Using divMigrate in the diveRsity package

Kevin Keenan 2013

Introduction

The R package, diveRsity, (Keenan et al, 2013a) is a general purpose library for population genetic analyses in R. It contains various function for the exploration, visualisation and analysis of, mainly, co-dominant diploid data. These data are read in the genepop format for most function (arlequin genotype files are also allowed for some functions). The package allows users to assess loci for relative informativeness, compare populations for relative standardised diversity measures, as well as pairwise differentiation of populations using a range of suitable statistics, including \( G_{ST} \) (Nei, 1972), \( G'_{ST} \) (Hedrick, 2005), \( \theta \) (Weir & Cockerham, 1984), and \( D_{Jost} \) (Jost, 2008).

Accessing the latest verison of diveRsity

# install devtools
install.packages("devtools")
# load devtools
library(devtools)
# install the dev version of diveRsity
install_github("diveRsity", "kkeenan02")

Using the function, divMigrate

divMigrate is a function within the diveRsity package, which implements the method presented in Sundqvist et al., (2013), and provides a plotting facility for the results of this method. Below is a coded demonstration of this function.

Loading the test data set

diveRsity is distributed with a test data set named, Test_data. These data are microsatellite genotypes for six population samples from three seperate geographical locations around Ireland (See Keenan et al 2013b for details). This data set will be used to demonstrate the divMigrate function.

# load diveRsity
library(diveRsity)
Loading required package: plotrix
Loading required package: shiny
Loading required package: ggplot2
Loading required package: qgraph
# load Test_data
data(Test_data)

Now that the data are loaded into R, we can have a look at the output from divMigrate.

Running divMigrate

div_res <- divMigrate(infile = Test_data, stat = "d_jost")
Caution! The method used in this function is still under development. 

plot of chunk runDiv

As we can see the function returns a nice connection network which is designed to reflect the relative relationships between pairs of populations. The relative proximity of the population 'centres' reflect the genetic similarity of populations (almost like a psudo-clustering method), while the darkness of connection lines reflect the relative magnitude of migration between population pairs. In this example is can be seen that P1 and P2 are much closer, genetically, than any of the other populations, while P3 and P4 are next. The darkness of the connection lines between P1 and P2 suggest that geneflow is high, and less so between P3 and P4. While P5 and P6 are relatively close, geographically, to each other, they appear not to be, genetically. All of the patterns displayed in this plot are confirmed by other methods, such as STRUCTUR clustering and sPCA multivariate analyses.

The divMigrate function also return relative migration matrices to the R workspace. Lets look at them.

div_res
$D_mig
       P 1    P 2    P 3    P 4    P 5    P 6
P 1 0.0000 0.9207 0.1332 0.1681 0.1031 0.1651
P 2 1.0000 0.0000 0.1616 0.1915 0.1241 0.1759
P 3 0.1800 0.1901 0.0000 0.6794 0.2128 0.2929
P 4 0.2033 0.2045 0.7007 0.0000 0.2276 0.3678
P 5 0.1181 0.1194 0.1511 0.1957 0.0000 0.2248
P 6 0.1838 0.1826 0.3384 0.3611 0.2222 0.0000

$Gst_mig
       P 1    P 2    P 3    P 4    P 5    P 6
P 1 0.0000 0.8982 0.1659 0.2012 0.1371 0.1995
P 2 1.0000 0.0000 0.2018 0.2337 0.1648 0.2189
P 3 0.2355 0.2454 0.0000 0.7644 0.2760 0.3562
P 4 0.2603 0.2620 0.7938 0.0000 0.2916 0.4442
P 5 0.1638 0.1638 0.1974 0.2468 0.0000 0.2796
P 6 0.2402 0.2402 0.4143 0.4386 0.2850 0.0000

We can see that these matrices are provided for both \( D_Jost \) and \( G_{ST} \).

divMigrate also allows the plotting of both migration matrices, by altering the stat argument as follows:

div_res2 <- divMigrate(infile = Test_data, stat = c("d_jost", "gst"))
Caution! The method used in this function is still under development. 

plot of chunk twoPlt

We can see that both plots, more or less agree.

References

Sundqvist, L., Zackrisson, M., & Kleinhans, D., (2013), Directional genetic differentiation and asymmetric migration, Populations and Evolution subject @ arXiv:1304.0118 [q-bio.PE]

Keenan, K., Bradley, C. R., Magee, J. J., Hynes, R. A., Kennedy, R. J., Crozier, W. W., Poole, R., Cross, T. F., McGinnity, P. and Prodöhl, P. A. (2013), Beaufort trout MicroPlex: a high-throughput multiplex platform comprising 38 informative microsatellite loci for use in resident and anadromous (sea trout) brown trout Salmo trutta genetic studies. Journal of Fish Biology, 82: 1789–1804. doi: 10.1111/jfb.12095

Keenan, K., McGinnity, P., Cross, T. F., Crozier, W. W., Prodöhl, P. A. (2013), diveRsity: An R package for the estimation and exploration of population genetics parameters and their associated errors. Methods in Ecology and Evolution, 4: 782–788. doi: 10.1111/2041-210X.12067