之前用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,'/',',') GOplotIn$Category = Category circ <- GOplot::circle_dat(GOplotIn, genedata) 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')
|