Report the status of the specified quartet(s) in given trees or lists of splits.
QuartetState(tips, bips, splits = bips, asRaw = FALSE)
QuartetStates(splits, asRaw = FALSE)
# S3 method for Splits
QuartetStates(splits, asRaw = FALSE)
# S3 method for list
QuartetStates(splits, asRaw = FALSE)
# S3 method for multiPhylo
QuartetStates(splits, asRaw = FALSE)
A four-element array listing a quartet of leaves, either by their
number (if class numeric
) or their name (if class character
).
Deprecated; included for compatibility with v1.0.2 and below.
An object, such as a tree of class phylo
, that can be
induced to a Splits
object using as.Splits
.
Logical specifying whether return format should be raw
,
which uses less memory and can be processed faster than integer
type.
Default is currently set to FALSE
for backwards compatibility; suggest
overriding to TRUE
.
QuartetState()
returns 0
if the relationships of the four leaves
are not constrained by the provided splits, or the index of the closest
relative to tips[4]
, otherwise.
QuartetStates()
returns a raw vector listing the status of each
quartet of leaves (in the order listed by AllQuartets()
) in turn,
or if multiple trees are provided, a matrix in which each row corresponds
to such a vector.
One of the three possible four-leaf trees will be consistent with any set of splits generated from a fully resolved tree. If the leaves are numbered 1 to 4, this tree can be identified by naming the leaf most closely related to leaf 4. If a set of splits is generated from a tree that contains polytomies, it is possible that all three four-leaf trees are consistent with the set of splits.
Estabrook GF, McMorris FR, Meacham CA (1985). “Comparison of undirected phylogenetic trees based on subtrees of four evolutionary units.” Systematic Zoology, 34(2), 193--200. doi:10.2307/2413326 .
Compare quartet states between trees (slowly) using
CompareQuartets()
and CompareQuartetsMulti()
.
Other element-by-element comparisons:
CompareQuartetsMulti()
,
CompareQuartets()
,
CompareSplits()
,
PairSharedQuartetStatus()
,
SharedQuartetStatus()
,
SplitStatus()
trees <- list(TreeTools::BalancedTree(6),
TreeTools::PectinateTree(6))
trees[[3]] <- TreeTools::CollapseNode(trees[[2]], 9:10)
QuartetState(c(1, 3, 4, 6), trees[[2]])
#> [1] 3
QuartetState(1:4, trees[[1]]) == QuartetState(1:4, trees[[2]])
#> [1] TRUE
QuartetState(c(1, 3, 4, 6), trees[[3]])
#> [1] 0
QuartetStates(trees[[2]])
#> [1] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
QuartetStates(trees[[3]])
#> [1] 0 0 0 0 0 3 0 0 3 3 0 0 3 3 3
CompareQuartets(QuartetStates(trees[[2]]), QuartetStates(trees[[3]]))
#> N Q s d r1 r2 u
#> 30 15 6 0 9 0 0
CompareQuartetsMulti(trees[[1]], trees[2:3])
#> N Q s_all s_any d_all d_any r1_all r1_any r2_all r2_any u_all
#> 45 15 3 12 3 3 0 9 0 0 0
#> u_any x_only
#> 0 3