曼哈顿图常用于展示基因组数据, 画图方法有多种,今天简单介绍以下几种:
一、R-qqman包
R包就会涉及安装,载入,如下:
安装:install.packages('qqman')
载入:library(qqman)
head(gwasResults,3) #查看qqman提供qwas示例数据(gwasResult)
SNP CHR BP P
1 rs1 1 1 0.9148060
2 rs2 1 2 0.9370754
3 rs3 1 3 0.2861395
其中:SNP---snp名称,CHR---染色体编号,BP---碱基位置,P---p值;
1)最简单的manhattan:
manhattan(gwasResults)
2)加入标题、调整颜色、部分SNP高亮等细节
head(snpOfInterest) #查看内置高亮snp数据,snpOfInterest可自行设置
manhattan(gwasResults, col = c("blue4", "orange3"), main = "Results from simulated trait",genomewideline = FALSE, suggestiveline = FALSE,highlight = snpsOfInterest[1:10])
其中参数:
CHR3的绿色点来自snpsOfInterest,highlight参数控制;
蓝色横线由参数suggestiveline控制;
红色横线由参数genomewideline控制;
3)批量表示基因名
gwasResults[3057,1] <- "AA" #将最显著的点,自定义,可看出改变
manhattan(gwasResults,suggestiveline =FALSE,genomewideline =FALSE,col=c("#FF6A6A","#43CD80","#EE7600"),annotatePval=0.05,annotateTop=TRUE)
其中: annotatePval可以设置p阈值,低于该值的散点将会在图中被标记;annotateTop默认为True,即仅标记p值最小的点,所以该图中各条染色体只有一个snp被标记,倘若annotateTop设置为False,则所有低于annotatePval的点均会被标记。
二、R-CMplot包
参数更多,图更美观;多表型manhattan图绘制;circos状展示;
1)沿用gwasResults数据:CMplot(gwasResults,plot.type="m",LOG10=TRUE,threshold=NULL,chr.den.col=NULL,file="jpg",memo="",dpi=300)
2)SNP的密度在图下面展示(CMplot内置数据):
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,chr.den.col=c("darkgreen","yellow","red"),bin.size=1e6,signal.col=c("red","green"),signal.cex=c(1,1),signal.pch=c(19,19),file="jpg",memo="",dpi=300)
#parameter 'chr.den.col' is bigger than 1, SNP density that counts the number of SNP within given size('bin.size') will be plotted
3)多表型展示
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)
4)circos状展示
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="",dpi=300)
三、function方法:
四、基础plot方法
将pos位置叠加,按照点图的思路绘制即可。