This new code works perfectly for me.
Thanks so much everyone for helping me to solve this issue in record time!
Kamila
> On Jan 6, 2017, at 6:39 AM, Emmanuel Paradis wrote:
>
> I paste below the new code of extract.clade for those who want to try it.
>
> Best,
>
>
I paste below the new code of extract.clade for those who want to try it.
Best,
Emmanuel
extract.clade <- function(phy, node, root.edge = 0, interactive = FALSE)
{
n <- length(phy$tip.label)
if (interactive) {
Hi,
Klaus is right: extract.clade() fails if the tree has been rooted with
resolve.root = TRUE before. I'm going to rewrite the function calling
drop.tip (which will be safer). In the meantime, Klaus's function should
work for Kamila.
Best,
Emmanuel
Le 06/01/2017 à 05:17, Klaus Schliep a
Hmm. Maybe something wonky with your tree? I simulated a 17-tip tree and tried
things out:
phy <- rtree(17);
rootID <- length(phy$tip.label) + 1;
counter <- 1;
for (i in rootID:max(phy$edge[,1])) {
clade <- extract.clade(phy, i);
# do something. just printing clade properties here
Dear Joseph,
thanks so much. This is exactly what I need!
I am running into some problems that I don’t understand though. In my case,
rootID is 18, and max(phy$edge[,1]) is 33. When I try to execute your loop,
this happens:
> extract.clade(phy, 18)
Phylogenetic tree with 17 tips and 16
Not sure if I understand the problem completely, but this should allow you to
examine all of the clades (and should work if polytomies are involved):
# for tree phy
rootID <- length(phy$tip.label) + 1;
for (i in rootID:max(phy$edge[,1])) {
clade <- extract.clade(phy, i);
# do something
}