parsimonyCost {PhylogeneticEM} | R Documentation |
Minimal number of shifts needed to get a clustering.
Description
parsimonyCost
is an implementation of the Sankoff algorithm,
when the cost of transition between two state is always one. It is used
in functions parsimonyNumber
and enumerate_parsimony
to count or enumerate all the parsimonious solutions given one clustering of the
tips.
Usage
parsimonyCost(phylo, clusters = rep(1, length(phylo$tip.label)))
Arguments
phylo |
a phylogenetic tree, class |
clusters |
the vector of the clusters of the tips. (Default to all the tips in a single group). |
Value
An S3 class "parsimonyCost
" containing a
(ntaxa + Nnode) x (nclus) matrix of the total number of shifts needed to
get the clustering, if starting from a node in state k. The cost can be
extract from any subtree with function extract.parsimonyCost
.
See Also
extract.parsimonyCost
, parsimonyNumber
,
enumerate_parsimony
, partitionsNumber
,
equivalent_shifts
Examples
tree <- read.tree(text="(((1,1),2),2);")
plot(tree); nodelabels()
clusters <- c(1, 1, 2, 2)
costs <- parsimonyCost(tree, clusters)
costs
## Extract the parsimony cost at the root
extract(costs)
## Extract the cost for the sub-tree below node 7
extract(costs, 7)
[Package PhylogeneticEM version 1.7.0 Index]