Mercurial > repos > jackcurragh > ribogalaxy_bowtie_rrna
diff bowtie_rRNA_removal_wrapper/bowtie_rRNA_tRNA_removal_wrapper.py @ 21:b49ad9f12dfa draft
Uploaded
author | jackcurragh |
---|---|
date | Wed, 11 May 2022 13:37:35 +0000 |
parents | dbb3e98144fd |
children | ca7c965f7cc9 |
line wrap: on
line diff
--- a/bowtie_rRNA_removal_wrapper/bowtie_rRNA_tRNA_removal_wrapper.py Wed Apr 13 09:00:19 2022 +0000 +++ b/bowtie_rRNA_removal_wrapper/bowtie_rRNA_tRNA_removal_wrapper.py Wed May 11 13:37:35 2022 +0000 @@ -411,10 +411,19 @@ # have to nest try-except in try-finally to handle 2.4 try: # prepare actual mapping commands - if options.paired == 'paired': - cmd2 = 'bowtie %s %s -1 %s -2 %s > %s' % ( aligning_cmds, ref_file_name, options.input1, options.input2, options.output ) + if options.output != 'XXXX': + print('incorrect option') + if options.paired == 'paired': + cmd2 = 'bowtie %s %s -1 %s -2 %s > %s | samtools view -b -S > %s' % ( aligning_cmds, ref_file_name, options.input1, options.input2, options.output, options.output ) + else: + cmd2 = 'bowtie %s %s %s > %s | samtools view -b -S > %s' % ( aligning_cmds, ref_file_name, options.input1, options.output, options.output ) else: - cmd2 = 'bowtie %s %s %s > %s' % ( aligning_cmds, ref_file_name, options.input1, options.output ) + if options.paired == 'paired': + cmd2 = 'bowtie %s %s -1 %s -2 %s' % ( aligning_cmds, ref_file_name, options.input1, options.input2 ) + else: + print('correct option') + cmd2 = 'bowtie %s %s %s' % ( aligning_cmds, ref_file_name, options.input1 ) + print(cmd2) # align tmp = tempfile.NamedTemporaryFile( dir=tmp_index_dir ).name with open(tmp, 'w') as tmp_stderr: @@ -456,7 +465,7 @@ except Exception as e: sys.stdout.write( 'Error producing the unmapped output file.\n' ) # check that there are results in the output file - if os.path.getsize( options.output ) == 0: + if options.output != "XXXX" and os.path.getsize( options.output ) == 0: raise Exception('The output file is empty, there may be an error with your input file or settings.') except Exception as e: stop_err( 'Error aligning sequence. ' + str( e ) )