RelabelSmallCategories: Relabel Small Categories / Clusters

View source: R/Seurat.Utils.R

RelabelSmallCategoriesR Documentation

Relabel Small Categories / Clusters

Description

Relabels small categories in a specified metadata column of a Seurat object. Categories with cell counts less than a minimum count are relabeled to a specified label. The function adds a new metadata column with the updated labels.

Usage

RelabelSmallCategories(
  obj,
  col_in,
  backup_col_name = ppp(col_in, "orig"),
  min_count = 100,
  small_label = "Other",
  v = TRUE
)

Arguments

obj

Seurat object. The Seurat object containing the metadata.

col_in

Character string. Name of the metadata column to process.

backup_col_name

Character string. Name of the new metadata column where to backup the original values. Default: ppp(col_in, "orig").

min_count

Numeric. Minimum number of cells required for a category to be retained. Categories with counts less than this number will be relabeled. Default: 100

small_label

Character string. Label to assign to small categories. Default: "Other".

v

Logical. If TRUE, prints verbose output. Default: TRUE.

Value

Seurat object. The modified Seurat object with the new metadata column added.

Examples

# Assuming 'seurat_obj' is your Seurat object
seurat_obj <- RelabelSmallCategories(
  obj = seurat_obj,
  col_in = "cell_type",
  min_count = 50,
  small_label = "MinorType",
  v = TRUE
)


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