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
.
1 2 3 
genD 
A symmetrical distance matrix giving the genetic distances among individual genotypes or populations 
coords 
A two column 
longlat 
If 
truncation 

transformation 

forwardPerm 
The number of permutations in the randomization test for the forward selection of MEM eigenvectors. The default 
forwardAlpha 
The 1alpha level for the forward selection process 
finalPerm 
The number of permutations for the final randomization test of the reduced model. 
doPlot 
Plot 
verbose 
If 
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
Pedro PeresNeto (peresneto.pedro@uqam.ca)
Paul Galpern (pgalpern@ucalgary.ca)
Galpern, P., PeresNeto, P., Polfus, J., and Manseau, M. 2014. MEMGENE: Spatial pattern detection in genetic distance data. Submitted.
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(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)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.