Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chaneg doc mentions of DiffEqBiological to Catalyst and update syntax #277

Merged
merged 4 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[deps]
DiffEqBiological = "eb300fae-53e8-50a0-950c-e21f52c2b7e0"
Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
ParameterizedFunctions = "65888b18-ceab-5e60-b2b9-181511a3b968"
6 changes: 3 additions & 3 deletions assets/assets.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generate the assets (pngs for README)
using Latexify, LaTeXStrings, ParameterizedFunctions, DiffEqBiological
using Latexify, LaTeXStrings, ParameterizedFunctions, Catalyst

struct Ket{T}
x::T
Expand All @@ -20,12 +20,12 @@ things = [
(r_bind, r_unbind), A + B ↔ C
Hill(C, v, k, n), 0 --> X
d_x, X --> 0
end r_bind r_unbind v k n d_x),
end; form=:ode),
"demo_rn_arrow" => latexify(@reaction_network demoNetwork begin
(r_bind, r_unbind), A + B ↔ C
Hill(C, v, k, n), 0 --> X
d_x, X --> 0
end r_bind r_unbind v k n d_x; env=:arrow),
end),
]

cd("$(pkgdir(Latexify))/assets") do
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ makedocs(
"tutorials/recipes.md",
"Use with other packages" => [
"tutorials/parameterizedfunctions.md",
"tutorials/DiffEqBiological.md"
"tutorials/Catalyst.md"
],
"tutorials/notebooks.md",
"arguments.md",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ latexify(args, env=:mdtable)
```

## Chemical arrow notation
Available with `ReactionNetwork`s from `DiffEqBiological`.
Available with `ReactionNetwork`s from `Catalyst`.
```@eval
Base.include(@__MODULE__, "src/table_generator.jl")
args = [arg for arg in keyword_arguments if :arrow in arg.env]
Expand Down
2 changes: 1 addition & 1 deletion docs/src/table_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ keyword_arguments = [
KeywordArgument(:convert_unicode, [:mdtable, :tabular, :align, :array, :raw, :inline], "`Bool`", "`true`", "Convert unicode characters to latex commands, for example `α` to `\\alpha`", [:Any]),
KeywordArgument(:cdot, [:mdtable, :tabular, :align, :array, :raw, :inline], "`Bool`", "`true`", "Toggle between using `\\cdot` or just a space to represent multiplication.", [:Any]),
KeywordArgument(:symbolic, [:align], "`Bool`", "`false`", "Use symbolic calculations to clean up the expression.", [:ReactionNetwork]),
KeywordArgument(:clean, [:align], "`Bool`", "`false`", "Clean out `1*` terms. Only useful for DiffEqBiological versions 3.4 or below.", [:ReactionNetwork]),
KeywordArgument(:clean, [:align], "`Bool`", "`false`", "Clean out `1*` terms. Only useful for Catalyst (then named DiffEqBiological) versions 3.4 or below.", [:ReactionNetwork]),
KeywordArgument(:rows, [:align], "Iterable or symol", ":all", "Which rows to include in the output.", [:Any]),
KeywordArgument(:booktabs, [:tabular], "`Bool`", "`false`", "Add top, mid and bottom booktabs rule", [:Any]),
KeywordArgument(:index, [:mdtable, :tabular, :align, :array, :raw, :inline], "`Symb`", "`:bracket`", "Represent index specification with `:bracket` (`u[1]`) or `:subscript` (`u_1`). ", [:Any]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Use with @reaction_network from DiffEqBiological.jl.
# Use with @reaction_network from Catalyst.jl.

Latexify.jl has methods for dealing with AbstractReactionNetworks. For more information regarding this DSL, turn to its [docs](http://docs.juliadiffeq.org/latest/models/biological.html). The latexify end of things are pretty simple: feed a reaction network to `latexify()` and let it do its magic.
Latexify.jl has methods for dealing with the `ReactionNetwork` models generated by Catalyst.jl. More information regarding these can be found [here](https://github.com/SciML/Catalyst.jl). The latexify end of things are pretty simple: feed a reaction network to `latexify()` and let it do its magic.

```julia
using DiffEqBiological
using Catalyst
using Latexify
copy_to_clipboard(true)

@reaction_func hill2(x, v, k) = v*x^2/(k^2 + x^2)

rn = @reaction_network MyRnType begin
hill2(x, v, k) = v*x^2/(k^2 + x^2)
rn = @reaction_network begin
hill2(y, v_x, k_x), 0 --> x
p_y, 0 --> y
(d_x, d_y), (x, y) --> 0
(r_b, r_u), x ↔ y
end v_x k_x p_y d_x d_y r_b r_u
end

latexify(rn)
latexify(rn; form=:ode)
```
```math
\begin{align}
Expand All @@ -25,25 +24,25 @@ latexify(rn)
\end{align}
```

The method has a keyword for choosing between outputting the ODE or the noise term. While it is not obvious from the latexify output, the noise in the reaction network is correlated.

Alternatively, the SDEs generated through the chemical Langevin equations can be displayed by setting the `form` argument to `:sde`. Here, the noise in the reaction network is correlated/
```julia
latexify(rn; noise=true)
latexify(rn; form=:sde)
```

```math
\begin{align}
\frac{dx}{dt} =& \sqrt{\frac{v_{x} \cdot y^{2}}{k_{x}^{2} + y^{2}}} - \sqrt{d_{x} \cdot x} - \sqrt{r_{b} \cdot x} + \sqrt{r_{u} \cdot y} \\
\frac{dy}{dt} =& \sqrt{p_{y}} - \sqrt{d_{y} \cdot y} + \sqrt{r_{b} \cdot x} - \sqrt{r_{u} \cdot y} \\
\end{align}
```

Note: On the current version of Latexify, generation of SDEs from reaction networks is broken.


## Chemical arrow notation

DiffEqBiologicals reaction network is all about chemical arrow notation, so why should we not be able to render arrows?
Catalyst reaction network is all about chemical arrow notation, so why should we not be able to render arrows?

Use `latexify`'s `env` keyword argument to specify that you want `:chemical` (or the equivalent `:arrow`, `:arrows` or `:chem`).
This is the default output (when no value to `form` is given).

```julia
latexify(rn; env=:chemical)
Expand Down
2 changes: 1 addition & 1 deletion paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Latexify.jl itself. This becomes especially powerful in combination with
Julia's metaprogramming facilities and easily generated domain-specific
languages (DSLs). Latexify.jl can, for example, output the system of
differential equations (and much more) that is automatically generated by a
chemical reaction arrow DSL provided by DiffEqBiological.jl [@diffeq].
chemical reaction arrow DSL provided by Catalyst.jl [@diffeq].

The package aims to support the scientific work-flow through facilitating
inspection, automation and representation. Simple inspection of the equations
Expand Down
Loading