TreeTools (version 0.1.3)

as.Splits: As splits

Description

Converts a phylogenetic tree to an array of bipartition splits.

Usage

as.Splits(x, tipLabels = NULL, ...)

# S3 method for phylo as.Splits(x, tipLabels = NULL, asSplits = TRUE, ...)

# S3 method for multiPhylo as.Splits(x, tipLabels = x[[1]]$tip.label, asSplits = TRUE, ...)

# S3 method for Splits as.Splits(x, tipLabels = NULL, ...)

# S3 method for list as.Splits(x, tipLabels = NULL, asSplits = TRUE, ...)

# S3 method for logical as.Splits(x, tipLabels = NULL, ...)

# S3 method for Splits as.logical(x, tipLabels = NULL, ...)

Arguments

x

Object to convert into splits: perhaps a tree of class phylo. If a logical matrix is provided, each row will be considered as a separate split.

tipLabels

Character vector specifying sequence in which to order tip labels. Label order must (currently) match to combine or compare separate Splits objects.

Presently unused.

asSplits

Logical specifying whether to return a Splits object, or an unannotated two-dimensional array (useful where performance is paramount).

Value

as.Splits returns an object of class Splits, or (if asSplits = FALSE) a two-dimensional array of 32-bit integers, which each bit specifying whether a tip is a member of the split. Splits are named according to the node that defines them.

See Also

Other Splits operations: NSplits, NTip, TipLabels, TipsInSplits, in.Splits, match.Splits

Examples

Run this code
# NOT RUN {
splits <- as.Splits(BalancedTree(letters[1:6]))
summary(splits)
TipsInSplits(splits)
summary(!splits)
TipsInSplits(!splits)

length(splits + !splits)
length(unique(splits + !splits))

summary(c(splits[[2:3]], !splits[[1:2]]))

moreSplits <- as.Splits(PectinateTree(letters[6:1]), tipLabel = splits)
print(moreSplits, details = TRUE)
match.Splits(splits, moreSplits)
in.Splits(moreSplits, splits)

# }

Run the code above in your browser using DataCamp Workspace