merge.Seurat: Merge Seurat Objects

View source: R/seurat.R

merge.SeuratR Documentation

Merge Seurat Objects

Description

Merge Seurat Objects

Usage

## S3 method for class 'Seurat'
merge(
  x = NULL,
  y = NULL,
  add.cell.ids = NULL,
  collapse = FALSE,
  merge.data = TRUE,
  merge.dr = FALSE,
  project = getOption(x = "Seurat.object.project", default = "SeuratProject"),
  ...
)

Arguments

x

A Seurat object

y

A single Seurat object or a list of Seurat objects

add.cell.ids

A character vector of length(x = c(x, y)); appends the corresponding values to the start of each objects' cell names

collapse

If TRUE, merge layers of the same name together; if FALSE, appends labels to the layer name

merge.data

Merge the data slots instead of just merging the counts (which requires renormalization); this is recommended if the same normalization approach was applied to all objects

merge.dr

Choose how to handle merging dimensional reductions:

  • TRUE”: merge dimensional reductions with the same name across objects; dimensional reductions with different names are added as-is

  • NA”: keep dimensional reductions from separate objects separate; will append the project name for duplicate reduction names

  • FALSE”: do not add dimensional reductions

project

Project name for the Seurat object

...

Arguments passed to other methods

Value

merge: Merged object

Merge Details

When merging Seurat objects, the merge procedure will merge the Assay level counts and potentially the data slots (depending on the merge.data parameter). It will also merge the cell-level meta data that was stored with each object and preserve the cell identities that were active in the objects pre-merge. The merge will optionally merge reductions depending on the values passed to merge.dr if they have the same name across objects. Here the embeddings slots will be merged and if there are differing numbers of dimensions across objects, only the first N shared dimensions will be merged. The feature loadings slots will be filled by the values present in the first object.The merge will not preserve graphs, logged commands, or feature-level metadata that were present in the original objects. If add.cell.ids isn't specified and any cell names are duplicated, cell names will be appended with _X, where X is the numeric index of the object in c(x, y).

See Also

Seurat object, validity, and interaction methods $.Seurat(), Seurat-class, Seurat-validity, [[.Seurat(), [[<-,Seurat,NULL, [[<-,Seurat, dim.Seurat(), dimnames.Seurat(), names.Seurat(), subset.Seurat()

Examples

# `merge' examples
# merge two objects
merge(pbmc_small, y = pbmc_small)
# to merge more than two objects, pass one to x and a list of objects to y
merge(pbmc_small, y = c(pbmc_small, pbmc_small))


SeuratObject documentation built on Nov. 18, 2023, 1:06 a.m.