pegas (version 1.3)

dist.asd: Allelic Sharing Distance

Description

This function computes the allelic sharing distance (ASD) for diploid genotypes.

Usage

dist.asd(x, scaled = TRUE, pairwise.deletion = FALSE)

Value

an object of class "dist".

Arguments

x

an object of class "loci".

scaled

a logical value specifying whether the distances should be scaled by the number of loci.

pairwise.deletion

a logical value: whether to check for missing values for each pairwise comparison (see details).

Author

Emmanuel Paradis

Details

The ASD between two diploid genotypes is (Gao and Martin, 2009):

$$\frac{1}{L}\sum_{j=1}^L d_j$$

where \(L\) is the number loci, \(d_j\) is the value for the \(j\)th locus: 0 if both genotypes are identical, 1 if they have one allele in common, or 2 if they have no allele in common.

dist.asd works for all diploid genotypes (phased or unphased, with two alleles or more). Note that the required conditions are not checked by the present function: see the functions below.

The pairwise deletion is done with respect to missing values coded as NA, not on the `null alleles' (`0' or `.'). You may need to use the function nullAlleles2NA first if your data has genotypes with null alleles that you want to treat as missing values.

References

Gao, X. and Martin, E. R. (2009) Using allele sharing distance for detecting human population stratification. Human Hederity, 68, 182--191.

See Also

is.snp, is.phased, getPloidy, nullAlleles2NA

Examples

Run this code
data(jaguar)
## ASD for micro-satellites:
d <- dist.asd(jaguar)
co <- rainbow(nlevels(jaguar$pop))
plot(nj(d), "u", tip.color = co[jaguar$pop], font = 2, lab4 = "a")
legend("topleft", legend = levels(jaguar$pop), text.col = co, text.font = 2)

Run the code above in your browser using DataLab