Previous changeset 6:ecbbc8be6266 (2017-01-08) Next changeset 8:b46e7d48076a (2017-05-15) |
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/bowtie_wrappers commit 397bc85634156862fdaa3d74b8f1e53752876619 |
modified:
bowtie_wrapper.py bowtie_wrapper.xml |
b |
diff -r ecbbc8be6266 -r 2c811e06006a bowtie_wrapper.py --- a/bowtie_wrapper.py Sun Jan 08 08:01:08 2017 -0500 +++ b/bowtie_wrapper.py Thu May 04 14:59:54 2017 -0400 |
b |
b'@@ -64,19 +64,24 @@\n --do_not_build_index: Flag to specify that provided file is already indexed and to just use \'as is\'\n """\n \n-import optparse, os, shutil, subprocess, sys, tempfile\n+import optparse\n+import os\n+import shutil\n+import subprocess\n+import sys\n+import tempfile\n \n-#Allow more than Sanger encoded variants\n+# Allow more than Sanger encoded variants\n DEFAULT_ASCII_ENCODING = \'--phred33-quals\'\n-GALAXY_FORMAT_TO_QUALITY_SCORE_ENCODING_ARG = { \'fastqsanger\':\'--phred33-quals\', \'fastqillumina\':\'--phred64-quals\', \'fastqsolexa\':\'--solexa-quals\' }\n-#FIXME: Integer quality scores are supported only when the \'--integer-quals\' argument is specified to bowtie; this is not currently able to be set in the tool/wrapper/config\n+GALAXY_FORMAT_TO_QUALITY_SCORE_ENCODING_ARG = {\'fastqsanger\': \'--phred33-quals\', \'fastqillumina\': \'--phred64-quals\', \'fastqsolexa\': \'--solexa-quals\'}\n+# FIXME: Integer quality scores are supported only when the \'--integer-quals\' argument is specified to bowtie; this is not currently able to be set in the tool/wrapper/config\n+\n \n def stop_err( msg ):\n- sys.stderr.write( \'%s\\n\' % msg )\n- sys.exit()\n+ sys.exit(\'%s\\n\' % msg)\n+\n \n def __main__():\n- #Parse Command Line\n parser = optparse.OptionParser()\n parser.add_option( \'-t\', \'--threads\', dest=\'threads\', help=\'The number of threads to run\' )\n parser.add_option( \'-o\', \'--output\', dest=\'output\', help=\'The output file\' )\n@@ -152,7 +157,7 @@\n # index if necessary\n if options.genomeSource == \'history\' and not options.do_not_build_index:\n # set up commands\n- if options.index_settings ==\'indexPreSet\':\n+ if options.index_settings == \'indexPreSet\':\n indexing_cmds = \'%s\' % colorspace\n else:\n try:\n@@ -204,7 +209,7 @@\n ( iautoB, ipacked, ibmax, ibmaxdivn, idcv, inodc,\n inoref, options.ioffrate, iftab, intoa, iendian,\n iseed, colorspace )\n- except ValueError, e:\n+ except ValueError as e:\n # clean up temp dir\n if os.path.exists( tmp_index_dir ):\n shutil.rmtree( tmp_index_dir )\n@@ -216,25 +221,22 @@\n cmd1 = \'bowtie-build %s -f %s %s\' % ( indexing_cmds, ref_file_name, ref_file_name )\n try:\n tmp = tempfile.NamedTemporaryFile( dir=tmp_index_dir ).name\n- tmp_stderr = open( tmp, \'wb\' )\n- proc = subprocess.Popen( args=cmd1, shell=True, cwd=tmp_index_dir, stderr=tmp_stderr.fileno() )\n- returncode = proc.wait()\n- tmp_stderr.close()\n- # get stderr, allowing for case where it\'s very large\n- tmp_stderr = open( tmp, \'rb\' )\n- stderr = \'\'\n- buffsize = 1048576\n- try:\n- while True:\n- stderr += tmp_stderr.read( buffsize )\n- if not stderr or len( stderr ) % buffsize != 0:\n- break\n- except OverflowError:\n- pass\n- tmp_stderr.close()\n+ with open(tmp, \'w\') as tmp_stderr:\n+ returncode = subprocess.call(args=cmd1, shell=True, cwd=tmp_index_dir, stderr=tmp_stderr.fileno())\n if returncode != 0:\n- raise Exception, stderr\n- except Exception, e:\n+ # get stderr, allowing for case where it\'s very large\n+ stderr = \'\'\n+ buffsize = 1048576\n+ with open(tmp, \'r\') as tmp_stderr:\n+ try:\n+ while True:\n+ stderr += tmp_stderr.read(buffsize)\n+ if not stderr or len(stderr) % buffsize != 0:\n+ break\n+ except OverflowError:\n+ pass\n+ raise Exception(stderr)\n+ except Exception as e:\n # clean up temp dir\n '..b' # align\n tmp = tempfile.NamedTemporaryFile( dir=tmp_index_dir ).name\n- tmp_stderr = open( tmp, \'wb\' )\n- proc = subprocess.Popen( args=cmd2, shell=True, cwd=tmp_index_dir, stdout=sys.stdout, stderr=tmp_stderr.fileno() )\n- returncode = proc.wait()\n- tmp_stderr.close()\n+ with open(tmp, \'w\') as tmp_stderr:\n+ returncode = subprocess.call(args=cmd2, shell=True, cwd=tmp_index_dir, stderr=tmp_stderr.fileno())\n # get stderr, allowing for case where it\'s very large\n- tmp_stderr = open( tmp, \'rb\' )\n stderr = \'\'\n buffsize = 1048576\n- try:\n- while True:\n- stderr += tmp_stderr.read( buffsize )\n- if not stderr or len( stderr ) % buffsize != 0:\n- break\n- except OverflowError:\n- pass\n- tmp_stderr.close()\n+ with open(tmp, \'r\') as tmp_stderr:\n+ try:\n+ while True:\n+ stderr += tmp_stderr.read(buffsize)\n+ if not stderr or len(stderr) % buffsize != 0:\n+ break\n+ except OverflowError:\n+ pass\n if returncode != 0:\n- raise Exception, stderr\n+ raise Exception(stderr)\n elif options.output_mapping_stats is not None:\n # Write stderr (containing the mapping statistics) to a named file\n with open(options.output_mapping_stats, \'w\') as mapping_stats:\n mapping_stats.write( stderr )\n # get suppressed and unmapped reads output files in place if appropriate\n if options.paired == \'paired\' and tmp_suppressed_file_name and \\\n- options.output_suppressed_reads_l and options.output_suppressed_reads_r:\n+ options.output_suppressed_reads_l and options.output_suppressed_reads_r:\n try:\n left = tmp_suppressed_file_name.replace( \'.fastq\', \'_1.fastq\' )\n right = tmp_suppressed_file_name.replace( \'.fastq\', \'_1.fastq\' )\n shutil.move( left, options.output_suppressed_reads_l )\n shutil.move( right, options.output_suppressed_reads_r )\n- except Exception, e:\n+ except Exception as e:\n sys.stdout.write( \'Error producing the suppressed output file.\\n\' )\n if options.paired == \'paired\' and tmp_unmapped_file_name and \\\n- options.output_unmapped_reads_l and options.output_unmapped_reads_r:\n+ options.output_unmapped_reads_l and options.output_unmapped_reads_r:\n try:\n left = tmp_unmapped_file_name.replace( \'.fastq\', \'_1.fastq\' )\n right = tmp_unmapped_file_name.replace( \'.fastq\', \'_2.fastq\' )\n shutil.move( left, options.output_unmapped_reads_l )\n shutil.move( right, options.output_unmapped_reads_r )\n- except Exception, e:\n+ except Exception as e:\n sys.stdout.write( \'Error producing the unmapped output file.\\n\' )\n # check that there are results in the output file\n if os.path.getsize( options.output ) == 0:\n- raise Exception, \'The output file is empty, there may be an error with your input file or settings.\'\n- except Exception, e:\n+ raise Exception(\'The output file is empty, there may be an error with your input file or settings.\')\n+ except Exception as e:\n stop_err( \'Error aligning sequence. \' + str( e ) )\n finally:\n # clean up temp dir\n@@ -468,5 +467,6 @@\n stdout += \'Sequence file aligned.\\n\'\n sys.stdout.write( stdout )\n \n+\n if __name__ == "__main__":\n __main__()\n' |
b |
diff -r ecbbc8be6266 -r 2c811e06006a bowtie_wrapper.xml --- a/bowtie_wrapper.xml Sun Jan 08 08:01:08 2017 -0500 +++ b/bowtie_wrapper.xml Thu May 04 14:59:54 2017 -0400 |
b |
@@ -1,8 +1,8 @@ <tool id="bowtie_wrapper" name="Map with Bowtie for Illumina" version="1.2.0"> + <description></description> <requirements> <requirement type="package" version="1.2.0">bowtie</requirement> </requirements> - <description></description> <version_command>bowtie --version</version_command> <command> python '$__tool_directory__/bowtie_wrapper.py' @@ -167,7 +167,7 @@ </param> </when> <when value="history"> - <param name="ownFile" type="data" format="bowtie_base_index,fasta" metadata_name="dbkey" label="Select the reference genome" /> + <param name="ownFile" type="data" format="bowtie_base_index,fasta" label="Select the reference genome" /> <conditional name="indexParams"> <param name="indexSettings" type="select" label="Choose whether to use Default options for building indices or to Set your own" help="These settings are ignored when using a prebuilt index"> <option value="indexPreSet">Default</option> @@ -313,7 +313,7 @@ <when value="paired"> <param name="pInput1" type="data" format="fastqsanger,fastqillumina,fastqsolexa" label="Forward FASTQ file" help="Must have ASCII encoded quality scores"/> <param name="pInput2" type="data" format="fastqsanger,fastqillumina,fastqsolexa" label="Reverse FASTQ file" help="File format must match the Forward FASTQ file"> - <options options_filter_attribute="ext" from_parameter="tool.app.datatypes_registry.datatypes_by_extension" transform_lines="obj.keys()">> + <options options_filter_attribute="ext" from_parameter="tool.app.datatypes_registry.datatypes_by_extension" transform_lines="obj.keys()"> <column name="name" index="0"/> <column name="value" index="0"/> <filter type="param_value" ref="pInput1" ref_attribute="ext" column="0"/> |