prefix_cells_seurat: Add Prefixes to Cell Names in Seurat Objects

View source: R/Seurat.Utils.R

prefix_cells_seuratR Documentation

Add Prefixes to Cell Names in Seurat Objects

Description

Adds prefixes derived from a vector of identifiers to cell names in a list of Seurat objects. This is useful for ensuring unique cell names across multiple samples or conditions when combining or comparing datasets.

Usage

prefix_cells_seurat(ls_obj, obj_IDs)

Arguments

ls_obj

List of Seurat S4 objects to which prefixes will be added. Each object should correspond to a different sample or condition.

obj_IDs

Character vector of identifiers that will be used as prefixes. Each identifier in the vector corresponds to a Seurat object in ls_obj. The length of obj_IDs must match the length of ls_obj.

Value

A list of Seurat objects with updated cell names, incorporating the specified prefixes.

Examples

## Not run: 
# Assuming seurat_obj1 and seurat_obj2 are Seurat objects
ls_obj <- list(seurat_obj1, seurat_obj2)
obj_IDs <- c("sample1", "sample2")
ls_obj_prefixed <- prefix_cells_seurat(ls_obj = ls_obj, obj_IDs = obj_IDs)
# Now each cell name in seurat_obj1 and seurat_obj2 will be prefixed with 'sample1_' and 'sample2_', respectively.

## End(Not run)


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