jenniferlu717/KrakenTools

Make_kreports.py breaks if all reads unclassified

mattheatley opened this issue · 1 comments

if all sequences have a taxid of 0 then I get the following

Traceback (most recent call last):
File "/home/OXFORDNANOLABS/mheatley/miniconda3/envs/krakentools_v1.2/bin/make_kreport.py", line 199, in
main()
File "/home/OXFORDNANOLABS/mheatley/miniconda3/envs/krakentools_v1.2/bin/make_kreport.py", line 174, in main
o_file.write("%6.2f\t" % (float(taxid2allcounts[curr_tid])/float(read_count)*100))
KeyError: '1'

The obvious answer is probably "just don't generate a kreport for such data!". however I'm benchmarking a bunch of different samples and settings in a pipeline so it would be great if these instances didn't break it and instead produced a really simple kreport instead (i.e. a single row of counts for taxid 0)

Got it, I'll try to change the script to allow for that