gl.dist.ind {dartR.base}R Documentation

Calculates a distance matrix for individuals defined in a genlight object

Description

Calculates various distances between individuals based on allele frequencies or presence-absence data

Usage

gl.dist.ind(
  x,
  method = NULL,
  scale = FALSE,
  swap = 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 [required].

method

Specify distance measure [SNP: Euclidean; P/A: Simple].

scale

If TRUE, the distances are scaled to fall in the range [0,1] [default TRUE]

swap

If TRUE and working with presence-absence data, then presence (no disrupting mutation) is scored as 0 and absence (presence of a disrupting mutation) is scored as 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 for SNP genotypes can be one of:

The distance measure for Sequence Tag Presence/Absence data (binary) can be one of:

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 'matrix' or dist' giving distances between individuals

Author(s)

Author(s): Custodian: Arthur Georges – Post to #' https://groups.google.com/d/forum/dartr

See Also

Other distance: gl.dist.pop(), gl.fdsim(), utils.dist.ind.snp()

Examples


D <- gl.dist.ind(testset.gl[1:20,], method='manhattan')
D <- gl.dist.ind(testset.gs[1:20,], method='Jaccard',swap=TRUE)

D <- gl.dist.ind(testset.gl[1:20,], method='euclidean',scale=TRUE)


[Package dartR.base version 0.65 Index]