if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("enrichplot")
library(enrichplot);browseVignettes("enrichplot")
library(DOSE)
library(dplyr)
library(clusterProfiler)
##输入基因集合DEG
##及每个基因的倍数变换值fc
edo <- enrichDGN(DEG)
#entrez gene ID
#除了DisGeNET,包括GO、KEGG、DO、wikiPathways、MSigDb
enrichGO(DEG,'org.Hs.eg.db') %>% goplot()
#这里我只富集到一个GO term,报错了。
条形图、泡泡图是最常用的富集可视化方法,用条形高度、点大小和颜色来描述富集分数(例如p值)和基因数或比例。
barplot(edo, showCategory=50)
dotplot(edo, showCategory=50)
setReadable(edo, 'org.Hs.eg.db', 'ENTREZID') %>% cnetplot(,
showCategory = 20,#展示富集条目数量,默认5
foldChange = fc,#倍数值
colorEdge = TRUE,
categorySize='pvalue',# 中心点大小, or 'geneNum'
circular = TRUE,#圆形排列
node_label = "all"
)
构建网络,其边连接重叠的基因集。这样一来,有重叠的基因集聚在一起,便于识别功能模块。
emapplot(
edo,
showCategory = 30,
color = "p.adjust",#设置颜色,也可以用pvalue, qvalue
layout = "sphere",##布局
pie_scale = 1,#点大小
line_scale = 1#线条粗细
)
setReadable(edo, 'org.Hs.eg.db', 'ENTREZID') %>% heatplot(,foldChange=fc)
根据PubMed Central的查询结果绘制出版物数量/比例趋势图。
pmcplot(edo$Description[1:5], 2015:2020)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("enrichplot")
library(enrichplot);library(DOSE);library(dplyr);library(clusterProfiler)
##输入基因集合DEG及每个基因的倍数变换值fc
edo <- enrichDGN(DEG)
#golpot
enrichGO(DEG,'org.Hs.eg.db') %>% goplot()
#barplot
barplot(edo, showCategory=50)
#dotplot
dotplot(edo, showCategory=50)
#cnetplot
setReadable(edo, 'org.Hs.eg.db', 'ENTREZID') %>% cnetplot(,showCategory = 20,foldChange = fc,colorEdge = TRUE,categorySize='pvalue',circular = TRUE,node_label = "all")
#emapplot
emapplot(edo,showCategory = 30,color = "p.adjust",layout = "sphere",pie_scale = 1,line_scale = 1)
#heatplot
setReadable(edo,'org.Hs.eg.db') %>% heatplot(,foldChange=fc)
#pmcplot
pmcplot(edo$Description[1:5], 2015:2020)