Question: Using the row order of one pheatmap to set the order of another. How to do it?
gravatar for achamess
11 months ago by
United States
achamess20 wrote:

Hi. I'm using pheatmap to create heatmaps. I've made a heatmap and used the clustering option (method = correlation) and the resulting heatmap has a certain row order based on the clustering. I want to make another heatmap using pheatmap that then has the same row order as the first one. Is there a way to specifically set the order of a second pheatmap based on the first?

I've been trying using the tree_row$order argument on the pheatmap object that I create. I think I can use this to set the order of the other, but then I don't know how to get pheatmap to display/write to file the changed pheatmap object.

Here's an example of some code:

create a pheatmap

hm_1<-pheatmap(mat1, cluster_rows=TRUE) hm_2<-pheatmap(mat1, cluster_rows=FALSE)

get the row order of another pheatmap and set the first to the second

hm_2$tree_row$order <-hm_1$tree_row$order

This works, but then I have this hm_2 object. How do I get it to display the resulting map again without calling the pheatmap argument?

And is there a batter way to do this?

rna-seq pheatmap R • 868 views
ADD COMMENTlink written 11 months ago by achamess20
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 557 users visited in the last hour