aertslab / AUCell

AUCell: score single cells with gene regulatory networks
110 stars 26 forks source link

AUCell_buildRankings() is broken in BioC 3.15 #27

Closed hpages closed 2 years ago

hpages commented 2 years ago

Hi,

Shouldn't AUCell_buildRankings() rank genes from highest to lowest expression? At least that's what it used to do. But with the version of AUCell available in BioC 3.15 (AUCell 1.18.0), genes now get ranked from lowest to highest expression.

For example, with the following expression matrix:

exprMatrix <- cbind(cell1=100*4:0, cell2=c(500, 0, 90, 0, 750))
rownames(exprMatrix) <- sprintf("gene%02d", seq_len(nrow(exprMatrix)))
exprMatrix
#        cell1 cell2
# gene01   400   500
# gene02   300     0
# gene03   200    90
# gene04   100     0
# gene05     0   750

The rankings returned with AUCell 1.18.0 are:

library(SummarizedExperiment)
library(AUCell)
rankings <- AUCell_buildRankings(exprMatrix, plotStats=FALSE, verbose=FALSE)
assay(rankings)
#         cells
# genes    cell1 cell2
#   gene01     5     4
#   gene02     4     1
#   gene03     3     3
#   gene04     2     2
#   gene05     1     5

With older versions of AUCell (e.g. with AUCell 1.16.0 available in BioC 3.14), this used to return:

assay(rankings)
#         cells
# genes    cell1 cell2
#   gene01     1     2
#   gene02     2     5
#   gene03     3     3
#   gene04     4     4
#   gene05     5     1

Note that this breaks Chapter 7 of the OSCA.basic book where the AUCell package is used to identify marker sets that are highly expressed in each cell.

The fix should be easy. However, even more important than the fix itself, AUCell_buildRankings() should have unit tests that make sure that it does the right thing, so this doesn't happen again in the future.

Thanks, H.

s-aibar commented 2 years ago

Thank you for the report! The bug has now been solved both in the Devel and Release Bioconductor branches. (It might take a few hours to become available though...)

hpages commented 2 years ago

Thanks!