绘制 SNP 密度图
一般使用 CMplot 绘制SNP密度图:
包链接:https://github.com/YinLiLin/R-CMplot

要绘制 SNP 密度图,仅仅需要三列即可:
a. 第一列是 SNP 名称
b. 第二列是染色体
c. 第三列是 SNP 的位置
d. 第四列开始为不同性状的P值

  1. 示例数据:
    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
  2. 安装 CMplot 包
    install.packages(“CMplot”)
    library(“CMplot”)
  3. 作图代码
    首先读取数据
    pig60k <- read.table(“data.txt”,header=T)

3.1 示例1 – 密度条形图
#users can personally set the windowsize and the max of legend by:
#bin.size=1e6
#bin.max=N
#memo: add a character to the output file name.

data(pig60K)
CMplot(
pig60K, plot.type=“d”, bin.size=1e6, col=c(“darkgreen”, “yellow”, “red”),
file=“jpg”, memo=“Fig1”, dpi=300, file.output=TRUE, verbose=TRUE
)
Fig1
3.2 示例2 – 环状图
CMplot(
pig60K, plot.type=“c”, chr.labels=paste(“Chr”,c(1:18,“X”), 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=“Fig2”, dpi=300, file.output=TRUE, verbose=TRUE
)
Fig2
3.3 示例3 – 多层圈图
CMplot(pig60K,plot.type=“c”,r=0.4,col=c(“grey30”,“grey60”),chr.labels=paste(“Chr”,c(1:18,“X”),sep=""),
threshold=c(1e-6,1e-4),cir.chr.h=1.5,amplify=TRUE,threshold.lty=c(1,2),threshold.col=c(“red”,
“blue”),signal.line=1,signal.col=c(“red”,“green”),chr.den.col=c(“darkgreen”,“yellow”,“red”),
bin.size=1e6,outward=FALSE,file=“jpg”,memo="",dpi=300,file.output=TRUE,verbose=TRUE)

##Note:
#1. if signal.line=NULL, the lines that crosse circles won’t be added.
#2. if the length of parameter ‘chr.den.col’ is not equal to 1, SNP density that counts the number of SNP within given size(‘bin.size’) will be plotted around the circle.
Fig3
3.4 示例4 – 曼哈顿图
CMplot(
pig60K, plot.type=“m”, col=c(“grey30”,“grey60”), LOG10=TRUE, ylim=c(2,12), threshold=c(1e-6,1e-4),
threshold.lty=c(1,2), threshold.lwd=c(1,1), threshold.col=c(“black”,“grey”), amplify=TRUE,
chr.den.col=NULL, signal.col=c(“red”,“green”), signal.cex=c(1,1),signal.pch=c(19,19),
file=“jpg”,memo="",dpi=300,file.output=TRUE,verbose=TRUE
)

Note:

if the ylim is setted, then CMplot will only plot the ponits which among this interval.

Fig4
3.5 示例5 – 曼哈顿 + 条形图
CMplot(
pig60K, plot.type=“m”, LOG10=TRUE, ylim=NULL, threshold=c(1e-6,1e-4),threshold.lty=c(1,2),
threshold.lwd=c(1,1), threshold.col=c(“black”,“grey”), amplify=TRUE,bin.size=1e6,
chr.den.col=c(“darkgreen”, “yellow”, “red”),signal.col=c(“red”,“green”),signal.cex=c(1,1),
signal.pch=c(19,19),file=“jpg”,memo="",dpi=300,file.output=TRUE,verbose=TRUE
)
##Note:
##if the length of parameter ‘chr.den.col’ is bigger than 1, SNP density that counts the number of SNP within given size(‘bin.size’) will be plotted.
Fig5
3.6 示例6 – 分染色体曼哈顿图
CMplot(
pig60K, plot.type=“m”, multracks=TRUE, threshold=c(1e-6,1e-4),threshold.lty=c(1,2),
threshold.lwd=c(1,1), threshold.col=c(“black”,“grey”), amplify=TRUE,bin.size=1e6,
chr.den.col=c(“darkgreen”, “yellow”, “red”), signal.col=c(“red”,“green”),signal.cex=c(1,1),
file=“jpg”,memo="",dpi=300,file.output=TRUE,verbose=TRUE
)
Fig6
3.7 示例7 – 单性状 QQ 图
CMplot(
pig60K,plot.type=“q”,conf.int.col=NULL,box=TRUE,file=“jpg”,memo="",dpi=300,
file.output=TRUE,verbose=TRUE
)
Fig7
3.8 示例8 – 多性状 QQ 图
CMplot(
pig60K,plot.type=“q”,col=c(“dodgerblue1”, “olivedrab3”, “darkgoldenrod1”),threshold=1e6,
signal.pch=19,signal.cex=1.5,signal.col=“red”,conf.int.col=“grey”,box=FALSE,multracks=
TRUE,file=“jpg”,memo="",dpi=300,file.output=TRUE,verbose=TRUE
)
Fig8
4. CMplot 的参数及解释:
Pmap:
a dataframe, at least four columns. The first column is the name of SNP, the second column is the chromosome of SNP, the third column is the position of SNP, and the remaining columns are the P-value of each trait(Note:each trait a column).
col:
a vector or a matrix, if “col” equals to a vector, each circle use the same colors, it means that the same chromosome is drewed in the same color, the colors are not fixed, one, two, three or more colors can be used, if the length of the “col” is shorter than the length the chromosome, then colors will be applied circularly.
if “col” equals to a matrix, the row is the number of circles(traits), the columns are the colors that users want to use for different circles, so each circle can be plotted in different number of colors, the missing value can be replaced by NA. For example:
col=matrix(c(“grey30”,“grey60”,NA,“red”,“blue”,“green”,“orange”,NA,NA),3,3,byrow=T).
bin.size:
the size of bin for SNP_density plot.
bin.max:
the max value of legend of SNP_density plot, the bin whose SNP number is bigger than ‘bin.max’ will be use the same color.
pch:
a number, the type for the points, is the same with “pch” in .
band:
a number, the space between chromosomes, the default is 1(if the band equals to 0, then there would be no space between chromosome).
cir.band:
a number, the space between circles, the default is 1.
H:
a number, the height for each circle, each circle represents a trait, the default is 1.
ylim:
a vector, the range of Y-axis when plotting the two type of Manhattans, is the same with “ylim” in .
cex.axis:
a number, controls the size of numbers of X-axis and the size of labels of circle plot.
plot.type:
a character or vector, only “d”, “c”, “m”, “q” or “b” can be used. if plot.type=“d”, SNP density will be plotted; if plot.type=“c”, only circle-Manhattan plot will be plotted; if plot.type=“m”,only Manhattan plot will be plotted; if plot.type=“q”,only Q-Q plot will be plotted;if plot.type=“b”, both circle-Manhattan, Manhattan and Q-Q plots will be plotted; if plot.type=c(“m”,“q”), Both Manhattan and Q-Q plots will be plotted.
multracks:
a logical,if multracks=FALSE, plotting multiple traits on multiple tracks, if it is TRUE, all Manhattan plots will be plotted in only one track.
cex:
a number or a vector, the size for the points, is the same with “size” in , and if it is a vector, the first number controls the size of points in circle plot(the default is 0.5), the second number controls the size of points in Manhattan plot(the default is 1), the third number controls the size of points in Q-Q plot(the default is 1)
r:
a number, the radius for the circle(the inside radius), the default is 1.
xlab:
a character, the labels for x axis.
ylab:
a character, the labels for y axis.
xaxs:
a character, The style of axis interval calculation to be used for the x-axis. Possible values are “r”, “i”, “e”, “s”, “d”. The styles are generally controlled by the range of data or xlim, if given.
yaxs:
a character, The style of axis interval calculation to be used for the y-axis. See xaxs above…
outward:
logical, if outward=TRUE,then all points will be plotted from inside to outside.
threshold:
a number or vector, the significant threshold. For example, Bonfferoni adjustment method: threshold=0.01/nrow(Pmap). More than one significant line can be added on the plots, if threshold=0 or NULL, then the threshold line will not be added.
threshold.col:
a character or vector, the colour for the line of threshold levels.
threshold.lwd:
a number or vector, the width for the line of threshold levels.
threshold.lty:
a number or vector, the type for the line of threshold levels.
amplify:
logical, CMplot can amplify the significant points, if amplify=T, then the points greater than the minimal significant level will be highlighted, the default: amplify=TRUE.
chr.labels:
a vector, the labels for the chromosomes of circle-Manhattan plot.
signal.cex:
a number, if amplify=TRUE, users can set the size of significant points.
signal.pch:
a number, if amplify=TRUE, users can set the shape of significant points.
signal.col:
a character, if amplify=TRUE, users can set the colour of significant points, if signal.col=NULL, then the colors of significant points will not be changed.
signal.line:
a number, the width of the lines cross the circle
cir.chr:
logical, a boundary represents chromosome, the default is TRUE.
cir.chr.h:
a number, the width for the boundary, if cir.chr=FALSE, then this parameter will be useless.
chr.den.col:
a character or vector or NULL, the colour for the SNP density. If the length of parameter ‘chr.den.col’ is bigger than 1, SNP density that counts
the number of SNP within given size(‘bin.size’) will be plotted around the circle. If chr.den.col=NULL, then the default colours are the same with the parameter “col” for circle.
cir.legend:
logical, whether to add the legend of each circle.
cir.legend.cex:
a number, the size of the number of legend.
cir.legend.col:
a character, the color of the axis of legend.
LOG10:
logical, whether to change the p-value into log10(p-value).
box:
logical, this function draws a box around the current Manhattan plot.
conf.int.col:
a character, the color of the confidence interval on QQ-plot.
file.output:
a logical, users can choose whether to output the plot results.
file:
a character, users can choose the different output formats of plot, so for, “jpg”, “pdf”, “tiff” can be selected by users.
dpi:
a number, the picture element for .jpg and .tiff files. The default is 300.
memo:
add a character to the output file name.
verbose:
whether print the reminder.

GWAS分析之绘制 SNP 密度图相关推荐

  1. R语言使用ggplot2包的快速可视化函数qplot绘制基础密度图实战

    R语言使用ggplot2包的快速可视化函数qplot绘制基础密度图实战 目录 R语言使用ggplot2包的快速可视化函数qplot绘制基础密度图实战 #仿真数据

  2. R语言使用ggplot2包使用geom_density()函数绘制分组密度图(自定义调色板、brewer、灰度比例)实战(density plot)

    R语言使用ggplot2包使用geom_density()函数绘制分组密度图(自定义调色板.brewer.灰度比例)实战(density plot) 目录 R语言使用ggplot2包使用geom_de ...

  3. R语言使用ggplot2包使用geom_density()函数绘制分组密度图(线条色彩、添加均值线)实战(density plot)

    R语言使用ggplot2包使用geom_density()函数绘制分组密度图(线条色彩.添加均值线)实战(density plot) 目录 R语言使用ggplot2包使用geom_density()函 ...

  4. R语言使用ggplot2包使用geom_density()函数绘制分组密度图(添加直方图、分组颜色配置)实战(density plot)

    R语言使用ggplot2包使用geom_density()函数绘制分组密度图(添加直方图.分组颜色配置)实战(density plot) 目录 R语言使用ggplot2包使用geom_density( ...

  5. R语言使用ggplot2包使用geom_density()函数绘制基础密度图实战(density plot)

    R语言使用ggplot2包使用geom_density()函数绘制基础密度图实战(density plot) 目录 R语言使用ggplot2包使用geom_density()函数绘制基础密度图实战(d ...

  6. R语言使用ggplot2包使用geom_density()函数绘制分组密度图(自定义调色板填充色、brewer调色板填充、灰度比例填充)实战(density plot)

    R语言使用ggplot2包使用geom_density()函数绘制分组密度图(自定义调色板填充色.brewer调色板填充.灰度比例填充)实战(density plot) 目录

  7. R语言使用ggplot2包使用geom_density()函数绘制分组密度图(改变图例位置、移除图例)实战(density plot)

    R语言使用ggplot2包使用geom_density()函数绘制分组密度图(改变图例位置.移除图例)实战(density plot) 目录 R语言使用ggplot2包使用geom_density() ...

  8. R语言使用ggplot2包使用geom_density()函数绘制分组密度图(分组拆分画板基于facet)实战(density plot)

    R语言使用ggplot2包使用geom_density()函数绘制分组密度图(分组拆分画板基于facet)实战(density plot) 目录 R语言使用ggplot2包使用geom_density

  9. R语言绘制核密度图实战(Kernel Density Plot)

    R语言绘制核密度图实战(Kernel Density Plot) 目录 R语言绘制核密度图实战(Kernel Density Plot) #仿真数据

  10. R可视化ggplot2绘制重叠密度图(Overlay Density Plots)

    R可视化ggplot2绘制重叠密度图(Overlay Density Plots) 目录 R可视化ggplot2绘制重叠密度图(Overlay Density Plots) 创建仿真数据 数据格式变换 ...

最新文章

  1. collections模块
  2. html旋转三角菜单,css3 这个三角怎么旋转_html/css_WEB-ITnose
  3. OpenCV黑白图像增强——灰度级切片
  4. TorchNet的学习笔记
  5. 机器学习-支持向量机原理
  6. 小程序左滑删除,可上下滑动
  7. 手机商城系统开发流程_各系统业务逻辑关系架构图_OctShop
  8. Opencv学习——LSD直线检测
  9. 动态链接库(.dll) 动态导入库(.lib) 静态链接库(.lib)
  10. 服务器带宽10M能带多少人同时访问之并发数计算
  11. 工作中遇到的小技巧 一(暂停更新)
  12. sql数据库习题总集
  13. Revit中批量设置导出CAD图纸
  14. 洛谷P1458 [USACO2.1]顺序的分数 Ordered Fractions
  15. putty下载安装教程
  16. Python学习日记1
  17. WebSocket(3)---实现一对一聊天功能
  18. python测试培训 马哥
  19. 【pymysql模块】
  20. iOS连接外设的几种方式

热门文章

  1. 五万字,快速读完《图解TCP/IP》核心内容!!!(建议收藏)
  2. Lighting build failed. Swarm failed to kick off UE4光照构建失败
  3. 《胡雪岩 1》——读书笔记
  4. 基于AT91SAM7se512的串口通讯的实现
  5. matlab liccode,有没有哪位大佬能帮忙解决以下两个错误:liccode=cha
  6. 2007年5月12日,地坛书市
  7. 服务器的硬件设备及raid
  8. 访问阿里云服务器配置的ftp后,报错227 entering passive mode
  9. 【转】PV3D的小练习~太阳系八大行星
  10. 大型在线考试答题系统源码 B/S架构