This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How do I extract gene names from different portions of my heatmap?

I have this heatmap that I generated using DESeq2 and pheatmap(). I had it perform hierarchal clustering on the rows. Now, how do I identify which genes are in the primarily blue band (on top) or the red band (on bottom). I am fairly new to R, so I have been using the code displayed on the vignette. Code below.

enter image description here

library("pheatmap")
df <- as.data.frame(colData(dds)[,c("condition","type")])
pheatmap(assay(vsd), cluster_rows=TRUE, show_rownames=FALSE,
     cluster_cols=FALSE, annotation_col=df)
pheatmap heatmap deseq2

1 answer

extract dendrogram cluster from pheatmap

As detailed in the linked reply above, you need to (a) decide at which level to cut the dendrogram and then (b) obtain the names of the members for the nodes. DAve Tang explained the relationship between (p)heatmaps and dendrograms well, if you need a primer on that.

Log in to answer this question.