曼哈顿图教程Manhattan plot tutorial

学术   2024-09-12 07:02   英国  


曼哈顿图简介

曼哈顿图(Manhattan Plot)是一种散点图,通常用于显示具有大量非零的波动数据点,以及更高幅度值的分布,常常用在全基因组关联研究(GWAS)中。它的图像因与曼哈顿的天际线相似而得名。在微生物分析中,曼哈顿图可以用来展示差异OTU/ASV的上下调和差异OTU/ASV归属情况。曼哈顿图在其他研究中的应用包括:1.展示全基因组数据,直观的展示整个基因组中的统计显著性,通常以染色体为单位来展示数据点; 2.识别显著性区域,通过颜色或高度的变化,可以快速识别出具有统计显著性的区域,这些区域可能与某些疾病或性状相关;3.比较不同研究,可以用来比较不同研究或不同群体之间的统计显著性差异;3.可视化P值分布,使用负对数尺度(-log10)来表示P值,这使得观察者可以很容易识别出P值的分布情况;4.软色体位置的可视化,通常沿着X轴展示染色体的位置,使得观察者可以直观地看到每个显著性信号在基因组中的位置;5.辅助假设生成,通过观察曼哈顿上的模式,研究人员可以生成新的科学假设,比如那些基因或区域可能与研究的性状有关联。

标签:#微生物组数据分析  #MicrobiomeStatPlot  #曼哈顿图  #R语言可视化

作者:First draft(初稿):Defeng Bai(白德凤)Proofreading(校对):Ma Chuang(马闯) and Jiani Xun(荀佳妮);Text tutorial(文字教程):Defeng Bai(白德凤)

源代码及测试数据链接:

https://github.com/YongxinLiu/MicrobiomeStatPlot/ 项目中目录 3.Visualization_and_interpretation/ManhattanPlot

或公众号后台回复“MicrobiomeStatPlot”领取


曼哈顿图案例1

这是中国科学院遗传发育所白洋课题组2019年发表于Nature Biotechnology上的一篇论文用到的曼哈顿图。论文题目为:NRT1.1B is associated with root microbiota composition and nitrogen use in field-grown ricehttps://doi.org/10.1038/s41587-019-0104-4.

图 3 |  籼稻和粳稻根部微生物群差异细菌的分类和功能特征

曼哈顿图显示田块 I (a) 和田块 II (b) 中富含籼稻或粳稻的 OTU。每个点或三角形代表一个 OTU。富含籼稻或粳稻的 OTU 分别用实心或空心三角形表示(FDR 调整 P<0.05,Wilcoxon 秩和检验)。OTU 按分类顺序排列,并根据门或变形菌纲着色。CPM,每百万计数。

总结:该图利用曼哈顿图展示了在籼稻或粳稻中富集的OTU。


结果

根系微生物组和氮利用。接下来我们在OTU水平上研究了籼稻和粳稻亚种根系微生物组的差异。首先,我们使用曼哈顿图分析了OTU的富集情况(图3a、b和补充表6)。在两个田块中,籼稻中富集的OTU属于广泛的细菌门,包括酸杆菌门、变形菌门、放线菌门、拟杆菌门、绿弯菌门、厚壁菌门和疣微菌门(FDR调整后的P<0.05,Wilcoxon秩和检验;图3a、b和补充表6)。粳稻根系保留了富集属于变形菌门、拟杆菌门和厚壁菌门的OTU的能力(FDR调整后的P<0.05,Wilcoxon秩和检验;图3a、b和补充表6)

正文描述:通过曼哈顿图展示了OTU水平上籼稻和粳稻亚种根系微生物组的差异。使用曼哈顿图分析了OTU的富集情况。


曼哈顿图案例2

这是约翰霍普金斯大学彭博公共卫生学院Nilanjan Chatterjee团队2022年发表于Nature Genetics上的一篇论文。论文的题目是:Plasma proteome analyses in individuals of European and African ancestry identify cis-pQTLs and models for proteome-wide association studies. https://doi.org/10.1038/s41588-022-01051-w.

图 4 | 血清尿酸水平和痛风的 PWAS 和 TWAS 分析的迈阿密图

a、b 尿酸 (a) 和痛风 (b) 的 PWAS (上) 和 TWAS (下) 的迈阿密图。每个点代表表型与顺式遗传调节的血浆蛋白或基因表达水平之间关联的双侧 z 检验的 P 值,按 x 轴上的基因组位置和 y 轴上的关联强度的 −log10(P 值) 排序。黑色水平虚线是 Bonferroni 校正后对总插补模型数量的显着性阈值(P 值 = 3.7 × 10−5(PWAS)和 TWAS 的 2.1 × 10−7)。为了更好地显示,a 中的尿酸 PWAS 和 TWAS 在 y 轴上以 −log10(P 值) = 30 和 −log10(P 值) = 150 截断。重要 PWAS 基因附近的 TWAS 基因(±500 kb)按 GTEx 组织着色。最显著的附近 TWAS 基因标有其基因名称和相应的组织。IL1RN 的 TWAS 未达到 TWAS 显著性阈值,因此标记为灰色。所有主要 TWAS 分析均基于使用 GTEx V7 数据开发的既定模型进行,并使用 GTEx V8 提供的初步模型进一步验证已确定的顶级基因/组织组合的结果(补充表 16)。为了减小图形的大小,我们仅绘制了 TWAS 结果中非常不显著(P 值 >0.05)的一小部分点。TWAS, 全转录组关联研究; PWAS, 全蛋白质组关联研究。

总结:通过曼哈顿图展示了TWAS和PWAS分析得到的表型与血浆蛋白或基因表达之间关联的显著性。

结果

将 pQTL 与从现有数据库 (方法) 中整理的基因组功能和调控注释整合在一起,提供了一种了解遗传调控效应的分子机制和后果的有效方法。我们发现顺式 pQTL 富含几种改变蛋白质的功能,这可能是由前面提到的表位结合效应引起的 (扩展数据图 4a、b)。调整 PAV 后,独立的哨兵顺式 pQTL 在大量功能注释中富集,包括非翻译区 (5′ 和 3′)、启动子和转录因子结合位点,其模式在两个种群中一致 (扩展数据图 4c、d 和补充表 9)。

曼哈顿图R语言实战1

源代码及测试数据链接:

https://github.com/YongxinLiu/MicrobiomeStatPlot/

或公众号后台回复“MicrobiomeStatPlot”领取

软件包安装

# 基于CRAN安装R包,检测没有则安装p_list = c("ggplot2", "dplyr", "readr", "ggrepel", "patchwork","CMplot")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(ggplot2)))suppressWarnings(suppressMessages(library(dplyr)))suppressWarnings(suppressMessages(library(readr)))suppressWarnings(suppressMessages(library(ggrepel)))suppressWarnings(suppressMessages(library(patchwork)))suppressWarnings(suppressMessages(library(CMplot)))

通过曼哈顿图展示OTU的上调、下调或者不显著 

# 读取数据# Read datadata <- read.csv("data/result.csv")
# 根据p值和logFC进行分类# Classification based on p-value and logFCdata <- data %>%  mutate(change = case_when(    P.Value < 0.05 & abs(logFC) > 1 ~ ifelse(logFC < 0, "depleted", "enriched"),    TRUE ~ "nosig"  ))
# 将p值取负对数# Take the negative logarithm of the p-valuedata <- data %>%  mutate(P.Value = -log10(P.Value))
# 绘制图形# Plotp1 <- ggplot(data, aes(x = Phylum, y = P.Value)) +  geom_point(aes(color = Phylum, shape = change, size = logFC), position = position_jitter(width = 0.5), alpha = 0.7) +  scale_y_continuous(expand = expansion(mult = c(0, 0)), limits = c(0, 15)) +  scale_size_continuous(range = c(1, 3.5)) +  scale_shape_manual(values = c(6,17,16)) +  scale_color_brewer(palette = "Set2") +  geom_hline(yintercept = -log10(0.05), linetype = "dotted", color = "darkred") +  labs(x = "Phylum", y = expression(-log[10](P)),                                #y = "-log10(P-Value)",       title = "Manhattan Plot") +  theme_light() +  theme(legend.position = "top",        legend.title = element_text(size = 12),        legend.text = element_text(size = 10),        axis.title = element_text(size = 12),        axis.text = element_text(size = 10),        plot.title = element_text(size = 14, face = "bold"))+  theme(axis.text.x = element_text(angle = 45, hjust = 1))  # 保存图形# Save plotggsave(paste("results/manhattan_plot01",".pdf", sep=""),p1, width=105 * 1.5, height=80 * 1.5, unit='mm')

结果

曼哈顿图R语言实战2

通过曼哈顿图展示关联分析的显著性

曼哈顿图目前也被广泛用于全基因组关联研究(GWAS)。其核心思想是表示大量非显著数据点,以及少数几个显著数据点的簇,这些显著点在图中呈现高耸的塔状结构。在常见的应用中,曼哈顿图用于绘制p值,但是通过使用-log10(p)进行转换,使得较小的p值有更高的转换值。


# 读取数据# Read datadatafile <- "data/41588_2022_1051_MOESM8_ESM.txt"data_df <- read_tsv(datafile)
# 统计染色体数量# Count the number of chromosomesnCHR<-length(unique(data_df$CHR))
# 根据疾病列筛选数据# Filter data based on disease columndata_filtered <- data_df %>% filter(disease == "Urate")
# 计算染色体中心位置# Calculate the chromosome center positionchr_centers <- data_filtered %>%  group_by(CHR) %>%  summarise(center = (max(BPcum) + min(BPcum)) / 2, .groups = 'drop')
# 根据组织列筛选数据# Filter data based on organization columndata_plasma <- data_filtered %>% filter(tissue == "Plasma")
# 绘制基本图形# Plotplot_base <- ggplot(data = data_plasma, aes(x = BPcum, y = -log10(P), color = as.factor(CHR), size = -log10(P))) +  geom_point(alpha = 0.7, size=0.5) +  scale_x_continuous(    breaks = chr_centers$center,    labels = chr_centers$CHR,    limits = c(min(data_plasma$BPcum), max(data_plasma$BPcum))  ) +  scale_y_continuous(    limits = c(0, 32),    expand = expansion(mult = c(0, 0))  ) +  scale_color_manual(values = rep(c("#5ebcc2", "#005c72"), nCHR)) +  scale_size_continuous(range = c(1, 4)) +  geom_hline(yintercept = -log10(3.7e-5), linetype = "dotted", color = "#a63b00") +  labs(    x = NULL,    y = expression(-log[10](P)),    title = NULL  ) +  guides(color = "none") +  theme_classic() +  theme(    axis.text.x = element_text(size = 8, angle = 45, hjust = 1),    axis.text.y = element_text(size = 8),    axis.title = element_text(size = 10),    plot.title = element_text(size = 12, face = "bold")  )
# 定义标签# Set labelsgenes <- c("INHBB", "ITIH1", "BTN3A3", "INHBA", "C11orf68", "B3GAT3", "INHBC(7.95e-63)", "SNUPN", "NEO1", "FASN")labels_data <- data_plasma %>% filter(ID %in% genes) %>%  mutate(logP = -log10(P))
# 添加文本标签# Add text labelsplot_labels <- plot_base +  ggrepel::geom_label_repel(    data = labels_data,    aes(x = BPcum, y = logP, label = ID),    size = 2,    box.padding = 0.3,    segment.color = "black",    direction = "both",    nudge_y = 0.2  )
# 拼接图形# Patchworkfinal_plot <- plot_base+  scale_color_manual(values = rep(c("#aba9dd", "#5ebcc2"), nCHR))+  theme(legend.direction = "horizontal")+  plot_labels + theme(legend.direction = "horizontal")+  plot_layout(guides="collect")+  plot_annotation(theme = theme(legend.position = "top"))# 保存图形# Save plotggsave(paste("results/manhattan_plot02",".pdf", sep=""), final_plot, width=135 * 1.5, height=60 * 1.5, unit='mm')

曼哈顿图R语言实战3

通过环状曼哈顿图对比多组之间关联分析差异情况

用CMplot软件包绘制曼哈顿圈图

CMplot 已集成到软件包 rMVP 中,可参考以下论文: Yin, L. et al. rMVP: A Memory-efficient, Visualization-enhanced, and Parallel-accelerated tool for Genome-Wide Association Study, Genomics, Proteomics & Bioinformatics (2021), https://doi.org/10.1016/j.gpb.2020.10.007.

# 示例数据# Load datadata("pig60K")   # 猪的60K SNP数据(60K SNP data of pig)data("cattle50K") # 牛的50K SNP数据(50K SNP data for cattle)
# 示例 1: 基本的圆形图,显示GWAS结果的p值(Example 1: Basic pie chart showing p-values of GWAS results)CMplot(pig60K, plot.type = "c", r = 0.5, LOG10 = TRUE, col = c("grey30", "grey60"), outward = FALSE)#>  Circular Manhattan plotting trait1.#>  Circular Manhattan plotting trait2.#>  Circular Manhattan plotting trait3.#>  Plots are stored in: F:/001_MicrobiomePlots/Formated_plots/22ManhattanPlot
# 示例 2: 更改图的方向,显示结果向外扩展# Example 2: Change the direction of the graph to show the results expanding outwardsCMplot(pig60K,       plot.type = "c",       r = 1,       LOG10 = TRUE,       col = c("grey30", "grey60"),       outward = TRUE)#>  Circular Manhattan plotting trait1.#>  Circular Manhattan plotting trait2.#>  Circular Manhattan plotting trait3.#>  Plots are stored in: F:/001_MicrobiomePlots/Formated_plots/22ManhattanPlot
# 示例 3: 在圆形图上添加染色体标签# Example 3: Add chromosome labels to a circular plotCMplot(pig60K,       plot.type = "c",       r = 1,       LOG10 = TRUE,       col = c("grey30", "grey60"),       outward = TRUE,       cir.chr = TRUE,       cir.chr.h = 1.3)#>  Circular Manhattan plotting trait1.#>  Circular Manhattan plotting trait2.#>  Circular Manhattan plotting trait3.#>  Plots are stored in: F:/001_MicrobiomePlots/Formated_plots/22ManhattanPlot
# 示例 4: 每个圆圈使用不同的颜色# Example 4: Use a different color for each circleCMplot(pig60K,       plot.type = "c",       r = 1,       cir.chr.h = 1.3,       col = matrix(c("darkblue", "darkgreen", "darkmagenta"), nrow = 3, byrow = TRUE))#>  Circular Manhattan plotting trait1.#>  Circular Manhattan plotting trait2.#>  Circular Manhattan plotting trait3.#>  Plots are stored in: F:/001_MicrobiomePlots/Formated_plots/22ManhattanPlot
# 示例 5: 相同染色体使用相同的颜色# Example 5: Use the same color for the same chromosomeCMplot(pig60K,       plot.type = "c",       r = 1,       LOG10 = TRUE,       cir.chr.h = 1.3,       col = c("darkblue", "darkgreen", "darkmagenta"))#>  Circular Manhattan plotting trait1.#>  Circular Manhattan plotting trait2.#>  Circular Manhattan plotting trait3.#>  Plots are stored in: F:/001_MicrobiomePlots/Formated_plots/22ManhattanPlot
# 示例 6: 每个圆圈使用不同数量的颜色# Example 6: Using a different number of colors for each circleCMplot(pig60K,       plot.type = "c",       r = 1,       LOG10 = TRUE,       cir.chr.h = 1.3,       col = matrix(c("darkblue", NA, NA,                      "darkgreen", "darkmagenta", NA,                      "gold", "black", "greenyellow"),                    nrow = 3, byrow = TRUE))#>  Circular Manhattan plotting trait1.#>  Circular Manhattan plotting trait2.#>  Circular Manhattan plotting trait3.#>  Plots are stored in: F:/001_MicrobiomePlots/Formated_plots/22ManhattanPlot

使用此脚本,请引用下文:

Yong-Xin Liu, Lei Chen, Tengfei Ma, Xiaofang Li, Maosheng Zheng, Xin Zhou, Liang Chen, Xubo Qian, Jiao Xi, Hongye Lu, Huiluo Cao, Xiaoya Ma, Bian Bian, Pengfan Zhang, Jiqiu Wu, Ren-You Gan, Baolei Jia, Linyang Sun, Zhicheng Ju, Yunyun Gao, Tao Wen, Tong Chen. 2023. EasyAmplicon: An easy-to-use, open-source, reproducible, and community-based pipeline for amplicon data analysis in microbiome research. iMeta 2: e83. https://doi.org/10.1002/imt2.83

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

宏基因组推荐
本公众号现全面开放投稿,希望文章作者讲出自己的科研故事,分享论文的精华与亮点。投稿请联系小编(微信号:yongxinliu 或 meta-genomics)

猜你喜欢

iMeta高引文章 fastp 复杂热图 ggtree 绘图imageGP 网络iNAP
iMeta网页工具 代谢组MetOrigin 美吉云乳酸化预测DeepKla
iMeta综述 肠菌菌群 植物菌群 口腔菌群 蛋白质结构预测

10000+:菌群分析 宝宝与猫狗 梅毒狂想曲 提DNA发Nature

系列教程:微生物组入门 Biostar 微生物组  宏基因组

专业技能:学术图表 高分文章 生信宝典 不可或缺的人

一文读懂:宏基因组 寄生虫益处 进化树 必备技能:提问 搜索  Endnote

扩增子分析:图表解读 分析流程 统计绘图

16S功能预测   PICRUSt  FAPROTAX  Bugbase Tax4Fun

生物科普:  肠道细菌 人体上的生命 生命大跃进  细胞暗战 人体奥秘  

写在后面

为鼓励读者交流快速解决科研困难,我们建立了“宏基因组”讨论群,己有国内外6000+ 科研人员加入。请添加主编微信meta-genomics带你入群,务必备注“姓名-单位-研究方向-职称/年级”。高级职称请注明身份,另有海内外微生物PI群供大佬合作交流。技术问题寻求帮助,首先阅读《如何优雅的提问》学习解决问题思路,仍未解决群内讨论,问题不私聊,帮助同行。

点击阅读原文

宏基因组
宏基因组/微生物组是当今世界科研最热门的研究领域之一,为加强本领域的技术交流与传播,推动中国微生物组计划发展,中科院青年科研人员创立“宏基因组”公众号,目标为打造本领域纯干货技术及思想交流平台。
 最新文章