Skip to content

Commit b42bb62

Browse files
committed
Improve documentation on completeness.
1 parent a9371d5 commit b42bb62

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

docs/src/catalyst_functionality/compositional_modeling.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ can construct the earlier repressilator model by composing together three
55
identically repressed genes, and how to use compositional modeling to create
66
compartments.
77

8-
## A note on *completeness*
8+
## [A note on *completeness*](@id completeness_note)
99
Catalyst `ReactionSystem` can either be *complete* or *incomplete*. When created using the `@reaction_network` DSL they are *created as complete*. Here, only complete `ReactionSystem`s can be used to create the various problem types (e.g. `ODEProblem`). However, only incomplete `ReactionSystem`s can be composed using the features described below. Hence, for compositional modeling, `ReactionSystem` must be created as incomplete, and later set to complete before simulation.
1010

1111
To create incomplete `ReactionSystem`s using the DSL as complete, use the `@network_component` instead of `@reaction_network`:
@@ -15,13 +15,13 @@ degradation_component = @network_component begin
1515
d, X --> 0
1616
end
1717
```
18-
Or when created directly, use the `complete = false` argument:
18+
Alternatively all `ReactionSystem`s created programmatically are incomplete:
1919
```@example ex0
2020
@parameters d
2121
@variable t
2222
@species X(t)
2323
rx = Reaction(d, [X], nothing)
24-
@named degradation_component = ReactionSystem([rs], t; complete = false)
24+
@named degradation_component = ReactionSystem([rs], t)
2525
```
2626
We can test whether a system is complete using the `ModelingToolkit.iscomplete` function:
2727
```@example ex0
@@ -83,7 +83,7 @@ t = default_t()
8383
@parameters k
8484
@species A(t), B(t), C(t)
8585
rxs = [Reaction(k, [A,B], [C])]
86-
@named rn = ReactionSystem(rxs, t; systems = [newrn, newestrn], complete = false)
86+
@named rn = ReactionSystem(rxs, t; systems = [newrn, newestrn])
8787
```
8888

8989
Catalyst provides several different accessors for getting information from a
@@ -147,7 +147,7 @@ t = default_t()
147147
@named G1 = repressed_gene(; R=ParentScope(G3₊P))
148148
@named G2 = repressed_gene(; R=ParentScope(G1.P))
149149
@named G3 = repressed_gene(; R=ParentScope(G2.P))
150-
@named repressilator = ReactionSystem(t; systems=[G1,G2,G3], complete = false)
150+
@named repressilator = ReactionSystem(t; systems=[G1,G2,G3])
151151
```
152152
Notice, in this system each gene is a child node in the system graph of the repressilator
153153
```julia

docs/src/catalyst_functionality/programmatic_CRN_construction.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ system to be the same as the name of the variable storing the system.
6161
Alternatively, one can use the `name = :repressilator` keyword argument to the
6262
`ReactionSystem` constructor.
6363

64+
!!! warn
65+
All `ReactionSystem`s created programmatically (i.e. by calling `ReactionSystem` with some input, rather than using `@reaction_network`) are created as *incomplete*. To simulate them, they must first be made *complete*. This can be done using the `complete` function, i.e. by calling `repressilator = complete(repressilator)`. An expanded description on *completeness* can be found [here](@ref completeness_note).
66+
6467
We can check that this is the same model as the one we defined via the DSL as
6568
follows (this requires that we use the same names for rates, species and the
6669
system)

docs/src/introduction_to_catalyst/introduction_to_catalyst.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Let's now use our `ReactionSystem` to generate and solve a corresponding mass
9696
action ODE model. We first convert the system to a `ModelingToolkit.ODESystem`
9797
by
9898
```@example tut1
99+
repressilator = complete(repressilator)
99100
odesys = convert(ODESystem, repressilator)
100101
```
101102
(Here Latexify is used automatically to display `odesys` in Latex within Markdown
@@ -138,6 +139,7 @@ By passing `repressilator` directly to the `ODEProblem`, Catalyst has to
138139
(internally) call `convert(ODESystem, repressilator)` again to generate the
139140
symbolic ODEs. We could instead pass `odesys` directly like
140141
```@example tut1
142+
odesys = complete(odesys)
141143
oprob2 = ODEProblem(odesys, u₀symmap, tspan, psymmap)
142144
nothing # hide
143145
```
@@ -152,6 +154,10 @@ underlying problem.
152154
always be converted to `symbolic` mappings using [`symmap_to_varmap`](@ref),
153155
see the [Basic Syntax](@ref basic_examples) section for more details.
154156

157+
158+
!!! note
159+
Above we have used `repressilator = complete(repressilator)` and `odesys = complete(odesys)` to mark these systems as *complete*. This must be done before any system is given as input to a `convert` call or some problem type. Models created through the @reaction_network` DSL (which is introduced elsewhere, and primarily used throughout these documentation) are created as complete. Hence `complete` does not need to be called on these models. An expanded description on *completeness* can be found [here](@ref completeness_note).
160+
155161
At this point we are all set to solve the ODEs. We can now use any ODE solver
156162
from within the
157163
[DifferentialEquations.jl](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/)

0 commit comments

Comments
 (0)