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

Description Usage Arguments Value Examples

View source: R/mgQuicker.R

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
mgQuicker(geoD, genD)

Arguments

genD

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

geoD

A symmetrical distance matrix giving the geographical distances among individual.

Value

A list

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 <- mgQuicker(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 18, 2017, 9:34 p.m.