API
SBMLImporter.load_SBML
— Functionload_SBML(path_SBML::AbstractString;
ifelse_to_callback::Bool=true,
inline_assignment_rules::Bool=false,
write_to_file::Bool=false,
model_as_string::Bool=false)
Parse an SBML model into a ParsedReactionNetwork
and convert SBML events/piecewise to callbacks.
For information on simulating the ParsedReactionNetwork
, as a JumpProblem
, a SDEProblem
, or an ODEProblem
see the documentation.
path_SBML
can be the model as a string if model_as_string=true
.
Arguments
path_SBML
: File path to a valid SBML file (level 2 or higher).ifelse_to_callback=true
: Whether to rewriteifelse
(piecewise) expressions to callbacks; recommended for performance.inline_assignment_rules=true
: Whether to inline assignment rules into model equations. Recommended for model import speed, however, it will not be possible to access the rule-variable via sol[:var].write_to_file=false
: Whether to write the parsed SBML model to a Julia file in the same directory as the SBML file.model_as_string=false
: Whether or not the model (path_SBML
) is provided as a string.
Returns
parsed_rn
: AParsedReactionNetwork
struct that can be converted into aJumpProblem
, aSDEProblem
, or anODEProblem
cbset
: Callbackset (events, piecewise etc...) for the model.
Examples
# Import and simulate model as a JumpProblem
using SBMLImporter, JumpProcesses
prnbng, cb = load_SBML(path_SBML)
tspan = (0.0, 10.0)
dprob = DiscreteProblem(prnbng.rn, prnbng.u₀, tspan, prnbng.p)
jprob = JumpProblem(prnbng.rn, dprob, Direct())
sol = solve(jprob, SSAStepper(), callback=cb)
# Import and simulate model as a SDE
using SBMLImporter, StochasticDiffEq
prnbng, cb = load_SBML(path_SBML)
tspan = (0.0, 10.0)
sprob = SDEProblem(prnbng.rn, prnbng.u₀, tspan, prnbng.p)
sol = solve(sprob, LambaEM(), callback=cb)
# Import and simulate model as an ODE
using SBMLImporter, ModelingToolkit, OrdinaryDiffEq
prnbng, cb = load_SBML(path_SBML)
sys = convert(ODESystem, prnbng.rn)
oprob = ODEProblem(sys, prnbng.u₀, tspan, prnbng.p, jac=true)
sol = solve(oprob, Rodas5P(), callback=cb)