cell_cycle 0.0.2

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.
@@ -0,0 +1,144 @@
1
+ # encoding: utf-8
2
+
3
+ # ==============================================================================
4
+ # MODEL PARAMETERS AND OTHER COMMON ASSETS OF VIRGINIA GENERIC CELL CYCLE MODEL
5
+ # PUBLICATION ID: Csikasznagy2006agm
6
+ # ==============================================================================
7
+
8
+ require 'sy'; require 'y_nelson' and include YNelson
9
+
10
+ # Golbeter-Koshland function used in Csikasznagy2006agm.
11
+ B = -> a1, a2, a3, a4 do a2 - a1 + a3 * a2 + a4 * a1 end
12
+ GK = -> a1, a2, a3, a4 do
13
+ b = B.( a1, a2, a3, a4 )
14
+ 2 * a4 * a1 / ( b + ( b**2 - 4 * ( a2 - a1 ) * a4 * a1 )**0.5 )
15
+ end
16
+
17
+ # Constants as per Csikasznagy2006agm
18
+ CELL_MASS_DOUBLING_TIME = { 1 => 24.h, 2 => 14.h }[ CASE ].in :s
19
+ CELL_GROWTH_RATE = Math.log( 2 ) / CELL_MASS_DOUBLING_TIME
20
+ CycB_DIVISION_THRESHOLD = 0.3
21
+
22
+ # Following are the data from Czikasznagy2006agm supplementary materials.
23
+ # Abbreviations meanings:
24
+ #
25
+ # BY -- budding yeast
26
+ # MA -- mammalian,
27
+ # FY -- fission yeast,
28
+ # G2 -- G2 module,
29
+ # XE -- xenopus embryo
30
+ #
31
+ DATA = {
32
+ J20: { BY: 100, MA: 100, FY: 0.05, G2: nil, XE: nil },
33
+ Ja20: { BY: 10, MA: 0.005, FY: 0.001, G2: nil, XE: 0.1 },
34
+ Ja25: { BY: nil, MA: nil, FY: 0.01, G2: 0.1, XE: 0.1 },
35
+ JaAPC: { BY: 0.1, MA: 0.01, FY: 0.001, G2: nil, XE: 0.01 },
36
+ Jafb: { BY: 0.1, MA: 0.1, FY: nil, G2: nil, XE: nil },
37
+ Jafi: { BY: 10, MA: nil, FY: nil, G2: nil, XE: nil },
38
+ Jah1: { BY: 0.03, MA: 0.01, FY: 0.01, G2: nil, XE: nil },
39
+ Jatf: { BY: 0.01, MA: 0.01, FY: 0.01, G2: nil, XE: nil },
40
+ Jawee: { BY: nil, MA: nil, FY: 0.01, G2: 0.05, XE: 0.3 },
41
+ Ji20: { BY: 10, MA: 0.005, FY: 0.001, G2: nil, XE: 0.1 },
42
+ Ji25: { BY: nil, MA: nil, FY: 0.01, G2: 0.1, XE: 0.1 },
43
+ JiAPC: { BY: 0.1, MA: 0.01, FY: 0.001, G2: nil, XE: 0.01 },
44
+ Jifb: { BY: 0.1, MA: 0.1, FY: nil, G2: nil, XE: nil },
45
+ Jifi: { BY: 10, MA: nil, FY: nil, G2: nil, XE: nil },
46
+ Jih1: { BY: 0.03, MA: 0.01, FY: 0.01, G2: nil, XE: nil },
47
+ Jitf: { BY: 0.01, MA: 0.01, FY: 0.01, G2: nil, XE: nil },
48
+ Jiwee: { BY: nil, MA: nil, FY: 0.01, G2: 0.05, XE: 0.3 },
49
+ J14di: { BY: 0.0833, MA: nil, FY: nil, G2: nil, XE: nil },
50
+ K25p: { BY: nil, MA: nil, FY: 0.001, G2: 0.05, XE: 0.1 },
51
+ K25pp: { BY: nil, MA: nil, FY: 1, G2: 05, XE: 1.9 },
52
+
53
+ Ka20: { BY: 1, MA: 0.0833, FY: 0.2, G2: nil, XE: 0.1 },
54
+ Ka25: { BY: nil, MA: nil, FY: 1, G2: 1, XE: 1 },
55
+ KaAPC: { BY: 0.1, MA: 0.0117, FY: 0.2, G2: nil, XE: 2 },
56
+ Kafb: { BY: 1, MA: 0.167, FY: nil, G2: nil, XE: nil },
57
+ Kafi: { BY: 6, MA: nil, FY: nil, G2: nil, XE: nil },
58
+ Kah1p: { BY: 0.01, MA: 0.175, FY: 5, G2: nil, XE: nil },
59
+ Kah1pp: { BY: 0.8, MA: 2.33, FY: 50, G2: nil, XE: nil },
60
+ Kasa: { BY: 50, MA: 16.7, FY: 500, G2: nil, XE: nil },
61
+ Kasb: { BY: 65, MA: nil, FY: 1000, G2: nil, XE: nil },
62
+ Kase: { BY: nil, MA: 16.7, FY: nil, G2: nil, XE: nil },
63
+ Katfp: { BY: nil, MA: 0.0, FY: 1.5, G2: nil, XE: nil },
64
+ Katfpp: { BY: 0.76, MA: 0.05, FY: nil, G2: nil, XE: nil },
65
+ Katfppp: { BY: 0.76, MA: 0.0833, FY: nil, G2: nil, XE: nil },
66
+ Katfpppp: { BY: 3.8, MA: 0.055, FY: nil, G2: nil, XE: nil },
67
+ Kaweep: { BY: nil, MA: nil, FY: 0.25, G2: 0.3, XE: 0.1 },
68
+ Kaweepp: { BY: nil, MA: nil, FY: 0.25, G2: nil, XE: nil },
69
+ Kd20: { BY: 0.05, MA: 0.025, FY: 0.1, G2: nil, XE: nil },
70
+ Kdap: { BY: 0.01, MA: 0.000333, FY: 0.01, G2: nil, XE: nil },
71
+ Kdapp: { BY: 0.16, MA: 0.333, FY: 2, G2: nil, XE: nil },
72
+ Kdappp: { BY: nil, MA: nil, FY: 0.02, G2: nil, XE: nil },
73
+
74
+ Kdbp: { BY: 0.003, MA: 0.000833, FY: 0.02, G2: nil, XE: 0.015 },
75
+ Kdbpp: { BY: 0.4, MA: 0.333, FY: 0.75, G2: nil, XE: nil },
76
+ Kdbppp: { BY: 0.15, MA: 0.0167, FY: 1.5, G2: nil, XE: nil },
77
+ Kdep: { BY: 0.12, MA: 0.00167, FY: nil, G2: nil, XE: nil },
78
+ Kdepp: { BY: nil, MA: 0.0167, FY: nil, G2: nil, XE: nil },
79
+ Kdeppp: { BY: nil, MA: 0.167, FY: nil, G2: nil, XE: nil },
80
+ Kdepppp: { BY: nil, MA: 0.167, FY: nil, G2: nil, XE: nil },
81
+ Kdia: { BY: 0.06, MA: 0.167, FY: 1, G2: nil, XE: nil },
82
+ Kdib: { BY: 0.05, MA: nil, FY: 1, G2: nil, XE: nil },
83
+ Kdie: { BY: nil, MA: 0.167, FY: nil, G2: nil, XE: nil },
84
+ Kdip: { BY: 0.02, MA: 0.167, FY: 0.1, G2: nil, XE: nil },
85
+ Kdipp: { BY: 0.2, MA: 0.833, FY: 2, G2: nil, XE: nil },
86
+ Kdippp: { BY: 0.9, MA: 1.67, FY: 100, G2: nil, XE: nil },
87
+ Kdipppp: { BY: 0.12, MA: 0.833, FY: nil, G2: nil, XE: nil },
88
+ Kdippppp: { BY: 0.66, MA: nil, FY: 1, G2: nil, XE: nil },
89
+ Ki20: { BY: 0.05, MA: 0.0417, FY: 0.05, G2: nil, XE: 0.095 },
90
+ Ki25p: { BY: nil, MA: nil, FY: 0.25, G2: 0.3, XE: 0.125 },
91
+ Ki25pp: { BY: nil, MA: nil, FY: 0.25, G2: nil, XE: nil },
92
+ KiAPC: { BY: 0.15, MA: 0.03, FY: 0.08, G2: nil, XE: 0.15 },
93
+ Kifb: { BY: 0.15, MA: 0.0167, FY: nil, G2: nil, XE: nil },
94
+
95
+ Kifip: { BY: 0.008, MA: nil, FY: nil, G2: nil, XE: nil },
96
+ Kifipp: { BY: 0.05, MA: nil, FY: nil, G2: nil, XE: nil },
97
+ Kih1p: { BY: 0.001, MA: nil, FY: 1, G2: nil, XE: nil },
98
+ Kih1pp: { BY: 0.64, MA: 0.2, FY: 40, G2: nil, XE: nil },
99
+ Kih1ppp: { BY: 0.1, MA: 0.667, FY: 40, G2: nil, XE: nil },
100
+ Kih1pppp: { BY: 0.032, MA: nil, FY: nil, G2: nil, XE: nil },
101
+ Kih1ppppp: { BY: 0.01, MA: nil, FY: 40, G2: nil, XE: nil },
102
+ Kitfp: { BY: 0.6, MA: 0.0417, FY: 1, G2: nil, XE: nil },
103
+ Kitfpp: { BY: 8, MA: 0.0167, FY: nil, G2: nil, XE: nil },
104
+ Kitfppp: { BY: nil, MA: 0.0167, FY: 10, G2: nil, XE: nil },
105
+ Kiwee: { BY: nil, MA: nil, FY: 1, G2: 1, XE: 3 },
106
+ Ks20p: { BY: 0.001, MA: nil, FY: 0.005, G2: nil, XE: 1 },
107
+ Ks20pp: { BY: 10, MA: 2.5, FY: 0.1, G2: nil, XE: nil },
108
+ Ksap: { BY: 0.0008, MA: nil, FY: nil, G2: nil, XE: nil },
109
+ Ksapp: { BY: 0.005, MA: 0.00417, FY: 0.02, G2: nil, XE: nil },
110
+ Ksbp: { BY: 0.004, MA: 0.00167, FY: 0.02, G2: nil, XE: 0.1 },
111
+ Ksbpp: { BY: 0.04, MA: 0.005, FY: nil, G2: nil, XE: nil },
112
+ Ksep: { BY: nil, MA: 0.00133, FY: nil, G2: nil, XE: nil },
113
+ Ksepp: { BY: 0.15, MA: 0.05, FY: nil, G2: nil, XE: nil },
114
+ Ksip: { BY: 0.036, MA: 0.333, FY: 0.3, G2: nil, XE: nil },
115
+
116
+ Ksipp: { BY: 0.24, MA: nil, FY: nil, G2: nil, XE: nil },
117
+ Kweep: { BY: nil, MA: nil, FY: 0.05, G2: 0.2, XE: 0.1 },
118
+ Kweepp: { BY: nil, MA: nil, FY: 0.5, G2: 2, XE: 0.9 },
119
+ N: { BY: 1, MA: 1, FY: 4, G2: nil, XE: nil },
120
+ CycD⁰: { BY: 0.108, MA: 0.5, FY: 0.05, G2: nil, XE: nil }
121
+ }
122
+
123
+ # We choose the mammalian parameter set.
124
+ PARAMETER_SET = :MA
125
+
126
+ # Singleton method that chooses a given set of constants. Constants starting
127
+ # with "K" are considered rate constants in min⁻¹. All values are converted to
128
+ # floats (Using #to_f method). Using eval, the keys are defined as constants
129
+ # in the top namespace.
130
+ #
131
+ def DATA.choose which
132
+ keys.each { |key|
133
+ a = [ "DATA[:#{key}][:#{which}]" ]
134
+ # Symbols started with "K" are converted from min⁻¹ to num. values in s⁻¹
135
+ x = if "#{key}"[0] == "K" then ".min⁻¹.in :s⁻¹" end
136
+ # This version replaces nils with zeroes:
137
+ eval "#{key} = %s.to_f#{x}" % a
138
+ # This version keeps nils:
139
+ # eval "#{key} = if %s.is_a? Numeric then %s.to_f#{x} else %s end" % ( a * 3 )
140
+ }
141
+ end
142
+
143
+ # Choose the parameter set.
144
+ DATA.choose PARAMETER_SET
@@ -0,0 +1,463 @@
1
+ # encoding: utf-8
2
+
3
+ # Generic cell cycle published in Csikasznagy2006agm. Mammalian constants used.
4
+ # Initial state was obtained as described in Csikasznagy2006agm.
5
+
6
+ require 'sy'; require 'y_nelson' and include YNelson
7
+
8
+ # == TRICKS =====================================================================
9
+
10
+ # The following definitions are used to handle Float::NAN.
11
+ class Float; def nan_to_zero; nan? ? 0.0 : self end end
12
+ class Numeric; def to_f_nan_0; to_f.nan_to_zero end end
13
+
14
+ # The following definitions are used to fine-step degradation.
15
+ #
16
+ class FirstOrderDegradation < Proc
17
+ def fine_step( step, n )
18
+ fine = step.to_f / n
19
+ -> v { orig = v; n.times { v -= call * v * fine }; ( orig - v ) / step }
20
+ end
21
+ end
22
+
23
+ def fod &nullary_block; FirstOrderDegradation.new &nullary_block end
24
+
25
+
26
+
27
+
28
+ # ==============================================================================
29
+ # THE MODEL ITSELF
30
+ # ==============================================================================
31
+
32
+ # Empirical places (in arbitrary units); they are the output of the cell cycle.
33
+ #
34
+ A_phase = Place m!: 0 # in situ
35
+ S_phase = Place m!: 0 # in situ
36
+ # TODO: Cdc20A is a part of the Virginia cycle, but not as 0/1 value, user must be adaptable
37
+ # Cdc20A = Place m!: 1 # in situ p
38
+
39
+ # Csikasznagy2006agm distinguishes 2 cases and has optional G2 module.
40
+ CASE = 1; G2_MODULE = true
41
+
42
+
43
+ # ==============================================================================
44
+ # THERE IS ANOTHER FILE WITH MODEL PARAMETERS THAT GETS LOADED HERE:
45
+ # cell_cycle/virginia/mammalian_constants.rb
46
+ # ==============================================================================
47
+
48
+ begin; require_relative './virginia_tech/mammalian_constants'; rescue LoadError
49
+ require './virginia_tech/mammalian_constants'
50
+ end
51
+
52
+ # == PLACES =====================================================================
53
+
54
+ # Cell mass
55
+ Mass = Place m!: { 1 => 1.098, 2 => 1.568 }[ CASE ]
56
+
57
+ # License that ensures that the cytokinesis occurs not more than once per cycle.
58
+ Ck_license = Place m!: 0
59
+
60
+ # === Module 1
61
+ Cdc20T = Place m!: { 1 => 2.66, 2 => 2.7 }[ CASE ] # Cdc20 total
62
+ Cdc20A = Place m!: { 1 => 0.708, 2 => 0.76 }[ CASE ]
63
+ APCP = Place m!: { 1 => 0.717, 2 => 0.78 }[ CASE ]
64
+
65
+ # === Module 2
66
+ Cdh1 = Place m!: { 1 => 0.999, 2 => 0.999 }[ CASE ]
67
+
68
+ # === Module 4
69
+ CycB = Place m!: { 1 => 0.289, 2 => 0.5 }[ CASE ] # Cdc2/CycB
70
+ ActCycB = Place m!: { 1 => 0.289, 2 => 0.22 }[ CASE ]
71
+
72
+ # === Module 5
73
+ PreMPF = Place m!: { 1 => 0, 2 => 0.29 }[ CASE ]
74
+
75
+ # === Module 6
76
+ TriB = Place m!: { 1 => 0, 2 => 0 }[ CASE ] # trimer CKI / CycB / Cdk
77
+
78
+ # === Module 8
79
+ CKI = Place m!: { 1 => 0.343, 2 => 0.26 }[ CASE ]
80
+
81
+ # === Module 10
82
+ CycE = Place m!: { 1 => 0.414, 2 => 0.73 }[ CASE ]
83
+ ActCycE = Place m!: { 1 => 0.181, 2 => 0.53 }[ CASE ]
84
+
85
+ # === Module 13
86
+ CycA = Place m!: { 1 => 0.0280, 2 => 0.062 }[ CASE ]
87
+ ActCycA = Place m!: { 1 => 0.0124, 2 => 0.045 }[ CASE ]
88
+
89
+ # == PLACES WITH ASSIGNMENT TRANSITIONS =========================================
90
+
91
+ CycD = ϝ Mass do |m| m * CycD⁰ end
92
+
93
+ # === Module 1
94
+ Cdc14 = ϝ :Cdc20A do |a| a end
95
+
96
+ # === Module 3
97
+ TFB = ϝ :ActCycB do |b| GK.( Kafb * b, Kifb, Jafb, Jifb ) end
98
+
99
+ # === Module 4
100
+ Vsb = ϝ :TFB do |tfb| Ksbp + Ksbpp * tfb end
101
+ Vdb = ϝ :Cdh1, :Cdc20A do |cdh1, a| Kdbp + Kdbpp * cdh1 + Kdbppp * a end
102
+ Cdk1P_CycB = ϝ :CycB, :ActCycB, :TriB do |b, ab, triB| b - ab - triB end
103
+ Cdk1_CycB_CKI = ϝ :CycB, :ActCycB, :PreMPF do |b, ab, f| b - ab - f end
104
+
105
+ # === Module 5 (G2 module) -- not included in mammalian cycle
106
+ Cdc25 = ϝ :ActCycB, :Cdc14 do |b, cdc14|
107
+ # Rescue 0 makes the closure return 0 rather than raising error over Ki25p etc.
108
+ # constants being equal to nil (not present in the mammalian cycle).
109
+ GK.( Ka25 * b, Ki25p + Ki25pp * cdc14, Ja25, Ji25 ).to_f_nan_0 rescue 0
110
+ end
111
+ V25 = ϝ :Cdc25 do |cdc25| ( K25p + K25pp * cdc25 ).to_f_nan_0 rescue 0 end
112
+ Vwee = ϝ :Wee1 do |wee1| ( Kweep + Kweepp * wee1 ).to_f_nan_0 rescue 0 end
113
+ Wee1 = ϝ :Cdc14, :ActCycB do |cdc14, b|
114
+ GK.( Kaweep + Kaweepp * cdc14, Kiwee * b, Jawee, Jiwee ).to_f_nan_0 rescue 0
115
+ end
116
+
117
+ # === Module 7 -- Not included in the mammalian cycle
118
+ TFI = ϝ :Cdc14, :ActCycB do |cdc14, actCycB|
119
+ GK.( Kafi * cdc14, Kifip + Kifipp * actCycB, Jafi, Jifi ).to_f_nan_0 rescue 0
120
+ end
121
+
122
+ # === Module 12
123
+ TriA = ϝ :CycA, :ActCycA do |a, actCycA| [ a - actCycA, 0 ].max rescue 0 end
124
+
125
+ # === Module 8
126
+ Vsi = ϝ :TFI do |tfi| ( Ksip + ( Ksipp * tfi ) ).to_f_nan_0 rescue 0 end
127
+
128
+ Vdi = case PARAMETER_SET # The function used depends on the parameter set.
129
+ when :BY then
130
+ ϝ :ActCycA, :ActCycB, :ActCycE, :CycD, :Cdc14 do |a, b, e, d, cdc14|
131
+ ( Kdip + Kdipp * a + Kdippp * b + Kdipppp * e + Kdippppp * d ) /
132
+ ( 1 + cdc14 / J14di ) # <---- problem, J14di is 0
133
+ end
134
+ else
135
+ ϝ :ActCycA, :ActCycB, :ActCycE, :CycD, :Cdc14 do |a, b, e, d, _|
136
+ Kdip + Kdipp * a + Kdippp * b + Kdipppp * e + Kdippppp * d
137
+ end
138
+ end
139
+
140
+ # REMARK: Band-aided not to go under 0
141
+ FreeCKI = ϝ :CKI, :TriA, :TriB, :TriE do |cki, a, b, e|
142
+ [ cki - a - b - e, 0.0 ].max
143
+ end
144
+ # FreeCKI = ϝ :CKI, :TriA, :TriB, :TriE do |cki, a, b, e| cki - a - b - e end
145
+
146
+ # === Module 9
147
+ # REMARK: Band-aided not to go under 0.
148
+ TriE = ϝ :CycE, :ActCycE do |e, actCycE|
149
+ [ e - actCycE, 0 ].max
150
+ end
151
+
152
+ # === Module 10
153
+ Vde = ϝ :ActCycA, :ActCycB, :ActCycE do |a, b, e|
154
+ Kdep + Kdepp * e + Kdeppp * a + Kdepppp * b
155
+ end
156
+
157
+ # === Module 11
158
+ Vatf = ϝ :ActCycA, :ActCycE, :CycD do |actCycA, actCycE, d|
159
+ Katfp + Katfpp * actCycA + Katfppp * actCycE + Katfpppp * d
160
+ end
161
+
162
+ TFE = ϝ :Vatf, :ActCycA, :ActCycB do |v, a, b|
163
+ GK.( v, Kitfp + Kitfpp * b + Kitfppp * a, Jatf, Jitf )
164
+ end
165
+
166
+ # === Module 13
167
+ Vda = ϝ :Cdc20A, :Cdc20T do |a, t| Kdap + Kdapp * a + Kdappp * t end
168
+
169
+ # == TRANSITIONS ================================================================
170
+
171
+ Cell_growth = TS Mass, Mass: 1 do |m| m * CELL_GROWTH_RATE end
172
+
173
+ Cytokinesis = AT Mass, Ck_license, domain: [ Mass, Ck_license, ActCycB ] do
174
+ |mass, license, b|
175
+ # Cytokinesis happens when ActCycB drops below the threshold
176
+ if license == 1 and b < CycB_DIVISION_THRESHOLD then
177
+ [ mass / 2, 0 ] # mass is halved, license consumed (set to value 0)
178
+ else
179
+ [ mass, license ]
180
+ end
181
+ end
182
+
183
+ License_cocking = AT Ck_license, domain: [ Ck_license, ActCycB ] do |license, b|
184
+ # License is cocked (value 1) if ActCycB goes above the threshold * 1.1
185
+ if b > CycB_DIVISION_THRESHOLD * 1.1 then 1 else license end
186
+ end
187
+
188
+ # === Module 1
189
+
190
+ Cdc20T_synthesis = -> b { x = b ** N; ( Ks20p + Ks20pp * x ) / ( J20 ** N + x ) }
191
+ Cdc20T_degradation = -> cdc20T { cdc20T * Kd20 }
192
+
193
+ Cdc20T_change = TS ActCycB, Cdc20T, Cdc20T: 1 do |b, t|
194
+ step = world.simulation.step.to_f
195
+ fine_step = step / 50.0
196
+ orig = t
197
+ 50.times do
198
+ t += ( Cdc20T_synthesis.( b ) - Cdc20T_degradation.( t ) ) * fine_step
199
+ end
200
+ ( t - orig ) / step # return the positive change rate
201
+ end
202
+
203
+ # REMARK: This section has to be band-aided for speed:
204
+ # Cdc20T_synthesis = TS ActCycB, Cdc20T: 1 do |b|
205
+ # x = b ** N; ( Ks20p + Ks20pp * x ) / ( J20 ** N + x )
206
+ # end
207
+ # Cdc20T_degradation = TS Cdc20T: -1, rate: Kd20
208
+
209
+ Cdc20_activation = -> t, a, apcp { x = t - a; Ka20 * apcp * x / ( Ja20 + x ) }
210
+ Cdc20A_inactivation = -> a { a * Ki20 / ( Ji20 + a ) }
211
+ Cdc20A_degradation = -> a { a * Kd20 }
212
+
213
+ Cdc20A_change = TS Cdc20T, Cdc20A, APCP, Cdc20A: 1 do |t, a, apcp|
214
+ step = world.simulation.step.to_f
215
+ fine_step = step / 50.0
216
+ orig = a
217
+ 50.times do
218
+ a = a +
219
+ ( Cdc20_activation.( t, a, apcp ) -
220
+ Cdc20A_inactivation.( a ) -
221
+ Cdc20A_degradation.( a )
222
+ ) * fine_step
223
+ end
224
+ ( a - orig ) / step # return the positive change rate
225
+ end
226
+
227
+ # REMARK: This section has to be band-aided for speed:
228
+ # Cdc20_activation = TS Cdc20T, Cdc20A, APCP, Cdc20A: 1 do |t, a, apcp|
229
+ # x = t - a; Ka20 * apcp * x / ( Ja20 + x )
230
+ # end
231
+ # Cdc20A_inactivation = TS Cdc20A: -1 do |a| a * Ki20 / ( Ji20 + a ) end
232
+ # Cdc20A_degradation = TS Cdc20A: -1, rate: Kd20
233
+
234
+ # REMARK: Just like in CI, this section has to be band-aided.
235
+
236
+ APC_activation = -> b, apcp { x = 1 - apcp; KaAPC * b * x / ( JaAPC + x ) }
237
+ APC_inactivation = -> apcp { KiAPC * apcp / ( JiAPC + apcp ) }
238
+
239
+ APC_change = TS ActCycB, APCP, APCP: 1 do |b, apcp|
240
+ step = world.simulation.step.to_f
241
+ fine_step = step / 50.0
242
+ orig = apcp
243
+ 50.times do
244
+ apcp += ( APC_activation.( b, apcp ) - APC_inactivation.( apcp ) ) * fine_step
245
+ end
246
+ ( apcp - orig ) / step
247
+ end
248
+
249
+ # APC_activation = TS ActCycB, APCP, APCP: 1 do |b, apcp|
250
+ # x = 1 - apcp; KaAPC * b * x / ( JaAPC + x )
251
+ # APC_inactivation = TS APCP: -1 do |apcp| KiAPC * apcp / ( JiAPC + apcp ) end
252
+
253
+ # === Module 2
254
+
255
+ # REMARK: Cdh1 activation and inactivation joined into 1 and band-aided in CI,
256
+ # and same has to be done here.
257
+
258
+ Cdh1_activation = -> cdc14, cdh1 {
259
+ x = 1 - cdh1; ( Kah1p + Kah1pp * cdc14 ) * x / ( Jah1 + x ) # orig. formula
260
+ }
261
+
262
+ Cdh1_inactivation = -> a, b, d, e, cdh1 {
263
+ ( Kih1p + Kih1pp * a + Kih1ppp * b + Kih1pppp * e + Kih1ppppp * d ) *
264
+ cdh1 / ( Jih1 + cdh1 )
265
+ }
266
+
267
+ Cdh1_change =
268
+ TS ActCycA, ActCycB, CycD, ActCycE, Cdc14, Cdh1, Cdh1: 1 do
269
+ |a, b, d, e, cdc14, cdh1|
270
+ step = world.simulation.step.to_f
271
+ fine_step = step / 500
272
+ orig = cdh1
273
+ 500.times do # fine-stepped formula
274
+ cdh1 += ( Cdh1_activation.( cdc14, cdh1 ) -
275
+ Cdh1_inactivation.( a, b, d, e, cdh1 ) ) * fine_step
276
+ end
277
+ ( cdh1 - orig ) / step
278
+ end
279
+
280
+ # Cdh1_activation = TS Cdc14, Cdh1, Cdh1: 1 do |cdc14, cdh1|
281
+ # x = 1 - cdh1; ( Kah1p + Kah1pp * cdc14 ) * x / ( Jah1 + x ) # orig. formula
282
+ # end
283
+ # Cdh1_inactivation = TS ActCycA, ActCycB, CycD, ActCycE, Cdh1, Cdh1: -1 do
284
+ # |a, b, d, e, cdh1|
285
+ # ( Kih1p + Kih1pp * a + Kih1ppp * b + Kih1pppp * e + Kih1ppppp * d ) *
286
+ # cdh1 / ( Jih1 + cdh1 )
287
+ # end
288
+
289
+ # === Module 4
290
+
291
+ CycB_synthesis = TS Vsb, Mass, CycB: 1 do |v, m| v * m end
292
+ CycB_degradation = TS Vdb, CycB, CycB: -1 do |v, b|
293
+ fod { v }.fine_step( world.simulation.step, 50 ).( b )
294
+ # v * b
295
+ end
296
+ ActCycB_synthesis = TS Vsb, Mass, ActCycB: 1 do |v, m| v * m end
297
+
298
+ ActCycB_freeing_due_to_degradation_of_CKI =
299
+ TS Vdi, CycB, PreMPF, ActCycB, ActCycB: 1 do |v, b, preMPF, actCycB|
300
+ v * ( b - preMPF - actCycB )
301
+ end
302
+
303
+ ActCycB_freeing_due_dissoociation_from_CKI =
304
+ TS CycB, PreMPF, ActCycB, ActCycB: 1 do |b, preMPF, actCycB|
305
+ Kdib * ( b - preMPF + actCycB )
306
+ end
307
+
308
+ ActCycB_creation_by_dephosphorylation_of_CycB =
309
+ TS V25, CycB, TriB, ActCycB, ActCycB: 1 do |v, b, triB, actCycB|
310
+ v * ( b - triB - actCycB )
311
+ end
312
+
313
+ ActCycB_phosphorylation_by_Wee1 =
314
+ TS Vwee, ActCycB, ActCycB: -1 do |v, b| v * b end
315
+ ActCycB_asociation_with_CKI =
316
+ TS FreeCKI, ActCycB, ActCycB: -1 do |freeCKI, b| freeCKI * b * Kasb end
317
+ ActCycB_degradation = TS Vdb, ActCycB, ActCycB: -1 do |v, b|
318
+ fod { v }.fine_step( world.simulation.step, 50 ).( b )
319
+ # v * b
320
+ end
321
+
322
+ # === Module 5
323
+
324
+ MPF_phosphorylation = TS Vwee, CycB, PreMPF, PreMPF: 1 do |v, b, preMPF|
325
+ v * ( b - preMPF )
326
+ end
327
+
328
+ PreMPF_dephosphorylation =
329
+ TS V25, PreMPF, PreMPF: -1 do |v, preMPF| v * preMPF end
330
+ PreMPF_degradation =
331
+ TS Vdb, PreMPF, PreMPF: -1 do |v, preMPF| v * preMPF end
332
+
333
+ # === Module 6
334
+
335
+ TriB_assembly = TS CycB, TriB, FreeCKI, TriB: 1 do |b, triB, freeCKI|
336
+ Kasb * ( b - triB ) * freeCKI
337
+ end
338
+
339
+ TriB_dissociation =
340
+ TS TriB: -1, rate: Kdib
341
+ TriB_decrease_due_to_CycB_degradation =
342
+ TS Vdb, TriB, TriB: -1 do |vdb, triB| vdb * triB end
343
+ TriB_decrease_due_to_CKI_degradation =
344
+ TS Vdi, TriB, TriB: -1 do |vdi, triB| vdi * triB end
345
+
346
+ # === Module 8
347
+
348
+ CKI_synthesis = TS Vsi, CKI: 1 do |v| v end
349
+
350
+ CKI_degradation = TS Vdi, CKI, CKI: -1 do |v, cki|
351
+ fod { v }.fine_step( world.simulation.step, 50 ).( cki )
352
+ # v * cki
353
+ end
354
+
355
+ # === Module 10
356
+
357
+ CycE_synthesis =
358
+ TS TFE, Mass, CycE: 1 do |f, m| ( Ksep + Ksepp * f ) * m end
359
+
360
+ CycE_degradation = TS Vde, CycE, CycE: -1 do |v, e|
361
+ # v * e
362
+ fod { v }.fine_step( world.simulation.step, 50 ).( e )
363
+ end
364
+
365
+ ActCycE_synthesis =
366
+ TS TFE, Mass, ActCycE: 1 do |f, m| ( Ksep + Ksepp * f ) * m end
367
+
368
+ ActCycE_freeing_due_to_degradation_of_CKI =
369
+ TS Vdi, TriE, ActCycE: 1 do |v, triE| v * triE end
370
+
371
+ ActCycE_freeing_due_to_dissociation_from_CKI =
372
+ TS TriE, ActCycE: 1 do |triE| Kdie * triE end
373
+
374
+ # REMARK: band-aided in CI not to go under 0, fine-stepped here.
375
+ ActCycE_degradation = TS Vde, FreeCKI, ActCycE, ActCycE: -1 do |v, freeCKI, e|
376
+ # ( v + Kase * freeCKI ) * e
377
+ fod { v + Kase * freeCKI }.fine_step( world.simulation.step, 50 ).( e )
378
+ end
379
+
380
+ # === Module 13
381
+
382
+ CycA_synthesis =
383
+ TS TFE, Mass, CycA: 1 do |f, m| ( Ksap + Ksapp * f ) * m end
384
+
385
+ CycA_degradation = TS Vda, CycA, CycA: -1 do |v, a|
386
+ # v * a
387
+ fod { v }.fine_step( world.simulation.step, 50 ).( a )
388
+ end
389
+
390
+ ActCycA_synthesis =
391
+ TS TFE, Mass, ActCycA: 1 do |f, m| ( Ksap + Ksapp * f ) * m end
392
+
393
+ ActCycA_freeing_due_to_degradation_of_CKI =
394
+ TS Vdi, TriA, ActCycE: 1 do |v, triA| v * triA end
395
+
396
+ ActCycA_freeing_due_to_dissociation_from_CKI =
397
+ TS TriA, ActCycA: 1 do |triA| Kdia * triA end
398
+
399
+ # band-aided
400
+ ActCycA_degradation = TS Vda, FreeCKI, ActCycA, ActCycA: -1 do |v, freeCKI, a|
401
+ # ( v + Kasa * freeCKI ) * a
402
+ fod { v + Kasa * freeCKI }.fine_step( world.simulation.step, 50 ).( a )
403
+ end
404
+
405
+ # === finalize
406
+
407
+ finalize # YNelson command that finishes the net from the prescribed commands.
408
+
409
+ # ==============================================================================
410
+ # THIS CONCLUDES THE MODEL. COMMANDS BELOW ARE JUST SAVED COMMANDS TO SERVE AS
411
+ # HELP WHEN PERUSING THE MODEL THROUGH THE COMMAND LINE
412
+ # ==============================================================================
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+ =begin
432
+
433
+ # === Whole CELL_CYCLE Nelson net ===
434
+
435
+ CELL_CYCLE = Net() << A_phase << S_phase << Cdc20A
436
+
437
+ # === Cell growh net ===
438
+
439
+ CELL_GROWTH_NET = Net() <<
440
+ Mass << Cell_growth << CycD << transition( :CycD_ϝ ) << # cell growth
441
+ CycB << ActCycB << # cyclin B
442
+ Ck_license << Cytokinesis << License_cocking # cytokinesis
443
+
444
+ set_step 5 # simulation settings
445
+ set_sampling 300
446
+ set_target_time 3600 * 24 * 4
447
+
448
+ new_simulation
449
+
450
+
451
+ pm # prints marking of the newly created simulation
452
+ simulation.step! # peforms a single simulation step
453
+ pm # prints marking again
454
+
455
+ # simulation.run! upto: 3600 # we can run 1 hour of this simulation
456
+
457
+ recording.plot # and plot the recording
458
+
459
+ # and do other things with the recording, such as resampling,
460
+ # feature extraction, saving to a file, reconstruction of a new
461
+ # simulation object at a given time etc.
462
+
463
+ =end
data/lib/cell_cycle.rb ADDED
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ # YSupport is a collection of methods used in Y gems.
4
+ #
5
+ require "cell_cycle/version"
@@ -0,0 +1,35 @@
1
+ #! /usr/bin/ruby
2
+ # encoding: utf-8
3
+
4
+ require 'minitest/autorun'
5
+ require 'sy'
6
+ require 'y_nelson' and include YNelson
7
+
8
+ describe :simple_cell_cycle do
9
+ before do
10
+ require './../lib/cell_cycle/simple'
11
+ end
12
+
13
+ it "should work" do
14
+ CELL_CYCLE.must_be_kind_of YNelson::Net
15
+ CELL_CYCLE.places.must_include A_phase
16
+ CELL_CYCLE.places.must_include S_phase
17
+ CELL_CYCLE.places.must_include Cdc20A
18
+ S_phase_duration.must_equal 12.h
19
+ S_phase_start.must_equal 5.h
20
+ S_phase_end.must_equal 17.h
21
+ A_phase_start.must_equal 3.h
22
+ A_phase_end.must_equal 17.h
23
+ Cdc20A_start.must_equal 22.h
24
+ Cdc20A_end.must_equal 1.h
25
+ CELL_CYCLE.A_tt.names.must_equal [ :A_phase_ϝ, :S_phase_ϝ, :Cdc20A_ϝ ]
26
+ # the simulation should look good
27
+ sim = CELL_CYCLE.simulation time: 0..36.h.in( :s ),
28
+ step: 1.min.in( :s ),
29
+ sampling: 20.min.in( :s )
30
+ sim.simulation_method.must_equal :pseudo_euler
31
+ sim.run!
32
+ sim.recording.marking( S_phase, A_phase, Cdc20A ).plot
33
+ sleep 15
34
+ end
35
+ end