Hi I tried it but it results on an error
from pysb import * from pysb.pathfinder import set_path from pysb.simulator import ScipyOdeSimulator set_path('bng', 'C:\Program Files\BNG') Model() Monomer('A',['a']) Observable('A_total', A()) Parameter('Hcoeff',1.0) Expression('kf_A', A_total*Hcoeff) Rule('bindA', A(a=None) + A(a=None) >> A(a=1) % A(a=1), kf_A) Parameter('A0',20) Initial(A(a=None),A0) simres = ScipyOdeSimulator(model, tspan=[0,20]).run()
This is the error I get:
AttributeError: 'str' object has no attribute 'args'
Is there some problem with my code?
Expression. It seems there is a problem when converting the model into ODEs. The solution, if you could read the conversation history, was export the model into kappa, edit by hand because the observable must be before the parameter that use the observable, and simulate the model using the command line (KaSim).
A, binding site
b, and phosphorylation site
Rule('r1', A(s='u') >> A(s='p'), kf). The left hand side of the rule,
A(s='u'), determines what's matched by the rule. Note that no binding site is included in that rule, so the phosphorylation will apply regardless if
Ais bound or not. If you want the phosphorylation reaction to only apply to
Aunits which are in complex, but you don't care what the binding partner is, you can use the
ANYkeyword to specify "any bond, but not unbound", i.e.
Rule('r2', A(b=ANY, s='u') >> A(b=ANY, s='p'), kf). For a worked example including the
ANYkeyword, see the egfr_simple model: https://github.com/pysb/pysb/blob/master/pysb/examples/bngwiki_egfr_simple.py
ScipyOdeSimulatorto run simulations, PySB must first pass the model through BioNetGen to generate the equations that then get passed to scipy and integrated.
Initialspecies concentrations. Or there may be an error in how your rules are defined. Check the
Initialdeclarations first and if that isn't the problem post your code here and we should be able to hunt down the problem.
s='u' >> s='p'can only happen if the
bsite is unbound, then
b=Nonemust be explicitly included in the rule even though it's not changed in the rule. We refer to conditions like this as "reaction context". The part of a rule that gets changed is called the "reaction center".
A(s='u', b=WILD)is equivalent to
A(s='u'). The reason this syntax exists even though it's redundant is that components can, in principle, carry both states and bonds at the same time. For example,
A(s='u', b=('x', 1))specifies an
Amolecule with an
scomponent in the
'u'state and a
bcomponent in the
xstate that is bound to something with a bond number
1. If one wants to write a rule that says
bmust be in the
xstate but it doesn't matter whether it's bound or not, the correct syntax would be
A(s='u', b=('x', WILD)). There's no other way to express this since
A(s='u', b='x')explicitly means
bis unbound and
bcan be in any state, even though excluding it from the rule means it can be bound or unbound. Hope this helps.
Hello, a quick question regarding the way PySB finds BNG2.pl. I have a testing machine with 2 testing environments for PySB (using Jupyter): one using pip and the other one using conda. Under the conda one I installed BioNetGen (from alubbock) but under the pip one I have not installed bionetgen. Still, under the pip environment, it finds the BNG2.pl executable installed under ~/miniconda3/bin. I checked using PySB.pathfinder.get_path('bng'). Is it expected behaviour? I looked at the code of the pathfinder module: does it "scan" the user home for a conda environment to locate the BNG2.pl file? Thanks a lot in advance.
EDIT: Forget it - I found the answer. When opening a Jupyter notebook, it sources my ~/.bashrc file, which was modified by 'conda init' to add 'miniconda3/bin' in my PATH. When installing BioNetGen under conda, it puts the executable under miniconda3/bin and therefore is used also in the pip environment.
im using pysb to setup a polymerisation reactions including this molecule at the start (bngl notation):
and this seed definition:
In python I write:
Monomer('PG', ['oh', 'oh'])
Initial(PG(oh=None, oh=None), 10)
This causes an error, because the 'oh' parameter is used twice in the 'Initial' function. What is the intended way to write this 'Initial' function?