Re: [R-sig-phylo] Extract all possible clades from a tree

2017-01-05 Thread Kamila Naxerova
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

[R-sig-phylo] Extract all possible clades from a tree

2017-01-05 Thread Kamila Naxerova
Hi all, I would like to break a phylogenetic tree into all possible clades and then examine each one of them for certain characteristics. I am writing some code to do this from scratch, but it’s getting pretty cumbersome quickly. I was wondering whether there are some functions out there

Re: [R-sig-phylo] Extract all possible clades from a tree

2017-01-05 Thread Joseph W. Brown
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 }

Re: [R-sig-phylo] Extract all possible clades from a tree

2017-01-05 Thread Joseph W. Brown
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