This document will report the test results for linkage disequilibrium and for Hardy-Weinberg equilibrium of lineage-corrected P. infestans populations on different hierarchical levels based on hosts and regions within Toluca of Mexico.

To set the work directory.

To import the data.

Toluca3regionsLC <- read.genalex("Toluca3regionsLC_farthest_Migrate.csv", ploidy = 3, geo = FALSE, region = FALSE)

First, let’s analyze the full lineage-corrected data set of Toluca population in Mexico.

To check the basic information about the whole Toluca population.

Toluca3regionsLC
## 
## This is a genclone object
## -------------------------
## Genotype information:
## 
##    25 original multilocus genotypes 
##    25 triploid individuals
##    12 codominant loci
## 
## Population information:
## 
##     1 stratum - Pop
##     3 populations defined - Potato_Rural Potato_Valley S. demissum_Wild
setPop(Toluca3regionsLC)<- ~ Pop

popNames(Toluca3regionsLC)
## [1] "Potato_Valley"    "Potato_Rural"     "S. demissum_Wild"
poppr(Toluca3regionsLC)
## | Potato_Valley 
## | Potato_Rural 
## | S. demissum_Wild 
## | Total
##                Pop  N MLG eMLG SE    H  G lambda E.5  Hexp     Ia   rbarD
## 1    Potato_Valley 11  11   10  0 2.40 11  0.909   1 0.497 -0.111 -0.0105
## 2     Potato_Rural  9   9    9  0 2.20  9  0.889   1 0.561  1.055  0.1028
## 3 S. demissum_Wild  5   5    5  0 1.61  5  0.800   1 0.458 -0.623 -0.0714
## 4            Total 25  25   10  0 3.22 25  0.960   1 0.521  0.295  0.0279
##               File
## 1 Toluca3regionsLC
## 2 Toluca3regionsLC
## 3 Toluca3regionsLC
## 4 Toluca3regionsLC

To analyze the index of association (Ia) and standardized index of association (rbarD) and to report P-values based on 10001 permutations of data.

RBARDToluca3regionsLCALL <- ia(Toluca3regionsLC, hist = FALSE, sample = 10001)
RBARDToluca3regionsLCALL
##         Ia       p.Ia      rbarD       p.rD 
## 0.29502375 0.02119576 0.02787128 0.02029594

To report the test results for Hardy-Weinberg equilibrium.

# Because no Monte Carlo test available for polyploids, the number of replicates for the Monte Carlo procedure (B) is zero. Thus, exact test based on Monte Carlo permutations of alleles is not performed.
Toluca3regionsLCALLHW <- hw.test(Toluca3regionsLC, B = 0)
Toluca3regionsLCALLHW
##           chi^2  df  Pr(chi^2 >)
## D13   673.08106 952 1.000000e+00
## G11   318.45239 442 9.999979e-01
## Pi04  126.56250  16 0.000000e+00
## Pi4B   72.97442  50 1.867382e-02
## Pi63   40.66125  16 6.228985e-04
## Pi70   45.40609   7 1.140494e-07
## SSR11  42.99100  16 2.803236e-04
## SSR2   59.18006  16 7.189302e-07
## SSR3   42.10484  77 9.995924e-01
## SSR4  161.79412  77 5.619148e-08
## SSR6   33.96044 112 1.000000e+00
## SSR8   35.24058  30 2.339918e-01

To list a table showing the results for Hardy-Weinberg equilibrium.

kable(Toluca3regionsLCALLHW, digits = 4)
chi^2 df Pr(chi^2 >)
D13 673.0811 952 1.0000
G11 318.4524 442 1.0000
Pi04 126.5625 16 0.0000
Pi4B 72.9744 50 0.0187
Pi63 40.6613 16 0.0006
Pi70 45.4061 7 0.0000
SSR11 42.9910 16 0.0003
SSR2 59.1801 16 0.0000
SSR3 42.1048 77 0.9996
SSR4 161.7941 77 0.0000
SSR6 33.9604 112 1.0000
SSR8 35.2406 30 0.2340

Next, to split the full data set according to “Host”.

splitStrata(Toluca3regionsLC) <- ~Host/Region
Toluca3regionsLC
## 
## This is a genclone object
## -------------------------
## Genotype information:
## 
##    25 original multilocus genotypes 
##    25 triploid individuals
##    12 codominant loci
## 
## Population information:
## 
##     2 strata - Host Region
##     3 populations defined - Potato_Valley Potato_Rural S. demissum_Wild
setPop(Toluca3regionsLC) <- ~Host

To check the basic information.

Toluca3regionsLC
## 
## This is a genclone object
## -------------------------
## Genotype information:
## 
##    25 original multilocus genotypes 
##    25 triploid individuals
##    12 codominant loci
## 
## Population information:
## 
##     2 strata - Host Region
##     2 populations defined - Potato S. demissum

To produce a basic summary table.

poppr(Toluca3regionsLC)
## | Potato 
## | S. demissum 
## | Total
##           Pop  N MLG eMLG SE    H  G lambda E.5  Hexp     Ia   rbarD
## 1      Potato 20  20   10  0 3.00 20   0.95   1 0.530  0.454  0.0428
## 2 S. demissum  5   5    5  0 1.61  5   0.80   1 0.458 -0.623 -0.0714
## 3       Total 25  25   10  0 3.22 25   0.96   1 0.521  0.295  0.0279
##               File
## 1 Toluca3regionsLC
## 2 Toluca3regionsLC
## 3 Toluca3regionsLC

To analyze the index of association (Ia) and standardized index of association (rbarD) and to report P-values based on 10001 permutations of data.

RBARDToluca3regionsLCALLbyHostsep <- (lapply(seppop(Toluca3regionsLC), ia, index="rbarD", hist = FALSE, sample = 10001))
RBARDToluca3regionsLCALLbyHostsep
## $Potato
##         Ia       p.Ia      rbarD       p.rD 
## 0.45411139 0.00529894 0.04276048 0.00519896 
## 
## $`S. demissum`
##          Ia        p.Ia       rbarD        p.rD 
## -0.62321792  0.93621276 -0.07143753  0.97520496

To list a table showing the RBARD results.

kable(RBARDToluca3regionsLCALLbyHostsep, digits = 4)
Ia 0.4541
p.Ia 0.0053
rbarD 0.0428
p.rD 0.0052
Ia -0.6232
p.Ia 0.9362
rbarD -0.0714
p.rD 0.9752

To report the test results of Hardy-Weinberg equilibrium of lineage-corrected populations split by host.

PinfToluca3regionsLCALLbyHostHW <-(lapply(seppop(Toluca3regionsLC), hw.test, B = 0))
PinfToluca3regionsLCALLbyHostHW
## $Potato
##           chi^2  df  Pr(chi^2 >)
## D13   486.25074 665 1.000000e+00
## G11   287.95068 352 9.946547e-01
## Pi04  106.02493  16 2.553513e-15
## Pi4B   60.86983  50 1.395136e-01
## Pi63   31.61420  16 1.122080e-02
## Pi70   29.44490   7 1.200037e-04
## SSR11  38.47954  16 1.292289e-03
## SSR2   62.11141  16 2.298335e-07
## SSR3   32.61834  30 3.393420e-01
## SSR4  138.01302  77 2.444370e-05
## SSR6   26.40138  77 1.000000e+00
## SSR8   29.85664  30 4.730137e-01
## 
## $`S. demissum`
##           chi^2 df Pr(chi^2 >)
## D13   47.000000 77  0.99723767
## G11   21.550000 50  0.99985359
## Pi04  21.550000 16  0.15832473
## Pi4B   6.388889  7  0.49514361
## Pi63   6.250000  2  0.04393693
## Pi70  17.500000  7  0.01444155
## SSR11  8.316327  7  0.30552862
## SSR2   6.388889  7  0.49514361
## SSR3  21.550000 30  0.86990587
## SSR4   6.388889  7  0.49514361
## SSR6   8.316327 30  0.99996917
## SSR8   6.562500  7  0.47580578

To list a table showing the results of Hardy-Weinberg equilibrium.

kable(PinfToluca3regionsLCALLbyHostHW, digits = 4)
chi^2 df Pr(chi^2 >)
D13 486.2507 665 1.0000
G11 287.9507 352 0.9947
Pi04 106.0249 16 0.0000
Pi4B 60.8698 50 0.1395
Pi63 31.6142 16 0.0112
Pi70 29.4449 7 0.0001
SSR11 38.4795 16 0.0013
SSR2 62.1114 16 0.0000
SSR3 32.6183 30 0.3393
SSR4 138.0130 77 0.0000
SSR6 26.4014 77 1.0000
SSR8 29.8566 30 0.4730
chi^2 df Pr(chi^2 >)
D13 47.0000 77 0.9972
G11 21.5500 50 0.9999
Pi04 21.5500 16 0.1583
Pi4B 6.3889 7 0.4951
Pi63 6.2500 2 0.0439
Pi70 17.5000 7 0.0144
SSR11 8.3163 7 0.3055
SSR2 6.3889 7 0.4951
SSR3 21.5500 30 0.8699
SSR4 6.3889 7 0.4951
SSR6 8.3163 30 1.0000
SSR8 6.5625 7 0.4758

Finally, to split the full data set according to “Host” and “Region”.

setPop(Toluca3regionsLC) <- ~Host/Region

To check the basic information.

Toluca3regionsLC
## 
## This is a genclone object
## -------------------------
## Genotype information:
## 
##    25 original multilocus genotypes 
##    25 triploid individuals
##    12 codominant loci
## 
## Population information:
## 
##     2 strata - Host Region
##     3 populations defined - Potato_Valley Potato_Rural S. demissum_Wild

To produce a basic summary table.

poppr(Toluca3regionsLC)
## | Potato_Valley 
## | Potato_Rural 
## | S. demissum_Wild 
## | Total
##                Pop  N MLG eMLG SE    H  G lambda E.5  Hexp     Ia   rbarD
## 1    Potato_Valley 11  11   10  0 2.40 11  0.909   1 0.497 -0.111 -0.0105
## 2     Potato_Rural  9   9    9  0 2.20  9  0.889   1 0.561  1.055  0.1028
## 3 S. demissum_Wild  5   5    5  0 1.61  5  0.800   1 0.458 -0.623 -0.0714
## 4            Total 25  25   10  0 3.22 25  0.960   1 0.521  0.295  0.0279
##               File
## 1 Toluca3regionsLC
## 2 Toluca3regionsLC
## 3 Toluca3regionsLC
## 4 Toluca3regionsLC

To analyze the index of association (Ia) and standardized index of association (rbarD) and to report P-values based on 10001 permutations of data.

RBARDToluca3regionsLCALLbyRegionsep <- (lapply(seppop(Toluca3regionsLC), ia, index="rbarD", hist = FALSE, sample = 10001))
RBARDToluca3regionsLCALLbyRegionsep
## $Potato_Valley
##          Ia        p.Ia       rbarD        p.rD 
## -0.11055339  0.65346931 -0.01048736  0.65666867 
## 
## $Potato_Rural
##         Ia       p.Ia      rbarD       p.rD 
## 1.05458290 0.00119976 0.10275762 0.00099980 
## 
## $`S. demissum_Wild`
##          Ia        p.Ia       rbarD        p.rD 
## -0.62321792  0.94051190 -0.07143753  0.97710458

To list a table showing the RBARD results.

kable(RBARDToluca3regionsLCALLbyRegionsep, digits = 4)
Ia -0.1106
p.Ia 0.6535
rbarD -0.0105
p.rD 0.6567
Ia 1.0546
p.Ia 0.0012
rbarD 0.1028
p.rD 0.0010
Ia -0.6232
p.Ia 0.9405
rbarD -0.0714
p.rD 0.9771

To report the test results of Hardy-Weinberg equilibrium of lineage-corrected populations split by “Host” and “Region”.

setPop(Toluca3regionsLC) <- ~Host/Region
PinfToluca3regionsLCALLbyRegionHW <-(lapply(seppop(Toluca3regionsLC), hw.test, B = 0))
PinfToluca3regionsLCALLbyRegionHW
## $Potato_Valley
##           chi^2  df  Pr(chi^2 >)
## D13   130.00000 156 9.363000e-01
## G11    83.83291 156 9.999996e-01
## Pi04   30.93750   7 6.384591e-05
## Pi4B   25.63000  30 6.938750e-01
## Pi63   17.49306   7 1.447909e-02
## Pi70   23.08172   7 1.649636e-03
## SSR11  21.83163   7 2.715837e-03
## SSR2   38.50000   7 2.434056e-06
## SSR3   15.26531  16 5.052996e-01
## SSR4   24.64000  30 7.423313e-01
## SSR6   14.36704  30 9.928561e-01
## SSR8   22.47980  16 1.283640e-01
## 
## $Potato_Rural
##           chi^2  df  Pr(chi^2 >)
## D13   214.23500 275 9.972989e-01
## G11    62.86388 112 9.999512e-01
## Pi04   51.75000  16 1.201958e-05
## Pi4B   59.04000  50 1.786791e-01
## Pi63   14.27552  16 5.781966e-01
## Pi70   11.56641   7 1.157500e-01
## SSR11  18.00000  16 3.238970e-01
## SSR2   32.62111  16 8.292627e-03
## SSR3   18.90000  16 2.738830e-01
## SSR4   99.84375  77 4.115019e-02
## SSR6   12.06000  16 7.398392e-01
## SSR8   25.66406  30 6.921620e-01
## 
## $`S. demissum_Wild`
##           chi^2 df Pr(chi^2 >)
## D13   47.000000 77  0.99723767
## G11   21.550000 50  0.99985359
## Pi04  21.550000 16  0.15832473
## Pi4B   6.388889  7  0.49514361
## Pi63   6.250000  2  0.04393693
## Pi70  17.500000  7  0.01444155
## SSR11  8.316327  7  0.30552862
## SSR2   6.388889  7  0.49514361
## SSR3  21.550000 30  0.86990587
## SSR4   6.388889  7  0.49514361
## SSR6   8.316327 30  0.99996917
## SSR8   6.562500  7  0.47580578

To list a table showing the results of Hardy-Weinberg Equilibrium.

kable(PinfToluca3regionsLCALLbyRegionHW, digits = 4)
chi^2 df Pr(chi^2 >)
D13 130.0000 156 0.9363
G11 83.8329 156 1.0000
Pi04 30.9375 7 0.0001
Pi4B 25.6300 30 0.6939
Pi63 17.4931 7 0.0145
Pi70 23.0817 7 0.0016
SSR11 21.8316 7 0.0027
SSR2 38.5000 7 0.0000
SSR3 15.2653 16 0.5053
SSR4 24.6400 30 0.7423
SSR6 14.3670 30 0.9929
SSR8 22.4798 16 0.1284
chi^2 df Pr(chi^2 >)
D13 214.2350 275 0.9973
G11 62.8639 112 1.0000
Pi04 51.7500 16 0.0000
Pi4B 59.0400 50 0.1787
Pi63 14.2755 16 0.5782
Pi70 11.5664 7 0.1158
SSR11 18.0000 16 0.3239
SSR2 32.6211 16 0.0083
SSR3 18.9000 16 0.2739
SSR4 99.8438 77 0.0412
SSR6 12.0600 16 0.7398
SSR8 25.6641 30 0.6922
chi^2 df Pr(chi^2 >)
D13 47.0000 77 0.9972
G11 21.5500 50 0.9999
Pi04 21.5500 16 0.1583
Pi4B 6.3889 7 0.4951
Pi63 6.2500 2 0.0439
Pi70 17.5000 7 0.0144
SSR11 8.3163 7 0.3055
SSR2 6.3889 7 0.4951
SSR3 21.5500 30 0.8699
SSR4 6.3889 7 0.4951
SSR6 8.3163 30 1.0000
SSR8 6.5625 7 0.4758

Please note that the values based on permutations could be different slightly among repeated runs.

Session information

sessionInfo()
## R version 3.3.1 (2016-06-21)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: OS X 10.11.6 (El Capitan)
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] knitr_1.14     pegas_0.9      ape_3.5        igraph_1.0.1  
## [5] poppr_2.2.1    adegenet_2.0.1 ade4_1.7-4    
## 
## loaded via a namespace (and not attached):
##  [1] phangorn_2.0.4   gtools_3.5.0     reshape2_1.4.2   splines_3.3.1   
##  [5] lattice_0.20-34  colorspace_1.2-7 htmltools_0.3.5  yaml_2.1.13     
##  [9] mgcv_1.8-15      DBI_0.5-1        sp_1.2-3         plyr_1.8.4      
## [13] stringr_1.1.0    munsell_0.4.3    gtable_0.2.0     codetools_0.2-15
## [17] coda_0.18-1      evaluate_0.10    permute_0.9-4    httpuv_1.3.3    
## [21] parallel_3.3.1   spdep_0.6-8      highr_0.6        Rcpp_0.12.7     
## [25] xtable_1.8-2     scales_0.4.0     backports_1.0.4  formatR_1.4     
## [29] gdata_2.17.0     vegan_2.4-1      mime_0.5         deldir_0.1-12   
## [33] fastmatch_1.0-4  ggplot2_2.1.0    digest_0.6.10    stringi_1.1.2   
## [37] gmodels_2.16.2   dplyr_0.5.0      shiny_0.14.2     grid_3.3.1      
## [41] rprojroot_1.1    quadprog_1.5-5   tools_3.3.1      LearnBayes_2.15 
## [45] magrittr_1.5     tibble_1.2       cluster_2.0.5    seqinr_3.3-3    
## [49] MASS_7.3-45      Matrix_1.2-7.1   nnls_1.4         assertthat_0.1  
## [53] rmarkdown_1.2    R6_2.2.0         boot_1.3-18      nlme_3.1-128