This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get the "average" of a column in a heatmap, combine 3 heatmaps into 1?

Hey guys,

So I have 3 gene signatures that I wanna look into on my own RNASeq data. I've created hierarchical clustering heatmaps for these gene signatures, and I want to get the "average" expression of a sample/column, so I can combine these values into a new figure like the one below. Is there some sort of numerical value I can get from the pheatmap function for each column in a heatmap, so I can put it into a a new heatmap like the picture?

enter image description here

heatmap rna-seq

Why do you need to average your data after generating the heatmap rather than transforming your input matrix?

1 answer

You can use pheatmapobj$gtable$grobs[[4]]$label to get the order of the column in pheatmap object and then compute the average of each column in order.

Log in to answer this question.