Skip to content

CLI

The command-line interface is implemented with Click and provides two commands:

ode2sbml convert INPUT_FILE --output OUTPUT --format sbml
ode2sbml validate SBML_FILE

Convert

ode2sbml convert path/to/model.py --output build/model.xml --format sbml

Options:

Option Required Values Description
INPUT_FILE yes path Python file containing a supported ODE convention.
--output, -o yes path Output XML file for SBML or output directory for PEtab.
--format, -f no sbml, petab Output format. Default: sbml.

PEtab export

ode2sbml convert path/to/model.py --output build/petab_problem --format petab

This writes a PEtab bundle containing:

build/petab_problem/
├── <model_id>.xml
├── conditions.tsv
├── measurements.tsv
├── observables.tsv
├── parameters.tsv     # only when parameters exist
└── petab_problem.yaml

PEtab output path

For --format petab, pass a directory path to --output, not an XML filename.

Validate

ode2sbml validate build/model.xml

The validator prints a Rich table when warnings or errors are found. It exits with non-zero status if libSBML reports Error or Fatal diagnostics.

Validation is structural

SBML validation checks file consistency and SBML rules. It does not determine whether the model fits experimental data.

Auto-detection order

The CLI inspects the input Python file in this order:

  1. model dictionary with an odes key → Convention B.
  2. odes dictionary whose keys are SymPy objects → Convention C.
  3. callable named model, ode, f, or rhs → Convention A.

Failure mode

If Convention A is detected but state_vars is missing, conversion fails. Define state_vars explicitly because the AST parser cannot infer biological state names safely.