All Projects → SciML → ReactionNetworkImporters.jl

SciML / ReactionNetworkImporters.jl

Licence: MIT license
Julia Catalyst.jl importers for various reaction network file formats like BioNetGen and stoichiometry matrices

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to ReactionNetworkImporters.jl

SBMLToolkit.jl
SBML differential equation and chemical reaction model (Gillespie simulations) for Julia's SciML ModelingToolkit
Stars: ✭ 25 (+19.05%)
Mutual labels:  differential-equations, gillespie-algorithm
Kinetic.jl
Universal modeling and simulation of fluid dynamics upon machine learning
Stars: ✭ 82 (+290.48%)
Mutual labels:  differential-equations
MultiScaleArrays.jl
A framework for developing multi-scale arrays for use in scientific machine learning (SciML) simulations
Stars: ✭ 63 (+200%)
Mutual labels:  differential-equations
Sundials.jl
Julia interface to Sundials, including a nonlinear solver (KINSOL), ODE's (CVODE and ARKODE), and DAE's (IDA) in a SciML scientific machine learning enabled manner
Stars: ✭ 167 (+695.24%)
Mutual labels:  differential-equations
DiffEqUncertainty.jl
Fast uncertainty quantification for scientific machine learning (SciML) and differential equations
Stars: ✭ 61 (+190.48%)
Mutual labels:  differential-equations
odex-js
Bulirsch-Stoer integration of systems of ordinary differential equations in JavaScript
Stars: ✭ 52 (+147.62%)
Mutual labels:  differential-equations
oasis-grow
Data collection, equipment control, and imaging engine for environmental IoT applications. Runs on RPi/ARM and interfaces with Arduino/ATmega minions over serial.
Stars: ✭ 53 (+152.38%)
Mutual labels:  biology
BioBlender21
Blender plugin to process biological data and molecular work.
Stars: ✭ 65 (+209.52%)
Mutual labels:  biology
DiffEqCallbacks.jl
A library of useful callbacks for hybrid scientific machine learning (SciML) with augmented differential equation solvers
Stars: ✭ 43 (+104.76%)
Mutual labels:  differential-equations
CellMLToolkit.jl
CellMLToolkit.jl is a Julia library that connects CellML models to the Scientific Julia ecosystem.
Stars: ✭ 50 (+138.1%)
Mutual labels:  differential-equations
diffeqr
Solving differential equations in R using DifferentialEquations.jl and the SciML Scientific Machine Learning ecosystem
Stars: ✭ 118 (+461.9%)
Mutual labels:  differential-equations
dae-cpp
A simple but powerful C++ DAE (Differential Algebraic Equation) solver
Stars: ✭ 33 (+57.14%)
Mutual labels:  differential-equations
numerical-methods-python
Numerical methods implementation in Python.
Stars: ✭ 65 (+209.52%)
Mutual labels:  differential-equations
PETLION.jl
High-performance simulations of the Porous Electrode Theory for Li-ion batteries
Stars: ✭ 41 (+95.24%)
Mutual labels:  differential-equations
BoundaryValueDiffEq.jl
Boundary value problem (BVP) solvers for scientific machine learning (SciML)
Stars: ✭ 23 (+9.52%)
Mutual labels:  differential-equations
FLINT
Fortran Library for numerical INTegration of differential equations
Stars: ✭ 37 (+76.19%)
Mutual labels:  differential-equations
heyoka.py
Python library for ODE integration via Taylor's method and LLVM
Stars: ✭ 45 (+114.29%)
Mutual labels:  differential-equations
Schrodingers-Equation-Solution-by-Neural-Network-NN-
Artifitial Neural Networks for Solving Ordinary and Partial Differential Equations, in this case, Schrodinger's Equation for One Particle in a 1-Dimentional Box
Stars: ✭ 18 (-14.29%)
Mutual labels:  differential-equations
HelicopterSciML.jl
Helicopter Scientific Machine Learning (SciML) Challenge Problem
Stars: ✭ 35 (+66.67%)
Mutual labels:  differential-equations
muscle
Multiple sequence alignment with top benchmark scores scalable to thousands of sequences. Generates replicate alignments, enabling assessment of downstream analyses such as trees and predicted structures.
Stars: ✭ 82 (+290.48%)
Mutual labels:  biology

ReactionNetworkImporters.jl

Join the chat at https://julialang.zulipchat.com #sciml-bridged Global Docs

codecov Build Status

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages SciML Code Style

This package provides importers to load reaction networks into Catalyst.jl ReactionSystems 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.

SBMLToolkit.jl provides an alternative for loading SBML files into Catalyst models, offering a much broader set of supported features. It allows the import of models that include features 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.

For information on using the package, see the stable documentation. Use the in-development documentation for the version of 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. The generate_network command in the bngl file outputs a reduced network description, i.e. a .net file, which can be loaded into a Catalyst ReactionSystem as:

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 Strings 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

using OrdinaryDiffEq, Catalyst
rn = prnbng.rn
tf = 100000.0
oprob = ODEProblem(rn, Float64[], (0.,tf), Float64[])
sol = solve(oprob, Tsit5(), saveat=tf/1000.)

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).

See the Catalyst documentation for how to generate ODE, SDE, jump and other types of models.

Loading a matrix representation

Catalyst ReactionSystems can also be constructed from

  • 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:

# Catalyst network from the macro:
rs = @reaction_network begin
    k1, 2A --> B
    k2, B --> 2A
    k3, A + B --> C
    k4, C --> A + B
    k5, 3C --> 3A
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
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
prn = loadrxnetwork(cmn)

# test the two networks are the same
@assert rs == prn.rn

The basic usages are

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)
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 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 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
  • 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 @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 Catalyst.jl ReactionSystem that represents the network.

Dispatches are added if substoich and prodstoich both have the type SparseMatrixCSCin case of MatrixNetwork (or stoichmat and incidencemat both have the type SparseMatrixCSC in case of ComplexMatrixNetwork), in which case they are efficiently iterated through using the SparseArrays interface.

If the keyword argument species is not set, the resulting reaction network will simply name the species S1, S2,..., SN for a system with N total species. params defaults to an empty vector, so that it does not need to be set for systems with no parameters.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].