KEGG Parsing
pdb.parse_kegg_relations
Parses a single KEGG KGML XML file to extract Gene-Compound relationships based on enzyme entries being linked to reactions that involve specific compounds (substrates/products).
| Parameter | Type | Description |
|---|---|---|
kgml_path |
str | Path to the KEGG KGML file (e.g., ’./hsa/hsa00010.xml’). |
Returns
pd.DataFrame: A DataFrame of unique gene-compound pairs (columns: ’kegg_gene_id’,’kegg_compound_id’).
Usage
kegg_relations_df = pdb.parse_kegg_relations(kgml_path="./kegg_kgml/hsa/hsa00010.xml")
pdb.parse_all_kegg_pathways
Processes all KEGG KGML files within a species-specific directory to aggregate all gene-compound relations into a single, deduplicated DataFrame.
| Parameter | Type | Description |
|---|---|---|
species_code |
str | The KEGG organism code (e.g., ’hsa’). Used to find the subdirectory. |
kgml_path |
str | The base directory containing the species subdirectory (e.g., ’/data’ if files are in ’/data/hsa’). |
Returns
pd.DataFrame: A single DataFrame of all unique gene-compound pairs across all pathways for the species (columns: ’kegg_gene_id’,’kegg_compound_id’).
Usage
all_kegg_gc_df = pdb.parse_all_kegg_pathways(
species_code="hsa", kgml_path="./kegg_kgml"
)