Utility to plot genome-level 2D-SFS

Utility to plot genome-level 2D-SFS

This script plots a shade-of-grey two-way plot where shade intensity represents the number of occurrences in each cell. All scripts are provided in their current state of development with no warranty that they will work in all cases, and only for reference purposes. They can be used and modified by citing the Author (see script header). Example files can be obtained from the Author upon request.

#this script was written by Ivan Scotti, INRA, URFM
#Site Agroparc, Domaine Saint-Paul
#84914 AVIGNON Cedex 9
#you are free to use and modify it, provided you quote the author
#for questions, please contact Ivan Scotti at
#ivan.scotti[at]paca.inra.fr
#15 July 2015
#
gridPlot<-function(X,nbGenes)
#X = a table object containing the 2D-SFS
#nbGenes = nb of genotyped chromosomes = 2 * individuals for diploid species  
  {
  #text(labels=X,x=(col(X)-1),y=((nbGenes+1)-row(X)),cex=((X+0.1)/max(X))^3)
  symbols(x=(col(X)-1),y=((nbGenes+1)-row(X)),
          squares=rep(1,(nbGenes+1)^2),inches=F,asp=1,xlab="",ylab="",xaxt="n",yaxt="n",
          #vary power in bg=...: the smaller the value, the darker the cells
          bty="n",bg=colours()[153+floor(100*(1-(X/max(X))^0.15))])
  #bty="n",bg=colours()[153])
}
gridPlot(multiPopSFS.list[[1]],40)

Date de modification : 22 juin 2023 | Date de création : 16 juillet 2015 | Rédaction : Ivan Scotti