ete3 error : could not be translated into taxids! - Bioinformatics

225 views Asked by At

I am using ete3(http://etetoolkit.org/) package in Python within a bioinformatics pipeline I wrote myself.

While running this script, I get the following error. I have used this script a lot for other datasets which don't have any issues and have not given any errors. I am using Python3.5 and miniconda. Any fixes/insights to resolve this error will be appreciated.

[Error]

Traceback (most recent call last):
  File "/Users/d/miniconda2/envs/py35/bin/ete3", line 11, in <module>
    load_entry_point('ete3==3.1.1', 'console_scripts', 'ete3')()
  File "/Users/d/miniconda2/envs/py35/lib/python3.5/site-packages/ete3/tools/ete.py", line 95, in main
    _main(sys.argv)
  File "/Users/d/miniconda2/envs/py35/lib/python3.5/site-packages/ete3/tools/ete.py", line 268, in _main
    args.func(args)
  File "/Users/d/miniconda2/envs/py35/lib/python3.5/site-packages/ete3/tools/ete_ncbiquery.py", line 168, in run
    collapse_subspecies=args.collapse_subspecies)
  File "/Users/d/miniconda2/envs/py35/lib/python3.5/site-packages/ete3/ncbi_taxonomy/ncbiquery.py", line 434, in get_topology
    lineage = id2lineage[sp]
KeyError: 3


1

There are 1 answers

1
Marek Schwarz On

Continuing from the comment section for better formatting.

Assuming that the sp contains 3 as suggested by the error message (do check this yourself). You can inspect the ete3 code (current version) following its definition, you can trace it to line:

    def get_lineage_translator(self, taxids):
        """Given a valid taxid number, return its corresponding lineage track as a
        hierarchically sorted list of parent taxids.

So I went to https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi and checked if 3 is valid taxid and it appears that it is not.

# relevant section from ncbi taxonomy browser
No result found in the Taxonomy database for taxonomy id
3

It appears to me that your only option is to trace how the 3 gets computed. Because the root cause is simply that taxid 3 is not valid taxid number as required by the function.