在Linux中绘制r中的热图
我试图在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")
I am trying to plot heatmap in linux.
this is the script i have written:
#!/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)
But it gives an error:
Error in .External2(C_dataviewer, x, title) : unable to start data viewer
Calls: View
In addition: Warning message:
In View(m) : unable to open display
Execution halted
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")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两个问题:
pheatmap
的拼写和数据框中的值类:尝试以下:Two problems: spelling of
pheatmap
and that character class of the values in the dataframe: try this: