SKILL.md
Version Compatibility
Reference examples tested with: R stats (base), ReactomePA 1.46+, clusterProfiler 4.10+
Before using code patterns, verify installed versions match. If versions differ:
- R:
packageVersion('<pkg>')then?function_nameto 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.
Reactome Pathway Enrichment
Core Pattern - Over-Representation Analysis
Goal: Identify Reactome pathways over-represented in a gene list from differential expression or other analyses.
Approach: Test for enrichment using the hypergeometric test via ReactomePA enrichPathway against curated peer-reviewed pathways.
"Run pathway enrichment against Reactome" → Test whether genes in curated Reactome pathways are over-represented among significant genes.
library(ReactomePA)
library(org.Hs.eg.db)
pathway_result <- enrichPathway(
gene = entrez_ids, # Character vector of Entrez IDs
organism = 'human', # human, rat, mouse, celegans, yeast, zebrafish, fly
pvalueCutoff = 0.05,
pAdjustMethod = 'BH',
readable = TRUE # Convert to gene symbols
)
head(as.data.frame(pathway_result))
Prepare Gene List from DE Results
Goal: Extract significant Entrez gene IDs from differential expression results for Reactome enrichment.
Approach: Filter by significance and fold change, then convert symbols to Entrez IDs using bitr.
library(clusterProfiler)
de_results <- read.csv('de_results.csv')
sig_genes <- de_results[de_results$padj < 0.05 & abs(de_results$log2FoldChange) > 1, 'gene_symbol']
gene_ids <- bitr(sig_genes, fromType = 'SYMBOL', toType = 'ENTREZID', OrgDb = org.Hs.eg.db)
entrez_ids <- gene_ids$ENTREZID
GSEA on Reactome Pathways
Detect coordinated expression changes in Reactome pathways using all genes ranked by a statistic.
