sbml¶
Reading, writing and validating SBML documents with libsbml.
The counterpart of sbml2cellml.cellml for the SBML side: errors are returned
as messages instead of printed, SBMLValidationError is raised by the callers
which want to stop on them.
SBMLValidationError
¶
Bases: ValueError
An SBML document has errors.
document_to_string
¶
Serialize a document to SBML xml.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc
|
SBMLDocument
|
SBML document. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The SBML xml. |
write_document
¶
Write a document as SBML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc
|
SBMLDocument
|
SBML document. |
required |
sbml_path
|
Path
|
path of the file, overwritten if it exists. |
required |
read_document
¶
Read an SBML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sbml_path
|
Path
|
path of the SBML file. |
required |
Returns:
| Type | Description |
|---|---|
SBMLDocument
|
The document. |
Raises:
| Type | Description |
|---|---|
SBMLValidationError
|
if the file cannot be read or has no model. |
validate_document
¶
Check the consistency of a document.
Runs the libsbml consistency checks (units, identifiers, MathML, SBO, modeling practice). Unit problems are reported by libsbml as warnings and are not part of the result. The error log of the document is cleared before the check.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc
|
SBMLDocument
|
SBML document. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The messages of severity error or fatal, empty for a consistent document. |