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 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 <- Standard_SCP(panc8_sub)
#> [2025-09-08 16:14:03.674449] Start Standard_SCP
#> [2025-09-08 16:14:03.674594] Checking srtList... ...
#> Warning: Failed to check Seurat version compatibility: 'list' object cannot be coerced to type 'double'
#> Warning: The following arguments are not used: drop
#> Warning: The following arguments are not used: drop
#> Error in as.vector(data): no method for coercing this S4 class to a vector
panc8_sub <- RunHarmony2(panc8_sub, group.by.vars = "tech", reduction = "Standardpca")
#> Error in check_R("harmony@1.1.0"): could not find function "check_R"
CellDimPlot(panc8_sub, group.by = c("tech", "celltype"), reduction = "Standardpca")
#> Error in DefaultReduction(srt, pattern = reduction): Unable to find any reductions.
CellDimPlot(panc8_sub, group.by = c("tech", "celltype"), reduction = "Harmony")
#> Error in DefaultReduction(srt, pattern = reduction): Unable to find any reductions.