proteomics-enrichment
Load for Fisher over-representation analysis of protein identifiers against caller-supplied pathways. Skip rank-based GSEA (use bulkrna-enrichment) or protein differential testing (use proteomics-de).
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 161
- Forks
- 27
01 前言 Front Matter
- name
- proteomics-enrichment
- tags
- [ "proteomics", "enrichment" ]
- trigger
- proteomics enrichment, pathway analysis, ORA
- description
- Load for Fisher over-representation analysis of protein identifiers against caller-supplied pathways. Skip rank-based GSEA (use bulkrna-enrichment) or protein differential testing (use proteomics-de).
02 资源文件 8
- 脚本_api.py4.0 KB
- 脚本examples/example_step.py555 B
- 脚本prot_enrichment.py5.7 KB
- 参考文档references/methodology.md332 B
- 参考文档references/output_contract.md272 B
- 参考文档references/parameters.md307 B
- 脚本tests/test_api.py698 B
- 脚本tests/test_cli.py969 B
03 SKILL.md 正文
proteomics-enrichment
When to use
ORA uses one-sided Fisher tests and BH correction. Pass an explicit pathway_db and a background_size matching the measured universe. Use existing search-engine tables; this skill does not search raw spectra.
Use from a step
from skills._sdk.notebook import load_skill, write_output
library = load_skill('proteomics-enrichment')
data = library.demo_data(random_state=42)
result = library.enrich(data['protein_id'].tolist(), pathway_db=library.demo_pathways())
write_output(result, 'tables/enrichment_results.csv')
For real data, use read_input and pass any read_table helper as reader=.
The executable examples/example_step.py also checks the result and writes a Figure.
API
<!-- api:begin generated from _api.py; regenerate with run.py api <skill dir> --write -->
enrich(genes: list[str], *, pathway_db: dict | None=None, background_size: int | None=None, method: str='ora') -> pd.DataFrame
Run one-sided Fisher tests with BH correction against an explicit pathway library.
:param genes: Protein or gene identifiers in the same identifier space as pathway_db. :param pathway_db: Required pathway-to-member mapping; no default biological database is assumed. :param background_size: CLI default None uses the input/library union plus at least one background-only member. :param method: CLI default ora is the only implemented method. :returns: Ranked pathway overlaps, odds ratios and adjusted p values. :raises ValueError: The library is absent, the method is invalid, or the background is too small.
run_info(table: pd.DataFrame, *, keep: bool=True) -> dict
Read enrichment diagnostics.
:param table: Output of enrich. :param keep: True preserves attrs; False removes diagnostics. :returns: A separate dictionary with library provenance and summary. :raises TypeError: The input is not a DataFrame.
enrichment_figure(table: pd.DataFrame, *, top_n: int=10)
Plot leading pathways by enrichment ratio.
:param table: Enrichment results sorted by p value. :param top_n: Display ten pathways by default; change for a larger result table. :returns: A matplotlib Figure without writing files. :raises KeyError: pathway or enrichment_ratio is absent.
demo_data(*, random_state: int=42) -> pd.DataFrame
Generate a synthetic significant-protein list.
:param random_state: CLI seed 42; change for another simulation. :returns: Eighteen example identifiers with simulated statistics. :raises ValueError: The seed is invalid.
demo_pathways() -> dict
Return the eight small illustrative pathway sets used by --demo.
:returns: A separate mapping, not a production pathway database. :raises RuntimeError: No runtime failures are expected.
<!-- api:end -->
Methods and parameters
ORA uses one-sided Fisher tests and BH correction. Pass an explicit pathway_db and a background_size matching the measured universe.
Functions return new DataFrames. run_info(result) reads diagnostic attrs;
use keep=False before serialization when those attrs are not needed.
Gotchas
- enrich requires pathway_db. demo_pathways contains eight illustrative sets and is only for demonstrations. The CLI requires --pathways for non-demo input; --species is recorded only.
demo_datauses seed 42, matching the CLI; every demo is synthetic.run_infolives in DataFrame attrs and is not preserved by CSV serialization.
Inputs and outputs
The CLI reads CSV tables and writes:
- tables/enrichment_results.csv
- report.md
- result.json
demo_proteins.csvis written only with--demo.
Functions return data and Figures without writing files. Steps own their outputs. Demo mode also writes its synthetic input when the original CLI used a file.
CLI
python skills/proteomics/proteomics-enrichment/prot_enrichment.py --demo --output /tmp/proteomics_enrichment
For real input replace --demo with --input <table>.
Non-demo enrichment also requires --pathways <pathways.json>, a pathway-to-members object.
See also
references/methodology.mdreferences/parameters.mdreferences/output_contract.mdproteomics-data-importfor protein-table normalization;proteomics-defor comparisons.
Dependencies
numpy, pandas, matplotlib, scipy
04 同仓库更多 Skills
demo-skill
A fixture skill for the skill environment tests. Use it for nothing else.
fake-domains
Test fixture for the golden deployment in tests/entry. Load never; it has no script.
replace-me-skill
Load when copying this directory to bootstrap a new OmicsClaw skill. Skip when an existing skill already covers the request.
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).
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).
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).