SNP密度图绘制
原创
©著作权归作者所有:来自51CTO博客作者育种数据分析之放飞自我的原创作品,请联系作者获取转载授权,否则将追究法律责任
本文绘制这种图:
每个SNP在染色体上的分布图,也称为SNP密度图,不同的颜色表示1Mb内包含的SNP个数。
用到的R包CMplot
安装方法:
install.packages("CMplot")
数据格式
plink的map格式:
1 1_320344 0 320344
1 1_342499 0 342499
1 1_509942 0 509942
1 1_538165 0 538165
1 1_565638 0 565638
1 1_612572 0 612572
1 1_722644 0 722644
1 1_791066 0 791066
1 1_813662 0 813662
1 1_865366 0 865366
也可以只包括三列数据:
代码
library(data.table)
library(CMplot)
map1 = fread("re1.map",header = F)
head(map1)
mm = map1 %>% dplyr::select(SNP = 2,Chromosome=1,Position = 4)
head(mm)
CMplot(mm,plot.type="d",bin.size=1e6,col=c("darkgreen", "yellow", "red"),
file="tiff",memo="",dpi=300,file.output=TRUE, verbose=TRUE)
CMplot(mm,plot.type="d",bin.size=1e6,col=c("darkgreen", "yellow", "red"),
file="tiff",memo="",dpi=300,file.output=FALSE, verbose=TRUE)
结果
很简单有没有!!!