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

Out of bounds error #37

Open jeffgreen123 opened 7 years ago

jeffgreen123 commented 7 years ago

Running i get the following error Traceback (most recent call last): File "mtoolbox/1.0.2/MToolBox/assembleMTgenome.py", line 443, in mut_events = mtvcf_main_analysis(mt_table, sam_file, sample_name, tail=tail) File "mtoolbox/1.0.2/MToolBox/mtVariantCaller.py", line 856, in mtvcf_main_analysis qs1.append(median(qs2)) File "mtoolbox/1.0.2/MToolBox/mtVariantCaller.py", line 402, in median m1 = sorted(l)[(len(l)/2)+1-1] IndexError: list index out of range

two points m1 = sorted(l)[(len(l)/2)+1-1] is a little weird with the +1 -1 (compiler will most likely take out anyways, but a little strange).

Also this would only occur if len(l) == 0 (as far as i can tell), is it possible to put a check for this and return 0 as median (assuming this is correct behaviour)

Let me know if you have any questions or concerns :)

3i-v commented 7 years ago

I have the same issue (see. issue #38 ) . I write a comment here to receive the follow-up and/or updates. Thank you again.

jich-MCTP commented 7 years ago

I met this problem also! Mark and hope get the follow-up. Thx

jich-MCTP commented 7 years ago

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!