librelist archives

« back to archive

comparison of PyDSTool with PySB

comparison of PyDSTool with PySB

From:
Jeremy Muhlich
Date:
2013-09-05 @ 12:49
Someone recently asked my how PyDSTool compares to PySB. Here is my 
response, in case it is useful to anyone else:

I have only briefly examined PyDSTool, but as I recall it only supports 
direct creation of dynamical systems variable-by-variable. PySB on the 
other hand is rooted in so-called "rules-based modeling" which is a sort 
of agent-based approach, with agents designed to model proteins and 
their interactions. Our best-supported simulator turns the model into a 
system of deterministic ODEs, and we're working on better support for 
some stochastic simulators. You can read more about rules-based modeling 
by looking into BioNetGen (bionetgen.org) and Kappa (kappalanguage.org).

Furthermore, in PyDSTool you have to define your math inside Python 
strings. PySB however uses a lot of operator overloading so that you 
never have to encode things in a string like that. Every expression you 
write in the course of defining a model is straight Python. The benefit 
to this is that you can use the entire Python programming toolbox when 
building up your model, rather than being forced to munge strings. The 
PySB macro system is basically just a few conventions on top of plain 
old Python functions.

Re: comparison of PyDSTool with PySB

From:
Rob Clewley
Date:
2014-06-13 @ 21:14
Hi Jeremy and PySB users,

I recently came across this post and wanted to clarify a couple of
points about PyDSTool. I am the designer and lead dev on PyDSTool, and
I've chatted with
Peter a few times before about software tools.

On 2013-09-05, Jeremy Muhlich wrote:

> I have only briefly examined PyDSTool, but as I recall it only supports
> direct creation of dynamical systems variable-by-variable. PySB on the
> other hand is rooted in so-called "rules-based modeling" which is a sort
> of agent-based approach, with agents designed to model proteins and
> their interactions. Our best-supported simulator turns the model into a
> system of deterministic ODEs, and we're working on better support for
> some stochastic simulators. You can read more about rules-based modeling
> by looking into BioNetGen (bionetgen.org) and Kappa (kappalanguage.org).
>
> Furthermore, in PyDSTool you have to define your math inside Python
> strings. PySB however uses a lot of operator overloading so that you
> never have to encode things in a string like that. Every expression you
> write in the course of defining a model is straight Python. The benefit
> to this is that you can use the entire Python programming toolbox when
> building up your model, rather than being forced to munge strings. The
> PySB macro system is basically just a few conventions on top of plain
> old Python functions.

PyDSTool's creation of a DS "variable by variable" is just one common
method to define variables using strings. It is fair to say that there
are no existing templates to convert SB rules into the equations, but
they can either be imported through SBML for use in PyDSTool, or
macro/class templates along the lines of those in the neural toolbox
PyDSTool/Toolbox/neuralcomp.py can be used to do just that kind of
definition. Indeed, the tests/ModelSpec.py and other scripts there use
these templates, which internally define dV/dt for the membrane
potential based on the sum of current terms that are automatically and
internally defined after declaration of ion channel (Python) objects
(i.e., agent-like objects). In particular, this means that there is a
whole hierarchy of symbolic and model component classes available to
build equations using overloaded operators in native Python (see
Symbolic.py, ModelSpec.py and ModelConstructor.py). Another example
can be seen in Tutorial_SymbolicJac.py
(http://www.ni.gsu.edu/~rclewley/PyDSTool/Tutorial/Tutorial_SymbolicJac.html)
and these model specification constructs can be combined arbitrarily.

I realize that the PyDSTool documentation is quite lacking in some
areas, so it may have been easy for you to miss these options and
capabilities.

If you have further opportunity to play with PyDSTool, and would like
to provide more feedback about how I could improve its support for
working with SB models and your analytical needs, I would love to
help. I am interested in discussing possible ways to support for
agent-based rule generation for helping PySB users have access to
PyDSTool capabilities.

Regards,
Rob

-- 
Robert Clewley, Ph.D.
Assistant Professor
Neuroscience Institute and
Department of Mathematics and Statistics
Georgia State University
PO Box 5030
Atlanta, GA 30302, USA

tel: 404-413-6420 fax: 404-413-5446
http://neuroscience.gsu.edu/rclewley.html

Re: [pysb] Re: comparison of PyDSTool with PySB

From:
Jeremy Muhlich
Date:
2014-06-19 @ 19:55
Hi Rob,

Thanks for the long and thoughtful reply.

I stand corrected regarding PyDSTool and I appreciate your explanation of
the true possibilities. The real distinction I was trying to point out is
that PySB (and other "rule-based modeling" systems biology modeling tools)
provides an agent-based formalism to manage the combinatorial complexity
that is specifically encountered in cell signaling processes. For example
if we wish to model protein A binding to protein B using mass-action
kinetics, it is easy to construct a system of 3 ODEs for the concentrations
of A, B and the A:B complex. Likewise for a system in which B binds to
another protein C. However the composition of those two systems (assuming
B's interactions with A and C are independent of each other) introduces a
third "emergent" species, A:B:C, and two more reactions leading to its
production. It is certainly feasible to work out the proper set of ODEs,
however it is tedious and error-prone especially as the scope of a model
grows. The rule-based approach lets one describe "protein" entities with
named reaction sites, and pattern-based reaction rules that act on those
proteins. The protein and rule definitions are then processed by a rules
"engine", one possible output of which is a completely enumerated dynamical
system. In a rule-based model of our A/B/C system, we would only need to
define A, B, C and two rules for A+B->A:B and B+C->B:C. The engine would
then automatically infer the existence of the species A:B:C and the four
possible reactions, and generate the DS. The amount of work that has gone
into these rule engines (and there are only a couple of them) is
substantial! See our 2011 News & Views article in Nature Methods for more:
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3100653/ .

It seems to me like the best plan for cooperation between PySB and PyDSTool
would be a function for translating a PySB-generated DS directly into a
PYDSTool.Generator.ODEsystem, without even going through SBML as an
intermediary. Something like this:

   my_pysb_model = ...
   ode = pysb.util.as_pydstool(my_pysb_model)
   traj = ode.compute...
   pts  = traj.sample...

That way we could use PySB for its strengths in construction of cell
signaling DSes, and also have ready access to the wealth of analysis tools
available in PyDSTool.

 -- Jeremy


On Fri, Jun 13, 2014 at 5:14 PM, Rob Clewley <rob.clewley@gmail.com> wrote:

> Hi Jeremy and PySB users,
>
> I recently came across this post and wanted to clarify a couple of
> points about PyDSTool. I am the designer and lead dev on PyDSTool, and
> I've chatted with
> Peter a few times before about software tools.
>
> On 2013-09-05, Jeremy Muhlich wrote:
>
> > I have only briefly examined PyDSTool, but as I recall it only supports
> > direct creation of dynamical systems variable-by-variable. PySB on the
> > other hand is rooted in so-called "rules-based modeling" which is a sort
> > of agent-based approach, with agents designed to model proteins and
> > their interactions. Our best-supported simulator turns the model into a
> > system of deterministic ODEs, and we're working on better support for
> > some stochastic simulators. You can read more about rules-based modeling
> > by looking into BioNetGen (bionetgen.org) and Kappa (kappalanguage.org).
> >
> > Furthermore, in PyDSTool you have to define your math inside Python
> > strings. PySB however uses a lot of operator overloading so that you
> > never have to encode things in a string like that. Every expression you
> > write in the course of defining a model is straight Python. The benefit
> > to this is that you can use the entire Python programming toolbox when
> > building up your model, rather than being forced to munge strings. The
> > PySB macro system is basically just a few conventions on top of plain
> > old Python functions.
>
> PyDSTool's creation of a DS "variable by variable" is just one common
> method to define variables using strings. It is fair to say that there
> are no existing templates to convert SB rules into the equations, but
> they can either be imported through SBML for use in PyDSTool, or
> macro/class templates along the lines of those in the neural toolbox
> PyDSTool/Toolbox/neuralcomp.py can be used to do just that kind of
> definition. Indeed, the tests/ModelSpec.py and other scripts there use
> these templates, which internally define dV/dt for the membrane
> potential based on the sum of current terms that are automatically and
> internally defined after declaration of ion channel (Python) objects
> (i.e., agent-like objects). In particular, this means that there is a
> whole hierarchy of symbolic and model component classes available to
> build equations using overloaded operators in native Python (see
> Symbolic.py, ModelSpec.py and ModelConstructor.py). Another example
> can be seen in Tutorial_SymbolicJac.py
> (
> http://www.ni.gsu.edu/~rclewley/PyDSTool/Tutorial/Tutorial_SymbolicJac.html
> )
> and these model specification constructs can be combined arbitrarily.
>
> I realize that the PyDSTool documentation is quite lacking in some
> areas, so it may have been easy for you to miss these options and
> capabilities.
>
> If you have further opportunity to play with PyDSTool, and would like
> to provide more feedback about how I could improve its support for
> working with SB models and your analytical needs, I would love to
> help. I am interested in discussing possible ways to support for
> agent-based rule generation for helping PySB users have access to
> PyDSTool capabilities.
>
> Regards,
> Rob
>
> --
> Robert Clewley, Ph.D.
> Assistant Professor
> Neuroscience Institute and
> Department of Mathematics and Statistics
> Georgia State University
> PO Box 5030
> Atlanta, GA 30302, USA
>
> tel: 404-413-6420 fax: 404-413-5446
> http://neuroscience.gsu.edu/rclewley.html
>