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

summary.py fails when samples with 0% coverage are present #75

Open psterk opened 5 years ago

psterk commented 5 years ago

I suggest to add a try / except clause around the output_file_write() statement so that summary.py does not fail when there are samples with 0% coverage. Of course, these samples are not useful, but you'd normally not be able to filter these out until after the run. Code change suggestion below:

    for k in dic_dp:
            dpt=dic_dp[k]
            dpt=str(dpt[:-1])
            try:
                    output_file.write(str(k)+"\t"+str(dic_cov[k])+"\t"+str(dpt) + ...... +str(dic_prio[k])+"\n")
            except KeyError as e:
                    print 'KeyError: reason "%s"' % str(e)
                    pass