Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dist.alignment

Pairwise Distances from Aligned Protein or DNA/RNA Sequences


Description

These functions compute a matrix of pairwise distances from aligned sequences using similarity (Fitch matrix, for protein sequences only) or identity matrix (for protein and DNA sequences). The resulting matrix contains the squared root of the pairwise distances. For example, if identity between 2 sequences is 80 the squared root of (1.0 - 0.8) i.e. 0.4472136. Note: seqinr::dist.alignment is the square root version of ape::dist.gene (and not ape::dist.dna).

Usage

dist.alignment(x, matrix = c("identity", "similarity"),gap)

Arguments

x

an object of class alignment, as returned by read.alignment for instance

matrix

the matrix distance to be used, partial matching allowed

gap

-optional- logical, with identity matrix, if set to TRUE, gaps will be counted in the identity measure

Value

The distance matrix, object of class dist, computed by using the specified distance measure.

Author(s)

D. Charif, J.R. Lobry

References

The reference for the similarity matrix is :
Fitch, W.M. (1966) An improved method of testing for evolutionary homology. J. Mol. Biol., 16:9-16.

citation("seqinr")

See Also

Examples

myseqs <- read.alignment(file = system.file("sequences/test.mase",
 package = "seqinr"), format = "mase")
 dist.alignment(myseqs, matrix = "identity" )
 as.matrix(dist.alignment(myseqs, matrix = "identity" ))

seqinr

Biological Sequences Retrieval and Analysis

v4.2-16
GPL (>= 2)
Authors
Delphine Charif [aut], Olivier Clerc [ctb], Carolin Frank [ctb], Jean R. Lobry [aut, cph], Anamaria Necşulea [ctb], Leonor Palmeira [ctb], Simon Penel [cre], Guy Perrière [ctb]
Initial release
2022-05-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.