sbmlutils.io.sbml
¶
Utility functions for reading, writing and validating SBML.
Module Contents¶
Functions¶
|
Read SBMLDocument from given source. |
|
Write SBMLDocument to file or string. |
|
Check given SBML source. |
|
Promotes local variables in SBMLDocument. |
Attributes¶
- sbmlutils.io.sbml.read_sbml(source, promote=False, validate=False, validation_options=None)[source]¶
Read SBMLDocument from given source.
Local parameters can be promoted using the promote flag. Allows to validate the file during reading via the `validate flag. The subset of tested features in validation can be set via the validation_options.
- Parameters
source (Union[pathlib.Path, str]) – SBML path or string
promote (bool) – promote local parameters to global parameters
validate (bool) – validate file
validation_options (Optional[sbmlutils.validation.ValidationOptions]) – options for validation
- Returns
libsbml.SBMLDocument
- Return type
libsbml.SBMLDocument
- sbmlutils.io.sbml.write_sbml(doc, filepath=None, validate=False, validation_options=None, program_name=None, program_version=None)[source]¶
Write SBMLDocument to file or string.
To write the SBML to string use ‘filepath=None’, which returns the SBML string.
The file can be validated during writing via the validate flag.
- Parameters
doc (libsbml.SBMLDocument) – SBMLDocument to write
filepath (Optional[pathlib.Path]) – output file to write
validate (bool) – flag for validation
validation_options (Optional[sbmlutils.validation.ValidationOptions]) – validation flag
program_name (Optional[str]) – Program name for SBML file
program_version (Optional[str]) – Program version for SBML file
- Returns
None or SBML string
- Return type
Optional[str]
- sbmlutils.io.sbml.validate_sbml(source, validation_options=None, title=None)[source]¶
Check given SBML source.
- Parameters
source (Union[str, pathlib.Path]) – SBML path or string
validation_options (Optional[sbmlutils.validation.ValidationOptions]) – options for validation
title (Optional[str]) – title for validation report (should be filname or model name)
- Returns
ValidationResult
- Return type
- sbmlutils.io.sbml.promote_local_variables(doc, suffix='_promoted')[source]¶
Promotes local variables in SBMLDocument.
Manipulates SBMLDocument in place!
- Parameters
doc (libsbml.SBMLDocument) – SBMLDocument
suffix (str) – str suffix for promoted SBML
- Returns
SBMLDocument with promoted parameters
- Return type
libsbml.SBMLDocument