gl.dist.ind: Calculates a distance matrix for individuals defined in a...

View source: R/gl.dist.ind.r

gl.dist.indR Documentation

Calculates a distance matrix for individuals defined in a genlight object

Description

This script calculates various distances between individuals based on allele frequencies or presence-absence data

Usage

gl.dist.ind(
  x,
  method = NULL,
  scale = FALSE,
  swap = FALSE,
  output = "dist",
  plot.out = TRUE,
  plot_theme = theme_dartR(),
  plot_colors = two_colors,
  save2tmp = FALSE,
  verbose = NULL
)

Arguments

x

Name of the genlight containing the SNP genotypes or presence-absence data [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].

output

Specify the format and class of the object to be returned, 'dist' for a object of class dist, 'matrix' for an object of class matrix [default "dist"].

plot.out

If TRUE, display a histogram and a boxplot of the genetic distances [TRUE].

plot_theme

User specified theme [default theme_dartR].

plot_colors

Vector with two color names for the borders and fill [default two_colors].

save2tmp

If TRUE, saves any ggplots to the session temporary directory [default FALSE].

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:

  • Euclidean Distance [method = "Euclidean"]

  • Scaled Euclidean Distance [method='Euclidean", scale=TRUE]

  • Simple Mismatch Distance [method="Simple"]

  • Absolute Mismatch Distance [method="Absolute"]

  • Czekanowski (Manhattan) Distance [method="Manhattan"]

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

  • Euclidean Distance [method = "Euclidean"]

  • Scaled Euclidean Distance [method='Euclidean", scale=TRUE]

  • Simple Matching Distance [method="Simple"]

  • Jaccard Distance [method="Jaccard"]

  • Bray-Curtis Distance [method="Bray-Curtis"]

Refer to the dartR Technical Note on Distances in Genetics.

Value

An object of class 'matrix' or dist' giving distances between individuals

Author(s)

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

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)

green-striped-gecko/dartR documentation built on Sept. 7, 2024, 4:15 a.m.