Skip to content

Commit

Permalink
fix devision by zero when bootstrap fails
Browse files Browse the repository at this point in the history
  • Loading branch information
cihga39871 committed Aug 8, 2019
1 parent 56fb39d commit dd2de64
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bin/sga-astat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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))

0 comments on commit dd2de64

Please sign in to comment.