From 4bf7c89f3592f433c914413f387ce23fbabb7cf3 Mon Sep 17 00:00:00 2001 From: Sebastian Proost Date: Mon, 29 Aug 2016 11:53:53 +0200 Subject: [PATCH] avoid division by zero --- helper/htseq_count_stats.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helper/htseq_count_stats.py b/helper/htseq_count_stats.py index bb1e781..52eb5d4 100644 --- a/helper/htseq_count_stats.py +++ b/helper/htseq_count_stats.py @@ -36,4 +36,5 @@ print('sample', 'mapped_reads', 'no_feature', 'ambiguous', '% mapped', '% no_feature', '% ambiguous', sep='\t') for s, m, n, a in zip(values['samples'], values['mapped_reads'], values['__no_feature'], values['__ambiguous']): total = sum([m, n, a]) - print(s, m, n, a, m*100/total, n*100/total, a*100/total, sep='\t') + if total > 0: + print(s, m, n, a, m*100/total, n*100/total, a*100/total, sep='\t')