clusterProfiler进行GO富集去冗余

2019-12-25  本文已影响0人  Mr_我爱读文献
library(org.Hs.eg.db)
library(clusterProfiler)
library(ggplot2) 

setwd("C:/Users/lenovo/Desktop")
a=read.table("testgeneid.txt",header = FALSE) # 读取输入文件gene symbol
gene=as.character(a[,1])  # 转换为字符

geneid= bitr(gene, fromType="SYMBOL", toType="ENTREZID", OrgDb="org.Hs.eg.db") # 将symbol转换为entrzid

ego <- enrichGO(gene=gene,OrgDb='org.Hs.eg.db',keyType='SYMBOL',ont= "BP",pAdjustMethod="BH",pvalueCutoff  = 0.01,qvalueCutoff  = 0.05)

dim(ego)
[1] 369   9

ego2 <- simplify(ego,cutoff=0.7,by="p.adjust",select_fun=min)  #去除冗余,可以调整cutoff值。

> dim(ego2)
[1] 115   9

barplot(ego, showCategory=20,title="EnrichmentGO")
barplot(ego2, showCategory=20,title="EnrichmentGO")

#KEGG富集分析
kk <- enrichKEGG(geneid$ENTREZID, organism="hsa",keyType = "kegg",pvalueCutoff=0.01,pAdjustMethod="BH",qvalueCutoff=0.05)

barplot(kk, showCategory=20,title="Enrichment KEGG")

#DO富集分析
 do <- enrichDO(gene = geneid$ENTREZID,ont = "DO",pvalueCutoff  = 0.01,pAdjustMethod = "BH",minGSSize     = 5,maxGSSize = 500,qvalueCutoff = 0.05,readable = FALSE)

barplot(do, showCategory=20,title="Enrichment DO")

#Ractome
 x <- enrichPathway(gene=geneid$ENTREZID,organism = "human",pvalueCutoff=0.05,pAdjustMethod = "BH",qvalueCutoff  = 0.05, readable=FALSE)

上一篇下一篇

猜你喜欢

热点阅读