GenVectors: HaploVectors, SNPVectors and GenVectors

Description Usage Arguments Details Value See Also Examples

View source: R/GenVectors.R

Description

Function to extract haplotypic/SNP/genetic eigenvectors and perform null model-based tests.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
SNPVectors(x, pop, checkdata = TRUE, method = "euclidean",
  squareroot.dis = TRUE, choices = c(1, 2), analysis = "none", envir,
  formula, runs = 999, ...)

HaploVectors(x, pop, dist.model = "N", checkdata = TRUE,
  log.frequencies = FALSE, method = "euclidean",
  squareroot.dis = TRUE, choices = c(1, 2), analysis = "none", envir,
  formula, runs = 999, ...)

GenVectors(pop, distances, checkdata = TRUE, method = "euclidean",
  squareroot.dis = TRUE, choices = c(1, 2), analysis = "none", envir,
  formula, runs = 999, ...)

## S3 method for class 'GenVectors'
print(x, ...)

Arguments

x

A list with the set of DNA sequences (class "DNAbin" or "haplotype") as used by the function haplotype or a set of individual genotypes (an object of class genind) as used by the function propShared.

pop

A matrix describing the incidence of each individual (columns) in a given locality (rows).

checkdata

Logical argument (TRUE or FALSE) to check if individual sequences in the pop data follow the same order as in the set of DNA sequences (Default checkdata = TRUE).

method

Dissimilarity index to apply in matrix P, which describes localities by their haplotypic/SNP/genetic composition, as accepted by vegdist function in vegan package (Default method = "euclidean").

squareroot.dis

Logical argument (TRUE or FALSE) to specify if use square root of dissimilarity index in matrix P (Default squareroot.dis = TRUE).

choices

Axes for re-scaling. Choices must have length equal to two (Default choices = c(1, 2)).

analysis

Type of analysis, partial match to "none", "adonis" or "glm" (Default analysis = "none").

envir

A matrix with environmental variables for each population, with variables as columns and localities as rows. See Details and Examples.

formula

An object of class formula. Used in "adonis" or "glm" analysis. See Details and Examples.

runs

Number of permutations for assessing probability of type I error.

...

Aditional arguments to function matrix.p.sig and pcps.sig.

dist.model

A character string used by the function dist.dna to specify the evolutionary model to be used to computes pairwise distances from DNA sequences (default dist.model = "N").

log.frequencies

Logical argument (TRUE or FALSE) to specify if transformation of natural logarithms plus one in haplotype per locality data must be applied (Default log.frequencies = FALSE).

distances

Matrix containing genetic distances between individuals.

Details

HaploVectors and SNPVectors are two complementary functions to extract haplotypic/SNP eigenvectors and perform null model-based tests.

HaploVectors function is based in set of DNA sequences (class "DNAbin" or "haplotype") as used by the function haplotype and pairwise distances from DNA sequences as used in dist.dna. SNPVectors function is based in set of individual genotypes (class "genind") as pairwise distances between alleles based in propShared function.

The function HaploVectors extract haplotypic eigenvectors and perform null model tests. The argument analysis specify the type of analysis performed. When analysis is equal "adonis" the analysis is performed in matrix of haplotypic composition (using matrix.p.sig function). The argument formula must be specified, where the left hand side gives the resemblance data, right hand side gives the variables. The resemblance data is internally named p.dist, thus formula is an expression of the form p.dist ~ predictors. If analysis is equal "glm" it is performed with haplovector (using pcps.sig function). In this case, the argument formula must also be specified, where the left hand side gives the vectors used, right hand side gives the variables. The vectors are internally named sequentially haplovector.1, haplovector.2, haplovector.3 and so on. Thus, formula is an expression of the form haplovector.1 ~ predictors.

The function SNPVectors work same way, however extract genetic eigenvectors based in distances between alleles. Similarly the argument analysis specify the type of analysis performed. When analysis is equal "adonis" the analysis is performed in matrix of genetic composition and the argument formula must be specified in the same way the HaploVectors function. If analysis is equal "glm" it is performed with SNPvector and the argument formula must also be specified. This case the vectors are internally named sequentially SNPvector.1, SNPvector.2, SNPvector.3 and so on. Thus, formula is an expression of the form SNPvector.1 ~ predictors.

A third function, called a GenVectors, is also available. In this case, the matrices of distances between individuals can be supplied directly. This function work same way that other two functions, but the vectors are internally named sequentially geneticvector.1, geneticvector.2, geneticvector.3 and so on.

Value

A list with:

call

Arguments used.

haplotypes

A list with haplotypes index that identify each observation that share the same haplotype.

haplotype.distances

A matrix with pairwise distances between haplotypes.

SNP.distances

A matrix with pairwise distances between alleles.

genetic.distances

A matrix with pairwise genetic distances.

individual.per.haplotype

A matrix with individuals per haplotype.

haplotype.per.locality

A matrix with frequency of each haplotype per locality (W).

vectors

Haplotypic/SNP/genetic eigenvectors (haplovectors, snpvectors or geneticvectors).

values

Eigenvalues, relative eigenvalues and cumulative relative eigenvalues.

correlations

Correlations between haplotypic/SNP/genetic eigenvectors and haplotypes/alleles.

P

Matrix of haplotypic/SNP/genetic composition (P).

scores

Scores for biplots.

model

The observed model.

fun

The funtion used.

statistic.null.turnover

A matrix with null statistic for turnover null model.

statistic.null.divergence

A matrix with null statistic for divergence null model.

statistic.obs

Observed statistic, F value to predefined function.

p.turnover

The p value for the turnover null model.

p.divergence

The p value for the divergence null model.

See Also

HaploDist, SNPDist, matrix.p.sig, pcps.sig

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(segv)

HaploVectors(segv$segv.fas, segv$segv.pi, envir = segv$segv.envir,
             choices = c(1,2))

HaploVectors(segv$segv.fas, segv$segv.pi, analysis = "adonis", 
             envir = segv$segv.envir, formula = p.dist~R, runs = 99)

HaploVectors(segv$segv.fas, segv$segv.pi, analysis = "glm", 
             envir = segv$segv.envir, formula = haplovector.1~R, runs = 99)

vanderleidebastiani/GenVectors documentation built on Aug. 9, 2019, 1:41 a.m.