RuleWorld / bionetgen

Rule-based modeling framework
https://bionetgen.org/
MIT License
59 stars 25 forks source link

Handling of reversible reaction across compartments #232

Open dweindl opened 3 years ago

dweindl commented 3 years ago

Hi, I am having trouble understanding how BioNetGen processes the following model:

model.bngl

begin model
begin parameters
  k1                 2
  k2                 3
end parameters

begin compartments
  C1  3  1
  C2  2  1  C1
  C3  3  1  C2
end compartments

begin molecule types
  A()
  C()
  B()
end molecule types

begin species
  A()@C1             1
  B()@C3             1
  C()@C3             1
end species

begin reaction rules
  R1: A()@C1 + B()@C3 <-> C()@C3   k1,k2
end reaction rules

end model

generate_network({overwrite=>1});

net file generated from BioNetGen2.6.0:

# Created by BioNetGen 2.6.0
begin parameters
    1 k1  2  # Constant
    2 k2  3  # Constant
end parameters
begin species
    1 @C1::A() 1
    2 @C3::B() 1
    3 @C3::C() 1
end species
begin reactions
    1 3 1,2 k2 #_reverse_R1
end reactions

I would have expected to see both the forward and reverse reaction instead of only the reverse reaction, i.e.:

begin reactions
    1 1,2 3 k1
    2 3 1,2 k2 #_reverse_R1
end reactions

Is this intended behaviour? Am I overlooking something? Thanks for your help.

ASinanSaglam commented 3 years ago

Molecules in two separate 3D containers can't bind (one is in C1 and the other is in C3), that's expected behavior. These types of reactions are generally done by first doing a compartment transfer on either of the molecules and then binding within the same compartment.

dweindl commented 3 years ago

Thanks. That explains why the forward reaction is not considered. I still don't quite get why the reverse reaction works then. "Un-binding" across two 3D compartments is okay? Feels somewhat counter-intuitive.

wshlavacek commented 3 years ago

The reverse reaction looks like a transfer reaction where a carrier is left behind

Sent from my iPhone

On Jul 22, 2021, at 9:08 AM, Daniel Weindl @.***> wrote:

 Thanks. That explains why the forward reaction is not considered. I still don't quite get why the reverse reaction works then. "Un-binding" across two 3D compartments is okay? Feels somewhat counter-intuitive.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jrfaeder commented 3 years ago

Formally, BNG uses only the reactant properties to determine whether a reaction can take place. Here, the criteria are that for a bimolecular reaction to take place the reactants must be in adjacent compartments, as Sinan has described above. For the reverse reaction, the reactant pattern requires only that the reactant species be in C3. Once that criterion is satisfied, the product species can be located anywhere, which enables transport across the compartmental hierarchy. Care should be exercised in using such rules in models because they clearly represent a non-elementary process, but it can at least be rationalized in some cases.

dweindl commented 3 years ago

Thanks @jrfaeder, that clarifies it. It would be super helpful if some kind of warning was emitted if impossible reactions are specified in a model.

jrfaeder commented 3 years ago

Interestingly, if the compartmental location of B is changed from C2 to C3, then both the forward and reverse reactions are generated, which is perhaps the originally expected behavior. In this case for the forward reaction, A and B are in adjacent compartments, so the reaction is allowed. As I think about this, I realize that in the original model the rule as written would never occur, so it would be appropriate and helpful to BNG to send a warning. We will look into that.

begin model
begin parameters
  k1                 2
  k2                 3
end parameters

begin compartments
  C1  3  1
  C2  2  1  C1
  C3  3  1  C2
end compartments

begin molecule types
  A()
  C()
  B()
end molecule types

begin species
  A()@C1             1
  B()@C2             1
  C()@C3             1
end species

begin reaction rules
  R1: A()@C1 + B()@C2 <-> C()@C3   k1,k2
end reaction rules

end model

generate_network({overwrite=>1})