14.3 Custom Enrichment
In addition to all of these curated annotation sets, ArchR is also capable of accepting user-defined annotations to perform custom enrichments. In the below example, we illustrate how to create a custom annotation based on select ENCODE ChIP-seq experiments.
First, we will define the datasets that will be used and provide links for their download. Local files could be used in the same way.
EncodePeaks <- c(
Encode_K562_GATA1 = "https://www.encodeproject.org/files/ENCFF632NQI/@@download/ENCFF632NQI.bed.gz",
Encode_GM12878_CEBPB = "https://www.encodeproject.org/files/ENCFF761MGJ/@@download/ENCFF761MGJ.bed.gz",
Encode_K562_Ebf1 = "https://www.encodeproject.org/files/ENCFF868VSY/@@download/ENCFF868VSY.bed.gz",
Encode_K562_Pax5 = "https://www.encodeproject.org/files/ENCFF339KUO/@@download/ENCFF339KUO.bed.gz"
)
We then add a custom annotation to our ArchRProject
using the addPeakAnnotation()
function. Here, we call our custom annotation “ChIP”.
projHeme5 <- addPeakAnnotations(ArchRProj = projHeme5, regions = EncodePeaks, name = "ChIP")
## ArchR logging to : ArchRLogs/ArchR-addPeakAnnotations-975f91f16-Date-2025-02-06_Time-02-13-02.630154.log
## If there is an issue, please report to github with logFile!
## 2025-02-06 02:13:06.471801 : Creating Peak Overlap Matrix, 0.064 mins elapsed.
## 2025-02-06 02:13:06.610289 : All Regions Overlap at least 1 peak!, 0.066 mins elapsed.
As before, we use this custom annotation to perform the peak annotation enrichment using peakAnnoEnrichment()
and follow the same steps to create our annotation heatmap.
enrichRegions <- peakAnnoEnrichment(
seMarker = markerPeaks,
ArchRProj = projHeme5,
peakAnnotation = "ChIP",
cutOff = "FDR <= 0.1 & Log2FC >= 0.5"
)
## ArchR logging to : ArchRLogs/ArchR-peakAnnoEnrichment-95e7694d4-Date-2025-02-06_Time-02-13-07.999931.log
## If there is an issue, please report to github with logFile!
## 2025-02-06 02:13:11.317168 : Computing Enrichments 1 of 11, 0.055 mins elapsed.
## 2025-02-06 02:13:11.337248 : Computing Enrichments 2 of 11, 0.056 mins elapsed.
## 2025-02-06 02:13:11.355956 : Computing Enrichments 3 of 11, 0.056 mins elapsed.
## 2025-02-06 02:13:11.374193 : Computing Enrichments 4 of 11, 0.056 mins elapsed.
## 2025-02-06 02:13:11.391767 : Computing Enrichments 5 of 11, 0.057 mins elapsed.
## 2025-02-06 02:13:11.410138 : Computing Enrichments 6 of 11, 0.057 mins elapsed.
## 2025-02-06 02:13:11.427705 : Computing Enrichments 7 of 11, 0.057 mins elapsed.
## 2025-02-06 02:13:11.446458 : Computing Enrichments 8 of 11, 0.057 mins elapsed.
## 2025-02-06 02:13:11.467138 : Computing Enrichments 9 of 11, 0.058 mins elapsed.
## 2025-02-06 02:13:11.485943 : Computing Enrichments 10 of 11, 0.058 mins elapsed.
## 2025-02-06 02:13:11.504303 : Computing Enrichments 11 of 11, 0.058 mins elapsed.
## ArchR logging successful to : ArchRLogs/ArchR-peakAnnoEnrichment-95e7694d4-Date-2025-02-06_Time-02-13-07.999931.log
enrichRegions
## class: SummarizedExperiment
## dim: 4 11
## metadata(0):
## assays(10): mlog10Padj mlog10p ... CompareFrequency feature
## rownames(4): Encode_K562_GATA1 Encode_GM12878_CEBPB Encode_K562_Ebf1
## Encode_K562_Pax5
## rowData names(0):
## colnames(11): B CD4.M ... PreB Progenitor
## colData names(0):
heatmapRegions <- plotEnrichHeatmap(enrichRegions, n = 7, transpose = TRUE)
## ArchR logging to : ArchRLogs/ArchR-plotEnrichHeatmap-96c5b6fa9-Date-2025-02-06_Time-02-13-11.636966.log
## If there is an issue, please report to github with logFile!
## Adding Annotations..
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
##
## Set `ht_opt$message = FALSE` to turn off this message.
To save an editable vectorized version of this plot, we use the plotPDF()
function.