6.4 Batch Effect Correction wtih Harmony

Sometimes the iterative LSI approach isnt enough of a correction for strong batch effect differences. For this reason, ArchR implements a commonly used batch effect correction tool called Harmony which was originally designed for scRNA-seq. We provide a wrapper that will pass a dimensionality reduction object from ArchR directly to the HarmonyMatrix() function. Additional arguments can be directly passed to HarmonyMatrix() in the function via the additional parameters (...) . See ?addHarmony() for more details. Users should be aware of the caveats of batch correction for their particular application.

projHeme2 <- addHarmony(
    ArchRProj = projHeme2,
    reducedDims = "IterativeLSI",
    name = "Harmony",
    groupBy = "Sample"
)
## Harmony 1/10
## Harmony 2/10
## Harmony 3/10
## Harmony converged after 3 iterations

This process creates a new reducedDims object called “Harmony” in our projHeme2 object. For downstream functions where you would like to use this new reducedDims object, you should make sure to pass it to the reducedDims paramter, for example with addImputeWeights() or other functions that use a reducedDims object. In the context of this tutorial, the data does not really benefit from batch correction so we will continue to use the IterativeLSI reducedDims object.