[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CV258BJ0ZJSFEJW9BB7NC9":3,"skill-same:01M7CV258BJ0ZJSFEJW9BB7NC9":63},{"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":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7CV258BJ0ZJSFEJW9BB7NC9","bio-pathway-gsea",null,"Tests a ranked gene vector for coordinated expression shifts in GO, KEGG, Reactome, or MSigDB gene sets with clusterProfiler's gseGO, gseKEGG, gsePathway, and GSEA (fgseaMultilevel engine), and scores per-sample pathway activity with ssGSEA and GSVA. Covers why a GSEA result is a deterministic function of three implicit choices (the ranking STATISTIC, the weight exponent p, and which LABELS are permuted), why the input must be a NAMED vector sorted DECREASING by a signed variance-calibrated metric (DESeq2 stat, limma t) not a raw p-value that erases direction, why preranked gene-permutation is anti-conservative for correlated sets (CAMERA with inter.gene.cor=NA is the fix), why nPerm silently downgrades the engine instead of erroring (eps governs tiny p), and why set.seed is required. Use when every gene carries a DE statistic, when a hard cutoff is arbitrary, or when ORA finds nothing. For gene-list ORA see go-enrichment; the ranking statistic comes from differential-expression\u002Fde-results.","mrsonord2240\u002Fopenscience-specialists","mrsonord2240","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F76487430?v=4","01M7CTEM40S43GSJZ9A3YCCXZK","Samuel Nord","01M7CTEM4K69JD1GBYNHVJ9ZP4",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fcrispr-screen-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-pathway-gsea\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-pathway-gsea\ndescription: Tests a ranked gene vector for coordinated expression shifts in GO, KEGG, Reactome, or MSigDB gene sets with clusterProfiler's gseGO, gseKEGG, gsePathway, and GSEA (fgseaMultilevel engine), and scores per-sample pathway activity with ssGSEA and GSVA. Covers why a GSEA result is a deterministic function of three implicit choices (the ranking STATISTIC, the weight exponent p, and which LABELS are permuted), why the input must be a NAMED vector sorted DECREASING by a signed variance-calibrated metric (DESeq2 stat, limma t) not a raw p-value that erases direction, why preranked gene-permutation is anti-conservative for correlated sets (CAMERA with inter.gene.cor=NA is the fix), why nPerm silently downgrades the engine instead of erroring (eps governs tiny p), and why set.seed is required. Use when every gene carries a DE statistic, when a hard cutoff is arbitrary, or when ORA finds nothing. For gene-list ORA see go-enrichment; the ranking statistic comes from differential-expression\u002Fde-results.\ntool_type: r\nprimary_tool: clusterProfiler\n---\n\n## Version Compatibility\n\nReference examples tested with: clusterProfiler 4.18.4+, org.Hs.eg.db 3.22+, msigdbr 26+, fgsea 1.36+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\ngseKEGG queries the live KEGG REST API, so the same code returns different results as KEGG updates; pin the run date. gseGO\u002FgsePathway and MSigDB GSEA use local annotation (`org.*.eg.db`, `reactome.db`, msigdbr) and are reproducible given the package version. The single source of truth for versions is this block, not headings.\n\n# Gene Set Enrichment Analysis (GSEA)\n\n**\"Which pathways shift coordinately across my full ranked gene list, with no cutoff?\"** -> Walk a weighted running-sum down the genome-wide ranking and test whether each gene set piles up at one END - because that score reports the structure of YOUR ranking, so the ranking metric and the permutation type, not the gene sets, decide the result.\n- R: `gseGO(geneList, OrgDb, ont)`, `gseKEGG(geneList, organism)`, `GSEA(geneList, TERM2GENE)`\n\nScope: threshold-free Functional Class Scoring (FCS) of a RANKED vector - the running-sum ES, the ranking-metric choice, the permutation null, NES\u002FFDR, the leading edge, and per-sample ssGSEA\u002FGSVA scores. A pre-selected unranked gene LIST -> go-enrichment (ORA). The ranking statistic source -> differential-expression\u002Fde-results. KEGG\u002FReactome\u002FWikiPathways database semantics -> kegg-pathways, reactome-pathways, wikipathways. Plots -> enrichment-visualization.\n\n## The Single Most Important Modern Insight -- A GSEA Result Is a Deterministic Function of Three Usually-Implicit Choices: the Ranking Statistic, the Weight Exponent p, and the Permuted Labels\n\nGSEA is not a discovery about biology - it is the running-sum's report on the ranking it was handed. The weighted enrichment score (Subramanian 2005; the default `exponent=1` weights each hit by the gene's statistic magnitude) asks exactly one question: do the members of a set pile up at one END of YOUR ranking. So the result is fixed by three decisions tutorials usually leave silent, and Wijesooriya 2022 found most published GSEA papers report none of them.\n\n1. **The ranking statistic IS the experiment.** Rank by a signed, variance-calibrated metric (DESeq2 `stat`, limma moderated `t`) - sign gives direction, variance-calibration sinks noisy low-information genes to the middle. Ranking by a RAW p-value erases the sign, so up- and down-regulated genes collapse together and NES becomes uninterpretable. Ranking by bare log2FC lets a handful of low-count genes with huge unstable fold changes hijack the leading edge. A bad ranking is faithfully reported as a ranking artifact.\n2. **The permutation type sets validity.** Phenotype (sample-label) permutation preserves the gene-gene correlation that co-regulated pathways are made of - it is the gold standard for type-I error control because it preserves that correlation, but needs the expression matrix and adequate n per group (~>=7); below that n its validity degrades. clusterProfiler\u002Ffgsea preranked are FORCED into GENE permutation, which treats genes as independent, destroys that correlation, and is ANTI-CONSERVATIVE: it returns \"significant\" pathways that are nothing but co-expression. Accept it, report it, and prefer CAMERA when the design matrix is available (full competitive\u002Fself-contained theory in the category README).\n3. **The honesty is bounded by reporting.** Log the ranking metric, the exponent p, the permutation type, the gene-set collection and its version\u002Fdate, the size filters, and the multiple-testing method. Without those, the result is unfalsifiable.\n\n## Tool Taxonomy\n\n| Method | Citation | Mechanism \u002F role | When |\n|--------|----------|------------------|------|\n| Preranked GSEA (gseGO\u002FgseKEGG\u002FGSEA) | Subramanian 2005 *PNAS* 102:15545; Mootha 2003 *Nat Genet* 34:267 | weighted running-sum ES over a ranked vector; gene-permutation null | the common case: a ranked statistic for all genes, no matrix |\n| fgsea engine | Korotkevich 2021 *bioRxiv* 060012 (preprint) | fgseaMultilevel; resolves tiny p accurately down to `eps` | the engine under `by='fgsea'` (default); what gives sub-1\u002Fnperm p-values |\n| Phenotype-permutation GSEA | Subramanian 2005 *PNAS* 102:15545 | shuffles sample labels; preserves gene-gene correlation | matrix + phenotype + ~>=7\u002Fgroup; the gold-standard competitive test |\n| CAMERA | Wu & Smyth 2012 *NAR* 40:e133 | competitive, VIF-corrects inter-gene correlation analytically - only with `inter.gene.cor = NA`; the default preset (0.01) gives no protection | matrix + design; want a correlation-honest competitive test |\n| ROAST \u002F fry | Wu 2010 *Bioinformatics* 26:2176 | self-contained rotation test; valid at any n | matrix + design, tiny n, \"is the set DE at all\" |\n| ssGSEA | Barbie 2009 *Nature* 462:108 | per-sample rank-based enrichment score | a per-sample pathway-activity matrix (no contrast test) |\n| GSVA | Hanzelmann 2013 *BMC Bioinformatics* 14:7 | unsupervised per-sample, per-set kernel\u002FCDF score | per-sample features for clustering\u002Fsurvival\u002FML |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| Ranked statistic for ALL genes, cutoff would be arbitrary | preranked `gseGO`\u002F`gseKEGG`\u002F`GSEA` | threshold-free; the common case (report gene-permutation) |\n| Pre-selected unranked list (module, GWAS hits, screen) | ORA -> go-enrichment | no genome-wide ranking exists |\n| Function annotation, broad GO coverage | `gseGO` | GO is the broadest local resource |\n| Metabolic \u002F signaling pathways | `gseKEGG` -> kegg-pathways | KEGG maps (live DB) |\n| Reaction-level, reproducible offline | `gsePathway` -> reactome-pathways | local reactome.db |\n| Curated MSigDB hallmark \u002F C2 \u002F C5 | `GSEA(TERM2GENE)` + msigdbr | generic-input GSEA on any collection |\n| Matrix + design, want competitive + correlation-honest | `limma::camera(..., inter.gene.cor = NA)` | VIF-corrects the inter-gene correlation gene-permutation ignores - the default preset `inter.gene.cor=0.01` gives no protection; `NA` estimates the real correlation |\n| Matrix + design, tiny n \u002F covariates, \"is set DE at all\" | `limma::roast`\u002F`fry` | self-contained rotation, valid at any n |\n| Per-sample pathway-activity matrix for clustering\u002FML | ssGSEA \u002F GSVA | scores each sample, not a contrast test |\n| The DE statistic \u002F ranking itself | -> differential-expression\u002Fde-results | upstream, not enrichment |\n\n## Build the Ranked Vector (the Caller-Owned Step)\n\n**Goal:** Turn a DE table into the named numeric vector sorted strictly decreasing that every preranked function requires, ranked by a signed variance-calibrated metric.\n\n**Approach:** Pick the ranking metric to match the DE tool, name the vector by gene ID, drop NAs, deduplicate to one statistic per gene, and sort decreasing. The DE mechanics and the `$padj`\u002F`$adj.P.Val` column conventions live in differential-expression\u002Fde-results.\n\n| DE source | Ranking metric | Column | Why |\n|-----------|----------------|--------|-----|\n| DESeq2 | Wald statistic | `stat` | signed + variance-calibrated; best single choice for RNA-seq |\n| limma \u002F voom | moderated t-statistic | `t` | empirical-Bayes shrinkage borrows variance; signed |\n| edgeR (QL) | `sign(logFC) * -log10(PValue)` | derived | no single signed statistic column |\n| any tool, last resort | log2 fold change | `log2FoldChange` | magnitude only; noisy for low-count genes |\n\n```r\nlibrary(clusterProfiler)\nlibrary(org.Hs.eg.db)\n\nde \u003C- read.csv('de_results.csv')          # DE list source: differential-expression\u002Fde-results\ngene_list \u003C- de$stat                       # DESeq2 Wald stat: signed + variance-calibrated\nnames(gene_list) \u003C- de$entrez_id\ngene_list \u003C- gene_list[!is.na(gene_list)]\ngene_list \u003C- gene_list[!duplicated(names(gene_list))]   # one statistic per gene; duplicates double-count hits\ngene_list \u003C- sort(gene_list, decreasing = TRUE)         # REQUIRED: unsorted input silently mis-ranks\n```\n\nRanking by `sign(log2FC) * -log10(pmax(pvalue, 1e-30))` (for edgeR, or when a Wald stat is unavailable) preserves direction and clamps `p==0` from going to `Inf` - **the clamp constant is a ranking weight, not just an `Inf` guard**: at `exponent=1`, `pmax(pvalue, 1e-300)` gives an exact-zero-p gene a weight of 300, ~75x the strongest genuinely-measured gene, so 4 such genes out of 14,000 can carry >16% of the total ranking weight and erase a real signal elsewhere in the ranking (audit-verified: `pmax(p, 1e-300)` lost a planted down-regulated set that `pmax(p, 1e-30)` recovered). Never rank by raw p-value alone (sign erased) or by `lfcShrink(type='normal')` (deprecated prior distorts the ranking). apeglm\u002Fashr-shrunk results DROP the `stat` column - pull `stat` from the unshrunk `results(dds)` if ranking by it.\n\n## Run Preranked GSEA on GO\n\n**Goal:** Find GO terms whose members shift coordinately up or down across the full ranking, with no significance cutoff.\n\n**Approach:** Set the permutation seed for reproducibility, set `eps=0` for exact tiny p-values, run gseGO, then map the leading-edge IDs back to symbols and read `core_enrichment` as the interpretable core.\n\n```r\nset.seed(123)                              # fixes the multilevel Monte Carlo; any fixed seed\ngse_go \u003C- gseGO(geneList = gene_list, OrgDb = org.Hs.eg.db, keyType = 'ENTREZID',\n                ont = 'BP', exponent = 1, minGSSize = 10, maxGSSize = 500,\n                eps = 0, pvalueCutoff = 0.05, pAdjustMethod = 'BH',\n                seed = TRUE, by = 'fgsea', verbose = FALSE)\ngse_go \u003C- setReadable(gse_go, OrgDb = org.Hs.eg.db, keyType = 'ENTREZID')\n```\n\n`gseaResult` columns: `ID`, `Description`, `setSize`, `enrichmentScore` (raw ES), `NES`, `pvalue`, `p.adjust` (BH), `qvalue`, `rank` (ES-peak position), `leading_edge`, `core_enrichment` (`\u002F`-separated leading-edge IDs). Report `p.adjust`\u002F`qvalue`, never raw `pvalue` and never an invented `$FDR`. NES sign = direction: positive = top of the ranking (up in the contrast), negative = bottom.\n\n## Run GSEA on KEGG, Reactome, or MSigDB\n\n**Goal:** Apply the same preranked engine to a pathway database with the gene-ID type that database expects.\n\n**Approach:** gseKEGG\u002FgsePathway need ENTREZ-style IDs; choose the collection, keep the seed and `eps=0`, and note KEGG queries the live REST API (date-dependent) while Reactome and MSigDB are local.\n\n```r\nset.seed(123)\ngse_kegg \u003C- gseKEGG(geneList = gene_list, organism = 'hsa', keyType = 'ncbi-geneid',   # Entrez-named vector; 'kegg' keyType is the prokaryote locus-tag path\n                    minGSSize = 10, maxGSSize = 500, eps = 0,\n                    pvalueCutoff = 0.05, seed = TRUE, verbose = FALSE)   # live KEGG API; pin the date\n\nlibrary(msigdbr)\nh \u003C- msigdbr(species = 'Homo sapiens', collection = 'H')    # 26.x: collection= (was category=); gs_collection (was gs_cat)\nt2g \u003C- h[, c('gs_name', 'ncbi_gene')]                       # 26.x Entrez column is ncbi_gene; older releases used entrez_gene\ngse_h \u003C- GSEA(geneList = gene_list, TERM2GENE = t2g, exponent = 1,\n              minGSSize = 10, maxGSSize = 500, eps = 0,\n              pvalueCutoff = 0.05, seed = TRUE, verbose = FALSE)\n```\n\nIf the installed msigdbr still uses `category=`\u002F`entrez_gene`, the old form works but warns - check `?msigdbr` and `names(h)`. ReactomePA's `gsePathway(geneList, organism='human')` reads the local reactome.db and also needs ENTREZ IDs.\n\n## Per-Sample Scores: ssGSEA and GSVA (Not a Contrast Test)\n\n**Goal:** Convert an expression matrix into a gene-set-by-sample activity matrix to feed clustering, survival, or a classifier - there is no per-pathway p-value here.\n\n**Approach:** GSVA >= 1.50 uses a PARAMETER-OBJECT API: build `gsvaParam(...)` or `ssgseaParam(...)` and pass it to `gsva()`. The old `gsva(expr, gset.idx.list, method=)` signature is defunct.\n\n```r\n# GSVA >= 1.50 \u002F Bioc 3.18 parameter-object API (older method= signature errors)\nlibrary(GSVA)\ngsva_scores  \u003C- gsva(gsvaParam(expr_matrix, gene_sets))      # unsupervised per-sample set scores\nssgsea_scores \u003C- gsva(ssgseaParam(expr_matrix, gene_sets))   # ssGSEA via the same dispatch\n```\n\nUse GSEA (preranked or phenotype) for a CONTRAST and a pathway-level p-value; use ssGSEA\u002FGSVA for a per-sample activity matrix for downstream modeling. GSVA is not installed in the reference environment - verify the installed signature with `?gsva` before running.\n\n## Per-Method Failure Modes\n\n### Ranking by raw p-value\n**Trigger:** `gene_list \u003C- -log10(de$pvalue)` with no `sign()`. **Mechanism:** the magnitude is symmetric, so up- and down-regulated genes both land at the top. **Symptom:** NES signs are meaningless; \"enriched\" sets mix directions. **Fix:** rank by `sign(log2FC) * -log10(pmax(p, 1e-30))`, or use DESeq2 `stat` \u002F limma `t`.\n\n### Preranked p-values treated as correlation-honest\n**Trigger:** reporting FDR 0.001 from gseGO\u002Ffgsea on a co-regulated set. **Mechanism:** gene permutation assumes gene independence; correlated sets inflate the set-statistic variance, so p is too small. **Symptom:** \"significant\" pathways that are co-expression and do not replicate. **Fix:** state the permutation type; for type-I control with a design matrix use CAMERA with the correlation estimated, `limma::camera(..., inter.gene.cor = NA)` (Wu & Smyth 2012) - the default preset `inter.gene.cor = 0.01` assumes low correlation and gives no protection against exactly this failure mode (audit-verified: FDR 7.2e-08 on a set with true inter-gene correlation ~0.31 under the default preset, vs 0.80 once estimated).\n\n### Unsorted or duplicated geneList\n**Trigger:** an un-sorted vector, or duplicate gene names after ID conversion. **Mechanism:** clusterProfiler validates both before running, not after. **Symptom:** a hard error, not a silent miscalculation - unsorted: `geneList should be a decreasing sorted vector...`; duplicated names: `Duplicate values in names(stats) not allowed`. **Fix:** `sort(gl[!duplicated(names(gl))], decreasing=TRUE)`; prefer a continuous metric (Wald stat \u002F moderated t rarely tie).\n\n### Bare log2FC ranking\n**Trigger:** ranking by `log2FoldChange` from raw counts. **Mechanism:** a gene with 2 vs 8 counts shows a huge unstable LFC. **Symptom:** the leading edge is one or two low-count outliers, not a coordinated shift. **Fix:** rank by `stat`\u002F`t`; if LFC is unavoidable use apeglm\u002Fashr-shrunk LFC (never `type='normal'`).\n\n### No set.seed\n**Trigger:** running gseGO without fixing the seed. **Mechanism:** the multilevel Monte Carlo is stochastic. **Symptom:** p-values and the significant-set list drift across identical reruns. **Fix:** `set.seed(123)` AND `seed=TRUE` in the call.\n\n### Tiny leading edge believed\n**Trigger:** trusting a high |NES| without inspecting `core_enrichment`. **Mechanism:** a 1-2 gene leading edge is outlier-driven, not a pathway shift; large sets reach high |NES| by chance. **Symptom:** an unreplicated headline pathway. **Fix:** FDR first, then leading-edge size\u002Fconcentration, then NES for prioritization.\n\n### Stale nPerm \u002F FDR\u003C0.25 lore\n**Trigger:** copying `nPerm=10000` and \"FDR \u003C 0.25\" from a Broad-desktop tutorial. **Mechanism:** `nPerm` is silently ACCEPTED, not rejected - clusterProfiler emits two warnings (\"We do not recommend using nPerm...\", \"You are trying to run fgseaSimple...\") and falls back from `fgseaMultilevel` to the coarser `fgseaSimple` engine; clusterProfiler `p.adjust` is BH, not the Broad empirical-null FDR that 0.25 was calibrated for. **Symptom:** no error - a complete-looking `gseaResult` computed on the coarser engine, plus a mis-transplanted threshold (audit-verified on clusterProfiler 4.14.6: `nPerm=10000` runs to completion with only warnings). **Fix:** drop `nPerm` entirely and govern tiny-p with `eps`; if the call isn't fully under your control, guard it: `if ('nPerm' %in% names(gse@params)) stop(\"nPerm forced a fgseaSimple fallback - remove it\")`. Treat `p.adjust` as BH and pick a defensible cutoff (often 0.05).\n\n### Stale GSVA call\n**Trigger:** `gsva(expr, gene_sets, method='ssgsea')`. **Mechanism:** GSVA >= 1.50 dispatches on a parameter object's class. **Symptom:** the old signature errors. **Fix:** `gsva(gsvaParam(expr, gene_sets))` \u002F `ssgseaParam(...)`.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| `exponent = 1` | Subramanian 2005 *PNAS* 102:15545 | weights each hit by |statistic|; p=0 is the unweighted KS that flags middle-clustered sets with no strong genes |\n| `minGSSize = 10` | clusterProfiler default | drops tiny sets that overfit on one outlier |\n| `maxGSSize = 500` | clusterProfiler default | drops overly broad sets that always 'enrich' |\n| `eps = 0` (default 1e-10) | clusterProfiler \u002F fgsea | replaces nPerm: `eps=0` resolves exact tiny p-values; 1e-10 is the default floor |\n| `pAdjustMethod = 'BH'` | clusterProfiler default | Benjamini-Hochberg FDR; NOT the Broad empirical-null FDR, so do not reflex to 0.25 |\n| `pvalueCutoff = 0.05` | clusterProfiler default | filters on p.adjust by default; defensible BH cutoff |\n| ~>=7 samples\u002Fgroup | Broad GSEA docs | minimum for a non-degenerate phenotype-permutation null |\n| `set.seed(123)` | reproducibility | any fixed seed; the point is to fix the multilevel Monte Carlo |\n| `pmax(p, 1e-30)` clamp, not `1e-300` | audit-verified | at `exponent=1` the clamp is a hit weight: `1e-300` gives an exact-zero-p gene ~75x the weight of the strongest measured gene (>16% of total \\|stat\\| from 4\u002F14,000 genes) and can erase a real signal; `1e-30` keeps the distortion small (~2%) |\n| genome-wide `gseGO` runtime | audit-measured | ~155s for 14,000 genes against full GO BP on a single core in this environment; budget minutes, not seconds |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Error about names \u002F wrong ES | geneList not named or not sorted decreasing | `sort(setNames(v, ids), decreasing=TRUE)` |\n| `--> No gene can be mapped` (often followed by `'organism' is not a slot in class \"NULL\"`) | wrong keyType\u002FOrgDb, or non-ENTREZ IDs | `bitr` to the expected ID type first |\n| gseKEGG returns 0 terms | ENSEMBL\u002FSYMBOL passed, wrong organism code, or KEGG API down | convert to kegg-id\u002FENTREZ; check the `organism` code; retry (live API) |\n| Different results each run | no `set.seed`, or live KEGG DB changed | fix the seed; pin the KEGG run date |\n| `nPerm` silently accepted, no error - engine downgrades to `fgseaSimple` | copied from a pre-4.0 tutorial | remove `nPerm`; use `eps`; guard with `'nPerm' %in% names(gse@params)` |\n| GSVA `method=` error | pre-1.50 signature | `gsva(gsvaParam(expr, sets))` |\n| `core_enrichment` is NA \u002F all-ID | `setReadable` not applied | `setReadable(gse, OrgDb, keyType='ENTREZID')` |\n\n## References\n\n- Mootha VK, Lindgren CM, Eriksson KF, et al. 2003. PGC-1alpha-responsive genes involved in oxidative phosphorylation are coordinately downregulated in human diabetes. *Nat Genet* 34:267-273.\n- Subramanian A, Tamayo P, Mootha VK, et al. 2005. Gene set enrichment analysis: a knowledge-based approach for interpreting genome-wide expression profiles. *PNAS* 102:15545-15550.\n- Korotkevich G, Sukhov V, Budin N, et al. Fast gene set enrichment analysis. *bioRxiv* 060012 (preprint). DOI 10.1101\u002F060012.\n- Wu D, Smyth GK. 2012. Camera: a competitive gene set test accounting for inter-gene correlation. *Nucleic Acids Res* 40:e133.\n- Wu D, Lim E, Vaillant F, et al. 2010. ROAST: rotation gene set tests for complex microarray experiments. *Bioinformatics* 26:2176-2182.\n- Barbie DA, Tamayo P, Boehm JS, et al. 2009. Systematic RNA interference reveals that oncogenic KRAS-driven cancers require TBK1. *Nature* 462:108-112.\n- Hanzelmann S, Castelo R, Guinney J. 2013. GSVA: gene set variation analysis for microarray and RNA-seq data. *BMC Bioinformatics* 14:7.\n- Reimand J, Isserlin R, Voisin V, et al. 2019. Pathway enrichment analysis and visualization of omics data using g:Profiler, GSEA, Cytoscape and EnrichmentMap. *Nat Protoc* 14:482-517.\n- Wijesooriya K, Jadaan SA, Perera KL, et al. 2022. Urgent need for consistent standards in functional enrichment analysis. *PLoS Comput Biol* 18:e1009935.\n\n## Related Skills\n\n- go-enrichment - Gene-list ORA alternative when no ranking exists\n- kegg-pathways - KEGG pathway and module enrichment and ID conventions\n- reactome-pathways - Reactome curated-pathway enrichment (local DB)\n- wikipathways - WikiPathways community-pathway enrichment\n- enrichment-visualization - gseaplot2, ridgeplot, and dotplot of GSEA results\n- differential-expression\u002Fde-results - Source of the ranking statistic and the padj column conventions\n- workflows\u002Fexpression-to-pathways - End-to-end DE-to-enrichment pipeline\n","## Version Compatibility\n\nReference examples tested with: clusterProfiler 4.18.4+, org.Hs.eg.db 3.22+, msigdbr 26+, fgsea 1.36+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\ngseKEGG queries the live KEGG REST API, so the same code returns different results as KEGG updates; pin the run date. gseGO\u002FgsePathway and MSigDB GSEA use local annotation (`org.*.eg.db`, `reactome.db`, msigdbr) and are reproducible given the package version. The single source of truth for versions is this block, not headings.\n\n# Gene Set Enrichment Analysis (GSEA)\n\n**\"Which pathways shift coordinately across my full ranked gene list, with no cutoff?\"** -> Walk a weighted running-sum down the genome-wide ranking and test whether each gene set piles up at one END - because that score reports the structure of YOUR ranking, so the ranking metric and the permutation type, not the gene sets, decide the result.\n- R: `gseGO(geneList, OrgDb, ont)`, `gseKEGG(geneList, organism)`, `GSEA(geneList, TERM2GENE)`\n\nScope: threshold-free Functional Class Scoring (FCS) of a RANKED vector - the running-sum ES, the ranking-metric choice, the permutation null, NES\u002FFDR, the leading edge, and per-sample ssGSEA\u002FGSVA scores. A pre-selected unranked gene LIST -> go-enrichment (ORA). The ranking statistic source -> differential-expression\u002Fde-results. KEGG\u002FReactome\u002FWikiPathways database semantics -> kegg-pathways, reactome-pathways, wikipathways. Plots -> enrichment-visualization.\n\n## The Single Most Important Modern Insight -- A GSEA Result Is a Deterministic Function of Three Usually-Implicit Choices: the Ranking Statistic, the Weight Exponent p, and the Permuted Labels\n\nGSEA is not a discovery about biology - it is the running-sum's report on the ranking it was handed. The weighted enrichment score (Subramanian 2005; the default `exponent=1` weights each hit by the gene's statistic magnitude) asks exactly one question: do the members of a set pile up at one END of YOUR ranking. So the result is fixed by three decisions tutorials usually leave silent, and Wijesooriya 2022 found most published GSEA papers report none of them.\n\n1. **The ranking statistic IS the experiment.** Rank by a signed, variance-calibrated metric (DESeq2 `stat`, limma moderated `t`) - sign gives direction, variance-calibration sinks noisy low-information genes to the middle. Ranking by a RAW p-value erases the sign, so up- and down-regulated genes collapse together and NES becomes uninterpretable. Ranking by bare log2FC lets a handful of low-count genes with huge unstable fold changes hijack the leading edge. A bad ranking is faithfully reported as a ranking artifact.\n2. **The permutation type sets validity.** Phenotype (sample-label) permutation preserves the gene-gene correlation that co-regulated pathways are made of - it is the gold standard for type-I error control because it preserves that correlation, but needs the expression matrix and adequate n per group (~>=7); below that n its validity degrades. clusterProfiler\u002Ffgsea preranked are FORCED into GENE permutation, which treats genes as independent, destroys that correlation, and is ANTI-CONSERVATIVE: it returns \"significant\" pathways that are nothing but co-expression. Accept it, report it, and prefer CAMERA when the design matrix is available (full competitive\u002Fself-contained theory in the category README).\n3. **The honesty is bounded by reporting.** Log the ranking metric, the exponent p, the permutation type, the gene-set collection and its version\u002Fdate, the size filters, and the multiple-testing method. Without those, the result is unfalsifiable.\n\n## Tool Taxonomy\n\n| Method | Citation | Mechanism \u002F role | When |\n|--------|----------|------------------|------|\n| Preranked GSEA (gseGO\u002FgseKEGG\u002FGSEA) | Subramanian 2005 *PNAS* 102:15545; Mootha 2003 *Nat Genet* 34:267 | weighted running-sum ES over a ranked vector; gene-permutation null | the common case: a ranked statistic for all genes, no matrix |\n| fgsea engine | Korotkevich 2021 *bioRxiv* 060012 (preprint) | fgseaMultilevel; resolves tiny p accurately down to `eps` | the engine under `by='fgsea'` (default); what gives sub-1\u002Fnperm p-values |\n| Phenotype-permutation GSEA | Subramanian 2005 *PNAS* 102:15545 | shuffles sample labels; preserves gene-gene correlation | matrix + phenotype + ~>=7\u002Fgroup; the gold-standard competitive test |\n| CAMERA | Wu & Smyth 2012 *NAR* 40:e133 | competitive, VIF-corrects inter-gene correlation analytically - only with `inter.gene.cor = NA`; the default preset (0.01) gives no protection | matrix + design; want a correlation-honest competitive test |\n| ROAST \u002F fry | Wu 2010 *Bioinformatics* 26:2176 | self-contained rotation test; valid at any n | matrix + design, tiny n, \"is the set DE at all\" |\n| ssGSEA | Barbie 2009 *Nature* 462:108 | per-sample rank-based enrichment score | a per-sample pathway-activity matrix (no contrast test) |\n| GSVA | Hanzelmann 2013 *BMC Bioinformatics* 14:7 | unsupervised per-sample, per-set kernel\u002FCDF score | per-sample features for clustering\u002Fsurvival\u002FML |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| Ranked statistic for ALL genes, cutoff would be arbitrary | preranked `gseGO`\u002F`gseKEGG`\u002F`GSEA` | threshold-free; the common case (report gene-permutation) |\n| Pre-selected unranked list (module, GWAS hits, screen) | ORA -> go-enrichment | no genome-wide ranking exists |\n| Function annotation, broad GO coverage | `gseGO` | GO is the broadest local resource |\n| Metabolic \u002F signaling pathways | `gseKEGG` -> kegg-pathways | KEGG maps (live DB) |\n| Reaction-level, reproducible offline | `gsePathway` -> reactome-pathways | local reactome.db |\n| Curated MSigDB hallmark \u002F C2 \u002F C5 | `GSEA(TERM2GENE)` + msigdbr | generic-input GSEA on any collection |\n| Matrix + design, want competitive + correlation-honest | `limma::camera(..., inter.gene.cor = NA)` | VIF-corrects the inter-gene correlation gene-permutation ignores - the default preset `inter.gene.cor=0.01` gives no protection; `NA` estimates the real correlation |\n| Matrix + design, tiny n \u002F covariates, \"is set DE at all\" | `limma::roast`\u002F`fry` | self-contained rotation, valid at any n |\n| Per-sample pathway-activity matrix for clustering\u002FML | ssGSEA \u002F GSVA | scores each sample, not a contrast test |\n| The DE statistic \u002F ranking itself | -> differential-expression\u002Fde-results | upstream, not enrichment |\n\n## Build the Ranked Vector (the Caller-Owned Step)\n\n**Goal:** Turn a DE table into the named numeric vector sorted strictly decreasing that every preranked function requires, ranked by a signed variance-calibrated metric.\n\n**Approach:** Pick the ranking metric to match the DE tool, name the vector by gene ID, drop NAs, deduplicate to one statistic per gene, and sort decreasing. The DE mechanics and the `$padj`\u002F`$adj.P.Val` column conventions live in differential-expression\u002Fde-results.\n\n| DE source | Ranking metric | Column | Why |\n|-----------|----------------|--------|-----|\n| DESeq2 | Wald statistic | `stat` | signed + variance-calibrated; best single choice for RNA-seq |\n| limma \u002F voom | moderated t-statistic | `t` | empirical-Bayes shrinkage borrows variance; signed |\n| edgeR (QL) | `sign(logFC) * -log10(PValue)` | derived | no single signed statistic column |\n| any tool, last resort | log2 fold change | `log2FoldChange` | magnitude only; noisy for low-count genes |\n\n```r\nlibrary(clusterProfiler)\nlibrary(org.Hs.eg.db)\n\nde \u003C- read.csv('de_results.csv')          # DE list source: differential-expression\u002Fde-results\ngene_list \u003C- de$stat                       # DESeq2 Wald stat: signed + variance-calibrated\nnames(gene_list) \u003C- de$entrez_id\ngene_list \u003C- gene_list[!is.na(gene_list)]\ngene_list \u003C- gene_list[!duplicated(names(gene_list))]   # one statistic per gene; duplicates double-count hits\ngene_list \u003C- sort(gene_list, decreasing = TRUE)         # REQUIRED: unsorted input silently mis-ranks\n```\n\nRanking by `sign(log2FC) * -log10(pmax(pvalue, 1e-30))` (for edgeR, or when a Wald stat is unavailable) preserves direction and clamps `p==0` from going to `Inf` - **the clamp constant is a ranking weight, not just an `Inf` guard**: at `exponent=1`, `pmax(pvalue, 1e-300)` gives an exact-zero-p gene a weight of 300, ~75x the strongest genuinely-measured gene, so 4 such genes out of 14,000 can carry >16% of the total ranking weight and erase a real signal elsewhere in the ranking (audit-verified: `pmax(p, 1e-300)` lost a planted down-regulated set that `pmax(p, 1e-30)` recovered). Never rank by raw p-value alone (sign erased) or by `lfcShrink(type='normal')` (deprecated prior distorts the ranking). apeglm\u002Fashr-shrunk results DROP the `stat` column - pull `stat` from the unshrunk `results(dds)` if ranking by it.\n\n## Run Preranked GSEA on GO\n\n**Goal:** Find GO terms whose members shift coordinately up or down across the full ranking, with no significance cutoff.\n\n**Approach:** Set the permutation seed for reproducibility, set `eps=0` for exact tiny p-values, run gseGO, then map the leading-edge IDs back to symbols and read `core_enrichment` as the interpretable core.\n\n```r\nset.seed(123)                              # fixes the multilevel Monte Carlo; any fixed seed\ngse_go \u003C- gseGO(geneList = gene_list, OrgDb = org.Hs.eg.db, keyType = 'ENTREZID',\n                ont = 'BP', exponent = 1, minGSSize = 10, maxGSSize = 500,\n                eps = 0, pvalueCutoff = 0.05, pAdjustMethod = 'BH',\n                seed = TRUE, by = 'fgsea', verbose = FALSE)\ngse_go \u003C- setReadable(gse_go, OrgDb = org.Hs.eg.db, keyType = 'ENTREZID')\n```\n\n`gseaResult` columns: `ID`, `Description`, `setSize`, `enrichmentScore` (raw ES), `NES`, `pvalue`, `p.adjust` (BH), `qvalue`, `rank` (ES-peak position), `leading_edge`, `core_enrichment` (`\u002F`-separated leading-edge IDs). Report `p.adjust`\u002F`qvalue`, never raw `pvalue` and never an invented `$FDR`. NES sign = direction: positive = top of the ranking (up in the contrast), negative = bottom.\n\n## Run GSEA on KEGG, Reactome, or MSigDB\n\n**Goal:** Apply the same preranked engine to a pathway database with the gene-ID type that database expects.\n\n**Approach:** gseKEGG\u002FgsePathway need ENTREZ-style IDs; choose the collection, keep the seed and `eps=0`, and note KEGG queries the live REST API (date-dependent) while Reactome and MSigDB are local.\n\n```r\nset.seed(123)\ngse_kegg \u003C- gseKEGG(geneList = gene_list, organism = 'hsa', keyType = 'ncbi-geneid',   # Entrez-named vector; 'kegg' keyType is the prokaryote locus-tag path\n                    minGSSize = 10, maxGSSize = 500, eps = 0,\n                    pvalueCutoff = 0.05, seed = TRUE, verbose = FALSE)   # live KEGG API; pin the date\n\nlibrary(msigdbr)\nh \u003C- msigdbr(species = 'Homo sapiens', collection = 'H')    # 26.x: collection= (was category=); gs_collection (was gs_cat)\nt2g \u003C- h[, c('gs_name', 'ncbi_gene')]                       # 26.x Entrez column is ncbi_gene; older releases used entrez_gene\ngse_h \u003C- GSEA(geneList = gene_list, TERM2GENE = t2g, exponent = 1,\n              minGSSize = 10, maxGSSize = 500, eps = 0,\n              pvalueCutoff = 0.05, seed = TRUE, verbose = FALSE)\n```\n\nIf the installed msigdbr still uses `category=`\u002F`entrez_gene`, the old form works but warns - check `?msigdbr` and `names(h)`. ReactomePA's `gsePathway(geneList, organism='human')` reads the local reactome.db and also needs ENTREZ IDs.\n\n## Per-Sample Scores: ssGSEA and GSVA (Not a Contrast Test)\n\n**Goal:** Convert an expression matrix into a gene-set-by-sample activity matrix to feed clustering, survival, or a classifier - there is no per-pathway p-value here.\n\n**Approach:** GSVA >= 1.50 uses a PARAMETER-OBJECT API: build `gsvaParam(...)` or `ssgseaParam(...)` and pass it to `gsva()`. The old `gsva(expr, gset.idx.list, method=)` signature is defunct.\n\n```r\n# GSVA >= 1.50 \u002F Bioc 3.18 parameter-object API (older method= signature errors)\nlibrary(GSVA)\ngsva_scores  \u003C- gsva(gsvaParam(expr_matrix, gene_sets))      # unsupervised per-sample set scores\nssgsea_scores \u003C- gsva(ssgseaParam(expr_matrix, gene_sets))   # ssGSEA via the same dispatch\n```\n\nUse GSEA (preranked or phenotype) for a CONTRAST and a pathway-level p-value; use ssGSEA\u002FGSVA for a per-sample activity matrix for downstream modeling. GSVA is not installed in the reference environment - verify the installed signature with `?gsva` before running.\n\n## Per-Method Failure Modes\n\n### Ranking by raw p-value\n**Trigger:** `gene_list \u003C- -log10(de$pvalue)` with no `sign()`. **Mechanism:** the magnitude is symmetric, so up- and down-regulated genes both land at the top. **Symptom:** NES signs are meaningless; \"enriched\" sets mix directions. **Fix:** rank by `sign(log2FC) * -log10(pmax(p, 1e-30))`, or use DESeq2 `stat` \u002F limma `t`.\n\n### Preranked p-values treated as correlation-honest\n**Trigger:** reporting FDR 0.001 from gseGO\u002Ffgsea on a co-regulated set. **Mechanism:** gene permutation assumes gene independence; correlated sets inflate the set-statistic variance, so p is too small. **Symptom:** \"significant\" pathways that are co-expression and do not replicate. **Fix:** state the permutation type; for type-I control with a design matrix use CAMERA with the correlation estimated, `limma::camera(..., inter.gene.cor = NA)` (Wu & Smyth 2012) - the default preset `inter.gene.cor = 0.01` assumes low correlation and gives no protection against exactly this failure mode (audit-verified: FDR 7.2e-08 on a set with true inter-gene correlation ~0.31 under the default preset, vs 0.80 once estimated).\n\n### Unsorted or duplicated geneList\n**Trigger:** an un-sorted vector, or duplicate gene names after ID conversion. **Mechanism:** clusterProfiler validates both before running, not after. **Symptom:** a hard error, not a silent miscalculation - unsorted: `geneList should be a decreasing sorted vector...`; duplicated names: `Duplicate values in names(stats) not allowed`. **Fix:** `sort(gl[!duplicated(names(gl))], decreasing=TRUE)`; prefer a continuous metric (Wald stat \u002F moderated t rarely tie).\n\n### Bare log2FC ranking\n**Trigger:** ranking by `log2FoldChange` from raw counts. **Mechanism:** a gene with 2 vs 8 counts shows a huge unstable LFC. **Symptom:** the leading edge is one or two low-count outliers, not a coordinated shift. **Fix:** rank by `stat`\u002F`t`; if LFC is unavoidable use apeglm\u002Fashr-shrunk LFC (never `type='normal'`).\n\n### No set.seed\n**Trigger:** running gseGO without fixing the seed. **Mechanism:** the multilevel Monte Carlo is stochastic. **Symptom:** p-values and the significant-set list drift across identical reruns. **Fix:** `set.seed(123)` AND `seed=TRUE` in the call.\n\n### Tiny leading edge believed\n**Trigger:** trusting a high |NES| without inspecting `core_enrichment`. **Mechanism:** a 1-2 gene leading edge is outlier-driven, not a pathway shift; large sets reach high |NES| by chance. **Symptom:** an unreplicated headline pathway. **Fix:** FDR first, then leading-edge size\u002Fconcentration, then NES for prioritization.\n\n### Stale nPerm \u002F FDR\u003C0.25 lore\n**Trigger:** copying `nPerm=10000` and \"FDR \u003C 0.25\" from a Broad-desktop tutorial. **Mechanism:** `nPerm` is silently ACCEPTED, not rejected - clusterProfiler emits two warnings (\"We do not recommend using nPerm...\", \"You are trying to run fgseaSimple...\") and falls back from `fgseaMultilevel` to the coarser `fgseaSimple` engine; clusterProfiler `p.adjust` is BH, not the Broad empirical-null FDR that 0.25 was calibrated for. **Symptom:** no error - a complete-looking `gseaResult` computed on the coarser engine, plus a mis-transplanted threshold (audit-verified on clusterProfiler 4.14.6: `nPerm=10000` runs to completion with only warnings). **Fix:** drop `nPerm` entirely and govern tiny-p with `eps`; if the call isn't fully under your control, guard it: `if ('nPerm' %in% names(gse@params)) stop(\"nPerm forced a fgseaSimple fallback - remove it\")`. Treat `p.adjust` as BH and pick a defensible cutoff (often 0.05).\n\n### Stale GSVA call\n**Trigger:** `gsva(expr, gene_sets, method='ssgsea')`. **Mechanism:** GSVA >= 1.50 dispatches on a parameter object's class. **Symptom:** the old signature errors. **Fix:** `gsva(gsvaParam(expr, gene_sets))` \u002F `ssgseaParam(...)`.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| `exponent = 1` | Subramanian 2005 *PNAS* 102:15545 | weights each hit by |statistic|; p=0 is the unweighted KS that flags middle-clustered sets with no strong genes |\n| `minGSSize = 10` | clusterProfiler default | drops tiny sets that overfit on one outlier |\n| `maxGSSize = 500` | clusterProfiler default | drops overly broad sets that always 'enrich' |\n| `eps = 0` (default 1e-10) | clusterProfiler \u002F fgsea | replaces nPerm: `eps=0` resolves exact tiny p-values; 1e-10 is the default floor |\n| `pAdjustMethod = 'BH'` | clusterProfiler default | Benjamini-Hochberg FDR; NOT the Broad empirical-null FDR, so do not reflex to 0.25 |\n| `pvalueCutoff = 0.05` | clusterProfiler default | filters on p.adjust by default; defensible BH cutoff |\n| ~>=7 samples\u002Fgroup | Broad GSEA docs | minimum for a non-degenerate phenotype-permutation null |\n| `set.seed(123)` | reproducibility | any fixed seed; the point is to fix the multilevel Monte Carlo |\n| `pmax(p, 1e-30)` clamp, not `1e-300` | audit-verified | at `exponent=1` the clamp is a hit weight: `1e-300` gives an exact-zero-p gene ~75x the weight of the strongest measured gene (>16% of total \\|stat\\| from 4\u002F14,000 genes) and can erase a real signal; `1e-30` keeps the distortion small (~2%) |\n| genome-wide `gseGO` runtime | audit-measured | ~155s for 14,000 genes against full GO BP on a single core in this environment; budget minutes, not seconds |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Error about names \u002F wrong ES | geneList not named or not sorted decreasing | `sort(setNames(v, ids), decreasing=TRUE)` |\n| `--> No gene can be mapped` (often followed by `'organism' is not a slot in class \"NULL\"`) | wrong keyType\u002FOrgDb, or non-ENTREZ IDs | `bitr` to the expected ID type first |\n| gseKEGG returns 0 terms | ENSEMBL\u002FSYMBOL passed, wrong organism code, or KEGG API down | convert to kegg-id\u002FENTREZ; check the `organism` code; retry (live API) |\n| Different results each run | no `set.seed`, or live KEGG DB changed | fix the seed; pin the KEGG run date |\n| `nPerm` silently accepted, no error - engine downgrades to `fgseaSimple` | copied from a pre-4.0 tutorial | remove `nPerm`; use `eps`; guard with `'nPerm' %in% names(gse@params)` |\n| GSVA `method=` error | pre-1.50 signature | `gsva(gsvaParam(expr, sets))` |\n| `core_enrichment` is NA \u002F all-ID | `setReadable` not applied | `setReadable(gse, OrgDb, keyType='ENTREZID')` |\n\n## References\n\n- Mootha VK, Lindgren CM, Eriksson KF, et al. 2003. PGC-1alpha-responsive genes involved in oxidative phosphorylation are coordinately downregulated in human diabetes. *Nat Genet* 34:267-273.\n- Subramanian A, Tamayo P, Mootha VK, et al. 2005. Gene set enrichment analysis: a knowledge-based approach for interpreting genome-wide expression profiles. *PNAS* 102:15545-15550.\n- Korotkevich G, Sukhov V, Budin N, et al. Fast gene set enrichment analysis. *bioRxiv* 060012 (preprint). DOI 10.1101\u002F060012.\n- Wu D, Smyth GK. 2012. Camera: a competitive gene set test accounting for inter-gene correlation. *Nucleic Acids Res* 40:e133.\n- Wu D, Lim E, Vaillant F, et al. 2010. ROAST: rotation gene set tests for complex microarray experiments. *Bioinformatics* 26:2176-2182.\n- Barbie DA, Tamayo P, Boehm JS, et al. 2009. Systematic RNA interference reveals that oncogenic KRAS-driven cancers require TBK1. *Nature* 462:108-112.\n- Hanzelmann S, Castelo R, Guinney J. 2013. GSVA: gene set variation analysis for microarray and RNA-seq data. *BMC Bioinformatics* 14:7.\n- Reimand J, Isserlin R, Voisin V, et al. 2019. Pathway enrichment analysis and visualization of omics data using g:Profiler, GSEA, Cytoscape and EnrichmentMap. *Nat Protoc* 14:482-517.\n- Wijesooriya K, Jadaan SA, Perera KL, et al. 2022. Urgent need for consistent standards in functional enrichment analysis. *PLoS Comput Biol* 18:e1009935.\n\n## Related Skills\n\n- go-enrichment - Gene-list ORA alternative when no ranking exists\n- kegg-pathways - KEGG pathway and module enrichment and ID conventions\n- reactome-pathways - Reactome curated-pathway enrichment (local DB)\n- wikipathways - WikiPathways community-pathway enrichment\n- enrichment-visualization - gseaplot2, ridgeplot, and dotplot of GSEA results\n- differential-expression\u002Fde-results - Source of the ranking statistic and the padj column conventions\n- workflows\u002Fexpression-to-pathways - End-to-end DE-to-enrichment pipeline\n",{"name":5,"tool_type":24,"description":7,"primary_tool":25},"r","clusterProfiler","main","e0956dc9606356ab78468936b502e55a365282e2","specialists\u002Fcrispr-screen-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-pathway-gsea",0,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists","https:\u002F\u002Fgithub.com\u002Fmrsonord2240","2026-10-12 03:19:04",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-pathway-gsea",{"tool":39,"command":40},"bunx","bunx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-pathway-gsea",{"tool":42,"command":43},"pnpm","pnpm dlx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-pathway-gsea","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fcrispr-screen-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-pathway-gsea\u002FSKILL.md",true,[47,53,57],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"examples\u002Fgsea_go.R","OTHER","其他",2813,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fcrispr-screen-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-pathway-gsea\u002Fexamples\u002Fgsea_go.R",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"examples\u002Fgsea_msigdb.R",2297,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fcrispr-screen-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-pathway-gsea\u002Fexamples\u002Fgsea_msigdb.R",{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"usage-guide.md","REFERENCE","参考文档",8457,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fcrispr-screen-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-pathway-gsea\u002Fusage-guide.md",[64,71,78,85,92,99],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7CW36A6QAGWFE2C008M1XPG","bio-workflows-metabolomics-pipeline","Orchestrates the untargeted LC-MS metabolomics pipeline end-to-end (xcms 4.x feature extraction, QC\u002Fdrift\u002Fnormalization, confidence-stratified annotation, permutation-validated statistics, background-aware pathway mapping), naming what each stage decides and where it silently fails. Use when running a full LC-MS metabolomics study from raw mzML to enriched pathways and needing the honest handoffs between stages. Each stage defers to its component skill for parameters and traps; for stable-isotope flux (a separate branch, not this untargeted flow) see metabolomics\u002Fisotope-tracing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-workflows-metabolomics-pipeline\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7CW2Y18623NA2S1Y30FRQW1","bio-metabolomics-xcms-preprocessing","Programmatic untargeted LC-MS feature extraction in R with the modern xcms 4.x MsExperiment\u002FXcmsExperiment API, taking raw mzML to a feature table via CentWave peak detection, retention-time alignment, peak-density correspondence, gap-filling, CAMERA redundancy collapse, and built-in QC feature filtering. Use when converting centroided LC-MS runs into a features-by-samples matrix and deciding centWave\u002Fgrouping\u002Falignment parameters. For drift correction and QC\u002FCV filtering execution see metabolomics\u002Fnormalization-qc; for metabolite identification see metabolomics\u002Fmetabolite-annotation; for the MS-DIAL GUI alternative with MS2Dec deconvolution see metabolomics\u002Fmsdial-preprocessing; for downstream statistics see metabolomics\u002Fstatistical-analysis.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-xcms-preprocessing\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7CW2M364HVWPNQEKE2WP4PP","bio-metabolomics-statistical-analysis","Decision-grade statistical analysis for metabolomics intensity tables. Covers transformation and scaling (Pareto vs unit-variance as a hidden hypothesis), unsupervised structure (PCA\u002FHCA for QC), permutation-validated PLS-DA\u002FOPLS-DA (R2 vs Q2, double CV, VIP as heuristic), univariate testing (Welch\u002FMann-Whitney\u002FANOVA\u002FLMM with covariate adjustment), and dependence-aware multiple testing. Use when testing which metabolites differ, building or validating a discriminant model, choosing a scaling, or correcting many correlated tests. For sample-wise normalization\u002Fdrift correction see metabolomics\u002Fnormalization-qc; for ML classifiers and selection-inside-CV leakage see machine-learning\u002Fbiomarker-discovery and machine-learning\u002Fmodel-validation; for pathway interpretation see metabolomics\u002Fpathway-mapping; for design\u002Fpower\u002Fmultiplicity regime see experimental-design\u002Fmultiple-testing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-statistical-analysis\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7CW2BCBF851WYE03Z8XPEDQ","bio-metabolomics-pathway-mapping","Maps metabolomics results to biological pathways via over-representation (ORA), metabolite-set enrichment (MSEA\u002FQEA), mummichog\u002FPSEA on raw m\u002Fz peaks, and network-diffusion enrichment (FELLA), with correct background-set construction and honest interpretive ceilings. Use when interpreting differential metabolites or an untargeted LC-MS feature table in pathway context, choosing ORA vs MSEA vs mummichog vs topology, or setting the reference\u002Fbackground set. For annotation confidence levels feeding ORA see metabolomics\u002Fmetabolite-annotation; for gene-set concepts see pathway-analysis\u002Fgo-enrichment and pathway-analysis\u002Fgsea; for joint gene+metabolite pathways see multi-omics-integration\u002Fmofa-integration.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-pathway-mapping\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7CW21NSZMCPMF7D9CHJM718","bio-metabolomics-normalization-qc","Designs QC, corrects signal drift, removes batch effects, filters features, normalizes samples, and imputes missing values for untargeted LC-MS\u002FGC-MS metabolomics, framing each step as a measurement model that can create or erase biological signal. Use when processing a peak\u002Ffeature table before statistical analysis, choosing a drift-correction or sample-normalization method, deciding QC RSD vs D-ratio filtering, or handling left-censored missing values. The feature table is produced by metabolomics\u002Fxcms-preprocessing or metabolomics\u002Fmsdial-preprocessing; transformation\u002Fscaling for modeling defers to metabolomics\u002Fstatistical-analysis; cross-study design issues link to experimental-design\u002Fbatch-design.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M7CW1SWVM0NYHVE6Q7MA3G7R","bio-metabolomics-msdial-preprocessing","Runs the MS-DIAL preprocessing workflow (peak picking, MS2Dec spectral deconvolution, alignment, gap-filling) and imports the alignment-result table into R or Python with honest filtering. Use when preprocessing LC-MS DDA\u002FDIA (SWATH) or GC-MS raw data with MS-DIAL, deciding MS-DIAL vs XCMS, configuring the MSDIALCUI console run, or parsing an MS-DIAL export into a clean feature matrix. For programmatic R peak detection and the feature-table-as-artifact framing see metabolomics\u002Fxcms-preprocessing; for lipid annotation mode see metabolomics\u002Flipidomics; for MSI-level confidence honesty see metabolomics\u002Fmetabolite-annotation; for drift correction and QC see metabolomics\u002Fnormalization-qc.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-msdial-preprocessing\u002FSKILL.md",[],[]]