创建 RPKM 分析的热图

create heatmap of RPKM analysis

我对我的数据进行了 RPKM 分析并生成了这个结果

head((RPKM_analysis))
                      a        b         c           d        e               f               g           h  
gene0         8.5099049 5.5732562   5.0730217  6.4162466  25.075330      19.163763           39.085439  21.368201
gene1         2.6056052 0.4082469   4.4356482  0.9731503   3.508077      41.594664            6.998682   2.742124
gene2         0.4727903 0.3678376   0.3397144  0.1221217   4.475466       2.936647            2.820639  17.592733
gene3         0.8390143 0.3199489   1.2082854  0.1856811  14.063714       4.129234            6.103459  33.116435
gene4         2.2246130 2.3719177   2.3547895  0.7456295  22.917552       7.871053            4.437163  76.596441
gene6       150.0407639 9.5132677 266.7380691 76.9122813 100.517840      61.350209          392.224464 158.130721
                       i        j          k                        l
gene0             34.667379 13.056078 90.2201082                8.3383381
gene1              4.642868  2.658317  0.5275397                0.6345467
gene2              1.864922  1.487531  8.1337453               24.3506878
gene3              2.594216  2.194451  6.2621722               49.8774268
gene4              4.922619  5.944980 41.6279899              119.1270556
gene6            582.504495 12.147723 74.0451493               11.8167852

可以创建此分析的热图吗? 我使用了这个脚本

heatmap_RPKM <- heatmap(as.matrix(RPKM_aalysis))

但问题是它没有显示行名和列名。 谁能帮帮我?

尝试gplots::heatmap.2,它比heatmap更高级:

library(gplots)
library(dendextend)
library(stringi)

dat   <- as.matrix(dat)
dst   <- as.dist(1 - cor(t(dat), method = "spearman"))
dend  <- as.dendrogram(hclust(dst))
title <- stringi::stri_unescape_unicode("I\u2661 Heatmaps!")

heatmap.2(
  x          = dat,
  scale      = "row",
  dendrogram = "row",
  col        = heat.colors(25),
  key        = F,
  trace      = "none",
  Colv       = F,
  Rowv       = dend,
  srtCol     = 0,
  main       = title
)

数据:

dat <- read.table(
  text = "                      a        b         c           d        e               f               g           h  
gene0         8.5099049 5.5732562   5.0730217  6.4162466  25.075330      19.163763           39.085439  21.368201
gene1         2.6056052 0.4082469   4.4356482  0.9731503   3.508077      41.594664            6.998682   2.742124
gene2         0.4727903 0.3678376   0.3397144  0.1221217   4.475466       2.936647            2.820639  17.592733
gene3         0.8390143 0.3199489   1.2082854  0.1856811  14.063714       4.129234            6.103459  33.116435
gene4         2.2246130 2.3719177   2.3547895  0.7456295  22.917552       7.871053            4.437163  76.596441
gene6       150.0407639 9.5132677 266.7380691 76.9122813 100.517840      61.350209          392.224464 158.130721",
  stringsAsFactors = F, header = T
)