Merges raw.data and scale.data of object, and creates Seurat object with these values along with slots containing dimensionality reduction coordinates, iNMF factorization, and cluster assignments. Supports Seurat V3/4 and V4.

# S3 method for liger
as.Seurat(
  x,
  nms = names(x@H),
  renormalize = TRUE,
  use.liger.genes = TRUE,
  by.dataset = FALSE,
  keep_meta = TRUE,
  reduction_label = "UMAP",
  seurat_assay = "RNA",
  assay_type = NULL,
  add_barcode_names = FALSE,
  barcode_prefix = TRUE,
  barcode_cell_id_delimiter = "_",
  ...
)

Arguments

x

liger object.

nms

By default, labels cell names with dataset of origin (this is to account for cells in different datasets which may have same name). Other names can be passed here as vector, must have same length as the number of datasets. (default names(H)).

renormalize

Whether to log-normalize raw data using Seurat defaults (default TRUE).

use.liger.genes

Whether to carry over variable genes (default TRUE).

by.dataset

Include dataset of origin in cluster identity in Seurat object (default FALSE).

keep_meta

logical. Whether to transfer additional metadata (nGene/nUMI/dataset already transferred) to new Seurat Object. Default is TRUE.

reduction_label

Name of dimensionality reduction technique used. Enables accurate transfer or name to Seurat object instead of defaulting to "tSNE".

seurat_assay

Name to set for assay in Seurat Object. Default is "RNA".

assay_type

what type of Seurat assay to create in new object (Assay vs Assay5). Default is NULL which will default to the current user settings. See Convert_Assay parameter convert_to for acceptable values.

add_barcode_names

logical, whether to add dataset names to the cell barcodes when creating Seurat object, default is FALSE.

barcode_prefix

logical, if add_barcode_names = TRUE should the names be added as prefix to current cell barcodes/names or a suffix (default is TRUE; prefix).

barcode_cell_id_delimiter

The delimiter to use when adding dataset id to barcode prefix/suffix. Default is "_".

...

unused.

Value

Seurat object with raw.data, scale.data, reduction_label, iNMF, and ident slots set.

Seurat object.

Details

Stores original dataset identity by default in new object metadata if dataset names are passed in nms. iNMF factorization is stored in dim.reduction object with key "iNMF".

References

Original function is part of LIGER package https://github.com/welch-lab/liger (Licence: GPL-3). Function was modified for use in scCustomize with additional parameters/functionality.

Examples

if (FALSE) {
seurat_object <- as.Seurat(x = liger_object)
}