ape (version 1.7)

nj: Neighbor-Joining Tree Estimation

Description

This function performs the neighbor-joining tree estimation of Saitou and Nei (1987).

Usage

nj(X)

Arguments

X
a distance matrix; may be an object of class ``dist''.

Value

  • an object of class "phylo".

Details

The argument may be a square matrix (e.g. as estimated by dist.dna), a dist object (estimated by dist).

References

Saitou, N. and Nei, M. (1987) The neighbor-joining method: a new method for reconstructing phylogenetic trees. Molecular Biology and Evolution, 4, 406--425.

See Also

write.tree, read.tree, dist.dna

Examples

Run this code
### From Saitou and Nei (1987, Table 1):
x <- c(7, 8, 11, 13, 16, 13, 17, 5, 8, 10, 13,
       10, 14, 5, 7, 10, 7, 11, 8, 11, 8, 12,
       5, 6, 10, 9, 13, 8)
M <- matrix(NA, 8, 8)
M[row(M) > col(M)] <- x
M[row(M) < col(M)] <- x
diag(M) <- 0
rownames(M) <- colnames(M) <- 1:8
tr <- nj(M)
plot(tr, "u")
### a less theoretical example
data(woodmouse)
trw <- nj(dist.dna(woodmouse))
plot(trw)

Run the code above in your browser using DataCamp Workspace