绘制富集系统聚类图(简化版)

之前用GOplot绘制了富集系统聚类图,感觉非常好看也非常实用,因此简化一下调用流程

1
2
3
4
5
6
7
8
9
10
f_GOplot <- function(GOplotIn, genedata, filePath, Category='enricher', width = 12, height = 8){
names(GOplotIn) <- c('ID','Term','adj_pval','Genes')#修改列名,后面弦图绘制的时候需要这样的格式
GOplotIn$Genes <- stringr::str_replace_all(GOplotIn$Genes,'/',',') #把GeneID列中的’/’替换成‘,’
GOplotIn$Category = Category #分类信息
circ <- GOplot::circle_dat(GOplotIn, genedata) #GOplot导入数据格式整理
chord <<- GOplot::chord_dat(data = circ,genes = genedata) #生成含有选定基因的数据框
pdf(filePath, width = width, height = height)
print(GOplot::GOCluster(circ, GOplotIn$Term)) #系统聚类图
dev.off()
}
1
2
3
4
5
6
write.csv(res_MF[,c('ID','Description','p.adjust','geneID')], 'res_MF.csv')

DEG <- readRDS('DEG_filer.rds')
genedata<-data.frame(ID=DEG$gene_name,logFC=DEG$log2FoldChange)
res <- read.csv('res_MF.csv', row.names = 1)
f_GOplot(res, genedata, 'test.pdf')

绘制富集系统聚类图(简化版)
https://occdn.limour.top/2320.html
Author
Limour
Posted on
September 10, 2022
Licensed under