7.1.2.3. cobramod.retrieval¶
Retrieval of data from multiple databases
This module includes the class ‘Data’, that is responsable for the internal data representation for this package. The class Data includes methods for parsing itself into a Reaction, Metabolite or Pathway.
Additionally, this package includes high level functions such as get_data, file_to_Data_class or get_response that handles the data retrieval or convertion
7.1.2.3.1. Attributes¶
7.1.2.3.2. Classes¶
7.1.2.3.3. Functions¶
|
Request different servers to see if there a valid response and returns the |
|
Creates a Data object from given file. |
|
Finds the content type and writes the data into disk and returns the Path |
|
Returns a Generator with the possible files given a specific identifier |
|
Retrieves the Data for given identifier. This function either retrieves |
|
Populates the reaction with Metabolites from given reaction string. |
7.1.2.3.4. Module Contents¶
- cobramod.retrieval.debug_log¶
- cobramod.retrieval.db_configuration¶
- cobramod.retrieval.BIOCYC = 'https://websvc.biocyc.org/getxml?id='¶
- cobramod.retrieval.PMN = 'https://pmn.plantcyc.org/getxml?id='¶
- cobramod.retrieval.KEGG = 'https://rest.kegg.jp/get/'¶
- cobramod.retrieval.SOLCYC = 'https://solcyc.sgn.cornell.edu/getxml?id='¶
- cobramod.retrieval.EXTENSIONS = ['.xml', '.txt', '.json']¶
- class cobramod.retrieval.Databases¶
Simple object that shows the information about the database
- cobramod.retrieval.available_databases¶
- cobramod.retrieval.databases¶
- class cobramod.retrieval.Data(identifier, attributes, mode, database, path, model_id, version)¶
- Parameters:
- path: pathlib.Path¶
- version: str¶
CobraMod’s Data object. This class is responsible for converting information into COBRApy objects
- classmethod from_json(entry, data, database, path)¶
Creates an instance from a JSON file. Database: BIGG
- Parameters:
entry (str)
database (str)
path (pathlib.Path)
- classmethod from_text(entry, text, database, path, genome)¶
Creates an instance from plain text. Database: KEGG
- Parameters:
entry (str)
text (str)
database (str)
path (pathlib.Path)
genome (str)
- classmethod from_xml(entry, root, database, path)¶
Creates an instance from an XML file. Database: Biocyc families
- Parameters:
entry (str)
database (str)
path (pathlib.Path)
- parse(model, compartment, replacement={})¶
Parses information and creates a cobrapy Object. This can be a Metabolite or Reaction.
- Parameters:
model (cobra.core.Model) – Model to search for information
compartment (str) – Location of the object
replacement (dict[str, str]) – In case of Reactions, the dictionary represents the metabolites to replace. The key is the identifier of the object to replaced and the value is the new identifier to use instead. Defaults to an empty dictionary
- Returns:
cobra.core.Object This can be a Reaction or Metabolites
- Return type:
- cobramod.retrieval.get_response(query, model_id=None)¶
Request different servers to see if there a valid response and returns the database name with the response
model_id is a BIGG-specific argument.
The content type must be xml, json or text
- cobramod.retrieval.file_to_Data_class(identifier, filename, genome)¶
Creates a Data object from given file.
- cobramod.retrieval.write(name, directory, response)¶
Finds the content type and writes the data into disk and returns the Path of the new file
- Parameters:
name (str)
directory (pathlib.Path)
response (requests.Response)
- Return type:
- cobramod.retrieval.get_files(directory, identifier)¶
Returns a Generator with the possible files given a specific identifier
- Parameters:
directory (pathlib.Path)
identifier (str)
- cobramod.retrieval.get_data(identifier, directory, database, model_id=None, genome=None)¶
Retrieves the Data for given identifier. This function either retrieves from the server of the databases or locally.
- Parameters:
identifier (str) – Name of the object to retrieve
dictionary (str or Path) – Location of the files to retrieve or store
database (Optional[str]) – Name of the database. Check cobramod.retrieval.available_databases for more information
model_id (Optional[str]) – BIGG-specific argument. Name of the model to retrieve information
genome (Optional[str]) – (Optional[str]): Name of the genome to retrieve
directory (Union[str, pathlib.Path])
- Returns:
Data
- Return type:
- cobramod.retrieval.build_reaction_from_str(model, reaction, reaction_str, directory, database, model_id, replacement)¶
Populates the reaction with Metabolites from given reaction string. Metabolites are retrieved from the servers or locally
- Parameters:
model (cobra.core.Model) – Model to search for metabolites
reaction (cobra.core.Reaction) – Empty reaction to populate
reaction_str (str) – valid reaction string
directory (Path) – Path for the location of the directory where the information is stored
database (str, optional) – Name of the database. Check cobramod.retrieval.available_databases for more information
model_id (str, optional) – BIGG-specific argument. Name of the model to retrieve information
genome – (Optional[str]): Name of the genome to retrieve
replacement (dict[str, str]) – The dictionary represents the metabolites to replace. The key is the identifier of the object to replaced and the value is the new identifier to use instead