FEV_KEGG.KEGG.Download module¶
-
FEV_KEGG.KEGG.Download.downloadEcEnzyme(ecNumberID)[source]¶ Download an enzyme description file from KEGG, defined by its EC number.
Parameters: ecNumber (str) – The EC number string of the enzyme to download, e.g. ‘4.1.2.48’. Returns: Content of the EcEnzymes’s description. Return type: str Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadEnzymeEcNumbers(enzymeAbbreviation) → str[source]¶ Download the list of all EC numbers for a given enzyme, identified by its abbreviation, from KEGG.
Also works for everything else in the description of an enzyme, not just the abbreviation. Tries several times before giving up, see
FEV_KEGG.settings.retryDownloadBackoffFactor.Parameters: enzymeAbbreviation (str) – Common abbreviation of the desired enzyme, as it appears in its description, e.g. ‘MiA’. Also works for everything else in the description of an enzyme, not just the abbreviation. Returns: EC numbers, delimited by ‘\n’. Return type: str Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadGene(geneID: eco:b0004) → str[source]¶ Downloads gene description for a given gene ID (includes organism) from KEGG.
Tries several times before giving up, see
FEV_KEGG.settings.retryDownloadBackoffFactor.Parameters: geneID (str) – ID of the gene, including organism abbreviation, e.g. ‘eco:b0004’.
Returns: Gene in KEGG GENE format.
Return type: str
Raises: HTTPError– If gene does not exist.URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadGeneBulk(geneIDs: [eco:b0004, eco:b0015,...]) → str[source]¶ Downloads gene descriptions for a given list of gene IDs (includes organism) from KEGG
Tries several times before giving up, see
FEV_KEGG.settings.retryDownloadBackoffFactor.Parameters: geneIDs (Iterable) – IDs of the genes, including organism abbreviation, e.g. ‘[eco:b0004, eco:b0015,…]’.
Returns: Genes in KEGG GENE format, delimited by a line of ‘///’. You will have to split them! Order is arbitrary.
Return type: str
Raises: IOError– If result is too small. Possibly because none of the genes exist.URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadOrganismInfo(organismAbbreviation) → str[source]¶ Downloads the info file of an organism.
Parameters: organismAbbreviation (str) – Abbreviation of the organism to check, e.g. ‘eco’. Returns: Raw organism info. None, if download was empty (400 Bad Request), because this organism does not exist. Return type: str Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadOrganismList() → str[source]¶ Download the list of all organisms known to KEGG.
Tries several times before giving up, see
FEV_KEGG.settings.retryDownloadBackoffFactor.Returns: List of organism descriptions known to KEGG, delimited by ‘\n’. Return type: str Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadOrthologOverview(geneID: GeneID) → Tuple[int, List[FEV_KEGG.KEGG.SSDB.Match]][source]¶ Download overview of orthologs of gene geneID found in any organism.
Parameters: geneID (GeneID) – GeneID object of the gene to be compared against, i.e. against its amino acid sequence. Returns: List of Matches, containing gene IDs of orthologs, and other data necessary for sequence matching. Will be empty, if nothing is found. Return type: List[SSDB.Match] Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadOrthologs(geneID: GeneID, comparisonOrganismString: eco) → Tuple[int, List[FEV_KEGG.KEGG.SSDB.PreMatch]][source]¶ Download orthologs of gene geneID found in organism comparisonOrganismString.
Parameters: - geneID (GeneID) – GeneID object of the gene to be compared against, i.e. against its amino acid sequence.
- comparisonOrganismString (str) – Abbreviation of the organism to search for orthologs of geneID.
Returns: List of Pre-Matches, containing gene IDs of orthologs, and other data necessary for sequence matching. Will be empty, if nothing is found.
Return type: List[SSDB.PreMatch]
Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadParalogs(geneID: GeneID) → Tuple[int, List[FEV_KEGG.KEGG.SSDB.PreMatch]][source]¶ Download paralogs of gene geneID.
Parameters: geneID (GeneID) – GeneID object of the gene to be compared against, i.e. against its amino acid sequence. Returns: List of Pre-Matches, containing gene IDs of paralogs, and other data necessary for sequence matching. Will be empty, if nothing is found. Return type: List[SSDB.PreMatch] Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadPathway(organismString: eco, pathwayName: 00260) → str[source]¶ Downloads pathway as KGML for a given organism from KEGG.
Tries several times before giving up, see
FEV_KEGG.settings.retryDownloadBackoffFactor.Parameters: - organismString (str) – Abbreviation of the organism, e.g. ‘eco’.
- pathwayName (str) – Name of the pathway, e.g. ‘00260’. Will be automatically concatenated with organismString to form the pathway ID, e.g. ‘eco:00260’.
Returns: Pathway in KGML format.
Return type: str
Raises: HTTPError– If pathway does not exist.URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadPathwayList(organismString: eco) → str[source]¶ Downloads list of all pathways for a given organism from KEGG.
Tries several times before giving up, see
FEV_KEGG.settings.retryDownloadBackoffFactor.Parameters: organismString (str) – Abbreviation of the organism, e.g. ‘eco’.
Returns: List of pathways, delimited by ‘\n’.
Return type: str
Raises: HTTPError– If pathway list does not exist.URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadSubstance(substanceID)[source]¶ Download a substance description file from KEGG, compound or glycan.
Parameters: substanceID (str) – The ID string of the substance to download, e.g. ‘C00084’. Returns: Content of the substance’s description. Return type: str Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadTaxonomyKEGG()[source]¶ Download KEGG taxonomy from KEGG BRITE.
Returns: KEGG taxonomy in special text format. Return type: str Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.downloadTaxonomyNCBI() → str[source]¶ Download NCBI taxonomy from KEGG BRITE.
Returns: NCBI taxonomy in special text format. Return type: str Raises: URLError– If connection to KEGG fails.
-
FEV_KEGG.KEGG.Download.is_not_404(exception)[source]¶ Checks if exception is not an HTTP 404 error.
This is useful, because for most types of downloads 404 means ‘does not exist’ and is in itself a valid reply. Therefore, retrying a download because it raised a 404 error is usually unnecessary.
Parameters: exception (Exception) – Any error class instance. Must be of class urllib.error.HTTPErrorto be recognised as a 404 error.Returns: False, if exception is an HTTP 404 error. True, if it is anythign else. Return type: bool