getTree: Create a phylogenetic tree

View source: R/merge_order.R

getTreeR Documentation

Create a phylogenetic tree

Description

Builds a phylogenetic tree from the distance matrix using UPGMA algorithm.

Usage

getTree(distMat, method = "average", prefix = "master")

Arguments

distMat

(dist) a pairwise distance matrix.

Value

(phylo) a tree.

Author(s)

Shubham Gupta, shubh.gupta@mail.utoronto.ca

ORCID: 0000-0003-3500-8152

License: (c) Author (2020) + GPL-3 Date: 2020-05-31

See Also

upgma, getNodeIDs

Examples

m <- matrix(c(0,1,2,3, 1,0,1.5,1.5, 2,1.5,0,1, 3,1.5,1,0), byrow = TRUE,
            ncol = 4, dimnames = list(c("run1", "run2", "run3", "run4"),
                                      c("run1", "run2", "run3", "run4")))
distMat <- as.dist(m, diag = FALSE, upper = FALSE)
## Not run: 
tree <- getTree(distMat)

## End(Not run)
tree <- ape::read.tree(text = "(run1:9,(run2:7,run0:2)master2:5)master1;")
plot(tree, type = "phylogram", show.node.label = TRUE)
ape::axisPhylo(1)
plot(tree, type = "unrooted", show.node.label = TRUE)
ape::edgelabels(tree$edge.length)
tree <- ape::nj(distMat) # Neighbor-Joining tree
plot(tree, type = "unrooted", show.node.label = TRUE)
ape::edgelabels(tree$edge.length)

shubham1637/DIAlignR documentation built on March 29, 2023, 8:45 p.m.