视频讲解
https:
//www.bilibili.com/video/BV1mA3yzEEnc/
森林图简介
什么是森林图?
参考:
https://mp.weixin.qq.com/s/vwNf_sFlmhp7DeSYaQ3NxQ
森林图是以统计指标和统计分析方法为基础,用数值运算结果绘制出的图形。它在平面直角坐标系中,以一条垂直的无效线(横坐标刻度为1或0)为中心,用平行于横轴的多条线段描述了每个被纳入研究的效应量和置信区间,用一个图形描述了多个研究合并的效应量及置信区间。
标签:#微生物组数据分析 #MicrobiomeStatPlots #森林图 #R语言可视化 #Forest plot
作者:First draft(初稿):Defeng Bai(白德凤);Proofreading(校对):Ma Chuang(马闯) and Jiani Xun(荀佳妮);Text tutorial(文字教程):Defeng Bai(白德凤)
引文: Defeng Bai, Chuang Ma, Jiani Xun, Hao Luo, Haifei Yang, Hujie Lyu, et al. 2025. "MicrobiomeStatPlots: Microbiome statistics plotting gallery for meta-omics and bioinformatics." iMeta 4: e70002. https://doi.org/10.1002/imt2.70002
源代码及测试数据链接:
https://github.com/YongxinLiu/MicrobiomeStatPlot/项目中目录 3.Visualization_and_interpretation/ForestPlot
或公众号后台回复“MicrobiomeStatPlot”领取
森林图应用案例
这是Jakob Stokholm课题组2023年发表于Nature Medicine上的文章,第一作者为Cristina Leal Rodríguez,题目为:The infant gut virome is associated with preschool asthma risk independently of bacteria. https://doi.org/10.1038/s41591-023-02685-x
图 6 | 病毒性哮喘特征评分与早期生活暴露的关系。
森林图显示了双侧线性回归的β系数和P值,点表示点估计值,水平线表示早期暴露与1年哮喘病毒组特征评分之间相关性的95%置信区间。风险敞口按其R2贡献进行排序。对于出生季节,基线为冬季;分娩时,基线是阴道分娩。BMI,体重指数。
结果
接下来,我们研究了早期暴露是否会影响病毒组特征评分(图6)。家中有兄弟姐妹(R2=1.64%;β=−0.26(−0.41至−0.10);P=0.001),夏季出生(相对=0.83%;β=−0.27(−0.49至−0.05);P=0.017),出生体重=0.78%;β=−0.16(−0.30至−0.02);P=0.027)和妊娠期补充鱼油(R2冬季,R2(R2=0.67%;β=−0.16(−0.32至0.01);P=0.04)均与较高的病毒组评分呈负相关。出生时只养猫(R2=0.76%;β=0.21(0.02–0.41);P=0.027)与较高的病毒组评分呈正相关。在对这些暴露进行调整后,病毒组评分仍与后期哮喘相关(OR=1.32(1.09-1.61);P=0.005)。
森林图R语言实战
源代码及测试数据链接:
https://github.com/YongxinLiu/MicrobiomeStatPlot/
或公众号后台回复“MicrobiomeStatPlot”领取
软件包安装
# 基于CRAN安装R包,检测没有则安装p_list = c("forestploter", "readxl")for(p in p_list){if (!requireNamespace(p)){install.packages(p)} library(p, character.only = TRUE, quietly = TRUE, warn.conflicts = FALSE)}
# 加载R包 Load the packagesuppressWarnings(suppressMessages(library(forestploter)))suppressWarnings(suppressMessages(library(readxl)))
实战
使用R语言中forestploter软件包实现
# 载入数据# Load datadt <- read_excel("data/forest.xlsx")
# 数据处理# Data processing# 组别前添加空格# Add space before groupdt$Subgroups <- ifelse(is.na(dt$HR), dt$Subgroups, paste0(" ", dt$Subgroups))
# 创建一列空列,用来后面存放森林图的图形部分# Create an empty column to store the graphic part of the forest map later.dt$` ` <- paste(rep(" ", 20), collapse = " ")
# 正常需要在图形显示数据的文本部分# Display the text part of the data in the graphdt$`HR (95% CI)` <- ifelse(is.na(dt$HR), "", sprintf("%.2f (%.2f to %.2f)", dt$HR, dt$LowerCI, dt$UpperCI))
# 设置主题# Set themecustom_theme <- forest_theme( base_size = 12, refline_col = "#EB746A", footnote_col = "#4F4F4F", footnote_fontface = "italic", title_fontface = "bold", title_size = 14)
# 绘制森林图# Plotplot <- forest( dt[, c(1, 6, 7)], est = dt$HR, lower = dt$LowerCI, upper = dt$UpperCI, ci_column = 2, ref_line = 2, arrow_lab = c("Placebo Better", "Treatment Better"), xlim = c(0, 3), ticks_at = c(0, 1, 2, 3), theme = custom_theme)
# 保存图形# Save plotpdf("results/Forest_map_Optimized.pdf", width = 7, height = 8)print(plot)dev.off()#> png #> 2
使用此脚本,请引用下文:
Defeng Bai, Chuang Ma, Jiani Xun, Hao Luo, Haifei Yang, Hujie Lyu, et al. 2025. "MicrobiomeStatPlots: Microbiome statistics plotting gallery for meta-omics and bioinformatics." iMeta 4: e70002. https://doi.org/10.1002/imt2.70002
Copyright 2016-2024 Defeng Bai baidefeng@caas.cn, Chuang Ma 22720765@stu.ahau.edu.cn, Jiani Xun 15231572937@163.com, Yong-Xin Liu liuyongxin@caas.cn
宏基因组推荐
8月22-24日,高级转录组分析和R语言数据可视化
10月18-19日,微生物组-扩增子16S分析
11月15-16日,微生物组-宏基因组分析
本公众号现全面开放投稿,希望文章作者讲出自己的科研故事,分享论文的精华与亮点。投稿请联系小编(微信号:yongxinliu 或 meta-genomics)
猜你喜欢
iMeta高引 fastp PhyloSuite ImageGP2 iNAP2 ggClusterNet2
iMeta工具 SangerBox2 美吉2024 OmicStudio Wekemo OmicShare
iMeta综述 高脂饮食菌群 发酵中药 口腔菌群 微塑料 癌症 宿主代谢
10000+:扩增子EasyAmplicon 比较基因组JCVI 序列分析SeqKit2 维恩图EVenn
iMetaOmics高引 猪微生物组 16S扩增子综述 易扩增子(EasyAmplicon)
系列教程:微生物组入门 Biostar 微生物组 宏基因组
专业技能:学术图表 高分文章 生信宝典 不可或缺的人
点击阅读原文