diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml index 453925c..9c79359 100644 --- a/.JuliaFormatter.toml +++ b/.JuliaFormatter.toml @@ -1 +1,2 @@ -style = "sciml" \ No newline at end of file +style = "sciml" +format_markdown = true \ No newline at end of file diff --git a/README.md b/README.md index 91e3e98..82fb7b1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![codecov](https://codecov.io/gh/SciML/ReactionNetworkImporters.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/SciML/ReactionNetworkImporters.jl) [![Build Status](https://github.com/SciML/ReactionNetworkImporters.jl/workflows/CI/badge.svg)](https://github.com/SciML/ReactionNetworkImporters.jl/actions?query=workflow%3ACI) -[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac) +[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%27s%20Guide-blueviolet)](https://github.com/SciML/ColPrac) [![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle) This package provides importers to load reaction networks into @@ -14,10 +14,11 @@ This package provides importers to load reaction networks into [`ReactionSystem`s](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#ModelingToolkit.ReactionSystem) from several file formats. Currently it supports loading networks in the following formats: -1. A *subset* of the BioNetGen .net file format. -2. Networks represented by dense or sparse substrate and product stoichiometric - matrices. -3. Networks represented by dense or sparse complex stoichiometric and incidence matrices. + + 1. A *subset* of the BioNetGen .net file format. + 2. Networks represented by dense or sparse substrate and product stoichiometric + matrices. + 3. Networks represented by dense or sparse complex stoichiometric and incidence matrices. [SBMLToolkit.jl](https://docs.sciml.ai/SBMLToolkit/stable/) provides an alternative for loading SBML files into Catalyst models, offering a much broader @@ -34,42 +35,48 @@ the documentation which contains the unreleased features. ## Examples ### Loading a BioNetGen .net file + A simple network from the builtin BioNetGen bngl examples is the [repressilator](data/repressilator/Repressilator.bngl). The `generate_network` command in the bngl file outputs a reduced network description, i.e. a [.net](data/repressilator/Repressilator.net) file, which can be loaded into a Catalyst `ReactionSystem` as: + ```julia using ReactionNetworkImporters fname = "PATH/TO/Repressilator.net" prnbng = loadrxnetwork(BNGNetwork(), fname) ``` + Here `BNGNetwork` is a type specifying the file format that is being loaded. `prnbng` is a `ParsedReactionNetwork` structure with the following fields: -- `rn`, a Catalyst `ReactionSystem` -- `u₀`, a `Dict` mapping initial condition symbolic variables to numeric values - and/or symbolic expressions. -- `p`, a `Dict` mapping parameter symbolic variables to numeric values and/or - symbolic expressions. -- `varstonames`, a `Dict` mapping the internal symbolic variable of a species - used in the generated `ReactionSystem` to a `String` generated from the name - in the .net file. This is necessary as BioNetGen can generate exceptionally - long species names, involving characters that lead to malformed species names - when used with `Catalyst`. -- `groupstosyms`, a `Dict` mapping the `String`s representing names for any - groups defined in the BioNetGen file to the corresponding symbolic variable - representing the `ModelingToolkit` symbolic observable associated with the - group. + + - `rn`, a Catalyst `ReactionSystem` + - `u₀`, a `Dict` mapping initial condition symbolic variables to numeric values + and/or symbolic expressions. + - `p`, a `Dict` mapping parameter symbolic variables to numeric values and/or + symbolic expressions. + - `varstonames`, a `Dict` mapping the internal symbolic variable of a species + used in the generated `ReactionSystem` to a `String` generated from the name + in the .net file. This is necessary as BioNetGen can generate exceptionally + long species names, involving characters that lead to malformed species names + when used with `Catalyst`. + - `groupstosyms`, a `Dict` mapping the `String`s representing names for any + groups defined in the BioNetGen file to the corresponding symbolic variable + representing the `ModelingToolkit` symbolic observable associated with the + group. Given `prnbng`, we can construct and solve the corresponding ODE model for the reaction system by + ```julia using OrdinaryDiffEq, Catalyst rn = prnbng.rn tf = 100000.0 -oprob = ODEProblem(rn, Float64[], (0.,tf), Float64[]) -sol = solve(oprob, Tsit5(), saveat=tf/1000.) +oprob = ODEProblem(rn, Float64[], (0.0, tf), Float64[]) +sol = solve(oprob, Tsit5(), saveat = tf / 1000.0) ``` + Note that we specify empty parameter and initial condition vectors as these are already stored in the generated `ReactionSystem`, `rn`. A `Dict` mapping each symbolic species and parameter to its initial value or symbolic expression can @@ -79,13 +86,16 @@ See the [Catalyst documentation](https://docs.sciml.ai/Catalyst/stable/) for how generate ODE, SDE, jump and other types of models. ### Loading a matrix representation + Catalyst `ReactionSystem`s can also be constructed from -- substrate and product stoichiometric matrices. -- complex stoichiometric and incidence matrices. + + - substrate and product stoichiometric matrices. + - complex stoichiometric and incidence matrices. For example, here we both directly build a Catalyst network using the `@reaction_network` macro, and then show how to build the same network from these matrices using `ReactionNetworkImporters`: + ```julia # Catalyst network from the macro: rs = @reaction_network begin @@ -99,33 +109,33 @@ end k1 k2 k3 k4 k5 # network from basic stoichiometry using ReactionNetworkImporters @parameters k1 k2 k3 k4 k5 @variables t A(t) B(t) C(t) -species = [A,B,C] -pars = [k1,k2,k3,k4,k5] -substoich =[ 2 0 1 0 0; - 0 1 1 0 0; - 0 0 0 1 3] -prodstoich = [0 2 0 1 3; - 1 0 0 1 0; - 0 0 1 0 0] -mn= MatrixNetwork(pars, substoich, prodstoich; species=species, - params=pars) # a matrix network +species = [A, B, C] +pars = [k1, k2, k3, k4, k5] +substoich = [2 0 1 0 0; + 0 1 1 0 0; + 0 0 0 1 3] +prodstoich = [0 2 0 1 3; + 1 0 0 1 0; + 0 0 1 0 0] +mn = MatrixNetwork(pars, substoich, prodstoich; species = species, + params = pars) # a matrix network prn = loadrxnetwork(mn) # dense version # test the two networks are the same @assert rs == prn.rn # network from reaction complex stoichiometry -stoichmat =[2 0 1 0 0 3; - 0 1 1 0 0 0; - 0 0 0 1 3 0] -incidencemat = [-1 1 0 0 0; - 1 -1 0 0 0; - 0 0 -1 1 0; - 0 0 1 -1 0; - 0 0 0 0 -1; - 0 0 0 0 1] -cmn= ComplexMatrixNetwork(pars, stoichmat, incidencemat; species=species, - params=pars) # a complex matrix network +stoichmat = [2 0 1 0 0 3; + 0 1 1 0 0 0; + 0 0 0 1 3 0] +incidencemat = [-1 1 0 0 0; + 1 -1 0 0 0; + 0 0 -1 1 0; + 0 0 1 -1 0; + 0 0 0 0 -1; + 0 0 0 0 1] +cmn = ComplexMatrixNetwork(pars, stoichmat, incidencemat; species = species, + params = pars) # a complex matrix network prn = loadrxnetwork(cmn) # test the two networks are the same @@ -133,50 +143,58 @@ prn = loadrxnetwork(cmn) ``` The basic usages are + ```julia -mn = MatrixNetwork(rateexprs, substoich, prodstoich; species=Any[], - params=Any[], t=nothing) +mn = MatrixNetwork(rateexprs, substoich, prodstoich; species = Any[], + params = Any[], t = nothing) prn = loadrxnetwork(mn::MatrixNetwork) -cmn = ComplexMatrixNetwork(rateexprs, stoichmat, incidencemat; species=Any[], - params=Any[], t=nothing) +cmn = ComplexMatrixNetwork(rateexprs, stoichmat, incidencemat; species = Any[], + params = Any[], t = nothing) prn = loadrxnetwork(cmn::ComplexMatrixNetwork) ``` + Here `MatrixNetwork` and `ComplexMatrixNetwork` are the types, which select that we are constructing a substrate/product stoichiometric matrix-based or a reaction complex matrix-based stoichiometric representation as input. See the [Catalyst.jl API](hhttps://docs.sciml.ai/Catalyst/stable/api/catalyst_api/) for more discussion on these matrix representations, and how Catalyst handles symbolic reaction rate expressions. These two types have the following fields: -- `rateexprs`, any valid - [Symbolics.jl](https://docs.sciml.ai/Symbolics/stable/) expression for - the rates, or any basic number type. This can be a hardcoded rate constant - like `1.0`, a parameter like `k1` above, or an general Symbolics expression - involving parameters and species like `k*A`. -- matrix inputs - - For `MatrixNetwork` - - `substoich`, a number of species by number of reactions matrix with entry - `(i,j)` giving the stoichiometric coefficient of species `i` as a - substrate in reaction `j`. - - `prodstoich`, a number of species by number of reactions matrix with entry - `(i,j)` giving the stoichiometric coefficient of species `i` as a product - in reaction `j`. - - For `ComplexMatrixNetwork` - - `stoichmat`, the complex stoichiometry matrix [defined - here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.complexstoichmat). - - `incidencemat`, the complex incidence matrix [defined - here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.reactioncomplexes). -- `species`, an optional vector of symbolic variables representing each species - in the network. Can be constructed using the Symbolics.jl `@variables` macro. - Each species should be dependent on the same time variable (`t` in the example - above). -- `parameters`, a vector of symbolic variables representing each parameter in - the network. Can be constructed with the - [ModelingToolkit.jl](https://docs.sciml.ai/ModelingToolkit/stable/) - `@parameters` macro. If no parameters are used it is an optional keyword. -- `t`, an optional Symbolics.jl variable representing time as the independent - variable of the reaction network. If not provided `Catalyst.DEFAULT_IV` is - used to determine the default time variable. + + - `rateexprs`, any valid + [Symbolics.jl](https://docs.sciml.ai/Symbolics/stable/) expression for + the rates, or any basic number type. This can be a hardcoded rate constant + like `1.0`, a parameter like `k1` above, or an general Symbolics expression + involving parameters and species like `k*A`. + + - matrix inputs + + + For `MatrixNetwork` + + * `substoich`, a number of species by number of reactions matrix with entry + `(i,j)` giving the stoichiometric coefficient of species `i` as a + substrate in reaction `j`. + * `prodstoich`, a number of species by number of reactions matrix with entry + `(i,j)` giving the stoichiometric coefficient of species `i` as a product + in reaction `j`. + + + For `ComplexMatrixNetwork` + + * `stoichmat`, the complex stoichiometry matrix [defined + here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.complexstoichmat). + * `incidencemat`, the complex incidence matrix [defined + here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.reactioncomplexes). + - `species`, an optional vector of symbolic variables representing each species + in the network. Can be constructed using the Symbolics.jl `@variables` macro. + Each species should be dependent on the same time variable (`t` in the example + above). + - `parameters`, a vector of symbolic variables representing each parameter in + the network. Can be constructed with the + [ModelingToolkit.jl](https://docs.sciml.ai/ModelingToolkit/stable/) + `@parameters` macro. If no parameters are used it is an optional keyword. + - `t`, an optional Symbolics.jl variable representing time as the independent + variable of the reaction network. If not provided `Catalyst.DEFAULT_IV` is + used to determine the default time variable. For both input types, `loadrxnetwork` returns a `ParsedReactionNetwork`, `prn`, with only the field, `prn.rn`, filled in. `prn.rn` corresponds to the generated diff --git a/docs/make.jl b/docs/make.jl index 592c907..3ad5ead 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -24,8 +24,15 @@ makedocs(sitename = "ReactionNetworkImporters.jl", prettyurls = (get(ENV, "CI", nothing) == "true"), canonical = "https://docs.sciml.ai/ReactionNetworkImporters/stable/"), modules = [ReactionNetworkImporters], - doctest = false, - clean = true, + clean = true, doctest = false, linkcheck = true, + strict = [ + :doctest, + :linkcheck, + :parse_error, + :example_block, + # Other available options are + # :autodocs_block, :cross_references, :docs_block, :eval_block, :example_block, :footnote, :meta_block, :missing_docs, :setup_block + ], pages = pages) deploydocs(repo = "github.com/SciML/ReactionNetworkImporters.jl.git"; diff --git a/docs/src/index.md b/docs/src/index.md index 4788ba3..cd36ea2 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -3,12 +3,13 @@ This package provides importers to load reaction networks into [Catalyst.jl](https://docs.sciml.ai/Catalyst/stable/) [`ReactionSystem`s](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#ModelingToolkit.ReactionSystem) -from several file formats. Currently it supports loading networks in the +from several file formats. Currently, it supports loading networks in the following formats: -1. A *subset* of the BioNetGen .net file format. -2. Networks represented by dense or sparse substrate and product stoichiometric - matrices. -3. Networks represented by dense or sparse complex stoichiometric and incidence matrices. + + 1. A *subset* of the BioNetGen .net file format. + 2. Networks represented by dense or sparse substrate and product stoichiometric + matrices. + 3. Networks represented by dense or sparse complex stoichiometric and incidence matrices. [SBMLToolkit.jl](https://docs.sciml.ai/SBMLToolkit/stable/) provides an alternative for loading SBML files into Catalyst models, offering a much broader @@ -17,48 +18,78 @@ such as constant species, boundary condition species, events, constraint equations and more. SBML files can be generated from many standard modeling tools, including BioNetGen, COPASI, and Virtual Cell. ----- +## Installation + +To install ReactionNetworkImporters.jl, use the Julia package manager: + +```julia +using Pkg +Pkg.add("ReactionNetworkImporters") +``` + +## Contributing + + - Please refer to the + [SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://github.com/SciML/ColPrac/blob/master/README.md) + for guidance on PRs, issues, and other matters relating to contributing to SciML. + + - See the [SciML Style Guide](https://github.com/SciML/SciMLStyle) for common coding practices and other style decisions. + - There are a few community forums: + + + The #diffeq-bridged and #sciml-bridged channels in the + [Julia Slack](https://julialang.org/slack/) + + The #diffeq-bridged and #sciml-bridged channels in the + [Julia Zulip](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged) + + On the [Julia Discourse forums](https://discourse.julialang.org) + + See also [SciML Community page](https://sciml.ai/community/) + ## Examples ### Loading a BioNetGen .net file -A simple network from the builtin BioNetGen bngl examples is the + +A simple network from the built-in BioNetGen bngl examples is the [repressilator](https://github.com/SciML/ReactionNetworkImporters.jl/blob/65f5f23bc52a7eefe32ca2ccabef0298e8e5772d/data/repressilator/Repressilator.bngl). The `generate_network` command in the bngl file outputs a reduced network description, i.e. a [.net](https://github.com/SciML/ReactionNetworkImporters.jl/blob/65f5f23bc52a7eefe32ca2ccabef0298e8e5772d/data/repressilator/Repressilator.net) file, which can be loaded into a Catalyst `ReactionSystem` as: + ```julia using ReactionNetworkImporters fname = "PATH/TO/Repressilator.net" prnbng = loadrxnetwork(BNGNetwork(), fname) ``` + Here `BNGNetwork` is a type specifying the file format that is being loaded. `prnbng` is a `ParsedReactionNetwork` structure with the following fields: -- `rn`, a Catalyst `ReactionSystem` -- `u₀`, a `Dict` mapping initial condition symbolic variables to numeric values - and/or symbolic expressions. -- `p`, a `Dict` mapping parameter symbolic variables to numeric values and/or - symbolic expressions. -- `varstonames`, a `Dict` mapping the internal symbolic variable of a species - used in the generated `ReactionSystem` to a `String` generated from the name - in the .net file. This is necessary as BioNetGen can generate exceptionally - long species names, involving characters that lead to malformed species names - when used with `Catalyst`. -- `groupstosyms`, a `Dict` mapping the `String`s representing names for any - groups defined in the BioNetGen file to the corresponding symbolic variable - representing the `ModelingToolkit` symbolic observable associated with the - group. + + - `rn`, a Catalyst `ReactionSystem` + - `u₀`, a `Dict` mapping initial condition symbolic variables to numeric values + and/or symbolic expressions. + - `p`, a `Dict` mapping parameter symbolic variables to numeric values and/or + symbolic expressions. + - `varstonames`, a `Dict` mapping the internal symbolic variable of a species + used in the generated `ReactionSystem` to a `String` generated from the name + in the .net file. This is necessary as BioNetGen can generate exceptionally + long species names, involving characters that lead to malformed species names + when used with `Catalyst`. + - `groupstosyms`, a `Dict` mapping the `String`s representing names for any + groups defined in the BioNetGen file to the corresponding symbolic variable + representing the `ModelingToolkit` symbolic observable associated with the + group. Given `prnbng`, we can construct and solve the corresponding ODE model for the reaction system by + ```julia using OrdinaryDiffEq, Catalyst rn = prnbng.rn tf = 100000.0 -oprob = ODEProblem(rn, Float64[], (0.,tf), Float64[]) -sol = solve(oprob, Tsit5(), saveat=tf/1000.) +oprob = ODEProblem(rn, Float64[], (0.0, tf), Float64[]) +sol = solve(oprob, Tsit5(), saveat = tf / 1000.0) ``` -Note that we specify empty parameter and initial condition vectors as these are + +Note that we specify empty parameter and initial condition vectors, as these are already stored in the generated `ReactionSystem`, `rn`. A `Dict` mapping each symbolic species and parameter to its initial value or symbolic expression can be obtained using `ModelingToolkit.defaults(rn)`. @@ -67,13 +98,16 @@ See the [Catalyst documentation](https://docs.sciml.ai/Catalyst/stable/) for how generate ODE, SDE, jump and other types of models. ### Loading a matrix representation + Catalyst `ReactionSystem`s can also be constructed from -- substrate and product stoichiometric matrices. -- complex stoichiometric and incidence matrices. + + - substrate and product stoichiometric matrices. + - complex stoichiometric and incidence matrices. For example, here we both directly build a Catalyst network using the `@reaction_network` macro, and then show how to build the same network from these matrices using `ReactionNetworkImporters`: + ```julia # Catalyst network from the macro: rs = @reaction_network begin @@ -87,33 +121,33 @@ end k1 k2 k3 k4 k5 # network from basic stoichiometry using ReactionNetworkImporters @parameters k1 k2 k3 k4 k5 @variables t A(t) B(t) C(t) -species = [A,B,C] -pars = [k1,k2,k3,k4,k5] -substoich =[ 2 0 1 0 0; - 0 1 1 0 0; - 0 0 0 1 3] -prodstoich = [0 2 0 1 3; - 1 0 0 1 0; - 0 0 1 0 0] -mn= MatrixNetwork(pars, substoich, prodstoich; species=species, - params=pars) # a matrix network +species = [A, B, C] +pars = [k1, k2, k3, k4, k5] +substoich = [2 0 1 0 0; + 0 1 1 0 0; + 0 0 0 1 3] +prodstoich = [0 2 0 1 3; + 1 0 0 1 0; + 0 0 1 0 0] +mn = MatrixNetwork(pars, substoich, prodstoich; species = species, + params = pars) # a matrix network prn = loadrxnetwork(mn) # dense version # test the two networks are the same @assert rs == prn.rn # network from reaction complex stoichiometry -stoichmat =[2 0 1 0 0 3; - 0 1 1 0 0 0; - 0 0 0 1 3 0] -incidencemat = [-1 1 0 0 0; - 1 -1 0 0 0; - 0 0 -1 1 0; - 0 0 1 -1 0; - 0 0 0 0 -1; - 0 0 0 0 1] -cmn= ComplexMatrixNetwork(pars, stoichmat, incidencemat; species=species, - params=pars) # a complex matrix network +stoichmat = [2 0 1 0 0 3; + 0 1 1 0 0 0; + 0 0 0 1 3 0] +incidencemat = [-1 1 0 0 0; + 1 -1 0 0 0; + 0 0 -1 1 0; + 0 0 1 -1 0; + 0 0 0 0 -1; + 0 0 0 0 1] +cmn = ComplexMatrixNetwork(pars, stoichmat, incidencemat; species = species, + params = pars) # a complex matrix network prn = loadrxnetwork(cmn) # test the two networks are the same @@ -121,50 +155,58 @@ prn = loadrxnetwork(cmn) ``` The basic usages are + ```julia -mn = MatrixNetwork(rateexprs, substoich, prodstoich; species=Any[], - params=Any[], t=nothing) +mn = MatrixNetwork(rateexprs, substoich, prodstoich; species = Any[], + params = Any[], t = nothing) prn = loadrxnetwork(mn::MatrixNetwork) -cmn = ComplexMatrixNetwork(rateexprs, stoichmat, incidencemat; species=Any[], - params=Any[], t=nothing) +cmn = ComplexMatrixNetwork(rateexprs, stoichmat, incidencemat; species = Any[], + params = Any[], t = nothing) prn = loadrxnetwork(cmn::ComplexMatrixNetwork) ``` + Here `MatrixNetwork` and `ComplexMatrixNetwork` are the types, which select that we are constructing a substrate/product stoichiometric matrix-based or a reaction complex matrix-based stoichiometric representation as input. See the [Catalyst.jl API](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/) for more discussion on these matrix representations, and how Catalyst handles symbolic reaction rate expressions. These two types have the following fields: -- `rateexprs`, any valid - [Symbolics.jl](https://docs.sciml.ai/Symbolics/stable/) expression for - the rates, or any basic number type. This can be a hardcoded rate constant - like `1.0`, a parameter like `k1` above, or an general Symbolics expression - involving parameters and species like `k*A`. -- matrix inputs - - For `MatrixNetwork` - - `substoich`, a number of species by number of reactions matrix with entry - `(i,j)` giving the stoichiometric coefficient of species `i` as a - substrate in reaction `j`. - - `prodstoich`, a number of species by number of reactions matrix with entry - `(i,j)` giving the stoichiometric coefficient of species `i` as a product - in reaction `j`. - - For `ComplexMatrixNetwork` - - `stoichmat`, the complex stoichiometry matrix [defined - here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.complexstoichmat). - - `incidencemat`, the complex incidence matrix [defined - here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.reactioncomplexes). -- `species`, an optional vector of symbolic variables representing each species - in the network. Can be constructed using the Symbolics.jl `@variables` macro. - Each species should be dependent on the same time variable (`t` in the example - above). -- `parameters`, a vector of symbolic variables representing each parameter in - the network. Can be constructed with the - [ModelingToolkit.jl](https://docs.sciml.ai/ModelingToolkit/stable/) - `@parameters` macro. If no parameters are used it is an optional keyword. -- `t`, an optional Symbolics.jl variable representing time as the independent - variable of the reaction network. If not provided `Catalyst.DEFAULT_IV` is - used to determine the default time variable. + + - `rateexprs`, any valid + [Symbolics.jl](https://docs.sciml.ai/Symbolics/stable/) expression for + the rates, or any basic number type. This can be a hard-coded rate constant + like `1.0`, a parameter like `k1` above, or a general Symbolics expression + involving parameters and species like `k*A`. + + - matrix inputs + + + For `MatrixNetwork` + + * `substoich`, a number of species by number of reactions matrix, with entry + `(i,j)` giving the stoichiometric coefficient of species `i` as a + substrate in reaction `j`. + * `prodstoich`, a number of species by number of reactions matrix, with entry + `(i,j)` giving the stoichiometric coefficient of species `i` as a product + in reaction `j`. + + + For `ComplexMatrixNetwork` + + * `stoichmat`, the complex stoichiometry matrix [defined + here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.complexstoichmat). + * `incidencemat`, the complex incidence matrix [defined + here](https://docs.sciml.ai/Catalyst/stable/api/catalyst_api/#Catalyst.reactioncomplexes). + - `species`, an optional vector of symbolic variables representing each species + in the network. Can be constructed using the Symbolics.jl `@variables` macro. + Each species should be dependent on the same time variable (`t` in the example + above). + - `parameters`, a vector of symbolic variables representing each parameter in + the network. Can be constructed with the + [ModelingToolkit.jl](https://docs.sciml.ai/ModelingToolkit/stable/) + `@parameters` macro. If no parameters are used, it is an optional keyword. + - `t`, an optional Symbolics.jl variable representing time as the independent + variable of the reaction network. If not provided `Catalyst.DEFAULT_IV` is + used to determine the default time variable. For both input types, `loadrxnetwork` returns a `ParsedReactionNetwork`, `prn`, with only the field, `prn.rn`, filled in. `prn.rn` corresponds to the generated @@ -184,56 +226,72 @@ species. `params` defaults to an empty vector, so that it does not need to be set for systems with no parameters. ## Reproducibility + ```@raw html
The documentation of this SciML package was built using these direct dependencies, ``` + ```@example using Pkg # hide Pkg.status() # hide ``` + ```@raw html
``` + ```@raw html
and using this machine and Julia version. ``` + ```@example using InteractiveUtils # hide versioninfo() # hide ``` + ```@raw html
``` + ```@raw html
A more complete overview of all dependencies and their versions is also provided. ``` + ```@example using Pkg # hide -Pkg.status(;mode = PKGMODE_MANIFEST) # hide +Pkg.status(; mode = PKGMODE_MANIFEST) # hide ``` + ```@raw html
``` + ```@raw html You can also download the manifest file and the project file. -``` \ No newline at end of file +``` diff --git a/src/parsing_routines_matrixnetworks.jl b/src/parsing_routines_matrixnetworks.jl index 82f5e3f..f99520e 100644 --- a/src/parsing_routines_matrixnetworks.jl +++ b/src/parsing_routines_matrixnetworks.jl @@ -133,15 +133,16 @@ Given complex stoichiometric matrix ,incidence matrix ,rate-expressions and list , return a ReactionSystem that describes the chemical reaction network Notes: -- The column of complex stoichiometric represents composition of reaction complexes, - with positive entries of size num_of_species by num_of_complexes, where - the non-zero positive entries in the k'th column denote stoichiometric - coefficients of the species participating in the k'th reaction complex. - -- The complex incidence matrix, is number of complexes by number of reactions with - Bᵢⱼ = -1, if the i'th complex is the substrate of the j'th reaction, - 1, if the i'th complex is the product of the j'th reaction, - 0, otherwise + + - The column of complex stoichiometric represents composition of reaction complexes, + with positive entries of size num_of_species by num_of_complexes, where + the non-zero positive entries in the k'th column denote stoichiometric + coefficients of the species participating in the k'th reaction complex. + + - The complex incidence matrix, is number of complexes by number of reactions with + Bᵢⱼ = -1, if the i'th complex is the substrate of the j'th reaction, + 1, if the i'th complex is the product of the j'th reaction, + 0, otherwise """ struct ComplexMatrixNetwork{S, T, U, V, W, X} <: NetworkFileFormat """The symbolic expressions for each reaction rate."""