Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

TreeTools (version 1.6.0)

ConstrainedNJ: Constrained neighbour-joining tree

Description

Constructs an approximation to a neighbour-joining tree, modified in order to be consistent with a constraint. Zero-length branches are collapsed at random.

Usage

ConstrainedNJ(dataset, constraint, weight = 1L, ratio = TRUE, ambig = "mean")

Arguments

dataset

A phylogenetic data matrix of class phyDat, whose names correspond to the labels of any accompanying tree.

constraint

An object of class phyDat; returned trees will be perfectly compatible with each character in constraint. See vignette for further examples.

weight

Numeric specifying degree to up-weight characters in constraint.

ratio

Settings of ambig and ratio to be used when computing Hamming() distances between sequences.

ambig

Settings of ambig and ratio to be used when computing Hamming() distances between sequences.

Value

ConstrainedNJ() returns a tree of class phylo.

See Also

Other tree generation functions: GenerateTree, NJTree(), SingleTaxonTree(), TreeNumber

Examples

Run this code
# NOT RUN {
dataset <- MatrixToPhyDat(matrix(
  c(0, 1, 1, 1, 0, 1,
    0, 1, 1, 0, 0, 1), ncol = 2,
  dimnames = list(letters[1:6], NULL)))
constraint <- MatrixToPhyDat(
  c(a = 0, b = 0, c = 0, d = 0, e = 1, f = 1))
plot(ConstrainedNJ(dataset, constraint))
# }

Run the code above in your browser using DataLab