[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75PBPF7NEFJ51N3VKSF3XCS":3,"skill-same:01M75PBPF7NEFJ51N3VKSF3XCS":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":33,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M75PBPF7NEFJ51N3VKSF3XCS","pathway-enrichment",null,"Run pathway and gene-set enrichment analysis on gene lists or ranked gene data, then interpret the results. Use whenever the user has a set of genes (differentially expressed genes from PyDESeq2\u002FScanpy, CRISPR-screen hits, cluster marker genes, proteomics hits) and wants to know which biological pathways, GO terms, or gene sets are over-represented or enriched. Covers over-representation analysis (ORA \u002F Enrichr \u002F Fisher \u002F hypergeometric), ranked Gene Set Enrichment Analysis (GSEA \u002F preranked), single-sample scoring (ssGSEA\u002FGSVA), and functional profiling via gseapy, g:Profiler, Enrichr libraries, MSigDB, GO, KEGG, Reactome, and WikiPathways — plus gene-ID mapping, choosing the right background universe, multiple-testing correction, redundancy reduction, dotplots\u002Fenrichment maps, and publication-ready tables. Use this for \"pathway analysis\", \"enrichment analysis\", \"GO enrichment\", \"KEGG\u002FReactome pathways\", \"GSEA\", \"over-representation\", \"functional annotation\", or \"what pathways are my genes in\".","stanfish06\u002Fskillquarium","stanfish06","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F93099613?v=4","01M75F1CK4ZW109ZK3T26VN52F","Zhiyuan","01M75F1CM53VH6F79DZ8GXKKES",12,"MIT","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fpathway-enrichment\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: pathway-enrichment\ndescription: Run pathway and gene-set enrichment analysis on gene lists or ranked gene data, then interpret the results. Use whenever the user has a set of genes (differentially expressed genes from PyDESeq2\u002FScanpy, CRISPR-screen hits, cluster marker genes, proteomics hits) and wants to know which biological pathways, GO terms, or gene sets are over-represented or enriched. Covers over-representation analysis (ORA \u002F Enrichr \u002F Fisher \u002F hypergeometric), ranked Gene Set Enrichment Analysis (GSEA \u002F preranked), single-sample scoring (ssGSEA\u002FGSVA), and functional profiling via gseapy, g:Profiler, Enrichr libraries, MSigDB, GO, KEGG, Reactome, and WikiPathways — plus gene-ID mapping, choosing the right background universe, multiple-testing correction, redundancy reduction, dotplots\u002Fenrichment maps, and publication-ready tables. Use this for \"pathway analysis\", \"enrichment analysis\", \"GO enrichment\", \"KEGG\u002FReactome pathways\", \"GSEA\", \"over-representation\", \"functional annotation\", or \"what pathways are my genes in\".\nlicense: MIT\nmetadata: {\"version\": \"1.0\", \"skill-author\": \"K-Dense Inc.\"}\n---\n\n# Pathway Enrichment\n\n## Overview\n\nEnrichment analysis answers \"what biology is over-represented in my genes?\" It is the standard last step after differential expression, a screen, or clustering. There are two core methods, and choosing correctly is the single most important decision:\n\n- **ORA (over-representation analysis)** — take a *thresholded* gene list (e.g., padj \u003C 0.05) and test which gene sets it overlaps more than chance, using Fisher's exact \u002F hypergeometric tests. Tools: Enrichr, g:Profiler.\n- **GSEA (gene set enrichment analysis)** — take the *whole ranked list* of genes (no threshold) and test whether each gene set is concentrated toward the top or bottom. Preranked GSEA uses a per-gene score (e.g., the DESeq2 `stat`). Better when effects are broad and subtle.\n\nThis skill orchestrates these analyses, the gene-set databases behind them, and the interpretation pitfalls that make results wrong or unpublishable.\n\n## When to Use This Skill\n\nUse this skill when the user wants to:\n- Find enriched GO terms \u002F KEGG \u002F Reactome \u002F WikiPathways \u002F MSigDB Hallmark sets in a gene list.\n- Run GSEA \u002F preranked GSEA on DESeq2, edgeR, limma, or Scanpy `rank_genes_groups` output.\n- Score pathway activity per sample\u002Fcell (ssGSEA, GSVA).\n- Interpret, deduplicate, and visualize enrichment results, or build a publication table\u002Ffigure.\n- Decide between ORA and GSEA, pick gene-set libraries, choose a background, or fix gene-ID problems.\n\nFor quick one-off Enrichr lookups the `gget` skill (`gget enrichr`) is lighter weight; for raw pathway\u002Finteraction APIs (Reactome, KEGG, STRING) see the `database-lookup` skill. Use **this** skill for full, defensible enrichment workflows.\n\n## Choosing the Right Method\n\n| Situation | Method | Tool \u002F entry point |\n|-----------|--------|--------------------|\n| You have a discrete hit list (DE genes, screen hits, cluster markers) | **ORA** | `gp.enrichr(...)` or g:Profiler |\n| You have a full ranked list (every tested gene + a score) | **Preranked GSEA** | `gp.prerank(...)` |\n| You have an expression matrix + class labels | **GSEA** | `gp.gsea(...)` |\n| You want a pathway score per sample\u002Fcell | **ssGSEA \u002F GSVA** | `gp.ssgsea(...)`, `gp.gsva(...)` |\n| You need a custom background or 500+ organisms | **ORA with custom domain** | g:Profiler (`domain_scope='custom'`) |\n| You want TF \u002F signaling *activity* (PROGENy, DoRothEA) | activity inference | see `references\u002Fdatabases-and-gene-sets.md` (decoupler) |\n\nWhen in doubt: a thresholded list → ORA; a ranked table with scores → GSEA. Never threshold a list and then feed it to GSEA — that discards the ranking GSEA depends on.\n\n## Setup\n\n```bash\nuv pip install gseapy gprofiler-official\n# gseapy pulls pandas, numpy, scipy, matplotlib. Network access is needed for\n# Enrichr, g:Profiler, and MSigDB downloads. For fully offline ORA, use a local\n# GMT file with gp.enrich() (see references\u002Fgseapy.md).\n```\n\nVerify and list available gene-set libraries (names change over time — never hardcode blindly):\n\n```python\nimport gseapy as gp\nnames = gp.get_library_name(organism=\"human\")   # 200+ Enrichr libraries\nprint([n for n in names if \"Reactome\" in n or \"KEGG\" in n or \"Hallmark\" in n])\n```\n\n## Quick Start\n\n### ORA on a hit list (gseapy + Enrichr)\n\n```python\nimport gseapy as gp\n\n# Enrichr libraries expect HGNC gene SYMBOLS (human: UPPERCASE). Map IDs first if needed.\ngenes = [g.strip() for g in open(\"deg_symbols.txt\") if g.strip()]\n\nenr = gp.enrichr(\n    gene_list=genes,\n    gene_sets=[\"MSigDB_Hallmark_2020\", \"GO_Biological_Process_2023\",\n               \"KEGG_2021_Human\", \"Reactome_2022\"],\n    organism=\"human\",\n    outdir=None,            # in-memory; set a path to also write tables\u002Fplots\n)\nres = enr.results\nsig = res[res[\"Adjusted P-value\"] \u003C 0.05].sort_values(\"Adjusted P-value\")\nprint(sig[[\"Gene_set\", \"Term\", \"Overlap\", \"Adjusted P-value\", \"Combined Score\", \"Genes\"]].head(20))\n```\n\n### Preranked GSEA from DESeq2 results\n\n```python\nimport gseapy as gp\nimport pandas as pd\n\nres = pd.read_csv(\"deseq2_results.csv\", index_col=0)   # index = gene symbols\n# Rank by the test statistic (sign = direction, magnitude = evidence). This is\n# more stable than ranking by log2FoldChange, which is noisy for low-count genes.\nrnk = res[\"stat\"].dropna().sort_values(ascending=False)\nrnk.index = rnk.index.str.upper()\nrnk = rnk[~rnk.index.duplicated(keep=\"first\")]\n\npre = gp.prerank(\n    rnk=rnk,\n    gene_sets=[\"MSigDB_Hallmark_2020\", \"GO_Biological_Process_2023\"],\n    min_size=15, max_size=500,        # drop tiny\u002Fhuge sets (noisy or generic)\n    permutation_num=1000, seed=123,   # seed = reproducible p-values\n    threads=4, outdir=None,\n)\nout = pre.res2d.sort_values(\"FDR q-val\")\nprint(out[[\"Term\", \"ES\", \"NES\", \"NOM p-val\", \"FDR q-val\", \"Lead_genes\"]].head(20))\n```\n\nIf you have no `stat` column, build the rank from `sign(log2FoldChange) * -log10(pvalue)`.\n\n## Core Workflow\n\nFor a defensible analysis, work through these steps. The middle steps (ID type, background) are where results most often silently go wrong.\n\n### Step 1 — Pin down inputs and pick the method\nConfirm: which genes, what organism, is there a per-gene score (→ GSEA) or just a list (→ ORA), and what comparison they represent (direction matters for interpretation).\n\n### Step 2 — Get gene IDs into the right namespace\nEnrichr\u002FMSigDB libraries are keyed by **gene symbols** (human UPPERCASE, mouse Title-case). If you have Ensembl\u002FEntrez IDs, convert first. See `references\u002Fdatabases-and-gene-sets.md` for `gp.Biomart`, g:Profiler `g:Convert`, and `mygene`. A silent ID mismatch is the #1 cause of \"nothing is significant\".\n\n### Step 3 — Choose gene-set libraries to match the question\nHallmark (broad themes) → GO:BP (mechanism) → KEGG\u002FReactome\u002FWikiPathways (curated pathways) → C7 (immune), etc. Don't run 50 libraries; pick 2–4 that fit the biology. Catalog and selection guidance: `references\u002Fdatabases-and-gene-sets.md`.\n\n### Step 4 — Set the background universe (ORA only)\nThe background must be the genes that *could* have been detected in your assay (e.g., all expressed\u002Ftested genes), not the whole genome. The wrong background inflates significance. Enrichr uses a fixed background; when background matters, use g:Profiler with `domain_scope='custom'` + your `background`, or `gp.enrich()` with an explicit background. Rationale in `references\u002Finterpretation.md`.\n\n### Step 5 — Run the analysis\nUse the Quick Start patterns or the bundled `scripts\u002Frun_enrichment.py`. For GSEA always set a `seed` and report `permutation_num`.\n\n### Step 6 — Filter on adjusted p-values\nUse `Adjusted P-value` (ORA, Benjamini–Hochberg) or `FDR q-val` (GSEA), not raw p-values. Typical cutoff 0.05; also check the overlap\u002Fgene count so a \"hit\" isn't 1 gene out of a 2000-gene set.\n\n### Step 7 — Visualize\nDotplots, bar plots, enrichment maps, and GSEA running-score plots are built into gseapy (`gp.dotplot`, `gp.barplot`, `gp.enrichment_map`, `gp.gseaplot`). See `references\u002Fgseapy.md`.\n\n### Step 8 — Reduce redundancy and interpret\nGO especially returns many near-duplicate terms. Collapse with an enrichment map (term–term similarity), leading-edge overlap, or parent terms, and report representative terms. Interpretation framework and a publication-table format are in `references\u002Finterpretation.md`.\n\n## Helper Script\n\n`scripts\u002Frun_enrichment.py` runs ORA or GSEA end-to-end and writes a results table plus a dotplot, handling the boilerplate (symbol cleanup, dedup, NA removal, rank construction from a DESeq2 table, per-library FDR filtering).\n\n```bash\n# ORA from a hit list (one gene symbol per line)\npython scripts\u002Frun_enrichment.py ora \\\n  --genes deg_symbols.txt \\\n  --libraries MSigDB_Hallmark_2020 GO_Biological_Process_2023 KEGG_2021_Human \\\n  --organism human --outdir results\u002F\n\n# Preranked GSEA from a DESeq2 results CSV (auto-builds the rank from `stat`)\npython scripts\u002Frun_enrichment.py gsea \\\n  --deseq2 deseq2_results.csv \\\n  --libraries MSigDB_Hallmark_2020 GO_Biological_Process_2023 \\\n  --organism human --outdir results\u002F --seed 123\n\n# Preranked GSEA from an explicit 2-column rank file (gene,score)\npython scripts\u002Frun_enrichment.py gsea --rnk ranked_genes.csv --outdir results\u002F\n```\n\nRun `python scripts\u002Frun_enrichment.py --help` for all options (background file, FDR cutoff, min\u002Fmax set size, permutations).\n\n## Common Pitfalls\n\nThese cause most wrong or irreproducible results:\n\n1. **Gene-ID \u002F organism mismatch** — symbols vs Ensembl, human vs mouse casing. Map IDs and set `organism` correctly, or matches silently drop to ~zero.\n2. **Wrong background (ORA)** — using the whole genome instead of the tested\u002Fexpressed gene set inflates p-values. Set a custom background when it matters.\n3. **Thresholding before GSEA** — GSEA needs the *full* ranked list; only ORA uses a cut list.\n4. **Ranking GSEA by log2FoldChange alone** — unstable for low-count genes; prefer `stat` or `sign(LFC) * -log10(p)`.\n5. **Multiple-testing across libraries** — FDR is computed *within* a library; running many libraries multiplies tests. Report per-library FDR and stay conservative.\n6. **Redundant GO terms** — don't report 40 variants of the same term; collapse and show representatives.\n7. **Significance ≠ relevance** — check the overlap count and gene-set size; tiny sets reach significance trivially.\n8. **List too short\u002Flong for ORA** — \u003C10 genes is underpowered; >2000 loses specificity (consider GSEA instead).\n9. **No reproducibility metadata** — Enrichr\u002FGO libraries are versioned and drift over time. Record library names+date and set a GSEA `seed`.\n\n## Integration with Other Skills\n\n- **Upstream (where genes come from):** `pydeseq2` (DE genes + `stat` for GSEA), `scanpy` (`rank_genes_groups` markers \u002F scores), `depmap`\u002F`pytdc` (screen hits), proteomics skills (`pyopenms`, `matchms`).\n- **Databases \u002F IDs:** `database-lookup` (Reactome, KEGG, STRING, Gene Ontology APIs), `gget` (`gget enrichr` quick path, `gget info` for ID mapping), `bioservices`.\n- **Downstream:** `scientific-visualization` (custom figures), `networkx` (enrichment-map graphs), `scientific-writing` \u002F `literature-review` (interpret and cite), `statistical-analysis` (multiple-testing details).\n\n## Reference Files\n\nRead the relevant file when you need depth:\n\n- `references\u002Fgseapy.md` — full gseapy API: `enrichr`, offline `enrich`, `prerank`, `gsea`, `ssgsea`, `gsva`, `Msigdb`, `Biomart`, `get_library_name`\u002F`read_gmt`, every plot, result-column meanings, GMT\u002Foffline usage, and troubleshooting (rate limits, empty results).\n- `references\u002Fdatabases-and-gene-sets.md` — GO, KEGG, Reactome, WikiPathways, MSigDB collections, Enrichr library naming, g:Profiler sources, organism handling, gene-ID conversion, library selection by question, and pointers to Reactome\u002FSTRING APIs and decoupler activity inference.\n- `references\u002Finterpretation.md` — ORA vs GSEA statistics, background-universe choice, multiple-testing methods (BH vs g:SCS vs Bonferroni), leading-edge genes, redundancy reduction, effect vs significance, a publication-table template, and reproducibility checklist.\n\n## Resources\n\n- gseapy docs: https:\u002F\u002Fgseapy.readthedocs.io\u002F · repo: https:\u002F\u002Fgithub.com\u002Fzqfang\u002FGSEApy\n- g:Profiler: https:\u002F\u002Fbiit.cs.ut.ee\u002Fgprofiler\u002F · Python client: https:\u002F\u002Fpypi.org\u002Fproject\u002Fgprofiler-official\u002F\n- Enrichr: https:\u002F\u002Fmaayanlab.cloud\u002FEnrichr\u002F · MSigDB: https:\u002F\u002Fwww.gsea-msigdb.org\u002Fgsea\u002Fmsigdb\u002F\n- GSEA method: Subramanian et al. (2005) PNAS, DOI: 10.1073\u002Fpnas.0506580102\n","# Pathway Enrichment\n\n## Overview\n\nEnrichment analysis answers \"what biology is over-represented in my genes?\" It is the standard last step after differential expression, a screen, or clustering. There are two core methods, and choosing correctly is the single most important decision:\n\n- **ORA (over-representation analysis)** — take a *thresholded* gene list (e.g., padj \u003C 0.05) and test which gene sets it overlaps more than chance, using Fisher's exact \u002F hypergeometric tests. Tools: Enrichr, g:Profiler.\n- **GSEA (gene set enrichment analysis)** — take the *whole ranked list* of genes (no threshold) and test whether each gene set is concentrated toward the top or bottom. Preranked GSEA uses a per-gene score (e.g., the DESeq2 `stat`). Better when effects are broad and subtle.\n\nThis skill orchestrates these analyses, the gene-set databases behind them, and the interpretation pitfalls that make results wrong or unpublishable.\n\n## When to Use This Skill\n\nUse this skill when the user wants to:\n- Find enriched GO terms \u002F KEGG \u002F Reactome \u002F WikiPathways \u002F MSigDB Hallmark sets in a gene list.\n- Run GSEA \u002F preranked GSEA on DESeq2, edgeR, limma, or Scanpy `rank_genes_groups` output.\n- Score pathway activity per sample\u002Fcell (ssGSEA, GSVA).\n- Interpret, deduplicate, and visualize enrichment results, or build a publication table\u002Ffigure.\n- Decide between ORA and GSEA, pick gene-set libraries, choose a background, or fix gene-ID problems.\n\nFor quick one-off Enrichr lookups the `gget` skill (`gget enrichr`) is lighter weight; for raw pathway\u002Finteraction APIs (Reactome, KEGG, STRING) see the `database-lookup` skill. Use **this** skill for full, defensible enrichment workflows.\n\n## Choosing the Right Method\n\n| Situation | Method | Tool \u002F entry point |\n|-----------|--------|--------------------|\n| You have a discrete hit list (DE genes, screen hits, cluster markers) | **ORA** | `gp.enrichr(...)` or g:Profiler |\n| You have a full ranked list (every tested gene + a score) | **Preranked GSEA** | `gp.prerank(...)` |\n| You have an expression matrix + class labels | **GSEA** | `gp.gsea(...)` |\n| You want a pathway score per sample\u002Fcell | **ssGSEA \u002F GSVA** | `gp.ssgsea(...)`, `gp.gsva(...)` |\n| You need a custom background or 500+ organisms | **ORA with custom domain** | g:Profiler (`domain_scope='custom'`) |\n| You want TF \u002F signaling *activity* (PROGENy, DoRothEA) | activity inference | see `references\u002Fdatabases-and-gene-sets.md` (decoupler) |\n\nWhen in doubt: a thresholded list → ORA; a ranked table with scores → GSEA. Never threshold a list and then feed it to GSEA — that discards the ranking GSEA depends on.\n\n## Setup\n\n```bash\nuv pip install gseapy gprofiler-official\n# gseapy pulls pandas, numpy, scipy, matplotlib. Network access is needed for\n# Enrichr, g:Profiler, and MSigDB downloads. For fully offline ORA, use a local\n# GMT file with gp.enrich() (see references\u002Fgseapy.md).\n```\n\nVerify and list available gene-set libraries (names change over time — never hardcode blindly):\n\n```python\nimport gseapy as gp\nnames = gp.get_library_name(organism=\"human\")   # 200+ Enrichr libraries\nprint([n for n in names if \"Reactome\" in n or \"KEGG\" in n or \"Hallmark\" in n])\n```\n\n## Quick Start\n\n### ORA on a hit list (gseapy + Enrichr)\n\n```python\nimport gseapy as gp\n\n# Enrichr libraries expect HGNC gene SYMBOLS (human: UPPERCASE). Map IDs first if needed.\ngenes = [g.strip() for g in open(\"deg_symbols.txt\") if g.strip()]\n\nenr = gp.enrichr(\n    gene_list=genes,\n    gene_sets=[\"MSigDB_Hallmark_2020\", \"GO_Biological_Process_2023\",\n               \"KEGG_2021_Human\", \"Reactome_2022\"],\n    organism=\"human\",\n    outdir=None,            # in-memory; set a path to also write tables\u002Fplots\n)\nres = enr.results\nsig = res[res[\"Adjusted P-value\"] \u003C 0.05].sort_values(\"Adjusted P-value\")\nprint(sig[[\"Gene_set\", \"Term\", \"Overlap\", \"Adjusted P-value\", \"Combined Score\", \"Genes\"]].head(20))\n```\n\n### Preranked GSEA from DESeq2 results\n\n```python\nimport gseapy as gp\nimport pandas as pd\n\nres = pd.read_csv(\"deseq2_results.csv\", index_col=0)   # index = gene symbols\n# Rank by the test statistic (sign = direction, magnitude = evidence). This is\n# more stable than ranking by log2FoldChange, which is noisy for low-count genes.\nrnk = res[\"stat\"].dropna().sort_values(ascending=False)\nrnk.index = rnk.index.str.upper()\nrnk = rnk[~rnk.index.duplicated(keep=\"first\")]\n\npre = gp.prerank(\n    rnk=rnk,\n    gene_sets=[\"MSigDB_Hallmark_2020\", \"GO_Biological_Process_2023\"],\n    min_size=15, max_size=500,        # drop tiny\u002Fhuge sets (noisy or generic)\n    permutation_num=1000, seed=123,   # seed = reproducible p-values\n    threads=4, outdir=None,\n)\nout = pre.res2d.sort_values(\"FDR q-val\")\nprint(out[[\"Term\", \"ES\", \"NES\", \"NOM p-val\", \"FDR q-val\", \"Lead_genes\"]].head(20))\n```\n\nIf you have no `stat` column, build the rank from `sign(log2FoldChange) * -log10(pvalue)`.\n\n## Core Workflow\n\nFor a defensible analysis, work through these steps. The middle steps (ID type, background) are where results most often silently go wrong.\n\n### Step 1 — Pin down inputs and pick the method\nConfirm: which genes, what organism, is there a per-gene score (→ GSEA) or just a list (→ ORA), and what comparison they represent (direction matters for interpretation).\n\n### Step 2 — Get gene IDs into the right namespace\nEnrichr\u002FMSigDB libraries are keyed by **gene symbols** (human UPPERCASE, mouse Title-case). If you have Ensembl\u002FEntrez IDs, convert first. See `references\u002Fdatabases-and-gene-sets.md` for `gp.Biomart`, g:Profiler `g:Convert`, and `mygene`. A silent ID mismatch is the #1 cause of \"nothing is significant\".\n\n### Step 3 — Choose gene-set libraries to match the question\nHallmark (broad themes) → GO:BP (mechanism) → KEGG\u002FReactome\u002FWikiPathways (curated pathways) → C7 (immune), etc. Don't run 50 libraries; pick 2–4 that fit the biology. Catalog and selection guidance: `references\u002Fdatabases-and-gene-sets.md`.\n\n### Step 4 — Set the background universe (ORA only)\nThe background must be the genes that *could* have been detected in your assay (e.g., all expressed\u002Ftested genes), not the whole genome. The wrong background inflates significance. Enrichr uses a fixed background; when background matters, use g:Profiler with `domain_scope='custom'` + your `background`, or `gp.enrich()` with an explicit background. Rationale in `references\u002Finterpretation.md`.\n\n### Step 5 — Run the analysis\nUse the Quick Start patterns or the bundled `scripts\u002Frun_enrichment.py`. For GSEA always set a `seed` and report `permutation_num`.\n\n### Step 6 — Filter on adjusted p-values\nUse `Adjusted P-value` (ORA, Benjamini–Hochberg) or `FDR q-val` (GSEA), not raw p-values. Typical cutoff 0.05; also check the overlap\u002Fgene count so a \"hit\" isn't 1 gene out of a 2000-gene set.\n\n### Step 7 — Visualize\nDotplots, bar plots, enrichment maps, and GSEA running-score plots are built into gseapy (`gp.dotplot`, `gp.barplot`, `gp.enrichment_map`, `gp.gseaplot`). See `references\u002Fgseapy.md`.\n\n### Step 8 — Reduce redundancy and interpret\nGO especially returns many near-duplicate terms. Collapse with an enrichment map (term–term similarity), leading-edge overlap, or parent terms, and report representative terms. Interpretation framework and a publication-table format are in `references\u002Finterpretation.md`.\n\n## Helper Script\n\n`scripts\u002Frun_enrichment.py` runs ORA or GSEA end-to-end and writes a results table plus a dotplot, handling the boilerplate (symbol cleanup, dedup, NA removal, rank construction from a DESeq2 table, per-library FDR filtering).\n\n```bash\n# ORA from a hit list (one gene symbol per line)\npython scripts\u002Frun_enrichment.py ora \\\n  --genes deg_symbols.txt \\\n  --libraries MSigDB_Hallmark_2020 GO_Biological_Process_2023 KEGG_2021_Human \\\n  --organism human --outdir results\u002F\n\n# Preranked GSEA from a DESeq2 results CSV (auto-builds the rank from `stat`)\npython scripts\u002Frun_enrichment.py gsea \\\n  --deseq2 deseq2_results.csv \\\n  --libraries MSigDB_Hallmark_2020 GO_Biological_Process_2023 \\\n  --organism human --outdir results\u002F --seed 123\n\n# Preranked GSEA from an explicit 2-column rank file (gene,score)\npython scripts\u002Frun_enrichment.py gsea --rnk ranked_genes.csv --outdir results\u002F\n```\n\nRun `python scripts\u002Frun_enrichment.py --help` for all options (background file, FDR cutoff, min\u002Fmax set size, permutations).\n\n## Common Pitfalls\n\nThese cause most wrong or irreproducible results:\n\n1. **Gene-ID \u002F organism mismatch** — symbols vs Ensembl, human vs mouse casing. Map IDs and set `organism` correctly, or matches silently drop to ~zero.\n2. **Wrong background (ORA)** — using the whole genome instead of the tested\u002Fexpressed gene set inflates p-values. Set a custom background when it matters.\n3. **Thresholding before GSEA** — GSEA needs the *full* ranked list; only ORA uses a cut list.\n4. **Ranking GSEA by log2FoldChange alone** — unstable for low-count genes; prefer `stat` or `sign(LFC) * -log10(p)`.\n5. **Multiple-testing across libraries** — FDR is computed *within* a library; running many libraries multiplies tests. Report per-library FDR and stay conservative.\n6. **Redundant GO terms** — don't report 40 variants of the same term; collapse and show representatives.\n7. **Significance ≠ relevance** — check the overlap count and gene-set size; tiny sets reach significance trivially.\n8. **List too short\u002Flong for ORA** — \u003C10 genes is underpowered; >2000 loses specificity (consider GSEA instead).\n9. **No reproducibility metadata** — Enrichr\u002FGO libraries are versioned and drift over time. Record library names+date and set a GSEA `seed`.\n\n## Integration with Other Skills\n\n- **Upstream (where genes come from):** `pydeseq2` (DE genes + `stat` for GSEA), `scanpy` (`rank_genes_groups` markers \u002F scores), `depmap`\u002F`pytdc` (screen hits), proteomics skills (`pyopenms`, `matchms`).\n- **Databases \u002F IDs:** `database-lookup` (Reactome, KEGG, STRING, Gene Ontology APIs), `gget` (`gget enrichr` quick path, `gget info` for ID mapping), `bioservices`.\n- **Downstream:** `scientific-visualization` (custom figures), `networkx` (enrichment-map graphs), `scientific-writing` \u002F `literature-review` (interpret and cite), `statistical-analysis` (multiple-testing details).\n\n## Reference Files\n\nRead the relevant file when you need depth:\n\n- `references\u002Fgseapy.md` — full gseapy API: `enrichr`, offline `enrich`, `prerank`, `gsea`, `ssgsea`, `gsva`, `Msigdb`, `Biomart`, `get_library_name`\u002F`read_gmt`, every plot, result-column meanings, GMT\u002Foffline usage, and troubleshooting (rate limits, empty results).\n- `references\u002Fdatabases-and-gene-sets.md` — GO, KEGG, Reactome, WikiPathways, MSigDB collections, Enrichr library naming, g:Profiler sources, organism handling, gene-ID conversion, library selection by question, and pointers to Reactome\u002FSTRING APIs and decoupler activity inference.\n- `references\u002Finterpretation.md` — ORA vs GSEA statistics, background-universe choice, multiple-testing methods (BH vs g:SCS vs Bonferroni), leading-edge genes, redundancy reduction, effect vs significance, a publication-table template, and reproducibility checklist.\n\n## Resources\n\n- gseapy docs: https:\u002F\u002Fgseapy.readthedocs.io\u002F · repo: https:\u002F\u002Fgithub.com\u002Fzqfang\u002FGSEApy\n- g:Profiler: https:\u002F\u002Fbiit.cs.ut.ee\u002Fgprofiler\u002F · Python client: https:\u002F\u002Fpypi.org\u002Fproject\u002Fgprofiler-official\u002F\n- Enrichr: https:\u002F\u002Fmaayanlab.cloud\u002FEnrichr\u002F · MSigDB: https:\u002F\u002Fwww.gsea-msigdb.org\u002Fgsea\u002Fmsigdb\u002F\n- GSEA method: Subramanian et al. (2005) PNAS, DOI: 10.1073\u002Fpnas.0506580102\n",{"name":5,"license":15,"metadata":24,"description":7},{"version":25,"skill-author":26},"1.0","K-Dense Inc.","master","49e49abf2f670d429e0b7e2c0349739c3fdd5cbe","skills\u002Fpathway-enrichment",5,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium","https:\u002F\u002Fgithub.com\u002Fstanfish06","https:\u002F\u002Fwww.stanfish.dev\u002F","2026-11-14 21:31:37",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add stanfish06\u002Fskillquarium --skill pathway-enrichment",{"tool":41,"command":42},"bunx","bunx skills add stanfish06\u002Fskillquarium --skill pathway-enrichment",{"tool":44,"command":45},"pnpm","pnpm dlx skills add stanfish06\u002Fskillquarium --skill pathway-enrichment","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fpathway-enrichment\u002FSKILL.md",true,[49,55,59,63],{"path":50,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":53,"sourceHtmlUrl":54},"references\u002Fdatabases-and-gene-sets.md","REFERENCE","参考文档",6418,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fpathway-enrichment\u002Freferences\u002Fdatabases-and-gene-sets.md",{"path":56,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Fgseapy.md",7720,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fpathway-enrichment\u002Freferences\u002Fgseapy.md",{"path":60,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Finterpretation.md",5985,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fpathway-enrichment\u002Freferences\u002Finterpretation.md",{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"scripts\u002Frun_enrichment.py","SCRIPT","脚本",8550,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fpathway-enrichment\u002Fscripts\u002Frun_enrichment.py",[70,77,86,93,100,107],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M76ZJTRVA456GD7K8Y3EP82H","zarr-python","Stores and queries chunked N-D scientific arrays with Zarr-Python 3, including codecs, sharding, S3\u002FGCS storage, and NumPy\u002FDask\u002FXarray integration. Use for array layout, bounded I\u002FO, format migration, or scientific metadata preservation.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":82,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M76ZJQZ15Q1HKC5V85NHE325","yeet","Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M76ZJ8ASZ4QYQ70Y6SBA4Z4S","xarray","N-dimensional labeled arrays and datasets in Python. Built on top of NumPy and Dask. It introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, making data analysis in physical sciences more intuitive and less error-prone. Use for working with multi-dimensional scientific data, NetCDF\u002FGRIB\u002FZarr files, climate\u002Fweather\u002Foceanographic datasets, remote sensing, geospatial imaging, large out-of-memory datasets with Dask, and labeled array operations.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fxarray\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M76ZHFBXD6VXPQ02VCEG202B","writing-mstest-tests","Use when asked to fix, rewrite, update, improve, modernize, show corrected code for, or explain existing MSTest tests or MSTest-specific configuration. Use for \"review\" when corrected code or edits are wanted, even for one pasted assertion or passing tests with bad failure output. Covers expected\u002Factual labels; generic Boolean, collection, string, numeric, null, identity, exception, hard-cast, and object[] checks; TestContext\u002Flifecycle; timeout\u002Fcancellation; OS\u002FCI conditions, retry, cleanup, parallelization, MSTest.Sdk project setup, and MSTESTxxxx. Honor the installed MSTest version. DO NOT USE to design new test cases (code-testing), perform report-only audits, create project files rather than explain MSTest setup, run tests, migrate frameworks, or handle non-MSTest\u002Fnon-.NET code.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwriting-mstest-tests\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M76ZDFDF4N88RH6HSYGS7GP2","wgs-prs","End-to-end WGS to polygenic risk score pipeline. Takes paired-end FASTQ files (or a pre-existing VCF) through nf-core\u002Fsarek for variant calling, applies VCF QC (normalisation, hard filtering, Ti\u002FTv and Het\u002FHom checks), then computes polygenic risk scores via the PGS Catalog. Fills the FASTQ to VCF gap upstream of the gwas-prs skill.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwgs-prs\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":111,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M76ZCC1SC68J42QK4MDC8RCG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[]]