13.3 Pairwise Testing Between Groups
Marker feature identification is a very specific type of differential test. However, ArchR also enables standard differential testing using the same getMarkerFeatures()
function. The trick is to set useGroups
to one of the two cell groups and bgdGroups
to the other cell group. This performs a differential test between the two provided groups. To be explicitly clear, the cell groups here are user-defined. They can be anything that fits your application. All you need to do is add a new column to cellColData
that defines the groups that you would like to compare. In all differential tests, the peaks that are higher in the group passed to useGroups
will have positive fold change values while the peaks that are higher in the group passed to bgdGroups
will have negative fold change values.
Here we perform a pairwise test between the “Erythroid” cell group and the “Progenitor” cell group.
<- getMarkerFeatures(
markerTest ArchRProj = projHeme5,
useMatrix = "PeakMatrix",
groupBy = "Clusters2",
testMethod = "wilcoxon",
bias = c("TSSEnrichment", "log10(nFrags)"),
useGroups = "Erythroid",
bgdGroups = "Progenitor"
)## ArchR logging to : ArchRLogs/ArchR-getMarkerFeatures-371b073b94818-Date-2022-12-23_Time-07-45-54.log
## If there is an issue, please report to github with logFile!
## MatrixClass = Sparse.Integer.Matrix
## 2022-12-23 07:45:56 : Matching Known Biases, 0.005 mins elapsed.
## 2022-12-23 07:46:05 : Computing Pairwise Tests (1 of 1), 0.159 mins elapsed.
## Pairwise Test Erythroid : Seqnames chr1
## Pairwise Test Erythroid : Seqnames chr10
## Pairwise Test Erythroid : Seqnames chr11
## Pairwise Test Erythroid : Seqnames chr12
## Pairwise Test Erythroid : Seqnames chr13
## Pairwise Test Erythroid : Seqnames chr14
## Pairwise Test Erythroid : Seqnames chr15
## Pairwise Test Erythroid : Seqnames chr16
## Pairwise Test Erythroid : Seqnames chr17
## Pairwise Test Erythroid : Seqnames chr18
## Pairwise Test Erythroid : Seqnames chr19
## Pairwise Test Erythroid : Seqnames chr2
## Pairwise Test Erythroid : Seqnames chr20
## Pairwise Test Erythroid : Seqnames chr21
## Pairwise Test Erythroid : Seqnames chr22
## Pairwise Test Erythroid : Seqnames chr3
## Pairwise Test Erythroid : Seqnames chr4
## Pairwise Test Erythroid : Seqnames chr5
## Pairwise Test Erythroid : Seqnames chr6
## Pairwise Test Erythroid : Seqnames chr7
## Pairwise Test Erythroid : Seqnames chr8
## Pairwise Test Erythroid : Seqnames chr9
## Pairwise Test Erythroid : Seqnames chrX
## ###########
## 2022-12-23 07:46:51 : Completed Pairwise Tests, 0.923 mins elapsed.
## ###########
## ArchR logging successful to : ArchRLogs/ArchR-getMarkerFeatures-371b073b94818-Date-2022-12-23_Time-07-45-54.log
We can then plot an MA or Volcano plot using the plotMarkers()
function. We indicate an MA plot using plotAs = "MA"
.
<- plotMarkers(seMarker = markerTest, name = "Erythroid", cutOff = "FDR <= 0.1 & abs(Log2FC) >= 1", plotAs = "MA")
pma
pma## Warning: Removed 56 rows containing missing values (geom_point_rast).
Similarly, we plot a volvano plot using plotAs = "Volcano"
.
<- plotMarkers(seMarker = markerTest, name = "Erythroid", cutOff = "FDR <= 0.1 & abs(Log2FC) >= 1", plotAs = "Volcano")
pv
pv## Warning: Removed 56 rows containing missing values (geom_point_rast).
To save an editable vectorized version of these plots, we use the plotPDF()
function.
plotPDF(pma, pv, name = "Erythroid-vs-Progenitor-Markers-MA-Volcano", width = 5, height = 5, ArchRProj = projHeme5, addDOC = FALSE)
## Plotting Ggplot!
## Plotting Ggplot!
We will continue this differential analysis in the next chapter by looking for motif enrichments in our differentially accessible peaks.