SBMLToolkit.jl is a lightweight tool to import models specified in the Systems Biology Markup Language (SBML) into the Julia SciML ecosystem. There are multiple ways to specify the same model in SBML. Please help us improving SBMLToolkit.jl by creating a GitHub issue if you experience errors when converting your SBML model.
SBMLToolkit uses the SBML.jl wrapper of the libSBML library to lower dynamical SBML models into dynamical systems. If you would like to import BioNetGen models use the writeSBML()
export function or import the .net
file with ReactionNetworkImporters.jl. For constrained-based modeling, please have a look at COBREXA.jl.
To install SBMLToolkit.jl, use the Julia package manager:
using Pkg
Pkg.add("SBMLToolkit")
SBML models can be simulated with the following steps (note that sol
is in absolute quantities rather than concentrations):
using SBMLToolkit, ModelingToolkit, OrdinaryDiffEq
SBMLToolkit.checksupport_file("my_model.xml")
mdl = readSBML("my_model.xml", doc -> begin
set_level_and_version(3, 2)(doc)
convert_promotelocals_expandfuns(doc)
end)
rs = ReactionSystem(mdl) # If you want to create a reaction system
odesys = convert(ODESystem, rs) # Alternatively: ODESystem(mdl)
tspan = (0.0, 1.0)
prob = ODEProblem(odesys, [], tspan, [])
sol = solve(prob, Tsit5())
Alternatively, SBMLToolkit also provides more concise methods to import SBML.Models
, Catalyst.ReactionSystems
, and ModelingToolkit.ODESystems
.
mdl = readSBML(sbmlfile, DefaultImporter())
rs = readSBML(sbmlfile, ReactionSystemImporter())
odesys = readSBML(sbmlfile, ODESystemImporter())
The package is released under the MIT license.
This package was developed by Paul F. Lang at the University of Oxford, UK and Anand Jain at the University of Chicago, USA.
Please use GitHub issues, the #sciml-sysbio channel in the Julia Slack workspace or email Paul F. Lang with any questions or comments.