SplitObject: Splits object into a list of subsetted objects.

Description Usage Arguments Value Examples

View source: R/objects.R

Description

Splits object based on a single attribute into a list of subsetted objects, one for each level of the attribute. For example, useful for taking an object that contains cells from many patients, and subdividing it into patient-specific objects.

Usage

1
SplitObject(object, split.by = "ident")

Arguments

object

Seurat object

split.by

Attribute for splitting. Default is "ident". Currently only supported for class-level (i.e. non-quantitative) attributes.

Value

A named list of Seurat objects, each containing a subset of cells from the original object.

Examples

1
2
3
4
5
6
data("pbmc_small")
# Assign the test object a three level attribute
groups <- sample(c("group1", "group2", "group3"), size = 80, replace = TRUE)
names(groups) <- colnames(pbmc_small)
pbmc_small <- AddMetaData(object = pbmc_small, metadata = groups, col.name = "group")
obj.list <- SplitObject(pbmc_small, split.by = "group")

ibseq/scs-analysis documentation built on Feb. 27, 2021, 12:35 a.m.