tellurium.roadrunner package

Submodules

tellurium.roadrunner.extended_roadrunner module

Extending the RoadRunner object with additional fields.

class tellurium.roadrunner.extended_roadrunner.ExtendedRoadRunner(*args, **kwargs)[source]

Bases: RoadRunner

bs()[source]

ExecutableModel.getBoundarySpeciesIds()

Returns a vector of boundary species Ids.

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

a list of boundary species ids.

draw(**kwargs)[source]

Draws an SBMLDiagram of the current model.

To set the width of the output plot provide the ‘width’ argument. Species are drawn as white circles (boundary species shaded in blue), reactions as grey squares. Currently only the drawing of medium-size networks is supported.

dv()[source]

RoadRunner::getRatesOfChange()

Returns the rates of change of all floating species. The order of species is given by the order of Ids returned by getFloatingSpeciesIds()

Returns:

a named array of floating species rates of change.

Return type:

numpy.ndarray

exportToAntimony(filePath, current=True)[source]

Save current model as Antimony file.

Parameters:
  • current (bool) – export current model state

  • filePath (str) – file path of Antimony file

exportToCellML(filePath, current=True)[source]

Save current model as CellML file.

Parameters:
  • current (bool) – export current model state

  • filePath (str) – file path of CellML file

exportToMatlab(filePath, current=True)[source]

Save current model as Matlab file. To save the original model loaded into roadrunner use current=False.

Parameters:
  • self (RoadRunner.roadrunner) – RoadRunner instance

  • filePath (str) – file path of Matlab file

exportToSBML(filePath, current=True)[source]

Save current model as SBML file.

Parameters:
  • current (bool) – export current model state

  • filePath (str) – file path of SBML file

fjac()[source]

RoadRunner.getFullJacobian()

Compute the full Jacobian at the current operating point.

This is the Jacobian of ONLY the floating species.

fs()[source]

ExecutableModel.getFloatingSpeciesIds()

Return a list of floating species sbml ids.

getAntimony(current=False)[source]

Antimony string of the original model loaded into roadrunner.

Parameters:

current (bool) – return current model state

Returns:

Antimony

Return type:

str

getBoundarySpeciesAmounts([index])

Returns a vector of boundary species amounts. The order of species is given by the order of Ids returned by getBoundarySpeciesIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of the boundary species amounts.

Return type:

numpy.ndarray.

given by the order of Ids returned by getBoundarySpeciesIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of the boundary species amounts.

Return type:

numpy.ndarray.

getBoundarySpeciesConcentrationIds()

Returns a vector of boundary species concentration Ids.

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

a list of boundary species ids.

getBoundarySpeciesConcentrations([index])

Returns a vector of boundary species concentrations. The order of species is given by the order of Ids returned by getBoundarySpeciesIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of the boundary species concentrations.

Return type:

numpy.ndarray.

given by the order of Ids returned by getBoundarySpeciesIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of the boundary species concentrations.

Return type:

numpy.ndarray.

getBoundarySpeciesIds()

Returns a vector of boundary species Ids.

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

a list of boundary species ids.

getCellML(current=False)[source]

CellML string of the original model loaded into roadrunner.

Parameters:

current (bool) – return current model state

Returns:

CellML string

Return type:

str

getCompartmentIds([index])

Returns a vector of compartment identifier symbols.

Parameters:

index (None or numpy.ndarray) – A array of compartment indices indicating which compartment ids to return.

Returns:

a list of compartment ids.

getCompartmentVolumes([index])

Returns a vector of compartment volumes. The order of volumes is given by the order of Ids returned by getCompartmentIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of compartment volumes.

Return type:

numpy.ndarray.

getConservedMoietyValues([index])

Returns a vector of conserved moiety volumes. The order of values is given by the order of Ids returned by getConservedMoietyIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of conserved moiety values.

Return type:

numpy.ndarray.

getCurrentAntimony()[source]

Antimony string of the current model state.

See also: getAntimony() :returns: Antimony string :rtype: str

getCurrentCellML()[source]

CellML string of current model state.

See also: getCellML() :returns: CellML string :rtype: str

getCurrentMatlab()[source]

Matlab string of current model state.

Parameters:

current (bool) – return current model state

Returns:

Matlab string

Return type:

str

getFloatingSpeciesAmounts([index])

Get the list of floating species amounts. If no arguments are given, this returns all floating species amounts.

Parameters:

index – an optional array of desired floating species indices. i.e. if this model has 4 floating species and we want the amounts for the last and first, we would use [3,0] for the index array.

get all the amounts:

>>> e.getFloatingSpeciesAmounts()
[15,2,3,20]

get amounts 3 and 0:

>>> getFloatingSpeciesAmounts([3,0])
[10,15]
getFloatingSpeciesConcentrationIds()

Return a list of floating species concentration ids.

getFloatingSpeciesConcentrations([index])

Returns a vector of floating species concentrations. The order of species is given by the order of Ids returned by getFloatingSpeciesIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of floating species concentrations.

Return type:

numpy.ndarray

getFloatingSpeciesIds()

Return a list of floating species sbml ids.

getGlobalParameterIds([index])

Return a list of global parameter ids.

Returns:

a list of global parameter ids.

getGlobalParameterValues([index])

Return a vector of global parameter values. The order of species is given by the order of Ids returned by getGlobalParameterIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of global parameter values.

Return type:

numpy.ndarray.

getMatlab(current=False)[source]

Matlab string of the original model loaded into roadrunner.

See also: getCurrentMatlab() :returns: Matlab string :rtype: str

getNumBoundarySpecies()

Returns the number of boundary species in the model.

getNumCompartments()

Returns the number of compartments in the model.

Return type:

int

getNumConservedMoieties()

Returns the number of conserved moieties in the model.

Return type:

int

getNumEvents()
getNumFloatingSpecies()

Returns the number of floating species in the model.

getNumGlobalParameters()

Returns the number of global parameters in the model.

getNumRateRules()
getNumReactions()

Returns the number of reactions in the model.

getReactionIds()

Returns a vector of reaction Ids.

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

a list of reaction ids.

getReactionRates([index])

Returns a vector of reaction rates (reaction velocity) for the current state of the model. The order of reaction rates is given by the order of Ids returned by getReactionIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of reaction rates.

Return type:

numpy.ndarray

Stoichiometry

getSeed(integratorName='gillespie')[source]

Current seed used by the integrator with integratorName. Defaults to the seed of the gillespie integrator.

Parameters:

integratorName (str) – name of the integrator for which the seed should be retured

Returns:

current seed

Return type:

float

gillespie(*args, **kwargs)[source]

Run a Gillespie stochastic simulation.

Sets the integrator to gillespie and performs simulation.

rr = te.loada ('S1 -> S2; k1*S1; k1 = 0.1; S1 = 40')
# Simulate from time zero to 40 time units using variable step sizes (classic Gillespie)
result = rr.gillespie (0, 40)
# Simulate on a grid with 10 points from start 0 to end time 40
rr.reset()
result = rr.gillespie (0, 40, 10)
# Simulate from time zero to 40 time units using variable step sizes with given selection list
# This means that the first column will be time and the second column species S1
rr.reset()
result = rr.gillespie (0, 40, selections=['time', 'S1'])
# Simulate on a grid with 20 points from time zero to 40 time units
# using the given selection list
rr.reset()
result = rr.gillespie (0, 40, 20, ['time', 'S1'])
rr.plot(result)
Parameters:
  • seed (int) – seed for gillespie

  • args – parameters for simulate

  • kwargs – parameters for simulate

Returns:

simulation results

plot(result=None, show=True, xlabel=None, ylabel=None, title=None, linewidth=2, xlim=None, ylim=None, logx=False, logy=False, xscale='linear', yscale='linear', grid=False, ordinates=None, tag=None, labels=None, figsize=(6, 4), savefig=None, dpi=80, alpha=1.0, **kwargs)[source]

Plot roadrunner simulation data.

Plot is called with simulation data to plot as the first argument. If no data is provided the data currently held by roadrunner generated in the last simulation is used. The first column is considered the x axis and all remaining columns the y axis. If the result array has no names, then the current r.selections are used for naming. In this case the dimension of the r.selections has to be the same like the number of columns of the result array.

Curves are plotted in order of selection (columns in result).

In addition to the listed keywords plot supports all matplotlib.pyplot.plot keyword arguments, like color, alpha, linewidth, linestyle, marker, …

sbml = te.getTestModel('feedback.xml')
r = te.loadSBMLModel(sbml)
s = r.simulate(0, 100, 201)
r.plot(s, loc="upper right", linewidth=2.0, lineStyle='-', marker='o', markersize=2.0,
       alpha=0.8, title="Feedback Oscillation", xlabel="time", ylabel="concentration",
       xlim=[0,100], ylim=[-1, 4])
Parameters:
  • result – results data to plot (numpy array)

  • show (bool) – show=True (default) shows the plot, use show=False to plot multiple simulations in one plot

  • xlabel (str) – x-axis label

  • ylabel (str) – y-axis label

  • title (str) – plot title

  • linewidth (float) – linewidth of the plot

  • xlim – limits on x-axis (tuple [start, end])

  • ylim – limits on y-axis

  • logx (bool) – use log scale for x-axis

  • logy (bool) – use log scale for y-axis

  • xscale – ‘linear’ or ‘log’ scale for x-axis

  • yscale – ‘linear’ or ‘log’ scale for y-axis

  • grid (bool) – show grid

  • ordinates – If supplied, only these selections will be plotted (see RoadRunner selections)

  • tag – If supplied, all traces with the same tag will be plotted with the same color/style

  • labels – ‘id’ to use species IDs

  • figsize – If supplied, customize the size of the figure (width,height)

  • savefig (str) – If supplied, saves the figure to specified location

  • dpi (int) – Change the dpi of the saved figure

  • alpha (float) – Change the alpha value of the figure

  • kwargs – additional matplotlib keywords like marker, lineStyle, …

ps()[source]

ExecutableModel.getGlobalParameterIds([index])

Return a list of global parameter ids.

Returns:

a list of global parameter ids.

rs()[source]

ExecutableModel.getReactionIds()

Returns a vector of reaction Ids.

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

a list of reaction ids.

rv()[source]

ExecutableModel.getReactionRates([index])

Returns a vector of reaction rates (reaction velocity) for the current state of the model. The order of reaction rates is given by the order of Ids returned by getReactionIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of reaction rates.

Return type:

numpy.ndarray

Stoichiometry

property seed

Getter for Gillespie seed.

setSeed(seed, integratorName='gillespie')[source]

Set seed in integrator with integratorName. Defaults to the seed of the gillespie integrator.

Raises Error if integrator does not have key ‘seed’.

Parameters:
  • seed – seed to set

  • integratorName (str) – name of the integrator for which the seed should be retured

show(reset=True)[source]

Show plot.

sm()[source]

RoadRunner.getFullStoichiometryMatrix()

Get the stoichiometry matrix that coresponds to the full model, even it it was converted via conservation conversion.

sv()[source]

ExecutableModel.getFloatingSpeciesConcentrations([index])

Returns a vector of floating species concentrations. The order of species is given by the order of Ids returned by getFloatingSpeciesIds()

Parameters:

index (numpy.ndarray) – (optional) an index array indicating which items to return.

Returns:

an array of floating species concentrations.

Return type:

numpy.ndarray

vs()[source]

ExecutableModel.getCompartmentIds([index])

Returns a vector of compartment identifier symbols.

Parameters:

index (None or numpy.ndarray) – A array of compartment indices indicating which compartment ids to return.

Returns:

a list of compartment ids.

Module contents