KEGG & Reactome
Map genes and metabolites to biological pathways using KEGG and Reactome. Run enrichment analysis on gene or metabolite sets and download pathway diagrams.
TOOL
kegg_enrichmentRun KEGG pathway enrichment on a gene list. Returns enriched pathways with adjusted p-values, gene overlap counts, and optionally saves a colour-mapped pathway image.
| Parameter | Type | Description |
|---|---|---|
| gene_list * | string[] | HGNC gene symbols or Entrez IDs. |
| species | string | KEGG organism code: hsa (human), mmu (mouse) (default: hsa). |
| pvalue_threshold | number | Adjusted p-value cutoff (default 0.05). |
| workspace_id | string | Set to save results and pathway diagrams to workspace. |
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
gene_list = ["BRCA1", "BRCA2", "ATM", "CHEK2", "RAD51", "PALB2", "TP53", "CDK2", "CCND1"]
result = client.tools.run(
tool_id="kegg_enrichment",
input={
"gene_list": gene_list,
"species": "hsa",
"pvalue_threshold": 0.05,
"workspace_id": ws_id,
"output_path": "pathways/kegg/",
},
)
print(f"Enriched pathways: {len(result['pathways'])}")
for p in result["pathways"][:5]:
print(f" {p['id']:<10} {p['name']:<45} p={p['padj']:.2e} k={p['k']}/{p['n']}")
# Download pathway diagram for top hit
diagram = client.files.download(result["pathways"][0]["diagram_path"], workspace_id=ws_id, dest="./pathways/")
print(f"Pathway diagram saved to {diagram}")TOOL
reactome_enrichmentRun pathway enrichment against the Reactome hierarchy. Returns parent–child pathway context and gene-level overlap details.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
gene_list = ["EGFR", "ERBB2", "PIK3CA", "AKT1", "MTOR", "RPS6KB1", "PTEN"]
result = client.tools.run(
tool_id="reactome_enrichment",
input={
"gene_list": gene_list,
"species": "Homo sapiens",
"pvalue_threshold": 0.05,
"workspace_id": ws_id,
"output_path": "pathways/reactome/",
},
)
for p in result["pathways"][:5]:
print(f" {p['pathway_id']:<15} {p['name'][:50]:<50} FDR={p['fdr']:.2e}")
# Download full results table
csv = client.files.download(result["output_path"], workspace_id=ws_id, dest="./pathways/")
print(f"Results saved to {csv}")Download a KEGG pathway diagram
Retrieve a colour-highlighted pathway image for a specific KEGG pathway ID.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
result = client.tools.run(
tool_id="kegg_pathway_diagram",
input={
"pathway_id": "hsa05200", # Pathways in cancer
"highlight_genes": ["TP53", "KRAS", "EGFR", "MYC"],
"workspace_id": ws_id,
"output_path": "diagrams/",
},
)
diagram = client.files.download(result["diagram_path"], workspace_id=ws_id, dest="./diagrams/")
print(f"Pathway image saved to {diagram}")