Skip to content

Commit

Permalink
Fixes #192 (#193)
Browse files Browse the repository at this point in the history
* 0 and ∅ not added as species for user defined function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Change explicit list to self.nothing

* Fix merge conflict of last commit

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
formersbach and pre-commit-ci[bot] authored Sep 14, 2022
1 parent 0101941 commit 389d20b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions biomass/construction/reaction_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,12 @@ def user_defined(self, line_num: int, line: str) -> None:
for arrow in self.fwd_arrows:
if arrow in balance:
reactant, product = balance.split(arrow)
self._set_species(reactant.strip(), product.strip())
if reactant in self.nothing:
self._set_species(product.strip())
elif product in self.nothing:
self._set_species(product.strip())
else:
self._set_species(reactant.strip(), product.strip())
break
else:
raise ArrowError(f"line{line_num:d}: Use one of {', '.join(self.fwd_arrows)}.")
Expand All @@ -1845,8 +1850,8 @@ def user_defined(self, line_num: int, line: str) -> None:
)
self.kinetics.append(
KineticInfo(
(reactant,),
(product,),
() if reactant in self.nothing else (reactant,),
() if product in self.nothing else (product,),
() if modulators is None else (modulators),
rate_equation.replace("x[C.", "").replace("y[V.", "").replace("]", ""),
)
Expand Down

0 comments on commit 389d20b

Please sign in to comment.