cobramod.parsing.biocyc ======================= .. py:module:: cobramod.parsing.biocyc .. autoapi-nested-parse:: 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. Attributes ---------- .. autoapisummary:: cobramod.parsing.biocyc.debug_log Functions --------- .. autoapisummary:: cobramod.parsing.biocyc.build_cross_references_xml cobramod.parsing.biocyc.reaction_str_from_xml cobramod.parsing.biocyc.get_direction_from_xml cobramod.parsing.biocyc.parse_reaction_attributes cobramod.parsing.biocyc.parse_metabolite_attributes cobramod.parsing.biocyc.get_graph cobramod.parsing.biocyc.parse_pathway_attributes cobramod.parsing.biocyc.retrieve_gene_information cobramod.parsing.biocyc.parse_genes Module Contents --------------- .. py:data:: debug_log .. py:function:: build_cross_references_xml(root) Returns a dictionary with the corresponding cross-references and their identifiers. .. py:function:: reaction_str_from_xml(root) .. py:function:: get_direction_from_xml(root) Returns the direction of the chemical reaction .. py:function:: parse_reaction_attributes(root, entry, gene_directory) .. py:function:: parse_metabolite_attributes(root, entry) .. py:function:: 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. :param root: An XML element, which represent a XML file with the information of a pathway. :type root: Element :returns: Directed graph from root. :rtype: Dict :raises WrongParserError: If given root does not represent a pathway. .. py:function:: parse_pathway_attributes(root, entry) .. py:function:: 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". Full list in: "https://biocyc.org/biocyc-pgdb-list.shtml" :type database: str :raises HTTPError: If given reaction does not have gene information available .. py:function:: 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.