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,
  assay = NULL,
  reduction = "pca",
  dims.use = 1:30,
  project.dim = TRUE,
  reduction.name = "Harmony",
  reduction.save = NULL,
  reduction.key = "Harmony_",
  verbose = TRUE,
  seed.use = 11,
  ...
)

Arguments

object

A Seurat object.

...

Additional arguments to be passed to harmony::RunHarmony.

group.by.vars

The batch variable name.

assay

Which assay to use. If NULL, the default assay of the Seurat object will be used. When the object also contains ChromatinAssay, the default assay and additional ChromatinAssay will be preprocessed sequentially.

reduction

Which dimensionality reduction to use. Default is "pca".

dims.use

The dimensions to be used. Default is 1:30.

project.dim

Whether to project dimension reduction loadings. Default is TRUE.

reduction.name

The name of the reduction to be stored in the Seurat object. Default is "Harmony".

reduction.save

Deprecated alias for reduction.name, retained for compatibility with harmony::RunHarmony.Seurat.

reduction.key

The prefix for the column names of the Harmony embeddings. Default is "Harmony_".

verbose

Whether to print the message. Default is TRUE.

seed.use

Random seed for reproducibility. Default is 11.

Examples

data(panc8_sub)
panc8_sub <- standard_scop(panc8_sub)
panc8_sub <- RunHarmony2(
  panc8_sub,
  group.by.vars = "tech",
  reduction = "pca"
)

CellDimPlot(
  panc8_sub,
  group.by = c("tech", "celltype"),
  reduction = "pca"
)

CellDimPlot(
  panc8_sub,
  group.by = c("tech", "celltype"),
  reduction = "Harmony"
)

panc8_sub <- standard_scop(
  panc8_sub,
  prefix = "Harmony",
  linear_reduction = "Harmony"
)

CellDimPlot(
  panc8_sub,
  group.by = c("tech", "celltype"),
  reduction = "StandardpcaUMAP2D"
)

CellDimPlot(
  panc8_sub,
  group.by = c("tech", "celltype"),
  reduction = "HarmonyUMAP2D"
)