Learn R Programming

haplotypes (version 1.1.3.1)

distance-methods: Calculates absolute pairwise character difference matrix using a Dna object

Description

Computes and returns an absolute pairwise character difference matrix from DNA sequences.

Usage

# S4 method for Dna
distance(x,subset=NULL,indels="sic")

Value

returns an object of class dist.

Arguments

x

an object of class Dna.

subset

a vector of integers in the range [1,nrow(x)], specifying which sequence(s) are used in the distance calculation. Only distance between selected sequence(s) and the rest of the sequences are calculated. If it is NULL, all comparisons are done.

indels

the indel coding method to be used. This must be one of "sic", "5th" or "missing". Any unambiguous substring can be given. See also ‘Details’

Methods

signature(x = "Dna")

Computes and returns an absolute pairwise character difference matrix from Dna objects.

Author

Caner Aktas, caktas.aca@gmail.com

Details

Available indel coding methods:

sic:

Treating gaps as a missing character and coding them separately following the simple indel coding method.

5th:

Treating gaps as a fifth state character.

missing:

Treating gaps as a missing character.

References

Giribet, G. and Wheeler, W.C. (1999) On gaps. Molecular Phylogenetics and Evolution 13, 132-143.

Simmons, M., Ochoterena, H. (2000) Gaps as characters in sequence-based phylogenetic analyses. Systematic Biology 49, 369-381.

See Also

indelcoder and subs

Examples

Run this code
data("dna.obj")
x<-dna.obj[4:7,13:22,as.matrix=FALSE]

## Simple indel coding.
distance(x,indels="s")

## Gaps as 5th state characters.
distance(x,indels="5")

## Gaps as missing characters.
distance(x,indels="m")

if (FALSE) {
## Using 'subset'.
x<-dna.obj[4:10,13:22,as.matrix=FALSE]
distance(x, NULL)
distance(x, subset=c(1))
distance(x, subset=c(2,4))
}

Run the code above in your browser using DataLab