Tellurium Notebook Tutorial

The Tellurium notebook environment is a self-contained Jupyter-like environment based on the nteract project. Tellurium adds special cells for working with SBML and COMBINE archives by representing these standards in human-readable form.

Tellurium also features a variety of Python packages, such as the libroadrunner simulator, designed to provide a complete biochemical network modeling environment using Python.

Contents:

Example 1: A Simple SBML Model

This example generates a very simple SBML model. Reactant S1 is converted to product S2 at a rate k1*S1. Running the following cell will generate an executable version of the model in the variable simple. You can then call the simulate method on this variable (specifying the start time, end time, and number of points), and plot the result.

Back to top


In [ ]:
model simple()
  S1 -> S2; k1*S1
  k1 = 0.1
  S1 = 10
end

In [ ]:
simple.simulate(0, 50, 100)
simple.plot()

Example 2: Advanced SBML Features

In this example, we will demonstrate the use of SBML events, compartments, and assignment rules. Events occur at discrete instants in time, and can be used to model the addition of a bolus of ligand etc. to the system. Compartments allow modeling of discrete volumetric spaces within a cell or system. Assignment rules provide a way to explicitly specify a value, as a function of time (as we do here) or otherwise.

  • There are two compartments: one containing species A, and one containing species B.
  • One mass unit of A is converted to one mass unit of B, but because B's compartment is half the size, the concentration of B increases at twice the rate as A diminishes.
  • Half-way through the simulation, we add a bolus of A
  • Species C is neither created nor destroyed in a reaction - it is defined entirely by a rate rule.

Back to top


In [ ]:
model advanced()
  # Create two compartments
  compartment compA=1, compB=0.5 # B is half the volume of A
  species A in compA, B in compB
  # Use the label `J0` for the reaction
  J0: A -> B; k*A
  # C is defined by an assignment rule
  species C
  C := sin(2*time/3.14) # a sine wave
  k = 0.1
  A = 10
  
  # Event: half-way through the simulation,
  # add a bolus of A
  at time>=5: A = A+10
end

In [ ]:
advanced.simulate(0, 10, 100)
advanced.plot()

Example 3: Creating a COMBINE Archive

COMBINE archives are containers for standards. They enable models encoded in SBML and simulations encoded in SED-ML to be exchanged between different tools. Tellurium displays COMBINE archives in an inline, human-readable form.

To convert the SBML model of Example 1 into a COMBINE archive, we need to define four steps in the workflow, which correspond to distinct elements in SED–ML: (1) models, (2) simulations, (3) tasks, and (4) outputs.

You can export this cell as a COMBINE archive by clicking on the diskette icon in the upper-right. You should be able to import it using other tools which support COMBINE archives, such as the SED-ML Web Tools or iBioSim.

Back to top


In [ ]:
model simple()
  S1 -> S2; k1*S1
  k1 = 0.1
  S1 = 10
end

# Models
model1 = model "simple"
# Simulations
sim1 = simulate uniform(0, 50, 1000)
// Tasks
task1 = run sim1 on model1
// Outputs
plot "COMBINE Archive Plot" time vs S1, S2