R08

作者: rong酱 | 来源:发表于2021-12-10 13:32 被阅读0次
# ./R-3.6.2/bin/R
library(enrichplot)
library(DOSE)
library(clusterProfiler)

rt=read.table("GO-gene.txt",sep="\t",header=F,check.names=F,stringsAsFactors = F)
head(rt)

rt1 = as.data.frame(rt[!duplicated(rt$V1),])
colnames(rt1)=c("symbol") #加列名
rt2 <- bitr(rt1$symbol, fromType="SYMBOL",toType=c("ENTREZID","ENSEMBL"),OrgDb="org.Hs.eg.db",drop = FALSE)

rt3=rt2[is.na(rt2[,"ENTREZID"])==F,]#除去NA行
head(rt3)

gene=rt3$ENTREZID
class(gene)

kk <- enrichDO(gene=gene, ont = 'DO', pvalueCutoff =0.05,qvalueCutoff =0.05, minGSSize = 1, readable = TRUE)

write.table(kk,file="DO.txt",sep="\t",quote=F,row.names = F)

dpi=300
png('./barplot.png',w=12*dpi,h=8*dpi,units = "px",res = dpi,type='cairo')
barplot(kk, showCategory = 20)
dev.off()

png('./barplotv1.png',w=12*dpi,h=8*dpi,units = "px",res = dpi,type='cairo')
dotplot(kk, color = "p.adjust", font.size = 12,title = "DO annotion", showCategory = 20)
dev.off()

png('./barplotv2.png',w=12*dpi,h=8*dpi,units = "px",res = dpi,type='cairo')
emapplot(kk, showCategory = 20)
dev.off()

png('./barplotv3.png',w=12*dpi,h=8*dpi,units = "px",res = dpi,type='cairo')
cnetplot(kk, foldChange=kk, circular = TRUE, colorEdge = TRUE,layout="kk",showCategory = 2)
dev.off()

png('./barplotv4.png',w=12*dpi,h=8*dpi,units = "px",res = dpi,type='cairo')
cnetplot(kk, foldChange=kk, circular = TRUE, colorEdge = TRUE,layout="kk",showCategory = 2)
dev.off()

png('./barplotv5.png',w=12*dpi,h=8*dpi,units = "px",res = dpi,type='cairo')
upsetplot(kk,n=8)
dev.off()

相关文章

网友评论

      本文标题:R08

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