CMplot
๐ Circular and Rectangular Manhattan Plot
Install / Use
/learn @YinLiLin/CMplotREADME
CMplot
<img alt="Hits" src="https://hits.sh/github.com/YinLiLin/CMplot.svg?view=today-total&label=Today%2FTotal%20Visitors&extraCount=105563"/>
A high-quality drawing tool designed for Manhattan plot of genomic analysis
:toolbox: Relevant software tools for genetic analyses and genomic breeding
<table> <tr> <td><g-emoji class="g-emoji" alias="mailbox" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4eb.png">๐ซ</g-emoji> <strong><a href="https://www.hiblup.com/" rel="nofollow">HIBLUP</a></strong>: Versatile and easy-to-use GS toolbox.</td> <td><g-emoji class="g-emoji" alias="four_leaf_clover" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f340.png">๐</g-emoji> <strong><a href="https://github.com/xiaolei-lab/SIMER">SIMER</a></strong>: data simulation for life science and breeding.</td> </tr> <tr> <td><g-emoji class="g-emoji" alias="biking_man" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f6b4-2642.png">๐ด‍โ๏ธ</g-emoji> <strong><a href="https://github.com/YinLiLin/KAML">KAML</a></strong>: Advanced GS method for complex traits.</td> <td><g-emoji class="g-emoji" alias="mountain_snow" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f3d4.png">๐๏ธ</g-emoji> <strong><a href="http://ianimal.pro/" rel="nofollow">IAnimal</a></strong>: an omics knowledgebase for animals.</td> </tr> <tr> <td><g-emoji class="g-emoji" alias="swimmer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f3ca.png">๐</g-emoji> <strong><a href="https://github.com/YinLiLin/hibayes">hibayes</a></strong>: A Bayesian-based GWAS and GS tool.</td> <td><g-emoji class="g-emoji" alias="postbox" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4ee.png">๐ฎ</g-emoji> <strong><a href="https://github.com/xiaolei-lab/rMVP">rMVP</a></strong>: Efficient and easy-to-use GWAS tool.</td> </tr> </table>Installation
CMplot is available on CRAN, so it can be installed with the following R code:
> install.packages("CMplot")
> library("CMplot")
# if you want to use the latest version on GitHub:
> source("https://raw.githubusercontent.com/YinLiLin/CMplot/master/R/CMplot.r")
There are two example datasets attached in CMplot, users can export and view the details by following R code:
> data(pig60K) #calculated p-values by MLM
> data(cattle50K) #calculated SNP effects by rrblup
> 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
> head(cattle50K)
SNP chr pos Somatic cell score Milk yield Fat percentage
1 SNP1 1 59082 0.000244361 0.000484255 0.001379210
2 SNP2 1 118164 0.000532272 0.000039800 0.000598951
3 SNP3 1 177246 0.001633058 0.000311645 0.000279427
4 SNP4 1 236328 0.001412865 0.000909370 0.001040161
5 SNP5 1 295410 0.000090700 0.002202973 0.000351394
6 SNP6 1 354493 0.000110681 0.000342628 0.000105792
As the example datasets, the first three columns are names, chromosome, position of SNPs respectively, the rest of columns are the pvalues of GWAS or effects of GS/GP for traits, the number of traits is unlimited. Note: if plotting SNP_Density, only the first three columns are needed.
Now CMplot could handle not only Genome-wide association study results, but also SNP effects, Fst, tajima's D and so on.
Total 50~ parameters are available in CMplot, typing ?CMplot can get the detail function of all parameters.
Citation
CMplot has been integrated into our developed GWAS package rMVP, please cite the following paper:</br>
Yin, L. et al. rMVP: A Memory-efficient, Visualization-enhanced, and Parallel-accelerated tool for Genome-Wide Association Study, Genomics, Proteomics & Bioinformatics (2021), doi: 10.1016/j.gpb.2020.10.007.</br>
SNP-density plot
> CMplot(pig60K,plot.type="d",bin.size=1e6,chr.den.col=c("darkgreen", "yellow", "red"),file="jpg",file.name=NULL,dpi=300,
main="illumilla_60K",file.output=TRUE,verbose=TRUE,width=9,height=6)
# set the window size: bin.size=1e6
# set the legend breaks by: bin.breaks=seq(min, max, step), e.g., bin.breaks=seq(0, 50, 10), the windows out of the breaks will be plotted in the same color as min or max.
# get the detailed information of all windows: "windinfo <- CMplot(pig60K, plot.type="d", ...)"
# file: the format of the output file, if file="png", CMplot will output a transparent background file
# file.name: specify the output file name, the default is corresponding column name when setting file.name=NULL
# chr.labels: change the chromosome names
# main: change the title of the plots
# NOTE: to show the full length of each chromosome, users can manually add every chromosome with one SNP, whose
# position equals to the length of corresponding chromosome, then specify the parameter: CMplot(..., chr.pos.max=TRUE).
<p align="center">
<a href="https://raw.githubusercontent.com/YinLiLin/R-CMplot/master/Figure/illumilla_60K_Qc.jpg">
<img src="Figure/illumilla_60K_Qc.jpg" height="460px" width="680px">
</a>
</p>
Circular-Manhattan plot
(1) Genome-wide association study(GWAS)
> CMplot(pig60K,type="p",plot.type="c",chr.labels=paste("Chr",c(1:18,"X","Y"),sep=""),r=0.4,cir.axis=TRUE,
outward=FALSE,cir.axis.col="black",cir.chr.h=1.3,chr.den.col="black",file="jpg",
file.name=NULL,dpi=300,file.output=TRUE,verbose=TRUE,width=10,height=10)
# to remove the grid line in circles, add parameter cir.axis.grid=FALSE
# file.name: specify the output file name, the default is corresponding column name
<p align="center">
<a href="https://raw.githubusercontent.com/YinLiLin/R-CMplot/master/Figure/9.jpg">
<img src="Figure/9.jpg" height="480px" width="480px">
</a>
</p>
> CMplot(pig60K,type="p",plot.type="c",r=0.4,col=c("grey30","grey60"),chr.labels=paste("Chr",c(1:18,"X","Y"),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",file.name=NULL,dpi=300,file.output=TRUE,verbose=TRUE,width=10,height=10)
#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.
<p align="center">
<a href="https://raw.githubusercontent.com/YinLiLin/R-CMplot/master/Figure/10.jpg">
<img src="Figure/10.jpg" height="480px" width="480px">
</a>
</p>
(2) Genomic Selection/Prediction(GS/GP)
> CMplot(cattle50K,type="p",plot.type="c",LOG10=FALSE,outward=TRUE,col=matrix(c("#4DAF4A",NA,NA,"dodgerblue4",
"deepskyblue",NA,"dodgerblue1", "olivedrab3", "darkgoldenrod1"), nrow=3, byrow=TRUE),
chr.labels=paste("Chr",c(1:29),sep=""),threshold=NULL,r=1.2,cir.chr.h=1.5,axis.cex=1,
cir.band=1,file="jpg", file.name=NULL,dpi=300,chr.den.col="black",file.output=TRUE,verbose=TRUE,
width=10,height=10)
# parameter 'col' can be eitherย vector or matrix, if a matrix, each trait can be plotted in different colors.
# file.name: specify the output file name, the default is corresponding column name when setting ' file.name=NULL '
<p align="center">
<a href="https://raw.githubusercontent.com/YinLiLin/R-CMplot/master/Figure/11.jpg">
<img src="Figure/11.jpg" height="480px" width="480px">
</a>
</p>
Rectangular-Manhattan plot
Genome-wide association study(GWAS)
> CMplot(pig60K,type="p",plot.type="m",LOG10=TRUE,threshold=NULL,file="jpg",file.name=NULL,dpi=300,
file.output=TRUE,verbose=TRUE,width=14,height=6,chr.labels.angle=45)
# 'chr.labels.angle': adjust the angle of labels of x-axis (-90 < chr.labels.angle < 90).
# file.name: specify the output file name, the default is corresponding column name when setting ' file.name=NULL '.
<p align="center">
<a href="https://raw.githubusercontent.com/YinLiLin/R-CMplot/master/Figure/1.jpg">
<img src="Figure/1.jpg" height="385px" width="900px">
</a>
</p>
Amplify signals on pch, cex and col
> 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.5,1.5),signal.pch=c(19,19),
file="jpg",file.name=NULL,dpi=300,file.output=TRUE,verbose=TRUE,width=14,height=6)
#Note: if the ylim is setted, then CMplot will only plot the points among this interval,
# ylim can be vector or list, if it is a list, different traits can be assigned with
# different range at y-axis.
# 'threshold' can be set for different traits, for example: threshold=list(c(1e-6,1e-4),
