【问题标题】:Inconsistent clustering with ComplexHeatmap?与 ComplexHeatmap 的聚类不一致?
【发布时间】:2018-11-22 13:22:36
【问题描述】:

因此,我尝试使用 Bioconductor 的 ComplexHeatmap 包为我的数据生成热图,但我得到的结果略有不同,具体取决于我是自己制作树状图,还是告诉 Heatmap 制作它。

包:

require(ComplexHeatmap)
require(dendextend)

数据:

a=rnorm(400,1)
b=as.matrix(a)
dim(b)=c(80,5)

如果我自己制作树状图:

d=dist(b,method="euclidean")
d=as.dist(d)
h=hclust(d,method="ward.D")
dend=as.dendrogram(h)

Heatmap(b,
    cluster_columns=FALSE,
    cluster_rows = dend)

与使用 Heatmap 进行聚类相比:

Heatmap(b,
    cluster_columns=FALSE,
    clustering_distance_rows = "euclidean",
    clustering_method_rows = "ward.D") 

它们看起来非常相似,但它们会略有不同。

这对我的数据很重要。 Heatmap 的聚类最终以更好的方式组织了我的数据,但是,我也想通过 like cutree() 提取聚类项目的列表,但我认为我不能从 Heatmap 的聚类中提取它。

有人知道怎么回事吗?

【问题讨论】:

    标签: r heatmap bioconductor


    【解决方案1】:

    树状图是相同的。唯一改变的是排序。您可以使用以下方法验证这一点:

    hmap1 <- Heatmap(b,
                     cluster_columns=FALSE,
                     cluster_rows = dend)
    
    hmap2 <- Heatmap(b,
                     cluster_columns=FALSE,
                     clustering_distance_rows = "euclidean",
                     clustering_method_rows = "ward.D") 
    
    #Reorder both row dendrograms using the same weights:
    rowdend1 <- reorder(row_dend(hmap1)[[1]], 1:80)
    rowdend2 <- reorder(row_dend(hmap2)[[1]], 1:80)
    
    #check that they are identical:
    identical( rowdend1, rowdend2)
    ## [1] TRUE
    

    ComplexHeatmap::Heatmap 函数有一个参数 row_dend_reorder,您应该检查它的默认值 TRUE

    【讨论】:

      猜你喜欢
      • 2012-08-10
      • 2019-01-27
      • 1970-01-01
      • 2015-03-16
      • 2018-11-05
      • 2016-08-07
      • 1970-01-01
      • 2012-08-06
      • 1970-01-01
      相关资源
      最近更新 更多