KrakenTools icon indicating copy to clipboard operation
KrakenTools copied to clipboard

Error running kreports2mpa.py

Open ghost opened this issue 2 years ago • 3 comments

Traceback (most recent call last): File "/home/davidmartins/miniconda3/envs/statistics/bin/kreport2mpa.py", line 173, in main() File "/home/davidmartins/miniconda3/envs/statistics/bin/kreport2mpa.py", line 128, in main report_vals = process_kraken_report(line) File "/home/davidmartins/miniconda3/envs/statistics/bin/kreport2mpa.py", line 71, in process_kraken_report int(split_str[1]) IndexError: list index out of range

I'm trying to convert a KREPORTS file to mpa format but it keeps getting this error message. Does anyone knows how to solve this?

ghost avatar Jan 12 '23 19:01 ghost

Just noting that I get the following issue when running kreport2mpa.py:

Traceback (most recent call last): File "/Users/simongrimm/Documents/mit/stats/illumina_pilot/kreport2mpa.py", line 188, in main() File "/Users/simongrimm/Documents/mit/stats/illumina_pilot/kreport2mpa.py", line 143, in main report_vals = process_kraken_report(line) File "/Users/simongrimm/Documents/mit/stats/illumina_pilot/kreport2mpa.py", line 80, in process_kraken_report taxid = int(l_vals[-3])

Command: xxx illumina_pilot % python3 kreport2mpa.py -r data/kraken_reports/kraken2_standard_16gb/10170_kraken2_report.txt -o data/10170_kraken2_report.mpa.txt --intermediate-ranks

simonleandergrimm avatar Jan 30 '23 16:01 simonleandergrimm

**Platelmin1o ** c

you should check your input file. it seems there is something wrong.

lvmt avatar Jan 31 '23 06:01 lvmt

Just noting that I get the following issue when running kreport2mpa.py:

Traceback (most recent call last): File "/Users/simongrimm/Documents/mit/stats/illumina_pilot/kreport2mpa.py", line 188, in main() File "/Users/simongrimm/Documents/mit/stats/illumina_pilot/kreport2mpa.py", line 143, in main report_vals = process_kraken_report(line) File "/Users/simongrimm/Documents/mit/stats/illumina_pilot/kreport2mpa.py", line 80, in process_kraken_report taxid = int(l_vals[-3])

Command: xxx illumina_pilot % python3 kreport2mpa.py -r data/kraken_reports/kraken2_standard_16gb/10170_kraken2_report.txt -o data/10170_kraken2_report.mpa.txt --intermediate-ranks

it seems that the author have changed the script(kreport2mpa.py)

my kraken2report.file looks like

72.82  30462668        30462668        0       0       U       0       unclassified
 27.18  11370380        1851    545292866       4986675 R       1       root
 26.47  11072306        12408   531053515       4875213 R1      131567    cellular organisms
 26.36  11028751        46106   529587807       4842382 D       2           Bacteria
 18.07  7561237 2922    410480000       2972031 D1      1783272       Terrabacteria group

### actually the var 'l_vals' is split_str

try:
   taxid = int(split_str[-2])
   level_type = split_str[-3]
   #map_kuniq = {'species':'S', 'genus':'G','family':'F',
   #    'order':'O','class':'C','phylum':'P','superkingdom':'D',
   #    'kingdom':'K'}
   map_kuniq = ['D', 'K', 'P', 'C', 'O', 'F', 'G', 'S']
   if level_type not in map_kuniq:
       level_type = '-' 
   #else:
       #level_type = map_kuniq[level_type]
except ValueError:
   taxid = int(split_str[-2])
   level_type = split_str[-3]

hope this can help you

lvmt avatar Jan 31 '23 06:01 lvmt