Open lh64 opened 9 years ago
@lh64 This has changed with pysb/pysb#317. Your synth/deg example above now gives the single BNGL rule:
synth_deg: A() <-> 0 k_deg, k_synth
If that's correct, we can close the ticket. One slight issue is that it doesn't get detected as a zero-order synthesis rule, so PySB needs an initial for A(), or it won't generate the network (assuming no other rules in the system). Is that something that needs changing?
Is it a PySB issue or a BNG issue? What happens if you write it as two separate rules: 0 >> A() and A() >> 0? Do you need an initial on A() in that case? I think BNG will generate a network in that case but I’m not certain. If it does, I’m not sure why it doesn’t if the rule is reversible.
It's a PySB issue. Rule.is_synth()
and Rule.is_deg()
weren't working properly for reversible rules. I've submitted a PR to fix it here: pysb/pysb#326
The reversible synthesis/degradation rule
should produce the following pair of BNGL rules:
However, it instead produces the single BNGL rule
This is obviously a problem since the synthesis rate erroneously depends on the concentration of the dummy species __sink().
Furthermore, reversing the order of the reactant and product in the rule, i.e.,
leads to the erroneous BNGL rule
where the reactant and product have been swapped but the rate constants have not.
These problems can be avoided by writing the synthesis and degradation rules as separate unidirectional rules or by using the macro 'synthesize_degrade_table([[A(), k_synth, k_deg]])'. Nevertheless, it makes sense to fix these problems. The best solution is probably to replace the source() and sink() species with BNG's null symbol '0'. This would avoid the need for any special handling in cases like this.