pertpy
pertpy copied to clipboard
Switch from ete3 to ete4
PR Checklist
- [X] Referenced issue is linked
- [X] If you've fixed a bug or added code that should be tested, add tests!
- [ ] Documentation in
docs
is updated
Description of changes
This PR is the response to the issue https://github.com/etetoolkit/ete/issues/739, which aim to upgrade the usage of etetoolkit in pertpy from ete3 to ete4.
perpty implement ete for the following tasks: a) browsing trees, such as getting leaves, descendants, ancestors, etc. b) annotation of trees, such as adding information to nodes. c) drawing tree, including drawing tree with layouts of nodes' information.
This repo upgrade the syntax in regards to the first two tasks. The third task which include the drawing part will mostly maintain the usage of ete3 version expect for calling the module in new places
Technical details This PR mostly just correct the syntax of calling the methods or features from ete3 to ete4, straight forward and trivial. detailed differences can be found from
- migration noteos: https://github.com/etetoolkit/ete/wiki/3to4
- ete4 official tutorial https://etetoolkit.github.io/ete/tutorial/tutorial_trees.html#browsing-trees-traversing
I used two ways to conduct the test
-
Passed the unitest this folder /home/deng/Projects/metatree_drawer/test_pertpy/pertpy/tests/tools/_coda
-
Be able to recreate tree images from the step-by-step tutorial of tasccoda tree-aggregated analysis from https://pertpy.readthedocs.io/en/latest/tutorials/notebooks/tasccoda.html
Additional context
ete4 installation, ete4 currently is released on githup repo as beta version therefore not yet available in pip nor conda. Users can install ete4 via githup
pip install https://github.com/etetoolkit/ete/archive/ete4.zip
In regards to c) drawing tree, ete4 still contains the treeview inherited from ete3 which relies on novel PyQt6 module to render tree image. Users can install the depencies by
pip install PyQt6
or install ete4 via
pip install -e .[treeview]
for a local editable installation.
Important information: In ete4 we will stop maintaining nor making new updates in the old treeview module which is used in pertpy, at this moment it is still functional.
Instead ete4 embrace the new smartview module which has abilities to visualize large tree dataset up to thousands of tips interactively and introduce with novel layouts. The new drawing engine has been implemented in some tools such as PhyloCloud https://phylocloud.cgmlab.org/ (https://doi.org/10.1093/nar/gkac324) TreeProfiler https://doi.org/10.1101/2023.09.21.558621
If pertpy has the demands to visualize trees with ete4 smartview, I'm more than welcome to provide a novel PR in regards to this feature.