etetoolkit / ete

Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
http://etetoolkit.org
GNU General Public License v3.0
768 stars 216 forks source link

Ete4 #750 #751

Closed dengzq1234 closed 1 month ago

dengzq1234 commented 1 month ago

this PR is to solve #750

It includes the following features:

dengzq1234 commented 1 month ago

Thanks @dengzq1234

Before I merge this PR, I'd like to understand the couple of things I mentioned before, and also we should understand why after this change the ncbiquery test fails (which seems to be from your change in line 135 of tests/test_ncbiquery.py, that I imagine you had a reason to do):

$ pytest tests/test_ncbiquery.py 
[...]
tests/test_ncbiquery.py ......F.
[...]
____________________________________________ Test_ncbiquery.test_merged_id _____________________________________________

self = <tests.test_ncbiquery.Test_ncbiquery testMethod=test_merged_id>

    def test_merged_id(self):
      ncbi = NCBITaxa(dbfile=DATABASE_PATH)
      t1 = ncbi.get_lineage(649756)
>     self.assertEqual(t1, [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756])
E     AssertionError: Lists differ: [1, 131567, 2, 1783272, 1239, 186801, 186802, 186803, 207244, 649756] != [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756]
E     
E     First differing element 6:
E     186802
E     3085636
E     
E     - [1, 131567, 2, 1783272, 1239, 186801, 186802, 186803, 207244, 649756]
E     ?                                       ^  ^^^
E     
E     + [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756]
E     ?                                       ^^ + ^^

test_ncbiquery.py:135: AssertionError

I changed it because I updated my ncbi taxonomy database, I wonder if it would effect test_ncbiquery.taxa.sqlite? For my latest update of ncbi taxonomy, I won't pass this unitest if I don't change it.

dengzq1234 commented 1 month ago

@jordibc Already update with the next ncbi unitest