美文网首页数据分析
GO KEGG GSEA-ClusterProfiler

GO KEGG GSEA-ClusterProfiler

作者: 白云梦_7 | 来源:发表于2018-06-07 12:47 被阅读2185次

    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.画图

    相关文章

      网友评论

        本文标题:GO KEGG GSEA-ClusterProfiler

        本文链接:https://www.haomeiwen.com/subject/cbzwsftx.html