API

ReactionNetworkImporters.BNGNetworkType
BNGNetwork()

File-format selector for BioNetGen .net reaction network files.

Arguments

None.

Keywords

None.

Fields

None.

Pass BNGNetwork() to loadrxnetwork to parse a BioNetGen .net file into a Catalyst ReactionSystem.

Examples

using ReactionNetworkImporters

BNGNetwork() isa ReactionNetworkImporters.NetworkFileFormat

# output
true
source
ReactionNetworkImporters.MatrixNetworkType
MatrixNetwork(rateexprs, substoich, prodstoich; species = Any[], params = Any[], t = nothing)

Input representation for constructing a Catalyst reaction network from substrate and product stoichiometry matrices.

Arguments

  • rateexprs::AbstractVector: One symbolic or numeric rate expression per reaction.
  • substoich::AbstractMatrix: Species-by-reaction substrate coefficients.
  • prodstoich::AbstractMatrix{Int}: Species-by-reaction product coefficients; it must have the same size as substoich.

Keywords

  • species::AbstractVector = Any[]: Symbolic species in row order. Empty uses generated species with the chosen independent variable.
  • params::AbstractVector = Any[]: Symbolic parameters referenced by rateexprs.
  • t = nothing: Independent variable. nothing uses Catalyst.default_t().

Fields

  • rateexprs: Rate expressions, one for each reaction column.
  • substoich: Substrate stoichiometry matrix.
  • prodstoich: Product stoichiometry matrix.
  • species: Symbolic species in matrix-row order.
  • params: Symbolic parameters available to rate expressions.
  • t: Independent variable or nothing.

Examples

using ReactionNetworkImporters

network = MatrixNetwork([1.0], reshape([1], 1, 1), reshape([0], 1, 1))
network isa MatrixNetwork

# output
true
source
ReactionNetworkImporters.ComplexMatrixNetworkType
ComplexMatrixNetwork(rateexprs, stoichmat, incidencemat; species = Any[], params = Any[], t = nothing)

Input representation for constructing a Catalyst reaction network from complex stoichiometry and complex-incidence matrices.

Arguments

  • rateexprs::AbstractVector: One symbolic or numeric rate expression per reaction.
  • stoichmat::AbstractMatrix: Species-by-complex nonnegative stoichiometric coefficients.
  • incidencemat::AbstractMatrix{Int}: Complex-by-reaction matrix whose entries are -1, 0, or 1.

Keywords

  • species::AbstractVector = Any[]: Symbolic species in row order. Empty uses generated species with the chosen independent variable.
  • params::AbstractVector = Any[]: Symbolic parameters referenced by rateexprs.
  • t = nothing: Independent variable. nothing uses Catalyst.default_t().

Fields

  • rateexprs: Rate expressions, one for each reaction column.
  • stoichmat: Species-by-complex stoichiometry matrix.
  • incidencemat: Complex-by-reaction incidence matrix.
  • species: Symbolic species in matrix-row order.
  • params: Symbolic parameters available to rate expressions.
  • t: Independent variable or nothing.

Examples

using ReactionNetworkImporters

network = ComplexMatrixNetwork([1.0], [1 0], reshape([-1, 1], 2, 1))
network isa ComplexMatrixNetwork

# output
true
source
ReactionNetworkImporters.loadrxnetworkFunction
loadrxnetwork(ft::BNGNetwork, rxfilename; name = gensym(:ReactionSystem), verbose = true, kwargs...)

Parse a BioNetGen .net file and construct a Catalyst ReactionSystem.

Arguments

  • ft::BNGNetwork: Selector for the BioNetGen .net format.
  • rxfilename::AbstractString: Path to the network file.

Keywords

  • name::Symbol = gensym(:ReactionSystem): Name assigned to the returned system.
  • verbose::Bool = true: Print parser progress when true.
  • kwargs...: Additional keywords forwarded to ReactionSystem.

Returns

  • ReactionSystem: Incomplete Catalyst system. Its metadata contains initial conditions, parameter values, BNG variable names, and BNG group observables.

Rules

  • Supports parameter expressions, fixed species, compartment-prefixed species, elementary and Sat rate laws, function blocks, and groups.
  • MM, Hill, and tfun() constructs are unsupported and throw an error.
  • Call complete on the returned system before constructing a SciML problem.

Examples

using ReactionNetworkImporters

format = BNGNetwork()
format isa ReactionNetworkImporters.NetworkFileFormat

# output
true
source
loadrxnetwork(mn::MatrixNetwork; name = gensym(:ReactionSystem))

Convert a MatrixNetwork into a Catalyst ReactionSystem.

Arguments

  • mn::MatrixNetwork: Input matrix representation satisfying MatrixNetwork's dimensionality rules.

Keywords

  • name::Symbol = gensym(:ReactionSystem): Name assigned to the resulting system.

Returns

  • ReactionSystem: An incomplete Catalyst system. Call complete before using it to construct a SciML problem.

Rules

  • substoich and prodstoich must be species-by-reaction matrices of equal size.
  • Each rate expression corresponds to one reaction column.
  • An empty species vector requests generated species symbols.

Examples

using ReactionNetworkImporters

network = MatrixNetwork([1.0], reshape([1], 1, 1), reshape([0], 1, 1))
system = loadrxnetwork(network; name = :decay)
nameof(system)

# output
:decay
source
loadrxnetwork(cmn::ComplexMatrixNetwork; name = gensym(:ReactionSystem))

Convert a ComplexMatrixNetwork into a Catalyst ReactionSystem.

Arguments

  • cmn::ComplexMatrixNetwork: Complex-matrix representation satisfying the documented stoichiometry and incidence rules.

Keywords

  • name::Symbol = gensym(:ReactionSystem): Name assigned to the resulting system.

Returns

  • ReactionSystem: An incomplete Catalyst system. Call complete before using it to construct a SciML problem.

Rules

  • stoichmat is species-by-complex and has nonnegative entries.
  • incidencemat is complex-by-reaction with entries in (-1, 0, 1).
  • Every reaction column needs one substrate complex (-1) and one product complex (1).

Examples

using ReactionNetworkImporters

network = ComplexMatrixNetwork([1.0], [1 0], reshape([-1, 1], 2, 1))
system = loadrxnetwork(network; name = :conversion)
nameof(system)

# output
:conversion
source
ReactionNetworkImporters.has_varstonamesFunction
has_varstonames(rs::ReactionSystem)

Return whether rs has a VarsToNames metadata entry.

Arguments

  • rs::ReactionSystem: System to inspect.

Returns

  • Bool: true when the mapping exists.
source
ReactionNetworkImporters.get_varstonamesFunction
get_varstonames(rs::ReactionSystem)

Return the VarsToNames mapping from rs, or nothing when it is absent.

Arguments

  • rs::ReactionSystem: System to inspect.

Returns

  • Dict or nothing: Mapping from system variables to BioNetGen names.
source
ReactionNetworkImporters.set_varstonamesFunction
set_varstonames(rs::ReactionSystem, m)

Return a new ReactionSystem with the VarsToNames metadata set to m.

Arguments

  • rs::ReactionSystem: System to update.
  • m: Mapping from system variables to BioNetGen names.

Returns

  • ReactionSystem: Copy of rs carrying m; rs is not mutated.
source
ReactionNetworkImporters.has_groupstosymsFunction
has_groupstosyms(rs::ReactionSystem)

Return whether rs has a GroupsToSyms metadata entry.

Arguments

  • rs::ReactionSystem: System to inspect.

Returns

  • Bool: true when the mapping exists.
source
ReactionNetworkImporters.get_groupstosymsFunction
get_groupstosyms(rs::ReactionSystem)

Return the GroupsToSyms mapping from rs, or nothing when it is absent.

Arguments

  • rs::ReactionSystem: System to inspect.

Returns

  • Dict or nothing: Mapping from BioNetGen group names to observables.
source
ReactionNetworkImporters.set_groupstosymsFunction
set_groupstosyms(rs::ReactionSystem, m)

Return a new ReactionSystem with the GroupsToSyms metadata set to m.

Arguments

  • rs::ReactionSystem: System to update.
  • m: Mapping from BioNetGen group names to observables.

Returns

  • ReactionSystem: Copy of rs carrying m; rs is not mutated.
source