Importing from other formats (pysb.importers)

pysb.importers.bngl.model_from_bngl(filename, force=False, cleanup=True)[source]

Convert a BioNetGen .bngl model file into a PySB Model.

Parameters:

filename : string

A BioNetGen .bngl file

force : bool, optional

The default, False, will raise an Exception if there are any errors importing the model to PySB, e.g. due to unsupported features. Setting to True will attempt to ignore any import errors, which may lead to a model that only poorly represents the original. Use at own risk!

cleanup : bool

Delete temporary directory on completion if True. Set to False for debugging purposes.

Notes

The following features are not supported in PySB and will cause an error if present in a .bngl file:

  • Fixed species (with a $ prefix, like $Null)
  • BNG excluded or included reaction patterns (deprecated in BNG)
  • BNG local functions
  • Molecules with identically named sites, such as M(l,l)
  • BNG’s custom rate law functions, such as MM and Sat (deprecated in BNG)
pysb.importers.sbml.model_from_sbml(filename, force=False, cleanup=True, **kwargs)[source]

Create a PySB Model object from an Systems Biology Markup Language (SBML) file, using BioNetGen’s sbmlTranslator, which can attempt to extrapolate higher-level (rule-based) structure from an SBML source file (argument atomize=True). The model is first converted into BioNetGen language by sbmlTranslator, then PySB’s BnglBuilder class converts the BioNetGen language model into a PySB Model.

Parameters:

filename :

A Systems Biology Markup Language .sbml file

force : bool, optional

The default, False, will raise an Exception if there are any errors importing the model to PySB, e.g. due to unsupported features. Setting to True will attempt to ignore any import errors, which may lead to a model that only poorly represents the original. Use at own risk!

cleanup : bool

Delete temporary directory on completion if True. Set to False for debugging purposes.

**kwargs: kwargs

Keyword arguments to pass on to sbml_translator()

Notes

Read the sbmlTranslator documentation for further information on sbmlTranslator’s limitations.

pysb.importers.sbml.sbml_translator(input_file, output_file=None, convention_file=None, naming_conventions=None, user_structures=None, molecule_id=False, atomize=False, pathway_commons=False, verbose=False)[source]

Run the BioNetGen sbmlTranslator binary to convert SBML to BNGL

This function runs the external program sbmlTranslator, included with BioNetGen, which converts SBML files to BioNetGen language (BNGL).

Generally, PySB users don’t need to run this function directly; an SBML model can be imported to PySB in a single step with model_from_sbml(). However, users may wish to note the parameters for this function, which alter the way the SBML file is processed. These parameters can be supplied as **kwargs to model_from_sbml().

For more detailed descriptions of the arguments, see the sbmlTranslator documentation.

Parameters:

input_file : string

SBML input filename

output_file : string, optional

BNGL output filename

convention_file : string, optional

Conventions filename

naming_conventions : string, optional

Naming conventions filename

user_structures : string, optional

User structures filename

molecule_id : bool, optional

Use SBML molecule IDs (True) or names (False). IDs are less descriptive but more BNGL friendly. Use only if the generated BNGL has syntactic errors

atomize : bool, optional

Atomize the model, i.e. attempt to infer molecular structure and build rules from the model (True) or just perform a flat import (False)

pathway_commons : bool, optional

Use pathway commons to infer molecule binding. This setting requires an internet connection and will query the pathway commons web service.

verbose : bool or int, optional (default: False)

Sets the verbosity level of the logger. See the logging levels and constants from Python’s logging module for interpretation of integer values. False leaves the logging verbosity unchanged, True is equal to DEBUG.

Returns:

string

BNGL output filename