在之前GWAS分析中,我們已經(jīng)學(xué)會了如何使用R包qqman對單個性狀繪制manhattan圖,有時(shí)會需要將多個性狀的manhattan圖組合到一張圖中分析,今天就帶小伙伴學(xué)習(xí)一個R包(CMplot)的用法。
Step1:下載,加載R包
#安裝R包CMplot
BiocManager::install("CMplot")
# 或則在GitHub獲取最新版本:
source("https://raw.githubusercontent.com/YinLiLin/CMplot/master/R/CMplot.r")
#加載
library(CMplot)
Step2: 加載,查看示例文件
#加載示例文件pig60K
data(pig60K) #通過MLM計(jì)算p-values
#可以看看文件格式
head(pig60K)
SNP Chromosome Position trait1 trait2 trait3
1 ALGA0000009 1 52297 0.7738187 0.51194318 0.51194318
2 ALGA0000014 1 79763 0.7738187 0.51194318 0.51194318
3 ALGA0000021 1 209568 0.7583016 0.98405289 0.98405289
4 ALGA0000022 1 292758 0.7200305 0.48887140 0.48887140
5 ALGA0000046 1 747831 0.9736840 0.22096836 0.22096836
6 ALGA0000047 1 761957 0.9174565 0.05753712 0.05753712
說明:
第一列:標(biāo)記
第二列:染色體
第三列:位置
第四列往后:不同性狀
Step3: 畫manhanttan圖組合圖
#同時(shí)畫出單個性狀和3個性狀組合圖:
CMplot(pig60K[sample(1:nrow(pig60K), 10000),c(1:6)],plot.type="m", mar = c(3,6,3,3),
threshold=c(0.01,0.05)/nrow(pig60K),threshold.col=c('red','orange'),
multracks=TRUE, chr.den.col=NULL, file.output=TRUE)


#使用所有標(biāo)記畫3個性狀曼哈頓圖的circle圖:
#加載數(shù)據(jù)
data(pig60K)
#做circle圖
CMplot(pig60K,type="p",plot.type="c",chr.labels=paste("Chr",c(1:18,"X","Y"),sep=""),r=0.4,cir.legend=TRUE, outward=FALSE,cir.legend.col="black",cir.chr.h=1.3,chr.den.col="black",file="jpg", memo="",dpi=300,file.output=TRUE,verbose=TRUE,width=10,height=10)

最后,我們看一下CMplot的所有參數(shù)及用法。
CMplot(Pmap, col=c("#4197d8", "#f8c120", "#413496", "#495226",
"#d60b6f", "#e66519", "#d581b7", "#83d3ad", "#7c162c", "#26755d"),
bin.size=1e6, bin.range=NULL, pch=19, type="p", band=1, H=1.5,
ylim=NULL, cex.axis=1, lwd.axis=1.5, cex.lab=1.5, plot.type="b",
multracks=FALSE, cex=c(0.5,1,1), r=0.3, outward=FALSE,
ylab=expression(-log[10](italic(p))), ylab.pos=3, xticks.pos=1,
mar = c(3,6,3,3), threshold = NULL, threshold.col="red", threshold.lwd=1,
threshold.lty=2, amplify= TRUE, signal.cex = 1.5, signal.pch = 19,
signal.col=NULL, signal.line=2, highlight=NULL, highlight.cex=1,
highlight.pch=19, highlight.type="p", highlight.col="red",
highlight.text=NULL, highlight.text.col="black", highlight.text.cex=1,
highlight.text.xadj=NULL, highlight.text.yadj=NULL,
highlight.text.font=3, chr.labels=NULL, chr.border=FALSE,
chr.labels.angle=0, chr.den.col="black", cir.band=1, cir.chr=TRUE,
cir.chr.h=1.5, cir.legend=TRUE, cir.legend.cex=0.6,
cir.legend.col="black", LOG10=TRUE, box=FALSE, conf.int=TRUE,
conf.int.col=NULL, file.output=TRUE, file=c("jpg","pdf","tiff"),
dpi=300, height=NULL, width=NULL, memo="", main="", main.cex=1.5,
main.font=2, trait.legend.ncol=NULL, verbose=TRUE)
其中:
Pmap: 輸入的數(shù)據(jù)文件
col:不同染色體中點(diǎn)的顏色或者不同性狀中點(diǎn)的顏色
pch: 點(diǎn)的形狀
type: 可以是"p"(點(diǎn)), "l"(線), "h"(垂線) 等
band: 染色體之間的距離
H: 每個性狀(圓圈)的高度
ylim: y軸范圍
cex.axis:設(shè)置X/Y軸刻度標(biāo)簽和圓形圖的染色體標(biāo)簽的大小
lwd.axis:X/Y軸刻度線的粗細(xì)
cex.lab:控制X/Y軸標(biāo)簽的大小
plot.type:設(shè)置繪圖類型,可以設(shè)置為"d", "c", "m", "q" or "b"
multracks:是否繪制多個track,選項(xiàng)TRUE/FALSE
cex:點(diǎn)的大小
r:圓圈的半徑
outward:點(diǎn)的分布朝向,由內(nèi)而外或者由外向內(nèi)
ylab:y軸標(biāo)簽
ylab.pos:y軸標(biāo)簽位置
mar: 繪圖周圍白色空間大小
threshold:設(shè)置閾值
threshold.col:閾值線顏色
threshold.lwd:閾值線寬度
threshold.lty:閾值線類型
amplify:是否放大顯著的點(diǎn)
…
LOG10: P value是否進(jìn)行l(wèi)og10處理
file.output:是否輸出結(jié)果
file:輸出格式,可以是"jpg","pdf","tiff"
dpi:輸出圖片的分辨率
今天的分享就到這里了,有興趣的小伙伴可以自己嘗試畫一下。
往期回顧:
GWAS分析 (一)
http://www.itdecent.cn/p/67e1878845e3
GWAS分析-曼哈頓圖 (二)
http://www.itdecent.cn/p/fa261b6045c2
GWAS分析-常用文件格式 (三)
http://www.itdecent.cn/p/ad47f575e83b
GWAS分析-R包GAPIT (四)
http://www.itdecent.cn/p/9944bcbfe3c7