安装并加载所需R包
# install.packages("CMplot")
library(CMplot)
基本用法
CMplot(Pmap, col=c("#377EB8", "#4DAF4A", "#984EA3", "#FF7F00"),
bin.size=1e6, bin.max=NULL, pch=19, band=1, cir.band=0.5, H=1.5,
ylim=NULL, cex.axis=1, plot.type="b", multracks=FALSE, cex=c(0.5,1,1),
r=0.3, xlab="Chromosome", ylab=expression(-log[10](italic(p))), xaxs="i",
yaxs="r", outward=FALSE, threshold = NULL, threshold.col="red",
threshold.lwd=1, threshold.lty=2, amplify= TRUE, chr.labels=NULL,
signal.cex = 1.5, signal.pch = 19, signal.col="red", signal.line=1,
cir.chr=TRUE, cir.chr.h=1.5, chr.den.col=c("darkgreen", "yellow", "red")
, cir.legend=TRUE, cir.legend.cex=0.6, cir.legend.col="black",
LOG10=TRUE, box=FALSE, conf.int.col="grey", file.output=TRUE,
file="jpg", dpi=300, memo="")
常用参数
Pmap 输入数据文件
col 设置不同染色体中点的颜色
cex 设置点的大小
pch 设置点的形状
band 设置不同染色体之间的间隔
H 设置每个圈的高度
ylim 设置y轴的范围
bin.size 设置SNP密度图中的窗口大小
cex.axis 设置坐标轴字体和标签字体的大小
plot.type 设置不同的绘图类型,可以设定为 "d", "c", "m", "q" or "b"
multracks 设置是否需要绘制多个track
r 设置圈的半径大小
xlab 设置x轴标签
ylab 设置y轴标签
outward 设置点的朝向是否向外
threshold 设置阈值并添加阈值线
threshold.col 设置阈值线的颜色
threshold.lwd 设置阈值线的宽度
threshold.lty 设置阈值线的类型
amplify 设置是否放大显著的点
signal.cex 设置显著点的大小
signal.pch 设置显著点的形状
signal.col 设置显著点的颜色
chr.labels 设置染色体的标签
chr.den.col 设置SNP密度图的颜色
cir.band 设置环状曼哈度图中不同染色体之间的间隔
cir.chr 设置是否显示染色体的边界
cir.chr.h 设置染色体边界的高度
cir.legend 设置是否显示图例
cir.legend.cex 设置图例字体的大小
cir.legend.col 设置图例的颜色
LOG10 设置是否对p-value取log10对数
conf.int.col 设置QQ图中置信区间的颜色
file.output 设置是否输出图片
file 设置输出图片的格式,可以设定为"jpg", "pdf", "tiff"
dpi 设置输出图片的分辨度
memo 设置输出图片文件的名字
加载并查看示例数据
data(pig60K)
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
基本数据格式:
前三列分别为SNP的名称,所在染色体,SNP的位置,
后面每列为不同性状的P值,每个性状单独一列
默认绘图(分别绘制出SNP密度图,曼哈顿图,环形曼哈顿图和QQ图)
CMplot(pig60K)
单独绘制SNP密度图
CMplot(pig60K,plot.type = "d",bin.size = 1e6, col = c("darkgreen","yellow","red"))
绘制单性状曼哈顿图
CMplot(pig60K,plot.type = "m",threshold = c(0.01,0.05)/nrow(pig60K),threshold.col=c('grey','black'),
threshold.lty = c(1,2),threshold.lwd = c(1,1), amplify = T,
signal.cex = c(1,1), signal.pch = c(20,20),signal.col = c("red","orange"))
绘制多性状曼哈顿图
CMplot(pig60K,plot.type = "m",threshold = c(0.01,0.05)/nrow(pig60K),threshold.col=c('grey','black'),
threshold.lty = c(1,2),threshold.lwd = c(1,1), amplify = T, multracks = T,
signal.cex = c(1,1), signal.pch = c(20,20),signal.col = c("red","orange"))
绘制环形曼哈顿图
CMplot(pig60K,plot.type="c",r=0.5,threshold=c(0.01,0.05)/nrow(pig60K),cex = 0.5,
threshold.col = c("red","orange"), threshold.lty = c(1,2),amplify = T, cir.chr.h = 2,
signal.cex = c(2,2), signal.pch = c(19,20), signal.col=c("red","green"),outward=TRUE)
绘制单性状QQ图
CMplot(pig60K,plot.type = "q",threshold = 0.05)
绘制多性状QQ图
CMplot(pig60K,plot.type = "q",multracks = T, threshold = 0.05, threshold.col = "orange",
amplify = T,signal.cex = 1.5, signal.pch = 20, signal.col = "red")