Learn R Programming

BAT (version 2.11.0)

tree.build: Build functional tree.

Description

Builds a functional tree from distance data.

Usage

tree.build(distance, func = "nj", fs = 0, root = NULL)

Value

A phylo object representing a functional tree.

Arguments

distance

A dist object.

func

One of "upgma", "mst", "nj", "bionj" or "best".

fs

Only used for func = "nj" OR "bionj". Argument s of the agglomerative criterion: it is coerced as an integer and must at least equal to one.

root

A numeric or character specifying the functional outgroup to root the tree.

Details

The tree will be built using one of four algorithms: If func = "upgma" uses average linkage clustering (UPGMA, Cardoso et al. 2014). If func = "mst" uses minimum spanning trees, equivalent to single linkage clustering (Gower & Ross 1969). If func = "nj" uses the original neighbor-joining algorithm of Saitou & Nei (1987) (default). If func = "bionj" uses the modified neighbor-joining algorithm of Gascuel (1997). Any of the neighbor-joining options is usually preferred as they keep distances between species better than UPGMA or MST (Cardoso et al. 2024). If func = "best", chooses the best of the options above based on maximum tree.quality values. If NJ trees are built, the root will be set at the node closest to the midpoint between the two most dissimilar species in the tree or, if root not NULL, at the node provided in parameter root (Podani et al. 2000).

References

Cardoso et al. (2014) Partitioning taxon, phylogenetic and functional beta diversity into replacement and richness difference components. Journal of Biogeography, 41: 749-761.

Cardoso et al. (2024) Calculating functional diversity metrics using neighbor-joining trees. Ecography, 2024: e07156.

Criscuolo & Gascuel (2008) Fast NJ-like algorithms to deal with incomplete distance matrices. BMC Bioinformatics, 9: 166.

Gascuel (1997) BIONJ: an improved version of the NJ algorithm based on a simple model of sequence data. Molecular Biology and Evolution, 14: 685–695.

Podani et al. (2000) Additive trees in the analysis of community data. Community Ecology, 1, 33–41.

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

Examples

Run this code
trait = data.frame(body = c(NA,2,3,4,4), beak = c(1,1,1,1,2))
distance = gower(trait)
plot(tree.build(distance), "u")
plot(tree.build(distance, func = "bionj", fs = 1), "u")
plot(tree.build(distance, func = "best", root = 4))

Run the code above in your browser using DataLab