You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/02_model_creation/03_programmatic_CRN_construction.md
+59-25
Original file line number
Diff line number
Diff line change
@@ -267,37 +267,13 @@ sol = solve(oprob)
267
267
plot(sol)
268
268
```
269
269
270
-
271
270
## [Additional options for declaration of `Reaction`s](@id programmatic_CRN_construction_reactions_options)
272
271
When describing the DSL, we also describe a range of [options for declaring various types of reactions](@ref ref). Each type of reaction that can be created using the DSL can also be created programmatically. Below, we briefly describe each case.
273
272
274
-
### [Reactions with non-unitary stoichiometries](@id programmatic_CRN_construction_reactions_options_stoichiometries)
275
-
Previously, we assumed that all reactions' substrates and products had stoichiometry 1. Other stoichiometries ([including decimal, parametric, and distributed, ones](@ref ref)) are possible. To designate this we provide two additional arguments to the `Reaction` constructor, designating the substrates and products stoichiometries respectively.
276
-
277
-
E.g. to model a simple dimerisation system (where two copies of $X$ dimerise to form $X2$, which then may dissociate back into two copies of $X$) we use
Here, `Reaction(k, [X], [X2], [2], [1])` indicates that there are `2` copies of $X$ and one copy of $X2$ involved in the reaction.
290
-
291
-
If there are multiple substrates and/or products, the order of the stoichiometries must correspond to the order in which these occur. E.g. to create a reaction `k, 2X + Y --> X + 2Y` we would use
292
-
```@example programmatic_6
293
-
@parameters k
294
-
@species X(t) Y(t)
295
-
Reaction(k, [X, Y], [X, Y], [2, 1], [1, 2]),
296
-
```
297
-
298
273
### [Production and degradation reactions](@id programmatic_CRN_construction_reactions_options_production_and_degradation)
299
274
To designate [an absence of substrates and/or products](@ref ref), we simply give an empty vector. E.g. to create a [birth-death model](@ref ref) we use
300
275
```@example programmatic_6
276
+
using Catalyst # hide
301
277
@parameters p d
302
278
@species X(t)
303
279
rxs = [
@@ -338,6 +314,64 @@ Finally, Catalyst also pre-defined a few functions commonly used in systems biol
338
314
Reaction(mm(E, v, K), [Xi], [Xa])
339
315
```
340
316
317
+
### [Reactions with non-unitary stoichiometries](@id programmatic_CRN_construction_reactions_options_stoichiometries)
318
+
Previously, we assumed that all reactions' substrates and products had stoichiometry 1. Other stoichiometries ([including decimal, parametric, and distributed, ones](@ref ref)) are possible. To designate this we provide two additional arguments to the `Reaction` constructor, designating the substrates and products stoichiometries respectively.
319
+
320
+
E.g. to model a simple dimerisation system (where two copies of $X$ dimerise to form $X2$, which then may dissociate back into two copies of $X$) we use
Here, `Reaction(k, [X], [X2], [2], [1])` indicates that there are `2` copies of $X$ and one copy of $X2$ involved in the reaction.
332
+
333
+
If there are multiple substrates and/or products, the order of the stoichiometries must correspond to the order in which these occur. E.g. to create a reaction `k, 2X + Y --> X + 2Y` we would use
334
+
```@example programmatic_6
335
+
@parameters k
336
+
@species X(t) Y(t)
337
+
Reaction(k, [X, Y], [X, Y], [2, 1], [1, 2]),
338
+
```
339
+
340
+
### [Reactions with non-standard stoichiometries](@id programmatic_CRN_construction_reactions_options_stoichiometries)
341
+
Reactant stoichiometries does not need to be integers, but can also be other numbers, parameters, or expressions.
342
+
343
+
Here we create a birth-death model where each production reaction produces 1.5 units of `X`:
344
+
```@example programmatic_6
345
+
t = default_t()
346
+
@species X(t)
347
+
@parameters p d
348
+
rxs = [
349
+
Reaction(p, [], [X], [], [1.5]),
350
+
Reaction(d, [X], [])
351
+
]
352
+
@named bd_model = ReactionSystem(rxs, t)
353
+
```
354
+
It is also possible to have non-integer stoichiometric coefficients for substrates. However, in this case the [`combinatoric_ratelaw = false`](@ref ref) option must be used. We note that non-integer stoichiometric coefficients does not make sense in most fields, however, this features is available for use for models where it does make sense.
355
+
356
+
It is possible for stoichiometric coefficients to be parameters. E.g. here we create a generic polymerisation system where `n` copies of `X` binds to form `Xn`:
The `Reaction` constructor accepts several additional optional arguments. E.g. to [disable to use of mass action to compute reaction propensities, and instead use the rate only], you can use the `only_use_rate = true` argument:
0 commit comments