as.star.tree {phyclust} | R Documentation |
Coerce a Rooted Tree to a Star Tree in Class phylo
Description
Coerce a rooted tree generating by ms
to a star tree and
maintain a bifurcation structure.
Usage
as.star.tree(rooted.tree, keep.bifurcation = TRUE)
Arguments
rooted.tree |
a rooted tree in |
keep.bifurcation |
keep a bifurcation structure. |
Details
A tree with a star shape means that all internal branches are 0 and all leaf branches are equal.
The rooted.tree
should be in a phylo
class of ape,
and may be created by ms
.
Basically, it is a list with an attribute that the class is phylo, and the other elements are:
'edge'edge ids.
'Nnode'number of internal nodes.
'tip.lab'number of tips (leaves).
'edge.length'length of edges.
If keep.bifurcation
is TRUE, then internal branches are set to be 0
and leaves branches are set to the original tree height. Otherwise,
the internal branches will be dropped from rooted.tree.
Value
Return a rooted tree in Class phylo
with a star shape.
Author(s)
Wei-Chen Chen wccsnow@gmail.com
References
Phylogenetic Clustering Website: https://snoweye.github.io/phyclust/
See Also
ms
,
read.tree
,
as.phylo
,
plot.phylo
.
Examples
## Not run:
library(phyclust, quiet = TRUE)
set.seed(1234)
ret.ms <- ms(5, 1, opts = paste("-T", sep = " "))
tree.ms <- read.tree(text = ret.ms[3])
str(tree.ms)
(tree.star <- as.star.tree(tree.ms))
# Plot results
par(mfrow = c(1, 2))
plot(tree.ms, type = "u", main = "original tree")
plot(tree.star, type = "u", main = "as star tree")
## End(Not run)