exportTree: Export a distance matrix as a tree object

Description Usage Arguments Value Examples

View source: R/07_miscellaneous.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)

colordistance documentation built on March 21, 2021, 1:06 a.m.