bc_query_kegg
Query the KEGG API to retrieve biological data such as pathways, genes, compounds, and diseases. Convert identifiers, search entries, and link related datasets using supported operations for comprehensive analysis.
Instructions
Execute a KEGG API query.
This function provides access to the KEGG API, allowing you to query biological data across pathways, genes, compounds, diseases, and more. The function can perform all KEGG API operations and accepts various parameters depending on the operation.
When searching for genes in KEGG, you typically need KEGG IDs rather than gene symbols. Use the get_kegg_id_by_gene_symbol function first to convert gene symbols to KEGG IDs.
Common operations:
- info: Get database metadata (e.g., operation=info, database=PATHWAY)
- list: List entries in a database (e.g., operation=list, database=PATHWAY, query="hsa")
- get: Retrieve specific entries (e.g., operation=get, entries=["hsa:7157"])
- find: Search for entries by keyword (e.g., operation=find, database=COMPOUND, query="glucose")
- link: Find related entries (e.g., operation=link, target_db=PATHWAY, entries=["hsa:7157"])
- conv: Convert between identifiers (e.g., operation=conv, target_db=NCBI_GENEID, entries=["hsa:7157"])
Args: operation (KeggOperation): The KEGG operation to perform. database (KeggDatabase | KeggOutsideDb | str, optional): The database to query. target_db (KeggDatabase | KeggOutsideDb | str, optional): The target database for conversion. source_db (KeggDatabase | KeggOutsideDb | str, optional): The source database for conversion. query (str, optional): The query string for FIND or LIST operations. option (KeggOption | KeggFindOption | KeggRdfFormat, optional): Additional options for the operation. entries (List[str], optional): List of entries for GET or LINK operations.
Returns: str | dict: The result of the KEGG query or an error message.
Examples: # List human pathways >>> query_kegg(operation=KeggOperation.LIST, database=KeggDatabase.PATHWAY, query="hsa")
Input Schema
Name | Required | Description | Default |
---|---|---|---|
database | No | The KEGG database to query (e.g., pathway, genes, compound) or organism code (e.g., hsa) | |
entries | No | List of KEGG entry IDs (e.g., ['hsa:7157', 'hsa:00010']) | |
operation | Yes | The KEGG API operation to perform (info, list, find, get, conv, link, ddi) | |
option | No | Additional options like sequence formats, chemical formula search, etc. | |
query | No | Query string for operations like FIND, or organism code for LIST | |
source_db | No | Source database for conversion or linking operations | |
target_db | No | Target database for conversion or linking operations |