This function creates a liger
object from multiple (disjoint) Seurat objects or a single
(combined-analysis) Seurat object. It includes options for keeping the variable genes and cluster
identities from the original Seurat objects. Seurat V2 and V3 supported (though all objects
should share the same major version).
seuratToLiger(
objects,
combined.seurat = FALSE,
names = "use-projects",
meta.var = NULL,
assays.use = NULL,
raw.assay = "RNA",
remove.missing = TRUE,
renormalize = TRUE,
use.seurat.genes = TRUE,
num.hvg.info = NULL,
use.idents = TRUE,
use.tsne = TRUE,
cca.to.H = FALSE
)
liger
object.
One or more Seurat v2 objects. If passing multiple objects, should be in list.
Whether Seurat object (single) already contains multiple datasets (default FALSE).
Names to use for datasets in new liger object. If use-projects, takes project names from individual Seurat objects; if use-meta, takes value of object meta.data in meta.var column for each dataset; otherwise, user can pass in vector of names with same length as number of datasets. If combined.seurat, infers project names based on whether meta.var or assays.use is present (at least one required).
Seurat meta.data column name to use in naming datasets. Either meta.var or assays.use required if combined.seurat is TRUE (default NULL).
Names of Seurat v3 assays to use as separate datasets in conversion (e.g. RNA, ADT) (default NULL).
Name of Seurat v3 assay to use for raw data if meta.var used to split combined Seurat object -- in case integrated assay has been set as default (default "RNA").
Whether to remove missing genes/cells when converting raw.data to liger object (default TRUE).
Whether to automatically normalize raw.data once liger
object is created
(default TRUE).
Carry over variable genes from Seurat objects. If num.hvg.info is set, uses that value to get top most highly variable genes from hvg.info slot in Seurat objects. Otherwise uses var.genes slot in Seurat objects. For multiple datasets, takes the union of the variable genes. (default TRUE)
Number of highly variable genes to include from each object's hvg.info slot. Only available for Seurat v2 objects. If set, recommended value is 2000 (default NULL).
Carry over cluster identities from Seurat objects. If multiple objects with overlapping cluster names, will preface cluster names by dataset names to distinguish. (default TRUE).
Carry over t-SNE coordinates from Seurat object (only meaningful for combined analysis Seurat object). Useful for plotting directly afterwards. (default TRUE)
Carry over CCA (and aligned) loadings and insert them into H (and H.norm) slot in liger object (only meaningful for combined analysis Seurat object). Useful for plotting directly afterwards. (default FALSE)
if (packageVersion("Matrix") <= package_version("1.6.1.1")) {
ctrl.srt <- Seurat::CreateSeuratObject(ctrl, project = "ctrl")
stim.srt <- Seurat::CreateSeuratObject(stim, project = "stim")
ligerex <- seuratToLiger(list(ctrl = ctrl.srt, stim = stim.srt),
use.seurat.genes = FALSE)
}
Run the code above in your browser using DataLab