Detailed ExampleΒΆ

This section illustrates the construction of a closed loop system for moderately complicated open loop system, the mTOR pathway as modeled in Biomodels 823 (Varusai2018). The figure below provides an overview of the pathway that is modelled.

_images/mTOR-network.png

Our objective is to control the concentration of the concentration of DEPTOR, the mTOR interacting proteint with the DEP dependendent domain. concentration of 100.

Below we display the model in the Antimony modeling language. We have modified the model slightly by adding the chemical species E_v11. In the spirit of Metabolic Control Analysis, this species has an additive effect on the kinetics of reaction v11.

  1NEW_MTOR = """
  2// Created by libAntimony v2.13.2
  3function Constant_flux__irreversible(v)
  4  v;
  5end
  6
  7Constant_flux__irreversible is "Constant flux (irreversible)"
  8
  9function Henri_Michaelis_Menten__irreversible(substrate, Km, V)
 10  V*substrate/(Km + substrate);
 11end
 12
 13Henri_Michaelis_Menten__irreversible is "Henri-Michaelis-Menten (irreversible)"
 14
 15function HMM_Mod(V, s, m, Km)
 16  V*s*m/(Km + s);
 17end
 18
 19HMM_Mod is "HMM_Mod"
 20
 21function Function_for_v11(k11ca, pmTORC1, DEPTOR, Km11a, pDEPTOR, k11cb, pmTORC2, Km11b)
 22  k11ca*pmTORC1*DEPTOR/(Km11a + pDEPTOR) + k11cb*pmTORC2*DEPTOR/(Km11b + DEPTOR);
 23end
 24
 25Function_for_v11 is "Function_for_v11"
 26
 27function Function_for_v5(k5ca, pIRS, Akt, Km5a, k5cb, pmTORC2, Km5b)
 28  k5ca*pIRS*Akt/(Km5a + Akt) + k5cb*pmTORC2*Akt/(Km5b + Akt);
 29end
 30
 31Function_for_v5 is "Function_for_v5"
 32
 33
 34model *Varusai2018___Dynamic_modelling_of_the_mTOR_signalling_network_reveals_complex_emergent_behaviours_conferred_by_DEPTOR()
 35
 36  // Compartments and Species:
 37  compartment compartment_;
 38  species IR in compartment_, pIR in compartment_, IRS in compartment_, pIRS in compartment_;
 39  species iIRS in compartment_, Akt in compartment_, pAkt in compartment_;
 40  species mTORC1 in compartment_, pmTORC1 in compartment_, mTORC2 in compartment_;
 41  species pmTORC2 in compartment_, imTORC2 in compartment_, mTORC1_DEPTOR in compartment_;
 42  species mTORC2_DEPTOR in compartment_, DEPTOR in compartment_, pDEPTOR in compartment_;
 43  E_v11 in  compartment_;
 44
 45  // Reactions:
 46  v1: IR => pIR; compartment_*Henri_Michaelis_Menten__irreversible(IR, Km1, V1);
 47  v2: pIR => IR; compartment_*Henri_Michaelis_Menten__irreversible(pIR, Km2, V2);
 48  v3: IRS => pIRS; compartment_*HMM_Mod(k3c, IRS, pIR, Km3);
 49  v4: pIRS => IRS; compartment_*Henri_Michaelis_Menten__irreversible(pIRS, Km4, V4);
 50  v5: Akt => pAkt; compartment_*Function_for_v5(k5ca, pIRS, Akt, Km5a, k5cb, pmTORC2, Km5b);
 51  v6: pAkt => Akt; compartment_*Henri_Michaelis_Menten__irreversible(pAkt, Km6, V6);
 52  v7: mTORC1 => pmTORC1; compartment_*HMM_Mod(k7c, mTORC1, pAkt, Km7);
 53  v8: pmTORC1 => mTORC1; compartment_*Henri_Michaelis_Menten__irreversible(pmTORC1, Km8, V8);
 54  v9: mTORC2 => pmTORC2; compartment_*HMM_Mod(k9c, mTORC2, pIR, Km9);
 55  v10: pmTORC2 => mTORC2; compartment_*Henri_Michaelis_Menten__irreversible(pmTORC2, Km10, V10);
 56  v11: DEPTOR => pDEPTOR; E_v11 + compartment_*Function_for_v11(k11ca, pmTORC1, DEPTOR, Km11a, pDEPTOR, k11cb, pmTORC2, Km11b);
 57  v12: pDEPTOR => DEPTOR; compartment_*Henri_Michaelis_Menten__irreversible(pDEPTOR, Km12, V12);
 58  v13: mTORC1 + DEPTOR -> mTORC1_DEPTOR; compartment_*(k13f*mTORC1*DEPTOR - k13r*mTORC1_DEPTOR);
 59  v14: mTORC2 + DEPTOR -> mTORC2_DEPTOR; compartment_*(k14f*mTORC2*DEPTOR - k14r*mTORC2_DEPTOR);
 60  v15: IRS => iIRS; compartment_*HMM_Mod(k15c, IRS, pmTORC1, Km15);
 61  v16: iIRS => IRS; compartment_*Henri_Michaelis_Menten__irreversible(iIRS, Km16, V16);
 62  v17:  => DEPTOR; compartment_*Constant_flux__irreversible(ks17);
 63  v18: pDEPTOR => ; compartment_*kd18*pDEPTOR;
 64
 65  // Species initializations:
 66  IR = 50;
 67  pIR = 0;
 68  IRS = 100;
 69  pIRS = 0;
 70  iIRS = 0;
 71  Akt = 100;
 72  pAkt = 0;
 73  mTORC1 = 250;
 74  pmTORC1 = 0;
 75  mTORC2 = 200;
 76  pmTORC2 = 0;
 77  imTORC2 = 0;
 78  mTORC1_DEPTOR = 0;
 79  mTORC2_DEPTOR = 0;
 80  DEPTOR = 350;
 81  pDEPTOR = 0;
 82  // Added to model
 83  E_v11 = 1;
 84
 85  // Compartment initializations:
 86  compartment_ = 1;
 87
 88  // Variable initializations:
 89  V1 = 1;
 90  Km1 = 95;
 91  V2 = 1;
 92  Km2 = 35;
 93  k3c = 0.1;
 94  Km3 = 50;
 95  V4 = 1;
 96  Km4 = 50;
 97  k5ca = 0.05;
 98  Km5a = 7;
 99  k5cb = 1.5;
100  Km5b = 4;
101  V6 = 2;
102  Km6 = 34;
103  k7c = 0.1;
104  Km7 = 2;
105  V8 = 6;
106  Km8 = 1;
107  k9c = 0.3;
108  Km9 = 160;
109  V10 = 3;
110  Km10 = 7;
111  k11ca = 0.1;
112  Km11a = 120;
113  k11cb = 0.13;
114  Km11b = 11;
115  V12 = 4;
116  Km12 = 7;
117  k13f = 0.001;
118  k13r = 0.006;
119  k14f = 0.007;
120  k14r = 0.006;
121  k15c = 0.1;
122  Km15 = 50;
123  V16 = 1;
124  Km16 = 50;
125  ks17 = 0;
126  kd18 = 0;
127
128  // Other declarations:
129  const compartment_, V1, Km1, V2, Km2, k3c, Km3, V4, Km4, k5ca, Km5a, k5cb;
130  const Km5b, V6, Km6, k7c, Km7, V8, Km8, k9c, Km9, V10, Km10, k11ca, Km11a;
131  const k11cb, Km11b, V12, Km12, k13f, k13r, k14f, k14r, k15c, Km15, V16;
132  const Km16, ks17, kd18;
133
134  // Unit definitions:
135  unit volume = 1e-3 litre;
136  unit substance = 1e-3 mole;
137
138  // Display Names:
139  compartment_ is "compartment";
140
141  // CV terms:
142  compartment_ hypernym "http://identifiers.org/ncit/C48694"
143  IR identity "http://identifiers.org/pr/PR:000009064"
144  pIR hypernym "http://identifiers.org/pr/PR:000009064"
145  IRS identity "http://identifiers.org/ncit/C28474"
146  pIRS hypernym "http://identifiers.org/ncit/C28474"
147  iIRS hypernym "http://identifiers.org/ncit/C28474"
148  Akt identity "http://identifiers.org/pr/PR:000029189"
149  pAkt hypernym "http://identifiers.org/pr/PR:000029189"
150  mTORC1 hypernym "http://identifiers.org/ncit/C96314"
151  pmTORC1 hypernym "http://identifiers.org/ncit/C96314"
152  mTORC2 identity "http://identifiers.org/ncit/C96315"
153  pmTORC2 hypernym "http://identifiers.org/ncit/C96315"
154  imTORC2 hypernym "http://identifiers.org/ncit/C96315"
155  mTORC1_DEPTOR part "http://identifiers.org/ncit/C96314"
156  mTORC1_DEPTOR part "http://identifiers.org/ncit/C101595"
157  mTORC2_DEPTOR part "http://identifiers.org/ncit/C101595"
158  mTORC2_DEPTOR part "http://identifiers.org/ncit/mTORC2"
159  DEPTOR identity "http://identifiers.org/ncit/C101595"
160  pDEPTOR hypernym "http://identifiers.org/ncit/C101595"
161  v1 hypernym "http://identifiers.org/go/GO:0016310"
162  v2 hypernym "http://identifiers.org/go/GO:0016311"
163  v3 hypernym "http://identifiers.org/go/GO:0016310"
164  v4 hypernym "http://identifiers.org/go/GO:0016311"
165  v5 hypernym "http://identifiers.org/go/GO:0016310"
166  v6 hypernym "http://identifiers.org/go/GO:0016311"
167  v7 hypernym "http://identifiers.org/go/GO:0016310"
168  v8 hypernym "http://identifiers.org/go/GO:0016311"
169  v9 hypernym "http://identifiers.org/go/GO:0016310"
170  v10 hypernym "http://identifiers.org/go/GO:0016311"
171  v11 hypernym "http://identifiers.org/go/GO:0016310"
172  v12 hypernym "http://identifiers.org/go/GO:0016311"
173  v13 hypernym "http://identifiers.org/ncit/C18469"
174  v14 hypernym "http://identifiers.org/ncit/C18469"
175  v15 hypernym "http://identifiers.org/ncit/C16983"
176  v15 hypernym "http://identifiers.org/sbo/SBO:0000169"
177  v16 hypernym "http://identifiers.org/ncit/C21018"
178  v17 hypernym "http://identifiers.org/ncit/C80450"
179  v18 hypernym "http://identifiers.org/ncit/C61559"
180end
181
182Varusai2018___Dynamic_modelling_of_the_mTOR_signalling_network_reveals_complex_emergent_behaviours_conferred_by_DEPTOR is "Varusai2018 - Dynamic modelling of the mTOR signalling network reveals complex emergent behaviours conferred by DEPTOR"
183
184Varusai2018___Dynamic_modelling_of_the_mTOR_signalling_network_reveals_complex_emergent_behaviours_conferred_by_DEPTOR description "http://identifiers.org/pubmed/29330362"
185Varusai2018___Dynamic_modelling_of_the_mTOR_signalling_network_reveals_complex_emergent_behaviours_conferred_by_DEPTOR model_entity_is "http://identifiers.org/biomodels.db/MODEL1909250003",
186                                                                                                                                       "http://identifiers.org/biomodels.db/BIOMD0000000823"
187Varusai2018___Dynamic_modelling_of_the_mTOR_signalling_network_reveals_complex_emergent_behaviours_conferred_by_DEPTOR property "http://identifiers.org/mamo/MAMO_0000046"
188Varusai2018___Dynamic_modelling_of_the_mTOR_signalling_network_reveals_complex_emergent_behaviours_conferred_by_DEPTOR property "http://identifiers.org/pw/PW:0000180"
189Varusai2018___Dynamic_modelling_of_the_mTOR_signalling_network_reveals_complex_emergent_behaviours_conferred_by_DEPTOR property "http://identifiers.org/ncit/C101595"
190Varusai2018___Dynamic_modelling_of_the_mTOR_signalling_network_reveals_complex_emergent_behaviours_conferred_by_DEPTOR taxon "http://identifiers.org/taxonomy/9606"
191"""

To simplify the analysis, we make use of the ctl.Timeseries class (essentially a pandas.DataFrame whose index is time in milliseconds). controlSBML has several methods that makes it easy to plot and manipulate ctl.Timeseries objects.

We begin by creating a control.NonlinearIOSystem for the mTOR model.

ctlsb = ctl.ControlSBML(NEW_MTOR,
                        input_names=["E_v11"],
                        output_names=["mTORC1_DEPTOR", "pAkt"])
mtor = ctlsb.makeNonlinearIOSystem("mtor")

Next, we plot the open loop behavior of the model.

1ctlsb = ctl.ControlSBML(NEW_MTOR,
2                        input_names=["E_v11"],
3                        output_names=["mTORC1_DEPTOR", "pAkt"])
4mtor = ctlsb.makeNonlinearIOSystem("mtor")
5ctl.plotOneTS(ctl.simulateSystem(mtor, end_time=500), figsize=(5,5))
 1ref = 100  # Desired concentration for mTORC1_DEPTOR
 2kP = 0.1
 3kI = 0.01
 4# Calculate derivative of state
 5def updfcn(t, x, u, _):
 6    # Accumulate the control error
 7    # t: float (time)
 8    # x: array-float (state)
 9    # u: array-float (output from OLS)
10    # returns: array-float (derivative of state)
11    dx = ref - u[0]
12    #print(t, u, dx)
13    return dx
14
15# Calculate output value
16def outfcn(t, x, y, _):
17    # Calculate the output from the input
18    # t: float (time)
19    # x: array-float (state)
20    # e: array-float (inputs)
21    # returns: array (output)
22    new_err = ref - y[0]
23    output = -kI*x[0] - kP*new_err
24    #print(t, output)
25    return output
26
27# Create a PI Controller
28controller = control.NonlinearIOSystem(
29  updfcn,
30  outfcn,
31  states=1,
32  inputs=['in'],
33  outputs=['out'], name='controller')