BioNetGen integration (pysb.bng
)¶
-
class
pysb.bng.
BngBaseInterface
(model, verbose=False, cleanup=False, output_prefix=None, output_dir=None)[source]¶ Abstract base class for interfacing with BNG
-
action
(action, **kwargs)[source]¶ Generates code to execute a BNG action command
Parameters: action: string
The name of the BNG action function
kwargs: kwargs, optional
Arguments and values to supply to BNG
-
base_filename
¶ Returns the base filename (without extension) for BNG output files
-
bng_filename
¶ Returns the BNG command list (.bngl) filename (does not check whether the file exists)
-
model
¶ Convenience method to get the PySB model itself
Returns: PySB model used in BNG interface constructor
-
net_filename
¶ Returns the BNG network filename (does not check whether the file exists)
-
-
class
pysb.bng.
BngConsole
(model, verbose=False, cleanup=True, output_dir=None, output_prefix=None, timeout=30, suppress_warnings=False)[source]¶ Interact with BioNetGen through BNG Console
-
pysb.bng.
generate_equations
(model, cleanup=True, verbose=False)[source]¶ Generate math expressions for reaction rates and species in a model.
This fills in the following pieces of the model:
- odes
- species
- reactions
- reactions_bidirectional
- observables (just coefficients and species fields for each element)
-
pysb.bng.
generate_network
(model, cleanup=True, append_stdout=False, verbose=False)[source]¶ Return the output from BNG’s generate_network function given a model.
The output is a BNGL model definition with additional sections ‘reactions’ and ‘groups’, and the ‘species’ section expanded to contain all possible species. BNG refers to this as a ‘net’ file.
Parameters: model : Model
Model to pass to generate_network.
cleanup : bool, optional
If True (default), delete the temporary files after the simulation is finished. If False, leave them in place (in output_dir). Useful for debugging.
append_stdout : bool, optional
This option is no longer supported and has been left here for API compatibility reasons.
verbose : bool, optional
If True, print output from BNG to stdout.
-
pysb.bng.
run_ssa
(model, t_end=10, n_steps=100, param_values=None, output_dir=None, output_file_basename=None, cleanup=True, verbose=False, **additional_args)[source]¶ Simulate a model with BNG’s SSA simulator and return the trajectories.
Parameters: model : Model
Model to simulate.
t_end : number, optional
Final time point of the simulation.
n_steps : int, optional
Number of steps in the simulation.
param_values : vector-like or dictionary, optional
Values to use for every parameter in the model. Ordering is determined by the order of model.parameters. If not specified, parameter values will be taken directly from model.parameters.
output_dir : string, optional
Location for temporary files generated by BNG. If None (the default), uses a temporary directory provided by the system. A temporary directory with a random name is created within the supplied location.
output_file_basename : string, optional
This argument is used as a prefix for the temporary BNG output directory, rather than the individual files.
cleanup : bool, optional
If True (default), delete the temporary files after the simulation is finished. If False, leave them in place. Useful for debugging.
verbose: bool, optional
If True, print BNG screen output.
additional_args: kwargs, optional
Additional arguments to pass to BioNetGen