Skip to content

Commit

Permalink
check star return code and assert that it is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ottojolanki committed Nov 20, 2018
1 parent d68e281 commit 93e1809
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/bam_to_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@

def main(args):
print(args)
call_star(args.bamfile, args.strandedness)
star_return_code = call_star(args.bamfile, args.strandedness)

try:
assert star_return_code == 0
except AssertionError:
logger.exception('Building bedGraph had a problem, most likely out of memory.')
raise

if args.strandedness == 'stranded':
call_bg_to_bw('Signal.UniqueMultiple.str1.out.bg', args.chrom_sizes,
args.bamroot + '_minusAll.bw')
Expand All @@ -55,7 +62,8 @@ def call_star(input_bam, strandedness):
command = STAR_COMMAND.format(
input_bam=input_bam, strandedness=strandedness.capitalize())
logger.info('Running STAR command %s', command)
subprocess.call(shlex.split(command))
return_code = subprocess.call(shlex.split(command))
return return_code


def call_bg_to_bw(input_bg, chrom_sizes, out_fn):
Expand Down

0 comments on commit 93e1809

Please sign in to comment.