Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running kreports2mpa.py #59

Open
ghost opened this issue Jan 12, 2023 · 3 comments
Open

Error running kreports2mpa.py #59

ghost opened this issue Jan 12, 2023 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 12, 2023

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?

@simonleandergrimm
Copy link

simonleandergrimm commented Jan 30, 2023

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

@lvmt
Copy link

lvmt commented Jan 31, 2023

**Platelmin1o ** c

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

@lvmt
Copy link

lvmt commented Jan 31, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants