0

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


007
  • 5
  • 5
  • As far as I recall, the ete3 has database behind the scenes for this task. This database may be out of date. Also check what the `sp` actually contains when the script fails. – Marek Schwarz May 13 '20 at 10:54
  • @MarekSchwarz thanx. I updated ete3's database following [Upgrading the local database](http://etetoolkit.org/docs/latest/tutorial/tutorial_ncbitaxonomy.html) but this error does not resolve.. – 007 May 13 '20 at 15:38

1 Answers1

0

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.

Marek Schwarz
  • 578
  • 6
  • 10
  • Thanks @Marek Schwarz !! I think I have figured out the cause. Some numbers were not in proper format. The file ete3 uses in this step had numbers which do not correspond to taxids. – 007 May 17 '20 at 05:27