我正在尝试将基于k-means的聚类算法的结果显示为pheatmap。为此,我使用这里建议的过程:R draw kmeans clustering with heatmap
现在的问题是,我想添加一个突出显示集群的配色方案,类似于heatmap和heatmap.2中的"RowSideColors"-option。至于pheatmap,我只找到了annotation选项,但它是按列工作的,而不是按行工作的。有没有办法突出显示pheatmap中的行聚类
我的另一个想法是将cluster-column作为单独的颜色添加到热图中。然而,我需要使用另一种配色方案,而不是热图的其余部分,所以我不确定这是否可能。
发布于 2015-10-01 00:17:30
现在pheatmap包中有一个annotation_row参数:
library(pheatmap)
# define a matrix
test = matrix(rnorm(200), 20, 10)
test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 3
test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 2
test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4
colnames(test) = paste("Test", 1:10, sep = "")
rownames(test) = paste("Gene", 1:20, sep = "")
# annotate rows
annotation_row = data.frame(
GeneClass = factor(rep(c("Path1", "Path2", "Path3"), c(10, 4, 6))))
rownames(annotation_row) = paste("Gene", 1:20, sep = "")
# plot pheatmap
pheatmap(test, annotation_row = annotation_row)发布于 2014-11-07 06:01:11
你可以直接使用heatmap或heatmap.2,因为pheatmap没有这类参数。实际上,我也有类似的任务。

https://stackoverflow.com/questions/10300284
复制相似问题