jeetsukumaran / DendroPy

A Python library for phylogenetic scripting, simulation, data processing and manipulation.
https://pypi.org/project/DendroPy/.
BSD 3-Clause "New" or "Revised" License
210 stars 61 forks source link

Add Bandelt Encoding #124

Closed Kuanhao-Chao closed 4 years ago

Kuanhao-Chao commented 4 years ago
  1. I tried to create a new module under src/dendropy/calculate/. However, after rebuilding DendroPy from source code, I can not find my module, so I put my code in src/dendropy/calculate/treemeasure.py temporarily.
  2. I put the testing data in Bandelt_Test_Data under the project root directory temporarily.
  3. I write tests in Test_Bandelt_Encoding.ipynb to check that the distance between the original tree and the decoded tree is zero.
  4. I need your help in Tree checking conditions should be added HERE !! section in my code. Can you help me with adding input checking conditions of a valid tree of my Bandelt_encode function because I am not so familiar with built-in functions in Dendropy. Basically, Bandelt algorithm can be used to encode and decode all bifurcating trees. After reading IQ-TREE output, which must be a bifurcating tree, into dendropy, the tree will look like Tree 1 below. What I want to do is to construct a tree like Tree 2 below with my own auxiliary BandeltNode class so that I can do the remaining encoding steps.

(1) Tree 1

/---------------------------------------------------- A
|
+---------------------------------------------------- B
|
|                /----------------------------------- C
\----------------+
                 |                  /----------------- D
                 \-----------------+
                                    \----------------- E

(2) Tree 2

         /-------------------------------------------------B
A ------+
        |             /----------------------------------- C
         \-----------+
                     |              /----------------- D
                      \------------+
                                    \----------------- E

If there are any problems that I need to fix, please let me know. And thank you for your help!

Howard Chao