Skip to contents

This function performs automatic annotation of clusters in a Seurat object, based on a provided list of markers and cellular populations names. This function uses Seurat::AddModuleScore to attribute a score to each cell. Then, it gives to the cell to cell type corresponding to the highest score.

Usage

cell_annot_custom(
  sobj,
  assay = "RNA",
  layer_use = "data",
  newname = "annotation",
  markers = markers,
  use_negative = FALSE,
  add_score = FALSE,
  prefix = "score_",
  seed = 1337L,
  verbose = TRUE
)

Arguments

sobj

A Seurat object (no default)

assay

CHARACTER : on which assay from sobj to perform cell type annotation ? (default to 'RNA')

layer_use

CHARACTER : on which layer in the assay to perform cell type annotation (default to 'data')

newname

CHARACTER : name for the new column in metadata (default to 'annotation')

markers

LIST : a named list containing markers for each population (no default)

use_negative

LOGICAL : whether to use all markers as negative markers for each cell type or not, in the definition of cell type (default to FALSE)

add_score

LOGICAL : whether to add the columns containing scores to metadata in sobj (default to FALSE)

prefix

CHARACTER : if add_score is set to TRUE, the prefix for new column names in metadata. For example, if a population type is called "pop1", which names to give to the new column in metadata containing score ? If prefix is "score_", then new column will be "score_pop1" (default to "score_")

seed

INTEGER : the seed to be used by Seurat::AddModuleScore (default to 1337L)

verbose

LOGICAL : whether to print messages or not (default to TRUE)

Value

This function returns the input Seurat object with a new column in metadata, containing factor levels from names(markers)