exportTree {colordistance}R Documentation

Export a distance matrix as a tree object

Description

Converts a symmetrical distance matrix to a tree and saves it in newick format. Uses hclust to form clusters.

Usage

exportTree(getColorDistanceMatrixObject, file, return.tree = FALSE)

Arguments

getColorDistanceMatrixObject

A distance matrix, especially as returned by getColorDistanceMatrix, but any numeric symmetrical matrix will work.

file

Character vector of desired filename for saving tree. Should end in ".newick".

return.tree

Logical. Should the tree object be returned to the working environment in addition to being saved as a file?

Value

Newick tree saved in specified location and as.phylo tree object if return.tree=TRUE.

Examples

## Not run: 
clusterList <- colordistance::getHistList(dir(system.file("extdata",
"Heliconius/", package="colordistance"), full.names=TRUE), lower=rep(0.8, 3),
upper=rep(1, 3))
CDM <- colordistance::getColorDistanceMatrix(clusterList, method="emd",
plotting=FALSE)

# Tree is both saved in current working directory and stored in
# heliconius_tree variable

heliconius_tree <- colordistance::exportTree(CDM,
"./HeliconiusColorTree.newick", return.tree=TRUE)
## End(Not run)

[Package colordistance version 1.1.2 Index]