AGENT SKILL

metabolomics-pathway-enrichment

Load when running metabolite-name ORA against an explicit local pathway reference with BH-FDR; bundled pathway sets are for explicit demonstrations only. Skip m/z annotation (use metabolomics-annotation) and topology analysis or online pathway retrieval (use external mummichog / FELLA or database tools).

使用场景后端与接口
License 许可
Apache-2.0
最近更新
2026-10-08
Stars
★ 161
Forks
27

01 前言 Front Matter

name
metabolomics-pathway-enrichment
tags
[ "metabolomics", "pathway", "enrichment", "ora", "fisher", "demo" ]
trigger
metabolomics pathway, KEGG, MetaboAnalyst, enrichment, mummichog
description
Load when running metabolite-name ORA against an explicit local pathway reference with BH-FDR; bundled pathway sets are for explicit demonstrations only. Skip m/z annotation (use metabolomics-annotation) and topology analysis or online pathway retrieval (use external mummichog / FELLA or database tools).

02 资源文件 12

03 SKILL.md 正文

metabolomics-pathway-enrichment

When to use

Run metabolite-name ORA against explicit pathways or nine demo pathways. External mummichog/FELLA are required for their own methods.

Use from a step

import pandas as pd
import json
from pathlib import Path
from skills._sdk.notebook import load_skill, read_input, write_output
library = load_skill("metabolomics-pathway-enrichment")
data = read_input('features.csv', reader=pd.read_csv)
pathways = read_input('pathways.json', reader=lambda path: json.loads(Path(path).read_text()))
result = library.enrich(data['metabolite'], pathways=pathways)
write_output(result, 'tables/result.csv')

examples/example_step.py runs a seeded synthetic example through the step runner and writes a table and Figure. Computations return new DataFrames, leave the input unchanged and expose diagnostics through run_info(result). Plotting functions write no files.

API

<!-- api:begin generated from _api.py; regenerate with run.py api <skill dir> --write -->

enrich(data, *, method='ora', pathways=None)

Test case-insensitive exact metabolite-name overlap by hypergeometric ORA.

:param data: Iterable of metabolite names; duplicates count once in each overlap. :param method: CLI default ora, the only implemented method. :param pathways: Required mapping of pathway names to metabolites lists and kegg_id labels; use demo_pathways() only for demonstrations. :returns: A new table; BH FDR covers pathways with at least one hit, matching the CLI. :raises ValueError: A requested method is unimplemented or reference is empty.

demo_pathways()

Return an independent copy of the nine illustrative pathway sets.

:returns: A mapping for explicit demo use, not a complete pathway database.

run_info(data, *, keep=True)

Read diagnostics attached to a returned table.

:param data: DataFrame returned by this library. :param keep: Default True; use False in the CLI to remove diagnostics. :returns: An independent dictionary describing the run. :raises ValueError: The table carries no run_info.

enrichment_figure(data, *, n_top=10)

Plot the strongest pathway overlaps by adjusted p value.

:param data: Results returned by enrich. :param n_top: Default 10; maximum number of pathways shown. :returns: A matplotlib Figure. :raises KeyError: pathway or fdr is absent.

<!-- api:end -->

Methods and parameters

Matching is case-insensitive exact name equality, not substring matching. The background is the union of reference members. Hypergeometric survival probabilities and BH correction apply to pathways with at least one hit, matching the legacy CLI.

Gotchas

  • enrich requires explicit pathways= and implements only ora. Missing reference data and fella/mummichog requests fail. demo_pathways() explicitly selects the nine illustrative sets; never use these as biological evidence.
  • tables/pathway_enrichment.csv has a stable schema even with no overlap. result.json records the reference scope in data.run_info.reference_scope.

Inputs and outputs

CSV input; tables/pathway_enrichment.csv, report.md and result.json. Demo mode also writes its synthetic input CSV at the output root. Real input also requires a JSON reference: {"pathway name": {"kegg_id": "identifier", "metabolites": ["glucose", "pyruvate"]}}. The function library returns objects; the CLI and step own file writes.

CLI

python skills/metabolomics/metabolomics-pathway-enrichment/met_pathway.py --demo --output /tmp/metabolomics_pathway_enrichment
python skills/metabolomics/metabolomics-pathway-enrichment/met_pathway.py --input features.csv --pathway-file pathways.json --output /tmp/metabolomics_pathway_real

See also

Dependencies

numpy, pandas, scipy, matplotlib

04 同仓库更多 Skills

TianGzlab
TianGzlab/OmicsClaw

demo-skill

A fixture skill for the skill environment tests. Use it for nothing else.

Skill与智能体开发
★ 161
TianGzlab
TianGzlab/OmicsClaw

fake-domains

Test fixture for the golden deployment in tests/entry. Load never; it has no script.

★ 161
TianGzlab
TianGzlab/OmicsClaw

replace-me-skill

Load when copying this directory to bootstrap a new OmicsClaw skill. Skip when an existing skill already covers the request.

Skill与智能体开发
★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-velocity

Load when estimating RNA velocity on a spatial AnnData with `layers["spliced"]` + `layers["unspliced"]` via scVelo (stochastic / deterministic / dynamical) or veloVI (deep generative). Skip when input lacks the spliced/unspliced layers (must be quantified upstream by velocyto / kb-python / STARsolo); non-spatial scRNA velocity (use sc-velocity).

★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-trajectory

Load when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state + fate-probability), or Palantir (waypoint branch probabilities). Skip when the data has spliced/unspliced layers and you want velocity-driven dynamics (use spatial-velocity); non-spatial scRNA pseudotime (use sc-pseudotime).

★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-statistics

Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy. Skip when ranking spatially variable genes (use spatial-genes); tissue domain detection (use spatial-domains).

★ 161