---
title: "Enrichment Plot"
author: "Mason Bryant"
output: html_document
---
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
load data and library
library(DOSE)
library(clusterProfiler)
data(geneList)
de <- names(geneList)[abs(geneList) > 2]
enrichment analysis
{r eval=FALSE}
#GO enrichment analysis
ego_BP <- enrichGO(gene = geneEntrezID[,2], #使用entrezID作为输入
OrgDb=org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
minGSSize = 1,
pvalueCutoff = 0.05,
qvalueCutoff = 0.1,
readable = TRUE
)
#simplify函数可以精简GO富集的结果
lineage1_ego <- simplify(
formula_res,
cutoff=0.5,
by="p.adjust",
select_fun=min
)
ego_kegg <- enrichKEGG(gene = geneEntrezID[,2],
organism ="mouse", #http://www.genome.jp/kegg/catalog/org_list.html(species names)
pvalueCutoff = 0.05,
qvalueCutoff = 0.1,
minGSSize = 1,
use_internal_data =FALSE
)
Plot
library(enrichplot)
#棒状图展???
barplot(edo, showCategory=20)
#点图展示
dotplot(edo, showCategory=30) + ggtitle("dotplot for ORA")
gene & Term
## convert gene ID to Symbol
suppressMessages(library(clusterProfiler))
suppressMessages(library(org.Hs.eg.db))
# geneSymbol <- bitr(as.character(edo@gene), fromType="ENTREZID", toType="SYMBOL", OrgDb="org.Hs.eg.db")
# edo@gene <- geneSymbol$SYMBOL
#另一种转换ID的方???
edox <- setReadable(edo, 'org.Hs.eg.db', 'ENTREZID')
## categorySize can be scaled by 'pvalue' or 'geneNum'
cnetplot(edox, categorySize="pvalue", foldChange=geneList )
cnetplot(edox, foldChange=geneList, circular = TRUE, colorEdge = TRUE)
#cowplot::plot_grid(P1, P2, ncol=2, labels=LETTERS[1:2])
# 热图与cnetplot类似,但将关系显示为热图。如果用户希望显示大量的重要术语???
# 则基因概念网络可能会变得过于复杂。热图可以简化结果,更容易识别表达模式???
heatplot(edox, foldChange=geneList,showCategory = 10)
#
# Enrichment Map
#
# 富集图将被富集的术语组织成一个边缘连接重叠基因集的网络。这样,
# 相互重叠的基因集往往会聚集在一起,使其容易识别功能模块???
#
# emapplot函数支持超几何检验和基因集富集分析的结果???
#
#
emapplot(edo)
# UpSet Plot
#
# upsetplot是cnetplot的一种替代方法,用于可视化基因和基因集之间的复杂关联???
# 它强调不同基因之间的重叠???
upsetplot(edo)
多个基因集同时富集分析
https://guangchuangyu.github.io/cn/2017/07/clusterprofiler-dotplot/