Skip to contents

This is a modified version of harmony::RunHarmony specifically designed for compatibility with RunSymphonyMap.

Usage

RunHarmony2(object, ...)

# S3 method for class 'Seurat'
RunHarmony2(
  object,
  group.by.vars,
  reduction = "pca",
  dims.use = 1:30,
  project.dim = TRUE,
  reduction.name = "Harmony",
  reduction.key = "Harmony_",
  verbose = TRUE,
  seed.use = 11L,
  ...
)

Arguments

object

A Seurat object.

...

Additional arguments to be passed to the harmony::RunHarmony function.

group.by.vars

A character vector specifying the batch variable name.

reduction

A character string specifying the reduction to be used. Default is "pca".

dims.use

An integer vector specifying the dimensions to be used. Default is 1:30.

project.dim

A logical value indicating whether to project dimension reduction loadings. Default is TRUE.

reduction.name

A character string specifying the name of the reduction to be stored in the Seurat object. Default is "Harmony".

reduction.key

A character string specifying the prefix for the column names of the Harmony embeddings. Default is "Harmony_".

verbose

A logical value indicating whether to print verbose output. Default is TRUE.

seed.use

An integer specifying the random seed to be used. Default is 11.

Examples

panc8_sub <- RunHarmony2(
  panc8_sub,
  group.by.vars = "tech",
  reduction = "pca"
)
#> Transposing data matrix
#> Initializing state using k-means centroids initialization
#> Harmony 1/10
#> Harmony 2/10
#> Harmony 3/10
#> Harmony 4/10
#> Harmony 5/10
#> Harmony 6/10
#> Harmony 7/10
#> Harmony converged after 7 iterations
CellDimPlot(
  panc8_sub,
  group.by = c("tech", "celltype"),
  reduction = "pca"
)
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.

CellDimPlot(
  panc8_sub,
  group.by = c("tech", "celltype"),
  reduction = "Harmony"
)
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.