A common task in modeling is to see how a parameter influences a model’s dynamics. For example, consider a simple two reaction pathway:
-> S1 ->
where the first reaction has a fixed input of vo and the second reaction a first-order rate laws k1*S1. The task is to investigate how the time course of S1 is influenced by vo.
The script below defines the model, then changes vo in increments and plots the effect on the pathway via a time course simulation. To do the parameter scan we exploit plotArray. This initially prevents the plots from being shown using show=False. We make sure that each plot gets a different color using resetColorCycle=False, finally, we show the plot using show(). To make things more interesting we also add a legend entry for each plot.
Note we call reset each time we run a simulation to ensure that S1 is reset back to its initial condition.
import tellurium as te
import numpy as np
r = te.loada("""
J1: -> S1; vo;
S1 -> ; k1*S1
k1 = 0.5;
vo = 4;
for vo in np.arange (0, 5, 0.5):
r.vo = vo;
m = r.simulate(0, 10, 100)
te.plotArray(m, labels=['v0 = '+str(vo)], show=False, resetColorCycle=False)
The following figure shows the resulting plot:
Thanks to Kiri Choi for pointing out how to use plotArray in this way.