mobspy.sbml_simulator package — MobsPy 2.2 documentation

# mobspy.sbml_simulator package

## Submodules

## mobspy.sbml_simulator.SBMLWriter module

This module is responsible for converting a model_str into a SBML format

mobspy.sbml_simulator.SBMLWriter.check(value, message='error')

  If ‘value’ is None, prints an error message constructed using ‘message’ and then exits with status code 1. If ‘value’ is an integer, it assumes it is a libSBML return status code. If the code value is LIBSBML_OPERATION_SUCCESS, returns without further action; if it is not, prints an error message constructed using ‘message’ along with text from libSBML explaining the meaning of the code, and exits with status code 1.

mobspy.sbml_simulator.SBMLWriter.create_model(species={}, parameters={}, reactions={}, events={})

  Returns an SBML Level 3 model. Example: species = { ‘E’: 1,

  > ‘EM’: 0, ‘EM2’: 0, ‘F’: 100, },

  parameters = {‘k’: (1e-06,’per_min’),

    }

  reactions = { ‘Production_E’:

    > { ‘re’: [(1,’E’),(1,’F’)],

    >   ‘pr’: [(2,’E’)], ‘kin’ : ‘k * E * F’

    > },

    },

  events = {‘e’:
    { ‘trigger’: ‘true’,

      ‘delay’: ‘10’, ‘assignments’: [(‘M’,’1’),],

    },

  }

## mobspy.sbml_simulator.builder module

Picks and translates a python model into an SBML readable by Copasi. New models must be references here as well.

mobspy.sbml_simulator.builder.build(species, parameters, reactions, events)

  Constructs the sbml file for a model from the dictionary syntax for python sbml lib

  Parameters:

    - species – (dict) species as keys and counts as values

    - parameters – (dict) parameter name and value

    - reactions – (dict) reaction name and reaction in python sbml writer format

    - events – (dict) event name and event in python sbml writer format

  Returns:

    sbml_str (str) = string describing the model in sbml format

## mobspy.sbml_simulator.run module

mobspy.sbml_simulator.run.job_execution(params, models, jobs)

  This is defined for parallelism purposes Uses multiple cores from the processor to execute stochastic simulations

  Parameters:

    - params – (dict) = simulation parameters

    - models – (list) [{‘species_for_sbml’:, ‘parameters_for_sbml’:, ‘reactions_for_sbml’:, ‘events_for_sbml’:, ‘species_not_mapped’:, ‘mappings’:}]

    - jobs – (int) = number of cores to use, -1 for all available

  Returns:

    parallel_data data of all the individual simulations executed in parallel

mobspy.sbml_simulator.run.reformat_time_series(data)

  Transforms the _dot_ in from the results into .

  Parameters:

    data – (pd.dataframe) simulation data results from BasiCO

mobspy.sbml_simulator.run.simulate(jobs, list_of_params, models)

  This function coordinates the simulation by calling the necessary jobs In the future we hope to implement parallel cluster computing compatibility

  Parameters:

    - list_of_params – (dict) simulation parameters from the text file

    - models – (list) [{‘species_for_sbml’:, ‘parameters_for_sbml’:, ‘reactions_for_sbml’:, ‘events_for_sbml’:, ‘species_not_mapped’:, ‘mappings’:}]

  Returns:

    data (dict) = dictionary containing the resulting data from simulation

## Module contents