@@ -19,7 +19,7 @@ Let us illustrate some of the types of network properties that
19
19
Catalyst can determine.
20
20
21
21
To begin, consider the following reaction network:
22
- ``` @example s1
22
+ ``` @example s1b
23
23
using Catalyst
24
24
rn = @reaction_network begin
25
25
(k1,k2), A + B <--> C
@@ -31,7 +31,8 @@ rn = @reaction_network begin
31
31
end
32
32
```
33
33
with graph
34
- ``` @example s1
34
+ ``` @example s1b
35
+ using CairoMakie, GraphMakie, NetworkLayout
35
36
plot_complexes(rn)
36
37
```
37
38
@@ -45,7 +46,7 @@ these for a given network, returning a vector of the integer indices of reaction
45
46
complexes participating in each set of linkage-classes. Note, indices of
46
47
reaction complexes can be determined from the ordering returned by
47
48
[ ` reactioncomplexes ` ] ( @ref ) .
48
- ``` @example s1
49
+ ``` @example s1b
49
50
# we must first calculate the reaction complexes -- they are cached in rn
50
51
reactioncomplexes(rn)
51
52
@@ -54,19 +55,19 @@ lcs = linkageclasses(rn)
54
55
```
55
56
It can often be convenient to obtain the disconnected sub-networks as distinct
56
57
` ReactionSystem ` s, which are returned by the [ ` subnetworks ` ] ( @ref ) function:
57
- ``` @example s1
58
+ ``` @example s1b
58
59
subnets = subnetworks(rn)
59
60
60
61
# check the reactions in each subnetwork
61
62
reactions.(subnets)
62
63
```
63
64
The graphs of the reaction complexes in the two sub-networks are then
64
- ``` @example s1
65
+ ``` @example s1b
65
66
plot_complexes(subnets[1])
66
67
```
67
68
68
69
and,
69
- ``` @example s1
70
+ ``` @example s1b
70
71
plot_complexes(subnets[2])
71
72
```
72
73
@@ -84,7 +85,7 @@ to the number of independent species in a chemical reaction network. That is, if
84
85
we calculate the linear conservation laws of a network, and use them to
85
86
eliminate the dependent species of the network, we will have `` r `` independent
86
87
species remaining. For our current example the conservation laws are given by
87
- ``` @example s1
88
+ ``` @example s1b
88
89
# first we calculate the conservation laws -- they are cached in rn
89
90
conservationlaws(rn)
90
91
@@ -95,11 +96,11 @@ show(stdout, MIME"text/plain"(), ans) # hide
95
96
Here the parameters ` Γ[i] ` represent the constants of the three
96
97
conservation laws, and we see that there are three dependent species that could
97
98
be eliminated. As
98
- ``` @example s1
99
+ ``` @example s1b
99
100
numspecies(rn)
100
101
```
101
102
we find that there are five independent species. Let's check this is correct:
102
- ``` @example s1
103
+ ``` @example s1b
103
104
using LinearAlgebra
104
105
rank(netstoichmat(rn)) == 5
105
106
```
@@ -112,7 +113,7 @@ The deficiency, ``\delta``, of a reaction network is defined as
112
113
\delta = \textrm{(number of complexes)} - \textrm{(number of linkage classes)} - \textrm{(rank)}.
113
114
```
114
115
For our network this is `` 7 - 2 - 5 = 0 `` , which we can calculate in Catalyst as
115
- ``` @example s1
116
+ ``` @example s1b
116
117
# first we calculate the reaction complexes of rn and cache them in rn
117
118
reactioncomplexes(rn)
118
119
@@ -130,7 +131,7 @@ A reaction network is *reversible* if the "arrows" of the reactions are
130
131
symmetric so that every reaction is accompanied by its reverse reaction.
131
132
Catalyst's API provides the [ ` isreversible ` ] ( @ref ) function to determine whether
132
133
a reaction network is reversible. As an example, consider
133
- ``` @example s1
134
+ ``` @example s1b
134
135
rn = @reaction_network begin
135
136
(k1,k2),A <--> B
136
137
(k3,k4),A + C <--> D
@@ -145,7 +146,7 @@ reactioncomplexes(rn)
145
146
isreversible(rn)
146
147
```
147
148
Consider another example,
148
- ``` @example s1
149
+ ``` @example s1b
149
150
rn = @reaction_network begin
150
151
(k1,k2),A <--> B
151
152
k3, A + C --> D
155
156
reactioncomplexes(rn)
156
157
isreversible(rn)
157
158
```
158
- ``` @example s1
159
+ ``` @example s1b
159
160
plot_complexes(rn)
160
161
```
161
162
@@ -164,7 +165,7 @@ However, it satisfies a weaker property in that there is a path from each
164
165
reaction complex back to itself within its associated subgraph. This is known as
165
166
* weak reversibility* . One can test a network for weak reversibility by using
166
167
the [ ` isweaklyreversible ` ] ( @ref ) function:
167
- ``` @example s1
168
+ ``` @example s1b
168
169
# need subnetworks from the reaction network first
169
170
subnets = subnetworks(rn)
170
171
isweaklyreversible(rn, subnets)
@@ -219,12 +220,12 @@ With these definitions we can now see how knowing the deficiency and weak
219
220
reversibility of the network can tell us about its steady state behavior.
220
221
Consider the previous example, which we know is weakly reversible. Its
221
222
deficiency is
222
- ``` @example s1
223
+ ``` @example s1b
223
224
deficiency(rn)
224
225
```
225
226
We also verify that the system is purely mass action (though it is apparent
226
227
from the network's definition):
227
- ``` @example s1
228
+ ``` @example s1b
228
229
all(rx -> ismassaction(rx, rn), reactions(rn))
229
230
```
230
231
We can therefore apply the Deficiency Zero Theorem to draw conclusions about the
@@ -245,7 +246,7 @@ exactly one equilibrium solution which will be positive and locally
245
246
asymptotically stable.
246
247
247
248
As a final example, consider the following network from [ ^ 1 ]
248
- ``` @example s1
249
+ ``` @example s1b
249
250
def0_rn = @reaction_network begin
250
251
(k1,k2),A <--> 2B
251
252
(k3,k4), A + C <--> D
@@ -265,7 +266,7 @@ RRE ODEs cannot have a positive equilibrium solution.
265
266
There is an API function [ ` satisfiesdeficiencyzero ` ] ( @ref ) that will let us check
266
267
all these conditions easily:
267
268
268
- ``` @example s1
269
+ ``` @example s1b
269
270
satisfiesdeficiencyzero(def0_rn)
270
271
```
271
272
@@ -287,7 +288,7 @@ to have stable solutions.
287
288
288
289
Let's look at an example network.
289
290
290
- ``` @example s1
291
+ ``` @example s1b
291
292
def1_network = @reaction_network begin
292
293
(k1, k2), A <--> 2B
293
294
k3, C --> 2D
@@ -300,15 +301,15 @@ plot_complexes(def1_network)
300
301
We can see from the complex graph that there are two linkage classes, the deficiency of the bottom one is zero and the deficiency of the top one is one.
301
302
The total deficiency is one:
302
303
303
- ``` @example s1
304
+ ``` @example s1b
304
305
deficiency(def1_network)
305
306
```
306
307
307
308
And there is only one terminal linkage class in each, so our network satisfies all three conditions.
308
309
As in the deficiency zero case, there is the API function [ ` satisfiesdeficiencyone ` ] ( @ref )
309
310
for quickly checking these conditions:
310
311
311
- ``` @example s1
312
+ ``` @example s1b
312
313
satisfiesdeficiencyone(def1_network)
313
314
```
314
315
@@ -330,13 +331,13 @@ please consult Martin Feinberg's *Foundations of Chemical Reaction Network Theor
330
331
knowing that a network is complex balanced is really quite powerful.
331
332
332
333
Let's check whether the deficiency 0 reaction network that we defined above is complex balanced by providing a set of rates:
333
- ``` @example s1
334
+ ``` @example s1b
334
335
rates = Dict([:k1 => 2.4, :k2 => 4., :k3 => 10., :k4 => 5.5, :k5 => 0.4])
335
336
iscomplexbalanced(rn, rates)
336
337
```
337
338
338
339
We can do a similar check for detailed balance.
339
- ``` @example s1
340
+ ``` @example s1b
340
341
isdetailedbalanced(rn, rates)
341
342
```
342
343
0 commit comments