How to plot the heat map of a subset of cell types using plotHeatmap from scater package
1
1
Entering edit mode
6 months ago
FantasticAI ▴ 60

Hi

I'm using plotHeatmap (library(scater)) to visualize the accuracy of cell type annotation output from SingleR. In total I got 28 labels, but as you can see on the top of the plot, the color different is hard to distinguish due to too many labels. I wonder whether there is a simple way to show only 5 to 7 labels in this plot, this is because I only care some specific cell types only, not all of them. For example "AT1 cells, AT2 cells and B cells" are the three cells I'm interested. How to only plot for only three labels?

 Library(scater)  
 plotHeatmap(sce.data.combined.sct, order_columns_by = "labels", features=feature)

heatmap output

scRNAseq scRNA SingleR plotHeatmap scater • 851 views
ADD COMMENT
0
Entering edit mode

One of the potential solution is to subset from the sce object based on the ColData = "AT1 Cells, AT2 Cells, B Cells", then use plotHeatmap function. But how to subset the columns that are associated with those three cell types?

ADD REPLY
3
Entering edit mode
6 months ago

Gonna cheat and just recommend dittoSeq. To do what you want will be something like:

dittoHeatmap(sce.data.combined.sct, genes = feature, order.by = "labels", annot.by = "labels", 
  cells.use = sce.data.combined.sct$labels %in% c("AT1 cells", "AT2 cells", "B cells"), scale = "none")

You may also be interested in setting scaled.to.max = TRUE, which is useful for single-cell data given their enrichment for 0s. Setting scale = "row" will plots z-scores instead. I also usually pass complex = TRUE and use_raster = TRUE with single cell data, as it makes the resulting image much easier to edit in Illustrator or such.

ADD COMMENT
0
Entering edit mode

Thank you for the great answer! It works really well and what a powerful package it is, thank you.

ADD REPLY

Login before adding your answer.

Traffic: 1351 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6