synbiopython.genbabel.sbmlgen

Synbiopython (c) Global BioFoundry Alliance 2020

Synbiopython is licensed under the MIT License.

This module is to create SBML file for ODE model using simplesbml package, which relies on libSBML.

Reference:

https://github.com/sys-bio/simplesbml

class synbiopython.genbabel.sbmlgen.SBMLgen.SBMLgen[source]

Bases: object

Class to generate SBML file for ODE model.

static export_sbml(ODE, Variable, Init, ParamName, Param, ParamUnit, **kwargs)[source]

Function to generate the SBML xml file.

Parameters
  • ODE (list) – The ODEs in the form of string stored in a list

  • Variable (list) – The names of variable in a list of string

  • Init (list) – Initial conditions for the variables in a list of values

  • ParamName (list) – The names of the parameters stored in a list

  • Param (list) – The parameters values

  • ParamUnit (list) – The unit for the parameter according to available unit definition

Returns

SBML in str

Return type

str

This module is the simplesbml package from https://simplesbml.readthedocs.io/en/latest/ with minor modifications to include more unit definitions

Reference:

https://github.com/sys-bio/simplesbml/blob/master/simplesbml/__init__.py

class synbiopython.genbabel.sbmlgen.simplesbml.sbmlModel(time_units='second', extent_units='mole', sub_units='mole', level=3, version=1)[source]

Bases: object

Class to generate sbml model file using libsbml method.

addAssignmentRule(var, math)[source]

To assign a state variable with an expression.

Parameters
  • var (str) – id of the state variable

  • math (str) – expression in str

addCompartment(vol=1, comp_id='')[source]

Create compartment of volume litres to the model.

Parameters
  • vol (float) – volume of compartment in L

  • comp_id (str) – compartment id

addEvent(trigger, assignments, persistent=True, initial_value=False, priority=0, delay=0, event_id='')[source]

Add event supplied with when an event is triggered and what happens using assignments in a dictionary.

Parameters
  • trigger (str) – define when an event is triggered (logical expression)

  • assignments (dict) – keys are the variables to be modified and the values are the new values

  • persistent (boolean) – determine if the event will still be executed if trigger turns from True to False

  • initial_value (boolean) – value of trigger before t=0

  • priority (float) – determine which event is executed, event with larger priority is executed

  • delay (float) – time between when the event is triggered and the assignment is implemented

  • event_id (str) – id of the event

addInitialAssignment(symbol, math)[source]

Describe the initial value of the variable in terms of other variables or parameters.

Parameters
  • symbol (str) – id of the variable

  • math (str) – expression

addParameter(param_id, val, units='per_second')[source]

Add Parameter with value and unit.

Parameters
  • param_id (str) – parameter id/name

  • val (float) – value for the parameter

  • units (str) – unit for the parameter

addRateRule(var, math, rr_id='')[source]

Describe the derivative of the state variable wrt time as an expression.

Parameters
  • var (str) – id of the state variable

  • math (str) – expression in str

  • rr_id (str, optional) – id for the reaction rate

addReaction(reactants, products, expression, local_params=None, rxn_id='')[source]

Create reaction provided with reactants and products in lists

Parameters
  • reactants (list) – list of species id for reactants

  • products (list) – list of species id for products

  • expression (str) – reaction rate expression

  • local_params (dict) – keys are the param id and values are their respective values

  • rxn_id (str, optional) – id for the reaction

addSpecies(species_id, amt, comp='c1')[source]

Create Species with the provided amount.

Parameters
  • species_id (str) – id or name of the species.

  • amt (float) – initial amount.

  • comp (str) – compartment id

check(value, message)[source]

Return value to string using libsbml.

getCompartment(comp_id)[source]

Return compartment.

getDocument()[source]

Return document.

getEvent(event_id)[source]

Return event.

getInitialAssignment(var)[source]

Return initial assignment.

getListOfCompartments()[source]

Return list of compartments.

getListOfEvents()[source]

Return list of events.

getListOfInitialAssignments()[source]

Return list of initial assignments.

getListOfParameters()[source]

Return list of parameters.

getListOfReactions()[source]

Return list of reactions.

getListOfRules()[source]

Return list of rules.

getListOfSpecies()[source]

Return list of species.

getModel()[source]

Return Model.

getParameter(param_id)[source]

Return parameter.

getReaction(rxn_id)[source]

Return Reaction.

getRule(var)[source]

Return rule.

getSpecies(species_id)[source]

Return Species.

setLevelAndVersion(level, version)[source]

Set the level and version of the SBML.

Parameters
  • level (int) – level of the sbml

  • version (int) – version of the sbml

toSBML()[source]

Return the model in SBML format as strings.

synbiopython.genbabel.sbmlgen.simplesbml.writeCode(doc)[source]

Return string containing calls to functions that reproduce the model in SBML doc.

synbiopython.genbabel.sbmlgen.simplesbml.writeCodeFromFile(filename)[source]

Read the SBML format model and returns strings containing calls to functions to reproduce the model in an sbmlModel object.

synbiopython.genbabel.sbmlgen.simplesbml.writeCodeFromString(sbmlstring)[source]

Read sbmlstring as the SBML format model and return strings containing calls to functions to reproduce the model in an sbmlModel object.