metabolomics-pathway-enrichment
When to use
The user has a CSV listing metabolites of interest (e.g.
significant features from metabolomics-de or metabolomics-statistics,
joined with their HMDB / KEGG names) and wants over-representation
enrichment via Fisher's exact test, with BH-adjusted FDR.
This is a demo-only enrichment. The pathway database is the
hard-coded 9-pathway DEMO_METABOLIC_PATHWAYS dict at
met_pathway.py:45-104 (e.g. glycolysis, TCA cycle, amino-acid
metabolism). There is NO CLI flag to load real KEGG / Reactome /
SMPDB. For production metabolomics enrichment, route to
external tools (MetaboAnalystR, mummichog, FELLA) or send the
metabolite list through bulkrna-enrichment after gene-mapping.
Inputs & Outputs
| Input |
Format |
Required |
| Metabolite list |
.csv with metabolite column (or any first column treated as metabolite names) |
yes (unless --demo) |
| Method |
--method {ora,mummichog,fella} (only ora is actually implemented) |
no |
| Output |
Path |
Notes |
| Pathway enrichment |
tables/pathway_enrichment.csv |
per-pathway pvalue, fdr (BH-adjusted), overlap counts |
| Report |
report.md + result.json |
summary["n_significant"] (FDR < 0.05); summary["n_pathways_tested"] = 9 |
Flow
- Load CSV (
--input <metabolites.csv>) or generate a demo at output_dir/<demo>.csv (met_pathway.py:300).
- Pick the metabolite-list column:
metabolite if present, otherwise the first column (met_pathway.py:307).
- For each pathway in
DEMO_METABOLIC_PATHWAYS (met_pathway.py:45), run Fisher's exact test (hypergeometric) (met_pathway.py:132-200); apply BH FDR adjustment (:198).
- Write
tables/pathway_enrichment.csv (met_pathway.py:314) + report.md + result.json.
Gotchas
- Pathway database is HARD-CODED 9 demo pathways.
met_pathway.py:45-104 defines DEMO_METABOLIC_PATHWAYS (e.g. glycolysis, TCA cycle, urea cycle). The n_pathways_tested = 9 in result.json (:320) is constant. For real enrichment, use MetaboAnalystR / mummichog / FELLA externally.
--method mummichog and --method fella are RECORDED-ONLY. met_pathway.py:293 accepts choices=["ora", "mummichog", "fella"] but pathway_enrichment (:132-200) ignores the method parameter — only ORA (Fisher's exact + BH FDR) is implemented. Calling with --method mummichog produces ORA results plus a misleading method=mummichog label in result.json.
- Metabolite-name matching is CASE-INSENSITIVE substring.
met_pathway.py:165 lower-cases both query and pathway-member names. glucose, Glucose, D-Glucose all match a pathway entry D-Glucose — but Hexose will NOT.
- Column auto-detection:
metabolite first, else first column. met_pathway.py:307 uses met_col = "metabolite" if "metabolite" in df.columns else df.columns[0]. Pre-rename if your CSV has multiple ID columns (name, hmdb_id, kegg).
--input REQUIRED unless --demo. met_pathway.py:303 raises ValueError("--input required when not using --demo").
Key CLI
# Demo (9-pathway DEMO_METABOLIC_PATHWAYS)
python omicsclaw.py run metabolomics-pathway-enrichment --demo --output /tmp/path_demo
# Real metabolite list (CSV with `metabolite` column)
python omicsclaw.py run metabolomics-pathway-enrichment \
--input significant_metabolites.csv --output results/
# `--method mummichog` is accepted but produces ORA results regardless
python omicsclaw.py run metabolomics-pathway-enrichment \
--input significant_metabolites.csv --output results/ \
--method mummichog
See also
references/parameters.md — every CLI flag
references/methodology.md — Fisher's exact ORA, BH FDR, demo-DB caveats
references/output_contract.md — tables/pathway_enrichment.csv schema
- Adjacent skills:
metabolomics-de (upstream — significant feature list), metabolomics-statistics (upstream — multi-test backends), metabolomics-annotation (upstream — m/z → metabolite name mapping), proteomics-enrichment (parallel — same demo-only ORA pattern but for proteins)
Source: TianGzlab/OmicsClaw — distributed by TomeVault.
1---2name: metabolomics-pathway-enrichment3description: Load when running over-representation analysis (ORA) on a metabolite list via Fisher's exact test against a built-in 9-pathway DEMO dictionary, BH-FDR adjusted. Skip when needing real KEGG / Reactome (this skill is demo-only) or `mummichog` / `fella` topology methods (CLI accepts them but only ORA runs). Use when this capability is needed.4---56# metabolomics-pathway-enrichment78## When to use910The user has a CSV listing metabolites of interest (e.g.11significant features from `metabolomics-de` or `metabolomics-statistics`,12joined with their HMDB / KEGG names) and wants over-representation13enrichment via Fisher's exact test, with BH-adjusted FDR.1415**This is a demo-only enrichment.** The pathway database is the16hard-coded 9-pathway `DEMO_METABOLIC_PATHWAYS` dict at17`met_pathway.py:45-104` (e.g. glycolysis, TCA cycle, amino-acid18metabolism). There is NO CLI flag to load real KEGG / Reactome /19SMPDB. For production metabolomics enrichment, route to20external tools (MetaboAnalystR, mummichog, FELLA) or send the21metabolite list through `bulkrna-enrichment` after gene-mapping.2223## Inputs & Outputs2425| Input | Format | Required |26|---|---|---|27| Metabolite list | `.csv` with `metabolite` column (or any first column treated as metabolite names) | yes (unless `--demo`) |28| Method | `--method {ora,mummichog,fella}` (only `ora` is actually implemented) | no |2930| Output | Path | Notes |31|---|---|---|32| Pathway enrichment | `tables/pathway_enrichment.csv` | per-pathway `pvalue`, `fdr` (BH-adjusted), overlap counts |33| Report | `report.md` + `result.json` | `summary["n_significant"]` (FDR < 0.05); `summary["n_pathways_tested"]` = 9 |3435## Flow36371. Load CSV (`--input <metabolites.csv>`) or generate a demo at `output_dir/<demo>.csv` (`met_pathway.py:300`).382. Pick the metabolite-list column: `metabolite` if present, otherwise the first column (`met_pathway.py:307`).393. For each pathway in `DEMO_METABOLIC_PATHWAYS` (`met_pathway.py:45`), run Fisher's exact test (hypergeometric) (`met_pathway.py:132-200`); apply BH FDR adjustment (`:198`).404. Write `tables/pathway_enrichment.csv` (`met_pathway.py:314`) + `report.md` + `result.json`.4142## Gotchas4344- **Pathway database is HARD-CODED 9 demo pathways.** `met_pathway.py:45-104` defines `DEMO_METABOLIC_PATHWAYS` (e.g. glycolysis, TCA cycle, urea cycle). The `n_pathways_tested = 9` in `result.json` (`:320`) is constant. For real enrichment, use MetaboAnalystR / mummichog / FELLA externally.45- **`--method mummichog` and `--method fella` are RECORDED-ONLY.** `met_pathway.py:293` accepts `choices=["ora", "mummichog", "fella"]` but `pathway_enrichment` (`:132-200`) ignores the `method` parameter — only ORA (Fisher's exact + BH FDR) is implemented. Calling with `--method mummichog` produces ORA results plus a misleading `method=mummichog` label in `result.json`.46- **Metabolite-name matching is CASE-INSENSITIVE substring.** `met_pathway.py:165` lower-cases both query and pathway-member names. `glucose`, `Glucose`, `D-Glucose` all match a pathway entry `D-Glucose` — but `Hexose` will NOT.47- **Column auto-detection: `metabolite` first, else first column.** `met_pathway.py:307` uses `met_col = "metabolite" if "metabolite" in df.columns else df.columns[0]`. Pre-rename if your CSV has multiple ID columns (`name`, `hmdb_id`, `kegg`).48- **`--input` REQUIRED unless `--demo`.** `met_pathway.py:303` raises `ValueError("--input required when not using --demo")`.4950## Key CLI5152```bash53# Demo (9-pathway DEMO_METABOLIC_PATHWAYS)54python omicsclaw.py run metabolomics-pathway-enrichment --demo --output /tmp/path_demo5556# Real metabolite list (CSV with `metabolite` column)57python omicsclaw.py run metabolomics-pathway-enrichment \58 --input significant_metabolites.csv --output results/5960# `--method mummichog` is accepted but produces ORA results regardless61python omicsclaw.py run metabolomics-pathway-enrichment \62 --input significant_metabolites.csv --output results/ \63 --method mummichog64```6566## See also6768- `references/parameters.md` — every CLI flag69- `references/methodology.md` — Fisher's exact ORA, BH FDR, demo-DB caveats70- `references/output_contract.md` — `tables/pathway_enrichment.csv` schema71- Adjacent skills: `metabolomics-de` (upstream — significant feature list), `metabolomics-statistics` (upstream — multi-test backends), `metabolomics-annotation` (upstream — m/z → metabolite name mapping), `proteomics-enrichment` (parallel — same demo-only ORA pattern but for proteins)7273---74> Source: [TianGzlab/OmicsClaw](https://github.com/TianGzlab/OmicsClaw) — distributed by [TomeVault](https://tomevault.io).75<!-- tomevault:4.0:skill_md:2026-07-02 -->