y_petri 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/lib/y_petri/demonstrator.rb +164 -0
- data/lib/y_petri/demonstrator_2.rb +176 -0
- data/lib/y_petri/demonstrator_3.rb +150 -0
- data/lib/y_petri/demonstrator_4.rb +217 -0
- data/lib/y_petri/manipulator.rb +598 -0
- data/lib/y_petri/net.rb +458 -0
- data/lib/y_petri/place.rb +189 -0
- data/lib/y_petri/simulation.rb +1313 -0
- data/lib/y_petri/timed_simulation.rb +281 -0
- data/lib/y_petri/transition.rb +921 -0
- data/lib/y_petri/version.rb +3 -0
- data/lib/y_petri/workspace/instance_methods.rb +254 -0
- data/lib/y_petri/workspace/parametrized_subclassing.rb +26 -0
- data/lib/y_petri/workspace.rb +16 -0
- data/lib/y_petri.rb +141 -0
- data/test/simple_manual_examples.rb +28 -0
- data/test/y_petri_graph.png +0 -0
- data/test/y_petri_test.rb +1521 -0
- data/y_petri.gemspec +21 -0
- metadata +112 -0
@@ -0,0 +1,217 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'y_petri'
|
4
|
+
include YPetri
|
5
|
+
require 'sy'
|
6
|
+
require 'mathn'
|
7
|
+
|
8
|
+
# === General assumptions
|
9
|
+
|
10
|
+
Cell_diameter = 10.µm
|
11
|
+
Cytoplasm_volume = ( 4 / 3 * Math::PI * ( Cell_diameter / 2 ) ** 3 ).( SY::LitreVolume )
|
12
|
+
|
13
|
+
# How many molecules per micromolar are there in an average cell.
|
14
|
+
Pieces_per_µM = ( 1.µM * Cytoplasm_volume ).in( :unit )
|
15
|
+
|
16
|
+
# === Simulation settings
|
17
|
+
|
18
|
+
set_step 60.s.in( :s )
|
19
|
+
set_target_time 20.min.in( :s ) # up to 5 days is interesting
|
20
|
+
set_sampling 120.s.in( :s )
|
21
|
+
|
22
|
+
# === Places (all in µM)
|
23
|
+
|
24
|
+
AMP = Place m!: 82.0 # Traut1994pcp
|
25
|
+
ADP = Place m!: 137.0 # Traut1994pcp
|
26
|
+
ATP = Place m!: 2102.0 # Traut1994pcp
|
27
|
+
UTP = Place m!: 253.0 # Traut1994pcp
|
28
|
+
UDP = Place m!: ADP.m / ATP.m * UTP.m
|
29
|
+
UMP = Place m!: AMP.m / ATP.m * UTP.m
|
30
|
+
GMP = Place m!: 32.0 # Traut1994pcp
|
31
|
+
|
32
|
+
DeoxyATP = Place m!: 2.4 # Traut1994pcp
|
33
|
+
DeoxyADP = Place m!: ADP.m / ATP.m * DeoxyATP.m
|
34
|
+
DeoxyAMP = Place m!: AMP.m / ATP.m * DeoxyATP.m
|
35
|
+
|
36
|
+
DeoxyCytidine = Place m!: 0.7 # Traut1994pcp
|
37
|
+
DeoxyCMP = Place m!: 1.9 # Traut1994pcp
|
38
|
+
DeoxyCDP = Place m!: 0.1 # Traut1994pcp
|
39
|
+
DeoxyCTP = Place m!: 4.5 # Traut1994pcp
|
40
|
+
|
41
|
+
DeoxyGTP = Place m!: 2.7 # Traut1994pcp
|
42
|
+
DeoxyGMP = Place m!: AMP.m / ATP.m * DeoxyATP.m
|
43
|
+
|
44
|
+
DeoxyUridine = Place m!: 0.6 # Traut1994pcp
|
45
|
+
DeoxyUMP = Place m!: 2.70 # Traut1994pcp
|
46
|
+
DeoxyUDP = Place m!: 0.5 # Traut1994pcp
|
47
|
+
DeoxyUTP = Place m!: 0.7 # Traut1994pcp
|
48
|
+
|
49
|
+
DeoxyThymidine = Place m!: 0.5 # Traut1994pcp
|
50
|
+
DeoxyTMP = Place m!: 0.0 # in situ
|
51
|
+
DeoxyTDP = Place m!: 2.4 # Traut1994pcp
|
52
|
+
DeoxyTTP = Place m!: 17.0 # Traut1994pcp
|
53
|
+
|
54
|
+
# === Empirical places (in arbitrary units)
|
55
|
+
|
56
|
+
A_phase = Place m!: 1 # in situ
|
57
|
+
S_phase = Place m!: 1 # in situ
|
58
|
+
Cdc20A = Place m!: 0.0 # in situ
|
59
|
+
|
60
|
+
# === Enzymes
|
61
|
+
|
62
|
+
# ==== Thymidine kinase, cytoplasmic (TK1)
|
63
|
+
|
64
|
+
# Molecular weight:
|
65
|
+
TK1_m = 24.8.kDa
|
66
|
+
TK1_a = 9500.mol.min⁻¹.mg⁻¹
|
67
|
+
|
68
|
+
# Total unphosphorylated TK1 expressed in <em>monomer molarity</em>.
|
69
|
+
TK1 = Place m!: 0 # in situ
|
70
|
+
|
71
|
+
TK1_4mer_Kd = 0.03 # in situ
|
72
|
+
TK1di = Place m!: 0 # TK1 in the dimer form, unphosphorylated
|
73
|
+
TK1di_P = Place m!: 0 # in situ; TK1 in the dimer form, phosphorylated
|
74
|
+
TK1tetra = Place m!: 0 # TK1 in the tetramer form (phosphorylation prevents 4merization)
|
75
|
+
|
76
|
+
# Assignment transition keeping TK1_di level based on total TK1 monomer
|
77
|
+
Transition name: :TK1_di_ϝ,
|
78
|
+
assignment: true,
|
79
|
+
domain: TK1,
|
80
|
+
codomain: TK1di,
|
81
|
+
action: lambda { |monomer| # solution of a quadratic equation for dimer / tetramer balance
|
82
|
+
TK1_4mer_Kd / 4 * ( ( 1 + 4 / TK1_4mer_Kd * monomer ) ** 0.5 - 1 )
|
83
|
+
}
|
84
|
+
|
85
|
+
# Assignment transition keeping TK1_tetra level based on total TK1 tetramer
|
86
|
+
Transition name: :TK1_tetra_ϝ,
|
87
|
+
assignment: true,
|
88
|
+
domain: [ TK1, TK1di ],
|
89
|
+
codomain: TK1tetra,
|
90
|
+
action: lambda { |monomer, dimer| # based on equation monomer = dimer * 2 + tetramer * 4
|
91
|
+
monomer / 4 - dimer / 2
|
92
|
+
}
|
93
|
+
|
94
|
+
# Dissociation constants [µM]
|
95
|
+
|
96
|
+
TK1di_Kd_ATP = 4.7 # Barroso2003tbd
|
97
|
+
TK1di_Kd_dT = 15.0 # Eriksson2002sfc
|
98
|
+
|
99
|
+
# FIXME - THIS IS HOW FAR I CAME
|
100
|
+
|
101
|
+
# Inhibition constant of dTTP
|
102
|
+
TK1di_Kd_dTTP
|
103
|
+
# Hill coefficient of TK1 dimer
|
104
|
+
TK1di_hill
|
105
|
+
# k_cat of TK1 dimer
|
106
|
+
TK1_k_cat = ( TK1_a * TK1_m ).( SY::Amount / SY::Time ).in :s⁻¹
|
107
|
+
TK1_k_cat = 3.80 #
|
108
|
+
|
109
|
+
|
110
|
+
TYMS_m = 66.0.kDa
|
111
|
+
RNR_m = 140.0.kDa
|
112
|
+
TMPK_m = 50.0.kDa
|
113
|
+
|
114
|
+
# === Enzyme specific activities
|
115
|
+
|
116
|
+
TK1_a = 5.40.µmol.min⁻¹.mg⁻¹
|
117
|
+
TYMS_a = 3.80.µmol.min⁻¹.mg⁻¹
|
118
|
+
RNR_a = 1.00.µmol.min⁻¹.mg⁻¹
|
119
|
+
TMPK_a = 0.83.µmol.min⁻¹.mg⁻¹
|
120
|
+
|
121
|
+
# === Enzyme kcat
|
122
|
+
|
123
|
+
TK1_k_cat = ( TK1_a * TK1_m ).( SY::Amount / SY::Time ).in :s⁻¹
|
124
|
+
TYMS_k_cat = ( TYMS_a * TYMS_m ).( SY::Amount / SY::Time ).in :s⁻¹
|
125
|
+
RNR_k_cat = ( RNR_a * RNR_m ).( SY::Amount / SY::Time ).in :s⁻¹
|
126
|
+
TMPK_k_cat = ( TMPK_a * TMPK_m ).( SY::Amount / SY::Time ).in :s⁻¹
|
127
|
+
|
128
|
+
# === Clamps (all in µM)
|
129
|
+
|
130
|
+
clamp AMP: 8695.0, ADP: 6521.0, ATP: 3152.0
|
131
|
+
clamp DeoxyCytidine: 0.5, DeoxyCTP: 1.0, DeoxyGMP: 1.0
|
132
|
+
clamp Thymidine: 0.5
|
133
|
+
clamp U12P: 2737.0
|
134
|
+
|
135
|
+
# === Function closures
|
136
|
+
|
137
|
+
# Vmax of an enzyme.
|
138
|
+
#
|
139
|
+
Vmax = -> enzyme_µM, k_cat do enzyme_µM * k_cat end
|
140
|
+
|
141
|
+
# Michaelis constant reduced for competitive inhibitors.
|
142
|
+
#
|
143
|
+
Km_reduced = -> reactant_Km, hash_Ki=Hash.new do
|
144
|
+
hash_Ki.map { |compet_inhibitor_concentration, compet_inhibitor_Ki|
|
145
|
+
compet_inhibitor_concentration / compet_inhibitor_Ki
|
146
|
+
}.reduce( 1, :+ ) * reactant_Km
|
147
|
+
end
|
148
|
+
|
149
|
+
# Occupancy fraction of the Michaelis-Menten equation.
|
150
|
+
#
|
151
|
+
Occupancy = -> reactant_µM, reactant_Km, hash_Ki=Hash.new do
|
152
|
+
reactant_µM / ( reactant_µM + Km_reduced.( reactant_Km, hash_Ki ) )
|
153
|
+
end
|
154
|
+
|
155
|
+
# Michaelis-Menten equation with competitive inhibitors.
|
156
|
+
#
|
157
|
+
MMi = -> reactant_µM, reactant_Km, enzyme_µM, k_cat, hash_Ki=Hash.new do
|
158
|
+
Vmax.( enzyme_µM, k_cat ) * Occupancy.( reactant_µM, reactant_Km, hash_Ki )
|
159
|
+
end
|
160
|
+
|
161
|
+
# === Michaelis constants (all in µM)
|
162
|
+
|
163
|
+
TK1_Thymidine_Km = 5.0
|
164
|
+
TYMS_DeoxyUMP_Km = 2.0
|
165
|
+
RNR_UDP_Km = 1.0
|
166
|
+
TMPK_DeoxyTMP_Km = 12.0
|
167
|
+
|
168
|
+
# === DNA synthesis speed
|
169
|
+
|
170
|
+
S_phase_duration = 12.h
|
171
|
+
Genome_size = 3_000_000_000 # of bases
|
172
|
+
DNA_creation_speed = Genome_size / S_phase_duration.in( :s ) # in base.s⁻¹
|
173
|
+
|
174
|
+
# === Transitions
|
175
|
+
|
176
|
+
Transition name: :TK1_Thymidine_DeoxyTMP,
|
177
|
+
domain: [ Thymidine, TK1, DeoxyT23P, DeoxyCTP, DeoxyCytidine, AMP, ADP, ATP ],
|
178
|
+
stoichiometry: { Thymidine: -1, DeoxyTMP: 1 },
|
179
|
+
rate: proc { |reactant, enzyme, pool, inhibitor_2, inhibitor_3, mono, di, tri|
|
180
|
+
inhibitor_1 = pool * tri / ( di + tri ) # conc. of DeoxyTTP
|
181
|
+
MMi.( reactant, TK1_Thymidine_Km, enzyme, TK1_k_cat,
|
182
|
+
inhibitor_1 => 13.5, inhibitor_2 => 0.8, inhibitor_3 => 40.0 )
|
183
|
+
}
|
184
|
+
|
185
|
+
Transition name: :TYMS_DeoxyUMP_DeoxyTMP,
|
186
|
+
domain: [ DeoxyU12P, TYMS, AMP, ADP, ATP ],
|
187
|
+
stoichiometry: { DeoxyU12P: -1, DeoxyTMP: 1 },
|
188
|
+
rate: proc { |pool, enzyme, mono, di, tri|
|
189
|
+
reactant = pool * di / ( mono + di ) # conc. of DeoxyUMP
|
190
|
+
MMi.( reactant, TYMS_DeoxyUMP_Km, enzyme, TYMS_k_cat )
|
191
|
+
}
|
192
|
+
|
193
|
+
Transition name: :RNR_UDP_DeoxyUDP,
|
194
|
+
domain: [ U12P, RNR, DeoxyU12P, AMP, ADP, ATP ],
|
195
|
+
stoichiometry: { U12P: -1, DeoxyU12P: 1 },
|
196
|
+
rate: proc { |pool, enzyme, mono, di, tri|
|
197
|
+
reactant = pool * di / ( mono + di )
|
198
|
+
MMi.( reactant, RNR_UDP_Km, enzyme, RNR_k_cat )
|
199
|
+
}
|
200
|
+
|
201
|
+
Transition name: :DNA_polymerase_consumption_of_DeoxyTTP,
|
202
|
+
stoichiometry: { DeoxyT23P: -1 },
|
203
|
+
rate: proc { DNA_creation_speed / 4 }
|
204
|
+
|
205
|
+
Transition name: :TMPK_DeoxyTMP_DeoxyTDP,
|
206
|
+
domain: [ DeoxyTMP, TMPK, DeoxyT23P, DeoxyGMP, AMP, ADP, ATP ],
|
207
|
+
stoichiometry: { DeoxyTMP: -1, DeoxyT23P: 1 },
|
208
|
+
rate: proc { |reactant, enzyme, pool, inhibitor_4, mono, di, tri|
|
209
|
+
inhibitor_1 = di
|
210
|
+
inhibitor_2 = pool * di / ( di + tri ) # conc. of DeoxyTDP
|
211
|
+
inhibitor_3 = pool * tri / ( di + tri ) # conc. of DeoxyTTP
|
212
|
+
MMi.( reactant, TMPK_DeoxyTMP_Km, enzyme, TMPK_k_cat )
|
213
|
+
}
|
214
|
+
|
215
|
+
# execution
|
216
|
+
run!
|
217
|
+
plot_recording
|