一、聚类-clusterprofiler
F<-read.table("4w_specific.txt")
x<-F[,1]
eg<-bitr(x,fromType = "ENSEMBL",toType = "ENTREZID",OrgDb = "org.Rn.eg.db")
#转换ID,这里物种是老鼠,所以选择这个库,人类是Hs
genelist<-eg$ENTREZID
genelist<-unique(genelist)
kegg<-enrichKEGG(genelist,organism = "rno",pAdjustMethod = "BH",pvalueCutoff = 0.05,qvalueCutoff = 0.2,keyType = "kegg")
go<-enrichGO(genelist,OrgDb = org.Rn.eg.db,ont = "all",pAdjustMethod = "BH",pvalueCutoff = 0.05,qvalueCutoff = 0.2,keyType = "ENTREZID")
二、画图-ggplot
f
f$Description=factor(f$Description,levels = rev(f$Description))
#按照输入顺序排列,因为默认会按照ASCII码进行排列
ggplot(f,aes(x=Description,y=GeneCount,fill=Category))+geom_bar(stat = "identity")+
coord_flip()+
#转置
theme(axis.title.x =element_text(size=14),axis.title.y =element_text(size=14),
#调整坐标轴字体
panel.grid.major =element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(),
#去网格去背景色
axis.line = element_line(colour = "black"), axis.text = element_text(color = "black",size = 14),
#刻度字体大小
legend.text = element_text(size = 14))+
#图例字体大小
guides(fill=guide_legend(title=NULL))
#去掉图例标题
GO
网友评论