SingleR-inc / SingleR

Clone of the Bioconductor repository for the SingleR package.
https://bioconductor.org/packages/devel/bioc/html/SingleR.html
GNU General Public License v3.0
177 stars 19 forks source link

plotScoreHeatmap annotation_colors #157

Closed danhtruong closed 4 years ago

danhtruong commented 4 years ago

I tried adjusting plotScoreHeatmap annotation colors using pheatmap parameter. It doesn't seem to adjust the colors at all and instead seems to just change the colors to a palette similar to ggplot for some reason.

original colors

When I add annotation_colors: plotScoreHeatmap(pred.LPS_data.cell.list[[x]], annotation_colors=list(labels = lps_anno_colors[labs]) ) wrong_colors

My expected color palette: lps_anno_colors[labs] Fibroblasts NK cells Endothelial cells Monocytes CD8+ T-cells "#81C847" "#E74C3C" "#30B59E" "#E67625" "#5186D0" expected colors from palette In fact, if I run this code: plotScoreHeatmap(pred.LPS_data.cell.list[[x]], annotation_colors=list() )

I still get this:

wrong_colors

dtm2451 commented 4 years ago

The colors you are getting are the pheatmap defaults. When there is any sort of formatting or linkage issue with the annotation_colors provided to pheatmap(), pheatmap fills in with its original defaults. When plotScoreHeatmap sees that you provided your own annotation_colors, it doesn't create its own.

So this points us to there being an issue with your annotation_colors. I think the issue is a capitalization one: you need to capitalize labels in annotation_colors=list(labels = lps_anno_colors[labs]) to match that it is capitalized in the plot.

Does plotScoreHeatmap(pred.LPS_data.cell.list[[x]], annotation_colors=list(Labels = lps_anno_colors[labs]) ) give what you want?

danhtruong commented 4 years ago

Got it! It worked out. I was still thinking it was 'labels' from the predicted score object. I didn't realize the plostScoreHeatmap function renamed it to 'Labels'.