biocrnpyler.utils.sbmlutil

Functions

add_all_compartments(model, compartments, ...)

Adds the list of Compartment objects to the SBML model.

add_all_reactions(model, reactions[, stochastic])

Adds a list of reactions to the SBML model.

add_all_species(model, species, ...[, ...])

Adds a list of Species to the SBML model.

add_compartment(model, compartment, **kwargs)

Helper function to add a compartment to the SBML model.

add_parameter(mixture, name[, value, debug])

add_reaction(model, crn_reaction, reaction_id)

Adds a sbml_reaction to an sbml model.

add_species(model, compartment, ...[, ...])

Helper function to add a species to the sbml model.

create_sbml_model([compartment_id, ...])

Creates SBML Level 3 Version 2 model with some fixed standard settings.

find_parameter(mixture, id)

getAllIds(allElements)

getSpeciesByName(model, name[, compartment])

Returns a list of species in the Model with the given name.

get_compartment_by_name(model, compartment_name)

Find SBML compartment object from name in SBML file.

valid_sbml_id(given_id[, document])

validate_sbml(sbml_document[, ...])

Validates SBML model using libSBML SBML validation code.

Classes

SetIdFromNames(ids)

validateSBML(ucheck)

Class to validate the generated SBML models.

class biocrnpyler.utils.sbmlutil.SetIdFromNames(ids)[source]
__swig_destroy__(IdentifierTransformer self)
property thisown

The membership flag

transform(IdentifierTransformer self, SBase element) int[source]
biocrnpyler.utils.sbmlutil.add_all_compartments(model, compartments: List, **kwargs)[source]

Adds the list of Compartment objects to the SBML model.

Parameters:
modellibsbml.Model

Valid SBML model.

compartmentslist

List of compartments to be added to the SBML model.

biocrnpyler.utils.sbmlutil.add_all_reactions(model, reactions: List, stochastic=False, **kwargs)[source]

Adds a list of reactions to the SBML model.

Parameters:
modellibsbml.Model

An sbml model created by create_sbml_model().

reactionslist

List of Reactions.

stochasticbool

Binary flag for stochastic models.

biocrnpyler.utils.sbmlutil.add_all_species(model, species: List, initial_condition_dictionary: dict, compartment=None, **kwargs)[source]

Adds a list of Species to the SBML model.

Parameters:
modellibsbml.Model

Valid SBML model.

specieslist

List of species to be added to the SBML model.

initial_condition_dictionarydict

A dictionary s –> initial_concentration.

compartmentstr, optional

Compartment id, if empty species go to the first compartment.

biocrnpyler.utils.sbmlutil.add_compartment(model, compartment, **kwargs)[source]

Helper function to add a compartment to the SBML model.

Parameters:
modellibsbml.Model

A valid SBML model.

compartmentbcp.Compartment

A Compartment object.

Returns:
libsbml.Compartment

SBML compartment object.

biocrnpyler.utils.sbmlutil.add_reaction(model, crn_reaction, reaction_id: str, stochastic: bool = False, reverse_reaction: bool = False, **kwargs)[source]

Adds a sbml_reaction to an sbml model.

Parameters:
modellibsbml.Model

An sbml model created by create_sbml_model().

crn_reactionbcp.Reaction

Must be a chemical_reaction_network.reaction object.

reaction_idstr

Unique id of the reaction.

stochasticbool

Stochastic model flag.

reverse_reactionbool
Returns:
libsbml.Reaction

SBML Reaction object.

biocrnpyler.utils.sbmlutil.add_species(model, compartment, species_name, species_id, initial_concentration=None, **kwargs)[source]

Helper function to add a species to the sbml model.

Parameters:
modellibsbml.Model
compartmentlibsbml.Compartment

A compartment in the SBML model.

species_namestr
species_idstr
initial_concentrationfloat, optional

Initial concentration of the species in the SBML model.

Returns:
libsbml.Species

SBML species object.

biocrnpyler.utils.sbmlutil.create_sbml_model(compartment_id='default', time_units='second', extent_units='mole', substance_units='mole', length_units='metre', area_units='square_metre', volume_units='litre', volume=1e-06, model_id=None, **kwargs)[source]

Creates SBML Level 3 Version 2 model with some fixed standard settings.

Refer to python-libsbml for more information on SBML API.

Parameters:
compartment_idstr
time_unitsstr
extent_unitsstr
substance_unitsstr
length_unitsstr
area_unitsstr
volume_unitsstr
volumefloat
model_idstr
Returns:
tuple

The SBMLDocument and the Model object as a tuple.

biocrnpyler.utils.sbmlutil.getSpeciesByName(model, name, compartment='')[source]

Returns a list of species in the Model with the given name.

Parameters:
compartmentstr, optional

Compartment name in which to look for the species.

biocrnpyler.utils.sbmlutil.get_compartment_by_name(model, compartment_name)[source]

Find SBML compartment object from name in SBML file.

class biocrnpyler.utils.sbmlutil.validateSBML(ucheck)[source]

Class to validate the generated SBML models.

validate(sbml_document, print_results=False)[source]

Validate an SBML document.

Parameters:
sbml_documentlibsbml.SBMLDocument

libSBML SBMLDocument object.

print_resultsbool

Print toggle for validation warnings.

biocrnpyler.utils.sbmlutil.validate_sbml(sbml_document, enable_unit_check=False, print_results=True)[source]

Validates SBML model using libSBML SBML validation code.