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
andSat
(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.
model_from_biomodels
(accession_no, force=False, cleanup=True, **kwargs)[source]¶ Create a PySB Model based on a BioModels SBML model
Downloads file from BioModels (https://www.ebi.ac.uk/biomodels-main/) and runs it through
model_from_sbml()
. See that function for further details on additional arguments and implementation details. Utilizes BioNetGen’s SBMLTranslator.Parameters: - accession_no : str
A BioModels accession number - the string ‘BIOMD’ followed by 10 digits, e.g. ‘BIOMD0000000001’. For brevity, just the last digits will be accepted as a string, e.g. ‘1’ is equivalent the accession number in the previous sentence.
- 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.
Examples
>>> from pysb.importers.sbml import model_from_biomodels >>> model = model_from_biomodels('1') >>> print(model) <Model 'pysb' (monomers: 12, rules: 17, parameters: 37, expressions: 0, ...
-
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
tomodel_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