knn_refine: Refine cell type labels with knn classifier

View source: R/classify.R

knn_refineR Documentation

Refine cell type labels with knn classifier

Description

Assigns the label that most neighbors have, given it is more than min_knn_prob. I've found empirically on the MALT data that min_knn_prob=0.5 gives good results, whether you classify the entire data set or just a single cell type. It simply excludes some of the cells that have more than 2 cell types in their neighborhood and none is much stronger than the others, so this is a reasonable, conservative filtering.

Usage

knn_refine(labels, neighbors, min_knn_prob = 0.5)

Arguments

labels

Cell type labels as character or factor.

neighbors

Neighbor graph, pass obj$neighbors.

min_knn_prob

Value between 0 and 1, defaults to 0.5. If the 'winning label' is below this proportion of kNN that have it, knn_refine will return "Unassigned".

Value

Character vector with refined labels.


cellpypes documentation built on May 29, 2024, 1:24 a.m.