From dd2de6406bac4cdbf21a79c9cd3b456893eae1d3 Mon Sep 17 00:00:00 2001 From: Jiacheng Eric Chuan Date: Thu, 8 Aug 2019 16:05:38 -0300 Subject: [PATCH] fix devision by zero when bootstrap fails --- src/bin/sga-astat.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/sga-astat.py b/src/bin/sga-astat.py index 819b6a2c..92875e38 100755 --- a/src/bin/sga-astat.py +++ b/src/bin/sga-astat.py @@ -150,6 +150,8 @@ def usage(): bootstrapReads += cd.n # Estimate arrival rate based on unique contigs + if bootstrapLen == 0 or bootstrapReads == 0: + continue # failed arrivalRate = float(bootstrapReads) / float(bootstrapLen) genomeSize = int(totalReads / arrivalRate) sys.stderr.write('Iteration ' + str(i) + ' arrival rate: ' + str(arrivalRate) + '\n'); @@ -180,5 +182,4 @@ def usage(): sumRepeat += cd.len sys.stderr.write('Sum unique bases in contigs >= %d bp in length: %d\n' % (minLength, sumUnique)) -sys.stderr.write('Sum repeat bases in contigs >= %d bp in length: %d\n' % (minLength, sumRepeat)) - +sys.stderr.write('Sum repeat bases in contigs >= %d bp in length: %d\n' % (minLength, sumRepeat)) \ No newline at end of file