Hi Yan, I'm useless in R, so I won't comment on that aspect of your email...
I just posted a fix on a branch of dendropy. The algorithm that DendroPy uses is basically stepwise addition of leaves. The code we had pruned the polytomy down to having 2 children, and then adding leaves back randomly in the subtree that subtends the node that had been the polytomy. We (dendropy folks) had just failed to include the "root" of the original polytomy as an attachment point for a new node. So, that method was conceptually correct, but implemented in a buggy way. The star-decomposition-like method (pinching off pairs of children) doesn't work for equiprobable topologies. I think that (if you added branch lengths during simulation) that method will give you an equiprobable distribution over labelled histories (where the depth of the nodes you are pinching off matters) rather than topologies. That pinching off pairs is essentially what we do when simulating coalescent histories. I hope that helps, but I'm definitely being sloppy in my description. So don't hesitate to let me know if this explanation doesn't make sens. all the best, Mark Mark Holder mthol...@gmail.com mthol...@ku.edu http://phylo.bio.ku.edu/mark-holder ============================================== Department of Ecology and Evolutionary Biology University of Kansas 6031 Haworth Hall 1200 Sunnyside Avenue Lawrence, Kansas 66045 lab phone: 785.864.5789 fax (shared): 785.864.5860 ============================================== ________________________________ From: R-sig-phylo <r-sig-phylo-boun...@r-project.org> on behalf of Yan Wong <y...@pixie.org.uk> Sent: Friday, June 26, 2020 4:46 PM To: r-sig-phylo@r-project.org <r-sig-phylo@r-project.org> Subject: [R-sig-phylo] Breaking polytomies such that all topologies are equiprobable I�m trying to figure out how to randomly resolve polytomies such that there is an equal probability of any topology being generated. I thought that the ape function �multi2di� did this, but when I have tried it repeatedly with a 4-tomy, multi2di seems to produce the 3 balanced trees [((a,b),(c,d)) ; ((a,c),(b,d)); ((a,d),(b,c))] twice as often as the 12 possible unbalanced dichotomous 4-tip rooted topologies. The R code I�ve used to produce the sample topologies is something like this: do.call(c, lapply(1:100000, function(x) multi2di(starTree(c('a','b','c','d'))))) Firstly, is this expected, or am I doing something wrong (if expected, it would be useful to note this in the docs)? Secondly, is there an function somewhere that *will* break polytomies to produce equiprobable topologies? If not, thirdly, is there an algorithm that will do this? I think the standard �repeatedly pick 2 random edges from the polytomy node and pair them off� results in the non-equiprobable distribution that I find using multi2di. I think I�ve found a similar problem with the Dendropy algorithm, which does claim to result in equiprobable topologies, and have posted to their mailing list in case I�m misunderstanding something. Cheers Yan Wong Big Data Institute, Oxford University _______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylo&data=02%7C01%7Cmtholder%40ku.edu%7Cc9cac10fb66d4f6a054f08d81a1a7574%7C3c176536afe643f5b96636feabbe3c1a%7C0%7C0%7C637288048254353234&sdata=kXOqMU5IQY4Pa2BVsHZnvm01mpVieHIFFa9yg720bhc%3D&reserved=0 Searchable archive at https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2F&data=02%7C01%7Cmtholder%40ku.edu%7Cc9cac10fb66d4f6a054f08d81a1a7574%7C3c176536afe643f5b96636feabbe3c1a%7C0%7C0%7C637288048254353234&sdata=ir2rXEIKyLeaPF4MbY36uvqn6Z2o1pT8sApoZQXZnPc%3D&reserved=0 [[alternative HTML version deleted]]
_______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/