y_petri 2.1.51 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3896cb4a505575a8a8e087b846183a901be76fc
4
- data.tar.gz: af87fbeae3c77dced19c699d8295b148452f5743
3
+ metadata.gz: 83dcb590fe26b6d6bb33cf3294d36f3ec2e55739
4
+ data.tar.gz: 406058cde1b0a815b77dc4feedd0da86cd0613e6
5
5
  SHA512:
6
- metadata.gz: 71c519d53c258dd1f1135ce270d31aeb17e1cf5ee416e3b3f6d0db1968bf4c49e519839ab9a576eaf118bc3f3f119ed6776bce130aaf743fa17bafd17cc6c3f1
7
- data.tar.gz: c81ab243918a093e49f755cc5f4d8ca4ae2d2fdffbc3682562e88000dcafedc93e714eed347c71a6b0f641e186e62436971535711f5b4411cf21196e3b3242c6
6
+ metadata.gz: 1aef6f5b2bee23dbfae95c73806633355dc83daa7af0f87a3384d7442f8128eaecfe53fcdef7a48864269ca59ac6449d7fc161bb4e6b66803736c8145bcbe430
7
+ data.tar.gz: 921a481415b9c45df393c46cc709eac71eaae664562e8c971aee49c07820426813aecdd1863b6b697fd5a5ab18dc208c8940850627bae2e6d9b3f63fab75a18a
data/lib/y_petri/net.rb CHANGED
@@ -44,8 +44,8 @@ class YPetri::Net
44
44
  with: { net: self } )
45
45
  end
46
46
 
47
- # Includes a place in the net. Returns _true_ if successful, _false_ if the
48
- # place is already included in the net.
47
+ # Includes a place in the receiver. Returns _true_ if successful, _false_ if
48
+ # the place is already included in the receiver net.
49
49
  #
50
50
  def include_place id
51
51
  pl = Place().instance( id )
@@ -53,9 +53,9 @@ class YPetri::Net
53
53
  true.tap { @places << pl }
54
54
  end
55
55
 
56
- # Includes a transition in the net. Returns _true_ if successful, _false_ if
57
- # the transition is already included in the net. The arcs of the transition
58
- # being included may only connect to the places already in the net.
56
+ # Includes a transition in the receiver. Returns _true_ if successful, _false_
57
+ # if the transition is already included in the net. The arcs of the transition
58
+ # being included may only connect to the places already in the receiver net.
59
59
  #
60
60
  def include_transition id
61
61
  tr = Transition().instance( id )
@@ -65,9 +65,9 @@ class YPetri::Net
65
65
  true.tap { @transitions << tr }
66
66
  end
67
67
 
68
- # Excludes a place from the net. Returns _true_ if successful, _false_ if the
69
- # place was not found in the net. A place may not be excluded from the net so
70
- # long as any transitions in the net connect to it.
68
+ # Excludes a place from the receiver. Returns _true_ if successful, _false_
69
+ # if the place was not found in the receiver net. A place may not be excluded
70
+ # from the receiver so long as any transitions therein connect to it.
71
71
  #
72
72
  def exclude_place id
73
73
  pl = Place().instance( id )
@@ -76,33 +76,75 @@ class YPetri::Net
76
76
  false.tap { return true if @places.delete( pl ) }
77
77
  end
78
78
 
79
- # Excludes a transition from the net. Returns _true_ if successful, _false_ if
80
- # the transition was not found in the net.
79
+ # Excludes a transition from the receiver. Returns _true_ if successful,
80
+ # _false_ if the transition was not found in the receiver net.
81
81
  #
82
82
  def exclude_transition id
83
83
  tr = Transition().instance( id )
84
84
  false.tap { return true if @transitions.delete( tr ) }
85
85
  end
86
86
 
87
- # Includes an element in the net.
87
+ # Includes another net in the receiver net. Returns _true_ if successful
88
+ # (ie. if there was any change to the receiver net), _false_ if the receiver
89
+ # net already includes the argument net.
90
+ #
91
+ def include_net id
92
+ net = Net().instance( id )
93
+ p_rslt = net.pp.map { |p| include_place p }.reduce :|
94
+ t_rslt = net.tt.map { |t| include_transition t }.reduce :|
95
+ p_rslt || t_rslt
96
+ end
97
+ alias merge! include_net
98
+
99
+ # Excludes another net from the receiver net. Returns _true_ if successful
100
+ # (ie. if there was any change to the receiver net), _false_ if the receiver
101
+ # net contained no element of the argument net.
102
+ #
103
+ def exclude_net id
104
+ net = Net().instance( id )
105
+ t_rslt = net.tt.map { |t| exclude_transition t }.reduce :|
106
+ p_rslt = net.pp.map { |p| exclude_place p }.reduce :|
107
+ p_rslt || t_rslt
108
+ end
109
+
110
+ # Includes an element (place or transition) in the net.
88
111
  #
89
112
  def << element_id
90
113
  begin
91
- element = self.class.place( element_id )
92
- type = :place
114
+ type, element = :place, self.class.place( element_id )
93
115
  rescue NameError, TypeError
94
116
  begin
95
- element = self.class.transition( element_id )
96
- type = :transition
117
+ type, element = :transition, self.class.transition( element_id )
97
118
  rescue NameError, TypeError => err
98
119
  raise TypeError, "Current world contains no place or transition " +
99
120
  "identified by #{element_id}! (#{err})"
100
121
  end
101
122
  end
102
- # Separated to minimize the code inside rescue clause:
103
- if type == :place then include_place element
104
- elsif type == :transition then include_transition element
105
- else fail "Implementation error in YPetri::Net#<<!" end
123
+ case type # Factored out to minimize the code inside the rescue clause.
124
+ when :place then include_place( element )
125
+ when :transition then include_transition( element )
126
+ else fail "Implementation error!" end
127
+ return self # important to enable chaining, eg. foo_net << p1 << p2 << t1
128
+ end
129
+
130
+ # Creates a new net that contains all the places and transitions of both
131
+ # operands.
132
+ #
133
+ def + other
134
+ self.class.send( :new ).tap do |net|
135
+ net.merge! self
136
+ net.merge! other
137
+ end
138
+ end
139
+
140
+ # Creates a new net that contains the places and transition of the receiver
141
+ # after excluding the second operand.
142
+ #
143
+ def - other
144
+ self.class.send( :new ).tap do |net|
145
+ net.merge! self
146
+ net.exclude_net other
147
+ end
106
148
  end
107
149
 
108
150
  # Is the net _functional_?
@@ -133,10 +175,10 @@ class YPetri::Net
133
175
  # Returns a string briefly describing the net.
134
176
  #
135
177
  def to_s
136
- "#<Net: " +
137
- ( name.nil? ? "%s" : "name: #{name}, %s" ) %
138
- "#{pp.size rescue '∅'} places, #{tt.size rescue '∅'} transitions" +
139
- ">"
178
+ form = "#<Net: %s>"
179
+ content = ( name.nil? ? "%s" : "name: #{name}, %s" ) %
180
+ "#{pp.size rescue '∅'} places, #{tt.size rescue '∅'} transitions"
181
+ form % content
140
182
  end
141
183
 
142
184
  # Inspect string of the instance.
@@ -1,4 +1,4 @@
1
1
  module YPetri
2
- VERSION = "2.1.51"
2
+ VERSION = "2.2.0"
3
3
  DEBUG = false
4
4
  end
@@ -1,5 +1,5 @@
1
1
  #! /usr/bin/ruby
2
- # -*- coding: utf-8 -*-
2
+ # encoding: utf-8
3
3
 
4
4
  gem 'minitest', '=4.7.4'
5
5
  require 'minitest/autorun'
@@ -16,7 +16,7 @@ describe "Graphviz visualization" do
16
16
  @m.Place name: :D, m!: 2.5
17
17
  @m.Transition name: :A_pump, s: { A: -1 }, rate: proc { 0.005 }
18
18
  @m.Transition name: :B_decay, s: { B: -1 }, rate: 0.05
19
- @m.Transition name: :C_guard, assignment: true, codomain: :C, action: -> { 2 }
19
+ @m.Transition name: :C_guard, codomain: :C, assignment: -> { 2 }
20
20
  end
21
21
 
22
22
  it "should work" do
data/test/agent_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/ruby
2
2
  # encoding: utf-8
3
3
 
4
- gem 'minitest', '=4.7.4'
4
+ # gem 'minitest', '=4.7.4' # try uncommenting this line if problems appear
5
5
  require 'minitest/autorun'
6
6
  require_relative '../lib/y_petri' # tested component itself
7
7
  # require 'y_petri'
data/test/net_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/ruby
2
2
  # encoding: utf-8
3
3
 
4
- gem 'minitest', '=4.7.4'
4
+ # gem 'minitest', '=4.7.4' # try uncommenting this line if problems appear
5
5
  require 'minitest/autorun'
6
6
  require_relative '../lib/y_petri' # tested component itself
7
7
  # require 'y_petri'
data/test/place_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/ruby
2
2
  # encoding: utf-8
3
3
 
4
- gem 'minitest', '=4.7.4'
4
+ # gem 'minitest', '=4.7.4' # try uncommenting this line if problems appear
5
5
  require 'minitest/autorun'
6
6
  require_relative '../lib/y_petri' # tested component itself
7
7
  # require 'y_petri'
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/ruby
2
2
  # encoding: utf-8
3
3
 
4
- gem 'minitest', '=4.7.4'
4
+ # gem 'minitest', '=4.7.4' # try uncommenting this line if problems appear
5
5
  require 'minitest/autorun'
6
6
  require_relative '../lib/y_petri' # tested component itself
7
7
  # require 'y_petri'
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/ruby
2
2
  # encoding: utf-8
3
3
 
4
- gem 'minitest', '=4.7.4'
4
+ # gem 'minitest', '=4.7.4' # try uncommenting this line if problems appear
5
5
  require 'minitest/autorun'
6
6
  require 'y_support/typing'
7
7
 
data/test/world_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/ruby
2
2
  # encoding: utf-8
3
3
 
4
- gem 'minitest', '=4.7.4'
4
+ # gem 'minitest', '=4.7.4' # try uncommenting this line if problems appear
5
5
  require 'minitest/autorun'
6
6
  require_relative '../lib/y_petri' # tested component itself
7
7
  # require 'y_petri'
data/test/y_petri_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/ruby
2
2
  # encoding: utf-8
3
3
 
4
- gem 'minitest', '=4.7.4'
4
+ # gem 'minitest', '=4.7.4' # try uncommenting this line if problems appear
5
5
  require 'minitest/autorun'
6
6
  require_relative '../lib/y_petri' # tested component itself
7
7
  # require 'y_petri'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y_petri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.51
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-01 00:00:00.000000000 Z
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: y_support
@@ -182,10 +182,8 @@ files:
182
182
  - test/examples/manual_examples.rb
183
183
  - test/net_test.rb
184
184
  - test/place_test.rb
185
- - test/sim_test
186
185
  - test/simulation_test.rb
187
186
  - test/transition_test.rb
188
- - test/ttp_pathway.rb
189
187
  - test/world_mock.rb
190
188
  - test/world_test.rb
191
189
  - test/y_petri_test.rb
@@ -230,10 +228,8 @@ test_files:
230
228
  - test/examples/manual_examples.rb
231
229
  - test/net_test.rb
232
230
  - test/place_test.rb
233
- - test/sim_test
234
231
  - test/simulation_test.rb
235
232
  - test/transition_test.rb
236
- - test/ttp_pathway.rb
237
233
  - test/world_mock.rb
238
234
  - test/world_test.rb
239
235
  - test/y_petri_test.rb
data/test/sim_test DELETED
@@ -1,565 +0,0 @@
1
- #! /usr/bin/ruby
2
- # -*- coding: utf-8 -*-
3
-
4
- require 'minitest/spec'
5
- require 'minitest/autorun'
6
- require_relative '../lib/y_petri' # tested component itself
7
- # require 'y_petri'
8
- # require 'sy'
9
- require_relative 'workspace_mock'
10
-
11
- describe YPetri::Simulation::TransitionRepresentation do
12
- before do
13
- @pç, @tç, @nç = WORKSPACE_MOCK.()
14
- # Set up places:
15
- @p1 = @pç.nw "P1", 1
16
- @p2 = @pç.nw "P2", 2
17
- @p3 = @pç.nw "P3", 3
18
- @p4 = @pç.nw "P4", 4
19
- @p5 = @pç.nw "P5", 5
20
- # Set up transitions:
21
- @t1 = @tç.nw "T1", s: { @p1 => -1, @p2 => -1, @p4 => 1 },
22
- rate: 0.1
23
- @t2 = @tç.nw "T2", s: { @p1 => -1, @p3 => 1 },
24
- rate: -> a { a * 0.5 }
25
- @t3 = @tç.nw "T3", s: { @p1 => -1, @p2 => -1, @p4 => 1 },
26
- domain: @p3,
27
- rate: -> a { a * 0.5 }
28
- @net = @nç.new << @p1 << @p2 << @p3 << @p4 << @p5
29
- @net.include_transition! @t1
30
- @net.include_transition! @t2
31
- @net << @t3
32
- @s = YPetri::Simulation.new net: @net,
33
- marking_clamps: { @p1 => 2.0, @p5 => 2.0 },
34
- initial_marking: { @p2 => @p2.default_marking,
35
- @p3 => @p3.default_marking,
36
- @p4 => @p4.default_marking }
37
- end
38
-
39
- it "exposes the net" do
40
- @s.net.must_equal @net
41
- @s.net.places.size.must_equal 5
42
- @s.net.transitions.size.must_equal 3
43
- assert @net.include? @t1
44
- assert @s.net.include? @t1
45
- assert @net.include? @t2
46
- assert @s.net.include? @t2
47
- assert @net.include? @t3
48
- assert @s.net.include? @t3
49
- @s.net.transitions.size.must_equal 3
50
- end
51
-
52
- it "exposes Petri net places" do
53
- @s.places.map( &:source ).must_equal [ @p1, @p2, @p3, @p4, @p5 ]
54
- @s.pn.must_equal [ :P1, :P2, :P3, :P4, :P5 ]
55
- end
56
-
57
- it "exposes Petri net transitions" do
58
- @s.transitions.map( &:source ).must_equal [ @t1, @t2, @t3 ]
59
- @s.tn.must_equal [ :T1, :T2, :T3 ]
60
- end
61
-
62
- it "exposes place clamps" do
63
- @s.marking_clamps.values.must_equal [2, 2]
64
- @s.n_clamped.must_equal [:P1, :P5]
65
- end
66
-
67
- it "presents free places" do
68
- @s.free_places.map( &:source ).must_equal [ @p2, @p3, @p4 ]
69
- @s.n_free.must_equal [ :P2, :P3, :P4 ]
70
- end
71
-
72
- it "presents clamped places" do
73
- @s.n_clamped.must_equal [ :P1, :P5 ]
74
- @s.clamped_places.map( &:source ).must_equal [ @p1, @p5 ]
75
- end
76
-
77
- it "exposes initial marking" do
78
- ( @s.free_places.map( &:source ) >> @s.im( *@s.free_places ) )
79
- .must_equal( { @p2 => 2, @p3 => 3, @p4 => 4 } )
80
- ( @s.n_free >> @s.im( *@s.free_places ) )
81
- .must_equal( { P2: 2, P3: 3, P4: 4 } )
82
- @s.im.must_equal [ 2, 3, 4 ]
83
- @s.im_vector.must_equal Matrix[[2], [3], [4]]
84
- @s.im_vector.must_equal @s.iᴍ
85
- end
86
-
87
- it "exposes marking (simulation state)" do
88
- @s.marking.must_equal [2, 3, 4] # (we're after reset)
89
- @s.free_places( :m ).must_equal( { @p2 => 2, @p3 => 3, @p4 => 4 } )
90
- @s.free_pp( :m ).must_equal( { P2: 2, P3: 3, P4: 4 } )
91
- @s.ᴍ.must_equal Matrix[[2], [3], [4]]
92
- end
93
-
94
- it "separately exposes marking of clamped places" do
95
- @s.m( *@s.clamped_places ).must_equal [ 2, 2 ]
96
- @s.clamped_places( :m_clamped ).must_equal( { @p1 => 2, @p5 => 2 } )
97
- @s.clamped_pp( :m_clamped ).must_equal( { P1: 2, P5: 2 } )
98
- @s.ᴍ_clamped.must_equal Matrix[[2], [2]]
99
- end
100
-
101
- it "exposes marking of all places (with capitalized M)" do
102
- @s.pn.must_equal [:P1, :P2, :P3, :P4, :P5]
103
- @s.m.must_equal [ 2, 2, 3, 4, 2 ]
104
- ( @s.places >> @s.m( *@s.places ) )
105
- .must_equal( { @p1 => 2, @p2 => 2, @p3 => 3, @p4 => 4, @p5 => 2 } )
106
- @s.marking_vector.must_equal Matrix[[2], [2], [3], [4], [2]]
107
- end
108
-
109
- it "has stoichiometry matrix for 3. tS transitions" do
110
- @s.tS_stoichiometry_matrix.must_equal Matrix.empty( 3, 0 )
111
- @s.tS_SM.must_equal Matrix.empty( 3, 0 )
112
- end
113
-
114
- it "has stoichiometry matrix for 6. TS transitions" do
115
- @s.TS_SM.must_equal Matrix[[-1, 0, -1], [0, 1, 0], [1, 0, 1]]
116
- @s.SM.must_equal @s.TS_SM
117
- end
118
-
119
- it "presents 1. TS transitions" do
120
- assert_equal [@t1, @t2, @t3], @s.TS_transitions.map( &:source )
121
- assert_equal( { @t1 => :T1, @t2 => :T2, @t3 => :T3 },
122
- @s.TS_transitions.map( &:source ) >> @s.n_TS )
123
- assert_equal [:T1, :T2, :T3], @s.n_TS
124
- end
125
-
126
- it "presents 2. Ts transitions" do
127
- assert_equal [], @s.Ts_transitions
128
- assert_equal [], @s.n_Ts
129
- end
130
-
131
- it "presents 3. tS transitions" do
132
- assert_equal [], @s.tS_transitions
133
- assert_equal [], @s.n_tS
134
- end
135
-
136
- it "presents 4. ts transitions" do
137
- assert_equal [], @s.ts_transitions
138
- assert_equal [], @s.n_ts
139
- end
140
-
141
- it "presents A transitions" do
142
- assert_equal [], @s.A_transitions
143
- assert_equal [], @s.n_A
144
- end
145
-
146
- it "presents S transitions" do
147
- assert_equal [@t1, @t2, @t3], @s.S_transitions.map( &:source )
148
- assert_equal [:T1, :T2, :T3], @s.n_S
149
- end
150
-
151
- it "presents s transitions" do
152
- assert_equal [], @s.s_transitions
153
- assert_equal [], @s.n_s
154
- end
155
-
156
- it "1. handles TS transitions" do
157
- @s.transitions.TS.rate_closures.size.must_equal 3
158
- @s.transitions.TS.flux_vector.must_equal Matrix.column_vector( [ 0.4, 1.0, 1.5 ] )
159
- @s.φ_for_SR.must_equal @s.flux_vector
160
- @s.SR_tt( :φ_for_SR ).must_equal( { T1: 0.4, T2: 1.0, T3: 1.5 } )
161
- @s.first_order_action_vector_for_SR( 1 )
162
- .must_equal Matrix.column_vector [ 0.4, 1.0, 1.5 ]
163
- @s.SR_tt( :first_order_action_for_SR, 1 ).must_equal( T1: 0.4, T2: 1.0, T3: 1.5 )
164
- @s.Δ_SR( 1 ).must_equal Matrix[[-1.9], [1.0], [1.9]]
165
- @s.free_pp( :Δ_SR, 1 ).must_equal( { P2: -1.9, P3: 1.0, P4: 1.9 } )
166
- end
167
-
168
- it "2. handles Ts transitions" do
169
- assert_equal [], @s.transitions.Ts.gradient_closures
170
- @s.transitions.Ts.delta( 1.0 ).must_equal Matrix.zero( @s.n_free.size, 1 )
171
- end
172
-
173
- it "3. handles tS transitions" do
174
- @s.transitions.tS.firing_closures.must_equal []
175
- @s.transitions.tS.firing_vector.must_equal Matrix.column_vector( [] )
176
- @s.transitions.tS.delta.must_equal Matrix.zero( @s.n_free.size, 1 )
177
- end
178
-
179
- it "1. handles ts transitions" do
180
- @s.transitions.ts.delta_closures.must_equal []
181
- end
182
-
183
- it "presents sparse stoichiometry vectors for its transitions" do
184
- @s.transition( @t1 ).sparse_sv.must_equal Matrix.cv( [-1, 0, 1] )
185
- @s.sparse_stoichiometry_vector( of: @t1 )
186
- .must_equal Matrix.cv( [-1, -1, 0, 1, 0] )
187
- end
188
-
189
- it "presents correspondence matrices free, clamped => all places" do
190
- @s.f2a.must_equal Matrix[[0, 0, 0], [1, 0, 0], [0, 1, 0],
191
- [0, 0, 1], [0, 0, 0]]
192
- @s.c2a.must_equal Matrix[[1, 0], [0, 0], [0, 0], [0, 0], [0, 1]]
193
- end
194
- end
195
-
196
- describe ::YPetri::Simulation do
197
- before do
198
- @pç, @tç, @nç = WORKSPACE_MOCK.()
199
- # Set up places:
200
- @p1 = @pç.nw "P1", 1
201
- @p2 = @pç.nw "P2", 2
202
- @p3 = @pç.nw "P3", 3
203
- @p4 = @pç.nw "P4", 4
204
- @p5 = @pç.nw "P5", 5
205
- # Set up transitions:
206
- @t1 = @tç.nw "T1", s: { @p1 => -1, @p2 => -1, @p4 => 1 },
207
- rate: 0.1
208
- @t2 = @tç.nw "T2", s: { @p1 => -1, @p3 => 1 },
209
- rate: -> a { a * 0.5 }
210
- @t3 = @tç.new "T3", s: { @p1 => -1, @p2 => -1, @p4 => 1 },
211
- domain: @p3,
212
- rate: -> a { a * 0.5 }
213
- @net = @nç.new << @p1 << @p2 << @p3 << @p4 << @p5
214
- @net.include_transition! @t1
215
- @net.include_transition! @t2
216
- @net << @t3
217
- @s = YPetri::Simulation.new net: @net,
218
- marking_clamps: { @p1 => 2.0, @p5 => 2.0 },
219
- initial_marking: { @p2 => @p2.default_marking,
220
- @p3 => @p3.default_marking,
221
- @p4 => @p4.default_marking }
222
- end
223
-
224
- it "exposes the net" do
225
- @s.net.must_equal @net
226
- @s.net.places.size.must_equal 5
227
- @s.net.transitions.size.must_equal 3
228
- assert @net.include? @t1
229
- assert @s.net.include? @t1
230
- assert @net.include? @t2
231
- assert @s.net.include? @t2
232
- assert @net.include? @t3
233
- assert @s.net.include? @t3
234
- @s.net.transitions.size.must_equal 3
235
- end
236
-
237
- it "exposes Petri net places" do
238
- @s.places.map( &:source ).must_equal [ @p1, @p2, @p3, @p4, @p5 ]
239
- @s.pn.must_equal [ :P1, :P2, :P3, :P4, :P5 ]
240
- end
241
-
242
- it "exposes Petri net transitions" do
243
- @s.transitions.map( &:source ).must_equal [ @t1, @t2, @t3 ]
244
- @s.tn.must_equal [ :T1, :T2, :T3 ]
245
- end
246
-
247
- it "exposes place clamps" do
248
- @s.marking_clamps.values.must_equal [2, 2]
249
- @s.n_clamped.must_equal [:P1, :P5]
250
- end
251
-
252
- it "presents free places" do
253
- @s.free_places.map( &:source ).must_equal [ @p2, @p3, @p4 ]
254
- @s.n_free.must_equal [ :P2, :P3, :P4 ]
255
- end
256
-
257
- it "presents clamped places" do
258
- @s.n_clamped.must_equal [ :P1, :P5 ]
259
- @s.clamped_places.map( &:source ).must_equal [ @p1, @p5 ]
260
- end
261
-
262
- it "exposes initial marking" do
263
- ( @s.free_places.map( &:source ) >> @s.im( *@s.free_places ) )
264
- .must_equal( { @p2 => 2, @p3 => 3, @p4 => 4 } )
265
- ( @s.n_free >> @s.im( *@s.free_places ) )
266
- .must_equal( { P2: 2, P3: 3, P4: 4 } )
267
- @s.im.must_equal [ 2, 3, 4 ]
268
- @s.im_vector.must_equal Matrix[[2], [3], [4]]
269
- @s.im_vector.must_equal @s.iᴍ
270
- end
271
-
272
- it "exposes marking (simulation state)" do
273
- @s.marking.must_equal [2, 3, 4] # (we're after reset)
274
- @s.free_places( :m ).must_equal( { @p2 => 2, @p3 => 3, @p4 => 4 } )
275
- @s.free_pp( :m ).must_equal( { P2: 2, P3: 3, P4: 4 } )
276
- @s.ᴍ.must_equal Matrix[[2], [3], [4]]
277
- end
278
-
279
- it "separately exposes marking of clamped places" do
280
- @s.m( *@s.clamped_places ).must_equal [ 2, 2 ]
281
- @s.clamped_places( :m_clamped ).must_equal( { @p1 => 2, @p5 => 2 } )
282
- @s.clamped_pp( :m_clamped ).must_equal( { P1: 2, P5: 2 } )
283
- @s.ᴍ_clamped.must_equal Matrix[[2], [2]]
284
- end
285
-
286
- it "exposes marking of all places (with capitalized M)" do
287
- @s.pn.must_equal [:P1, :P2, :P3, :P4, :P5]
288
- @s.m.must_equal [ 2, 2, 3, 4, 2 ]
289
- ( @s.places >> @s.m( *@s.places ) )
290
- .must_equal( { @p1 => 2, @p2 => 2, @p3 => 3, @p4 => 4, @p5 => 2 } )
291
- @s.marking_vector.must_equal Matrix[[2], [2], [3], [4], [2]]
292
- end
293
-
294
- it "has stoichiometry matrix for 3. tS transitions" do
295
- @s.tS_stoichiometry_matrix.must_equal Matrix.empty( 3, 0 )
296
- @s.tS_SM.must_equal Matrix.empty( 3, 0 )
297
- end
298
-
299
- it "has stoichiometry matrix for 6. TS transitions" do
300
- @s.TS_SM.must_equal Matrix[[-1, 0, -1], [0, 1, 0], [1, 0, 1]]
301
- @s.SM.must_equal @s.TS_SM
302
- end
303
-
304
- it "presents 1. TS transitions" do
305
- assert_equal [@t1, @t2, @t3], @s.TS_transitions.map( &:source )
306
- assert_equal( { @t1 => :T1, @t2 => :T2, @t3 => :T3 },
307
- @s.TS_transitions.map( &:source ) >> @s.n_TS )
308
- assert_equal [:T1, :T2, :T3], @s.n_TS
309
- end
310
-
311
- it "presents 2. Ts transitions" do
312
- assert_equal [], @s.Ts_transitions
313
- assert_equal [], @s.n_Ts
314
- end
315
-
316
- it "presents 3. tS transitions" do
317
- assert_equal [], @s.tS_transitions
318
- assert_equal [], @s.n_tS
319
- end
320
-
321
- it "presents 4. ts transitions" do
322
- assert_equal [], @s.ts_transitions
323
- assert_equal [], @s.n_ts
324
- end
325
-
326
- it "presents A transitions" do
327
- assert_equal [], @s.A_transitions
328
- assert_equal [], @s.n_A
329
- end
330
-
331
- it "presents S transitions" do
332
- assert_equal [@t1, @t2, @t3], @s.S_transitions.map( &:source )
333
- assert_equal [:T1, :T2, :T3], @s.n_S
334
- end
335
-
336
- it "presents s transitions" do
337
- assert_equal [], @s.s_transitions
338
- assert_equal [], @s.n_s
339
- end
340
-
341
- it "1. handles TS transitions" do
342
- @s.transitions.TS.rate_closures.size.must_equal 3
343
- @s.transitions.TS.flux_vector.must_equal Matrix.column_vector( [ 0.4, 1.0, 1.5 ] )
344
- @s.φ_for_SR.must_equal @s.flux_vector
345
- @s.SR_tt( :φ_for_SR ).must_equal( { T1: 0.4, T2: 1.0, T3: 1.5 } )
346
- @s.first_order_action_vector_for_SR( 1 )
347
- .must_equal Matrix.column_vector [ 0.4, 1.0, 1.5 ]
348
- @s.SR_tt( :first_order_action_for_SR, 1 ).must_equal( T1: 0.4, T2: 1.0, T3: 1.5 )
349
- @s.Δ_SR( 1 ).must_equal Matrix[[-1.9], [1.0], [1.9]]
350
- @s.free_pp( :Δ_SR, 1 ).must_equal( { P2: -1.9, P3: 1.0, P4: 1.9 } )
351
- end
352
-
353
- it "2. handles Ts transitions" do
354
- assert_equal [], @s.transitions.Ts.gradient_closures
355
- @s.transitions.Ts.delta( 1.0 ).must_equal Matrix.zero( @s.n_free.size, 1 )
356
- end
357
-
358
- it "3. handles tS transitions" do
359
- @s.transitions.tS.firing_closures.must_equal []
360
- @s.transitions.tS.firing_vector.must_equal Matrix.column_vector( [] )
361
- @s.transitions.tS.delta.must_equal Matrix.zero( @s.n_free.size, 1 )
362
- end
363
-
364
- it "1. handles ts transitions" do
365
- @s.transitions.ts.delta_closures.must_equal []
366
- end
367
-
368
- it "presents sparse stoichiometry vectors for its transitions" do
369
- @s.transition( @t1 ).sparse_sv.must_equal Matrix.cv( [-1, 0, 1] )
370
- @s.sparse_stoichiometry_vector( of: @t1 )
371
- .must_equal Matrix.cv( [-1, -1, 0, 1, 0] )
372
- end
373
-
374
- it "presents correspondence matrices free, clamped => all places" do
375
- @s.f2a.must_equal Matrix[[0, 0, 0], [1, 0, 0], [0, 1, 0],
376
- [0, 0, 1], [0, 0, 0]]
377
- @s.c2a.must_equal Matrix[[1, 0], [0, 0], [0, 0], [0, 0], [0, 1]]
378
- end
379
- end
380
-
381
-
382
- describe ::YPetri::Simulation do
383
- before do
384
- @pç, @tç, @nç = WORKSPACE_MOCK.()
385
- # Set up places:
386
- @p1 = @pç.nw "P1", 1
387
- @p2 = @pç.nw "P2", 2
388
- @p3 = @pç.nw "P3", 3
389
- @p4 = @pç.nw "P4", 4
390
- @p5 = @pç.nw "P5", 5
391
- # Set up transitions:
392
- @t1 = @tç.nw "T1", s: { @p1 => -1, @p2 => -1, @p4 => 1 },
393
- rate: 0.1
394
- @t2 = @tç.nw "T2", s: { @p1 => -1, @p3 => 1 },
395
- rate: -> a { a * 0.5 }
396
- @t3 = @tç.new "T3", s: { @p1 => -1, @p2 => -1, @p4 => 1 },
397
- domain: @p3,
398
- rate: -> a { a * 0.5 }
399
- @net = @nç.new << @p1 << @p2 << @p3 << @p4 << @p5
400
- @net.include_transition! @t1
401
- @net.include_transition! @t2
402
- @net << @t3
403
- @s = YPetri::Simulation.new net: @net,
404
- marking_clamps: { @p1 => 2.0, @p5 => 2.0 },
405
- initial_marking: { @p2 => @p2.default_marking,
406
- @p3 => @p3.default_marking,
407
- @p4 => @p4.default_marking }
408
- end
409
-
410
- it "exposes the net" do
411
- @s.net.must_equal @net
412
- @s.net.places.size.must_equal 5
413
- @s.net.transitions.size.must_equal 3
414
- assert @net.include? @t1
415
- assert @s.net.include? @t1
416
- assert @net.include? @t2
417
- assert @s.net.include? @t2
418
- assert @net.include? @t3
419
- assert @s.net.include? @t3
420
- @s.net.transitions.size.must_equal 3
421
- end
422
-
423
- it "exposes Petri net places" do
424
- @s.places.map( &:source ).must_equal [ @p1, @p2, @p3, @p4, @p5 ]
425
- @s.pn.must_equal [ :P1, :P2, :P3, :P4, :P5 ]
426
- end
427
-
428
- it "exposes Petri net transitions" do
429
- @s.transitions.map( &:source ).must_equal [ @t1, @t2, @t3 ]
430
- @s.tn.must_equal [ :T1, :T2, :T3 ]
431
- end
432
-
433
- it "exposes place clamps" do
434
- @s.marking_clamps.values.must_equal [2, 2]
435
- @s.n_clamped.must_equal [:P1, :P5]
436
- end
437
-
438
- it "presents free places" do
439
- @s.free_places.map( &:source ).must_equal [ @p2, @p3, @p4 ]
440
- @s.n_free.must_equal [ :P2, :P3, :P4 ]
441
- end
442
-
443
- it "presents clamped places" do
444
- @s.n_clamped.must_equal [ :P1, :P5 ]
445
- @s.clamped_places.map( &:source ).must_equal [ @p1, @p5 ]
446
- end
447
-
448
- it "exposes initial marking" do
449
- ( @s.free_places.map( &:source ) >> @s.im( *@s.free_places ) )
450
- .must_equal( { @p2 => 2, @p3 => 3, @p4 => 4 } )
451
- ( @s.n_free >> @s.im( *@s.free_places ) )
452
- .must_equal( { P2: 2, P3: 3, P4: 4 } )
453
- @s.im.must_equal [ 2, 3, 4 ]
454
- @s.im_vector.must_equal Matrix[[2], [3], [4]]
455
- @s.im_vector.must_equal @s.iᴍ
456
- end
457
-
458
- it "exposes marking (simulation state)" do
459
- @s.marking.must_equal [2, 3, 4] # (we're after reset)
460
- @s.free_places( :m ).must_equal( { @p2 => 2, @p3 => 3, @p4 => 4 } )
461
- @s.free_pp( :m ).must_equal( { P2: 2, P3: 3, P4: 4 } )
462
- @s.ᴍ.must_equal Matrix[[2], [3], [4]]
463
- end
464
-
465
- it "separately exposes marking of clamped places" do
466
- @s.m( *@s.clamped_places ).must_equal [ 2, 2 ]
467
- @s.clamped_places( :m_clamped ).must_equal( { @p1 => 2, @p5 => 2 } )
468
- @s.clamped_pp( :m_clamped ).must_equal( { P1: 2, P5: 2 } )
469
- @s.ᴍ_clamped.must_equal Matrix[[2], [2]]
470
- end
471
-
472
- it "exposes marking of all places (with capitalized M)" do
473
- @s.pn.must_equal [:P1, :P2, :P3, :P4, :P5]
474
- @s.m.must_equal [ 2, 2, 3, 4, 2 ]
475
- ( @s.places >> @s.m( *@s.places ) )
476
- .must_equal( { @p1 => 2, @p2 => 2, @p3 => 3, @p4 => 4, @p5 => 2 } )
477
- @s.marking_vector.must_equal Matrix[[2], [2], [3], [4], [2]]
478
- end
479
-
480
- it "has stoichiometry matrix for 3. tS transitions" do
481
- @s.tS_stoichiometry_matrix.must_equal Matrix.empty( 3, 0 )
482
- @s.tS_SM.must_equal Matrix.empty( 3, 0 )
483
- end
484
-
485
- it "has stoichiometry matrix for 6. TS transitions" do
486
- @s.TS_SM.must_equal Matrix[[-1, 0, -1], [0, 1, 0], [1, 0, 1]]
487
- @s.SM.must_equal @s.TS_SM
488
- end
489
-
490
- it "presents 1. TS transitions" do
491
- assert_equal [@t1, @t2, @t3], @s.TS_transitions.map( &:source )
492
- assert_equal( { @t1 => :T1, @t2 => :T2, @t3 => :T3 },
493
- @s.TS_transitions.map( &:source ) >> @s.n_TS )
494
- assert_equal [:T1, :T2, :T3], @s.n_TS
495
- end
496
-
497
- it "presents 2. Ts transitions" do
498
- assert_equal [], @s.Ts_transitions
499
- assert_equal [], @s.n_Ts
500
- end
501
-
502
- it "presents 3. tS transitions" do
503
- assert_equal [], @s.tS_transitions
504
- assert_equal [], @s.n_tS
505
- end
506
-
507
- it "presents 4. ts transitions" do
508
- assert_equal [], @s.ts_transitions
509
- assert_equal [], @s.n_ts
510
- end
511
-
512
- it "presents A transitions" do
513
- assert_equal [], @s.A_transitions
514
- assert_equal [], @s.n_A
515
- end
516
-
517
- it "presents S transitions" do
518
- assert_equal [@t1, @t2, @t3], @s.S_transitions.map( &:source )
519
- assert_equal [:T1, :T2, :T3], @s.n_S
520
- end
521
-
522
- it "presents s transitions" do
523
- assert_equal [], @s.s_transitions
524
- assert_equal [], @s.n_s
525
- end
526
-
527
- it "1. handles TS transitions" do
528
- @s.transitions.TS.rate_closures.size.must_equal 3
529
- @s.transitions.TS.flux_vector.must_equal Matrix.column_vector( [ 0.4, 1.0, 1.5 ] )
530
- @s.φ_for_SR.must_equal @s.flux_vector
531
- @s.SR_tt( :φ_for_SR ).must_equal( { T1: 0.4, T2: 1.0, T3: 1.5 } )
532
- @s.first_order_action_vector_for_SR( 1 )
533
- .must_equal Matrix.column_vector [ 0.4, 1.0, 1.5 ]
534
- @s.SR_tt( :first_order_action_for_SR, 1 ).must_equal( T1: 0.4, T2: 1.0, T3: 1.5 )
535
- @s.Δ_SR( 1 ).must_equal Matrix[[-1.9], [1.0], [1.9]]
536
- @s.free_pp( :Δ_SR, 1 ).must_equal( { P2: -1.9, P3: 1.0, P4: 1.9 } )
537
- end
538
-
539
- it "2. handles Ts transitions" do
540
- assert_equal [], @s.transitions.Ts.gradient_closures
541
- @s.transitions.Ts.delta( 1.0 ).must_equal Matrix.zero( @s.n_free.size, 1 )
542
- end
543
-
544
- it "3. handles tS transitions" do
545
- @s.transitions.tS.firing_closures.must_equal []
546
- @s.transitions.tS.firing_vector.must_equal Matrix.column_vector( [] )
547
- @s.transitions.tS.delta.must_equal Matrix.zero( @s.n_free.size, 1 )
548
- end
549
-
550
- it "1. handles ts transitions" do
551
- @s.transitions.ts.delta_closures.must_equal []
552
- end
553
-
554
- it "presents sparse stoichiometry vectors for its transitions" do
555
- @s.transition( @t1 ).sparse_sv.must_equal Matrix.cv( [-1, 0, 1] )
556
- @s.sparse_stoichiometry_vector( of: @t1 )
557
- .must_equal Matrix.cv( [-1, -1, 0, 1, 0] )
558
- end
559
-
560
- it "presents correspondence matrices free, clamped => all places" do
561
- @s.f2a.must_equal Matrix[[0, 0, 0], [1, 0, 0], [0, 1, 0],
562
- [0, 0, 1], [0, 0, 0]]
563
- @s.c2a.must_equal Matrix[[1, 0], [0, 0], [0, 0], [0, 0], [0, 1]]
564
- end
565
- end
data/test/ttp_pathway.rb DELETED
@@ -1,233 +0,0 @@
1
- #! /usr/bin/ruby
2
- # coding: utf-8
3
-
4
- # ==============================================================================
5
- #
6
- # Thymidine triphosphate pathway model.
7
- #
8
- # Author: Boris Stitnicky
9
- # Affiliation:
10
- # ... etc etc same shit as in SBML
11
- #
12
- # ==============================================================================
13
-
14
- # === Load the required libraries.
15
- require 'y_nelson' # This pathway model uses FPN domain model.
16
- require 'sy' # This pathway model uses 'sy' metrology domain model.
17
- require 'mathn' # Standard library 'mathn' is required.
18
- include YNelson # pull in the DSL
19
-
20
- require "./ttp_pathway/version" # version number
21
- require './ttp_pathway/michaelis_menten' # basic function definitions
22
- require './ttp_pathway/general_assumptions' # general model assumptions
23
-
24
- # === Load the chosen cell cycle model.
25
- require "./ttp_pathway/simple_cell_cycle"
26
-
27
- # === Load the original version of the dTTP pathway based on the literature.
28
- require "./ttp_pathway/literature_model"
29
-
30
- # === Simulate it.
31
- set_step 1 # in seconds
32
- set_target_time 24.h.in :s
33
- set_sampling 5.min.in :s
34
- set_simulation_method :pseudo_euler
35
- sim = new_simulation guarded: false
36
- sim.guarded?
37
- sim.run! upto: 10
38
- sim.run! upto: 20
39
- sim.run! upto: 30
40
- sim.run! upto: 40
41
- # FIXME: Here it breaks if step is set to
42
- # set_step 5 # seconds
43
- # it seems that the problem is actually caused by one of the closures
44
- # returning an incompatible result (imaginary number in this particular case),
45
- # which causes the whole marking vector become imaginary numbers and fail upon
46
- # comparison (#>) subsequently.
47
- #
48
- # The challenge here is to make it easy to debug the models. In execution, I am
49
- # against artificial constraints on place marking, and not just because it slows
50
- # things down, but mainly because such thing is not a part of the Petri net
51
- # business model as I understand it. But at debug time, I am for "type" checking
52
- # that identify the source of problem values. And that should be implemented in
53
- # simulation, in those several #create_*_closures at the end of the class. There
54
- # should be versions of these closures that check the values of the transition
55
- # functions as they are produced and pinpoint where the problem is coming from.
56
- #
57
- # Obviously, YNelson at its current shape has no problems simulating well-written
58
- # nets with good simulation settings
59
- #
60
- # I am not going to program this right now. I'll just look at the simulation
61
- # class, and that will be it for this week. Next programming session: Monday.
62
- sim.run! upto: 50
63
- sim.run! upto: 60
64
- sim.run! upto: 70
65
- sim.run! upto: 80
66
- sim.run! upto: 90
67
- sim.run! upto: 100
68
- sim.run! upto: 1000
69
- sim.run! upto: 10000
70
- sim.run!
71
-
72
- sim = new_timed_simulation( guarded: true )
73
- sim.run! upto: 1000
74
- sim.run! upto: 1000
75
-
76
- # It turns out that simply, the step was too big
77
-
78
- # === Load the acceptance tests for the dTTP pathway behavior.
79
- require_relative "ttp_pathway/acceptance_tests"
80
-
81
- # === Run those tests.
82
- test simulation
83
-
84
- # === Load the pathway updates according to human judgment.
85
- require_relative "ttp_pathway/model_correction"
86
-
87
- # === Rerun the simulation.
88
- run!
89
-
90
- # === Run those tests.
91
- test simulation
92
-
93
- # Now, having at our disposal a satisfactory dTTP pathway, we can simulate
94
- # its behavior throughout the cell cycle.
95
-
96
- # === Rerun the simulation.
97
- run!
98
-
99
- # === Visualization suggestions
100
- plot :all, except: Timer # marking of all the FPN places except Timer
101
-
102
- plot [ S_phase, A_phase, Cdc20A ] # cell-cycle places marking
103
- plot [ S_phase, A_phase, Cdc20A, TK1, TK1di, TK1tetra, TK1di_P, TMPK ] # TTP pathway concentrations
104
- plot [ S_phase, TK1, TK1di, TK1tetra, TK1di_P ] # TTP pathway enzyme concentrations
105
- plot [ S_phase, Thymidine, TMP, TDP, TTP, T23P ] # TTP patwhay concentrations simplified
106
- plot :flux, except: Clock # all flux except time flow
107
- plot :flux, except: [ Clock, T23P_flux_clamp, TMP_flux_clamp,
108
- Thymidine_flux_clamp ] # all except flux clamps
109
- plot :state, except: [ Timer, AMP, ADP, ATP, UTP, UDP, UMP, GMP, DeoxyATP,
110
- DeoxyADP, DeoxyAMP, DeoxyCytidine, DeoxyCMP, DeoxyCDP,
111
- DeoxyCTP, DeoxyGTP, DeoxyGMP, DeoxyUridine, DeoxyUMP,
112
- DeoxyUDP, DeoxyUTP, DeoxyT23P ] # cell cycle marking
113
-
114
- # Now let's look into the graph visualization.
115
-
116
- # Define function to display it with kioclient
117
- #
118
- def showit( fɴ )
119
- system "sleep 0.2; kioclient exec 'file:%s'" %
120
- File.expand_path( '.', fɴ )
121
- end
122
-
123
- # Define enzyme places
124
- enzyme_places = {
125
- TK1: "TK1",
126
- TK1di: "TK1 dimer",
127
- TK1di_P: "TK1 phosphorylated dimer",
128
- TK1tetra: "TK1 tetramer",
129
- TMPK: "TMPK"
130
- }
131
-
132
- # Define small molecule places
133
- small_molecule_places = {
134
- Thymidine: "Thymidine",
135
- TMP: "Thymidine monophosphate",
136
- T23P: "Thymidine diphosphate / triphosphate pool",
137
- TDP: "Thymidine diphosphate",
138
- TTP: "Thymidine triphosphate"
139
- }
140
-
141
- # Define graphviz places
142
- def graphviz places
143
- require 'graphviz'
144
- γ = GraphViz.new :G, type: :digraph # Create a new graph
145
-
146
- # # set global node options
147
- # γ.node[:color] = "#ddaa66"
148
- # γ.node[:style] = "filled"
149
- # γ.node[:shape] = "box"
150
- # γ.node[:penwidth] = "1"
151
- # γ.node[:fontname] = "Trebuchet MS"
152
- # γ.node[:fontsize] = "8"
153
- # γ.node[:fillcolor] = "#ffeecc"
154
- # γ.node[:fontcolor] = "#775500"
155
- # γ.node[:margin] = "0.0"
156
-
157
- # # set global edge options
158
- # γ.edge[:color] = "#999999"
159
- # γ.edge[:weight] = "1"
160
- # γ.edge[:fontsize] = "6"
161
- # γ.edge[:fontcolor] = "#444444"
162
- # γ.edge[:fontname] = "Verdana"
163
- # γ.edge[:dir] = "forward"
164
- # γ.edge[:arrowsize] = "0.5"
165
-
166
- nodes = Hash[ places.map { |pɴ, label| # make nodes
167
- [ pɴ, γ.add_nodes( label ) ]
168
- } ]
169
-
170
- places.each { |pɴ, label| # add edges
171
- p = place pɴ
172
- p.upstream_places.each { |up|
173
- node = nodes[ pɴ ]
174
- next unless places.map { |ɴ, _| ɴ }.include? up.name
175
- next if up == p
176
- upstream_node = nodes[ up.name ]
177
- upstream_node << node
178
- }
179
- }
180
-
181
- γ.output png: "enzymes.png" # Generate output image
182
- showit "enzymes.png"
183
- end
184
-
185
- [ enzyme_places, small_molecule_places ].each { |ꜧ|
186
- ꜧ.define_singleton_method :+ do |o| merge o end }
187
-
188
- graphviz enzyme_places
189
- graphviz small_molecule_places
190
- graphviz enzyme_places + small_molecule_places # combining pathways
191
-
192
- net.visualize
193
-
194
-
195
- # ==============================================================================
196
- #
197
- # 1. Please note that the script contained in this file does not constitute
198
- # programming in the sense of software development. It is simply scripted
199
- # user interaction with YPetri FPN simulator. This user interaction takes
200
- # place inside the interactive Ruby session (irb), or it can be saved and
201
- # run all at once as a script. The user has at her disposal the devices and
202
- # language constructs of full-fledged Ruby. The user is not sandboxed (the
203
- # problem of many GUI-based "applications"). In other words, the simulation
204
- # software does not wrap its host language. Rather, it extends Ruby, giving
205
- # its interactive session new, pathway-specific abilities. No constraints
206
- # are placed on how complicated or intelligent the user's use of the software
207
- # can be.
208
- #
209
- # 2. However, on this dTTP pathway model, it can be already noted, that there
210
- # would be certain actions, that the user will have to repeat in most of
211
- # her biological models usin YPetri. For example, Michaelis & Menten function
212
- # definitions are to be expected in many pathway models. More seriously, the
213
- # Petri net models of enzymes and signal proteins suffer exponential explosion
214
- # with number of eligible reactants, competitive inhibitors, and other
215
- # interacting molecules. In typical smaller pathway models, this explosion is
216
- # not deadly, because only few of these interacting molecules are considered.
217
- # But the amount of scripting the user is required to do would still be
218
- # reduced many times, if such enzymes and signal proteins can be expressed
219
- # declaratively, rather than by manual enumeration of their Petri net
220
- # transitions. All of this provides motivation towards developing even more
221
- # concise way of pathway encoding than that provided by plain FPN.
222
- #
223
- # 3. In the planned more concise pathway encoding (that would subsume the
224
- # functionality of the current standards such as SBML), there is one more
225
- # major concern – storing relations. I feel tempted to use Ted Nelson's zz
226
- # structure as an alternative to usual SQL and non-SQL relational databases.
227
- # The usability of zz structures in bioinformatics has already been noted.
228
- # However, I am aware of the advantage held by the existing database merely
229
- # by the virtue of its maturity. To account for the possibility, that my zz
230
- # domain model would become a bottleneck, I will leave the back door open on
231
- # the possibility of using existing database software later on.
232
- #
233
- # ==============================================================================