Skip to content

Validation workflow

Validation wraps libSBML consistency checks.

CLI validation

ode2sbml validate build/model.xml

A valid file prints a success message. Diagnostics are shown in a table.

Python validation

from ode2sbml.validators.sbml_validator import validate_sbml_file

messages = validate_sbml_file("build/model.xml", raise_on_error=False)

if messages:
    print("Diagnostics:")
    for message in messages:
        print(message)
else:
    print("Valid SBML")

Validate in memory

from ode2sbml.converters.sbml_writer import model_to_sbml_string
from ode2sbml.validators.sbml_validator import validate_sbml_string

xml = model_to_sbml_string(ir)
messages = validate_sbml_string(xml, raise_on_error=False)

CI gate

Add SBML validation to CI. A converter that writes XML but fails consistency checks is not production-ready.

Typical issues

Symptom Likely cause Fix
Invalid ID Species or parameter name is not SBML-safe Use letters, digits, and underscores only; do not start with a digit.
Math parse error Formula contains np., math., or unsupported syntax Use SymPy/SBML-compatible formula strings.
Unit warning Units are incomplete or inconsistent Define explicit parameter units and inspect model-level assumptions.
Missing parameter file in PEtab Model has no parameters Expected behavior. Add parameters if required by downstream tooling.