在 linux 中绘制 R 中的热图

plot heatmap in R in linux

我正在尝试在 linux 中绘制热图。

这是我写的脚本:

#!/bin/R

setwd("~/scratch/peerfactors")

library(readr)

library(png)

#install.packages("Pheatmap")

library(pheatmap)

r_80 <- read_table2("GVDS_predixcan_n80.txt")

d <- r_80$IID

m <- as.matrix(r_80[, -1])
 rownames(m) <- d 
m1 <- m[,2:120]
m1 <- as.data.frame(m1)
library(pheatmap)
pheatmap(m, cutree_rows = 4)

但是报错:

.External2(C_dataviewer, x, title) 错误:无法启动数据查看器

来电:查看

另外:警告信息:

在视图中(m): 无法打开显示

执行暂停

    dput(m1[1:5,1:5])

structure(list(ENSG00000183307.3 = c(" 9.834121e-02", "-2.178226e-01", 
" 8.384525e-02", "-5.512204e-02", "-6.575162e-02"), ENSG00000237438.1 = c("-5.037736e-01", 
"-4.624093e-01", "-5.317209e-01", "-2.272977e-01", "-1.035980e-01"
), ENSG00000015475.14 = c("-2.714692e-01", "-2.925210e-01", " 1.571337e-01", 
" 8.176208e-02", " 1.216378e-01"), ENSG00000093100.12 = c("-1.730031e-01", 
" 9.960370e-02", "-1.026636e-01", " 1.027736e-01", "-8.116346e-02"
), ENSG00000243156.2 = c("-0.5487500919", "-0.0768463310", "-0.3728799856", 
"-0.0511935902", "-0.5747430589")), row.names = c("HG00096", 
"HG00097", "HG00099", "HG00100", "HG00101"), class = "data.frame")

两个问题:拼写 pheatmap 和数据框中值的 class 字符:试试这个:

m1[] <- lapply(m1, as.numeric)
pheatmap(m1, cutree_rows = 4)