annotate.by.neighbors | R Documentation |
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).
annotate.by.neighbors(
obj,
ref.cells = NULL,
reduction = "pca",
ndim = NULL,
k = 20,
ncores = 1,
bg.pseudocount = 10^9,
labels.col = "functional.cluster"
)
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 |
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.
# Fully annotate object, where partial annotations are stored in metadata column "celltype"
obj.full <- annotate.by.neighbors(obj.partial, labels.col="celltype")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.