Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior for reversible reaction #166

Closed
formersbach opened this issue Aug 5, 2022 · 8 comments
Closed

Unexpected behavior for reversible reaction #166

formersbach opened this issue Aug 5, 2022 · 8 comments
Labels
bug Something isn't working enhancement New feature or request text2model Text-to-model conversion

Comments

@formersbach
Copy link
Contributor

Description:

Text2Model of reversible reaction with one reactant and one product fails.

Reproduce:

Text file containing:

A + C <--> B
A <--> B

Convert to model:

from biomass import Text2Model
model = Text2Model("test.txt")
model.convert(overwrite=True)

Raises:

DetectionError
Unregistered words in line2: A <--> B

@formersbach formersbach added the bug Something isn't working label Aug 5, 2022
@formersbach
Copy link
Contributor Author

Hey @himoto could you take a look at this? Am I missing something or is this indeed a bug?

@formersbach
Copy link
Contributor Author

The same behavior appears for uni-directional reactions such as:

A --> B

@himoto
Copy link
Contributor

himoto commented Aug 5, 2022

Hi @formersbach,
This is NotImplementedError rather than a bug.
Currently, the arrows, e.g., <--> and --> are used for determining reaction directionality and specifying the name of the product in a reaction, not for identifying reaction rules.
Therefore in your example above Text2Model cannot choose which reaction rule to assign.
The solution is to use @rxn prefix:

@rxn A --> B: kfi * u[A]

And I think it would be dangerous to use arrows for identifying reaction rules, which will destroy Text2Model.

@formersbach formersbach added enhancement New feature or request and removed bug Something isn't working labels Aug 8, 2022
@formersbach
Copy link
Contributor Author

I see! But how can Text2Model identify the reaction rule for:

A + E <--> C + E

Is the plus symbol used to infer the reaction rule?

@himoto
Copy link
Contributor

himoto commented Aug 8, 2022

Yes, it is assigned for complex association and dissociation (see below).

# Words to identify reaction rules
rule_words: Dict[str, List[str]] = field(
default_factory=lambda: dict(
_bind_and_dissociate=[
" +",
],

Note that currently I do not allow to have the plus symbol in both left and right hand side of the arrow.
Therefore in your example above, if the reaction is unidirectional you can write:

@rxn A --> C: (rate depending on [E])

However, I found that the latest biomass does not raise any warning and errors.
This is a bug and I have fixed it in the kinetics branch. Can you please see it?

@himoto himoto added bug Something isn't working text2model Text-to-model conversion labels Aug 8, 2022
@formersbach formersbach added bug Something isn't working and removed bug Something isn't working labels Aug 15, 2022
@formersbach
Copy link
Contributor Author

Note that currently I do not allow to have the plus symbol in both left and right hand side of the arrow.

Correctly raises "Cannot put the plus symbol in both left and right hand side of arrow" error!

Currently, the arrows, e.g., <--> and --> are used for determining reaction directional and specifying the name of the product in a reaction, not for identifying reaction rules.

Wouldn't it make sense to use simple mass action kinetics by default? At least the other modelling programs I've used do it like that, so it was quite unexpected.
Would it be possible to implement mass action kinetics as the default when reaction rules are not infer-able?
E.g. if no words indicating a reaction are found try to assign reactants and products (if it fails raise error) and then construct mass action equation with them.

@himoto
Copy link
Contributor

himoto commented Aug 15, 2022

Would it be possible to implement mass action kinetics as the default when reaction rules are not infer-able?
E.g. if no words indicating a reaction are found try to assign reactants and products (if it fails raise error) and then construct mass action equation with them.

This sounds reasonable. To be able to describe simple state transition via arrows, I added state_transition rule in progress at PR #169. I confirmed that this worked fine with the EGFR signaling model:

EGF + EGFR <--> Ra | kf=0.003, kr=0.06 | EGFR=100
Ra + Ra <--> R2 | kf=0.01, kr=0.1
R2 <--> RP | kf=1, kr=0.01
RP is dephosphorylated --> R2 | V=450, K=50
RP + PLCg <--> RPL | kf=0.06, kr=0.2 | PLCg=105
RPL <--> RPLP | kf=1, kr=0.05
RPLP <--> RP + PLCgP | kf=0.3, kr=0.006
PLCgP is dephosphorylated --> PLCg | V=1, K=100
RP + Grb2 <--> RG | kf=0.003, kr=0.05 | Grb2=85
RG + SOS <--> RGS | kf=0.01, kr=0.06 | SOS=34
RGS <--> RP + GS | kf=0.03, kr=4.5e-3
GS <--> Grb2 + SOS | kf=1.5e-3, kr=1e-4
RP + Shc <--> RSh | kf=0.09, kr=0.6 | Shc=150
RSh <--> RShP | kf=6, kr=0.06
RShP <--> ShP + RP | kf=0.3, kr=9e-4
ShP is dephosphorylated --> Shc | V=1.7, K=340
RShP + Grb2 <--> RShG | kf=0.003, kr=0.1
RShG <--> RP + ShG | kf=0.3, kr=9e-4
RShG + SOS <--> RShGS | kf=0.01, kr=2.14e-2
RShGS <--> ShGS + RP | kf=0.12, kr=2.4e-4
ShP + Grb2 <--> ShG | kf=0.003, kr=0.1
ShG + SOS <--> ShGS | kf=0.03, kr=0.064
ShGS <--> ShP + GS | kf=0.1, kr=0.021
RShP + GS <--> RShGS | kf=0.009, kr=4.29e-2
PLCgP is translocated to cytoskeletal or membrane structures <--> PLCgP_I | kf=1, kr=0.03

@himoto
Copy link
Contributor

himoto commented Aug 18, 2022

I have fixed this issue in #169

@himoto himoto closed this as completed Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request text2model Text-to-model conversion
Projects
None yet
Development

No branches or pull requests

2 participants