#!/usr/bin/env Rscript
# cat ../manhattan_cmplot2.R
# Rscript ../manhattan_cmplot2.R gwas_output.snp gwas_output.png
library(tidyverse)
args=commandArgs(TRUE)
if (length(args) != 2) {
print ("usage: <gwas file(4 column)> <out.prefix> ")
q()
}
input <- args[1]
#max_y <- as.numeric(args[3])
prefix <- args[2]
library(CMplot)
gwas<- read.table(input, header = T);
png(paste(prefix, "_manhattan.png", sep = ""), width=600, height=300)
CMplot(gwas,
plot.type = "m",
LOG10 = T,
col = c("#808080","#000000"),
cex = 0.3,
ylab.pos = 2,
cex.axis = 1.2,
# chr.labels=paste("Chr",c(1:21),sep=""),
chr.labels.angle=45,
threshold = c(1e-5,1e-8), ## 显著性阈值, the Bonfferoni adjustment methodc(0.05,0.01)/nrow(gwas)
threshold.col=c('red','black'), ## 阈值线颜色
threshold.lty = c(2,2), ## 阈值线线型
threshold.lwd = c(2,1), ## 阈值线粗细
amplify = T, ## 放大显著SNP
highlight.cex=1,
highlight.pch=19,
main=prefix,
chr.den.col=c("darkgreen", "yellow","red"),
signal.cex = c(1,1), ## 点大小
signal.pch = c(20,20), ## 点形状
signal.col = c("#A2C39A","#6AA84F","#3E7D21"), ## 点颜色
file.output = F )
dev.off()
png(paste(prefix, "_qq.png", sep = ""), width=300, height=300)
CMplot(gwas,
plot.type = "q", ## 绘制QQplot
box=T, ## 是否加边框
conf.int=T, ## 是否绘制置信区间
conf.int.col=NULL, ## 置信区间颜色
threshold.col="red", ## 对角线颜色
threshold.lty=2, ## 线型
cex = 0.8,
ylab.pos = 2,
cex.axis = 1.5,
main = "QQ-plot",
file.output = F )
dev.off()