用clusterProfiler做GSEA(二)
之前写过用clusterProfiler做GSEA,enrichplot中的gseaplot作图,但是图没有最新版enrichplot包的gseaplot2做的图好看。此外,gseaplot2还可以同时显示多个功能组的富集曲线和pvalue。
library(clusterProfiler)
library(enrichplot)
library(ReactomePA)
gseaplot2(x, geneSetID, title = "", color = "green", base_size = 11,
rel_heights = c(1.5, 0.5, 1), subplots = 1:3, pvalue_table = FALSE,
ES_geom = "line")
GSEA的输入还是之前讲的按FC排序的基因list
如下:
将基因按FC降序排列
GSEA_input<-vivo_GSEA$logFC
names(GSEA_input) = as.character(vivo_GSEA$Row.names)
GSEA_input = sort(GSEA_input, decreasing = TRUE)
gsea做GO
因为我的数据正常的pvalue= 0.05没有聚出来,所以为了这里显示将pvalueCutoff = 1。
gseGO.res <- gseGO(GSEA_input, 'org.Hs.eg.db', keyType = "SYMBOL", ont="BP", nPerm = 1000, minGSSize = 5, maxGSSize = 1000, pvalueCutoff=1)
ridgeplot(gseGO.res, 5)
image.png
gseaplot2(gseGO.res, 1)
gseaplot2(gseGO.res, 1:3)
image.png
GSEA分析KEGG及Reactome同理
gseKEGG.res <- gseKEGG(GSEA_input, OrgDb="org.Hs.eg.db",keyType = "SYMBOL",nPerm = 1000, minGSSize = 5, maxGSSize = 1000, pvalueCutoff=0.05)
gseaplot2(gseKEGG.res ,1:3, pvalue_table = TRUE)
gseReactome.res <- gsePathway(GSEA_input, nPerm = 1000, minGSSize = 10, maxGSSize = 1000, pvalueCutoff=0.05)
gseaplot2(gseReactome.res,1:3, pvalue_table = TRUE)
欢迎关注~
参考:
Yu G, He Q (2016). “ReactomePA: an R/Bioconductor package for reactome pathway analysis and visualization.” Molecular BioSystems, 12(12), 477-479.
Yu G, Wang L, Han Y, He Q (2012). “clusterProfiler: an R package for comparing biological themes among gene clusters.” OMICS: A Journal of Integrative Biology, 16(5), 284-287.
Guangchuang Yu (2018). enrichplot: Visualization of Functional
Enrichment Result. R package version 1.2.0.
https://github.com/GuangchuangYu/enrichplot
https://mp.weixin.qq.com/s/szmquOt77e6Cad4Glhi-aA