harrietr (version 0.2.2)

dist_long: Return evolutionary distance in long format

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

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

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.

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.

Examples

Run this code
# NOT RUN {
data(woodmouse)
dist_df <- dist_long(woodmouse)
# }

Run the code above in your browser using DataCamp Workspace