annotate.by.neighbors: Annotate by neighbors

annotate.by.neighborsR Documentation

Annotate by neighbors

Description

Given a partially annotated dataset, propagate labels to un-annotated cells (NA values) by similarity with annotated cells. This can be useful after integration of fully annotated datasets with other dataset that lack cell type annotation. Propagation of labels is done by K-nearest neighbors with annotated cells in a given dimensionality reduction (e.g. PCA space).

Usage

annotate.by.neighbors(
  obj,
  ref.cells = NULL,
  reduction = "pca",
  ndim = NULL,
  k = 20,
  ncores = 1,
  bg.pseudocount = 10^9,
  labels.col = "functional.cluster"
)

Arguments

obj

A Seurat object

ref.cells

Barcode of the cells to be used as reference to annotate all remaining cells. By default uses all annotated cells as reference (i.e. all cells with metadata column 'labels.col != NA').

reduction

Dimensionality reduction to be used for knn calculation

ndim

Number of dimensions to use in given reduction (by default use all dimensions)

k

Number of nearest neighbors for knn calculation

ncores

Number of cores for multi-thread execution

bg.pseudocount

Background counts for cell type frequency estimation

labels.col

Metadata column that stores cell type annotations to be propagated

Value

Returns a Seurat object with standard gene names. Genes not found in the standard list are removed. Synonyms are accepted when the conversion is not ambiguous.

Examples

# Fully annotate object, where partial annotations are stored in metadata column "celltype"
obj.full <- annotate.by.neighbors(obj.partial, labels.col="celltype")


carmonalab/STACAS documentation built on Feb. 3, 2024, 7:42 a.m.