Mercurial > repos > devteam > bowtie_wrappers
diff bowtie_wrapper.py @ 5:306077e393d4 draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/bowtie_wrappers commit b2e1043bf4db38be490fec298a1829f8e4a1c48e
author | devteam |
---|---|
date | Thu, 18 Aug 2016 10:20:09 -0400 |
parents | df86f29bedee |
children | 2c811e06006a |
line wrap: on
line diff
--- a/bowtie_wrapper.py Tue Jul 21 13:04:45 2015 -0400 +++ b/bowtie_wrapper.py Thu Aug 18 10:20:09 2016 -0400 @@ -2,7 +2,6 @@ """ Runs Bowtie on single-end or paired-end data. -For use with Bowtie v. 0.12.7 usage: bowtie_wrapper.py [options] -t, --threads=t: The number of threads to run @@ -13,6 +12,7 @@ --output_suppressed_reads=: File name for suppressed reads because of max setting (single-end) --output_suppressed_reads_l=: File name for suppressed reads because of max setting (left, paired-end) --output_suppressed_reads_r=: File name for suppressed reads because of max setting (right, paired-end) + --output_mapping_stats=: File name for mapping statistics (output on stderr by bowtie) -i, --input1=i: The (forward or single-end) reads file in Sanger FASTQ format -I, --input2=I: The reverse reads file in Sanger FASTQ format -4, --dataType=4: The type of data (SOLiD or Solexa) @@ -86,6 +86,7 @@ parser.add_option( '', '--output_suppressed_reads', dest='output_suppressed_reads', help='File name for suppressed reads because of max setting (single-end)' ) parser.add_option( '', '--output_suppressed_reads_l', dest='output_suppressed_reads_l', help='File name for suppressed reads because of max setting (left, paired-end)' ) parser.add_option( '', '--output_suppressed_reads_r', dest='output_suppressed_reads_r', help='File name for suppressed reads because of max setting (right, paired-end)' ) + parser.add_option( '', '--output_mapping_stats', dest='output_mapping_stats', help='File for mapping statistics (i.e. stderr from bowtie)' ) parser.add_option( '-4', '--dataType', dest='dataType', help='The type of data (SOLiD or Solexa)' ) parser.add_option( '-i', '--input1', dest='input1', help='The (forward or single-end) reads file in Sanger FASTQ format' ) parser.add_option( '-I', '--input2', dest='input2', help='The reverse reads file in Sanger FASTQ format' ) @@ -415,7 +416,7 @@ # align tmp = tempfile.NamedTemporaryFile( dir=tmp_index_dir ).name tmp_stderr = open( tmp, 'wb' ) - proc = subprocess.Popen( args=cmd2, shell=True, cwd=tmp_index_dir, stderr=tmp_stderr.fileno() ) + proc = subprocess.Popen( args=cmd2, shell=True, cwd=tmp_index_dir, stdout=sys.stdout, stderr=tmp_stderr.fileno() ) returncode = proc.wait() tmp_stderr.close() # get stderr, allowing for case where it's very large @@ -432,6 +433,10 @@ tmp_stderr.close() if returncode != 0: raise Exception, stderr + elif options.output_mapping_stats is not None: + # Write stderr (containing the mapping statistics) to a named file + with open(options.output_mapping_stats, 'w') as mapping_stats: + mapping_stats.write( stderr ) # get suppressed and unmapped reads output files in place if appropriate if options.paired == 'paired' and tmp_suppressed_file_name and \ options.output_suppressed_reads_l and options.output_suppressed_reads_r: