Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    lu-250
    @lu-250
    the rule I was trying to create basically states all complex with the monomer will self phosphorylated from 'u' to 'p'
    Alex Lubbock
    @alubbock
    @lu-250 The general pattern for this, with a monomer A, binding site b, and phosphorylation site s, is 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 A is bound or not. If you want the phosphorylation reaction to only apply to A units which are in complex, but you don't care what the binding partner is, you can use the ANY keyword 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 ANY keyword, see the egfr_simple model: https://github.com/pysb/pysb/blob/master/pysb/examples/bngwiki_egfr_simple.py
    lu-250
    @lu-250
    Got it. Thank you so much ! much simpler than what i have in mind. @alubbock
    lu-250
    @lu-250
    just to make sure I understand it right, for your r1 example, if the rule only apply to monomer, not in complex, then the binding site need to be explicitly stated in rule as rule('r1', A(s = 'u', b = None) >> A (s = 'p', b = None), kf) , even though the binding site is not directly involved or changed in the reaction. Am I right ?
    lu-250
    @lu-250
    and basically A(s = 'u') is the same as A(s = 'u', b = WILD), right ?
    Thank you so much !
    lu-250
    @lu-250
    thus Rule('r1', A(s = 'u') >> A(s = 'p'), kf) is equivalent to Rule('r1', A(s = 'u', b = WILD) >> A(s = 'p', b = WILD), kf)
    davemasnou
    @davemasnou
    image.png
    Hello everyone, I have created a model using PySB for the first time, and following the example detailed on the docs. When I try to run the model in IPython, the error mesasge of the image I have uploaded above appears, and I can't find any information about what it means. I would appreciate a lot if you could help me handle this error, thanks a lot!
    Rodrigo Santibáñez
    @glucksfall
    Hello @davemasnou, could you share your code with us?
    Eric Fernandez
    @zebulon2
    Hello, I am using PySB through the indra project. The installation document say PySB requires BioNetGen to export models to SBML. Strangely, I am able to generate SBML files without BioNetGen installed, only python-libsbml. Am I missing something? Or do I misunderstand the BioNetGen requirements? Thanks a lot in advance!
    Rodrigo Santibáñez
    @glucksfall
    I think you only need BioNetGen to simulate a BNGL model using ODE, SSA, NF, PLA
    Eric Fernandez
    @zebulon2
    Hi Rodrigo, many thanks for your answer. However using ScipyOdeSimulator from pysb does not require BNGL as far as I could test.
    Eric Fernandez
    @zebulon2
    I find out I can run this code: bngl_model = export(model, 'bngl') and produce a BNGL model. However I understand that without BNGL installed, I cannot simulate it. But I can simulate with pysb.simulator any other compatible format?
    Eric Fernandez
    @zebulon2
    I think I now understand the requirements: BNGL is only required by BngSimulator but other simulators such as ScipyOdeSimulator can be used (here the reuqirement being Scipy). Am I correct, or are there other requirements?
    Leonard Harris
    @lh64
    @zebulon2 BioNetGen is used by PySB to generate the reaction network from the rules defined in the model. So, even when using ScipyOdeSimulator to run simulations, PySB must first pass the model through BioNetGen to generate the equations that then get passed to scipy and integrated.
    pysb_workflow.jpeg
    You can see the relationship between PySB and BioNetGen in the above workflow, which is from the original PySB paper (https://doi.org/10.1038/msb.2013.1)
    Leonard Harris
    @lh64
    For SBML export, it's true that PySB can export to SBML directly but SBML is a "flat" language, which means that the rules in PySB (composed of structured "patterns") must first be converted into reactions (composed of structureless "species"). This is done by BioNetGen in the network generation step described above and is why BioNetGen is a requirement.
    I hope this makes sense. If you have any other questions, please let us know.
    @davemasnou That error is coming from BioNetGen and means it wasn't able to create a reaction network from the rules defined in the PySB model. That could be because you didn't define any Initial species concentrations. Or there may be an error in how your rules are defined. Check the Initial declarations first and if that isn't the problem post your code here and we should be able to hunt down the problem.
    Leonard Harris
    @lh64
    @lu-250 To answer your last few questions, yes, if the state change s='u' >> s='p' can only happen if the b site is unbound, then b=None must 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".
    Leonard Harris
    @lh64
    And yes, 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 A molecule with an s component in the 'u' state and a b component in the x state that is bound to something with a bond number 1. If one wants to write a rule that says b must be in the x state 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 b is unbound and A(s='u') says b can be in any state, even though excluding it from the rule means it can be bound or unbound. Hope this helps.
    Alex Lubbock
    @alubbock
    Thanks for chiming in @lh64 - I seem to not always get notified when there are new gitter messages - I'll look into that.
    PySB v1.12 was released yesterday, see the release notes for details. To upgrade:
    • pip users: pip install --upgrade pysb
    • conda users: conda upgrade -c alubbock pysb
    Eric Fernandez
    @zebulon2
    @lh64 Thanks a lot.
    Eric Fernandez
    @zebulon2

    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.

    Eric Fernandez
    @zebulon2
    A good way to be in control I suppose is to set the BNG path using pysb.pathfinder. Curiously the documentation for pysb does not mention this, only the pysb-alubbock documentation. Is it supposed to be that way (not a criticism there!)
    Eric Fernandez
    @zebulon2
    Note there is now a bionetgen package under pip: https://pypi.org/project/bionetgen/ so for those who cannot install conda (such as restricted/professional environments). However contrary to the bionetgen-alubbock package, one has to set the path for pysb to work, this not not automatically detected. It is installed in the <env_name>/lib/python3.8/site-packages/bionetgen/bng-linux/ folder along with the package.
    jscov
    @jscov
    Dear all,

    im using pysb to setup a polymerisation reactions including this molecule at the start (bngl notation):

    PG(oh,oh)

    and this seed definition:

    PG(oh,oh) 10

    In python I write:

    Monomer('PG', ['oh', 'oh'])

    and:

    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?

    jscov
    @jscov

    I found the solution by taking a look into the source code:

    Monomer('PG', ['oh', 'oh'])
    Initial(PG(oh=MultiState(None, None)), 10)

    junhag2
    @junhag2

    Dear all,

    I have a couple questions regarding to run bngl simulation with pysb, and also to use stochkit.
    I am currently running stochastic simulation of gene regulatory network. I did it in bionetgen and for the same time range, my simulation actually ran pretty fast(each run takes less than 5s).

    However, when I used pysb bnglsimulator or stochkitsimulator, simulation could not finish in more than half an hour (I killed the process). For bnglsimulator, background process "run_network.exe" has been running for quite a while. For stochkitsimulatior, it called three other processes: ssa.exe, ssa_direct_small.exe, ssa_direct_serial_small.exe. And it seems like only the last one was running.

    I noticed that in pysb, it requires time range (example used linspace to generate number of time points), does that mean pysb simulator uses fixed time step simulator, or this is just the time point where output data is kept (at least that is what stochkit documentation says)?

    Also, my laptop is on Windows, and I use anaconda python. I noticed that anaconda does not have windows compatible stochkit packages (do have stochkit-lite), but I can download stochkit from sourgeforge. To utilize this full version stochkit in windows, do I just copy the unzipped stochkit folder to where anaconda manages packages?

    Further question about stochkit, I noticed there is cupSODA for runninng ODE on GPU, is there any equivalent version for running stochastic simulation?

    Thank you
    Best,
    Junhao

    Rodrigo Santibáñez
    @glucksfall
    Hi @junhag2
    Could you export the model and then use BNGL and stochkit? Also note that BNG can do ODE and SSA simulations: BngSimulator(model, linspace(start, finish, points+1)).run(method = 'ode').dataframe and BngSimulator(model, linspace(start, finish, points+1)).run(method = 'ssa', n_runs = n_runs).dataframe (with start/finish the initial/final time points to report)
    Leonard Harris
    @lh64
    Hi @junhag2. For stochastic simulations, PySB uses the BNG SSA simulator, so it should give you basically identical results. Can you share your model or the run commands that you used and the screen output that you got when running with PySB? That will help identify what the problem might be.
    It might help to share the BNGL model file too, just to make sure that there's not an issue with translating the model over to PySB that's causing the problem
    Rodrigo Santibáñez
    @glucksfall
    I have the doubt with the scipy ODE integrator, but all stochastic simulators are variable-step integrators. And BNG uses CVODE that is variable-step ODE integrator.
    Alex Lubbock
    @alubbock
    Hi @junhag2 - to answer your question about downloading stochkit from sourceforge. Yes, you can download it and use it with PySB by calling pysb.pathfinder.set_path('stochkit_ssa', path)with the appropriate path (or alternatively, by setting the STOCHKITPATH environment variable).
    lu-250
    @lu-250
    quick question about pysb: if the same rule is added twice to the model, will it be overwrited results as a single rule or it will be modeled twice ? Thanks a lot !
    Leonard Harris
    @lh64
    @lu-250 If you try to add a rule twice that has the same name, PySB will throw an error. But if the rules have different names, they will both be kept, even if they are identical. When the model is passed to BioNetGen, the two rules will then be combined into one and the rate constant will be multiplied by 2. So, you should definitely be careful to make sure that this is the desired behavior. If not, you'll need to make sure not to repeat the rule in your model.
    lu-250
    @lu-250
    got it. Thanks a lot !
    saubhagya-gatech
    @saubhagya-gatech
    Hello Forum members,
    I am a pyDream user. I have some questions about how Gamma values affect acceptance rate. In the original DREAM(ZS) MATLAB code, the parameter beta0 (Scaling factor jump rate) scales the gamma thus provide direct control of the jump size. Therefore, one can decrease jump size to potentially enhance acceptance rate. In PyDream, since there is no such parameter as beta0, I believe gamma levels does the similar job. The source code discusses gamma probabilities which is calculated from gamma_level provided by user. How is this gamma probability (or gamma level) impact jump sizes? What role does adapt_gamma option play here? How do adapt_gamma option interact with gamma_level option. I will appreciate any help in this regard.
    Alex Lubbock
    @alubbock
    M1 Mac users: I've built releases of BioNetGen, NFsim, and Kappa for M1, which in turn allows a single, native conda environment for PySB:
    Install miniforge or mambaforge from here: https://github.com/conda-forge/miniforge
    Install PySB: conda install -c alubbock pysb
    Note that using miniconda or Anaconda distributions will only work through emulation (Rosetta 2), not natively. No Atomizer or Stochkit support yet, however.
    junhag2
    @junhag2
    A quick question for comparison of pysb and bionetgen. In bionetgen, when the state of molecule is unspecified, the simulator would automatically consider all the molecules with possible state. In pysb, the documentation says that monomer in rules must have specific state, does that mean it can not have the feature as in bionetgen? Or state "None" is equivalent of any state?
    Leonard Harris
    @lh64
    @junhag2 None in PySB is equivalent to no state specified in BioNetGen
    For example, M(x=None) in PySB would be written as M(x) in BNG
    junhag2
    @junhag2
    @lh64 Thank you. That answers my question.
    rAntonioH
    @rAntonioh
    hello again, is there a way to print out the ODEs that are created from my model?
    Alex Lubbock
    @alubbock
    Yes, after network generation has taken place (either explicitly or by simulating the model), run print(list(model.odes))