gen_graph_indep: Create an independence graph of genetic differentiation from...

View source: R/gen_graph_indep.R

gen_graph_indepR Documentation

Create an independence graph of genetic differentiation from genetic data of class genind

Description

The function allows to create genetic graphs from genetic data by applying the conditional independence principle. Populations whose allelic frequencies covary significantly once the covariance with the other populations has been taken into account are linked on the graphs.

Usage

gen_graph_indep(
  x,
  dist = "basic",
  cov = "sq",
  pcor = "magwene",
  alpha = 0.05,
  test = "EED",
  adj = "none",
  output = "igraph"
)

Arguments

x

An object of class genind that contains the multilocus genotype (format 'locus') of the individuals as well as their population and their geographical coordinates.

dist

A character string indicating the method used to compute the multilocus genetic distance between populations

  • If 'dist = 'basic” (default), then the multilocus genetic distance is computed using a Euclidean genetic distance formula (Excoffier et al., 1992)

  • If 'dist = 'weight”, then the multilocus genetic distance is computed as in Fortuna et al. (2009). It is a Euclidean genetic distance giving more weight to rare alleles

  • If 'dist = 'PG”, then the multilocus genetic distance is computed as in popgraph::popgraph function, following several steps of PCA and SVD (Dyer et Nason, 2004).

  • If 'dist = 'PCA”, then the genetic distance is computed following a PCA of the matrix of allelic frequencies by population. It is a Euclidean genetic distance between populations in the multidimensional space defined by all the independent principal components.

cov

A character string indicating the formula used to compute the covariance matrix from the distance matrix

  • If 'cov = 'sq” (default), then the covariance matrix is calculated from the matrix of squared distances as in Everitt et Hothorn (2011)

  • If 'cov = 'dist”, then the covariance matrix is calculated from the matrix of distances as in Dyer et Nason (2004) and popgraph function

pcor

A character string indicating the way the partial correlation matrix is computed from the covariance matrix.

  • If 'pcor = 'magwene”, the steps followed are the same as in Magwene (2001) and in popgraph::popgraph function. It is the recommended option as it meets mathematical requirements.

  • If 'pcor = 'other”, the steps followed are the same as used by Fortuna et al. (2009). They are not consistent with the approach of Magwene (2001).

alpha

A numeric value corresponding to the statistical tolerance threshold used to test the difference from 0 of the partial correlation coefficients. By default, 'alpha=0.05'.

test

A character string indicating the method used to test the significance of the partial correlation coefficients.

  • If 'test = 'EED” (default), then the Edge Exclusion Deviance criterion is used (Whittaker, 2009). Although other methods exist, this is the most common and thus the only one implemented here.

adj

A character string indicating the way of adjusting p-values to assess the significance of the p-values

  • If 'adj = 'none” (default), there is no p-value adjustment correction

  • If 'adj = 'holm”, p-values are adjusted using the sequential Bonferroni correction (Holm, 1979)

  • If 'adj = 'bonferroni”, p-values are adjusted using the classic Bonferroni correction

  • If 'adj = 'BH”, p-values are adjusted using Benjamini et Hochberg (1995) correction controlling false discovery rate

output

A character string indicating the matrices included in the output list.

  • If 'output = 'all” (default), then D (distance matrix), C (covariance matrix), Rho (partial correlation matrix), M (graph incidence matrix) and S (strength matrix) are included

  • If 'output = 'dist_graph”, then the distance matrix D is returned only with the values corresponding to the graph edges

  • If 'output = 'str_graph”, then the strength values matrix S is returned only with the values corresponding to the graph edges

  • If 'output = 'inc”, then the binary adjacency matrix M is returned

  • If 'output = 'igraph”, then a graph of class igraph is returned

Details

The function allows to vary many parameters such as the genetic distance used, the formula used to compute the covariance, the statistical tolerance threshold, the p-values adjustment, among others.

Value

A list of objects of class matrix, an object of class matrix or a graph object of class igraph

Author(s)

P. Savary

References

\insertRef

dyer2004populationgraph4lg \insertRefbenjamini1995controllinggraph4lg \insertRefbowcock1994highgraph4lg \insertRefeveritt2011introductiongraph4lg \insertRefexcoffier1992analysisgraph4lg \insertReffortuna2009networksgraph4lg \insertRefholm1979simplegraph4lg \insertRefmagwene2001newgraph4lg \insertRefwermuth1977algorithmgraph4lg \insertRefwhittaker2009graphicalgraph4lg

Examples

data(data_ex_genind)
dist_graph_test <- gen_graph_indep(x = data_ex_genind, dist = "basic",
                             cov = "sq", pcor = "magwene",
                             alpha = 0.05, test = "EED",
                             adj = "none", output = "igraph")

graph4lg documentation built on Feb. 16, 2023, 5:43 p.m.