我想在分层聚类到.csv文件后提取热图矩阵。
我的代码如下:
library("ComplexHeatmap")
library("dendextend")
library("circlize")
row_dend = hclust(dist(df)) # row clustering
hm <- Heatmap(df, name = "heatmapName", show_row_names = FALSE,
cluster_columns = FALSE, col = colorRamp2(c(-10, 10),
c("ivory2", "deepskyblue4")), row_names_gp = gpar(fontsize = 6.5),
cluster_rows = color_branches(row_dend, k = 6))
我尝试使用:
write.csv(hm@matrix, "fileName.csv")
但是它给我的矩阵恰好是我最初输入函数的顺序。
感谢您的帮助!