GO KEGG GSEA-ClusterProfiler

library(clusterProfiler)

setwd("D:/Desktop/")

a=read.table("universeGeneIDs.txt",header = F,sep = "\t")


gene=as.character(a[,1])


ego<-enrichGO(gene = gene,'org.Hs.eg.db',ont = 'BP',pvalueCutoff = 0.01,readable = T)

write.table(ego,"go.txt",sep = "\t",quote = F,row.names = F)


barplot(ego,showCategory = 15,title = "EnrichmentGO")


dotplot(ego,title="EnrichmentGO_dot")


library(ggThemeAssist)

p<-dotplot(ego,title="EnrichmentGO_dot")

ggThemeAssistGadget(p)


ekk<-enrichKEGG(gene = gene,organism = "hsa",pAdjustMethod = "BH",pvalueCutoff = 0.01)

write.table(ekk,"kegg.txt",sep = "\t",quote = F,row.names = F)


barplot(ekk,showCategory = 15,title = "EnrichmentKEGG")


dotplot(ekk,title="EnrichmentKEGG_dot")


此外,还能做GSEA富集

gmtfile<- system.file("extdata", "c5.cc.v5.0.entrez.gmt", package="clusterProfiler")#选择GSEA数据库用的,http://software.broadinstitute.org/gsea/msigdb/collections.jsp,前面俩行大概就是来选择GSEA的数据库用的,c5.cc.v5.0.entrez.gmt这里他事例用的是GO的cc数据库,这个可以调整的,参考GSEA的网站来选择

egmt <- enricher(gene, TERM2GENE=c5)

write.table(egmt,"egmt.txt",sep = "\t",quote = F)


另外,多个基因集时(eg,WGCNA得到的不同module的基因集),用compareCluster。


1.基因ID转换

2.代码


3.画图



最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容