GO KEGG富集分析绘图

柱状图

setwd("C:/Users/acer/Desktop/数据处理/富集分析-lung/")
  • 读取数据
Data <- read.csv("富集分析-lung/lung-enrichment.csv",header=TRUE)
  • 转换term为因子
GO_term_order=factor(as.integer(rownames(Data)),labels=Data$term)
  • 设置柱子颜色
COLS <- c("#66C3A5", "#8DA1CB", "#FD8D62")
  • 绘图(柱状图)
ggplot(data=Data,aes(x=GO_term_order,y=pValue, fill=Category)) + geom_bar(stat="identity", width=0.8)+ xlab("GO terms") + ylab("-log(p-value)") + theme_bw() + labs(title = "The Most Enriched GO Terms") + scale_fill_manual(values = COLS) + coord_flip() + theme(axis.text.x=element_text(face = "bold", color="gray50",angle = 70,vjust = 1, hjust = 1 ))
  • 绘图(气泡图)
 ggplot(Data, aes(x=cc, y=term,  size=Count, color=-1*log10(pValue))) + geom_point()  + scale_colour_gradient(low="green",high="red") + labs(color=expression(-log[10](pValue)),size="Gene number", x="p-Value",y="Pathway name",title="Pathway enrichment")
posted @ 2020-06-15 01:01  艾易  阅读(2140)  评论(0)    收藏  举报