View source: R/gl.propShared.r
| gl.propShared | R Documentation |
This function calculates the proportion of shared alleles between each pair of individuals and returns it as a similarity matrix.
gl.propShared(x, verbose = NULL)
x |
Name of the genlight object containing the SNP data [required]. |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, brief progress messages; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity]. |
At a locus, two diploid individuals with allele dosages g1 and g2 (0, 1 or 2) share 2 - |g1 - g2| of their two alleles. The similarity is the mean proportion of shared alleles over the loci called in both individuals, 1 - mean(|g1 - g2|) / 2, so missing data are handled pair by pair.
The similarity is the exact complement of
gl.dist.ind with method = "manhattan",
which this function uses for the calculation. Use
as.dist(1 - gl.propShared(x)) to obtain a distance.
Only SNP data are accepted: for SilicoDArT (presence/absence) data the division by two does not apply.
A symmetric nInd(x) x nInd(x) similarity matrix with values between 0 (no alleles shared at any locus) and 1 (identical at all loci called in both individuals), and individual names as row and column names. The diagonal is set to 1. Pairs of individuals with no locus called in both get NA.
Author(s): Bernd Gruber. Custodian: Bernd Gruber – Post to https://groups.google.com/d/forum/dartr
Other distance:
gl.dist.ind(),
gl.dist.pop(),
gl.fst.pop(),
utils.dist.ind.snp()
res <- gl.propShared(bandicoot.gl)
res[1:5, 1:7] # show only a small part of the matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.