knncolle / BiocNeighbors

Clone of the Bioconductor repository for the BiocNeighbors package.
https://bioconductor.org/packages/devel/bioc/html/BiocNeighbors.html
6 stars 11 forks source link

queryKNN returns empty list() which may cause bug in SingleR #8

Closed mimi3421 closed 5 years ago

mimi3421 commented 5 years ago

Dear author, Dose queryKNN return any meaningful value when parameters get.index and get.distance are set to FALSE?

I have recently tried SingleR package and gotten the following error:

Error in nn.d^2 : non-numeric argument to binary operator

I looked into the codes and found that the error may be due to the following codes in SingleR/R/classifySingleR.R where queryKNN always returns an empty list():

.find_nearest_quantile <- function(ranked, index, quantile) {
    k <- max(1, round(nrow(index) * (1-quantile)))
    nn.d <- queryKNN(query=ranked, k=k, BNINDEX=index, get.index=FALSE, get.distance=FALSE)
    1 - 2*nn.d^2 # see https://arxiv.org/abs/1208.3145
}

Sorry to bring up an issue about SingleR here because I don't know how to put issues in bioconductor. Thanks for sharing these beautiful packages.

LTLA commented 5 years ago

This is a temporary error caused by the fact that BiocNeighbors was updated but SingleR was not. If you sit tight, it should fix itself with version 0.99.12 of SingleR. Or you can pull it from GitHub.

For future reference, questions about Bioconductor packages should go here.

AJnsm commented 5 years ago

I can confirm that installing 0.99.12 from GitHub solves this issue.

LTLA commented 5 years ago

This should be fixed on BioC as well.