Skip to content

Commit 1fd6141

Browse files
committed
init
1 parent dc414b7 commit 1fd6141

File tree

5 files changed

+51
-49
lines changed

5 files changed

+51
-49
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ model. Here we instead show how various Catalyst features can compose to create
137137
a much more advanced model. Our model describes how the volume of a cell ($V$)
138138
is affected by a growth factor ($G$). The growth factor only promotes growth
139139
while in its phosphorylated form ($G^P$). The phosphorylation of $G$ ($G \to G^P$)
140-
is promoted by sunlight (modeled as the cyclic sinusoid $k_a (\sin(t) + 1)$),
141-
which phosphorylates the growth factor (producing $G^P$). When the cell reaches a
142-
critical volume ($V_m$) it undergoes cell division. First, we declare our model:
140+
is promoted by sunlight, which is modeled as the cyclic sinusoid $k_a (\sin(t) + 1)$.
141+
When the cell reaches a critical volume ($V_m$) it undergoes cell division. First, we
142+
declare our model:
143143
```julia
144144
using Catalyst
145145
cell_model = @reaction_network begin

docs/src/devdocs/dev_guide.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Beginning with v15, Catalyst is using a new release process to try to ensure
55
continuing stability of releases. Before making a release one should
66

7-
1. Create a new release branch, i.e. "release-15.0.0"
7+
1. Create a new release branch, i.e. "release-15.0.0".
88
2. On this branch, cap major dependencies to their latest version that works and
99
for which tests pass.
1010
- Caps need to be included in both Project.toml and docs/Project.toml.
@@ -16,13 +16,13 @@ continuing stability of releases. Before making a release one should
1616
issues can arise that do not lead to actual errors in the doc CI).
1717
4. Release via the [registration
1818
issue](https://github.com/SciML/Catalyst.jl/issues/127) with the
19-
command:
19+
command:
2020

21-
```
22-
@JuliaRegistrator register branch=release-15.0.0
23-
```
21+
```
22+
@JuliaRegistrator register branch=release-15.0.0
23+
```
2424

25-
modifying as appropriate for the version you are releasing.
25+
modifying as appropriate for the version you are releasing.
2626

2727
If there is subsequently a need to increment the version of a dependency, this
2828
should be done via a new release that follows the above process, and modifies
@@ -38,7 +38,9 @@ Catalyst release branch*.
3838

3939
### Checking doc builds for errors
4040
When updating documentation, Catalyst will run any Julia code provided within example blocks to dynamically create figures and outputs. In addition to automatically creating these for us, it also provides an automatic check that all code in documentation is correct. Here, if any of the documentation code throws an error, the build job will fail. The documentation build job can be found at the bottom of a PRs conversation, here is an example of a failed one:
41+
4142
![Failed builddocs link](../assets/devdocs/failed_builddocs_link.png)
43+
4244
To check what errors were produced, click on the "Details" link of the job. Next, any errors can be found at the bottom of the "Build and deploy" section (which should be opened automatically).
4345

4446
### Inspecting documentation of a PR or branch

docs/src/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ model. Here we instead show how various Catalyst features can compose to create
164164
a much more advanced model. Our model describes how the volume of a cell ($V$)
165165
is affected by a growth factor ($G$). The growth factor only promotes growth
166166
while in its phosphorylated form ($G^P$). The phosphorylation of $G$ ($G \to G^P$)
167-
is promoted by sunlight (modeled as the cyclic sinusoid $k_a (\sin(t) + 1)$),
168-
which phosphorylates the growth factor (producing $G^P$). When the cell reaches a
169-
critical volume ($V_m$) it undergoes cell division. First, we declare our model:
167+
is promoted by sunlight, which is modeled as the cyclic sinusoid $k_a (\sin(t) + 1)$.
168+
When the cell reaches a critical volume ($V_m$) it undergoes cell division. First, we
169+
declare our model:
170170
```@example home_elaborate_example
171171
using Catalyst
172172
cell_model = @reaction_network begin

docs/src/model_creation/dsl_basics.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ Finally, `rn = ` is used to store the model in the variable `rn` (a normal Julia
3939
## [Defining parameters and species in the DSL](@id dsl_description_parameters_basics)
4040
Typically, the rates are not constants, but rather parameters (which values can be set e.g. at [the beginning of each simulation](@ref simulation_intro_ODEs)). To set parametric rates, simply use whichever symbol you wish to represent your parameter with. E.g. to set the above rates to `a` and `b`, we use:
4141
```@example dsl_basics
42-
rn1 = @reaction_network begin
42+
rn = @reaction_network begin
4343
a, X --> Y
4444
b, Y --> X
4545
end
4646
```
4747

4848
Here we have used single-character symbols to designate all species and parameters. Multi-character symbols, however, are also permitted. E.g. we could call the rates `kX` and `kY`:
4949
```@example dsl_basics
50-
rn1 = @reaction_network begin
50+
rn = @reaction_network begin
5151
kX, X --> Y
5252
kY, Y --> X
5353
end
@@ -59,22 +59,22 @@ Generally, anything that is a [permitted Julia variable name](https://docs.julia
5959
### [Reactions with multiple substrates or products](@id dsl_description_reactions_multiples)
6060
Previously, our reactions have had a single substrate and a single product. However, reactions with multiple substrates and/or products are possible. Here, all the substrates (or products) are listed and separated by a `+`. E.g. to create a model where `X` and `Y` bind (at rate `kB`) to form `XY` (which then can dissociate, at rate `kD`, to form `XY`) we use:
6161
```@example dsl_basics
62-
rn2 = @reaction_network begin
62+
rn = @reaction_network begin
6363
kB, X + Y --> XY
6464
kD, XY --> X + Y
6565
end
6666
```
6767
Reactions can have any number of substrates and products, and their names do not need to have any relationship to each other, as demonstrated by the following mock model:
6868
```@example dsl_basics
69-
rn3 = @reaction_network begin
69+
rn = @reaction_network begin
7070
k, X + Y + Z --> A + B + C + D
7171
end
7272
```
7373

7474
### [Reactions with degradation or production](@id dsl_description_reactions_degradation_and_production)
7575
Some reactions have no products, in which case the substrate(s) are degraded (i.e. removed from the system). To denote this, set the reaction's right-hand side to `0`. Similarly, some reactions have no substrates, in which case the product(s) are produced (i.e. added to the system). This is denoted by setting the left-hand side to `0`. E.g. to create a model where a single species `X` is both created (in the first reaction) and degraded (in a second reaction), we use:
7676
```@example dsl_basics
77-
rn4 = @reaction_network begin
77+
rn = @reaction_network begin
7878
p, 0 --> X
7979
d, X --> 0
8080
end
@@ -83,7 +83,7 @@ end
8383
### [Reactions with non-unitary stoichiometries](@id dsl_description_reactions_stoichiometries)
8484
Reactions may include multiple copies of the same reactant (i.e. a substrate or a product). To specify this, the reactant is preceded by a number indicating its number of copies (also called the reactant's *stoichiometry*). E.g. to create a model where two copies of `X` dimerise to form `X2` (which then dissociate back to two `X` copies) we use:
8585
```@example dsl_basics
86-
rn5 = @reaction_network begin
86+
rn = @reaction_network begin
8787
kB, 2X --> X2
8888
kD, X2 --> 2X
8989
end
@@ -92,7 +92,7 @@ Reactants whose stoichiometries are not defined are assumed to have stoichiometr
9292

9393
Stoichiometries can be combined with `()` to define them for multiple reactants. Here, the following (mock) model declares the same reaction twice, both with and without this notation:
9494
```@example dsl_basics
95-
rn6 = @reaction_network begin
95+
rn = @reaction_network begin
9696
k, 2X + 3(Y + 2Z) --> 5(V + W)
9797
k, 2X + 3Y + 6Z --> 5V + 5W
9898
end
@@ -103,28 +103,28 @@ end
103103
### [Bi-directional (or reversible) reactions](@id dsl_description_reaction_bundling_reversible)
104104
As is the case for the following two-state model:
105105
```@example dsl_basics
106-
rn7 = @reaction_network begin
106+
rn_bidir = @reaction_network begin
107107
k1, X1 --> X2
108108
k2, X2 --> X1
109109
end
110110
```
111111
it is common that reactions occur in both directions (so-called *bi-directional* reactions). Here, it is possible to bundle the reactions into a single line by using the `<-->` arrow. When we do this, the rate term must include two separate rates (one for each direction, these are enclosed by a `()` and separated by a `,`). I.e. the two-state model can be declared using:
112112
```@example dsl_basics
113-
rn7 = @reaction_network begin
113+
rn_bidir = @reaction_network begin
114114
(k1,k2), X1 <--> X2
115115
end
116116
```
117117
Here, the first rate (`k1`) denotes the *forward rate* and the second rate (`k2`) the *backwards rate*.
118118

119119
Catalyst also permits writing pure backwards reactions. These use identical syntax to forward reactions, but with the `<--` arrow:
120120
```@example dsl_basics
121-
rn8 = @reaction_network begin
121+
rn_ytox = @reaction_network begin
122122
k, X <-- Y
123123
end
124124
```
125125
Here, the substrate(s) are on the right-hand side and the product(s) are on the left-hand side. Hence, the above model can be written identically using:
126126
```@example dsl_basics
127-
rn8 = @reaction_network begin
127+
rn_ytox = @reaction_network begin
128128
k, Y --> X
129129
end
130130
```
@@ -133,56 +133,56 @@ Generally, using forward reactions is clearer than backwards ones, with the latt
133133
### [Bundling similar reactions on a single line](@id dsl_description_reaction_bundling_similar)
134134
There exist additional situations where models contain similar reactions (e.g. systems where all system components degrade at identical rates). Reactions which share either rates, substrates, or products can be bundled into a single line. Here, the parts which are different for the reactions are written using `(,)` (containing one separate expression for each reaction). E.g., let us consider the following model where species `X` and `Y` both degrade at the rate `d`:
135135
```@example dsl_basics
136-
rn8 = @reaction_network begin
136+
rn_deg = @reaction_network begin
137137
d, X --> 0
138138
d, Y --> 0
139139
end
140140
```
141141
These share both their rates (`d`) and products (`0`), however, the substrates are different (`X` and `Y`). Hence, the reactions can be bundled into a single line using the common rate and product expression while providing separate substrate expressions:
142142
```@example dsl_basics
143-
rn8 = @reaction_network begin
143+
rn_deg = @reaction_network begin
144144
d, (X,Y) --> 0
145145
end
146146
```
147147
This declaration of the model is identical to the previous one. Reactions can share any subset of the rate, substrate, and product expression (the cases where they share all or none, however, do not make sense to use). I.e. if the two reactions also have different degradation rates:
148148
```@example dsl_basics
149-
rn9 = @reaction_network begin
149+
rn_deg2 = @reaction_network begin
150150
dX, X --> 0
151151
dY, Y --> 0
152152
end
153153
```
154154
This can be represented using:
155155
```@example dsl_basics
156-
rn9 = @reaction_network begin
156+
rn_deg2 = @reaction_network begin
157157
(dX,dY), (X,Y) --> 0
158158
end
159159
```
160160

161161
It is possible to use bundling for any number of reactions. E.g. in the following model we bundle the conversion of a species $X$ between its various forms (where all reactions use the same rate $k$):
162162
```@example dsl_basics
163-
rn10 = @reaction_network begin
163+
rn = @reaction_network begin
164164
k, (X0,X1,X2,X3) --> (X1,X2,X3,X4)
165165
end
166166
```
167167

168168
It is possible to combine bundling with bi-directional reactions. In this case, the rate is first split into the forward and backwards rates. These may then (or may not) indicate several rates. We exemplify this using the two following two (identical) networks, created with and without bundling.
169169
```@example dsl_basics
170-
rn11 = @reaction_network begin
170+
rn_sp = @reaction_network begin
171171
kf, S --> P1
172172
kf, S --> P2
173173
kb_1, P1 --> S
174174
kb_2, P2 --> S
175175
end
176176
```
177177
```@example dsl_basics
178-
rn11 = @reaction_network begin
178+
rn_sp = @reaction_network begin
179179
(kf, (kb_1, kb_2)), S <--> (P1,P2)
180180
end
181181
```
182182

183183
Like when we designated stoichiometries, reaction bundling can be applied very generally to create some truly complicated reactions:
184184
```@example dsl_basics
185-
rn12 = @reaction_network begin
185+
rn = @reaction_network begin
186186
((pX, pY, pZ),d), (0, Y0, Z0) <--> (X, Y, Z1+Z2)
187187
end
188188
```
@@ -193,38 +193,38 @@ So far we have assumed that all reaction rates are constant (being either a numb
193193

194194
Let us consider a model with an activator (`A`, which degraded at a constant rate) and a protein (`P`). The production rate of `P` depends both on `A` and a parameter (`kP`). We model this through:
195195
```@example dsl_basics
196-
rn_13 = @reaction_network begin
196+
rn_ap = @reaction_network begin
197197
d, A --> 0
198198
kP*A, 0 --> P
199199
end
200200
```
201201
Here, `P`'s production rate will be reduced as `A` decays. We can [print the ODE this model produces with `Latexify`](@ref visualisation_latex):
202202
```@example dsl_basics
203203
using Latexify
204-
latexify(rn_13; form = :ode)
204+
latexify(rn_ap; form = :ode)
205205
```
206206

207207
In this case, we can generate an equivalent model by instead adding `A` as both a substrate and a product to `P`'s production reaction:
208208
```@example dsl_basics
209-
rn_13_alt = @reaction_network begin
209+
rn_ap_alt = @reaction_network begin
210210
d, A --> 0
211211
kp, A --> A + P
212212
end
213213
```
214214
We can confirm that this generates the same ODE:
215215
```@example dsl_basics
216-
latexify(rn_13_alt; form = :ode)
216+
latexify(rn_ap_alt; form = :ode)
217217
```
218218
Here, while these models will generate identical ODE, SDE, and jump simulations, the chemical reaction network models themselves are not equivalent. Generally, as pointed out in the two notes below, using the second form is preferable.
219219
!!! warning
220-
While `rn_13` and `rn_13_alt` will generate equivalent simulations, for jump simulations, the first model will have reduced performance as it generates a less performant representation of the system in JumpProcesses. It is generally recommended to write pure mass action reactions such that there is just a single constant within the rate constant expression for optimal performance of jump process simulations.
220+
While `rn_ap` and `rn_ap_alt` will generate equivalent simulations, for jump simulations, the first model will have reduced performance as it generates a less performant representation of the system in JumpProcesses. It is generally recommended to write pure mass action reactions such that there is just a single constant within the rate constant expression for optimal performance of jump process simulations.
221221

222222
!!! danger
223223
Catalyst automatically infers whether quantities appearing in the DSL are species or parameters (as described [here](@ref dsl_advanced_options_declaring_species_and_parameters)). Generally, anything that does not appear as a reactant is inferred to be a parameter. This means that if you want to model a reaction activated by a species (e.g. `kp*A, 0 --> P`), but that species does not occur as a reactant, it will be interpreted as a parameter. This can be handled by [manually declaring the system species](@ref dsl_advanced_options_declaring_species_and_parameters).
224224

225225
Above we used a simple example where the rate was the product of a species and a parameter. However, any valid Julia expression of parameters, species, and values can be used. E.g the following is a valid model:
226226
```@example dsl_basics
227-
rn_14 = @reaction_network begin
227+
rn = @reaction_network begin
228228
2.0 + X^2, 0 --> X + Y
229229
k1 + k2^k3, X --> ∅
230230
pi * X/(sqrt(2) + Y), Y → ∅
@@ -234,15 +234,15 @@ end
234234
### [Using functions in rates](@id dsl_description_nonconstant_rates_functions)
235235
It is possible for the rate to contain Julia functions. These can either be functions from Julia's standard library:
236236
```@example dsl_basics
237-
rn_16 = @reaction_network begin
237+
rn = @reaction_network begin
238238
d, A --> 0
239239
kp*sqrt(A), 0 --> P
240240
end
241241
```
242242
or ones defined by the user:
243243
```@example dsl_basics
244244
custom_function(p1, p2, X) = (p1 + X) / (p2 + X)
245-
rn_17 = @reaction_network begin
245+
rn = @reaction_network begin
246246
d, A --> 0
247247
custom_function(k1,k2,E), 0 --> P
248248
end
@@ -251,7 +251,7 @@ end
251251
### [Pre-defined functions](@id dsl_description_nonconstant_rates_available_functions)
252252
Two functions frequently used within systems biology are the [*Michaelis-Menten*](https://en.wikipedia.org/wiki/Michaelis%E2%80%93Menten_kinetics) and [*Hill*](https://en.wikipedia.org/wiki/Hill_equation_(biochemistry)) functions. These are pre-defined in Catalyst and can be called using `mm(X,v,K)` and `hill(X,v,K,n)`. E.g. a self-activation loop where `X` activates its own production through a Hill function can be created using:
253253
```@example dsl_basics
254-
rn_18 = @reaction_network begin
254+
rn = @reaction_network begin
255255
hill(X,v,K,n), 0 --> P
256256
d, X --> 0
257257
end
@@ -267,15 +267,15 @@ Catalyst comes with the following predefined functions:
267267
### [Time-dependant rates](@id dsl_description_nonconstant_rates_time)
268268
Previously we have assumed that the rates are independent of the time variable, $t$. However, time-dependent reactions are also possible. Here, simply use `t` to represent the time variable. E.g., to create a production/degradation model where the production rate decays as time progresses, we can use:
269269
```@example dsl_basics
270-
rn_14 = @reaction_network begin
270+
rn = @reaction_network begin
271271
kp/(1 + t), 0 --> P
272272
d, P --> 0
273273
end
274274
```
275275

276276
Like previously, `t` can be part of any valid expression. E.g. to create a reaction with a cyclic rate (e.g. to represent a [circadian system](https://en.wikipedia.org/wiki/Circadian_rhythm)) we can use:
277277
```@example dsl_basics
278-
rn_15 = @reaction_network begin
278+
rn = @reaction_network begin
279279
A*(sin(2π*f*t - ϕ)+1)/2, 0 --> P
280280
d, P --> 0
281281
end
@@ -293,7 +293,7 @@ end
293293
### [Non-integer stoichiometries](@id dsl_description_stoichiometries_decimal)
294294
Previously all stoichiometric constants have been integer numbers, however, decimal numbers are also permitted. Here we create a birth-death model where each production reaction produces 1.5 units of `X`:
295295
```@example dsl_basics
296-
rn_16 = @reaction_network begin
296+
rn = @reaction_network begin
297297
p, 0 --> 1.5X
298298
d, X --> 0
299299
end
@@ -303,15 +303,15 @@ It is also possible to have non-integer stoichiometric coefficients for substrat
303303
### [Parametric stoichiometries](@id dsl_description_stoichiometries_parameters)
304304
It is possible for stoichiometric coefficients to be parameters. E.g. here we create a generic polymerisation system where `n` copies of `X` bind to form `Xn`:
305305
```@example dsl_basics
306-
rn_17 = @reaction_network begin
306+
rn = @reaction_network begin
307307
(kB,kD), n*X <--> Xn
308308
end
309309
```
310310
Now we can designate the value of `n` through a parameter when we e.g. create an `ODEProblem`:
311311
```@example dsl_basics
312312
u0 = [:X => 5.0, :Xn => 1.0]
313313
ps = [:kB => 1.0, :kD => 0.1, :n => 4]
314-
oprob = ODEProblem(rn_17, u0, (0.0, 1.0), ps)
314+
oprob = ODEProblem(rn, u0, (0.0, 1.0), ps)
315315
nothing # hide
316316
```
317317

@@ -321,7 +321,7 @@ Julia permits any Unicode characters to be used in variable names, thus Catalyst
321321
### [Using ∅ in degradation/production reactions](@id dsl_description_symbols_empty_set)
322322
Previously, we described how `0` could be used to [create degradation or production reactions](@ref dsl_description_reactions_degradation_and_production). Catalyst permits the user to instead use the `` symbol. E.g. the production/degradation system can alternatively be written as:
323323
```@example dsl_basics
324-
rn4 = @reaction_network begin
324+
rn_pd = @reaction_network begin
325325
p, ∅ --> X
326326
d, X --> ∅
327327
end
@@ -335,7 +335,7 @@ Catalyst uses `-->`, `<-->`, and `<--` to denote forward, bi-directional, and ba
335335

336336
E.g. the production/degradation system can alternatively be written as:
337337
```@example dsl_basics
338-
rn4 = @reaction_network begin
338+
rn_pd = @reaction_network begin
339339
p, ∅ → X
340340
d, X → ∅
341341
end
@@ -361,7 +361,7 @@ nothing # hide
361361

362362
This functionality can also be used to create less serious models:
363363
```@example dsl_basics
364-
rn_13 = @reaction_network begin
364+
rn = @reaction_network begin
365365
🍦, 😢 --> 😃
366366
end
367367
```

0 commit comments

Comments
 (0)