knn_refine {cellpypes}R 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.


[Package cellpypes version 0.3.0 Index]