Skip to content

Commit

Permalink
remove vestigial code path where revertBam was an optional param (#28)
Browse files Browse the repository at this point in the history
* remove vestigial code path where revertBam was an optional param
* taxon_filter.py::deplete() make revertBam mandatory rather than optional positional
  • Loading branch information
tomkinsc authored Dec 16, 2020
1 parent 6b2186b commit 8e2a63d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions taxon_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

def parser_deplete(parser=argparse.ArgumentParser()):
parser.add_argument('inBam', help='Input BAM file.')
parser.add_argument('revertBam', nargs='?', help='Output BAM: read markup reverted with Picard.')
parser.add_argument('revertBam', help='Output BAM: read markup reverted with Picard.')
parser.add_argument('bwaBam', help='Output BAM: depleted of reads with BWA.')
parser.add_argument('bmtaggerBam', help='Output BAM: depleted of reads with BMTagger.')
parser.add_argument(
Expand Down Expand Up @@ -127,15 +127,12 @@ def bmtagger_wrapper(inBam, db, outBam, JVMmemory=None):
JVMmemory=args.JVMmemory
)

# if the user has not specified saving a revertBam, we used a temp file and can remove it
if not args.revertBam:
os.unlink(revertBamOut)
else:
if os.path.getsize(args.revertBam) == 0:
with util.file.tempfname('.empty.sam') as empty_sam:
samtools = tools.samtools.SamtoolsTool()
samtools.dumpHeader(args.inBam, empty_sam)
samtools.view(['-b'], empty_sam, args.revertBam)

if os.path.getsize(args.revertBam) == 0:
with util.file.tempfname('.empty.sam') as empty_sam:
samtools = tools.samtools.SamtoolsTool()
samtools.dumpHeader(args.inBam, empty_sam)
samtools.view(['-b'], empty_sam, args.revertBam)

multi_db_deplete_bam(
args.bmtaggerBam,
Expand Down

0 comments on commit 8e2a63d

Please sign in to comment.