gl.dist.pop {dartR.base} | R Documentation |
Calculates a distance matrix for populations with SNP genotypes in a genlight object
Description
This script calculates various distances between populations based on allele frequencies (SNP genotypes) or frequency of presences in PA (SilicoDArT) data
Usage
gl.dist.pop(
x,
as.pop = NULL,
method = "euclidean",
scale = FALSE,
type = "dist",
plot.display = TRUE,
plot.theme = theme_dartR(),
plot.colors = NULL,
plot.file = NULL,
plot.dir = NULL,
verbose = NULL
)
Arguments
x |
Name of the genlight containing [required]. |
as.pop |
Temporarily assign another locus metric as the population for the purposes of deletions [default NULL]. |
method |
Specify distance measure [default euclidean]. |
scale |
If TRUE and method='Euclidean', the distance will be scaled to fall in the range [0,1] [default FALSE]. |
type |
Specify the type of output, dist or matrix [default dist] |
plot.display |
If TRUE, resultant plots are displayed in the plot window [default TRUE]. |
plot.theme |
Theme for the plot. See Details for options [default theme_dartR()]. |
plot.colors |
List of two color names for the borders and fill of the plots [default c("#2171B5","#6BAED6")]. |
plot.file |
Name for the RDS binary file to save (base name only, exclude extension) [default NULL] |
plot.dir |
Directory to save the plot RDS files [default as specified by the global working directory or tempdir()] |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log ; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity]. |
Details
The distance measure can be one of 'euclidean', 'fixed-diff', 'reynolds', 'nei' and 'chord'. Refer to the documentation of functions in https://doi.org/10.1101/2023.03.22.533737 for algorithms and definitions.
Value
An object of class 'dist' giving distances between populations
Author(s)
author(s): Arthur Georges. Custodian: Arthur Georges – Post to https://groups.google.com/d/forum/dartr
See Also
Other distance:
gl.dist.ind()
,
gl.fdsim()
,
utils.dist.ind.snp()
Examples
# SNP genotypes
D <- gl.dist.pop(possums.gl, method='euclidean')
D <- gl.dist.pop(possums.gl, method='euclidean',scale=TRUE)
D <- gl.dist.pop(possums.gl, method='nei')
D <- gl.dist.pop(possums.gl, method='reynolds')
D <- gl.dist.pop(possums.gl, method='chord')
D <- gl.dist.pop(possums.gl, method='fixed-diff')
#Presence-Absence data [only 10 individuals due to speed]
D <- gl.dist.pop(testset.gs[1:10,], method='euclidean')