Alistair- Even if all the polytomies are small, if there are many of them, the number of potential trees may be very large. I don't know the exact numbers.
The following, for a phylo object named "tree" should give you a vector which identifies those nodes that are polytomies (have more than 2 descendant branches). nodes<-1:max(tree$edge) polys<-nodes[sapply(nodes,function(x) sum(x==tree$edge[,1]))>2] Enjoy! -Dave On Sun, Mar 13, 2011 at 7:16 AM, Alastair Potts <pott...@gmail.com> wrote: > Hi David, > Thanks for the response. I did not consider the computational difficulties > primarily because my polytomies are small - usually only involving 3 tips. I > think your extract.clade() --> allTrees() --> bind.tree() suggestion would > work well. This is actually for a simulation study where simulated data are > analysed using parsimony in PAUP, thus I have many trees that might have > this small polytomy - is there any way to identify nodes that contain > polytomies? After that, I think I should be able to implement the above > suggestion fairly easily. > > General comments to all: > Essentially my problem lies with the consensus function, and although > David's suggestion would solve the problem, it seems like a very long-winded > way of doing it. > > Is it not possible to get the consensus() function to accept a tree with a > polytomy, along with the other trees, and add this to the overall consensus > tree (which is expected to contain polytomies if there are topological > differences)? > > Thanks for your time, > Cheers, > Alastair > > David Bapst wrote: >> >> Alistair- >> >> How many multifurcations are there, with how many branches each? If >> the number of potentially resulting trees is too high, it may not be >> possible to store all the possible trees in memory. >> >> If your tree is small, you might try allTrees(), which is the only >> ready to use function I know of which gives all possible trees, but >> only for tree with up to 10 tips. >> >> If you have a tree with more than 10 taxa but one or two small >> polytomies, you could remove the polytomies out with extract.clade(), >> find all their resolutions with allTrees(), stick their descendant >> tips back onto the polytomy with bind.tree() and then stick them back >> into the original tree with bind.tree(). It sounds crazy, but I've >> written code that sort of does this for my tree, so that I can weigh >> polytomy resolution by the fit of the solutions to a model of >> preservation potential in the fossil record. It would still require >> some programming, though, for you to get what you want. >> >> -Dave >> >> On Sat, Mar 12, 2011 at 7:32 AM, Alastair Potts <pott...@gmail.com> wrote: >> >>> >>> Good day all, >>> I was wondering if there was any way to get multi2di to return trees with >>> all possible combinations when breaking up a polytomy to a dichotomous >>> branching tree? >>> >>> The reason why I ask is that PAUP is returning non-binary trees from some >>> analyses (e.g. a set of most parsimonious trees). The consensus function >>> requires binary trees, so I use the multi2di function to force these >>> trees >>> to binary trees. However, as not all possible trees are returned, just >>> one >>> possibility, I am getting more resolution in my topology that is actually >>> present in the PAUP strict consensus tree when I use the consensus >>> function. >>> >>> I've looked at the multi2di function thinking I may be able to get it to >>> return all trees - but it is a problem beyond my meagre programming >>> skills. >>> >>> Any help would be much appreciated! >>> >>> Cheers, >>> Alastair >>> -- >>> ----------------------------------------------------------------- >>> Alastair Potts >>> PhD candidate >>> Botany Department >>> University of Cape Town >>> alastair.po...@uct.ac.za or pott...@gmail.com >>> University Private Bag, Rondebosch 7700, South Africa >>> or >>> PO Box 115, Loxton 6985, South Africa >>> Cell: 082 491-7275 >>> >>> _______________________________________________ >>> R-sig-phylo mailing list >>> R-sig-phylo@r-project.org >>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo >>> >>> >> >> >> >> > > _______________________________________________ > R-sig-phylo mailing list > R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > -- David Bapst Dept of Geophysical Sciences University of Chicago 5734 S. Ellis Chicago, IL 60637 http://home.uchicago.edu/~dwbapst/ _______________________________________________ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo