Here we discuss some example systems and how to code them up using cayenne
.
This can be coded up with:
>>> from cayenne import Simulation
>>> model_str = """
const compartment comp1;
comp1 = 1.0; # volume of compartment
r1: => A; k1;
k1 = 1.1;
chem_flag = false;
A = 100;
"""
>>> sim = Simulation.load_model(model_str, "ModelString")
>>> sim.simulate()
>>> sim.plot()
This can be coded up with:
>>> from cayenne import Simulation
>>> model_str = """
const compartment comp1;
comp1 = 1.0; # volume of compartment
r1: A => B; k1;
k1 = 1.1;
chem_flag = false;
A = 100;
B = 20;
"""
>>> sim = Simulation.load_model(model_str, "ModelString")
>>> sim.simulate()
>>> sim.plot()
Suppose you want to use the tau_leaping
algorithm, run 20 repetitions and plot only species B. Then do:
>>> sim.simulate(algorithm="tau_leaping", n_rep=20)
>>> sim.plot(species_names=["B"], new_names=["Species B"])
This can be coded up with:
>>> from cayenne import Simulation
>>> model_str = """
const compartment comp1;
comp1 = 1.0; # volume of compartment
binding: S + E => SE; k1;
dissociation: SE => S + E; k2;
conversion: SE => P + E; k3;
k1 = 0.006;
k2 = 0.005;
k3 = 0.1;
chem_flag = false;
S = 200;
E = 50;
SE = 0;
P = 0;
"""
>>> sim = Simulation.load_model(model_str, "ModelString")
>>> sim.simulate(max_t=50, n_rep=10)
>>> sim.plot()
Since this is a second order system, the size of the system affects the reaction rates. What happens in a larger system? :
>>> from cayenne import Simulation
>>> model_str = """
const compartment comp1;
comp1 = 5.0; # volume of compartment
binding: S + E => SE; k1;
dissociation: SE => S + E; k2;
conversion: SE => P + E; k3;
k1 = 0.006;
k2 = 0.005;
k3 = 0.1;
chem_flag = false;
S = 200;
E = 50;
SE = 0;
P = 0;
"""
>>> sim = Simulation.load_model(model_str, "ModelString")
>>> sim.simulate(max_t=50, n_rep=10)
>>> sim.plot()
Here we see that the reaction proceeds slower. Less of the product is formed by t=50
compared to the previous case.