Tutorial
This overarching tutorial of SBMLImporter covers how to import an SBML model into a JumpProblem for Gillespie simulations, a SDEProblem for chemical Langevin simulations, or an ODEProblem for deterministic simulations. It also covers how to change parameter and/or initial values for an imported model.
Input - a valid SBML model file
SBMLImporter only requires one input: a valid SBML file. SBML files can be created from various sources, such as the graphical interface of COPASI, by converting rule-based BioNetGen models, or by using any other SBML exporting tools. Additionally, a large collection of published SBML models are hosted on BioModels.
In this tutorial, we will use the Brusselator model, whose SBML file can be downloaded from here.
Importing a model
To import an SBML model use load_SBML:
using SBMLImporter
prn, cb = load_SBML(path; massaction=true)Here, massaction=true informs the importer that the model follows chemical mass action kinetics. This is required for efficient jump (Gillespie type) simulations. Additional keyword arguments can be found in the API documentation.
load_SBML returns two outputs: a ParsedReactionSystem (prn) and a CallbackSet (cb). The CallbackSet holds any SBML events, as well as any piecewise functions parsed into events. The ParsedReactionSystem includes a Catalyst ReactionSystem (prn.rn), a map for the initial values of each species (prn.u0), and a map for setting the model parameter values (prn.p). Many modeling tasks can be performed with a Catalyst ReactionSystem, for example, the system reactions can be inspected by:
using Catalyst
reactions(prn.rn)\[ \begin{align*} \varnothing &\xrightleftharpoons[C]{A C} \mathrm{X} \\ \mathrm{Y} + 2 \mathrm{X} &\xrightarrow{2 C} 3 \mathrm{X} \\ \mathrm{X} &\xrightarrow{B C} \mathrm{Y} \end{align*} \]
The massaction keyword argument is only relevant for jump simulations. If you import the model as a SDEProblem or an ODEProblem, you can (and should) ignore this keyword argument.
Jump simulations
To perform jump simulations (e.g. using Gillespie's algorithm), convert the reaction system (prn.rn) into a JumpProblem (which requires first creating an intermediary DiscreteProblem).
using JumpProcesses
tspan = (0.0, 10.0)
dprob = DiscreteProblem(prn.rn, prn.u0, tspan, prn.p)
jprob = JumpProblem(prn.rn, dprob, Direct())The JumpProblem can be simulated with any solver from the JumpProcesses.jl package, such as the SSAStepper:
using Plots
sol = solve(jprob, SSAStepper(), callback=cb)
plot(sol; xlabel = "Time [s]", ylabel = "Protein amount")For more information on jump simulations, see JumpProcesses.jl's documentation. A guide to choosing a simulation algorithm can be found here.
SDE simulations
To perform chemical Langevin SDE simulations, convert the reaction-system prn.rn into a SDEProblem.
using StochasticDiffEq
tspan = (0.0, 10.0)
sprob = SDEProblem(prn.rn, prn.u0, tspan, prn.p)Precompiling packages...
2535.4 ms ? LinearSolve → LinearSolveSparseArraysExt
1817.1 ms ? NonlinearSolveQuasiNewton
763.2 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
2821.7 ms ? NonlinearSolveFirstOrder
2927.7 ms ? OrdinaryDiffEqDifferentiation
574.1 ms ? NonlinearSolve
2098.1 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
826.7 ms ? OrdinaryDiffEqNonlinearSolve
Info Given StochasticDiffEq was explicitly requested, output will be shown live
┌ Warning: Module NonlinearSolve with build ID ffffffff-ffff-ffff-174b-2770ddeebc58 is missing from the cache.
│ This may mean NonlinearSolve [8913a72c-1f9b-4ce2-8d82-65094dcecaec] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
2250.6 ms ? StochasticDiffEq
┌ Warning: Module NonlinearSolve with build ID ffffffff-ffff-ffff-174b-2770ddeebc58 is missing from the cache.
│ This may mean NonlinearSolve [8913a72c-1f9b-4ce2-8d82-65094dcecaec] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2459.3 ms ? LinearSolve → LinearSolveSparseArraysExt
1843.9 ms ? OrdinaryDiffEqDifferentiation
2883.2 ms ? NonlinearSolveQuasiNewton
2886.5 ms ? NonlinearSolveFirstOrder
773.2 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
2153.8 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
567.7 ms ? NonlinearSolve
Info Given OrdinaryDiffEqNonlinearSolve was explicitly requested, output will be shown live
┌ Warning: Module NonlinearSolve with build ID ffffffff-ffff-ffff-174b-2770ddeebc58 is missing from the cache.
│ This may mean NonlinearSolve [8913a72c-1f9b-4ce2-8d82-65094dcecaec] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
832.2 ms ? OrdinaryDiffEqNonlinearSolve
┌ Warning: Module NonlinearSolve with build ID ffffffff-ffff-ffff-174b-2770ddeebc58 is missing from the cache.
│ This may mean NonlinearSolve [8913a72c-1f9b-4ce2-8d82-65094dcecaec] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2459.0 ms ? LinearSolve → LinearSolveSparseArraysExt
Info Given OrdinaryDiffEqDifferentiation was explicitly requested, output will be shown live
┌ Warning: Module LinearSolveSparseArraysExt with build ID ffffffff-ffff-ffff-ce81-ff2eeeceb35a is missing from the cache.
│ This may mean LinearSolveSparseArraysExt [acf9803d-64eb-5f69-b965-a71e3e6e1ed4] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1832.5 ms ? OrdinaryDiffEqDifferentiation
2125.8 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
┌ Warning: Module LinearSolveSparseArraysExt with build ID ffffffff-ffff-ffff-ce81-ff2eeeceb35a is missing from the cache.
│ This may mean LinearSolveSparseArraysExt [acf9803d-64eb-5f69-b965-a71e3e6e1ed4] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2448.2 ms ? LinearSolve → LinearSolveSparseArraysExt
1858.5 ms ? OrdinaryDiffEqDifferentiation
Info Given OrdinaryDiffEqDifferentiationSparseArraysExt was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
265.0 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638The SDEProblem can be simulated with any solver from the StochasticDiffEq.jl package, such as the LambaEM solver:
sol = solve(sprob, LambaEM(), callback=cb)
plot(sol; xlabel = "Time [s]", ylabel = "Protein amount")For more information on SDE simulations, see StochasticDiffEq.jl's documentation.
ODE simulations
To perform ODE simulations, first convert the reaction system (prn.rn) into an ODESystem.
using ModelingToolkit
sys = structural_simplify(convert(ODESystem, prn.rn))Here we call structural_simplify to inline any potential assignment rules into the model equations. Given an ODESystem, a good sanity check is to inspect the generated ODEs:
equations(sys)\[ \begin{align} \frac{\mathrm{d} X\left( t \right)}{\mathrm{d}t} &= A C - C X\left( t \right) - B C X\left( t \right) + \left( X\left( t \right) \right)^{2} C Y\left( t \right) \\ \frac{\mathrm{d} Y\left( t \right)}{\mathrm{d}t} &= B C X\left( t \right) - \left( X\left( t \right) \right)^{2} C Y\left( t \right) \end{align} \]
Once we have an ODESystem, we can build an ODEProblem:
using OrdinaryDiffEq
tspan = (0.0, 10.0)
oprob = ODEProblem(sys, prn.u0, tspan, prn.p, jac=true)Precompiling packages...
2546.2 ms ? LinearSolve → LinearSolveSparseArraysExt
1917.7 ms ? OrdinaryDiffEqDifferentiation
244.6 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
3099.5 ms ? NonlinearSolveQuasiNewton
3177.4 ms ? NonlinearSolveFirstOrder
1124.7 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
821.1 ms ? NonlinearSolve
2940.0 ms ? OrdinaryDiffEqExponentialRK
3231.3 ms ? OrdinaryDiffEqExtrapolation
3279.2 ms ? OrdinaryDiffEqRosenbrock
950.8 ms ? OrdinaryDiffEqNonlinearSolve
1889.8 ms ? OrdinaryDiffEqStabilizedIRK
2000.0 ms ? OrdinaryDiffEqIMEXMultistep
2065.1 ms ? OrdinaryDiffEqSDIRK
2244.3 ms ? OrdinaryDiffEqPDIRK
2969.2 ms ? OrdinaryDiffEqFIRK
1829.5 ms ? OrdinaryDiffEqBDF
2866.2 ms ? OrdinaryDiffEqDefault
Info Given OrdinaryDiffEq was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1081.0 ms ? OrdinaryDiffEq
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2551.1 ms ? LinearSolve → LinearSolveSparseArraysExt
1944.3 ms ? OrdinaryDiffEqDifferentiation
262.7 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
Info Given OrdinaryDiffEqExtrapolation was explicitly requested, output will be shown live
┌ Warning: Module LinearSolveSparseArraysExt with build ID ffffffff-ffff-ffff-ce81-ff2eeeceb35a is missing from the cache.
│ This may mean LinearSolveSparseArraysExt [acf9803d-64eb-5f69-b965-a71e3e6e1ed4] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1917.7 ms ? OrdinaryDiffEqExtrapolation
┌ Warning: Module LinearSolveSparseArraysExt with build ID ffffffff-ffff-ffff-ce81-ff2eeeceb35a is missing from the cache.
│ This may mean LinearSolveSparseArraysExt [acf9803d-64eb-5f69-b965-a71e3e6e1ed4] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2562.3 ms ? LinearSolve → LinearSolveSparseArraysExt
1915.3 ms ? OrdinaryDiffEqDifferentiation
245.4 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
2638.0 ms ? NonlinearSolveQuasiNewton
2673.6 ms ? NonlinearSolveFirstOrder
773.7 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
564.6 ms ? NonlinearSolve
846.0 ms ? OrdinaryDiffEqNonlinearSolve
Info Given OrdinaryDiffEqStabilizedIRK was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1037.5 ms ? OrdinaryDiffEqStabilizedIRK
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2483.2 ms ? LinearSolve → LinearSolveSparseArraysExt
1920.4 ms ? OrdinaryDiffEqDifferentiation
247.5 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
2647.7 ms ? NonlinearSolveQuasiNewton
2663.0 ms ? NonlinearSolveFirstOrder
824.2 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
575.6 ms ? NonlinearSolve
837.6 ms ? OrdinaryDiffEqNonlinearSolve
Info Given OrdinaryDiffEqSDIRK was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1002.9 ms ? OrdinaryDiffEqSDIRK
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2563.9 ms ? LinearSolve → LinearSolveSparseArraysExt
1935.0 ms ? OrdinaryDiffEqDifferentiation
252.1 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
2702.2 ms ? NonlinearSolveQuasiNewton
2702.7 ms ? NonlinearSolveFirstOrder
779.2 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
556.7 ms ? NonlinearSolve
830.3 ms ? OrdinaryDiffEqNonlinearSolve
1000.9 ms ? OrdinaryDiffEqSDIRK
Info Given OrdinaryDiffEqBDF was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqSDIRK with build ID ffffffff-ffff-ffff-c130-353e4a0b51b8 is missing from the cache.
│ This may mean OrdinaryDiffEqSDIRK [2d112036-d095-4a1e-ab9a-08536f3ecdbf] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1048.4 ms ? OrdinaryDiffEqBDF
┌ Warning: Module OrdinaryDiffEqSDIRK with build ID ffffffff-ffff-ffff-c130-353e4a0b51b8 is missing from the cache.
│ This may mean OrdinaryDiffEqSDIRK [2d112036-d095-4a1e-ab9a-08536f3ecdbf] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2512.4 ms ? LinearSolve → LinearSolveSparseArraysExt
1880.2 ms ? OrdinaryDiffEqDifferentiation
260.5 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
Info Given OrdinaryDiffEqRosenbrock was explicitly requested, output will be shown live
┌ Warning: Module LinearSolveSparseArraysExt with build ID ffffffff-ffff-ffff-ce81-ff2eeeceb35a is missing from the cache.
│ This may mean LinearSolveSparseArraysExt [acf9803d-64eb-5f69-b965-a71e3e6e1ed4] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1898.2 ms ? OrdinaryDiffEqRosenbrock
┌ Warning: Module LinearSolveSparseArraysExt with build ID ffffffff-ffff-ffff-ce81-ff2eeeceb35a is missing from the cache.
│ This may mean LinearSolveSparseArraysExt [acf9803d-64eb-5f69-b965-a71e3e6e1ed4] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2557.7 ms ? LinearSolve → LinearSolveSparseArraysExt
1827.1 ms ? NonlinearSolveFirstOrder
2548.2 ms ? NonlinearSolveQuasiNewton
2657.5 ms ? OrdinaryDiffEqDifferentiation
257.3 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
819.5 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
607.7 ms ? NonlinearSolve
888.2 ms ? OrdinaryDiffEqNonlinearSolve
1973.0 ms ? OrdinaryDiffEqRosenbrock
1014.5 ms ? OrdinaryDiffEqSDIRK
1037.9 ms ? OrdinaryDiffEqBDF
Info Given OrdinaryDiffEqDefault was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqRosenbrock with build ID ffffffff-ffff-ffff-c99d-9d3b59a5d0a0 is missing from the cache.
│ This may mean OrdinaryDiffEqRosenbrock [43230ef6-c299-4910-a778-202eb28ce4ce] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1083.6 ms ? OrdinaryDiffEqDefault
┌ Warning: Module OrdinaryDiffEqRosenbrock with build ID ffffffff-ffff-ffff-c99d-9d3b59a5d0a0 is missing from the cache.
│ This may mean OrdinaryDiffEqRosenbrock [43230ef6-c299-4910-a778-202eb28ce4ce] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2549.2 ms ? LinearSolve → LinearSolveSparseArraysExt
1845.1 ms ? NonlinearSolveFirstOrder
2529.3 ms ? NonlinearSolveQuasiNewton
2642.9 ms ? OrdinaryDiffEqDifferentiation
244.7 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
808.3 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
580.0 ms ? NonlinearSolve
831.2 ms ? OrdinaryDiffEqNonlinearSolve
Info Given OrdinaryDiffEqFIRK was explicitly requested, output will be shown live
┌ Warning: Module LinearSolveSparseArraysExt with build ID ffffffff-ffff-ffff-ce81-ff2eeeceb35a is missing from the cache.
│ This may mean LinearSolveSparseArraysExt [acf9803d-64eb-5f69-b965-a71e3e6e1ed4] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1873.2 ms ? OrdinaryDiffEqFIRK
┌ Warning: Module LinearSolveSparseArraysExt with build ID ffffffff-ffff-ffff-ce81-ff2eeeceb35a is missing from the cache.
│ This may mean LinearSolveSparseArraysExt [acf9803d-64eb-5f69-b965-a71e3e6e1ed4] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2425.7 ms ? LinearSolve → LinearSolveSparseArraysExt
1856.9 ms ? OrdinaryDiffEqDifferentiation
241.2 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
2626.1 ms ? NonlinearSolveFirstOrder
2629.9 ms ? NonlinearSolveQuasiNewton
809.9 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
574.1 ms ? NonlinearSolve
873.6 ms ? OrdinaryDiffEqNonlinearSolve
Info Given OrdinaryDiffEqPDIRK was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1237.2 ms ? OrdinaryDiffEqPDIRK
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2542.0 ms ? LinearSolve → LinearSolveSparseArraysExt
1932.8 ms ? OrdinaryDiffEqDifferentiation
249.5 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
2675.8 ms ? NonlinearSolveQuasiNewton
2690.6 ms ? NonlinearSolveFirstOrder
770.4 ms ? NonlinearSolveQuasiNewton → NonlinearSolveQuasiNewtonForwardDiffExt
565.4 ms ? NonlinearSolve
876.0 ms ? OrdinaryDiffEqNonlinearSolve
Info Given OrdinaryDiffEqIMEXMultistep was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1045.1 ms ? OrdinaryDiffEqIMEXMultistep
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
Precompiling packages...
2549.0 ms ? LinearSolve → LinearSolveSparseArraysExt
1884.2 ms ? OrdinaryDiffEqDifferentiation
274.8 ms ? OrdinaryDiffEqDifferentiation → OrdinaryDiffEqDifferentiationSparseArraysExt
Info Given OrdinaryDiffEqExponentialRK was explicitly requested, output will be shown live
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638
1652.5 ms ? OrdinaryDiffEqExponentialRK
┌ Warning: Module OrdinaryDiffEqDifferentiation with build ID ffffffff-ffff-ffff-8c8b-d967360a0e6c is missing from the cache.
│ This may mean OrdinaryDiffEqDifferentiation [4302a76b-040a-498a-8c04-15b101fed76b] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2638Setting jac=true means that the ODE Jacobian is computed symbolically, which often improves simulation performance. The ODEProblem can be simulated with any solver from the OrdinaryDiffEq.jl package, such as the Rodas5P solver:
sol = solve(oprob, Rodas5P(), callback=cb)
plot(sol; xlabel = "Time [s]", ylabel = "Protein amount")For more information on ODE simulations, see OrdinaryDiffEq.jl's documentation. A guide to choosing an ODE solver can be found here.
For large models with more than 1000 species, constructing the Jacobian for the ODEProblem can be time-consuming. Therefore, if model load time is a problem, setting jac = false can help.
Changing Parameter Values and/or Initial Values
One of the most common modeling operations is to modify model parameter values and/or initial values. Because SBMLImporter imports models as a Catalyst ReactionSystem that supports the SymbolicIndexingInterface, these modifications are straightforward to perform at the ODEProblem, SDEProblem, or JumpProblem level.
Parameter values can be modified using prob.ps[:param_id]. For example, for the Brusselator imported as an ODEProblem above, the value of parameter A can be changed with:
oprob.ps[:A] = 2.0Initial values can be modified with prob[:specie_id]. For example, to change the initial value of the species X to 2.0, do:
oprob[:X] = 2.0Next Steps
For additional modeling tasks that can be carried out with a Catalyst ReactionSystem (e.g., bifurcation analysis, parameter estimation, etc.), see the Catalyst documentation. If you encounter any problems with importing an SBML model, first consult the FAQ. Additional details on importer options can be found in the API.