KEGG画图代码

576次阅读
没有评论
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(clusterProfiler)
mytheme<- theme(axis.title = element_text(size = 13),
                
                axis.text = element_text(size = 11),
                
                plot.title = element_text(size = 14,
                                          
                                          hjust= 0.5,
                                          
                                          face= "bold"),
                
                legend.title = element_text(size = 13),
                
                legend.text = element_text(size = 11),axis.text.y = element_blank())

kegg <- enrichKEGG(genelist ,
                   organism="mmu", 
                   pvalueCutoff=0.1, 
                   pAdjustMethod="BH",
                   keyType="kegg") 
Kegg=as.data.frame(kegg)
#KEGG_result<- mutate(Kegg,RichFactor= Count / as.numeric(sub( "/\\d+", "", BgRatio)))
top20<-KEGG_result[1:20,]
top20$text_x <- rep(0.03,20)
top20$pathway <- factor(top20$Description,levels = rev(top20$Description))
p2<- ggplot(data = top20,aes(x = Count, y = pathway))+
  geom_bar(aes(fill = -log10(pvalue)), stat = "identity", width = 0.8, alpha = 0.7)+
  scale_fill_distiller(palette = "YlOrRd", direction = 1)+
  labs(x = "Number of Gene", y = "pathway", title = "KEGG enrichment barplot")+
  geom_text(aes(x = text_x,label= pathway),hjust= 0)+
  mytheme
p2
ggsave("KEGG.pdf",width = 6,
       height = 8)
KEGG画图代码
sheep
版权声明:本站原创文章,由 sheep 2023-01-04发表,共计947字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)