Tellurium offers the ability to embed entire COMBINE archives within notebook cells. These inline OMEX cells are represented in a human-readable format that can be easily edited by hand.
This notebook shows some basic examples of COMBINE archives and how to use them in Tellurium. You can export any of these examples by clicking on the diskette icon in the upper right part of the cell.
In Tellurium, a special type of IPython cell exists for Combine archives (a.k.a. the Open Modeling EXchange format, OMEX). It is denoted by a small Combine archive icon next to the execution counter in the upper left corner of the cell.
A Combine archive cell may be created by importing from a Combine archive on disk. Move the mouse past the last cell in a notebook to show the cell creator bar. Click on the "Import" button, and choose "Import Combine archive...". Alternatively, simply click "New" -> "Combine archive" to create an empty Combine archive cell.
The example shows a minimal Combine archive containing an SBML model (myModel) representing conversion of species S1 to S2, a single timecourse simulation, and a plot.
In [1]:
// -- Begin Antimony block
model *myModel()
// Compartments and Species:
species S1, S2;
// Reactions:
_J0: S1 -> S2; k1*S1;
// Species initializations:
S1 = 10;
S2 = 0;
// Variable initializations:
k1 = 1;
// Other declarations:
const k1;
end
// -- End Antimony block
// -- Begin PhraSEDML block
// Models
model1 = model "myModel"
// Simulations
sim1 = simulate uniform(0, 5, 100)
// Tasks
task1 = run sim1 on model1
// Outputs
plot "Figure 1" time vs S1, S2
// -- End PhraSEDML block
This example plots a deterministic simulation and a stochastic simulation of the same system.
In [2]:
// SBML Part
model *myModel()
// Reactions:
J0: A -> B; k*A;
A = 10;
k = 1;
end
// SED-ML Part
// Models
model1 = model "myModel"
// Simulations
simulation1 = simulate uniform(0, 5, 100)
simulation2 = simulate uniform_stochastic(0, 5, 100)
// Tasks
task1 = run simulation1 on model1
task2 = run simulation2 on model1
// Outputs
plot "Deterministic Solution" task1.time vs task1.A, task1.B
plot "Stochastic Solution" task2.time vs task2.A, task2.B
This example uses a repeated task to run multiple copies of a stochastic simulation, then plots the ensemble.
In [3]:
// SBML Part
model *myModel()
// Reactions:
J0: A -> B; k*A;
A = 100;
k = 1;
end
// SED-ML Part
// Models
model1 = model "myModel"
// Simulations
simulation1 = simulate uniform_stochastic(0, 5, 100)
// Tasks
task1 = run simulation1 on model1
repeat1 = repeat task1 for \
local.x in uniform(0,25,25), reset=True
// Outputs
plot "Stochastic Ensemble" repeat1.time vs repeat1.A, repeat1.B
In addition to timecourse plots, SED-ML can also be used to create phase portraits. This is useful to show the presenence (or absence, in this case) of limit cycles. Here, we use the well-known Lorenz attractor to show this feature.
In [4]:
// -- Begin Antimony block
model *lorenz()
// Rate Rules:
x' = sigma*(y - x);
y' = x*(rho - z) - y;
z' = x*y - beta*z;
// Variable initializations:
x = 0.96259;
sigma = 10;
y = 2.07272;
rho = 28;
z = 18.65888;
beta = 2.67;
// Other declarations:
var x, y, z;
const sigma, rho, beta;
end
// -- End Antimony block
// -- Begin PhraSEDML block
// Models
model1 = model "lorenz"
// Simulations
sim1 = simulate uniform(0, 15, 2000)
// Tasks
task1 = run sim1 on model1
// Outputs
plot "Phase Portrait" z vs x
// -- End PhraSEDML block
Through the use of repeated tasks, SED-ML can be used to scan through parameter values. This example shows how to scan through a set of predefined values for a kinetic parameter (J1_KK2).
In [5]:
// -- Begin Antimony block
model *MAPKcascade()
// Compartments and Species:
compartment compartment_;
species MKKK in compartment_, MKKK_P in compartment_, MKK in compartment_;
species MKK_P in compartment_, MKK_PP in compartment_, MAPK in compartment_;
species MAPK_P in compartment_, MAPK_PP in compartment_;
// Reactions:
J0: MKKK => MKKK_P; J0_V1*MKKK/((1 + (MAPK_PP/J0_Ki)^J0_n)*(J0_K1 + MKKK));
J1: MKKK_P => MKKK; J1_V2*MKKK_P/(J1_KK2 + MKKK_P);
J2: MKK => MKK_P; J2_k3*MKKK_P*MKK/(J2_KK3 + MKK);
J3: MKK_P => MKK_PP; J3_k4*MKKK_P*MKK_P/(J3_KK4 + MKK_P);
J4: MKK_PP => MKK_P; J4_V5*MKK_PP/(J4_KK5 + MKK_PP);
J5: MKK_P => MKK; J5_V6*MKK_P/(J5_KK6 + MKK_P);
J6: MAPK => MAPK_P; J6_k7*MKK_PP*MAPK/(J6_KK7 + MAPK);
J7: MAPK_P => MAPK_PP; J7_k8*MKK_PP*MAPK_P/(J7_KK8 + MAPK_P);
J8: MAPK_PP => MAPK_P; J8_V9*MAPK_PP/(J8_KK9 + MAPK_PP);
J9: MAPK_P => MAPK; J9_V10*MAPK_P/(J9_KK10 + MAPK_P);
// Species initializations:
MKKK = 90;
MKKK_P = 10;
MKK = 280;
MKK_P = 10;
MKK_PP = 10;
MAPK = 280;
MAPK_P = 10;
MAPK_PP = 10;
// Compartment initializations:
compartment_ = 1;
// Variable initializations:
J0_V1 = 2.5;
J0_Ki = 9;
J0_n = 1;
J0_K1 = 10;
J1_V2 = 0.25;
J1_KK2 = 8;
J2_k3 = 0.025;
J2_KK3 = 15;
J3_k4 = 0.025;
J3_KK4 = 15;
J4_V5 = 0.75;
J4_KK5 = 15;
J5_V6 = 0.75;
J5_KK6 = 15;
J6_k7 = 0.025;
J6_KK7 = 15;
J7_k8 = 0.025;
J7_KK8 = 15;
J8_V9 = 0.5;
J8_KK9 = 15;
J9_V10 = 0.5;
J9_KK10 = 15;
// Other declarations:
const compartment_, J0_V1, J0_Ki, J0_n, J0_K1, J1_V2, J1_KK2, J2_k3, J2_KK3;
const J3_k4, J3_KK4, J4_V5, J4_KK5, J5_V6, J5_KK6, J6_k7, J6_KK7, J7_k8;
const J7_KK8, J8_V9, J8_KK9, J9_V10, J9_KK10;
end
// -- End Antimony block
// -- Begin PhraSEDML block
// Models
model1 = model "MAPKcascade"
// Simulations
sim1 = simulate uniform(0, 4000, 1000)
// Tasks
task1 = run sim1 on model1
// Repeated Tasks
repeat1 = repeat task1 for model1.J1_KK2 in [1, 10, 40], reset=true
// Outputs
plot "Sampled Simulation" repeat1.time vs repeat1.MKK, repeat1.MKK_P, repeat1.MAPK_PP
// -- End PhraSEDML block