changeset 0:c9d76b53903a draft

Uploaded
author qfab
date Wed, 19 Mar 2014 21:35:16 -0400
parents
children fc523597d86d
files bowtie_for_fasta-254d8bd5d21a/bowtie_for_fasta_wrapper.py bowtie_for_fasta-254d8bd5d21a/bowtie_for_fasta_wrapper.xml bowtie_for_fasta-254d8bd5d21a/bowtie_indices.loc.sample bowtie_for_fasta-254d8bd5d21a/tool_data_table_conf.xml.sample bowtie_for_fasta-254d8bd5d21a/tool_dependencies.xml
diffstat 5 files changed, 621 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bowtie_for_fasta-254d8bd5d21a/bowtie_for_fasta_wrapper.py	Wed Mar 19 21:35:16 2014 -0400
@@ -0,0 +1,324 @@
+#!/usr/bin/env python
+
+import optparse, os, shutil, subprocess, sys, tempfile
+
+#Allow more than Sanger encoded variants
+DEFAULT_ASCII_ENCODING = '--phred33-quals'
+GALAXY_FORMAT_TO_QUALITY_SCORE_ENCODING_ARG = { 'fastqsanger':'--phred33-quals', 'fastqillumina':'--phred64-quals', 'fastqsolexa':'--solexa-quals' }
+#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
+
+def stop_err( msg ):
+    sys.stderr.write( '%s\n' % msg )
+    sys.exit()
+
+def __main__():
+    #Parse Command Line
+    parser = optparse.OptionParser()
+    parser.add_option( '-t', '--threads', dest='threads', help='The number of threads to run' )
+    parser.add_option( '-i', '--input1', dest='input1', help='The (forward or single-end) reads file in Sanger FASTQ format' )
+    parser.add_option( '-4', '--dataType', dest='dataType', help='The type of data (SOLiD or Solexa)' )
+    parser.add_option( '-g', '--genomeSource', dest='genomeSource', help='The type of reference provided' )
+    parser.add_option( '-r', '--ref', dest='ref', help='The reference genome to use or index' )
+    parser.add_option( '-s', '--skip', dest='skip', help='Skip the first n reads' )
+    parser.add_option( '-a', '--alignLimit', dest='alignLimit', help='Only align the first n reads' )
+    parser.add_option( '-T', '--trimH', dest='trimH', help='Trim n bases from high-quality (left) end of each read before alignment' )
+    parser.add_option( '-L', '--trimL', dest='trimL', help='Trim n bases from low-quality (right) end of each read before alignment' )
+    parser.add_option( '-m', '--mismatchSeed', dest='mismatchSeed', help='Maximum number of mismatches permitted in the seed' )
+    parser.add_option( '-M', '--mismatchQual', dest='mismatchQual', help='Maximum permitted total of quality values at mismatched read positions' )
+    parser.add_option( '-l', '--seedLen', dest='seedLen', help='Seed length' )
+    parser.add_option( '-n', '--rounding', dest='rounding', help='Whether or not to round to the nearest 10 and saturating at 30' )
+    parser.add_option( '-P', '--maqSoapAlign', dest='maqSoapAlign', help='Choose MAQ- or SOAP-like alignment policy' )
+    parser.add_option( '-w', '--tryHard', dest='tryHard', help='Whether or not to try as hard as possible to find valid alignments when they exist' )
+    parser.add_option( '-v', '--valAlign', dest='valAlign', help='Report up to n valid arguments per read' )
+    parser.add_option( '-V', '--allValAligns', dest='allValAligns', help='Whether or not to report all valid alignments per read' )
+    parser.add_option( '-G', '--suppressAlign', dest='suppressAlign', help='Suppress all alignments for a read if more than n reportable alignments exist' )
+    parser.add_option( '-b', '--best', dest='best', help="Whether or not to make Bowtie guarantee that reported singleton alignments are 'best' in terms of stratum and in terms of the quality values at the mismatched positions" )
+    parser.add_option( '-B', '--maxBacktracks', dest='maxBacktracks', help='Maximum number of backtracks permitted when aligning a read' )
+    parser.add_option( '-R', '--strata', dest='strata', help='Whether or not to report only those alignments that fall in the best stratum if many valid alignments exist and are reportable' )
+    parser.add_option( '--do_not_build_index', dest='do_not_build_index', action="store_true", default=False, help='Flag to specify that provided file is already indexed, use as is' )
+    parser.add_option( '-x', '--indexSettings', dest='index_settings', help='Whether or not indexing options are to be set' )
+    parser.add_option( '-F', '--offrate', dest='offrate', help='Override the offrate of the index to n' )
+    parser.add_option( '-u', '--iautoB', dest='iautoB', help='Automatic or specified behavior' )
+    parser.add_option( '-K', '--ipacked', dest='ipacked', help='Whether or not to use a packed representation for DNA strings' )
+    parser.add_option( '-Q', '--ibmax', dest='ibmax', help='Maximum number of suffixes allowed in a block' )
+    parser.add_option( '-Y', '--ibmaxdivn', dest='ibmaxdivn', help='Maximum number of suffixes allowed in a block as a fraction of the length of the reference' )
+    parser.add_option( '-D', '--idcv', dest='idcv', help='The period for the difference-cover sample' )
+    parser.add_option( '-U', '--inodc', dest='inodc', help='Whether or not to disable the use of the difference-cover sample' )
+    parser.add_option( '-y', '--inoref', dest='inoref', help='Whether or not to build the part of the reference index used only in paired-end alignment' )
+    parser.add_option( '-z', '--ioffrate', dest='ioffrate', help='How many rows get marked during annotation of some or all of the Burrows-Wheeler rows' )
+    parser.add_option( '-W', '--iftab', dest='iftab', help='The size of the lookup table used to calculate an initial Burrows-Wheeler range with respect to the first n characters of the query' )
+    parser.add_option( '-X', '--intoa', dest='intoa', help='Whether or not to convert Ns in the reference sequence to As' )
+    parser.add_option( '-N', '--iendian', dest='iendian', help='Endianness to use when serializing integers to the index file' )
+    parser.add_option( '-Z', '--iseed', dest='iseed', help='Seed for the pseudorandom number generator' )
+    parser.add_option( '-c', '--icutoff', dest='icutoff', help='Number of first bases of the reference')
+    parser.add_option( '-C', '--params', dest='params', help='Whether to use default or specified parameters' ) 
+    parser.add_option( '-O', '--seed', dest='seed', help='Seed for pseudo-random number generator' ) 
+    parser.add_option( '-S', '-S', dest='samformat', help='The output format' )
+    parser.add_option( '-o', '--output', dest='output', help='The output file' )
+    parser.add_option( '--galaxy_input_format', dest='galaxy_input_format', default="fasta", help='galaxy input format' )
+    (options, args) = parser.parse_args()
+    stdout = ''
+    
+    # make temp directory for placement of indices and copy reference file there if necessary
+    tmp_index_dir = tempfile.mkdtemp()
+    # get type of data (solid or solexa)
+    if options.dataType == 'solid':
+        colorspace = '-C'
+    else:
+        colorspace = ''
+	
+	    # get type of data (solid or solexa)
+    if options.samformat == 'true':
+        format = '-S'
+    else:
+        format = ''	
+		
+    # index if necessary
+    if options.genomeSource == 'history' and not options.do_not_build_index:
+        # set up commands
+        if options.index_settings =='indexPreSet':
+            indexing_cmds = '%s' % colorspace
+        else:
+            try:
+                if options.iautoB and options.iautoB == 'set':
+                    iautoB = '--noauto'
+                else:
+                    iautoB = ''
+                if options. ipacked and options.ipacked == 'packed':
+                    ipacked = '--packed'
+                else:
+                    ipacked = ''
+                if options.ibmax and int( options.ibmax ) >= 1:
+                    ibmax = '--bmax %s' % options.ibmax 
+                else:
+                    ibmax = ''
+                if options.ibmaxdivn and int( options.ibmaxdivn ) >= 0:
+                    ibmaxdivn = '--bmaxdivn %s' % options.ibmaxdivn
+                else:
+                    ibmaxdivn = ''
+                if options.idcv and int( options.idcv ) > 0:
+                    idcv = '--dcv %s' % options.idcv
+                else:
+                    idcv = ''
+                if options.inodc and options.inodc == 'nodc':
+                    inodc = '--nodc'
+                else:
+                    inodc = ''
+                if options.inoref and options.inoref == 'noref':
+                    inoref = '--noref'
+                else:
+                    inoref = ''
+                if options.iftab and int( options.iftab ) >= 0:
+                    iftab = '--ftabchars %s' % options.iftab
+                else:
+                    iftab = ''
+                if options.intoa and options.intoa == 'yes':
+                    intoa = '--ntoa'
+                else:
+                    intoa = ''
+                if options.iendian and options.iendian == 'big':
+                    iendian = '--big'
+                else:
+                    iendian = '--little'
+                if options.iseed and int( options.iseed ) > 0:
+                    iseed = '--seed %s' % options.iseed
+                else:
+                    iseed = ''
+                if options.icutoff and int( options.icutoff ) > 0:
+                    icutoff = '--cutoff %s' % options.icutoff
+                else:
+                    icutoff = ''
+                indexing_cmds = '%s %s %s %s %s %s %s --offrate %s %s %s %s %s %s %s' % \
+                                ( iautoB, ipacked, ibmax, ibmaxdivn, idcv, inodc, 
+                                  inoref, options.ioffrate, iftab, intoa, iendian, 
+                                  iseed, icutoff, colorspace )
+            except ValueError, e:
+                # clean up temp dir
+                if os.path.exists( tmp_index_dir ):
+                    shutil.rmtree( tmp_index_dir )
+                stop_err( "Something is wrong with the indexing parameters and the indexing and alignment could not be run. Make sure you don't have any non-numeric values where they should be numeric.\n" + str( e ) )
+        ref_file = tempfile.NamedTemporaryFile( dir=tmp_index_dir )
+        ref_file_name = ref_file.name
+        ref_file.close()
+        os.symlink( options.ref, ref_file_name )
+
+        cmd1 = 'bowtie-build %s -f %s %s' % ( indexing_cmds, ref_file_name, ref_file_name )
+	
+        try:
+            tmp = tempfile.NamedTemporaryFile( dir=tmp_index_dir ).name
+            tmp_stderr = open( tmp, 'wb' )
+            proc = subprocess.Popen( args=cmd1, shell=True, cwd=tmp_index_dir, stderr=tmp_stderr.fileno() )
+            returncode = proc.wait()
+            tmp_stderr.close()
+            # get stderr, allowing for case where it's very large
+            tmp_stderr = open( tmp, 'rb' )
+            stderr = ''
+            buffsize = 1048576
+            try:
+                while True:
+                    stderr += tmp_stderr.read( buffsize )
+                    if not stderr or len( stderr ) % buffsize != 0:
+                        break
+            except OverflowError:
+                pass
+            tmp_stderr.close()
+            if returncode != 0:
+                raise Exception, stderr
+        except Exception, e:
+            # clean up temp dir
+            if os.path.exists( tmp_index_dir ):
+                shutil.rmtree( tmp_index_dir )
+            stop_err( 'Error indexing reference sequence\n' + str( e ) )
+        stdout += 'File indexed. '
+    else:
+
+        ref_file_name = options.ref
+    # set up aligning and generate aligning command options
+    # automatically set threads in both cases
+    tmp_suppressed_file_name = None
+    tmp_unmapped_file_name = None
+    quality_score_encoding = GALAXY_FORMAT_TO_QUALITY_SCORE_ENCODING_ARG.get( options.galaxy_input_format, DEFAULT_ASCII_ENCODING )
+
+    try:
+     if options.mismatchSeed and (options.mismatchSeed == '0' or options.mismatchSeed == '1' \
+	or options.mismatchSeed == '2' or options.mismatchSeed == '3'):
+	 mismatchSeed = '-n %s' % options.mismatchSeed
+     else:
+	 mismatchSeed = ''
+     if options.mismatchQual and int( options.mismatchQual ) >= 0:
+       mismatchQual = '-e %s' % options.mismatchQual
+     else:
+       mismatchQual = ''
+     print "seedLen is %s" % options.seedLen
+     if options.seedLen and int( options.seedLen ) >= 5:
+       print "seedLen1 is %s" % options.seedLen
+       seedLen = '-l %s' % options.seedLen
+     else:
+       print "seedLen2 is %s" % options.seedLen
+       seedLen = ''
+     if options.valAlign and int( options.valAlign ) >= 0:
+       valAlign = '-k %s' % options.valAlign
+     else:
+       valAlign = ''
+     if options.suppressAlign and int( options.suppressAlign ) >= 0:
+       suppressAlign = '-m %s' % options.suppressAlign
+     else:
+       suppressAlign = ''
+    except ValueError, e:
+    # clean up temp dir
+      if os.path.exists( tmp_index_dir ):
+        shutil.rmtree( tmp_index_dir )
+      stop_err( 'Something is wrong \n' + str( e ) )
+    if options.params:
+        aligning_cmds = '-f -p %s -S %s %s %s %s %s %s ' % \
+                (options.threads, mismatchSeed,mismatchQual,seedLen,valAlign,suppressAlign,
+		 quality_score_encoding )
+    else:
+        try:
+            if options.skip and int( options.skip ) > 0:
+                skip = '-s %s' % options.skip
+            else:
+                skip = ''
+            if options.alignLimit and int( options.alignLimit ) >= 0:
+                alignLimit = '-u %s' % options.alignLimit
+            else:
+                alignLimit = ''
+            if options.trimH and int( options.trimH ) > 0:
+                trimH = '-5 %s' % options.trimH
+            else:
+                trimH = ''
+            if options.trimL and int( options.trimL ) > 0:
+                trimL = '-3 %s' % options.trimL
+            else:
+                trimL = ''
+            if int(options.maqSoapAlign) != '-1' and int(options.maqSoapAlign) >= '0':
+                maqSoapAlign = '-v %s' % options.maqSoapAlign
+            else:
+                maqSoapAlign = ''
+            if options.rounding == 'noRound':
+                rounding = '--nomaqround'
+            else:
+                rounding = ''
+            if options.maxBacktracks and int( options.maxBacktracks ) > 0 and \
+                    ( options.mismatchSeed == '2' or options.mismatchSeed == '3' ):
+                maxBacktracks = '--maxbts %s' % options.maxBacktracks
+            else:
+                maxBacktracks = ''
+            if options.tryHard == 'doTryHard':
+                tryHard = '-y'
+            else:
+                tryHard = ''
+            if options.valAlign and int( options.valAlign ) >= 0:
+                valAlign = '-k %s' % options.valAlign
+            else:
+                valAlign = ''
+            if options.allValAligns == 'doAllValAligns':
+                allValAligns = '-a'
+            else:
+                allValAligns = ''
+            if options.best == 'doBest':
+                best = '--best'
+            else:
+                best = ''
+            if options.strata == 'doStrata':
+                strata = '--strata'
+            else:
+                strata = ''
+            if options.offrate and int( options.offrate ) >= 0:
+                offrate = '-o %s' % options.offrate
+            else:
+                offrate = ''
+            if options.seed and int( options.seed ) > 0:
+              seed = '--seed %s' % options.seed
+            else:
+              iseed = ''
+	    aligning_cmds = '-f -p %s %s %s %s %s %s %s %s %s %s %s %s ' \
+                            '%s %s %s %s %s %s %s %s' % \
+                            ( options.threads, skip, alignLimit, 
+                              trimH, trimL, maqSoapAlign,mismatchSeed, mismatchQual, seedLen, rounding,
+                              maxBacktracks,tryHard, valAlign, allValAligns, suppressAlign, best,
+                              strata, offrate,seed, quality_score_encoding )
+        except ValueError, e:
+         # clean up temp dir
+           if os.path.exists( tmp_index_dir ):
+             shutil.rmtree( tmp_index_dir )
+           stop_err( 'Something is wrong with the alignment parameters and the alignment could not be run\n' + str( e ) )
+ 
+       # have to nest try-except in try-finally to handle 2.4
+    try:
+      # prepare actual mapping commands
+      cmd2 = 'bowtie %s %s %s > %s' % ( aligning_cmds, ref_file_name, options.input1, options.output)
+      print(cmd2)
+      # 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() )
+      returncode = proc.wait()
+      tmp_stderr.close()
+      # get stderr, allowing for case where it's very large
+      tmp_stderr = open( tmp, 'rb' )
+      stderr = ''
+      buffsize = 1048576
+      try:
+        while True:
+          stderr += tmp_stderr.read( buffsize )
+          if not stderr or len( stderr ) % buffsize != 0:
+            break
+      except OverflowError:
+        pass
+      tmp_stderr.close()
+      if returncode != 0:
+        raise Exception, stderr
+      # check that there are results in the output file
+      if 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, e:
+      stop_err( 'Error aligning sequence. ' + str( e ) )
+    finally:
+        # clean up temp dir
+        if os.path.exists( tmp_index_dir ):
+            shutil.rmtree( tmp_index_dir )
+    stdout += 'Sequence file aligned.\n'
+    sys.stdout.write( stdout )
+
+if __name__=="__main__": __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bowtie_for_fasta-254d8bd5d21a/bowtie_for_fasta_wrapper.xml	Wed Mar 19 21:35:16 2014 -0400
@@ -0,0 +1,248 @@
+<tool id="bowtie_for_fasta_wrapper" name="Map with Bowtie for Fasta" version="1.1.2">
+  <requirements>
+    <requirement type='package' version="0.12.7">bowtie</requirement>
+  </requirements>
+  <description>Fasta File</description>
+  <parallelism method="basic"></parallelism>
+  <command interpreter="python">
+  bowtie_for_fasta_wrapper.py
+  ## Hackish setting of number of threads
+    --threads="4"
+  ## Output  
+  #if str( $outformat) == "sam":
+    -S "true"
+    --output "${samoutput}"
+  #else:
+    -S "false"
+    --output "${taboutput}"
+  #end if
+
+
+##    #if $output_unmapped_reads_l
+##      --output_unmapped_reads="${output_unmapped_reads_l}"
+##    #end if
+##    #if $output_suppressed_reads_l
+##      --output_suppressed_reads="${output_suppressed_reads_l}"
+##    #end if
+##      --galaxy_input_format="${singlePaired.sInput1.ext}"
+  ## Inputs
+  --dataType="solexa" ##this indicates that nucleotide base space is used in the wrapper
+##  --suppressHeader="${suppressHeader}"
+  --genomeSource="${refGenomeSource.genomeSource}"
+  #if $refGenomeSource.genomeSource == "history":
+    ##index already exists
+    #if $refGenomeSource.ownFile.extension.startswith( 'bowtie_' ):
+      ##user previously built
+      --ref="${refGenomeSource.ownFile.extra_files_path}/${refGenomeSource.ownFile.metadata.base_name}"
+      --do_not_build_index
+    #else:
+      ##build index on the fly
+      --ref="${refGenomeSource.ownFile}"
+      --indexSettings="${refGenomeSource.indexParams.indexSettings}"
+      #if $refGenomeSource.indexParams.indexSettings == "indexFull":
+        --iautoB="${refGenomeSource.indexParams.autoBehavior.autoB}"
+        #if $refGenomeSource.indexParams.autoBehavior.autoB == "set":
+          --ipacked="${refGenomeSource.indexParams.autoBehavior.packed}"
+          --ibmax="${refGenomeSource.indexParams.autoBehavior.bmax}"
+          --ibmaxdivn="${refGenomeSource.indexParams.autoBehavior.bmaxdivn}"
+          --idcv="${refGenomeSource.indexParams.autoBehavior.dcv}"
+        #end if
+        --inodc="${refGenomeSource.indexParams.nodc}"
+        --inoref="${refGenomeSource.indexParams.noref}"
+        --ioffrate="${refGenomeSource.indexParams.offrate}"
+        --iftab="${refGenomeSource.indexParams.ftab}"
+        --intoa="${refGenomeSource.indexParams.ntoa}"
+        --iendian="${refGenomeSource.indexParams.endian}"
+        --iseed="${refGenomeSource.indexParams.seed}"
+        --icutoff="${refGenomeSource.indexParams.cutoff}"
+      #end if
+    #end if
+  #else
+    ##use pre-built index
+    --ref="${refGenomeSource.index.fields.path}"
+  #end if
+  --input1="${sInput1}"
+  --params="${Params.sSettingsType}"
+  --mismatchQual="${sMismatchQual}"
+  --mismatchSeed="${sMismatchSeed}"
+  --seedLen="${sSeedLen}"
+  --suppressAlign="${sSuppressAlign}"
+  --valAlign="${sValAlign}"
+  #unless $Params.sSettingsType:
+     --skip="${Params.sSkip}"
+     --alignLimit="${Params.sAlignLimit}"
+     --trimH="${Params.sTrimH}"
+     --trimL="${Params.sTrimL}"
+     --rounding="${Params.sRounding}"
+     --maqSoapAlign="${Params.sMaqSoapAlign}"
+     --tryHard="${Params.sTryHard}"
+     --best="${Params.sBestOption.sBest}"
+     #if $Params.sBestOption.sBest == "doBest":
+       --maxBacktracks="${Params.sBestOption.sdMaxBacktracks}"
+       --strata="${Params.sBestOption.sdStrata}"
+     #else:
+     --maxBacktracks="${Params.sBestOption.snMaxBacktracks}"
+     #end if
+     --offrate="${Params.sOffrate}"
+     --seed="${Params.sSeed}"
+  #end unless
+  </command>
+  <inputs>
+    <conditional name="refGenomeSource">
+      <param name="genomeSource" type="select" label="Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options">
+        <option value="indexed">Use a built-in index</option>
+        <option value="history">Use one from the history</option>
+      </param>
+      <when value="indexed">
+        <param name="index" type="select" label="Select a reference genome" help="if your genome of interest is not listed - contact Galaxy team">
+          <options from_data_table="bowtie_indexes">
+            <filter type="sort_by" column="2" />
+            <validator type="no_options" message="No indexes are available" />
+          </options>
+        </param>
+      </when>
+      <when value="history">
+        <param name="ownFile" type="data" format="bowtie_base_index,fasta" metadata_name="dbkey" 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>
+            <option value="indexFull">Set your own</option>
+          </param> 
+          <when value="indexPreSet" />
+          <when value="indexFull">
+            <conditional name="autoBehavior">
+              <param name="autoB" type="select" label="Choose to use automatic or specified behavior for some parameters (-a)" help="Allows you to set --packed, --bmax, --bmaxdivn, and --dcv">
+                <option value="auto">Automatic behavior</option>
+                <option value="set">Set values (sets --noauto and allows others to be set)</option>
+              </param>
+              <when value="auto" />
+              <when value="set">
+                <param name="packed" type="select" label="Whether or not to use a packed representation for DNA strings (--packed)">
+                  <option value="unpacked">Use regular representation</option>
+                  <option value="packed">Use packed representation</option>
+                </param>
+                <param name="bmax" type="integer" value="-1" label="Maximum number of suffixes allowed in a block (--bmax)" help="-1 for not specified. Must be at least 1" />
+                <param name="bmaxdivn" type="integer" value="4" label="Maximum number of suffixes allowed in a block as a fraction of the length of the reference (--bmaxdivn)" />
+                <param name="dcv" type="integer" value="1024" label="The period for the difference-cover sample (--dcv)" />
+              </when>
+            </conditional>
+            <param name="nodc" type="select" label="Whether or not to disable the use of the difference-cover sample (--nodc)" help="Suffix sorting becomes quadratic-time in the worst case (with a very repetitive reference)">
+              <option value="dc">Use difference-cover sample</option>
+              <option value="nodc">Disable difference-cover sample</option>
+            </param>
+            <param name="noref" type="select" label="Whether or not to build the part of the reference index used only in paired-end alignment (-r)">
+              <option value="ref">Build all index files</option>
+              <option value="noref">Do not build paired-end alignment index files</option>
+            </param>
+            <param name="offrate" type="integer" value="5" label="How many rows get marked during annotation of some or all of the Burrows-Wheeler rows (-o)" />
+            <param name="ftab" type="integer" value="10" label="The size of the lookup table used to calculate an initial Burrows-Wheeler range with respect to the first n characters of the query (-t)" help="ftab is 4^(n+1) bytes" />
+            <param name="ntoa" type="select" label="Whether or not to convert Ns in the reference sequence to As (--ntoa)">
+              <option value="no">Do not convert Ns</option>
+              <option value="yes">Convert Ns to As</option>
+            </param>
+            <param name="endian" type="select" label="Endianness to use when serializing integers to the index file (--big/--little)" help="Little is most appropriate for Intel- and AMD-based architecture">
+              <option value="little">Little</option>
+              <option value="big">Big</option>
+            </param> 
+            <param name="seed" type="integer" value="-1" label="Seed for the pseudorandom number generator (--seed)" help="Use -1 to use default" />
+            <param name="cutoff" type="integer" value="-1" label="Number of first bases of the reference sequence to index (--cutoff)" help="Use -1 to use default" />
+          </when>  <!-- indexFull -->
+        </conditional>  <!-- indexParams -->
+      </when>  <!-- history -->
+    </conditional>  <!-- refGenomeSource -->
+    <param name="sInput1" type="data" format="fasta" label="FASTA file" />
+    <param name="sMismatchSeed" type="integer" value="2" label="Maximum number of mismatches permitted in the seed (-n)" help="May be 0, 1, 2, or 3" />
+    <param name="sSuppressAlign" type="integer" value="-1" label="Suppress all alignments for a read if more than n reportable alignments exist (-m)" help="-1 for no limit" />
+    <param name="sValAlign" type="integer" value="1" label="Report up to n valid alignments per read (-k)" />
+    <param name="sSeedLen" type="integer" value="28" label="Seed length (-l)" help="Minimum value is 5" />
+    <param name="sMismatchQual" type="integer" value="70" label="Maximum permitted total of quality values at mismatched read positions (-e)" />
+    <param name="outformat" size="" type="select" label="Output format">
+      <option value="tab">TABULAR</option>
+      <option value="sam">SAM</option>
+    </param>
+
+    <conditional name="Params">
+     <param name="sSettingsType" type="boolean" checked="true" label="Default settings to use" help="For most mapping needs use Commonly used settings. If you want full control uncheck this box"/>
+    <when value="true"></when>
+    <when value="false">
+    <param name="sSkip" type="integer" value="0" label="Skip the first n reads (-s)" />
+    <param name="sAlignLimit" type="integer" value="-1" label="Only align the first n reads (-u)" help="-1 for off" />
+    <param name="sTrimH" type="integer" value="0" label="Trim n bases from high-quality (left) end of each read before alignment (-5)" />
+    <param name="sTrimL" type="integer" value="0" label="Trim n bases from low-quality (right) end of each read before alignment (-3)" />
+    <param name="sRounding" type="select" label="Whether or not to round to the nearest 10 and saturating at 30 (--nomaqround)">
+	<option value="round">Round to nearest 10</option>
+        <option value="noRound">Do not round to nearest 10</option>
+    </param>
+    <param name="sMaqSoapAlign" type="integer" value="-1" label="Number of mismatches for SOAP-like alignment policy (-v)" help="-1 for default MAQ-like alignment policy" />
+    <param name="sTryHard" type="select" label="Whether or not to try as hard as possible to find valid alignments when they exist (-y)" help="Tryhard mode is much slower than regular mode">
+      <option value="noTryHard">Do not try hard</option>
+      <option value="doTryHard">Try hard</option>
+    </param>
+    <param name="sAllValAligns" type="select" label="Whether or not to report all valid alignments per read (-a)">
+      <option value="noAllValAligns">Do not report all valid alignments</option>
+      <option value="doAllValAligns">Report all valid alignments</option>
+    </param>
+    <param name="sMaxFile" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write all reads with a number of valid alignments exceeding the limit set with the -m option to a file (--max)" />
+    <param name="sUnmappedFile" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write all reads that could not be aligned to a file (--un)" />
+      <conditional name="sBestOption">
+        <param name="sBest" type="select" label="Whether or not to make Bowtie guarantee that reported singleton alignments are 'best' in terms of stratum and in terms of the quality values at the mismatched positions (--best)" help="Removes all strand bias. Only affects which alignments are reported by Bowtie. Runs slower with best option">
+        <option value="noBest">Do not use best</option>
+        <option value="doBest">Use best</option>
+        </param>
+        <when value="noBest">
+          <param name="snMaxBacktracks" type="integer" value="125" label="Maximum number of backtracks permitted when aligning a read (--maxbts)" />
+        </when>
+        <when value="doBest">
+          <param name="sdMaxBacktracks" type="integer" value="800" label="Maximum number of backtracks permitted when aligning a read (--maxbts)" />
+          <param name="sdStrata" type="select" label="Whether or not to report only those alignments that fall in the best stratum if many valid alignments exist and are reportable (--strata)">
+          <option value="noStrata">Do not use strata option</option>
+          <option value="doStrata">Use strata option</option>
+          </param>
+        </when>
+      </conditional> <!-- bestOption -->
+      <param name="sOffrate" type="integer" value="-1" label="Override the offrate of the index to n (-o)" help="-1 for default" />
+      <param name="sSeed" type="integer" value="-1" label="Seed for pseudo-random number generator (--seed)" help="-1 for default" />
+      </when> <!-- full -->
+    </conditional>
+  </inputs>
+  <outputs>        
+    <data format="sam" name="samoutput" label="${tool.name} on ${on_string}: SAM">
+    <filter>outformat == "sam"</filter>
+      <actions>
+        <conditional name="refGenomeSource.genomeSource">
+          <when value="indexed">
+            <action type="metadata" name="dbkey">
+              <option type="from_data_table" name="bowtie_indexes" column="1" offset="0">
+                <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/>
+                <filter type="param_value" ref="refGenomeSource.index" column="0"/>
+              </option>
+            </action>
+          </when>
+          <when value="history">
+            <action type="metadata" name="dbkey">
+              <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" />
+            </action>
+          </when>
+        </conditional>
+      </actions>
+    </data>
+    <data format="tabular" name="taboutput" label="${tool.name} on ${on_string}: TAB">
+    <filter>outformat == "tab"</filter>
+        <conditional name="refGenomeSource.genomeSource">
+          <when value="indexed">
+            <action type="metadata" name="dbkey">
+              <option type="from_data_table" name="bowtie_indexes" column="1" offset="0">
+                <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/>
+                <filter type="param_value" ref="refGenomeSource.index" column="0"/>
+              </option>
+            </action>
+          </when>
+          <when value="history">
+            <action type="metadata" name="dbkey">
+              <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" />
+            </action>
+          </when>
+        </conditional>
+    </data>
+  </outputs>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bowtie_for_fasta-254d8bd5d21a/bowtie_indices.loc.sample	Wed Mar 19 21:35:16 2014 -0400
@@ -0,0 +1,37 @@
+#This is a sample file distributed with Galaxy that enables tools
+#to use a directory of Bowtie indexed sequences data files. You will
+#need to create these data files and then create a bowtie_indices.loc
+#file similar to this one (store it in this directory) that points to
+#the directories in which those files are stored. The bowtie_indices.loc
+#file has this format (longer white space characters are TAB characters):
+#
+#<unique_build_id>   <dbkey>   <display_name>   <file_base_path>
+#
+#So, for example, if you had hg18 indexed stored in
+#/depot/data2/galaxy/bowtie/hg18/,
+#then the bowtie_indices.loc entry would look like this:
+#
+#hg18	hg18	hg18	/depot/data2/galaxy/bowtie/hg18/hg18
+#
+#and your /depot/data2/galaxy/bowtie/hg18/ directory
+#would contain hg18.*.ebwt files:
+#
+#-rw-r--r--  1 james    universe 830134 2005-09-13 10:12 hg18.1.ebwt
+#-rw-r--r--  1 james    universe 527388 2005-09-13 10:12 hg18.2.ebwt
+#-rw-r--r--  1 james    universe 269808 2005-09-13 10:12 hg18.3.ebwt
+#...etc...
+#
+#Your bowtie_indices.loc file should include an entry per line for each
+#index set you have stored. The "file" in the path does not actually
+#exist, but it is the prefix for the actual index files. For example:
+#
+#hg18canon			hg18	hg18 Canonical	/depot/data2/galaxy/bowtie/hg18/hg18canon
+#hg18full			hg18	hg18 Full		/depot/data2/galaxy/bowtie/hg18/hg18full
+#/orig/path/hg19	hg19	hg19			/depot/data2/galaxy/bowtie/hg19/hg19
+#...etc...
+#
+#Note that for backwards compatibility with workflows, the unique ID of
+#an entry must be the path that was in the original loc file, because that
+#is the value stored in the workflow for that parameter. That is why the
+#hg19 entry above looks odd. New genomes can be better-looking.
+#
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bowtie_for_fasta-254d8bd5d21a/tool_data_table_conf.xml.sample	Wed Mar 19 21:35:16 2014 -0400
@@ -0,0 +1,8 @@
+<!-- Use the file tool_data_table_conf.xml.oldlocstyle if you don't want to update your loc files as changed in revision 4550:535d276c92bc-->
+<tables>
+    <!-- Locations of indexes in the Bowtie mapper format -->
+    <table name="bowtie_indexes" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/bowtie_indices.loc" />
+    </table>
+</tables>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bowtie_for_fasta-254d8bd5d21a/tool_dependencies.xml	Wed Mar 19 21:35:16 2014 -0400
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<repositories description="Bowtie for fasta requieres Bowtie to be installed.">
+     <repository toolshed="http://toolshed.g2.bx.psu.edu" name="bowtie" owner="devteam" changeset_revision="e1c59c194b7b" />
+</repositories>