dist_long: Return evolutionary distance in long format

Description Usage Arguments Details Value Examples

View source: R/melt_distance.R

Description

This will take an alignment, will calculate the evolutionary distance between all pairs of sequence, and will transform the distance matrix to long format. It will remove upper triangle, and diagonal elements, so you end with only (n)*(n-1)/2 rows, where n are the total number of rows in the distance matrix.

Usage

1
dist_long(aln, order = NULL, dist = "N", tree = NULL)

Arguments

aln

An object of class matrix, it must be square

order

A character vector of size n with the order of the columns and rows (default: NULL)

dist

A string naming the model to calculate distances (accepted values are those in ape::dist.dna)

tree

An object of class phylo

Details

If a tree is optionally given, a fourth column is returned with the cophenetic distance across all elements of tree. It assumes the tree was generated from the alignment.

Value

A data.frame with three or four columns: (1) iso1; (2) iso2: (3) dist. If a tree is given then a fourth column (evol_dist) containig the distances from the tree is also supplied.

Examples

1
2
3
4
5
## Not run: 
data(woodmouse)
dist_df <- dist_long(woodmouse)

## End(Not run)

harrietr documentation built on Dec. 1, 2017, 9:02 a.m.