Skip to content

Latest commit

 

History

477 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build_and_test sbml_test_suite

Import SBML models into Chaste

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.

Installation

Install with pipx (recommended)

pipx install git+https://github.com/Chaste/chaste-codegen-sbml@develop

Install with pip

Create and activate a virtual environment (optional)

python3 -m venv .venv
source .venv/bin/activate

Install the package

python3 -m pip install git+https://github.com/Chaste/chaste-codegen-sbml@develop

Development

Getting the code

Clone the repository

git clone https://github.com/Chaste/chaste-codegen-sbml
cd chaste-codegen-sbml

Create and activate a virtual environment

python3 -m venv .venv
source .venv/bin/activate

Install in editable mode with development dependencies

python3 -m pip install -e ."[dev]"

Run tests

python3 -m pytest

Usage

Generating 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: on)
  --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)

Generate code

Generate Chaste C++ code from an SBML file:

chaste-sbml my_model.xml --model-type srn --output-dir src/

By default this also emits 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. Pass --no-tests to skip it, or --test-output-dir to place the placeholder test somewhere other than --output-dir.

Copy the base classes

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.

About

Chaste C++ code generation from SBML

Resources

Stars

0 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages