在生信分析中,我们都需要借助曼哈顿图来可视化Fst、iHS等选择信号的分析结果,那么,如何绘制曼哈顿图呢?
我们这里使用R语言中的qqman包来实现曼哈顿图的绘制
首先需要在R语言中安装qqman这个包
install.packages('qqman')
绘制之前需要制作一个5列的表格1列为序号 2列为SNP(rs) 3列为染色体 4列为位置(开始位置即可) 5列为Fst,表格第一行名称分别为 空 SNP CHR BP P csv格式保存
library('qqman')
data1 <- read.table("dorper-slow.windowed.weir.csv",header = T,sep = ',')
color_set <- c("#801e91","#344fa8","#f7cb34","#a8a8aa","#ffe4c7")
par(cex=0.9)
manhattan(data1,col=color_set, logp = F,ylab='Fst',suggestiveline = -log10(1e-08) )
##logp一般为F,若为T则y轴取值为-logp值
##ylim=c(0,7) 可限制y轴的范围
######常用参数
# suggestiveline 设置"suggestive"线的阈值,默认为-log10(1e-5),因此如果不想要这个线,可以放大这个值
# genomewideline 设置"genome-wide significant"线的阈值,默认为-log10(5e-8)
# highlight 高亮感兴趣的SNP位点, snps = c("51157","51158","51159")
# logp 设置是否对Pvalue去log10值
# annotatePval 注释低于指定p-value阈值的位点
# annotateTop 是否只注释低于指定p-value阈值位点中的top hit
############加与y轴相交的虚线 abline(lty = 2 , h = 0.42)
2、CMplot绘制
library(CMplot)
data1 <- read.table("FST.csv",header = T,sep = ',')
color_set <- c("#801e91","#344fa8","#f7cb34","#a8a8aa","#ffe4c7")
CMplot(data1, plot.type="m", LOG10=F,
chr.den.col=NULL, col = color_set,
threshold = 0.3, threshold.col = "red", threshold.lwd= 2, threshold.lty =1,
amplify = FALSE, file.output=T, height=5, width = 10,
###ylab = "XP-CLR",
ylab = expression(paste(italic('F'),st)),
pch =".", cex =4, dpi = 400, file = "jpg",memo = "FST")