Skip to main content
. 2013 Feb 19;9:646. doi: 10.1038/msb.2013.1

Figure 1.

Figure 1

Creation and simulation of a ‘Hello World’ model in PySB. (A) Creation and deterministic simulation of a model using PySB. The call to
Model()
creates the
pysb.core.Model
object to which all subsequently declared components are added. The first block of code declares the molecule types, parameters, initial conditions, reversible reaction rule, and observable necessary for modeling and simulating the reversible binding of proteins
L
and
R
. The second block of code calls the
odesolve
function from the
pysb.integrate
module to generate and integrate the ODEs. The third block plots the simulated time course using the Matplotlib
plot
command. Numbers associated with the code blocks identify the correspondences between the code and the control flow shown in B. (B) Control flow for an ODE simulation of a PySB model. The columns ‘User,’ ‘PySB’, and ‘External Tools’ indicate the locus of control of each step in the process (boxes). The ‘Result’ column shows the result of each individual step: the gray box indicates results of steps that are internal to the call to
odesolve
, whereas the other results are visible to the user at the top level. After declaring the model elements as in A, the user calls
odesolve
, which generates the corresponding BNGL for the model, invokes BNG externally on the generated BNGL code to create the reaction network, parses the reaction network to generate the corresponding set of ODEs, and calls an external integrator (VODE) to generate the trajectories. The trajectories are returned to the user as a NumPy record array, where they are visualized with a call to the
plot
function from Matplotlib.