Bipartition question
richardgoater opened this issue · 8 comments
Hello, thanks for a nice library!
I'm trying to implement a neighbour-joining example and I come across this issue on the penultimate step:
+---------- F
|
| +--------------------------------- E
|----------|ED
| +---------------------- D
|
| +---------- B
| +----------------------|BA
+----------|BAC +-------------------------------------------- A
|
+---------- C
--- FAIL: TestNJ (0.00s)
panic: We cannot add the bipartition, it already exists [recovered]
It is attempting to join F and ED at this point. Can I detect this situation and do something different perhaps?
Hello,
Could you provide a small example of the way you call the function?
Thanks,
Frederic
Thanks for the quick reply @fredericlemoine, I think this line is the one of interest:
https://gist.github.com/richardgoater/867546a4ec48cc75e570f1f42deb79ff#file-nj-go-L85
I realise that I'm not checking for errors with the edges on lines 77-78.
EDIT: Added a test file to the gist
Hello,
Wouldn't it be due to the fact that your tree is already fully resolved? It seems there is no "polytomies" left, i.e nodes with more than 3 neighbors.
By the way, there is a function you can call to create a startree from taxa names directly:
t,err := tree.StarTreeFromName(taxa...)
Thanks for your thoughts, and thanks for the tip on creating the startree. I think there should be one more round of joining at this point, the matrix is 3 x 3 with nodes F, ED, and BAC. The implementation is probably not 100% correct, and I still need to implement the final operation when the matrix is 2 x 2.
Ok, but I don't think you can add a new bipartition, as all the internal nodes have already 3 neighbors.
Are you sure you need a 2x2 matrix? (see here for example)
Thanks again, is there something else I can do instead of a bipartition?
I've been following this example:
http://www.evolution-textbook.org/content/free/tables/Ch_27/T11_EVOW_Ch27.pdf
I believe the program is stuck at cycle 4, and I need to implement the "final step" here: https://gist.github.com/richardgoater/867546a4ec48cc75e570f1f42deb79ff#file-nj-go-L107
Hi, I think I have it working now and updated the gist. I realised I just need to assign distances to the existing nodes in the situation above (and I was also assigning distances the opposite way round, now fixed). Thanks very much for your time again, and thanks for the library.
Thanks for the update