Skip to content

Commit

Permalink
Merge pull request #159 from cihga39871/sga-bin-multithreads
Browse files Browse the repository at this point in the history
 multithread for samtools sort in sga-align, and fix devision by zero when bootstrap fails in sga-astat
  • Loading branch information
jts committed Aug 8, 2019
2 parents af73db6 + dd2de64 commit 229293b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/bin/sga-align
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def runMerge(inFiles, outFile):
runCmd(cmd)

def runSort(inFile, outFile):

global threads
(outPrefix, fileExtension) = os.path.splitext(outFile)
cmd = "samtools sort %s -o %s.bam" % (inFile, outPrefix)
cmd = "samtools sort -@ %d %s -o %s.bam" % (threads, inFile, outPrefix)
runCmd(cmd)

#cmd = "samtools index %s" % (outFile)
Expand Down
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 229293b

Please sign in to comment.