You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The keywords used as rule modifiers, such as DeleteMolecules and TotalRate are not being output to strings. The result is these keywords are deleted upon output by PyBNG, which creates a model with rules missing the keywords that is not equivalent to the model initially read by PyBNG. An example is provided in the attached bngl and python files. The bngl file has a rule with the DeleteMolecules keyword. When the model is read by PyBNG, the output of the rule does not contain the keyword.
test_deleteMolecules.bngl
begin model
begin parameters
kdl 0.03 #CBL degrades ZAP/SYK
end parameters
begin molecule types
A(State~UZAP~PZAP~SHP~uSYK~pSYK,CBL)
Zeta(receptor,ITAM1~U~PP,ITAM2~U~PP,ITAM3~U~PP,ITAM4~U~PP,ITAM5~U~PP,ITAM6~U~PP)
CBL(site)
dead()
end molecule types
begin seed species
A(State~UZAP,CBL) 1
Zeta(receptor,ITAM1~U,ITAM2~U,ITAM3~U,ITAM4~U,ITAM5~U,ITAM6~U) 1
CBL(site) 1
end seed species
begin reaction rules
CBL_degrade_ITAM1: Zeta(ITAM1!1).A(State!1,CBL!3).CBL(site!3) -> dead() kdl DeleteMolecules
end reaction rules
end model
writeModel({suffix=>"changed",evaluate_expressions=>1,overwrite=>1})
It turns out that because of differences between BNGL and its translation to XML (which is what PyBNG uses to create objects), the assignment of keywords to rules can be tricky. The omission of the DeleteMolecules keyword above occurs because of the specific logic of the code that parses the xml version of the model (starting at bionetgen/modelapi/xmlparsers.py line 701) requires that only one instance of the Delete operation occur in the rule. If there are multiple instances, as in the example above, the keyword is not assigned to the rule. This is clearly incorrect, because the DeleteMolecules attribute is set in BNGL at the rule level, so all Delete operations in the rule inherit this attribute. Therefore, if there are multiple Delete operations, as above, each of them will have the DeleteMolecules keyword. However, the test at line 705,
ifnotisinstance(del_op, list):
only allows the keyword to be set if there is only one Delete operation present.
This points to a clear locus in the code to fix, but we are still working at present to make sure we get the logic of the new code correct.
A concrete example is provided by the following rule:
dZeta: Zeta() -> dead() kdl DeleteMolecules
For this rule the rule operations include only one Delete, and the DeleteMolecules keyword is correctly associated with the rule.
Commit 49625c2 fixes the issue described above but I'm going to leave this issue open because I am not convinced the current code will handle rules that use multiple keywords.
The keywords used as rule modifiers, such as
DeleteMolecules
andTotalRate
are not being output to strings. The result is these keywords are deleted upon output by PyBNG, which creates a model with rules missing the keywords that is not equivalent to the model initially read by PyBNG. An example is provided in the attached bngl and python files. The bngl file has a rule with theDeleteMolecules
keyword. When the model is read by PyBNG, the output of the rule does not contain the keyword.test_deleteMolecules.bngl
run_pybng.py
The text was updated successfully, but these errors were encountered: