Skip to content

Commit

Permalink
Correct mean_sample_coverage when no genes present
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelpmachado authored Nov 24, 2016
1 parent ee428d2 commit c228270
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/trueCoverage_rematch.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,11 @@ def runTrueCoverage(fastq_files, reference_file, threads, outdir, length_extra_s
if sample_data[i]['gene_number_positions_multiple_alleles'] > 0:
number_genes_multiple_alleles += 1

mean_sample_coverage = float(mean_sample_coverage) / float(len(sample_data) - number_absent_genes)
if len(sample_data) - number_absent_genes > 0:
mean_sample_coverage = float(mean_sample_coverage) / float(len(sample_data) - number_absent_genes)
else:
mean_sample_coverage = 0

writer.write('\n'.join(['#general', '>number_absent_genes', str(number_absent_genes), '>number_genes_multiple_alleles', str(number_genes_multiple_alleles), '>mean_sample_coverage', str(round(mean_sample_coverage, 2))]) + '\n')

print '\n'.join([str('number_absent_genes: ' + str(number_absent_genes)), str('number_genes_multiple_alleles: ' + str(number_genes_multiple_alleles)), str('mean_sample_coverage: ' + str(round(mean_sample_coverage, 2)))])
Expand Down

0 comments on commit c228270

Please sign in to comment.