Modify a tree such that it matches a specified constraint.
This is at present a somewhat crude implementation that attempts to retain
much of the structure of tree
whilst guaranteeing compatibility with
each entry in constraint
.
ImposeConstraint(tree, constraint)
AddUnconstrained(constraint, toAdd, asPhyDat = TRUE)
A tree of class phylo
.
Either an object of class phyDat
, in which case returned
trees will be perfectly compatible with each character in constraint
;
or a tree of class phylo
, in which each node in constraint
will occur in
the returned tree.
See vignette
for further examples.
Character vector specifying taxa to add to constraint.
Logical: if TRUE
, return a phyDat
object; if FALSE
,
return a matrix.
ImposeConstraint()
returns a tree of class phylo
, consistent
with constraint
.
AddUnconstrained()
: Expand a constraint to include unconstrained
taxa.
Other tree manipulation:
AddTip()
,
CollapseNode()
,
ConsensusWithout()
,
DropTip()
,
EnforceOutgroup()
,
KeptPaths()
,
KeptVerts()
,
LeafLabelInterchange()
,
MakeTreeBinary()
,
RenumberTips()
,
RenumberTree()
,
Renumber()
,
RootTree()
,
SortTree()
,
Subtree()
,
TipTimedTree()
,
TrivialTree
tips <- letters[1:9]
tree <- as.phylo(1, 9, tips)
plot(tree)
constraint <- StringToPhyDat("0000?1111 000111111 0000??110", tips, FALSE)
plot(ImposeConstraint(tree, constraint))