在GWAS研究中,还有一种常用的图形就是Q-Q plot
,虽然它的颜值可能不如曼哈顿图
, 但是它表达的信息比曼哈顿图
要丰富得多😽, 相当于GWAS
研究的质控图
。
Q-Q plot
全称是quantile-quantile plot,也就是分位图,基本原理
是通过比较两个概率分布的分位数,从而实现对两个概率分布进行比较。
✅ STEP1
Q-Q plot
的Y
轴是SNP
位点的p
值(实际结果,即observed
);
X
轴是则是均匀分布的概率值(期望值,即Expected
);
Note! 上述指标均为换算为-log10
后的数值。
✅ STEP2
如果traits
并非真的受SNP
的影响,那么会看到GWAS
的p
值分布和均匀分布的结果集中在一条直线上; 💔
如果traits
真的受SNP
的影响,GWAS
的p
值会在随X
轴的增大,突然出现与均匀分布的快速分离。🤜🤛
rm(list = ls())
library(CMplot)
data(pig60K)
data(cattle50K)
CMplot(pig60K,plot.type="q",
box=F,
file="jpg",
memo="",
dpi=300,conf.int=TRUE,
conf.int.col=NULL,
threshold.col="red",
threshold.lty=2,
file.output=F,
verbose=F,
width=5,height=5)
🧐常遇到的问题: ✅ 如何把不同的
traits
画在一张图上 ✅ 如果存在缺失值,怎么标记出来
我们先无中生有造几个缺失值出来,分别在trait2
和trait3
中。 🤫
这里我们把NA
标记成◇
和△
pig60K$trait1[sample(1:nrow(pig60K), round(nrow(pig60K)*0.80))] <- NA
pig60K$trait2[sample(1:nrow(pig60K), round(nrow(pig60K)*0.25))] <- NA
CMplot(pig60K,
plot.type="q",
col=c("dodgerblue1", "olivedrab3", "darkgoldenrod1"),
threshold=1e-6,
ylab.pos=2,
signal.pch=c(19,6,5), # shape of significant points.
signal.cex=1.2,
signal.col="red", # the colors of significant points
conf.int=T, # whether to plot confidence interval on QQ-plot.
box=F,
multracks=T,
cex.axis=2,
file="jpg", memo="",dpi=300,
file.output=F,verbose=F,
ylim=c(0,8),
width=5,height=5)
当然你也可以三个分开然后
拼
在一起
CMplot(pig60K,
plot.type="q",
col=c("dodgerblue1", "olivedrab3", "darkgoldenrod1"),
threshold=1e-6,
ylab.pos=2,
signal.pch=c(19,6,5), # shape of significant points.
signal.cex=1.2,
signal.col="red", # the colors of significant points
conf.int=T, # whether to plot confidence interval on QQ-plot.
box=F,
multracks=F,
cex.axis=2,
file="jpg", memo="",dpi=300,
file.output=F,verbose=F,
ylim=c(0,8),
width=5,height=5)
最后祝大家早日不卷!~