Harmony is an algorithm that projects cells into a shared embedding in which cells group by cell type rather than dataset-specific conditions.

runHarmony(
  inSCE,
  useAssay = "logcounts",
  useReducedDim = NULL,
  batch = "batch",
  reducedDimName = "HARMONY",
  nComponents = 50,
  lambda = 0.1,
  theta = 5,
  sigma = 0.1,
  nIter = 10,
  verbose = TRUE,
  ...
)

Arguments

inSCE

Input SingleCellExperiment object

useAssay

A single character indicating the name of the assay requiring batch correction. Default "logcounts".

useReducedDim

A single character indicating the name of the reducedDim used to be corrected. Specifying this will ignore useAssay. Default NULL.

batch

A single character indicating a field in colData that annotates the batches of each cell; or a vector/factor with the same length as the number of cells. Default "batch".

reducedDimName

A single character. The name for the corrected low-dimensional representation. Will be saved to reducedDim(inSCE). Default "HARMONY".

nComponents

An integer. The number of PCs to use and generate. Default 50L.

lambda

A Numeric scalar. Ridge regression penalty parameter. Must be strictly positive. Smaller values result in more aggressive correction. Default 0.1.

theta

A Numeric scalar. Diversity clustering penalty parameter. Larger values of theta result in more diverse clusters. theta=0 does not encourage any diversity. Default 5.

sigma

A Numeric scalar. Width of soft kmeans clusters. Larger values of sigma result in cells assigned to more clusters. Smaller values of sigma make soft kmeans cluster approach hard clustering. Default 0.1.

nIter

An integer. The max number of iterations to perform. Default 10L.

verbose

Whether to print progress messages. Default TRUE.

...

Other arguments passed to HarmonyMatrix. See details.

Value

The input SingleCellExperiment object with reducedDim(inSCE, reducedDimName) updated.

Details

Since some of the arguments of HarmonyMatrix is controlled by this wrapper function. The additional arguments users can work with only include: nclust, tau, block.size, max.iter.cluster, epsilon.cluster, epsilon.harmony, plot_convergence, reference_values and cluster_prior.

References

Ilya Korsunsky, et al., 2019

Examples

data('sceBatches', package = 'singleCellTK')
logcounts(sceBatches) <- log1p(counts(sceBatches))
if (FALSE) {
if (require("harmony"))
    sceCorr <- runHarmony(sceBatches)
}