subsetSeuObjByIdent: Subset a Seurat Object by Identity

View source: R/Seurat.Utils.R

subsetSeuObjByIdentR Documentation

Subset a Seurat Object by Identity

Description

Subsets a Seurat object based on a specified identity column and values. It allows for an optional inversion of the selection.

Usage

subsetSeuObjByIdent(
  obj = combined.obj,
  ident = GetClusteringRuns()[1],
  identGroupKeep,
  invert = FALSE
)

Arguments

obj

A Seurat object. Default: NULL.

ident

The name of the identity column to use for subsetting. It is recommended to specify this explicitly. Default: First entry from the result of GetClusteringRuns().

identGroupKeep

A vector of cluster values for which cells should be matched and retained. This parameter does not have a default value and must be specified.

invert

A logical indicating whether to invert the selection, keeping cells that do not match the specified identity values. Default: FALSE.

Value

A Seurat object subsetted based on the specified identity and identity values.

Examples

# Assuming `seurat_obj` is your Seurat object and you want to subset based on cluster 1
subsetted_obj <- subsetSeuObjByIdent(
  obj = seurat_obj, ident = "your_ident_column",
  identGroupKeep = c(1), invert = FALSE
)


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.