cobra.io.sbml3 Module Contents

class cobra.io.sbml3.Basic

replace prefixes with namespace

cobra.io.sbml3.extract_rdf_annotation(sbml_element, metaid)
class cobra.io.sbml3.CobraSBMLError[source]
cobra.io.sbml3.get_attrib(tag, attribute, type=None, require=False)[source]
cobra.io.sbml3.set_attrib(xml, attribute_name, value)[source]

parses filename or compressed stream to xml

cobra.io.sbml3.clip(string, prefix)[source]

clips a prefix from the beginning of a string if it exists

>>> clip("R_pgi", "R_")

Utility function to convert a number to a string

cobra.io.sbml3.construct_gpr_xml(parent, expression)[source]

create gpr xml under parent node

cobra.io.sbml3.annotate_cobra_from_sbml(cobra_element, sbml_element)[source]
cobra.io.sbml3.annotate_sbml_from_cobra(sbml_element, cobra_element)[source]
cobra.io.sbml3.parse_xml_into_model(xml, number=float)[source]
cobra.io.sbml3.model_to_xml(cobra_model, units=True)[source]
cobra.io.sbml3.read_sbml_model(filename, number=float, **kwargs)[source]
cobra.io.sbml3.validate_sbml_model(filename, check_model=True)[source]

Returns the model along with a list of errors.

  • filename (str) – The filename of the SBML model to be validated.
  • check_model (bool, optional) – Whether to also check some basic model properties such as reaction boundaries and compartment formulas.

  • model (Model object) – The cobra model if the file could be read succesfully or None otherwise.
  • errors (dict) – Warnings and errors grouped by their respective types.


CobraSBMLError – If the file is not a valid SBML Level 3 file with FBC.

cobra.io.sbml3.write_sbml_model(cobra_model, filename, use_fbc_package=True, **kwargs)[source]
cobra.io.sbml3.indent_xml(elem, level=0)[source]

indent xml for pretty printing