cocomico.sbmlreader

CoCoMiCo SBML reader.

Classes

SbmlReader

SBML reader builds Models from the bipartite metabolite-reaction

Module Contents

class cocomico.sbmlreader.SbmlReader(sbml_dir: pathlib.Path | None = None)[source]

SBML reader builds Models from the bipartite metabolite-reaction relations extracted from SBML files. The extraction is memoized: if a file or taxon is requested that has already been analyzed, the existing model is shared rather than being recomputed.

Parameters:

sbml_dir (Path) – optional directory where model files are found

Raises:

ValueError – if the model is empty or invalid

from_file(path: pathlib.Path) Tuple[cocomico.base.Taxon, cocomico.model.Model][source]

Parse an SBML file and convert its relations to a Model.

Parameters:

path (pathlib.Path)

Return type:

Tuple[cocomico.base.Taxon, cocomico.model.Model]

static read_sbml_file(candidate: pathlib.Path)[source]

RetrieveExtract the taxon id and the model from the XML tree.

Parameters:

candidate (pathlib.Path)

static decode_relations(taxon: cocomico.base.Taxon, sbml_model: xml.etree.ElementTree.Element) cocomico.model.Model[source]

Search for reaction-metabolite relations, also including reversed relations for those reactions that are reversible.

Parameters:
  • taxon (cocomico.base.Taxon)

  • sbml_model (xml.etree.ElementTree.Element)

Return type:

cocomico.model.Model

normalize(path: pathlib.Path, sbml_dir: pathlib.Path | None = None)[source]

Try to relative this SBML file name to a sbml_dir, either the one specified as a parameter or the default one encapsulated in the reader.

Parameters:
  • path (pathlib.Path)

  • sbml_dir (pathlib.Path | None)

__str__() str[source]

String representation of class SbmlReader.

Return type:

str