Tests a gene list (ORA, enrichWP) or a ranked gene vector (GSEA, gseWP) against the WikiPathways community-curated pathway collection with clusterProfiler and rWikiPathways. Covers why a WikiPathways result is a snapshot of a live, monthly-updated database (enrichWP/gseWP/gson_WP silently pull data.wikipathways.org/current/), why reproducibility requires pinning a dated GMT via downloadPathwayArchive(date=, format='gmt'), why the WP GMT is Entrez-keyed so symbols and Ensembl silently overlap nothing, why universe=NULL gives a biased all-WP-genes background, how to split the name%version%wpid%org term, and why WikiPathways (CC0, no peer review) complements KEGG/Reactome. Use when running open community-pathway enrichment, covering a non-model WP species, catching disease/drug pathways missing from KEGG/Reactome, or needing a reproducible dated analysis. The gene list comes from differential-expression/de-results; visualize with enrichment-visualization.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Tests a gene list (ORA, enrichWP) or a ranked gene vector (GSEA, gseWP) against the WikiPathways community-curated pathway collection with clusterProfiler and rWikiPathways. Covers why a WikiPathways result is a snapshot of a live, monthly-updated database (enrichWP/gseWP/gson_WP silently pull data.wikipathways.org/current/), why reproducibility requires pinning a dated GMT via downloadPathwayArchive(date=, format='gmt'), why the WP GMT is Entrez-keyed so symbols and Ensembl silently overlap nothing, why universe=NULL gives a biased all-WP-genes background, how to split the name%version%wpid%org term, and why WikiPathways (CC0, no peer review) complements KEGG/Reactome. Use when running open community-pathway enrichment, covering a non-model WP species, catching disease/drug pathways missing from KEGG/Reactome, or needing a reproducible dated analysis. The gene list comes from differential-expression/de-results; visualize with enrichment-visualization.
Before using code patterns, verify installed versions match. If versions differ:
R: packageVersion('<pkg>') then ?function_name to verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
WikiPathways is a LIVE, monthly-updated database. enrichWP, gseWP, and gson_WP all download data.wikipathways.org/current/gmt/ at run time, so the SAME code returns DIFFERENT pathways and p-values months apart with no error. current/ is not a version. For a reproducible analysis pin a dated release with downloadPathwayArchive(date='YYYYMMDD', organism=, format='gmt') and report the date. All enrichWP/gseWP/downloadPathwayArchive calls require internet at run time.
WikiPathways Enrichment
"Which community-curated WikiPathways are enriched in my genes?" -> Test WikiPathways gene sets against a gene list (ORA) or a ranked vector (GSEA), pinning a dated GMT for reproducibility - because the live monthly database changes under identical code, and the WP GMT is Entrez-keyed so any other ID type silently overlaps nothing.
R (ORA): enrichWP(entrez, organism='Homo sapiens', universe=all_entrez)
R (GSEA): gseWP(named_decreasing_entrez_vector, organism='Homo sapiens')
R (reproducible): downloadPathwayArchive(date='YYYYMMDD', organism=, format='gmt') -> read.gmt -> split term -> enricher/GSEA
Scope: WikiPathways-specific enrichment - the data model, the current/-vs-dated GMT reproducibility pin, the Entrez-GMT requirement, the term-field split, PFOCR as a noisier complement, and the WP-vs-KEGG-vs-Reactome contrast. The ORA/GSEA method choice and hypergeometric/background theory -> the category README. The DE list and ranking statistic -> differential-expression/de-results. KEGG and Reactome -> kegg-pathways, reactome-pathways. Plot grammar -> enrichment-visualization.
The Single Most Important Modern Insight -- A WikiPathways Result Is a Snapshot of a Live, Community-Edited Database Taken on the Run Date
WikiPathways is a wiki: anyone can create or edit a pathway, content is CC0, and there is NO formal journal-style peer review gating a pathway's publication (Pico 2008 PLoS Biol 6:e184; Martens 2021 NAR 49:D613). The collection is republished as a dated GMT archive every MONTH. Three properties every misuse forgets:
current/ is not a version.enrichWP, gseWP, and gson_WP all silently download data.wikipathways.org/current/gmt/ - the latest monthly release. Identical code two months apart returns different pathways and different p-values, with no error and no warning. Reproducibility is NOT a code freeze; it is a dated GMT: downloadPathwayArchive(date='20240310', organism='Homo sapiens', format='gmt'), read it, run enricher/GSEA on the pinned sets, and report the date in methods. gson_WP() freezes only within a session (it snapshots current/), not across time.
The WP GMT speaks Entrez, and the wrong ID type fails silently. The GMT is Entrez-keyed via BridgeDb. Passing SYMBOL or ENSEMBL yields near-zero overlap and an empty or misleading result with NO error - convert to Entrez upstream (bitr/OrgDb) before enrichWP. Likewise universe=NULL makes the background "all genes that happen to be in WP" - a small, biased set that inflates significance; pass the assayed/tested Entrez vector as universe.
A community pathway is a hypothesis someone drew, not a reviewed fact. The two things that make WP valuable (open CC0 license, anyone-can-edit curation that captures disease/drug pathways KEGG and Reactome lack, e.g. the COVID-19 Disease Map) are the same two things that make its quality heterogeneous. Many WP pathways are also imported from KEGG/Reactome, so "three databases agree" can be circular rather than independent. Treat each hit as a community claim - check getPathwayInfo(WPID) last-edit/curation before leaning on a single WP pathway for a key conclusion - and run WP as a COMPLEMENT to KEGG/Reactome, never a sole peer-reviewed source.
the WP GMT is Entrez-keyed; other types overlap nothing
Over-Representation Analysis (enrichWP)
Goal: Find WikiPathways over-represented in a thresholded gene list, against a defensible background.
Approach: Convert significant genes to Entrez, pass the tested-gene set as universe, run enrichWP, then make the result readable. enrichWP downloads the current/ GMT - acceptable for exploration, but pin a date for anything reportable.
library(clusterProfiler)
library(org.Hs.eg.db)# enrichWP downloads the current/ WP GMT over the network; symbols/Ensembl must be Entrez first
sig <- bitr(sig_symbols, fromType='SYMBOL', toType='ENTREZID', OrgDb=org.Hs.eg.db)$ENTREZID
all_entrez <- bitr(tested_symbols, fromType='SYMBOL', toType='ENTREZID', OrgDb=org.Hs.eg.db)$ENTREZID
wp <- enrichWP(gene=sig, organism='Homo sapiens', universe=all_entrez,
pvalueCutoff=0.05, pAdjustMethod='BH', minGSSize=10, maxGSSize=500, qvalueCutoff=0.2)
wp <- setReadable(wp, OrgDb=org.Hs.eg.db, keyType='ENTREZID')# geneID column -> symbols
as.data.frame(wp)# ID=WPID, Description, GeneRatio, BgRatio, p.adjust, qvalue, Count
GSEA (gseWP)
Goal: Find WikiPathways whose genes shift coordinately across the full ranking, with no cutoff.
Approach: Build a NAMED Entrez vector sorted DECREASING by the ranking metric, fix the permutation seed, then run gseWP. There is no universe argument - FCS uses the whole ranked list.
Reproducible Analysis with a Dated GMT (the correct pattern)
Goal: Make a WP analysis reproducible across re-runs by pinning a dated release instead of pulling current/.
Approach: Download a dated GMT (pass format='gmt' - the default is gpml), split the compound name%version%wpid%org term field into TERM2GENE/TERM2NAME, run enricher/GSEA on the pinned sets, and report the date in methods.
library(rWikiPathways)
library(tidyr)# downloadPathwayArchive needs an organism to actually download a file (organism=NULL opens the index)
gmt <- downloadPathwayArchive(date='20240310', organism='Homo sapiens', format='gmt', destpath=tempdir())
wp2gene <- read.gmt(file.path(tempdir(), gmt))
wp2gene <- separate(wp2gene, term,c('name','version','wpid','org'), sep='%')# term is a %-joined compound
t2g <- wp2gene[,c('wpid','gene')]# TERM2GENE
t2n <- wp2gene[,c('wpid','name')]# TERM2NAME
wp_pinned <- enricher(sig, universe=all_entrez, TERM2GENE=t2g, TERM2NAME=t2n)# report date='20240310'
gson_WP(organism) returns a GSON snapshot object, but it still pulls current/ - it freezes a session, NOT a chosen historical date. Only the dated downloadPathwayArchive GMT survives a re-run months later.
Query the Database Directly (rWikiPathways)
library(rWikiPathways)
listOrganisms()# supported species (full scientific names; ~30+)
listPathways('Homo sapiens')# all WPIDs + names for a species
getPathwayInfo('WP554')# metadata incl. last-edit; check before trusting a single hit
getXrefList('WP554','L')# genes by BridgeDb system code: 'L'=Entrez, 'H'=HGNC, 'En'=Ensembl
findPathwaysByText('cancer')# text search (searchPathways() is NOT a current function)
Other Organisms
wp_mouse <- enrichWP(gene=mouse_entrez, organism='Mus musculus')
wp_zfish <- enrichWP(gene=zfish_entrez, organism='Danio rerio')# verify the exact organism string before running:
get_wp_organisms()# plural accessor; the string must match exactly
Per-Method Failure Modes
Unpinned current/ release
Trigger: running enrichWP/gseWP/gson_WP without downloadPathwayArchive(date=). Mechanism: all three download data.wikipathways.org/current/, the latest monthly release. Symptom: the same script returns different pathways/p-values months apart, with no error. Fix: pin a dated GMT, run enricher/GSEA on it, and report the date.
Symbols or Ensembl into an Entrez GMT
Trigger: passing SYMBOL/ENSEMBL IDs to enrichWP/gseWP. Mechanism: the WP GMT is Entrez-keyed via BridgeDb, so non-Entrez IDs overlap nothing. Symptom: an empty or near-empty result, NO error. Fix:bitr to ENTREZID first; confirm the conversion rate before trusting the result.
Default universe inflates significance
Trigger:universe=NULL (the default). Mechanism:enricher then uses "all genes in the WP GMT" as background - a small, biased set, not the assayed genes. Symptom: implausibly strong p-values for tissue-specific or off-target pathways. Fix: pass the tested-gene Entrez vector as universe.
gson_WP mistaken for a reproducibility pin
Trigger: treating gson_WP() as "the snapshot" for a reproducible analysis. Mechanism: it snapshots current/ into an object - it freezes a session, not a historical date. Symptom: a re-run months later gives a different snapshot. Fix: use the dated downloadPathwayArchive GMT for cross-time reproducibility.
Unsplit GMT term field
Trigger:read.gmt on a WP GMT without splitting the term. Mechanism: the set-name field is a compound name%version%wpid%org joined by %. Symptom: WPIDs and clean names are buried in one column; TERM2GENE/TERM2NAME are wrong. Fix:separate(., term, c('name','version','wpid','org'), sep='%') (or use read.gmt.wp).
searchPathways() is gone
Trigger: calling searchPathways('cancer', 'Homo sapiens'). Mechanism: it is not a current rWikiPathways function. Symptom: an error. Fix:findPathwaysByText() / findPathwayIdsByText().
format defaults to gpml
Trigger:downloadPathwayArchive(date=, organism=) without format='gmt'. Mechanism:format defaults to gpml, which read.gmt cannot read. Symptom: a GPML file or a parse error. Fix: pass format='gmt'.
Quantitative Thresholds
Threshold
Source
Rationale
pvalueCutoff=0.05
enricher/GSEA default
filters on p.adjust (BH) by default; standard FDR gate
qvalueCutoff=0.2
clusterProfiler enricher default
secondary q-value gate on ORA
pAdjustMethod='BH'
clusterProfiler default
Benjamini-Hochberg FDR; not Bonferroni (too conservative for gene-set screens)
minGSSize=10
enricher/GSEA default
drop tiny WP pathways that overfit; many WP specialist sets fall below this and are never tested
maxGSSize=500
enricher/GSEA default
drop overly broad sets that always "enrich"
set.seed(123) for gseWP
reproducibility convention
permutation p-values drift across runs without a fixed seed (any fixed seed works)
Pin date='YYYYMMDD'
Martens 2021 NAR 49:D613
WP republishes monthly; current/ is not a version, so report the dated release
Common Errors
Error / symptom
Cause
Solution
enrichWP returns 0 terms
passed SYMBOL/ENSEMBL not Entrez
bitr to ENTREZID first
Implausibly significant pathways
universe=NULL (all-WP-genes background)
pass the tested-gene Entrez vector as universe
Different results each run
unpinned current/ release
downloadPathwayArchive(date=, format='gmt'); report the date