acore.io.kegg module#

Fetch from KEGG in batches informations.

Docs: https://www.kegg.jp/kegg/rest/keggapi.html

Parameters:
  • target_db (str) – Target endpoint of KEGG API, e.g. “ko” or “pathway”.

  • gene_ids (list of str) – List of KEGG gene IDs to query.

Returns:

A list of strings containing the fetched information.

Return type:

str

fetch_kegg_ko_descriptions(ko_terms: Iterable[str], timeout: float = 30.0) DataFrame[source]#

Fetch common descriptions for KEGG KO terms.

Parameters:
  • ko_terms (Iterable[str]) – KEGG KO identifiers such as K03007 or ko:K03007.

  • timeout (float, optional) – Timeout in seconds for each KEGG API request.

Returns:

A DataFrame with columns ko_term, symbol and common_description.

Return type:

pd.DataFrame

Notes

The KEGG API accepts up to 10 entry identifiers per request. This helper batches larger inputs automatically.

cid_to_kegg_id(pubchem_cid: int) str | None[source]#

Convert a single PubChem CID to a KEGG compound ID via KEGG conv API.

parse_compound_pathway_mapping(raw_mapping: str) dict[str, list[str]][source]#

Parse tab-delimited KEGG-style compound/pathway mappings into a dictionary.

parse_kegg_name_description(raw_text: str) dict[str, dict[str, str]][source]#

Parse KEGG pathway entries into ENTRY -> {NAME, DESCRIPTION}.

lookup_cid_to_kegg_id(pubchem_cid: Iterable[int]) Series | None[source]#

Look up KEGG IDs for a list of PubChem CIDs using a pre-downloaded mapping file.

Parameters:

pubchem_cid (Iterable[int]) – A list of PubChem CIDs to look up.

Returns:

A Series mapping PubChem CIDs to KEGG IDs, or None if no matches are found.

Return type:

pd.Series | None