
sbml2cellml: conversion between SBML and CellML¶
sbml2cellml converts between SBML (Systems Biology Markup Language) and CellML 2.0, so that a model developed with one tooling can be used, simulated and shared in the other ecosystem.
Online converter¶
Convert a model in either direction here, without an installation: the converter runs as a WebAssembly module in this page, nothing is uploaded and no server sees the model. Simulate the CellML model integrates the CellML side of the conversion in the same page with libopencor and plots the states of the model, so a model is converted and run without leaving the browser.
Warnings of the conversion
Warnings of the conversion
Both sides of a conversion are simulated here: the CellML model with libopencor and the SBML model with sbmlsim-core, which compiles it into a WebAssembly module in the browser, with the solver settings of the python package. The two plots are the same trajectories when the conversion keeps the model, and the line below them is the largest difference between them. A CellML model which imports a component or units, an SBML model which uses a package such as comp, and the metadata of a conversion need the python package, which converts and simulates the models of the roundtrip example. The source code of the project is on GitHub.
Online simulator¶
Simulate a published model and its conversion next to each other, with one set of sliders for both: libopencor integrates the CellML model and sbmlsim-core the SBML model, which it compiles in the browser. A model of BioModels is an SBML model and is converted to CellML here, a model of the Physiome Model Repository is a CellML model and is converted to SBML, so the two plots are the two languages of the same model. Every model of the selection passes every stage of its check, see Models; the simulators are loaded when this section comes into view.
The simulators are loaded when this section comes into view.
The sliders set the first parameters of the model, the same values on both sides: libopencor changes the variable of the CellML model and sbmlsim-core the parameter of the SBML model which the conversion wrote it as. The plots show the states of the model, up to eight of them, and an item of the legend shows and hides its series in both plots. The line below them is the largest difference between the two simulations, which is the error of the conversion and of the two solvers together.
Features¶
- conversion of compartments, parameters, species, assignment and rate rules, reactions and events into a single CellML component
- conversion of the units: unit definitions, the units of numbers and, for a model with a complete unit annotation, the units of every variable
- names, notes, SBO terms, annotations and the model history as RDF next to the CellML model, restored in the conversion back to SBML
- conversion of CellML models to SBML: parameters with rules, unit definitions and units of numbers, resets as events, imports resolved, CellML 1.0 and 1.1 read in the permissive mode of libcellml, the components optionally as
compsubmodels (--hierarchical) - the online converter of the documentation, which converts a model in either direction in the browser with a WebAssembly module of the rust converters, without an upload, and simulates the CellML side of the conversion there with libopencor (Online converter)
- the online simulator of the documentation, which converts a published model of BioModels or of the Physiome Model Repository in the browser and simulates both sides of the conversion next to each other, with one set of sliders for both (Online simulator)
- the interactive simulation of the roundtrip example, which simulates the CellML model with libopencor and the SBML model with sbmlsim-core in the browser, with one set of sliders for both (Roundtrip example)
- conversion of a hierarchical SBML model: the
compsubmodels are flattened before the model becomes CellML - validation of the result with libcellml
- timecourse simulation of the SBML with sbmlsim-core and of the CellML with libopencor, both optional, see Simulation
- the
sbml2cellmlandcellml2sbmlcommand lines - the SBML test suite harness: every semantic case through both converters and both simulators, results on the SBML test suite page
- the same check for the manually curated models of BioModels, results on the BioModels page
- the same check for the CellML models of the Physiome Model Repository, from the CellML side, results on the Physiome page
- an overview of which models of the three checks work, on the Models page
- the wall time of the two simulators over the same models, on the Benchmarks page
Quickstart¶
from pathlib import Path
from sbml2cellml import convert_sbml2cellml
model = convert_sbml2cellml(Path("model.xml"), cellml_path=Path("model.cellml"))
or on the command line:
The conversion is validated with libcellml; the resulting file can be simulated with libopencor and compared with the sbmlsim-core simulation of the SBML model, see Simulation. The roundtrip example shows the complete pipeline for the repressilator: the scripts, the three models and their simulations side by side.
What is converted¶
The converter puts every SBML compartment, parameter and species as a variable into a single CellML component, together with the variable of integration time when the model has differential equations (rate rules or reactions).
| SBML | CellML |
|---|---|
| compartment | variable with the size as initial value |
| parameter | variable with the value as initial value |
| species | variable in amount (hasOnlySubstanceUnits) or concentration |
| species in concentration whose compartment changes in time | a second variable <species>_amount which the reactions change (the rate rule of the species when it has one and an event sets the size), and the equation species = amount / compartment: the amount is kept when the size changes, not the concentration |
| assignment rule | equation; its target has no initial value, the equation defines it from the start |
| rate rule | differential equation |
| reaction | variable of its rate with the kinetic law as equation; the rate times the stoichiometry is added to the differential equation of every reactant and product which is not a boundary species, divided by the size of the compartment for a species in concentration |
| conversion factor of a species or the model | factor of the reaction terms of the species |
| species reference with an id | variable of its stoichiometry, which rules may set |
<stoichiometryMath> of a species reference (level 1 and 2) |
variable __stoichiometry_<reaction>_<role>_<index> with the formula as its equation, the number itself when the formula is one |
| reaction id in a formula | the variable of the rate of the reaction |
| unit definition | units of the same name; the scale becomes the prefix, the multiplier m of a unit with the exponent e becomes m^e (CellML applies the exponent to the prefix only) |
unit kinds item and avogadro |
new base units item, dimensionless units avogadro with the multiplier 6.02214179e23; every other unit kind is a standard unit of CellML |
| units of a compartment, parameter or species | units of the variable when the unit annotation of the model is complete, else every variable is dimensionless, see Units |
| numbers in formulas | real numbers with their units, dimensionless when they have none |
| time and avogadro symbols | the variable of integration time (another name when an element of the model is called time), the number 6.02214179e23 |
id which is a symbol of the formula syntax of libsbml (avogadro, pi, NaN, true) |
variable of that name like every other id: the formulas are converted as the MathML trees of the model, never as text |
| rateOf symbol | the right-hand side of the differential equation of its variable, 0 without one |
| delay symbol | no counterpart: CellML has no delay and a delay differential equation is no ODE system, so such a model is refused instead of written, see Conversion issues |
| rule or kinetic law without math | ignored, it has no effect |
| initial assignment | evaluated to the initial value; without math it has no effect |
| infinite or NaN value | the equation x = INF (or -INF, NaN), not for a state |
| function definition | calls replaced by the body of the function |
| names, notes, SBO terms, annotations (CV terms) and the model history | RDF file next to the CellML file which points at the id of the elements, see Metadata; cellml2sbml reads it back |
| local parameter of a kinetic law | variable <reaction>_<parameter> (numeric suffix when taken) |
| event | resets: the variable <event>_trigger is piecewise(1, trigger, 0) and every assignment a reset which fires when it reaches 1; the delay, the priority and the flags of the event go into the metadata, which gives the event back on the way to SBML |
| algebraic rule | implicit equation 0 = formula for the variable the rule determines, which starts from the solution at the start time; the constants of the rule become equations y = value |
plus, times, and, or, xor with less than two arguments |
their value (the argument or the identity element) |
relation of more than two arguments (a < b < c) |
the conjunction of its pairs, and(a < b, b < c) |
quotient, implies |
piecewise(ceiling(a / b), a / b < 0, floor(a / b)), the integer division which truncates towards zero, and not a or b: CellML has neither operator |
factorial |
of a constant its value, of a variable not converted: CellML has no counterpart; an event which uses it is skipped |
The reverse direction, CellML to SBML, maps every variable to a parameter with rules and converts units and resets.
The conversion issues list what is not converted yet, the SBML test suite, BioModels and Physiome pages how many of the semantic test cases, of the curated models and of the published CellML models pass. The Models page collects which models of the three checks work and the Benchmarks page how fast the two simulators are over them.
The release notes list the changes of every version.
Citation¶
If you use sbml2cellml please cite the archived software on Zenodo:
König, M. (2026). sbml2cellml: conversion of SBML models to CellML (Version 0.4.3) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.23554440
@software{konig_sbml2cellml,
author = {König, Matthias},
title = {sbml2cellml: conversion of SBML models to CellML},
year = {2026},
month = oct,
version = {0.4.3},
publisher = {Zenodo},
doi = {10.5281/zenodo.23554440},
url = {https://doi.org/10.5281/zenodo.23554440},
}
License¶
- Source Code: MIT
- Documentation: CC BY-SA 4.0
Funding¶
Matthias König was supported by the Federal Ministry of Education and Research (BMBF, Germany) within the research network Systems Medicine of the Liver (LiSyM, grant number 031L0054) and within ATLAS by grant number 031L0304B, and by the German Research Foundation (DFG) within the Research Unit Program FOR 5151 QuaLiPerF (Quantifying Liver Perfusion-Function Relationship in Complex Resection - A Systems Medicine Approach) by grant number 436883643 and by grant number 465194077 (Priority Programme SPP 2311, Subproject SimLivA).