简体   繁体   English

使用预制树状图对R中的Heatmap3中的样本进行排序

[英]Using a Pre-Made Dendrogram to Order Samples in Heatmap3 in R

I'm trying to use heatmap3 to visualize my bacterial community data. 我正在尝试使用heatmap3可视化我的细菌群落数据。 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. 我已经对样本进行了聚类,并且从hclust获得了一个树状图,我想用它来在热图中排序我的样本,同时还显示树状图。 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. 但是,我放入heatmap3的数据文件已经折叠到一般级别,因此,我以前拥有的结构对于heatmap3并不立即可见,因此,我不希望heatmap3尝试做自己的集群。

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. 我尝试将hclust对象用作树状图并将其传递给Colv,但是无论出于何种原因,在树状图看起来正确时,无论出于何种原因,热图中样本的顺序实际上都是随机的。 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. 基本上我要的是给我的热图树状图,我从一个hclust功能做出,并将它订购与上面的树状图顺序样品,然后在热图绘制的相对丰度。 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. 如果没有数据和R代码无法回答这个问题,我将尽我所能。

您可以尝试使用pheatmap包,其中的参数cluster_rowscluster_cols接受hclust对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM