classify putative cell types by given classifier.

predictCelltypes(classifier, data, prob = FALSE)

Arguments

classifier

a gknn classifier exported by buildClassifier.

data

A data.frame, containing features for gknn prediction.

prob

character specifying the return the class distribution for all k neighbors considered.

Value

A list with celltype factors for each cell and the probability.

Examples

data(iris)
iris[, 1:4] <- apply(iris[, 1:4], 2, function(.ele){
  (.ele-min(.ele))/max(.ele)
})
classifier <- buildClassifier(iris, colnames(iris)[1:4], iris$Species)
predictCelltypes(classifier, iris[c(1, 51, 101), ])
#> $celltypes
#>          1         51        101 
#>     setosa versicolor  virginica 
#> Levels: setosa versicolor virginica
#> 
#> $prob
#> NULL
#>