15.1.1.3.1.4. cobra.io.sbml
¶
15.1.1.3.1.4.1. Module Contents¶
-
cobra.io.sbml.
parse_legacy_id
(the_id, the_compartment=None, the_type="metabolite", use_hyphens=False)[source]¶ Deals with a bunch of problems due to bigg.ucsd.edu not following SBML standards
Parameters: - the_id (String.) –
- the_compartment (String) –
- the_type (String) – Currently only ‘metabolite’ is supported
- use_hyphens (Boolean) – If True, double underscores (__) in an SBML ID will be converted to hyphens
Returns: string
Return type: the identifier
-
cobra.io.sbml.
create_cobra_model_from_sbml_file
(sbml_filename, old_sbml=False, legacy_metabolite=False, print_time=False, use_hyphens=False)[source]¶ convert an SBML XML file into a cobra.Model object.
Supports SBML Level 2 Versions 1 and 4. The function will detect if the SBML fbc package is used in the file and run the converter if the fbc package is used.
Parameters: - sbml_filename (string) –
- old_sbml (bool) – Set to True if the XML file has metabolite formula appended to metabolite names. This was a poorly designed artifact that persists in some models.
- legacy_metabolite (bool) –
- If True then assume that the metabolite id has the compartment id
- appended after an underscore (e.g. _c for cytosol). This has not been implemented but will be soon.
- print_time (bool) – deprecated
- use_hyphens (bool) – If True, double underscores (__) in an SBML ID will be converted to hyphens
Returns: Model
Return type: The parsed cobra model
-
cobra.io.sbml.
parse_legacy_sbml_notes
(note_string, note_delimiter=":")[source]¶ Deal with various legacy SBML format issues.
-
cobra.io.sbml.
write_cobra_model_to_sbml_file
(cobra_model, sbml_filename, sbml_level=2, sbml_version=1, print_time=False, use_fbc_package=True)[source]¶ Write a cobra.Model object to an SBML XML file.
Parameters: - cobra_model (cobra.core.Model.Model) – The model object to write
- sbml_filename (string) – The file to write the SBML XML to.
- sbml_level (int) – 2 is the only supported level.
- sbml_version (int) – 1 is the only supported version.
- print_time (bool) – deprecated
- use_fbc_package (bool) – Convert the model to the FBC package format to improve portability. http://sbml.org/Documents/Specifications/SBML_Level_3/Packages/Flux_Balance_Constraints_(flux)
Notes
TODO: Update the NOTES to match the SBML standard and provide support for Level 2 Version 4
-
cobra.io.sbml.
get_libsbml_document
(cobra_model, sbml_level=2, sbml_version=1, print_time=False, use_fbc_package=True)[source]¶ Return a libsbml document object for writing to a file. This function is used by write_cobra_model_to_sbml_file().
-
cobra.io.sbml.
add_sbml_species
(sbml_model, cobra_metabolite, note_start_tag, note_end_tag, boundary_metabolite=False)[source]¶ A helper function for adding cobra metabolites to an sbml model.
Parameters: - sbml_model (sbml_model object) –
- cobra_metabolite (a cobra.Metabolite object) –
- note_start_tag (string) – the start tag for parsing cobra notes. this will eventually be supplanted when COBRA is worked into sbml.
- note_end_tag (string) – the end tag for parsing cobra notes. this will eventually be supplanted when COBRA is worked into sbml.
- boundary_metabolite (bool) – if metabolite boundary condition should be set or not
Returns: string
Return type: the created metabolite identifier