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?
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.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 useannot.by = c("Pre","Post")
I get this errorOh, right, it should be
annot.by = "condition_cluster"
rather than the levels thereof.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.
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.