enrichment
社区首页 >专栏 > enrichment_all | 一键完成富集分析!~(配高颜值可视化!)
写在前面
最近做这些富集分析实在太烦了,我就自己写了2个函数,run_enrichment_all()和plot_enrichment_all()。
这2个函数可以轻松完成GO和KEGG的富集分析和可视化,具体大家看一下。
当然也参考了别人的代码,深表感谢哈!~
用到的包
library(clusterProfiler) library(AnnotationDbi) library(dplyr) library(ggplot2) library(tibble) library(tidyr) library(ggprism) library(gground)
输入文件
输入文件可以是SYMBOL也可以是ENTREZID。
我这里以ENTREZID为例。
data(geneList, package="DOSE") gene <- names(geneList)[abs(geneList) > 2] gene
开始富集
dir.create("./enrichment")
这里第一个函数,是基于clusterProfiler的,可以轻松完成所有的G0(包括BP,CC,MF)和KEGG分析。
如果你懒得改参数,这里我都有默认好的。
res <- run_enrichment_all(gene, species = "human", # "human", "mouse", "rat" id_type = "ENTREZID", # "ENTREZID", "SYMBOL" pvalueCutoff = 0.05, qvalueCutoff = 0.05, minGSSize = 5, maxGSSize = 500, readable = T ) write.csv(res$BP, "./enrichment/enrichment_all_result_BP.csv") write.csv(res$CC, "./enrichment/enrichment_all_result_CC.csv") write.csv(res$MF, "./enrichment/enrichment_all_result_.csv") write.csv(res$KEGG, "./enrichment/enrichment_all_result_KEGG.csv")
可视化
这里默认参数也是做好的。
当然你也可以按需更改。
显示top5条目plot_enrichment_all(res, top_n = 5)
plot_enrichment_all(res, top_n = 5, gene_show_num = 10)
plot_enrichment_all(res, top_n = 5, # default 5 gene_show_num = 10, # default 5 color_palette = c("#640D5F", "#D91656", "#EB5B00", "#FFB200") )
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2025-04-27
,如有侵权请联系 [email protected] 删除
网址:enrichment https://mxgxt.com/news/view/1322084
相关内容
吕海泉清华大学深圳国际研究生院
杨颖
包燕平
李昱达
周小明
启明星人
悖论式领导如何促进员工工作—家庭平衡?