dittoHeatmap; adding column labels on the heatmap
1
0
Entering edit mode
8 weeks ago
Varun Gupta ★ 1.3k

I have a seurat object and I am subsetting it to make a heatmap using dittoHeatmap function.

Here is my code:

my_colors <- seq(-4,4,by=0.01)
dittoHeatmap(subset(obj, subset = condition_cluster %in% c("Pre", "Post")), assay = 'ADT',
             genes = rownames(obj[['ADT']]),
             annot.by = 'condition_cluster',
             use_raster = TRUE,
             complex = TRUE,
             breaks = my_colors,
             cluster_cols = FALSE,
             heatmap.colors = colorRampPalette(c("blue", "white", "red"))(801),
             )

I want to display the column labels Pre and Post as column labels on the heatmap apart from those being displayed on the legend. How can I do this, since I am also subsetting my seurat obj?

pheatmap ComplexHeatmap dittoHeatmap • 698 views
ADD COMMENT
0
Entering edit mode
8 weeks ago
bk11 ★ 3.0k

What will annot.by = c("Pre", "Post") do instead of using annot.by = 'condition_cluster'?

ADD COMMENT
0
Entering edit mode

That'll do exactly what they want.

Another note is that you can use the cells.use parameter if you want to limit the cells used in the plot without actually subsetting your input object. It also tends to be smarter about dropping unused levels in annotations and such if you do it that way.

ADD REPLY
0
Entering edit mode

I like the cells.use parameter to limit the cells. But I am still unable to display the Pre and Post labels on the top of the heatmap. They are displayed on the right as a legend. When I use annot.by = c("Pre","Post") I get this error

Error in .var_OR_get_meta_or_gene(x, object, assay, slot) : 
  Pre is not a gene of the targeted assay(s), a metadata, nor equal in length to ncol('object')
ADD REPLY
0
Entering edit mode

Oh, right, it should be annot.by = "condition_cluster" rather than the levels thereof.

ADD REPLY
0
Entering edit mode

any idea, how can I display the labels Pre and POst on the top of the heatmap? I am looking at complexheatmap package as to how they display the label names. Also, do you know which row clustering method dittoHeatmap uses by default? I will use the same one with ComplexHeatmap.

ADD REPLY
1
Entering edit mode

I'd consider making a block annotation and then vertically concatenating it to your dittoHeatmap output. Or just slap them on in Illustrator or such after the fact.

It uses whatever ComplexHeatmap is using, so no need to change the clustering.

ADD REPLY

Login before adding your answer.

Traffic: 2106 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