SBML differential equation and chemical reaction model (Gillespie simulations) for Julia's SciML ModelingToolkit
Author SciML
31 Stars
Updated Last
5 Months Ago
Started In
June 2021


Join the chat at #sciml-bridged Global Docs

codecov Build Status

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

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 modelling, please have a look at COBREXA.jl.


To install SBMLToolkit.jl, use the Julia package manager:

using Pkg


SBML models can be simulated with the following steps (note that sol is in absolute quantities rather than concentrations):

using SBMLToolkit, ModelingToolkit, OrdinaryDiffEq

mdl = readSBML("my_model.xml", doc -> begin
                   set_level_and_version(3, 2)(doc)

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.

Development team

This package was developed by Paul F. Lang at the University of Oxford, UK and Anand Jain at the University of Chicago, USA.

Questions and comments

Please use GitHub issues, the #sciml-sysbio channel in the Julia Slack workspace or email Paul F. Lang or Anand Jain with any questions or comments.