setwd("/mnt/d/wsj/GLM/Q")
library(CMplot)
SNPs <- c("NC_041007.1:38508460", "NC_041007.1:38516387") # 用您实际的SNP名称替换这里的示例SNP
file_list <- list.files(pattern = "\\.txt$")
#曼哈顿图
for (file in file_list) {
data <- read.table(file)
CMplot(data, plot.type="m", LOG10=TRUE, ylim=NULL, threshold=c(1e-6),threshold.lty=c(1,2),
threshold.lwd=c(1,1), threshold.col=c("black","grey"), amplify=TRUE,bin.size=1e6, highlight=SNPs, highlight.col=c("green", "blue"), highlight.cex=1,
chr.den.col=c("darkgreen", "yellow", "red"),signal.col=c("red","green"),signal.cex=c(1.5,1.5),
signal.pch=c(19,19),file="jpg",file.name=file, dpi=300,file.output=,verbose=TRUE,
width=14,height=6,main="")
}
#QQ图
setwd("D:/wsj/MLM/Q")
library(CMplot)
file_list <- list.files(pattern = "\\.txt$")
# 循环遍历每个文件,进行绘图并保存为jpg文件
for (file in file_list) {
data <- read.table(file)
CMplot(data,plot.type="q",box=FALSE,file="jpg",file.name=file,main="",dpi=300,
conf.int=TRUE,conf.int.col=NULL,threshold.col="red",threshold.lty=2,
file.output=TRUE,verbose=TRUE,width=5,height=5)
}