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}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
const geneList = ['BRCA1', 'BRCA2', 'ATM', 'CHEK2', 'RAD51', 'PALB2', 'TP53', 'CDK2', 'CCND1'];
const result = await client.tools.run('kegg_enrichment', {
input: {
geneList,
species: 'hsa',
pvalueThreshold: 0.05,
workspaceId: workspace.id,
outputPath: 'pathways/kegg/',
},
});
console.log('Enriched pathways:', result.pathways.length);
result.pathways.slice(0, 5).forEach((p: { id: string; name: string; padj: number; k: number; n: number; diagram_path: string }) => {
console.log(` ${p.id.padEnd(10)} ${p.name.padEnd(45)} p=${p.padj.toExponential(2)} k=${p.k}/${p.n}`);
});
const diagram = await client.files.download(result.pathways[0].diagram_path, workspace.id, './pathways/');
console.log('Pathway diagram saved to', diagram);curl -X POST https://api.smarts.bio/v1/tools/kegg_enrichment/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"input": {
"gene_list": ["BRCA1", "BRCA2", "ATM", "CHEK2", "TP53"],
"species": "hsa",
"pvalue_threshold": 0.05
}
}'# KEGG pathway enrichment on a gene list (pass the JSON input via a file)
echo '{
"gene_list": ["BRCA1", "BRCA2", "ATM", "CHEK2", "RAD51", "PALB2", "TP53", "CDK2", "CCND1"],
"species": "hsa",
"pvalue_threshold": 0.05,
"output_path": "pathways/kegg/"
}' > kegg_input.json
smarts tool run kegg_enrichment --input @kegg_input.json
# Download the top pathway diagram
smarts file download pathways/kegg/ ./pathways/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}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
const geneList = ['EGFR', 'ERBB2', 'PIK3CA', 'AKT1', 'MTOR', 'RPS6KB1', 'PTEN'];
const result = await client.tools.run('reactome_enrichment', {
input: {
geneList, species: 'Homo sapiens',
pvalueThreshold: 0.05,
workspaceId: workspace.id, outputPath: 'pathways/reactome/',
},
});
result.pathways.slice(0, 5).forEach((p: { pathway_id: string; name: string; fdr: number }) => {
console.log(` ${p.pathway_id.padEnd(15)} ${p.name.slice(0, 50).padEnd(50)} FDR=${p.fdr.toExponential(2)}`);
});
const csv = await client.files.download(result.outputPath, workspace.id, './pathways/');
console.log('Results saved to', csv);curl -X POST https://api.smarts.bio/v1/tools/reactome_enrichment/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"input": {
"gene_list": ["EGFR", "ERBB2", "PIK3CA", "AKT1", "MTOR", "RPS6KB1", "PTEN"],
"species": "Homo sapiens",
"pvalue_threshold": 0.05
}
}' | jq '.pathways[:5][] | {pathway_id, name, fdr}'# Reactome pathway enrichment (pass the JSON input via a file)
echo '{
"gene_list": ["EGFR", "ERBB2", "PIK3CA", "AKT1", "MTOR", "RPS6KB1", "PTEN"],
"species": "Homo sapiens",
"pvalue_threshold": 0.05,
"output_path": "pathways/reactome/"
}' > reactome_input.json
smarts tool run reactome_enrichment --input @reactome_input.json
# Download the full results table
smarts file download pathways/reactome/ ./pathways/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}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
const result = await client.tools.run('kegg_pathway_diagram', {
input: {
pathwayId: 'hsa05200',
highlightGenes: ['TP53', 'KRAS', 'EGFR', 'MYC'],
workspaceId: workspace.id,
outputPath: 'diagrams/',
},
});
const diagram = await client.files.download(result.diagramPath, workspace.id, './diagrams/');
console.log('Pathway image saved to', diagram);curl -X POST https://api.smarts.bio/v1/tools/kegg_pathway_diagram/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"input": {
"pathway_id": "hsa05200",
"highlight_genes": ["TP53", "KRAS", "EGFR", "MYC"],
"workspace_id": "ws_abc123",
"output_path": "diagrams/"
}
}' | jq '.diagram_path'# Retrieve a colour-highlighted KEGG pathway diagram
echo '{
"pathway_id": "hsa05200",
"highlight_genes": ["TP53", "KRAS", "EGFR", "MYC"],
"output_path": "diagrams/"
}' > diagram_input.json
smarts tool run kegg_pathway_diagram --input @diagram_input.json
# Download the pathway image
smarts file download diagrams/ ./diagrams/