0
votes

I'm trying to use heatmap3 to visualize my bacterial community data. I have already clustered my samples, and have a dendrogram from hclust that I want to use to order my samples in the heatmap, while showing the dendrogram as well. However, the data file that I am putting into heatmap3 has been collapsed to the genera level, so the structure that I had before isn't immediately apparent to heatmap3, and I therefore don't want heatmap3 to try to do its own clustering.

I've tried using my hclust object as a dendrogram and passing it to Colv, but the order of the samples in my heatmap, for whatever reason, becomes literally random while the dendrogram looks correct. When I extract the order of samples in my dendrogram and re-order my input matrix according to this order (without a dendrogram), I get visible clustering. Essentially what I want is to give heatmap my dendrogram that I made from an hclust function, and have it order the samples in that order WITH the dendrogram above, and then plot the relative abundances in the heatmap. What am I missing?

Unfortunately I don't have data that I'm able to provide, or an illustrative example. If this question is impossible to answer without data and R code, I will do my best to put something together.

1

1 Answers

0
votes

You can try pheatmap package there parameters cluster_rows and cluster_cols accept hclust objects.