calc_genetic_distances | R Documentation |
Calculates the genetic distances between either individuals or the levels of any sample specific facets, broken apart by any requested snp level facets. For details on methods, see details.
calc_genetic_distances(
x,
facets = NULL,
method = "Edwards",
interpolate = "bernoulli"
)
x |
snpRdata object. |
facets |
character or NULL, default NULL. Facets for which to calculate
genetic distances, as described in |
method |
character, default "Edwards". Name of the method to use. Options:
See details. |
interpolate |
character, default "bernoulli". Missing data interpolation
method, solely for individual/individual distances. Options detailed in
documentation for |
If a sample facet is requested, distances are calculated via code adapted
from code derived from adegenet
. Please cite them
alongside the tree-building and distance methods. Available methods:
Edwards: Angular distance as described in Edwards 1971.
Nei: Nei's (1978) genetic distance measure.
Otherwise, genetic distances are calculated via the dist
function using genotypes formatted numerically (the "sn" option in
format_snps
). In all cases, missing genotypes are first
interpolated according to the method provided to the 'interpolate' argument.
An overwrite-safe snpRdata object with genetic distance information (a named, nested list containing distance measures named according to facets and facet levels) added.
William Hemstrom
Edwards, A. W. F. (1971). Distances between populations on the basis of gene frequencies. Biometrics, 873-881.
Nei, M. (1978). Estimation of average heterozygosity and genetic distance from a small number of individuals. Genetics, 23, 341-369.
Jombart, T. (2008). adegenet: a R package for the multivariate analysis of genetic markers Bioinformatics 24: 1403-1405.
# by pop:
y <- calc_genetic_distances(stickSNPs, facets = "pop", method = "Edwards")
get.snpR.stats(y, "pop", "genetic_distance")
# by chr and pop jointly
y <- calc_genetic_distances(stickSNPs, facets = "pop.chr",
method = "Edwards")
get.snpR.stats(y, "pop.chr", "genetic_distance")
## Not run:
# by pop and fam separately
y <- calc_genetic_distances(stickSNPs, facets = c("pop", "fam"),
method = "Edwards")
get.snpR.stats(y, c("pop", "chr"), "genetic_distance")
# individuals across all snps + plot
y <- calc_genetic_distances(stickSNPs)
dat <- get.snpR.stats(y, stats = "genetic_distance")$.base$.base$Edwards
heatmap(as.matrix(dat))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.