ncbitax2lin: KeyError: 1

Im running the scripts as instructed in anaconda and I get this error. Im not good enough in python to figure out the problem. Can you help?

Console feed:

(base) C:\Users\BPIL>ncbitax2lin --nodes-file taxdump/nodes.dmp --names-file taxdump/names.dmp
2021-08-31 13:32:38,637|INFO|time spent on load_nodes: 0:00:04.046432
2021-08-31 13:32:45,796|INFO|time spent on load_names: 0:00:07.158943
2021-08-31 13:32:48,974|INFO|# of tax ids: 2,359,686
2021-08-31 13:32:49,420|INFO|df.info:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2359686 entries, 0 to 2359685
Data columns (total 4 columns):
 #   Column         Dtype
---  ------         -----
 0   tax_id         int64
 1   parent_tax_id  int64
 2   rank           object
 3   rank_name      object
dtypes: int64(2), object(2)
memory usage: 367.0 MB

2021-08-31 13:32:49,421|INFO|Generating TAXONOMY_DICT ...
2021-08-31 13:33:00,737|INFO|found 12 cpus, and will use all of them to find lineages for all tax ids
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "c:\users\bpil\anaconda3\lib\multiprocessing\pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "c:\users\bpil\anaconda3\lib\multiprocessing\pool.py", line 44, in mapstar
    return list(map(*args))
  File "c:\users\bpil\anaconda3\lib\site-packages\ncbitax2lin\ncbitax2lin.py", line 78, in find_lineage
    record = TAXONOMY_DICT[tax_id]
KeyError: 1
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\users\bpil\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\bpil\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\BPIL\Anaconda3\Scripts\ncbitax2lin.exe\__main__.py", line 7, in <module>
  File "c:\users\bpil\anaconda3\lib\site-packages\ncbitax2lin\ncbitax2lin.py", line 192, in main
    fire.Fire(taxonomy_to_lineages)
  File "c:\users\bpil\anaconda3\lib\site-packages\fire\core.py", line 138, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "c:\users\bpil\anaconda3\lib\site-packages\fire\core.py", line 468, in _Fire
    target=component.__name__)
  File "c:\users\bpil\anaconda3\lib\site-packages\fire\core.py", line 672, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "c:\users\bpil\anaconda3\lib\site-packages\ncbitax2lin\ncbitax2lin.py", line 179, in taxonomy_to_lineages
    lineages = find_all_lineages(df_data.tax_id)
  File "c:\users\bpil\anaconda3\lib\site-packages\ncbitax2lin\ncbitax2lin.py", line 101, in find_all_lineages
    return pool.map(find_lineage, tax_ids)
  File "c:\users\bpil\anaconda3\lib\multiprocessing\pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "c:\users\bpil\anaconda3\lib\multiprocessing\pool.py", line 657, in get
    raise self._value
KeyError: 1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Runs perfectly now, thank you…