clusterProfiler进行GO富集去冗余

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)


    原文作者:衰老分子进化机制
    原文地址: https://www.jianshu.com/p/ab0cebfa270a
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞