[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71H6PEM9MHNT0MRRTTP90E5":3,"skill-same:01M71H6PEM9MHNT0MRRTTP90E5":88},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":47,"commitSha":48,"skillDirectory":5,"forksCount":14,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M71H6PEM9MHNT0MRRTTP90E5","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\".","agency-black\u002FSkills","agency-black","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F234862658?v=4","01M6HWVFPNGNR5N2CX9ECSAD57","agencia.black","01M719WF77BF3HN0N9FK1APEFY",0,"MIT","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fpathway-enrichment\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"pathway enrichment","enrichment","pathway","screen","run","sample","functional","scanpy","libraries","maps","scoring","analysis","gene-set","enrichr","ssgsea","multiple-testing","testing","which","ready","SET","2026-11-10 10:12:30",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:\n  version: \"1.0\"\n  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":44,"description":7},{"version":45,"skill-author":46},"1.0","K-Dense Inc.","main","681496e0662f4c45c4758fae9d4510ae87311bf2","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills","https:\u002F\u002Fgithub.com\u002Fagency-black","http:\u002F\u002Fwww.dogma.black","Las grandes ideas merecen una ejecución impecable. Construimos plataformas web, aplicaciones y ecosistemas digitales completos. Esta Trinidad es nuestro dogma.","2026-05-29 16:13:55",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add agency-black\u002FSkills --skill pathway-enrichment",{"tool":60,"command":61},"bunx","bunx skills add agency-black\u002FSkills --skill pathway-enrichment",{"tool":63,"command":64},"pnpm","pnpm dlx skills add agency-black\u002FSkills --skill pathway-enrichment","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fpathway-enrichment\u002FSKILL.md",true,[68,74,78,82],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fdatabases-and-gene-sets.md","REFERENCE","参考文档",6418,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fpathway-enrichment\u002Freferences\u002Fdatabases-and-gene-sets.md",{"path":75,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fgseapy.md",7720,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fpathway-enrichment\u002Freferences\u002Fgseapy.md",{"path":79,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Finterpretation.md",5985,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fpathway-enrichment\u002Freferences\u002Finterpretation.md",{"path":83,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":86,"sourceHtmlUrl":87},"scripts\u002Frun_enrichment.py","SCRIPT","脚本",8550,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fpathway-enrichment\u002Fscripts\u002Frun_enrichment.py",[89,116,146,175,200,224],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":39},"01M71JZVZ0TVW7Z5DQBRWSBG8A","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fzarr-python\u002FSKILL.md",[],[96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115],"zarr python","python","zarr","arrays","Cloud Storage","remote","workflows","scientific","read","write","edit","parallel","dask","for","s3fs","use","numpy","s3","scientific computing","scale",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":120,"sourceHtmlUrl":121,"categories":122,"keywords":128,"publishedAt":39},"01M71JYXC5VAEJT8KXN5GRK32S","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fxvary-stock-research\u002FSKILL.md",[123],{"categoryNo":124,"categoryName":125,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000021","资料检索与研究","SCENARIO","使用场景",[129,130,131,132,133,134,135,97,136,102,30,137,138,139,140,141,142,143,144,145],"xvary","stock","research","xvary stock research","sec edgar","community","equity","thesis","code","Market","compare","market data","analyze","with","codex","cursor","2026",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":150,"licenseFileUrl":151,"sourceHtmlUrl":152,"categories":153,"keywords":160,"publishedAt":39},"01M71JVSDPDQ5040YBN6J1ASKY","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.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[154,157],{"categoryNo":155,"categoryName":156,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":158,"categoryName":159,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000009","前端开发",[161,35,162,109,163,164,165,166,167,168,169,142,170,171,172,173,174],"webapp","webapp testing","applications","local","frontend","debugging","toolkit","logs","browser","playwright","web","behavior","ui","screenshots",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":150,"licenseFileUrl":179,"sourceHtmlUrl":180,"categories":181,"keywords":183,"publishedAt":39},"01M71JV64CW7R6FYYK9JWWGW0X","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FSKILL.md",[182],{"categoryNo":158,"categoryName":159,"taxonomyType":126,"taxonomyTypeDesc":127},[184,185,186,171,187,188,189,109,190,191,165,192,111,193,194,195,196,197,198,199],"builder","artifacts builder","artifacts","web artifacts builder","single-file","css","Tailwind","ui components","single","file","components","react","multi","state","routing","state management",{"skillNo":201,"name":202,"nameZh":6,"description":203,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":204,"categories":205,"keywords":207,"publishedAt":39},"01M71JS4X2FRY41DE84DEP06MN","vercel-react-view-transitions","Guide for implementing smooth, native-feeling animations using React's View Transition API (`\u003CViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter\u002Fexit of components, animate list reorder, implement directional (forward\u002Fback) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fvercel-react-view-transitions\u002FSKILL.md",[206],{"categoryNo":158,"categoryName":159,"taxonomyType":126,"taxonomyTypeDesc":127},[195,208,209,210,211,212,213,214,215,189,216,217,218,219,220,194,221,222,223,27],"vercel react view transitions","view","react view transitions","vercel","transitions","shared","back","Animation","types","states","element","implementing","when","api","route","create",{"skillNo":225,"name":226,"nameZh":6,"description":227,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":228,"categories":229,"keywords":231,"publishedAt":39},"01M71JS1WZ1J4F9YVC2203JBJW","vercel-react-native-skills","React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fvercel-react-native-skills\u002FSKILL.md",[230],{"categoryNo":158,"categoryName":159,"taxonomyType":126,"taxonomyTypeDesc":127},[211,232,195,233,234,235,236,237,238,109,239,219,240,111,241,242,220,243,244,194],"vercel react native skills","react native","native","react native skills","modules","platform","animations","performance","triggers","react native components","apps","best practices","tasks"]