mgQuick: MEMGENE analysis of genetic distance data (main interface for...

Description Usage Arguments Value Author(s) References Examples

View source: R/mgQuick.R

Description

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

1. Find Moran's eigenvectors given coordinates (coords)

2. Perform separate forward selections of positive and negative Moran's 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.

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(genD, coords, 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

coords

A two column matrix or data.frame of x and y coordinates of sampling locations of individual genotypes

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 Moran's eigenvectors

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 using R. Submitted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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]
radialDM <- codomToPropShared(radialGen)

## Run the MEMGENE analysis
radialAnalysis <- mgQuick(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)

memgene documentation built on May 2, 2019, 5:19 p.m.