美文网首页
2020-12-10

2020-12-10

作者: vicLeo | 来源:发表于2020-12-10 21:48 被阅读0次

com2 <- read.table(file = "C:/Users/vic/Desktop/4_expressions/PanCancerImmune_743.txt", skip = 0, header = TRUE, sep = "\t")

class(com2)
[1] "data.frame"
row.names(com2)
[1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"
[11] "11" "12" "13" "14" "15" "16" "17" "18" "19" "20"
[21] "21" "22" "23" "24" "25" "26" "27" "28" "29" "30"
[31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40"
[41] "41" "42" "43" "44" "45" "46" "47" "48" "49" "50"
com2 <- com2[!duplicated(com2[,1]),] #必须先去重再设置rownames
row.names(com2) <- com2$锘縢ene_short_name
View(com2)
dim(com2)
[1] 741 7
com2 <- com2[,2:7]
View(com2)
M=cor(log(com2+1))
pheatmap::pheatmap(scale(M))


image.png
image.png

library(pheatmap)
library(stringr)
ac=data.frame(group=str_split(colnames(n),'_',simplify = T)[,1])
rownames(ac)=colnames(n)

pheatmap::pheatmap(n,

  •                show_colnames = F,#是否显示列名
    
  •                show_rownames = F,
    
  •                annotation_col=ac)#增加分组的栏#
    
image.png

当 cg=names(tail(sort(apply(com2,1,sd)),500))时,

ead(cg)
n=com2[cg,]
head(n)

library(pheatmap)
library(stringr)
ac=data.frame(group=str_split(colnames(n),'_',simplify = T)[,1])
rownames(ac)=colnames(n)
pheatmap::pheatmap(n,
show_colnames = F,#是否显示列名
show_rownames = F,
annotation_col=ac,#增加分组的栏
scale = "row")#横的比较wnames(ac)=colnames(n)


image.png

最终敲定


image.png

相关文章

网友评论

      本文标题:2020-12-10

      本文链接:https://www.haomeiwen.com/subject/xjargktx.html