# 安装并加载CMplot包(若未安装)
#if (!require("CMplot")) {
# install.packages("CMplot")}
library(CMplot)
#data(pig60K) # 加载内置示例数据集
#head(pig60K) # 查看数据结构:需包含SNP、Chromosome、Position、P值列
data <- read.csv("pig60K.csv")
#view(data)
#data("pig60K")
# 绘制基础曼哈顿图
CMplot(
data,
#pig60K,
plot.type = "m", # 指定绘图类型为曼哈顿图
col = c("grey", "skyblue"), # 交替染色体颜色
LOG10 = FALSE, # 对P值取-log10转换
threshold = c(2, 5, -2, -5),# 显著性阈值线(示例值,需根据实际数据调整)
threshold.col = c("red", "blue", "red", "blue"), # 阈值线颜色
threshold.lty = c(1, 2), # 线型(1=实线,2=虚线)
amplify = FALSE, # 放大显著点
#signal.col = "orange", # 显著点颜色
file.output = TRUE, # 输出图片文件
file = "jpg", # 输出格式(可选jpg/pdf/tiff)
dpi = 600, # 分辨率
width = 26, # 图片宽度
height = 6 # 图片高度
)
manhatnn_R.R
最新推荐文章于 2025-06-27 00:07:32 发布