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

View source: R/utils.dist.ind.snp.r

utils.dist.ind.snpR Documentation

Calculates a distance matrix for individuals defined in a genlight object using SNP data (DArTseq)

Description

WARNING: UTILITY SCRIPTS ARE FOR INTERNAL USE ONLY AND SHOULD NOT BE USED BY END USERS AS THEIR USE OUT OF CONTEXT COULD LEAD TO UNPREDICTABLE OUTCOMES.

Usage

utils.dist.ind.snp(
  x,
  method = "Euclidean",
  scale = FALSE,
  type = "dist",
  verbose = NULL
)

Arguments

x

Name of the genlight containing the genotypes [required].

method

Specify distance measure [default Euclidean].

scale

If TRUE and method='Euclidean', the summed squared differences are divided by the number of loci compared, so the distance falls in the range [0,2] for SNP genotypes scored 0, 1 or 2 [default FALSE].

type

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"].

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2].

Details

This script calculates various distances between individuals based on SNP genotypes.

The distance measure can be one of:

  • Euclidean – Euclidean Distance applied to Cartesian coordinates defined by the loci, scored as 0, 1 or 2.

  • Simple – based on shared alleles per locus: 0 where no alleles are shared, 1 where one allele is shared, 2 where both alleles are shared; distance = 1 - mean(shared)/2. With biallelic SNPs this is arithmetically identical to the Czekanowski distance.

  • Absolute – 0 where no alleles are shared (opposite homozygotes), 1 where one or both alleles are shared; distance is the proportion of loci with no shared alleles.

  • Czekanowski (or Manhattan) calculates the city block metric distance by summing the scores on each axis (locus).

All measures are invariant to which allele is scored as the reference allele.

Value

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

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.dist.pop(), gl.fst.pop(), gl.propShared()


dartR.base documentation built on Nov. 18, 2026, 9:06 a.m.