as.bitsplits: Split Frequencies and Conversion Among Split Classes

View source: R/as.bitsplits.R

as.bitsplitsR Documentation

Split Frequencies and Conversion Among Split Classes

Description

bitsplits returns the bipartitions (aka splits) for a single tree or a list of trees. If at least one tree is rooted, an error is returned.

countBipartitions returns the frequencies of the bipartitions from a reference tree (phy) observed in a list of trees (X), all unrooted.

as.bitsplits and as.prop.part are generic functions for converting between the "bitsplits" and "prop.part" classes.

Usage

bitsplits(x)
countBipartitions(phy, X)
as.bitsplits(x)
## S3 method for class 'prop.part'
as.bitsplits(x)
## S3 method for class 'bitsplits'
print(x, ...)
## S3 method for class 'bitsplits'
sort(x, decreasing = FALSE, ...)
as.prop.part(x, ...)
## S3 method for class 'bitsplits'
as.prop.part(x, include.trivial = FALSE, ...)

Arguments

x

an object of the appropriate class.

phy

an object of class "phylo".

X

an object of class "multiPhylo".

decreasing

a logical value to sort the bipartitions in increasing (the default) or decreasing order of their frequency.

include.trivial

a logical value specifying whether to include the trivial split with all tips in the returned object.

...

further arguments passed to or from other methods.

Details

These functions count bipartitions as defined by internal branches, so they work only with unrooted trees. The structure of the class "bitsplits" is described in a separate document on ape's web site.

This data structure has a memory requirement proportional to n^2, so it can be inefficient with large trees (> 1000 tips), particularly if they are very different (i.e., with few shared splits). In any case, an error occurs if the product of the number of tips by the number of nodes is greater than 2^{31}-1 (~2.1 billion). A warning message is given if the tree(s) has(ve) more than 46,341 tips. It may happen that the search for splits is interrupted if the data structure is full (with a warning message).

Value

bitsplits, as.bitsplits, and sort return an object of class "bitsplits".

countBipartitions returns a vector of integers.

as.prop.part returns an object of class "prop.part".

Author(s)

Emmanuel Paradis

See Also

prop.part, is.compatible

Examples

tr <- rtree(20)
pp <- prop.part(tr)
as.bitsplits(pp)
## works only with unrooted trees (ape 5.5):
countBipartitions(rtree(10, rooted = FALSE), rmtree(100, 10, rooted = FALSE))

ape documentation built on May 29, 2024, 10:50 a.m.