dviraran / SingleR

SingleR: Single-cell RNA-seq cell types Recognition (legacy version)
GNU General Public License v3.0
263 stars 98 forks source link

cells.use in SingleR.DrawHeatmap #84

Open my0916 opened 5 years ago

my0916 commented 5 years ago

Dear Dvir,

"cells.use" function in SingleR.DrawHeatmap should not work properly when combined with some options.

scores = SingleR$scores if (!is.null(cells.use)) { scores = scores[cells.use,] }

This is OK, but when we assign some clusters,

if (!is.null(clusters)) { clusters = as.data.frame(clusters) colnames(clusters) = 'Clusters' rownames(clusters) = colnames(data) }

Here the number of columns in data and that of rows in cluster should not match when we select cells as in "cells.use". We need to select the rows in cluster beforehand. For example, clusters <- clusters[names(clusters) %in% colnames(data)]

This can be problematic when we assign order.by.clusters==T, in the following

data = data[,order(clusters$Clusters)]

Please consider this. Thank you in advance.

Best, Masahito

dviraran commented 5 years ago

Thanks for the input. You can filter the clusters vector before input, but you are right that this should be fixed.

Best, Dvir