Learn R Programming

TreeTools (version 2.4.1)

Consensus: Construct consensus trees

Description

Consensus() calculates the majority-rule or strict consensus of a set of trees, using the cluster-table approach of Day1985TreeTools.

Usage

Consensus(trees, p = 1, check.labels = TRUE, hash = TRUE)

Value

Consensus() returns an object of class phylo, rooted as in the first entry of trees.

Arguments

trees

List of trees, optionally of class multiPhylo.

p

A number from 0.5 to 1 giving the proportion of trees that must contain a split for it to be reported in the consensus: from p = 0.5 (more than half the trees; the majority-rule consensus) to p = 1 (every tree; the strict consensus, the default).

check.labels

Logical specifying whether to check that all trees have identical labels. Defaults to TRUE, which is slower.

hash

Logical; if TRUE (default), majority/threshold consensus counts splits using 128-bit hashing, which is exact with overwhelming probability (a collision conflating two distinct splits is vanishingly unlikely). Set hash = FALSE for a slower but guaranteed-exact count. Ignored when p = 1, which is always exact.

Details

The strict consensus (p = 1) compares the clusters of the first tree against every other tree in linear time. The majority-rule and threshold consensus (0.5 <= p < 1) instead count the frequency of every split across all trees in a single pass and retain those occurring in a proportion p or more of trees (i.e. in at least ceiling(p * length(trees)) trees); this runs in time linear in the number of trees, after Jansson2016TreeTools. The majority threshold p = 0.5 is strict: a split is retained only if it occurs in more than half the trees, so that two conflicting splits can never both be reported. By default the count uses a 128-bit hash, whose results are exact with overwhelming probability; set hash = FALSE for a slower but guaranteed-exact count.

References

See Also

  • ConsTree implements other consensus tree algorithms.

  • Rogue increases the resolution of consensus trees by dropping wildcard taxa.

  • TreeDist::ConsensusInfo() calculates the information content of a consensus tree.

Other consensus tree functions: ConsensusWithout(), RoguePlot()

Other tree characterization functions: CladisticInfo(), J1Index(), Stemwardness, TotalCopheneticIndex()

Examples

Run this code
Consensus(as.phylo(0:2, 8))

Run the code above in your browser using DataLab