ape (version 0.1)

dist.gene: Pairwise Distances from Genetic Data

Description

This function computes a matrix of distances between pairs of individuals from a matrix or a data frame of genetic data.

Usage

dist.gene(x, method = "pairwise", variance = FALSE)
dist.gene.pairwise(x, variance = FALSE)
dist.gene.percentage(x, variance = FALSE)

Arguments

x
a matrix or a data frame.
method
a character string specifying the method used to compute the distances; only two choices are available: "pairwise", and "percentage".
variance
a logical, indicates whether the variance of the distances should be returned (default to FALSE).

Value

  • either a numeric matrix with possibly the names of the individuals (as given by the rownames of the argument `x') as colnames and rownames (if variance = FALSE, the default), or a list of two matrices names distances and variance, respectively (if variance = TRUE.

Details

This function is meant to be very general and accepts different kinds of data (alleles, haplotypes, DNA sequences, and so on). The rows of the data matrix represent the individuals, and the columns the loci. In the case of the pairwise method, the distance d between two individuals is the number of loci for which they differ, and the associated variance is d(L - d)/L, where L is the number of loci. In the case of the percentage method, this distance is divided by L, and the associated variance is d(1 - d)/L. Since "pairwise" is the default for method in dist.gene, dist.gene(x) and dist.gene.pairwise(x) return the same result. For more elaborate distances with DNA sequences, see the function dist.dna.

See Also

dist.dna, dist.phylo