Functional Genomic Annotation & Pathway Enrichment (ChIPseeker & clusterProfiler)
Functional Genomic Annotation & Pathway Enrichment (ChIPseeker & clusterProfiler)
Mapping differential peak coordinates to genomic features (promoter, 5' UTR, 3' UTR, exons, introns, distal intergenic) using ChIPseeker with TxDb.Hsapiens.UCSC.hg38.knownGene, plotting TSS distance distributions, and performing Gene Ontology and KEGG pathway over-representation analysis with clusterProfiler.
1. Peak Annotation with ChIPseeker
After identifying differentially bound peaks, we must map genomic coordinates to biological features: promoters ($\le 1\text{kb}$ or $\le 3\text{kb}$ upstream of TSS), 5' UTRs, 3' UTRs, coding exons, introns, and distal intergenic enhancers. We use the Bioconductor package ChIPseeker with human gene models from TxDb.Hsapiens.UCSC.hg38.knownGene.
library(ChIPseeker)
library(TxDb.Hsapiens.UCSC.hg38.knownGene)
library(org.Hs.eg.db)
library(clusterProfiler)
txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene
# Load significant differential peaks as GRanges
sigPeaksGR <- dba.report(dbObj, method = DBA_DESEQ2, th = 0.05, fold = 1)
# Annotate peaks relative to nearest TSS
peakAnno <- annotatePeak(sigPeaksGR,
tssRegion = c(-3000, 3000),
TxDb = txdb,
annoDb = "org.Hs.eg.db")
# Save annotation summary
peakAnnoDF <- as.data.frame(peakAnno)
write.csv(peakAnnoDF, "05_diffbind/chipseeker_annotated_peaks.csv", row.names = FALSE)
# Visualize genomic feature distribution pie chart
pdf("05_diffbind/feature_distribution.pdf", width = 7, height = 5)
plotAnnoPie(peakAnno)
dev.off()2. Pathway Enrichment with clusterProfiler
We isolate genes that exhibit significant loss of H3K4me3 in Huntington's Disease striatal tissues (hypo-methylated promoter peaks, $\text{Fold} < -1$) and perform over-representation analysis against Gene Ontology (GO) Biological Processes and KEGG pathways:
# Extract down-regulated promoter genes
down_genes <- subset(peakAnnoDF, Fold < -1)$geneId
# Run GO Biological Process overrepresentation
ego <- enrichGO(gene = down_genes,
OrgDb = org.Hs.eg.db,
keyType = 'ENTREZID',
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff = 0.01,
qvalueCutoff = 0.05)
# Save enrichment dotplot
pdf("05_diffbind/go_enrichment_dotplot.pdf", width = 9, height = 6)
dotplot(ego, showCategory = 15, title = "Enriched Pathways in Lost H3K4me3 Promoters (HD)")
dev.off()Biological Findings: Down-regulated promoters in Huntington's Disease strongly cluster into Synaptic Transmission, Dopamine Receptor Signaling, Neurotrophin Signaling (BDNF), and Calcium Homeostasis, validating the molecular mechanism of striatal neurodegeneration.
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
chr1or1; divergent naming causes silent alignment drops.