7.1.1.3.1.2. cobramod.parsing.biocyc

Data parsing for Biocyc

This module handles the retrieval of data from BioCyc into a local directory. The possible type of data that can be downloaded:

  • Metabolites: Normally have an abbreviation or short name.

  • Reactions: Can have the words “RXN” in the identifier. Enzymes can sometimes

be used instead. The gene information for the reactions is included if found.

7.1.1.3.1.2.1. Attributes

7.1.1.3.1.2.2. Functions

build_cross_references_xml(root)

Returns a dictionary with the corresponding cross-references and their

reaction_str_from_xml(root)

get_direction_from_xml(root)

Returns the direction of the chemical reaction

parse_reaction_attributes(root, entry, gene_directory)

parse_metabolite_attributes(root, entry)

get_graph(root)

Return a directed graph from given XML Element. A key represent the

parse_pathway_attributes(root, entry)

retrieve_gene_information(directory, identifier, database)

Retrieve the gene information for given reaction in a specific database

parse_genes(identifier, directory)

Returns a dictionary with the corresponding genes and gene-reaction rules.

7.1.1.3.1.2.3. Module Contents

cobramod.parsing.biocyc.debug_log
cobramod.parsing.biocyc.build_cross_references_xml(root)

Returns a dictionary with the corresponding cross-references and their identifiers.

Parameters:

root (Any)

Return type:

dict[str, str]

cobramod.parsing.biocyc.reaction_str_from_xml(root)
Parameters:

root (xml.etree.ElementTree.Element)

Return type:

str

cobramod.parsing.biocyc.get_direction_from_xml(root)

Returns the direction of the chemical reaction

Parameters:

root (xml.etree.ElementTree.Element)

Return type:

str

cobramod.parsing.biocyc.parse_reaction_attributes(root, entry, gene_directory)
Parameters:
Return type:

dict[str, Any]

cobramod.parsing.biocyc.parse_metabolite_attributes(root, entry)
Parameters:
cobramod.parsing.biocyc.get_graph(root)

Return a directed graph from given XML Element. A key represent the parent reaction and the value is the child. A parent can have multiple children as tuples. End-reactions have a NoneType as child.

Parameters:

root (Element) – An XML element, which represent a XML file with the information of a pathway.

Returns:

Directed graph from root.

Return type:

Dict

Raises:

WrongParserError – If given root does not represent a pathway.

cobramod.parsing.biocyc.parse_pathway_attributes(root, entry)
Parameters:
Return type:

dict[str, Any]

cobramod.parsing.biocyc.retrieve_gene_information(directory, identifier, database)

Retrieve the gene information for given reaction in a specific database :param directory: Directory to store and retrieve local data. :type directory: Path :param identifier: original identifier :type identifier: str :param database: Name of the database. Some options: “META”, “ARA”.

Raises:

HTTPError – If given reaction does not have gene information available

Parameters:
cobramod.parsing.biocyc.parse_genes(identifier, directory)

Returns a dictionary with the corresponding genes and gene-reaction rules. This function will try to read a file for given identifier. If nothing is found, the dictionary will have empty entries.

Parameters:
Return type:

dict