omics.co.in logo omics.co.in

11: Functional Enrichment & Pathway Mining

Tested Stacks: GATK 4.6.1 Samtools 1.21 Nextflow 24.10 Seurat v5.1 Python 3.12
Prerequisites: Basic Linux CLI & Sequencing Formats
📚 Chapter 11 of 13 0% Course Completed
📊 Downloadable Lesson R Script 4.3 KB

r11_pathway_enrichment_clusterprofiler.R

Over-Representation Analysis (ORA) via hypergeometric distribution, curated oncogenic pathway databases, fold enrichment metrics, and Benjamini-Hochberg FDR ranking.

$ Rscript r11_pathway_enrichment_clusterprofiler.R

Chapter 11: Functional Enrichment Analysis & Pathway Mining (clusterProfiler)

Translating lists of hundreds of differentially expressed genes into biological insight requires functional enrichment testing against Gene Ontology (GO) and KEGG databases using clusterProfiler.

1. Over-Representation Analysis (ORA)

Testing for statistical over-representation of Gene Ontology Biological Process (BP) terms:

library(clusterProfiler)
library(org.Hs.eg.db)

ego <- enrichGO(
    gene          = sig_entrez_ids,
    universe      = universe_entrez_ids,
    OrgDb         = org.Hs.eg.db,
    ont           = "BP",
    pAdjustMethod = "BH",
    pvalueCutoff  = 0.01,
    qvalueCutoff  = 0.05,
    readable      = TRUE
)
head(ego)

2. Visualizing Enriched Biological Pathways

# Dotplot of top 10 enriched pathways
dotplot(ego, showCategory = 10, title = "Enriched Gene Ontology Terms")

# Gene-concept network plot (cnetplot)
cnetplot(ego, categorySize = "pvalue", foldChange = gene_log2fc)
⚠️

Common Pitfalls & Troubleshooting Checklist

  • Java Heap Exhaustion (GATK / Picard): If processes terminate with java.lang.OutOfMemoryError, set your environment variable explicitly: export _JAVA_OPTIONS="-Xmx16g -Djava.io.tmpdir=/tmp".
  • Index Timestamp Mismatch: If tools complain that a BAM index is missing or out of date, regenerate with samtools index -@ 4 sample.bam.
  • Conda Channel Conflicts: Avoid ABI incompatibilities between bioconda and conda-forge by setting strict priority: conda config --set channel_priority strict.
  • Chromosome Naming Contamination: Always verify whether reference FASTA headers use chr1 or 1; divergent naming causes silent alignment drops.
Was this guide helpful to your research?
Help us maintain 100% accurate, peer-reviewed bioinformatics standards.
📝 Propose Edit on GitHub ↗