Skip to content

KeyError: 'child_id' #12

@ramanujamr

Description

@ramanujamr

Hi

I'm trying to convert kraken2 outputs for vamb.
When I try to run this command:
taxconverter kraken2 -i ${sample_id}_kraken2.tsv -o vamb/taxconverter/${sample_id}.tsv

The kraken2 output was generate using default command:
kraken2 -threads 16 --db ${KRAKEN_DB} --output ${WD}/kraken2/${sample_id}_kraken2.tsv $contig

I get this error:
2025-06-10 20:30:35.003 | INFO | taxconverter.main:ncbi_lineage:54 - Loading NCBI lineage
Traceback (most recent call last):
File "/home/ramanujam/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3652, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'child_id'

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

Traceback (most recent call last):
File "/home/ramanujam/.local/bin/taxconverter", line 8, in
sys.exit(main())
File "/home/ramanujam/.local/lib/python3.9/site-packages/taxconverter/main.py", line 282, in main
kraken_data(args.input)
File "/home/ramanujam/.local/lib/python3.9/site-packages/taxconverter/main.py", line 135, in wrapper
df = func(*arguments, **kwargs)
File "/home/ramanujam/.local/lib/python3.9/site-packages/taxconverter/main.py", line 268, in kraken_data
map_ncbi = ncbi_lineage()
File "/home/ramanujam/.local/lib/python3.9/site-packages/taxconverter/main.py", line 56, in ncbi_lineage
map_child_parent = {k: v for k, v in zip(df_ncbi[CHILD_ID].astype(str), df_ncbi[PARENT_ID].astype(str))}
File "/home/ramanujam/.local/lib/python3.9/site-packages/pandas/core/frame.py", line 3760, in getitem
indexer = self.columns.get_loc(key)
File "/home/ramanujam/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3654, in get_loc
raise KeyError(key) from err
KeyError: 'child_id' `

Any thoughts on fixes?
I have installed taxconverter in a fresh conda environment and manually copied over the clades.tsv file to data directory in the environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions