pophelperSpatial
is an R package that incorporates spatial/geographic data with qlist or q-matrices such as ADMIXTURE, fastSTRUCTURE, STRUCTURE, TESS etc.
For a detailed demonstration and walkthrough, refer the online vignette.
You need to have R (> 3.3.2) statistical package installed on your system. R is open-source and freely available to download for Windows, Mac and other OS. Then, install the 'devtools' package and other dependencies.
# install packages from CRAN
install.packages(c("akima","Cairo","devtools","fields","ggplot2","gridExtra","gtable","PBSmapping","spatstat","tidyr"),dependencies=T)
Then, you can install pophelperSpatial
and pophelper
from github
using the devtools
package. pophelper
package is needed to read in various run files.
#install from GitHub
install_github('royfrancis/pophelper')
install_github('royfrancis/pophelperSpatial')
Note that ggplot2
version must be 2.2.0 or higher. And pophelper
version must be 2.0.0 or higher. Then load both libraries as below.
#load library for use
library(pophelper)
library(pophelperSpatial)
pophelperSpatial 1.0.0
has been tested on
For help on any function, use ?plotQInterpolate
. If inside RStudio press TAB inside a function to view arguments. plotQSpatial(<tab>)
.
plotQInterpolate() # Spatially interpolate clusters from a STRUCTURE/TESS run file
plotQSpatial() # Cluster by max assignment and plot points spatially
Fig. 1: Interpolated plot of a one-element qlist containing 6 clusters (K=6). The default interpolation algorithm (method) used was kriging. In this particular case, it is known that K=2, therefore only cluster 2 has useful information.
Fig. 2: Interpolated plot of one cluster (Cluster 2) containing 6 clusters (K=6) showing different interpolation methods. Row 1 from left: bilinear, bicubic and Inverse distance weighting. Row 2 from left: Nearest neighbour and Kriging.
Fig. 3: Interpolation plots showing some of the available colour palettes.
Fig. 4: Some of the plots created using the function plotQSpatial()
.
For detailed demonstration and description, refer the vignette.
The pophelperSpatial
R package is offered free and without warranty of any kind, either expressed or implied. I will not be held liable to you for any damage arising out of the use, modification or inability to use this program. Please make sure you verify all your results.
If you have any comments, suggestions or issues, report on the Github issues page.
2016 Roy M Francis
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.