cellml2sbml¶
Conversion of CellML 2.0 models to SBML level 3 version 2.
The libcellml analyser classifies the variables and equations of the model and resolves the connections between components; the converter renders its model as SBML: every variable is a parameter, states get rate rules, algebraic variables assignment rules, computed constants initial assignments, and the resets of the components become events. CellML units become unit definitions. There are no compartments, species or reactions.
The metadata of an SBML model which sbml2cellml wrote next to the CellML
file (sbml2cellml.metadata) comes back on the parameters, the unit
definitions and the model.
CellML2SBMLConversionError
¶
Bases: ValueError
The CellML model cannot be converted.
convert_cellml2sbml
¶
Convert a CellML file to an SBML document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellml_path
|
Path
|
path of the CellML file; imports are resolved relative to it. |
required |
sbml_path
|
Path | None
|
path the SBML is written to, not written if |
None
|
validate
|
bool
|
check the consistency of the document with libsbml and raise if it has errors. |
True
|
metadata
|
bool
|
read the metadata from the RDF file next to the CellML file
( |
True
|
Returns:
| Type | Description |
|---|---|
SBMLDocument
|
The SBML document. |
Raises:
| Type | Description |
|---|---|
CellML2SBMLConversionError
|
if the file does not exist, the imports cannot be resolved, the analyser reports errors, the model is not an ODE or algebraic model, or a construct is not supported. |
CellMLValidationError
|
if the file cannot be parsed. |
SBMLValidationError
|
if |
build_document
¶
Build the SBML document of an analysed CellML model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Model
|
the (flattened) CellML model. |
required |
analyser_model
|
Any
|
its analyser model without errors. |
required |
records
|
dict[str, Record] | None
|
metadata by the id of a CellML element
( |
None
|
Returns:
| Type | Description |
|---|---|
SBMLDocument
|
The SBML document, not validated. |
Raises:
| Type | Description |
|---|---|
MathConversionError
|
for a construct which cannot be converted;
|
UnitsConversionError
|
for units which cannot be converted;
|