mitoNGS / MToolBox

A bioinformatics pipeline to analyze mtDNA from NGS data
http://sourceforge.net/projects/mtoolbox/?source=navbar
GNU General Public License v3.0
90 stars 38 forks source link

[mpileup]: IndexError: list index out of range #38

Closed 3i-v closed 7 years ago

3i-v commented 7 years ago

Dear, here I report an issue that is still persistent since the August,14th revision (version 1.0). (this issue was already present before the update).

I 've analysed 27 samples. 4 of them describe the same error that seems coming from assembleMTgenome.py

Here is a sub-section of the log file. Thank you for your help, v.

`

ASSEMBLING MT GENOMES WITH ASSEMBLEMTGENOME...

WARNING: values of tail < 5 are deprecated and will be replaced with 5

[mpileup] 1 samples in 1 input files

Set max per-file depth to 8000 Traceback (most recent call last): File "(...)/MToolBox-master_v1.0/MToolBox/**assembleMTgenome.py**", line 443, in mut_events = mtvcf_main_analysis(mt_table, sam_file, sample_name, tail=tail) File "(...)/MToolBox-master_v1.0/MToolBox/mtVariantCaller.py", line 856, in mtvcf_main_analysis qs1.append(median(qs2)) File "(...)/MToolBox-master_v1.0/MToolBox/mtVariantCaller.py", line 402, in median m1 = sorted(l)[(len(l)/2)+1-1] **IndexError: list index out of range** ##### GENERATING VCF OUTPUT... Traceback (most recent call last): File "(...)/MToolBox-master_v1.0/MToolBox/VCFoutput.py", line 33, in VCF_dict = ast.literal_eval(open('VCF_dict_tmp', 'r').read()) IOError: [Errno 2] No such file or directory: 'VCF_dict_tmp' `
3i-v commented 7 years ago

Hi @clody23. Sorry for asking, but do you have any news/updates on this issue ? merci.

grapedigger commented 7 years ago

Hi, I have the same problem as 3i-v Many thanks. ASSEMBLING MT GENOMES WITH ASSEMBLEMTGENOME...

WARNING: values of tail < 5 are deprecated and will be replaced with 5

[mpileup] 1 samples in 1 input files Set max per-file depth to 8000 Traceback (most recent call last): File "(...)/MToolBox-master_v1.0/MToolBox/assembleMTgenome.py", line 443, in mut_events = mtvcf_main_analysis(mt_table, sam_file, sample_name, tail=tail) File "(...)/MToolBox-master_v1.0/MToolBox/mtVariantCaller.py", line 856, in mtvcf_main_analysis qs1.append(median(qs2)) File "(...)/MToolBox-master_v1.0/MToolBox/mtVariantCaller.py", line 402, in median m1 = sorted(l)[(len(l)/2)+1-1] IndexError: list index out of range

GENERATING VCF OUTPUT...

Traceback (most recent call last): File "(...)/MToolBox-master_v1.0/MToolBox/VCFoutput.py", line 33, in VCF_dict = ast.literal_eval(open('VCF_dict_tmp', 'r').read()) IOError: [Errno 2] No such file or directory: 'VCF_dict_tmp'

JeffGreenGrok commented 7 years ago

There must be a scenario in which qs2 is an empty list, otherwise I don't see how this error can happen. @clody23 is there some assumption in the lines around 856 that qs2 is a non empty list?

Thanks.

clody23 commented 7 years ago

Hi,

apologies but I have been quite busy these last months and could not take care of new issues. Will be looking into that in the next following weeks.

Thanks for your patience.

Best, Claudia

2017-09-21 15:05 GMT+01:00 Jeff Green notifications@github.com:

There must be a scenario in which qs2 is an empty list, otherwise I don't see how this error can happen. @clody23 https://github.com/clody23 is there some assumption in the lines around 856 that qs2 is a non empty list?

Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mitoNGS/MToolBox/issues/38#issuecomment-331166738, or mute the thread https://github.com/notifications/unsubscribe-auth/AAh5zdsE1VYGdM30ImiFMTWLcwr6R9Upks5skm0ZgaJpZM4O3uox .

-- Claudia

3i-v commented 7 years ago

@JeffGreenGrok @clody23 Thank you very much. Best Regards

TakaYamaguchi commented 7 years ago

Hi @clody23,

I've encountered this issue as well. I'm looking forward to the updates.

Thank you,

Taka

Pilibeibei commented 7 years ago

Hi @clody23,

I have this issue as well when I only used VCFoutput.py. I'm looking forward to the updates.

Thank you,

jich-MCTP commented 7 years ago

I also encountered this issue. any update? Thx!

zqzneptune commented 7 years ago

Same issue here as well. Thank you!

jich-MCTP commented 7 years ago

Hi All,

Now I have a solution to fix this issue. open this file:~/MToolBox/MToolBox/mtVariantCaller.py change line 406: except ZeroDivisionError: to except IndexError:

This issue reason is : when input parameter "l" is empty, python will throw an error "IndexError", it is not error "ZeroDivisionError".

I re-run my two samples which met this issue, both of them are fixed and get the right results.

If you still encounter this problem, you can left a message at here.

Best!

3i-v commented 7 years ago

Thank you @jich-MCTP for the suggestion. Unfortunately, the change on lane 406

except ZeroDivisionError:

    except IndexError:

into the /MToolBox/MToolBox/mtVariantCaller.py file does not resolve the issue.

(I have tested 1 sample only).

The issue is:

ASSEMBLING MT GENOMES WITH ASSEMBLEMTGENOME...

WARNING: values of tail < 5 are deprecated and will be replaced with 5

[mpileup] 1 samples in 1 input files

Set max per-file depth to 8000 Traceback (most recent call last): File "(...)/MToolBox-master_v1.0/MToolBox/**assembleMTgenome.py**", line 443, in mut_events = mtvcf_main_analysis(mt_table, sam_file, sample_name, tail=tail) File "(...)/MToolBox-master_v1.0/MToolBox/mtVariantCaller.py", line 967, in mtvcf_main_analysis deletions.append(mtDNAseq[delflank]) **IndexError: string index out of range** ##### GENERATING VCF OUTPUT... Traceback (most recent call last): File "(...)/MToolBox-master_v1.0/MToolBox/VCFoutput.py", line 33, in VCF_dict = ast.literal_eval(open('VCF_dict_tmp', 'r').read()) IOError: [Errno 2] No such file or directory: 'VCF_dict_tmp' Notice that previlously, the error was **IndexError: list index out of range** (see comment of Aug.15th.); Today, and since the modification of the lane 406, the returned message is **IndexError: string index out of range**
jich-MCTP commented 7 years ago

@3i-v This issue is a new one. The error location is at line 967 in File "(...)/MToolBox-master_v1.0/MToolBox/mtVariantCaller.py" NOT at line 402 in File "(...)/MToolBox-master_v1.0/MToolBox/mtVariantCaller.py".

From error information "IndexError: string index out of range", it seems that also one list of python is empty. maybe this list "mtDNAseq".

I will check with source codes.

Best,

3i-v commented 7 years ago

Thank you very much @jich-MCTP .

3i-v commented 7 years ago

@jich-MCTP Dear, today I 've analysed all of my samples that previously failed because of the "[mpileup]: IndexError: list index out of range" error message, and since you have suggested to edit the code (change line 406), all of them (5/5) have been now completed with success. Thank you very much for you help. You resolved the issue.

I still have a problem on 1 sample (as described 2 days ago), but I think the better way to do is to report this one into a new post, as you noticed it is a new issue. Thank you very much again for your help.