This project is a Python code generator that reads an SBML model and emits C++ classes compatible with Chaste, so you can run SBML-defined biology models inside Chaste simulations.
Full documentation — installation, command-line options, supported SBML features, the anatomy of the generated code, and worked tutorials — is at https://chaste.github.io/chaste-sbml/.
The sections below are a quick reference; see the documentation site for the details.
pipx install git+https://github.com/Chaste/chaste-sbml@developCreate and activate a virtual environment (optional)
python3 -m venv .venv
source .venv/bin/activateInstall the package
python3 -m pip install git+https://github.com/Chaste/chaste-sbml@developClone the repository
git clone https://github.com/Chaste/chaste-sbml
cd chaste-sbmlCreate and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activateInstall in editable mode with development dependencies
python3 -m pip install -e ."[dev]"Run tests
python3 -m pytestGenerating Chaste C++ code from an SBML file is the default action. Passing
--copy-base-classes switches to copying the C++ base classes instead.
usage: chaste-sbml [-h] [--version] [--copy-base-classes]
[--output-dir OUTPUT_DIR]
[--model-type [{generic,srn,cell-cycle}]]
[--tests | --no-tests] [--timescale {ms,s,m,h}]
[--test-output-dir TEST_OUTPUT_DIR]
[sbml_file]
positional arguments:
sbml_file The SBML file to convert
options:
-h, --help show this help message and exit
--version show program's version number and exit
--copy-base-classes Copy the C++ base classes the generated code depends
on, instead of generating code
--output-dir OUTPUT_DIR
The directory to place output files in
--model-type [{generic,srn,cell-cycle}]
The type of model to generate
--tests, --no-tests Generate placeholder test files (default: off)
--timescale {ms,s,m,h}
The model's native time unit, used to convert
derivatives to Chaste's hours (auto-detected if omitted)
--test-output-dir TEST_OUTPUT_DIR
The directory to place generated test files in
(defaults to --output-dir; implies --tests)
Generate Chaste C++ code from an SBML file:
chaste-sbml my_model.xml --model-type srn --output-dir src/Pass --tests to also emit a placeholder test (Test<Model>Sbml.hpp), a
CxxTest skeleton with a suite for the ODE system, and the SRN/cell-cycle
model where applicable. --test-output-dir places that placeholder somewhere
other than --output-dir, and asks for it in the first place.
The generated code #includes and subclasses a set of C++ base classes (for example
AbstractSbmlOdeSystem). These are shipped with the package; copy them into your project so
they match the installed version of chaste-sbml:
chaste-sbml --copy-base-classes --output-dir src/In this mode only --output-dir applies; passing an SBML file or a generation option (such as
--model-type or --no-tests) is a usage error.