dist_long {harrietr} | R Documentation |
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 |
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
## Not run:
data(woodmouse)
dist_df <- dist_long(woodmouse)
## End(Not run)