mgQuick_geoD: Memgene analysis of genetic distance data (main interface for...

Description Usage Arguments Value Author(s) References Examples

Description

Performs multiple–typical–steps in a memgene analysis of genetic distance data. Gracefully handles potential errors. Steps are as follows:

1. Find MEM eigenvectors given coordinates (coords)

2. Perform separate forward selections of positive and negative MEM eigenvectors against genetic distance (genD), to identify a significant subset, using parameters forwardPerm as the number of permutations and forwardAlpha as the alpha level for a significant eigenvector. NOTE: The number of permutations forwardPerm is set at 100 by default to reduce analysis time for exploratory analyses. This number should be increased for final analyses.

3. Find the fit of the selected eigenvectors to the genetic distance data (using RDA).

4. Optionally run a permutation test (finalPerm) for the fit of the selected eigenvectors to the genetic distance data.

5. Produce MEMGENE variables using the fitted values from the RDA analysis. MEMGENE variables are the eigenvectors from a PCA of the fitted values. These are the product of memgene and can be used for visualization and subsequent analyses.

6. Optionally produce plots of the scores for the first n MEMGENE variables if doPlot = n.

Usage

1
2
3
mgQuick_geoD(genD, geoD, longlat = FALSE, truncation = NULL,
    transformation = NULL, forwardPerm = 100, forwardAlpha = 0.05,
    finalPerm = NULL, doPlot = NULL, verbose = TRUE)

Arguments

genD

A symmetrical distance matrix giving the genetic distances among individual genotypes or populations

geoD

A square matrix of the same dimensions and genD, containing geographical distances from which MEM vectors are calculated.

longlat

If TRUE then coords are longitude and latitude, so find the geodesic distances among sampling locations using the geosphere package

truncation

NULL under typical usage. See mgMEM for experimental options.

transformation

NULL under typical usage. See mgMEM for experimental options.

forwardPerm

The number of permutations in the randomization test for the forward selection of MEM eigenvectors. The default forwardPerm=100 is sufficient for exploratory purposes, however this should be increased for final analyses.

forwardAlpha

The 1-alpha level for the forward selection process

finalPerm

The number of permutations for the final randomization test of the reduced model. NULL by default does not perform a final randomization test.

doPlot

Plot doPlot = n MEMGENE variables

verbose

If TRUE then report progress to the console

Value

A list
$P gives the probability of the null hypothesis for the RDA on the final model
$RSqAdj is the adjusted R2 for the RDA, understood as the proportion of all genetic variation that is explicable by spatial pattern (i.e. spatial genetic signal)
$memgene contains a matrix with the MEMGENE variables in columns
$memSelected gives a matrix containing the selected MEM eigenvectors in columns
$whichSelectPos gives the indices of the selected MEM eigenvectors with positive eigenvalues (i.e. from $mem)
$whichSelectNeg gives the indices of the selected MEM eigenvectors with negative eigenvalues (i.e. from $mem)
$mem the output of mgMEM given coords

Author(s)

Pedro Peres-Neto (peres-neto.pedro@uqam.ca)
Paul Galpern (pgalpern@ucalgary.ca)

References

Galpern, P., Peres-Neto, P., Polfus, J., and Manseau, M. 2014. MEMGENE: Spatial pattern detection in genetic distance data. Submitted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
## Prepare the radial data for analysis
radialData <- read.csv(system.file("extdata/radial.csv", package="memgene"))
radialGen <- radialData[, -c(1,2)]
radialXY <- radialData[, 1:2]
if (require(adegenet)) {
  radialDM <- codomToPropShared(radialGen)
} else {
  stop("adegenent package required to produce genetic distance matrix in example.")
}

## Run the MEMGENE analysis
radialAnalysis <- mgQuick_geoD(radialDM, radialXY)

## Extract the scores on the first 3 MEMGENE variables
## for subsequent analysis
radialMEMGENE1 <- radialAnalysis$memgene[, 1]
radialMEMGENE2 <- radialAnalysis$memgene[, 2]
radialMEMGENE3 <- radialAnalysis$memgene[, 3]

## Find the proportion of variation explained by all MEMGENE variables
propVariation <- radialAnalysis$sdev/sum(radialAnalysis$sdev)

## End(Not run)

kkeenan02/memgeneMod documentation built on May 20, 2019, 10:46 a.m.