Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
vyudu committed Nov 7, 2024
1 parent bef4566 commit 8af57b4
Show file tree
Hide file tree
Showing 37 changed files with 163 additions and 154 deletions.
9 changes: 2 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,20 @@ BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
GraphMakie = "1ecd5474-83a3-4783-bb4f-06765db800d2"
HomotopyContinuation = "f213a82b-91d6-5c5d-acf7-10f1c761b327"
# StructuralIdentifiability = "220ca800-aa68-49bb-acd8-6037fa93a544"

[extensions]
CatalystBifurcationKitExtension = "BifurcationKit"
CatalystCairoMakieExtension = "CairoMakie"
CatalystGraphMakieExtension = "GraphMakie"
CatalystHomotopyContinuationExtension = "HomotopyContinuation"
# CatalystStructuralIdentifiabilityExtension = "StructuralIdentifiability"

[compat]
BifurcationKit = "0.3"
CairoMakie = "0.12"
Combinatorics = "1.0.2"
DataStructures = "0.18"
DiffEqBase = "6.83.0"
DifferentialEquations = "7.15.0"
DocStringExtensions = "0.8, 0.9"
DynamicPolynomials = "0.5, 0.6"
DynamicQuantities = "0.13.2, 1"
Expand All @@ -64,7 +63,6 @@ Requires = "1.0"
RuntimeGeneratedFunctions = "0.5.12"
SciMLBase = "< 2.57.2"
Setfield = "1"
# StructuralIdentifiability = "0.5.8"
SymbolicUtils = "2.1.2, 3.3.0"
Symbolics = "5.30.1, 6"
Unitful = "1.12.4"
Expand Down Expand Up @@ -93,7 +91,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[targets]
test = ["DiffEqCallbacks", "DomainSets", "Graphviz_jll", "Logging", "NonlinearSolve",
"OrdinaryDiffEq", "Pkg", "Plots", "Random", "SafeTestsets", "SciMLBase", "SciMLNLSolve",
"StableRNGs", "StaticArrays", "Statistics", "SteadyStateDiffEq", "StochasticDiffEq",
"Test", "Unitful"]
test = ["DiffEqCallbacks", "DomainSets", "Graphviz_jll", "Logging", "NonlinearSolve", "OrdinaryDiffEq", "Pkg", "Plots", "Random", "SafeTestsets", "SciMLBase", "SciMLNLSolve", "StableRNGs", "StaticArrays", "Statistics", "SteadyStateDiffEq", "StochasticDiffEq", "Test", "Unitful"]
9 changes: 5 additions & 4 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ OptimizationBBO = "3e6eede4-6085-4f62-9a71-46d9bc1eb92b"
OptimizationNLopt = "4e6fcdb7-1186-4e1f-a706-475e75c168bb"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
OrdinaryDiffEqBDF = "6ad6398a-0878-4a85-9266-38940aa047c8"
OrdinaryDiffEqRosenbrock = "43230ef6-c299-4910-a778-202eb28ce4ce"
OrdinaryDiffEqSDIRK = "2d112036-d095-4a1e-ab9a-08536f3ecdbf"
OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a"
OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
QuasiMonteCarlo = "8a4e6c94-4038-4cdc-81c3-7e6ffdb2a71b"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Expand All @@ -35,7 +39,6 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f"
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
#StructuralIdentifiability = "220ca800-aa68-49bb-acd8-6037fa93a544"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
Expand Down Expand Up @@ -65,7 +68,6 @@ OptimizationBBO = "0.4"
OptimizationNLopt = "0.3"
OptimizationOptimJL = "0.4"
OptimizationOptimisers = "0.3"
OrdinaryDiffEq = "6.80.1"
Plots = "1.40"
QuasiMonteCarlo = "0.3"
SciMLBase = "2.46"
Expand All @@ -74,5 +76,4 @@ SpecialFunctions = "2.4"
StaticArrays = "1.9"
SteadyStateDiffEq = "2.2"
StochasticDiffEq = "6.65"
#StructuralIdentifiability = "0.5.8"
Symbolics = "5.30.1, 6"
4 changes: 2 additions & 2 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ corresponding chemical reaction ODE models, chemical Langevin equation SDE
models, and stochastic chemical kinetics jump process models.

```@example ex1
using Catalyst, OrdinaryDiffEq, StochasticDiffEq, JumpProcesses, Plots
using Catalyst, OrdinaryDiffEqTsit5, StochasticDiffEq, JumpProcesses, Plots
t = default_t()
@parameters β γ
@species S(t) I(t) R(t)
Expand Down Expand Up @@ -393,4 +393,4 @@ Finally, we provide the following helper functions to plot and animate spatial l
lattice_plot
lattice_animation
lattice_kymograph
```
```
6 changes: 3 additions & 3 deletions docs/src/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ One can directly use symbolic variables to index into SciML solution objects.
Moreover, observables can also be evaluated in this way. For example,
consider the system
```@example faq1
using Catalyst, OrdinaryDiffEq, Plots
using Catalyst, OrdinaryDiffEqTsit5, Plots
rn = @reaction_network ABtoC begin
(k₊,k₋), A + B <--> C
end
Expand Down Expand Up @@ -132,7 +132,7 @@ When directly constructing a `ReactionSystem`, we can set the symbolic values to
have the desired default values, and this will automatically be propagated
through to the equation solvers:
```@example faq3
using Catalyst, Plots, OrdinaryDiffEq
using Catalyst, Plots, OrdinaryDiffEqTsit5
t = default_t()
@parameters β=1e-4 ν=.01
@species S(t)=999.0 I(t)=1.0 R(t)=0.0
Expand Down Expand Up @@ -175,7 +175,7 @@ Julia `Symbol`s corresponding to each variable/parameter to their values, or
from ModelingToolkit symbolic variables/parameters to their values. Using
`Symbol`s we have
```@example faq4
using Catalyst, OrdinaryDiffEq
using Catalyst, OrdinaryDiffEqTsit5
rn = @reaction_network begin
α, S + I --> 2I
β, I --> R
Expand Down
8 changes: 4 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ etc).
- [Steady states](@ref homotopy_continuation) (and their [stabilities](@ref steady_state_stability)) can be computed for model ODE representations.

#### [Features of Catalyst composing with other packages](@id doc_index_features_composed)
- [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) Can be used to numerically solver generated reaction rate equation ODE models.
- [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) Can be used to numerically solve generated reaction rate equation ODE models.
- [StochasticDiffEq.jl](https://github.com/SciML/StochasticDiffEq.jl) can be used to numerically solve generated Chemical Langevin Equation SDE models.
- [JumpProcesses.jl](https://github.com/SciML/JumpProcesses.jl) can be used to numerically sample generated Stochastic Chemical Kinetics Jump Process models.
- Support for [parallelization of all simulations](@ref ode_simulation_performance_parallelisation), including parallelization of [ODE simulations on GPUs](@ref ode_simulation_performance_parallelisation_GPU) using [DiffEqGPU.jl](https://github.com/SciML/DiffEqGPU.jl).
Expand Down Expand Up @@ -92,7 +92,7 @@ Pkg.add("Catalyst")

Many Catalyst features require the installation of additional packages. E.g. for ODE-solving and simulation plotting
```julia
Pkg.add("OrdinaryDiffEq")
Pkg.add("OrdinaryDiffEqTsit5")
Pkg.add("Plots")
```
is also needed.
Expand Down Expand Up @@ -124,7 +124,7 @@ an ordinary differential equation.

```@example home_simple_example
# Fetch required packages.
using Catalyst, OrdinaryDiffEq, Plots
using Catalyst, OrdinaryDiffEqTsit5, Plots
# Create model.
model = @reaction_network begin
Expand All @@ -140,7 +140,7 @@ ps = [:kB => 0.01, :kD => 0.1, :kP => 0.1]
ode = ODEProblem(model, u0, tspan, ps)
# Simulate ODE and plot results.
sol = solve(ode)
sol = solve(ode, Tsit5())
plot(sol; lw = 5)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ To import a Julia package into a session, you can use the `using PackageName` co
using Pkg
Pkg.add("Catalyst")
```
Here, the Julia package manager package (`Pkg`) is by default installed on your computer when Julia is installed, and can be activated directly. Next, we also wish to install the `OrdinaryDiffEq` and `Plots` packages (for numeric simulation of models, and plotting, respectively).
Here, the Julia package manager package (`Pkg`) is by default installed on your computer when Julia is installed, and can be activated directly. Next, we also wish to install the needed sub-libraries of `OrdinaryDiffEqTsit5` and `Plots` packages (for numeric simulation of models, and plotting, respectively). We will import the default recommende dsolver, `Tsit5()`, which is in the `OrdinaryDiffEqTsit5` sub-library. A full list of `OrdinaryDiffEq` solver sublibraries can be found on the sidebar of [this page](https://docs.sciml.ai/OrdinaryDiffEq/stable/).
```julia
Pkg.add("OrdinaryDiffEq")
Pkg.add("OrdinaryDiffEqTsit5")
Pkg.add("Plots")
```
Once a package has been installed through the `Pkg.add` command, this command does not have to be repeated if we restart our Julia session. We can now import all three packages into our current session with:
```@example ex2
using Catalyst
using OrdinaryDiffEq
using OrdinaryDiffEqTsit5
using Plots
```
Here, if we restart Julia, these `using` commands *must be rerun*.
Expand Down Expand Up @@ -253,4 +253,4 @@ If you are a new Julia user who has used this tutorial, and there was something
---
## References
[^1]: [Torkel E. Loman, Yingbo Ma, Vasily Ilin, Shashi Gowda, Niklas Korsbo, Nikhil Yewale, Chris Rackauckas, Samuel A. Isaacson, *Catalyst: Fast and flexible modeling of reaction networks*, PLOS Computational Biology (2023).](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011530)
[^2]: [Jeff Bezanson, Alan Edelman, Stefan Karpinski, Viral B. Shah, *Julia: A Fresh Approach to Numerical Computing*, SIAM Review (2017).](https://epubs.siam.org/doi/abs/10.1137/141000671)
[^2]: [Jeff Bezanson, Alan Edelman, Stefan Karpinski, Viral B. Shah, *Julia: A Fresh Approach to Numerical Computing*, SIAM Review (2017).](https://epubs.siam.org/doi/abs/10.1137/141000671)
6 changes: 3 additions & 3 deletions docs/src/introduction_to_catalyst/introduction_to_catalyst.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Pkg.activate("catalyst_introduction")

# packages we will use in this tutorial
Pkg.add("Catalyst")
Pkg.add("OrdinaryDiffEq")
Pkg.add("OrdinaryDiffEqTsit5")
Pkg.add("Plots")
Pkg.add("Latexify")
Pkg.add("JumpProcesses")
Expand All @@ -29,7 +29,7 @@ Pkg.add("StochasticDiffEq")

We next load the basic packages we'll need for our first example:
```@example tut1
using Catalyst, OrdinaryDiffEq, Plots, Latexify
using Catalyst, OrdinaryDiffEqTsit5, Plots, Latexify
```

Let's start by using the Catalyst [`@reaction_network`](@ref) macro to specify a
Expand Down Expand Up @@ -386,4 +386,4 @@ A more detailed summary of the precise mathematical equations Catalyst can gener

---
## References
1. [Torkel E. Loman, Yingbo Ma, Vasily Ilin, Shashi Gowda, Niklas Korsbo, Nikhil Yewale, Chris Rackauckas, Samuel A. Isaacson, *Catalyst: Fast and flexible modeling of reaction networks*, PLOS Computational Biology (2023).](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011530)
1. [Torkel E. Loman, Yingbo Ma, Vasily Ilin, Shashi Gowda, Niklas Korsbo, Nikhil Yewale, Chris Rackauckas, Samuel A. Isaacson, *Catalyst: Fast and flexible modeling of reaction networks*, PLOS Computational Biology (2023).](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011530)
4 changes: 2 additions & 2 deletions docs/src/inverse_problems/behaviour_optimisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end
```
To demonstrate this pulsing behaviour we will simulate the system for an example parameter set. We select an initial condition (`u0`) so the system begins in a steady state.
```@example behaviour_optimization
using OrdinaryDiffEq, Plots
using OrdinaryDiffEqTsit5, Plots
example_p = [:pX => 0.1, :pY => 1.0, :pZ => 1.0]
tspan = (0.0, 50.0)
example_u0 = [:X => 0.1, :Y => 0.1, :Z => 1.0]
Expand Down Expand Up @@ -107,4 +107,4 @@ If you use this functionality in your research, please cite the following paper
---
## References
[^1]: [Mykel J. Kochenderfer, Tim A. Wheeler *Algorithms for Optimization*, The MIT Press (2019).](https://algorithmsbook.com/optimization/files/optimization.pdf)
[^2]: [Lea Goentoro, Oren Shoval, Marc W Kirschner, Uri Alon *The incoherent feedforward loop can provide fold-change detection in gene regulation*, Molecular Cell (2009).](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2896310/)
[^2]: [Lea Goentoro, Oren Shoval, Marc W Kirschner, Uri Alon *The incoherent feedforward loop can provide fold-change detection in gene regulation*, Molecular Cell (2009).](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2896310/)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In this example we will use [Optimization.jl](https://github.com/SciML/Optimizat
First, we fetch the required packages.
```@example pe_osc_example
using Catalyst
using OrdinaryDiffEq
using OrdinaryDiffEqRosenbrock
using Optimization
using OptimizationOptimisers # Required for the ADAM optimizer.
using SciMLSensitivity # Required for `Optimization.AutoZygote()` automatic differentiation option.
Expand Down
6 changes: 3 additions & 3 deletions docs/src/inverse_problems/global_sensitivity_analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ end
```
We will study the peak number of infected cases's ($max(I(t))$) sensitivity to the system's three parameters. We create a function which simulates the system from a given initial condition and measures this property:
```@example gsa_1
using OrdinaryDiffEq
using OrdinaryDiffEqTsit5
u0 = [:S => 999.0, :I => 1.0, :E => 0.0, :R => 0.0]
p_dummy = [:β => 0.0, :a => 0.0, :γ => 0.0]
Expand All @@ -31,7 +31,7 @@ oprob_base = ODEProblem(seir_model, u0, (0.0, 10000.0), p_dummy)
function peak_cases(p)
ps = [:β => p[1], :a => p[2], :γ => p[3]]
oprob = remake(oprob_base; p = ps)
sol = solve(oprob; maxiters = 100000, verbose = false)
sol = solve(oprob, Tsit5(); maxiters = 100000, verbose = false)
SciMLBase.successful_retcode(sol) || return Inf
return maximum(sol[:I])
end
Expand Down Expand Up @@ -157,4 +157,4 @@ If you use this functionality in your research, [in addition to Catalyst](@ref d

---
## References
[^1]: [Saltelli, A et al. *Global Sensitivity Analysis. The Primer*, Wiley (2008).](http://www.andreasaltelli.eu/file/repository/A_Saltelli_Marco_Ratto_Terry_Andres_Francesca_Campolongo_Jessica_Cariboni_Debora_Gatelli_Michaela_Saisana_Stefano_Tarantola_Global_Sensitivity_Analysis_The_Primer_Wiley_Interscience_2008_.pdf)
[^1]: [Saltelli, A et al. *Global Sensitivity Analysis. The Primer*, Wiley (2008).](http://www.andreasaltelli.eu/file/repository/A_Saltelli_Marco_Ratto_Terry_Andres_Francesca_Campolongo_Jessica_Cariboni_Debora_Gatelli_Michaela_Saisana_Stefano_Tarantola_Global_Sensitivity_Analysis_The_Primer_Wiley_Interscience_2008_.pdf)
6 changes: 3 additions & 3 deletions docs/src/inverse_problems/optimization_ode_param_fitting.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ u0 = [:S => 1.0, :E => 1.0, :SE => 0.0, :P => 0.0]
ps_true = [:kB => 1.0, :kD => 0.1, :kP => 0.5]
# Generate synthetic data.
using OrdinaryDiffEq
using OrdinaryDiffEqTsit5
oprob_true = ODEProblem(rn, u0, (0.0, 10.0), ps_true)
true_sol = solve(oprob_true)
data_sol = solve(oprob_true; saveat=1.0)
true_sol = solve(oprob_true, Tsit5())
data_sol = solve(oprob_true, Tsit5(); saveat=1.0)
data_ts = data_sol.t[2:end]
data_vals = (0.8 .+ 0.4*rand(10)) .* data_sol[:P][2:end]
Expand Down
10 changes: 5 additions & 5 deletions docs/src/model_creation/conservation_laws.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ end
```
If we simulate it, we note that while the concentrations of $X₁$ and $X₂$ change throughout the simulation, the total concentration of $X$ ($= X₁ + X₂$) is constant:
```@example conservation_laws
using OrdinaryDiffEq, Plots
using OrdinaryDiffEqTsit5, Plots
u0 = [:X₁ => 80.0, :X₂ => 20.0]
ps = [:k₁ => 10.0, :k₂ => 2.0]
oprob = ODEProblem(rs, u0, (0.0, 1.0), ps)
sol = solve(oprob)
sol = solve(oprob, Tsit5())
plot(sol; idxs = [rs.X₁, rs.X₂, rs.X₁ + rs.X₂], label = ["X₁" "X₂" "X₁ + X₂ (a conserved quantity)"])
```
This makes sense, as while $X$ is converted between two different forms ($X₁$ and $X₂$), it is neither produced nor degraded. That is, it is a *conserved quantity*. Next, if we consider the ODE that our model generates:
Expand Down Expand Up @@ -47,15 +47,15 @@ Here, Catalyst encodes all conserved quantities in a single, [vector-valued](@re

Practically, the `remove_conserved = true` argument can be provided when a `ReactionSystem` is converted to an `ODEProblem`:
```@example conservation_laws
using OrdinaryDiffEq, Plots
using OrdinaryDiffEqTsit5, Plots
u0 = [:X₁ => 80.0, :X₂ => 20.0]
ps = [:k₁ => 10.0, :k₂ => 2.0]
oprob = ODEProblem(rs, u0, (0.0, 1.0), ps; remove_conserved = true)
nothing # hide
```
Here, while `Γ[1]` becomes a parameter of the new system, it has a [default value](@ref dsl_advanced_options_default_vals) equal to the corresponding conservation law. Hence, its value is computed from the initial condition `[:X₁ => 80.0, :X₂ => 20.0]`, and does not need to be provided in the parameter vector. Next, we can simulate and plot our model using normal syntax:
```@example conservation_laws
sol = solve(oprob)
sol = solve(oprob, Tsit5())
plot(sol)
```
!!! note
Expand Down Expand Up @@ -88,4 +88,4 @@ Finally, the `conservationlaws` function yields a $m \times n$ matrix, where $n$
```@example conservation_laws
conservationlaws(rs)
```
I.e. in this case we have a single conserved quantity, which contains a single copy each of the system's two species.
I.e. in this case we have a single conserved quantity, which contains a single copy each of the system's two species.
8 changes: 4 additions & 4 deletions docs/src/model_creation/constraint_equations.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ creating these two systems.
Here, to create differentials with respect to time (for our differential equations), we must import the time differential operator from Catalyst. We do this through `D = default_time_deriv()`. Here, `D(V)` denotes the differential of the variable `V` with respect to time.

```@example ceq1
using Catalyst, OrdinaryDiffEq, Plots
using Catalyst, OrdinaryDiffEqTsit5, Plots
t = default_t()
D = default_time_deriv()
Expand Down Expand Up @@ -73,7 +73,7 @@ plot(sol)
As an alternative to the previous approach, we could have constructed our
`ReactionSystem` all at once by directly using the symbolic interface:
```@example ceq2
using Catalyst, OrdinaryDiffEq, Plots
using Catalyst, OrdinaryDiffEqTsit5, Plots
t = default_t()
D = default_time_deriv()
Expand Down Expand Up @@ -106,7 +106,7 @@ callback interface is illustrated [here](https://docs.sciml.ai/DiffEqDocs/stable

Let's first create our equations and unknowns/species again
```@example ceq3
using Catalyst, OrdinaryDiffEq, Plots
using Catalyst, OrdinaryDiffEqTsit5, Plots
t = default_t()
D = default_time_deriv()
Expand Down Expand Up @@ -172,4 +172,4 @@ plot(sol)
For a detailed discussion on how to directly use the lower-level but more
flexible DifferentialEquations.jl event/callback interface, see the
[tutorial](https://docs.sciml.ai/Catalyst/stable/catalyst_applications/advanced_simulations/#Event-handling-using-callbacks)
on event handling using callbacks.
on event handling using callbacks.
Loading

0 comments on commit 8af57b4

Please sign in to comment.