Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NCBITaxa problem: Different behaviour between get_lineage and get_descendant_taxa #436

Closed
openpaul opened this issue Feb 3, 2020 · 1 comment
Assignees
Milestone

Comments

@openpaul
Copy link

openpaul commented Feb 3, 2020

When the taxid has to be changed only get_lineage works and not get_descendent_taxa:

from ete3 import NCBITaxa
ncbi = NCBITaxa()
ncbi.get_lineage(2599292)

results in:

[...]/lib/python3.7/site-packages/ete3/ncbi_taxonomy/ncbiquery.py:240: UserWarning: taxid 2599292 was translated into 400770
  warnings.warn("taxid %s was translated into %s" %(taxid, merged_conversion[taxid]))

[1, 131567, 2, 1224, 28211, 356, 45401, 46913, 400770]

Which is fine and expected.

Using the same TaxID with get_descendant_taxa does not work:

ncbi.get_descendant_taxa(id)

results in:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-0bee07a5e060> in <module>
----> 1 ncbi.get_descendant_taxa(2599292)

[...]/lib/python3.7/site-packages/ete3/ncbi_taxonomy/ncbiquery.py in get_descendant_taxa(self, parent, intermediate_nodes, rank_limit, collapse_subspecies, return_tree)
    353 
    354         if not found:
--> 355             raise ValueError("taxid not found:%s" %taxid)
    356         elif found == 1:
    357             return [taxid]

ValueError: taxid not found:2599292

If one instead uses the changed taxID it works well:

ncbi.get_descendant_taxa(400770)
[400770]
@jhcepas
Copy link
Member

jhcepas commented Mar 28, 2020

get_descendant_taxa is probably not reading the synonyms table. thanks for the report.

@jhcepas jhcepas added this to the ETE v4.0 milestone Mar 28, 2020
@jhcepas jhcepas changed the title Different behaviour between NCBITaxa problem: Different behaviour between get_lineage and get_descendant_taxa Mar 28, 2020
dengzq1234 added a commit to dengzq1234/ete that referenced this issue Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants