text:
<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>
  <version_command>bowtie --version</version_command>
  <command>
    python '$__tool_directory__/bowtie_wrapper.py'
      ## Set number of threads
      --threads="\${GALAXY_SLOTS:-4}"
      ## Outputs
      --output="${output}"
      #if str( $singlePaired.sPaired ) == "single"
        #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}"
      #else
        #if $output_unmapped_reads_l and $output_unmapped_reads_r
          --output_unmapped_reads_l="${output_unmapped_reads_l}"
          --output_unmapped_reads_r="${output_unmapped_reads_r}"
        #end if
        #if $output_suppressed_reads_l and $output_suppressed_reads_l
          --output_suppressed_reads_l="${output_suppressed_reads_l}"
          --output_suppressed_reads_r="${output_suppressed_reads_r}"
        #end if
        --galaxy_input_format="${singlePaired.pInput1.ext}"
      #end if
      ## 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}"
          #end if
        #end if
      #else
        ##use pre-built index
        --ref="${refGenomeSource.index.fields.path}"
      #end if
      --paired="${singlePaired.sPaired}"
      #if $singlePaired.sPaired == "single":
        --input1="${singlePaired.sInput1}"
        --params="${singlePaired.sParams.sSettingsType}"
        #if $singlePaired.sParams.sSettingsType == "full":
          --skip="${singlePaired.sParams.sSkip}"
          --alignLimit="${singlePaired.sParams.sAlignLimit}"
          --trimH="${singlePaired.sParams.sTrimH}"
          --trimL="${singlePaired.sParams.sTrimL}"
          #if $singlePaired.sParams.alignModeOption.alignMode == 'nMode'
            --mismatchSeed="${singlePaired.sParams.alignModeOption.sMismatchSeed}"
            --mismatchQual="${singlePaired.sParams.alignModeOption.sMismatchQual}"
            --seedLen="${singlePaired.sParams.alignModeOption.sSeedLen}"
            --rounding="${singlePaired.sParams.alignModeOption.sRounding}"
          #else
            --maxMismatches="${singlePaired.sParams.alignModeOption.maxMismatches}"
          #end if
          --forwardAlign="${singlePaired.sParams.sForwardAlign}"
          --reverseAlign="${singlePaired.sParams.sReverseAlign}"
          --tryHard="${singlePaired.sParams.sBestOption.sTryHardOption.sTryHard}"
          --allValAligns="${singlePaired.sParams.sAllValAlignsOption.sAllValAligns}"
          #if $singlePaired.sParams.sAllValAlignsOption.sAllValAligns == "noAllValAligns"
            --valAlign="${singlePaired.sParams.sAllValAlignsOption.sValAlign}"
          #end if
          --suppressAlign="${singlePaired.sParams.sSuppressAlign}"
          --best="${singlePaired.sParams.sBestOption.sBest}"
          #if $singlePaired.sParams.sBestOption.sBest == "doBest":
            --strata="${singlePaired.sParams.sBestOption.sdStrata}"
            #if $singlePaired.sParams.sBestOption.sTryHardOption.sTryHard == "noTryHard"
              --maxBacktracks="${singlePaired.sParams.sBestOption.sTryHardOption.sdMaxBacktracks}"
            #end if
          #else:
            #if $singlePaired.sParams.sBestOption.sTryHardOption.sTryHard == "noTryHard"
              --maxBacktracks="${singlePaired.sParams.sBestOption.sTryHardOption.snMaxBacktracks}"
            #end if
          #end if
          --offrate="${singlePaired.sParams.sOffrate}"
          --seed="${singlePaired.sParams.sSeed}"
        #end if
      #else:
        --input1="${singlePaired.pInput1}"
        --input2="${singlePaired.pInput2}"
        --maxInsert="${singlePaired.pMaxInsert}"
        --mateOrient="${singlePaired.pMateOrient}"
        --params="${singlePaired.pParams.pSettingsType}"
        #if $singlePaired.pParams.pSettingsType == "full":
          --skip="${singlePaired.pParams.pSkip}"
          --alignLimit="${singlePaired.pParams.pAlignLimit}"
          --trimH="${singlePaired.pParams.pTrimH}"
          --trimL="${singlePaired.pParams.pTrimL}"
          #if $singlePaired.pParams.alignModeOption.alignMode == 'nMode'
            --mismatchSeed="${singlePaired.pParams.alignModeOption.pMismatchSeed}"
            --mismatchQual="${singlePaired.pParams.alignModeOption.pMismatchQual}"
            --seedLen="${singlePaired.pParams.alignModeOption.pSeedLen}"
            --rounding="${singlePaired.pParams.alignModeOption.pRounding}"
          #else
            --maxMismatches="${singlePaired.pParams.alignModeOption.maxMismatches}"
          #end if
          --minInsert="${singlePaired.pParams.pMinInsert}"
          --forwardAlign="${singlePaired.pParams.pForwardAlign}"
          --reverseAlign="${singlePaired.pParams.pReverseAlign}"
          --tryHard="${singlePaired.pParams.pBestOption.pTryHardOption.pTryHard}"
          --allValAligns="${singlePaired.pParams.pAllValAlignsOption.pAllValAligns}"
          #if $singlePaired.pParams.pAllValAlignsOption.pAllValAligns == "noAllValAligns"
            --valAlign="${singlePaired.pParams.pAllValAlignsOption.pValAlign}"
          #end if
          --suppressAlign="${singlePaired.pParams.pSuppressAlign}"
          --best="${singlePaired.pParams.pBestOption.pBest}"
          #if $singlePaired.pParams.pBestOption.pBest == "doBest":
            --strata="${singlePaired.pParams.pBestOption.pdStrata}"
            #if $singlePaired.pParams.pBestOption.pTryHardOption.pTryHard == "noTryHard"
              --maxAlignAttempt="${singlePaired.pParams.pBestOption.pTryHardOption.pMaxAlignAttempt}"
              --maxBacktracks="${singlePaired.pParams.pBestOption.pTryHardOption.pdMaxBacktracks}"
            #end if
          #else:
            #if $singlePaired.pParams.pBestOption.pTryHardOption.pTryHard == "noTryHard"
              --maxAlignAttempt="${singlePaired.pParams.pBestOption.pTryHardOption.pMaxAlignAttempt}"
              --maxBacktracks="${singlePaired.pParams.pBestOption.pTryHardOption.pnMaxBacktracks}"
            #end if
          #end if
          --offrate="${singlePaired.pParams.pOffrate}"
          --seed="${singlePaired.pParams.pSeed}"
        #end if
      #end if
      #if $save_mapping_stats
        --output_mapping_stats="$mapping_stats"
      #end if
  </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" 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)" help="Packed representation saves memory but makes indexing 2-3 times slower">
                  <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" min="3" label="The period for the difference-cover sample (--dcv)" help="A larger period yields less memory overhead, but may make suffix sorting slower, especially if repeats are present" />
              </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" min="0" label="The indexer will mark every 2^n Burrows-Wheeler rows with their corresponding location on the genome (-o)" help="Marking more rows makes reference-position lookups faster, but requires more memory to hold the annotations at runtime" />
            <param name="ftab" type="integer" value="10" min="1" label="The size of the ftab lookup table used to calculate an initial Burrows-Wheeler range with respect to the first n characters of the query (-t)" help="ftab size 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" />
          </when>  <!-- indexFull -->
        </conditional>  <!-- indexParams -->
      </when>  <!-- history -->
    </conditional>  <!-- refGenomeSource -->
    <conditional name="singlePaired">
      <param name="sPaired" type="select" label="Is this library mate-paired?">
        <option value="single">Single-end</option>
        <option value="paired">Paired-end</option>
      </param>
      <when value="single">
        <param name="sInput1" type="data" format="fastqsanger,fastqillumina,fastqsolexa" label="FASTQ file" help="Must have ASCII encoded quality scores"/>
        <conditional name="sParams">
          <param name="sSettingsType" type="select" label="Bowtie settings to use" help="For most mapping needs use Commonly used settings. If you want full control use Full parameter list">
            <option value="preSet">Commonly used</option>
            <option value="full">Full parameter list</option>
          </param>
          <when value="preSet" />
          <when value="full">
            <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)" />
            <conditional name="alignModeOption">
              <param name="alignMode" type="select" label="Alignment mode">
                <option value="nMode">Maq-like: quality-aware, limit mismatches in seed (-n)</option>
                <option value="vMode">ignore qualities, limit end-to-end mismatches (-v)</option>
              </param>
              <when value="nMode">
                <param name="sMismatchSeed" type="integer" value="2" min="0" max="3" label="Maximum number of mismatches permitted in the seed (-n)" help="May be 0, 1, 2, or 3" />
                <param name="sMismatchQual" type="integer" value="70" min="1" label="Maximum permitted total of quality values at all mismatched read positions (-e)" />
                <param name="sSeedLen" type="integer" value="28" min="5" label="Seed length (-l)" help="Minimum value is 5" />
                <param name="sRounding" type="select" label="Whether or not to round to the nearest 10 and saturating at 30 (--nomaqround)" help="Maq accepts quality values in the Phred quality scale, but internally rounds values to the nearest 10, with a maximum of 30. By default, bowtie also rounds this way">
                  <option value="round">Round to nearest 10</option>
                  <option value="noRound">Do not round to nearest 10</option>
                </param>
              </when>
              <when value="vMode">
                <param name="maxMismatches" type="integer" value="" min="0" max="3" label="Maximum number of mismatches (-v)" help="May be 0, 1, 2, or 3" />
              </when>
            </conditional>
            <param name="sForwardAlign" type="select" label="Choose whether or not to attempt to align against the forward reference strand (--nofw)">
              <option value="forward">Align against the forward reference strand</option>
              <option value="noForward">Do not align against the forward reference strand</option>
            </param>
            <param name="sReverseAlign" type="select" label="Choose whether or not to attempt to align against the reverse-complement reference strand (--norc)">
              <option value="reverse">Align against the reverse-complement reference strand</option>
              <option value="noReverse">Do not align against the reverse-complement reference strand</option>
            </param>
            <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">
                <conditional name="sTryHardOption">
                  <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>
                  <when value="noTryHard">
                    <param name="snMaxBacktracks" type="integer" value="125" min="0" label="Maximum number of backtracks permitted when aligning a read (--maxbts)" />
                  </when>
                  <when value="doTryHard" />
                </conditional>
              </when>
              <when value="doBest">
                <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>
                <conditional name="sTryHardOption">
                  <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>
                  <when value="noTryHard">
                    <param name="sdMaxBacktracks" type="integer" value="800" min="0" label="Maximum number of backtracks permitted when aligning a read (--maxbts)" />
                  </when>
                  <when value="doTryHard" />
                </conditional>
              </when>
            </conditional> <!-- bestOption -->
            <conditional name="sAllValAlignsOption">
              <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>
              <when value="noAllValAligns">
                <param name="sValAlign" type="integer" value="1" min="1" label="Report up to n valid alignments per read (-k)" />
              </when>
              <when value="doAllValAligns" />
            </conditional>
            <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="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)" />
            <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> <!-- sParams -->
      </when> <!-- single -->
      <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()">
               <column name="name" index="0"/>
               <column name="value" index="0"/>
               <filter type="param_value" ref="pInput1" ref_attribute="ext" column="0"/>
           </options>
        </param>
        <param name="pMaxInsert" type="integer" value="1000" label="Maximum insert size for valid paired-end alignments (-X)" />
        <param name="pMateOrient" type="select" label="The upstream/downstream mate orientation for valid paired-end alignment against the forward reference strand (--fr/--rf/--ff)">
          <option value="fr">FR (for Illumina)</option>
          <option value="rf">RF</option>
          <option value="ff">FF (for SOLiD)</option>
        </param>
        <conditional name="pParams">
          <param name="pSettingsType" type="select" label="Bowtie settings to use" help="For most mapping needs use Commonly used settings. If you want full control use Full parameter list">
            <option value="preSet">Commonly used</option>
            <option value="full">Full parameter list</option>
          </param>
          <when value="preSet" />
          <when value="full">
            <param name="pSkip" type="integer" value="0" label="Skip the first n pairs (-s)" />
            <param name="pAlignLimit" type="integer" value="-1" label="Only align the first n pairs (-u)" help="-1 for off" />
            <param name="pTrimH" type="integer" value="0" label="Trim n bases from high-quality (left) end of each read before alignment (-5)" />
            <param name="pTrimL" type="integer" value="0" label="Trim n bases from low-quality (right) end of each read before alignment (-3)" />
            <conditional name="alignModeOption">
              <param name="alignMode" type="select" label="Alignment mode">
                <option value="nMode">Maq-like: quality-aware, limit mismatches in seed (-n)</option>
                <option value="vMode">ignore qualities, limit end-to-end mismatches (-v)</option>
              </param>
              <when value="nMode">
                <param name="pMismatchSeed" type="integer" value="2" min="0" max="3" label="Maximum number of mismatches permitted in the seed (-n)" help="May be 0, 1, 2, or 3" />
                <param name="pMismatchQual" type="integer" value="70" min="1" label="Maximum permitted total of quality values at all mismatched read positions (-e)" />
                <param name="pSeedLen" type="integer" value="28" min="5" label="Seed length (-l)" help="Minimum value is 5" />
                <param name="pRounding" type="select" label="Whether or not to round to the nearest 10 and saturating at 30 (--nomaqround)" help="Maq accepts quality values in the Phred quality scale, but internally rounds values to the nearest 10, with a maximum of 30. By default, bowtie also rounds this way">
                  <option value="round">Round to nearest 10</option>
                  <option value="noRound">Do not round to nearest 10</option>
                </param>
              </when>
              <when value="vMode">
                <param name="maxMismatches" type="integer" value="" min="0" max="3" label="Maximum number of mismatches (-v)" help="May be 0, 1, 2, or 3" />
              </when>
            </conditional>
            <param name="pMinInsert" type="integer" value="0" label="Minimum insert size for valid paired-end alignments (-I)" />
            <param name="pForwardAlign" type="select" label="Choose whether or not to attempt to align against the forward reference strand (--nofw)">
              <option value="forward">Align against the forward reference strand</option>
              <option value="noForward">Do not align against the forward reference strand</option>
            </param>
            <param name="pReverseAlign" type="select" label="Choose whether or not to attempt to align against the reverse-complement reference strand (--norc)">
              <option value="reverse">Align against the reverse-complement reference strand</option>
              <option value="noReverse">Do not align against the reverse-complement reference strand</option>
            </param>
            <conditional name="pBestOption">
              <param name="pBest" 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">
                <conditional name="pTryHardOption">
                  <param name="pTryHard" 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>
                  <when value="noTryHard">
                    <param name="pMaxAlignAttempt" type="integer" value="100" min="1" label="Maximum number of attempts Bowtie will make to match an alignment for one mate with an alignment for the opposite mate (--pairtries)" />
                    <param name="pnMaxBacktracks" type="integer" value="125" min="0" label="Maximum number of backtracks permitted when aligning a read (--maxbts)" />
                  </when>
                  <when value="doTryHard" />
                </conditional>
              </when>
              <when value="doBest">
                <param name="pdStrata" 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>
                <conditional name="pTryHardOption">
                  <param name="pTryHard" 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>
                  <when value="noTryHard">
                    <param name="pMaxAlignAttempt" type="integer" value="100" min="1" label="Maximum number of attempts Bowtie will make to match an alignment for one mate with an alignment for the opposite mate (--pairtries)" />
                    <param name="pdMaxBacktracks" type="integer" value="800" min="0" label="Maximum number of backtracks permitted when aligning a read (--maxbts)" />
                  </when>
                  <when value="doTryHard" />
                </conditional>
              </when>
            </conditional>
            <conditional name="pAllValAlignsOption">
              <param name="pAllValAligns" type="select" label="Whether or not to report all valid alignments per pair (-a)">
                <option value="noAllValAligns">Do not report all valid alignments</option>
                <option value="doAllValAligns">Report all valid alignments</option>
              </param>
              <when value="noAllValAligns">
                <param name="pValAlign" type="integer" value="1" min="1" label="Report up to n valid alignments per pair (-k)" />
              </when>
              <when value="doAllValAligns" />
            </conditional>
            <param name="pSuppressAlign" type="integer" value="-1" label="Suppress all alignments for a pair if more than n reportable alignments exist (-m)" help="-1 for no limit" />
            <param name="pMaxFile" 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="pUnmappedFile" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write all reads that could not be aligned to a file (--un)" />
            <param name="pOffrate" type="integer" value="-1" label="Override the offrate of the index to n (-o)" help="-1 for default" />
            <param name="pSeed" type="integer" value="-1" label="Seed for pseudo-random number generator (--seed)" help="-1 for default" />
          </when> <!-- full -->
        </conditional> <!-- pParams -->
      </when> <!-- paired -->
    </conditional> <!-- singlePaired -->
    <param name="save_mapping_stats" type="boolean" checked="False" label="Save the bowtie mapping statistics to the history" />
    <param name="suppressHeader" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Suppress the header in the output SAM file (--sam-nohead)" help="Bowtie produces SAM with several lines of header information by default" />
  </inputs>
  <outputs>
    <data format="sam" name="output" label="${tool.name} on ${on_string}: mapped reads">
      <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="txt" name="mapping_stats" label="${tool.name} on ${on_string}: mapping stats">
      <filter>save_mapping_stats is True</filter>
    </data>
    <data format="fastq" name="output_suppressed_reads_l" label="${tool.name} on ${on_string}: suppressed reads (L)">
      <filter>((
          singlePaired['sPaired'] == "single" and
          singlePaired['sParams']['sSettingsType'] == "full" and
          singlePaired['sParams']['sMaxFile'] is True
        ) or (
          singlePaired['sPaired'] == "paired" and
          singlePaired['pParams']['pSettingsType'] == "full" and
          singlePaired['pParams']['pMaxFile'] is True
        ))
      </filter>
      <actions>
        <conditional name="singlePaired.sPaired">
          <when value="single">
            <action type="format">
              <option type="from_param" name="singlePaired.sInput1" param_attribute="ext" />
            </action>
          </when>
          <when value="paired">
            <action type="format">
              <option type="from_param" name="singlePaired.pInput1" param_attribute="ext" />
            </action>
          </when>
        </conditional>
      </actions>
    </data>
    <data format="fastq" name="output_suppressed_reads_r" label="${tool.name} on ${on_string}: suppressed reads (R)">
      <filter>singlePaired['sPaired'] == "paired"</filter>
      <filter>singlePaired['pParams']['pSettingsType'] == "full"</filter>
      <filter>singlePaired['pParams']['pMaxFile'] is True</filter>
      <actions>
        <conditional name="singlePaired.sPaired">
          <when value="single">
            <action type="format">
              <option type="from_param" name="singlePaired.sInput1" param_attribute="ext" />
            </action>
          </when>
          <when value="paired">
            <action type="format">
              <option type="from_param" name="singlePaired.pInput1" param_attribute="ext" />
            </action>
          </when>
        </conditional>
      </actions>
    </data>
    <data format="fastq" name="output_unmapped_reads_l" label="${tool.name} on ${on_string}: unmapped reads (L)">
      <filter>
        ((
          singlePaired['sPaired'] == "single" and
          singlePaired['sParams']['sSettingsType'] == "full" and
          singlePaired['sParams']['sUnmappedFile'] is True
        ) or (
          singlePaired['sPaired'] == "paired" and
          singlePaired['pParams']['pSettingsType'] == "full" and
          singlePaired['pParams']['pUnmappedFile'] is True
        ))
      </filter>
      <actions>
        <conditional name="singlePaired.sPaired">
          <when value="single">
            <action type="format">
              <option type="from_param" name="singlePaired.sInput1" param_attribute="ext" />
            </action>
          </when>
          <when value="paired">
            <action type="format">
              <option type="from_param" name="singlePaired.pInput1" param_attribute="ext" />
            </action>
          </when>
        </conditional>
      </actions>
    </data>
    <data format="fastq" name="output_unmapped_reads_r" label="${tool.name} on ${on_string}: unmapped reads (R)">
      <filter>singlePaired['sPaired'] == "paired"</filter>
      <filter>singlePaired['pParams']['pSettingsType'] == "full"</filter>
      <filter>singlePaired['pParams']['pUnmappedFile'] is True</filter>
      <actions>
        <conditional name="singlePaired.sPaired">
          <when value="single">
            <action type="format">
              <option type="from_param" name="singlePaired.sInput1" param_attribute="ext" />
            </action>
          </when>
          <when value="paired">
            <action type="format">
              <option type="from_param" name="singlePaired.pInput1" param_attribute="ext" />
            </action>
          </when>
        </conditional>
      </actions>
    </data>
  </outputs>
  <tests>
    <test>
      <!--
      Bowtie command:
      bowtie -q -p 4 -S +sam-nohead chrM_base test-data/bowtie_in2.fastqsanger > bowtie_out6_u.sam
      sort bowtie_out6_u.sam > bowtie_out6.sam
      -p is the number of threads. You need to replace the + with 2 dashes.
      chrM_base needs to be the base location/name of the index files.
      -->
      <param name="genomeSource" value="indexed" />
      <!-- this is the backwards-compatible "unique value" for this index, not an actual path -->
      <param name="index" value="equCab2chrM" />
      <param name="sPaired" value="single" />
      <param name="sInput1" ftype="fastqsanger" value="bowtie_in2.fastqsanger" />
      <param name="sSettingsType" value="preSet" />
      <param name="suppressHeader" value="true" />
      <output name="output" ftype="sam" file="bowtie_out6.sam" sort="True">
        <metadata name="dbkey" value="equCab2" />
      </output>
    </test>
    <test>
      <!--
      Bowtie command:
      bowtie-build -f test-data/phiX.fasta phiX_base
      bowtie -q -X 1000 +ff -p 4 -S +sam-nohead -n 2 -e 70 -l 28 +pairtries 100 +maxbts 800 +best +un bowtie_out8_u.fastq phiX_base -1 test-data/bowtie_in5.fastqsanger -2 test-data/bowtie_in6.fastqsanger > bowtie_out7_u.sam
      sort bowtie_out7_u.sam > bowtie_out7.sam
      sort bowtie_out8_u_1.sam > bowtie_out8_1.sam
      sort bowtie_out8_u_2.sam > bowtie_out8_2.sam
      Then also need to modify bowtie_out8_1.sam and bowtie_out8_2.sam so that all @ lines come before sequence lines.
      -p is the number of threads. You need to replace the + with 2 dashes.
      The two unmapped output files will be named bowtie_out8_1.fastq and bowtie_out8_2.fastq.
      chrM_base is the index files' location/base name.
      -->
      <param name="genomeSource" value="history" />
      <param name="ownFile" value="phiX.fasta" />
      <param name="indexSettings" value="indexPreSet" />
      <param name="sPaired" value="paired" />
      <param name="pInput1" ftype="fastqsanger" value="bowtie_in5.fastqsanger" />
      <param name="pInput2" ftype="fastqsanger" value="bowtie_in6.fastqsanger" />
      <param name="pMaxInsert" value="1000" />
      <param name="pMateOrient" value="ff" />
      <param name="pSettingsType" value="full" />
      <param name="pSkip" value="0" />
      <param name="pAlignLimit" value="-1" />
      <param name="pTrimH" value="0" />
      <param name="pTrimL" value="0" />
      <param name="alignMode" value="nMode" />
      <param name="pMismatchSeed" value="2" />
      <param name="pMismatchQual" value="70" />
      <param name="pSeedLen" value="28" />
      <param name="pRounding" value="round" />
      <param name="pMinInsert" value="0" />
      <param name="pMaxAlignAttempt" value="100" />
      <param name="pForwardAlign" value="forward" />
      <param name="pReverseAlign" value="reverse" />
      <param name="pTryHard" value="noTryHard" />
      <param name="pValAlign" value="1" />
      <param name="pAllValAligns" value="noAllValAligns" />
      <param name="pSuppressAlign" value="-1" />
      <param name="pUnmappedFile" value="true" />
      <param name="pMaxFile" value="false" />
      <param name="pBest" value="doBest" />
      <param name="pdMaxBacktracks" value="800" />
      <param name="pdStrata" value="noStrata" />
      <param name="pOffrate" value="-1" />
      <param name="pSeed" value="-1" />
      <param name="suppressHeader" value="true" />
      <output name="output" ftype="sam" file="bowtie_out7.sam" sort="True" />
      <output name="output_unmapped_reads_l" ftype="fastqsanger" file="bowtie_out8_1.fastq" sort="True" />
      <output name="output_unmapped_reads_r" ftype="fastqsanger" file="bowtie_out8_2.fastq" sort="True" />
    </test>
    <!-- start testing of non-sanger variant fastq reads -->
    <test>
      <param name="genomeSource" value="history" />
      <param name="ownFile" value="phiX.fasta" />
      <param name="indexSettings" value="indexPreSet" />
      <param name="sPaired" value="paired" />
      <param name="pInput1" ftype="fastqillumina" value="bowtie_in5.fastqillumina" />
      <param name="pInput2" ftype="fastqillumina" value="bowtie_in6.fastqillumina" />
      <param name="pMaxInsert" value="1000" />
      <param name="pMateOrient" value="ff" />
      <param name="pSettingsType" value="full" />
      <param name="pSkip" value="0" />
      <param name="pAlignLimit" value="-1" />
      <param name="pTrimH" value="0" />
      <param name="pTrimL" value="0" />
      <param name="alignMode" value="nMode" />
      <param name="pMismatchSeed" value="2" />
      <param name="pMismatchQual" value="70" />
      <param name="pSeedLen" value="28" />
      <param name="pRounding" value="round" />
      <param name="pMinInsert" value="0" />
      <param name="pMaxAlignAttempt" value="100" />
      <param name="pForwardAlign" value="forward" />
      <param name="pReverseAlign" value="reverse" />
      <param name="pTryHard" value="noTryHard" />
      <param name="pValAlign" value="1" />
      <param name="pAllValAligns" value="noAllValAligns" />
      <param name="pSuppressAlign" value="-1" />
      <param name="pUnmappedFile" value="true" />
      <param name="pMaxFile" value="false" />
      <param name="pBest" value="doBest" />
      <param name="pdMaxBacktracks" value="800" />
      <param name="pdStrata" value="noStrata" />
      <param name="pOffrate" value="-1" />
      <param name="pSeed" value="-1" />
      <param name="suppressHeader" value="true" />
      <output name="output" ftype="sam" file="bowtie_out7.sam" sort="True" />
      <output name="output_unmapped_reads_l" ftype="fastqillumina" file="bowtie_out8_1.fastqillumina.sorted" sort="True" />
      <output name="output_unmapped_reads_r" ftype="fastqillumina" file="bowtie_out8_2.fastqillumina.sorted" sort="True" />
    </test>
    <test>
      <param name="genomeSource" value="history" />
      <param name="ownFile" value="phiX.fasta" />
      <param name="indexSettings" value="indexPreSet" />
      <param name="sPaired" value="paired" />
      <param name="pInput1" ftype="fastqsolexa" value="bowtie_in5.fastqsolexa" />
      <param name="pInput2" ftype="fastqsolexa" value="bowtie_in6.fastqsolexa" />
      <param name="pMaxInsert" value="1000" />
      <param name="pMateOrient" value="ff" />
      <param name="pSettingsType" value="full" />
      <param name="pSkip" value="0" />
      <param name="pAlignLimit" value="-1" />
      <param name="pTrimH" value="0" />
      <param name="pTrimL" value="0" />
      <param name="alignMode" value="nMode" />
      <param name="pMismatchSeed" value="2" />
      <param name="pMismatchQual" value="70" />
      <param name="pSeedLen" value="28" />
      <param name="pRounding" value="round" />
      <param name="pMinInsert" value="0" />
      <param name="pMaxAlignAttempt" value="100" />
      <param name="pForwardAlign" value="forward" />
      <param name="pReverseAlign" value="reverse" />
      <param name="pTryHard" value="noTryHard" />
      <param name="pValAlign" value="1" />
      <param name="pAllValAligns" value="noAllValAligns" />
      <param name="pSuppressAlign" value="-1" />
      <param name="pUnmappedFile" value="true" />
      <param name="pMaxFile" value="false" />
      <param name="pBest" value="doBest" />
      <param name="pdMaxBacktracks" value="800" />
      <param name="pdStrata" value="noStrata" />
      <param name="pOffrate" value="-1" />
      <param name="pSeed" value="-1" />
      <param name="suppressHeader" value="true" />
      <output name="output" ftype="sam" file="bowtie_out7.sam" sort="True" />
      <output name="output_unmapped_reads_l" ftype="fastqsolexa" file="bowtie_out8_1.fastqsolexa.sorted" sort="True" />
      <output name="output_unmapped_reads_r" ftype="fastqsolexa" file="bowtie_out8_2.fastqsolexa.sorted" sort="True" />
    </test>
    <!-- end testing of non-sanger variant fastq reads -->
    <test>
      <!--
      Bowtie command:
      bowtie -q -p 4 -S +sam-nohead -n 2 -e 70 -l 28 -y -k 1 chrM_base test-data/bowtie_in2.fastqsanger > bowtie_out9_u.sam
      sort bowtie_out9_u.sam > bowtie_out9.sam
      -p is the number of threads. You need to replace the + with 2 dashes.
      chrM_base is the index files' location/base name.
      -->
      <param name="genomeSource" value="indexed" />
      <!-- this is the backwards-compatible "unique value" for this index, not an actual path -->
      <param name="index" value="equCab2chrM" />
      <param name="sPaired" value="single" />
      <param name="sInput1" ftype="fastqsanger" value="bowtie_in2.fastqsanger" />
      <param name="sSettingsType" value="full" />
      <param name="sSkip" value="0" />
      <param name="sAlignLimit" value="-1" />
      <param name="sTrimH" value="0" />
      <param name="sTrimL" value="0" />
      <param name="alignMode" value="nMode" />
      <param name="sMismatchSeed" value="2" />
      <param name="sMismatchQual" value="70" />
      <param name="sSeedLen" value="28" />
      <param name="sRounding" value="round" />
      <param name="sForwardAlign" value="forward" />
      <param name="sReverseAlign" value="reverse" />
      <param name="sTryHard" value="doTryHard" />
      <param name="sValAlign" value="1" />
      <param name="sAllValAligns" value="noAllValAligns" />
      <param name="sSuppressAlign" value="-1" />
      <param name="sUnmappedFile" value="false" />
      <param name="sMaxFile" value="false" />
      <param name="sBest" value="noBest" />
      <param name="sOffrate" value="-1" />
      <param name="sSeed" value="-1" />
      <param name="suppressHeader" value="true" />
      <output name="output" ftype="sam" file="bowtie_out9.sam" sort="True">
        <metadata name="dbkey" value="equCab2" />
      </output>
    </test>
    <test>
      <!--
      Bowtie command:
      bowtie-build +offrate 5 +ftabchars 10 +little -f test-data/phiX.fasta phiX_base
      bowtie -q -X 1000 +ff -p 4 -S +sam-nohead phiX_base -1 test-data/bowtie_in5.fastqsanger -2 test-data/bowtie_in6.fastqsanger > bowtie_out10_u.sam
      sort bowtie_out10_u.sam > bowtie_out10.sam
      -p is the number of threads. You need to replace the + with 2 dashes.
      chrM_base is the index files' location/base name.
      -->
      <param name="genomeSource" value="history" />
      <param name="ownFile" value="phiX.fasta" />
      <param name="indexSettings" value="indexFull" />
      <param name="autoB" value="auto" />
      <param name="nodc" value="dc" />
      <param name="noref" value="ref" />
      <param name="offrate" value="5" />
      <param name="ftab" value="10" />
      <param name="ntoa" value="no" />
      <param name="endian" value="little" />
      <param name="seed" value="-1" />
      <param name="sPaired" value="paired" />
      <param name="pInput1" ftype="fastqsanger" value="bowtie_in5.fastqsanger" />
      <param name="pInput2" ftype="fastqsanger" value="bowtie_in6.fastqsanger" />
      <param name="pMaxInsert" value="1000" />
      <param name="pMateOrient" value="ff" />
      <param name="pSettingsType" value="preSet" />
      <param name="suppressHeader" value="true" />
      <output name="output" ftype="sam" file="bowtie_out10.sam" sort="True" />
    </test>
    <test>
      <!--
      Bowtie command:
      bowtie-build +offrate 5 +ftabchars 10 +little -f test-data/phiX.fasta phiX_base
      bowtie -q -X 1000 +ff -p 4 -S +sam-nohead phiX_base -1 test-data/bowtie_in5.fastqsanger -2 test-data/bowtie_in6.fastqsanger > bowtie_out10_u.sam
      sort bowtie_out10_u.sam > bowtie_out10.sam
      -p is the number of threads. You need to replace the + with 2 dashes.
      chrM_base is the index files' location/base name.
      -->
      <param name="genomeSource" value="history" />
      <param name="ownFile" value="phiX.fasta" />
      <param name="indexSettings" value="indexFull" />
      <param name="autoB" value="auto" />
      <param name="nodc" value="dc" />
      <param name="noref" value="ref" />
      <param name="offrate" value="5" />
      <param name="ftab" value="10" />
      <param name="ntoa" value="no" />
      <param name="endian" value="little" />
      <param name="seed" value="-1" />
      <param name="sPaired" value="paired" />
      <param name="pInput1" ftype="fastqsanger" value="bowtie_in5.fastqsanger" />
      <param name="pInput2" ftype="fastqsanger" value="bowtie_in6.fastqsanger" />
      <param name="pMaxInsert" value="1000" />
      <param name="pMateOrient" value="ff" />
      <param name="pSettingsType" value="preSet" />
      <param name="suppressHeader" value="true" />
      <param name="save_mapping_stats" value="true" />
      <output name="output" ftype="sam" file="bowtie_out10.sam" sort="True" />
      <output name="mapping_stats" ftype="txt" file="bowtie_out11.txt" sort="True" />
    </test>
  </tests>

  <help>

**What it does**

Bowtie_ is a short read aligner designed to be ultrafast and memory-efficient. It is developed by Ben Langmead and Cole Trapnell. Please cite: Langmead B, Trapnell C, Pop M, Salzberg SL. Ultrafast and memory-efficient alignment of short DNA sequences to the human genome. Genome Biology 10:R25.

.. _Bowtie: http://bowtie-bio.sourceforge.net/index.shtml

------

**Know what you are doing**

.. class:: warningmark

There is no such thing (yet) as an automated gearshift in short read mapping. It is all like stick-shift driving in San Francisco. In other words = running this tool with default parameters will probably not give you meaningful results. A way to deal with this is to **understand** the parameters by carefully reading the `documentation`__ and experimenting. Fortunately, Galaxy makes experimenting easy.

 .. __: http://bowtie-bio.sourceforge.net/index.shtml

------

**Input formats**

Bowtie accepts files in Sanger FASTQ format. Use the FASTQ Groomer to prepare your files.

------

**A Note on Built-in Reference Genomes**

The default variant for all genomes is "Full", defined as all primary chromosomes (or scaffolds/contigs) including mitochondrial plus associated unmapped, plasmid, and other segments. When only one version of a genome is available in this tool, it represents the default "Full" variant. Some genomes will have more than one variant available. The "Canonical Male" or sometimes simply "Canonical" variant contains the primary chromosomes for a genome. For example a human "Canonical" variant contains chr1-chr22, chrX, chrY, and chrM. The "Canonical Female" variant contains the primary chromosomes excluding chrY.

------

**Outputs**

The output is in SAM format, and has the following columns::

    Column  Description
  --------  --------------------------------------------------------
   1 QNAME  Query (pair) NAME
   2 FLAG   bitwise FLAG
   3 RNAME  Reference sequence NAME
   4 POS    1-based leftmost POSition/coordinate of clipped sequence
   5 MAPQ   MAPping Quality (Phred-scaled)
   6 CIGAR  extended CIGAR string
   7 MRNM   Mate Reference sequence NaMe ('=' if same as RNAME)
   8 MPOS   1-based Mate POSition
   9 ISIZE  Inferred insert SIZE
  10 SEQ    query SEQuence on the same strand as the reference
  11 QUAL   query QUALity (ASCII-33 gives the Phred base quality)
  12 OPT    variable OPTional fields in the format TAG:VTYPE:VALUE

The flags are as follows::

    Flag  Description
  ------  -------------------------------------
  0x0001  the read is paired in sequencing
  0x0002  the read is mapped in a proper pair
  0x0004  the query sequence itself is unmapped
  0x0008  the mate is unmapped
  0x0010  strand of the query (1 for reverse)
  0x0020  strand of the mate
  0x0040  the read is the first read in a pair
  0x0080  the read is the second read in a pair
  0x0100  the alignment is not primary

It looks like this (scroll sideways to see the entire example)::

  QNAME	FLAG	RNAME	POS	MAPQ	CIAGR	MRNM	MPOS	ISIZE	SEQ	QUAL	OPT
  HWI-EAS91_1_30788AAXX:1:1:1761:343	4	*	0	0	*	*	0	0	AAAAAAANNAAAAAAAAAAAAAAAAAAAAAAAAAAACNNANNGAGTNGNNNNNNNGCTTCCCACAGNNCTGG	hhhhhhh;;hhhhhhhhhhh^hOhhhhghhhfhhhgh;;h;;hhhh;h;;;;;;;hhhhhhghhhh;;Phhh
  HWI-EAS91_1_30788AAXX:1:1:1578:331	4	*	0	0	*	*	0	0	GTATAGANNAATAAGAAAAAAAAAAATGAAGACTTTCNNANNTCTGNANNNNNNNTCTTTTTTCAGNNGTAG	hhhhhhh;;hhhhhhhhhhhhhhhhhhhhhhhhhhhh;;h;;hhhh;h;;;;;;;hhhhhhhhhhh;;hhVh

-------

**Bowtie settings**

All of the options have a default value. You can change any of them. Most of the options in Bowtie have been implemented here.

------

**Bowtie parameter list**

This is an exhaustive list of Bowtie options:

For indexing (bowtie-build)::

  -a                 No auto behavior. Disable the default behavior where bowtie automatically
                     selects values for --bmax/--bmaxdivn/--dcv/--packed parameters according
                     to the memory available. [off]
  --packed           Packing. Use a packed representation for DNA strings. [auto]
  --bmax INT         Suffix maximum. The maximum number of suffixes allowed in a block. [auto]
  --bmaxdivn INT     Suffix maximum fraction. The maximum number of suffixes allowed in a block
                     expressed as a fraction of the length of the reference. [4]
  --dcv INT          Difference-cover sample. Use INT as the period for the difference-cover
                     sample. [1024]
  --nodc INT         No difference-cover sample. Disable the difference-cover sample. [off]
  -r                 No reference indexes. Do not build the NAME.3.ebwt and NAME.4.ebwt portions
                     of the index. Used only for paired-end alignment. [off]
  -o                 Offrate. How many Burrows-Wheeler rows get marked by the indexer. The
                     indexer will mark every 2^INT rows. The marked rows correspond to rows on
                     the genome. [5]
  -t INT             The ftab lookup table used to calculate an initial Burrows-Wheeler range
                     with respect to the first INT characters of the query. Ftab size is 4^(INT+1)
                     bytes. [10]
  --ntoa             N conversion. Convert Ns to As before building the index. Otherwise, Ns are
                     simply excluded from the index and Bowtie will not find alignments that
                     overlap them. [off]
  --big              Endianness. Endianness to use when serializing integers to the index file. [off]
  --little           Endianness. [--little]
  --seed INT         Random seed. Use INT as the seed for the pseudo-random number generator. [off]

For aligning (bowtie)::

  -s INT             Skip. Do not align the first INT reads or pairs in the input. [off]
  -u INT             Align limit. Only align the first INT reads/pairs from the input. [no limit]
  -5 INT             High-quality trim. Trim INT bases from the high-quality (left) end of each
                     read before alignment. [0]
  -3 INT             Low-quality trim. Trim INT bases from the low-quality (right) end of each
                     read before alignment. [0]
  -n INT             Mismatch seed. Maximum number of mismatches permitted in the seed (defined
                     with seed length option). Can be 0, 1, 2, or 3. [2]
  -e INT             Mismatch quality. Maximum permitted total of quality values at mismatched
                     read positions. Bowtie rounds quality values to the nearest 10 and saturates
                     at 30. [70]
  -l INT             Seed length. The number of bases on the high-quality end of the read to
                     which the -n ceiling applies. Must be at least 5. [28]
  --nomaqround       Suppress Maq rounding. Values are internally rounded to the nearest 10 and
                     saturate at 30. This options turns off that rounding. [off]
  -v INT             Maq- or SOAP-like alignment policy. This option turns off the default
                     Maq-like alignment policy in favor of a SOAP-like one. End-to-end alignments
                     with at most INT mismatches. [off]
  -I INT             Minimum insert. The minimum insert size for valid paired-end alignments.
                     Does checking on untrimmed reads if -5 or -3 is used. [0]
  -X INT             Maximum insert. The maximum insert size for valid paired-end alignments.
                     Does checking on untrimmed reads if -5 or -3 is used. [250]
  --fr               Mate orientation. The upstream/downstream mate orientations for a valid
                     paired-end alignment against the forward reference strand. [--fr]
  --rf               Mate orientation. [off]
  --ff               Mate orientation. [off]
  --pairtries INT    Maximum alignment attempts for paired-end data. [100]
  --nofw             No forward aligning. Choosing this option means that Bowtie will not attempt
                     to align against the forward reference strand. [off]
  --norc             No reverse-complement aligning. Setting this will mean that Bowtie will not
                     attempt to align against the reverse-complement reference strand. [off]
  --un FILENAME      Write all reads that could not be aligned to file [off]
  --max FILENAME     Write all reads with a number of valid alignments exceeding the limit
                     set with the -m option to file [off]
  --maxbts INT       Maximum backtracks. The maximum number of backtracks permitted when aligning
                     a read in -n 2 or -n 3 mode. [125 without --best] [800 with --best]
  -y                 Try hard. Try as hard as possible to find valid alignments when they exist,
                     including paired-end alignments. [off]
  --chunkmbs INT     Thread memory. The number of megabytes of memory a given thread is given to
                     store path descriptors in --best mode. [32]
  -k INT             Valid alignments. The number of valid alignments per read or pair. [off]
  -a                 All valid alignments. Choosing this means that all valid alignments per read
                     or pair will be reported. [off]
  -m INT             Suppress alignments. Suppress all alignments for a particular read or pair
                     if more than INT reportable alignments exist for it. [no limit]
  --best             Best mode. Make Bowtie guarantee that reported singleton alignments are
                     "best" in terms of stratum (the number of mismatches) and quality values at
                     mismatched position. [off]
  --strata           Best strata. When running in best mode, report alignments that fall into the
                     best stratum if there are ones falling into more than one. [off]
  -o INT             Offrate override. Override the offrate of the index with INT. Some row
                     markings are discarded when index read into memory. INT must be greater than
                     the value used to build the index (default: 5). [off]
  --seed INT         Random seed. Use INT as the seed for the pseudo-random number generator. [off]
  --snpphred INT     Use INT as the SNP penalty for decoding colorspace alignments. True ratio of
                     SNPs per base in the subject genome. [see --snpfrac]
  --snpfrac DEC      Use DEC as the estimated ratio of SNPs per base when decoding colorspace
                     alignments. [0.001]
  --col-keepends     Keep the extreme-end nucleotides and qualities when decoding colorspace
                     alignments. [off]

    </help>
    <citations>
        <citation type="doi">10.1186/gb-2009-10-3-r25</citation>
    </citations>
</tool>


text:
<template ref-id="${id}">

      <select ref="_select" id.bind="id" name.bind="name" style="width: 100%" aria-describedby="helpBlock" placeholder="${placeholder}" value.bind="value">
        <option value="" if.bind="!_multiple"></option>
        <template if.bind="_optGroup" containerless>
          <optgroup model.bind="opt"
                    repeat.for="opt of optionGroups"  label="${opt}">
            <option model.bind="option"
                  repeat.for="option of options | filterOnProperty: groupProperty: opt"
                  disabled.bind="option[disabledProperty]!==null&&option[disabledProperty]!==undefined&&option[disabledProperty]"
                  value="${option[valueProperty]!==null&&option[valueProperty]!==undefined?option[valueProperty]:option}">${option[displayProperty] || option}</option>
          </optgroup>

          <option model.bind="option"
                  repeat.for="option of options | filterOnProperty: groupProperty: '!'"
                  disabled.bind="option[disabledProperty]!==null&&option[disabledProperty]!==undefined&&option[disabledProperty]"
                  value="${option[valueProperty]!==null&&option[valueProperty]!==undefined?option[valueProperty]:option}">${option[displayProperty] || option}</option>
        </template>
        <template if.bind="!_optGroup" containerless>
          <option model.bind="option"
                  repeat.for="option of options"
                  disabled.bind="option[disabledProperty]!==null&&option[disabledProperty]!==undefined&&option[disabledProperty]"
                  value="${option[valueProperty]!==null&&option[valueProperty]!==undefined?option[valueProperty]:option}">${option[displayProperty] || option}</option>
        </template>
      </select>

</template>

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Building an Enigma Machine</title>
    <meta name="description" content="Brian's Blog - A place where I'll share my latest travel stories, academic thoughts, and personal musings." />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="/assets/images/favicon.ico" >

    <link rel="stylesheet" type="text/css" href="/assets/css/screen.css" />
    <link rel="stylesheet" type="text/css"
          href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />
    <link rel="stylesheet" type="text/css" href="/assets/css/syntax.css" />

        <link rel="canonical" href="/" />
    <meta name="referrer" content="origin" />
    <link rel="next" href="/page2/" />

    <meta property="og:site_name" content="Brian's Blog" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Brian's Blog" />
    <meta property="og:description" content="A place where I'll share my latest travel stories, academic thoughts, and personal musings." />
    <meta property="og:url" content="/" />
    <meta property="og:image" content="/assets/images/cover1.jpg" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="Brian's Blog" />
    <meta name="twitter:description" content="A place where I'll share my latest travel stories, academic thoughts, and personal musings." />
    <meta name="twitter:url" content="/" />
    <meta name="twitter:image:src" content="/assets/images/cover1.jpg" />

    <meta name="generator" content="Jekyll 3.0.0" />
    <link rel="alternate" type="application/rss+xml" title="Brian's Blog" href="/rss.xml" />

Menu

        Close

Home

Academics

Projects

Travels

Other

bsu.me

            Menu

Building an Enigma Machine

            <time class="post-date" datetime="2016-06-06">06 Jun 2016</time>

                on

                       Projects

This post is still a work in progress!

During World War II, the Enigma machine was widely used by the German forces to communicate
    sensitive information amongst themselves. Believed by the Germans to be unbreakable,
    the Enigma had a series of rotors and a single reflector at the end. The first
    rotor would map the initial input into an output letter, which is then passed
    to the subsequent rotors in similar fashion. Upon reaching the reflector, which
    also maps its input to an output, the translation happens in reverse, where the
    output of the reflector is passed through the last rotor all the way to the first
    rotor, where it is then given back as an encoded letter. To decode, the encoded
    message would be passed through the Enigma machine with the same initial state,
    and the original message would show up.

Okay, I simplified it a little bit. Before every letter is processed by the rotors,
    the first rotor rotates, and possibly the subsequent rotors too. Every rotor
    has a notch that it rotates the next rotor on. For example, Rotor II has notch
    E. This is predefined - otherwise, none of the Enigma operators would be able
    to transcribe messages from their counterparts. Thus, when Rotor II is on notch
    E, the next input that rotates Rotor II causes the subsequent rotor to rotate,
    increasing its notch. On the other hand, reflectors don't rotate.

There's also the ring offset. Suppose we are abou to pass in A to a rotor and the
    rotor is at notch C. In this case, the rotor treats A as C and outputs the mapping
    for C, instead of A.

In addition, there's also the plugboard (Steckerbrett) that is used before
    the input is passed into the first rotor. Basically, the operator has 13 wires
    that can change any two pairs of letters. For example, an operator can switch
    A for Z and Z for A.

Also, quick note about the reflector. It's mapping is reversable, so if A maps to
    D, then D maps to A.

Hello Cem!

                's Picture

Brian Su

 I'm a fourth year computer science major at UC Berkeley, interested in machine learning and data science. When I'm not at my computer, I'm traveling, playing sports, and learning Wing Chun.

                     Berkeley, CA
                     blog.bsu.me/

Share this post

                    Twitter

                    Facebook

                    Google+

Great Podcasts I Recommend

This summer, I spend at least 40 minutes in my car and about 2 hours...

Asia Winter 2016. The Beginning.

Last winter, in the span of 27 days, I traveled to Asia and visited 6...

Brian's Blog © 2016

Proudly published with Jekyll using Jasper


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<typeInfoHistroy>
<typeInfo handle="=consisthash/src<com.fhr.consisthash.core{ConsistencyHashServer.java[ConsistencyHashServer" modifiers="1" timestamp="1520672421498"/>
</typeInfoHistroy>


text:
package br.com.delogic.leitoor;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;

import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.sql.DataSource;

import org.apache.log4j.Level;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.init.ScriptException;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import br.com.delogic.jfunk.Each;
import br.com.delogic.jfunk.ForEach;
import br.com.delogic.jnerator.AttributeConfiguration;
import br.com.delogic.jnerator.AttributeGenerator;
import br.com.delogic.jnerator.InstanceGenerator;
import br.com.delogic.jnerator.JNerator;
import br.com.delogic.jnerator.JNeratorImpl;
import br.com.delogic.jnerator.impl.generator.ProvidedAttributeGenerator;
import br.com.delogic.leitoor.entidade.Aluno;
import br.com.delogic.leitoor.entidade.Atividade;
import br.com.delogic.leitoor.entidade.ConfiguracaoPagina;
import br.com.delogic.leitoor.entidade.Leitura;
import br.com.delogic.leitoor.entidade.Material;
import br.com.delogic.leitoor.entidade.MaterialConfigurado;
import br.com.delogic.leitoor.entidade.Professor;
import br.com.delogic.leitoor.entidade.Questao;
import br.com.delogic.leitoor.entidade.QuestaoDissertativa;
import br.com.delogic.leitoor.entidade.QuestaoObjetiva;
import br.com.delogic.leitoor.entidade.QuestaoObjetivaAlternativa;
import br.com.delogic.leitoor.entidade.Questionario;
import br.com.delogic.leitoor.entidade.Resposta;
import br.com.delogic.leitoor.entidade.RespostaDissertativa;
import br.com.delogic.leitoor.entidade.RespostaObjetiva;
import br.com.delogic.leitoor.entidade.RespostasQuestionario;
import br.com.delogic.leitoor.entidade.Tarefa;
import br.com.delogic.leitoor.entidade.TarefaEnviada;
import br.com.delogic.leitoor.entidade.Turma;
import br.com.delogic.leitoor.util.Log4jManager;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
    locations = { "classpath:database/gerar-banco.xml" })
public class GerarBanco {

    @PersistenceContext
    private EntityManager         entityManager;

    @Inject
    @Named("sqlDS")
    private DataSource            dataSource;

    @Inject
    private JpaTransactionManager transactionManager;

    @SuppressWarnings("serial")
    class Contos extends HashMap<Integer, String> {
        {
            for (int p = 1; p <= 49; p++) {
                put(p, "contos" + p + ".pdf");
            }
        }
    }

    private TransactionStatus  transactionStatus;

    private JNerator           jNerator            = new JNeratorImpl();

    AttributeGenerator<String> emailGenerator      = new AttributeGenerator<String>() {
                                                       private int contador = 1;

                                                       @Override
                                                       public String generate(int index, AttributeConfiguration attributeConfiguration,
                                                           Object instance) {
                                                           return "email" + (contador++) + "@gmail.com";
                                                       }
                                                   };

    AttributeGenerator<String> conviteGenerator    = new AttributeGenerator<String>() {
                                                       private int contador = 1;

                                                       @Override
                                                       public String generate(int index, AttributeConfiguration attributeConfiguration,
                                                           Object instance) {
                                                           return "convite" + (contador++);
                                                       }
                                                   };

    AttributeGenerator<String> idFacebookGenerator = new AttributeGenerator<String>() {
                                                       private int contador = 1;

                                                       @Override
                                                       public String generate(int index, AttributeConfiguration attributeConfiguration,
                                                           Object instance) {
                                                           return "idfacebook" + (contador++);
                                                       }
                                                   };

    protected void beginTransaction() {
        transactionStatus = transactionManager.getTransaction(new DefaultTransactionDefinition());
    }

    protected void commitTransaction() {
        if (transactionManager == null || transactionStatus == null) throw new IllegalStateException(
            "A transação não foi aberta e provavelmente o begin() não foi chamado");

        transactionManager.commit(transactionStatus);
    }

    private final org.slf4j.Logger logger = LoggerFactory.getLogger(GerarBanco.class);

    static {
        /* desligar o log para melhorar performance */
        Log4jManager.setLevel(Level.INFO);
    }

    private <E> AttributeGenerator<E> of(E... elements) {
        return new ProvidedAttributeGenerator<E>(elements);
    }

    @SuppressWarnings("unused")
    private <E> AttributeGenerator<E> of(List<E> elements) {
        return new ProvidedAttributeGenerator<E>(elements);
    }

    private Random random = new Random();

    @Test
    public void popular() throws ScriptException, SQLException {

        beginTransaction();

        jNerator.doNotGenerateFor("id", "convidadoPor");

        persist(jNerator.prepare(Aluno.class)
            .setAttributeGenerator("email", emailGenerator)
            .setAttributeGenerator("convite", conviteGenerator)
            .setAttributeGenerator("idFacebook", idFacebookGenerator)
            .setAttributeGenerator("idGoogle", idFacebookGenerator)
            .generate(50));

        persist(jNerator.prepare(Professor.class)
            .setAttributeGenerator("email", emailGenerator)
            .setAttributeGenerator("convite", conviteGenerator)
            .setAttributeGenerator("idFacebook", idFacebookGenerator)
            .setAttributeGenerator("idGoogle", idFacebookGenerator)
            .generate(1));

        persist(jNerator.prepare(Material.class)
            .setAttributeGenerator("numeroPaginas", of(49))
            .setAttributeGenerator("arquivoUnico", of("contos.pdf"))
            .setAttributeGenerator("arquivoPaginado", of(new Contos()))
            .generate(10));

        persist(jNerator.prepare(MaterialConfigurado.class)
            .setAttributeGenerator("configuracaoPaginas", new AttributeGenerator<Map<Integer, ConfiguracaoPagina>>() {
                @Override
                public Map<Integer, ConfiguracaoPagina> generate(int index, AttributeConfiguration attributeConfiguration,
                    Object materialConfigurado) {
                    InstanceGenerator<ConfiguracaoPagina> generator = jNerator.prepare(ConfiguracaoPagina.class);
                    generator.setAttributeGenerator("questoes", new AttributeGenerator<List<? extends Questao>>() {
                        @Override
                        public List<? extends Questao> generate(int index, AttributeConfiguration attributeConfiguration, Object instance) {
                            if (random.nextBoolean()) {
                                return jNerator.prepare(QuestaoObjetiva.class)
                                    .setAttributeGenerator("alternativas", new AttributeGenerator<List<QuestaoObjetivaAlternativa>>() {
                                        @Override
                                        public List<QuestaoObjetivaAlternativa> generate(int index,
                                            AttributeConfiguration attributeConfiguration, Object instance) {
                                            return
                                            jNerator
                                                .prepare(QuestaoObjetivaAlternativa.class)
                                                .setAttributeGenerator("questao", of(instance))
                                                .generate(5);
                                        }
                                    }).generate(3);
                            } else {
                                return jNerator.prepare(QuestaoDissertativa.class).generate(3);
                            }
                        }
                    });
                    generator.setAttributeGenerator("materialConfigurado", of(materialConfigurado));
                    Map<Integer, ConfiguracaoPagina> paginas = new HashMap<Integer, ConfiguracaoPagina>();
                    int p = 1;
                    for (ConfiguracaoPagina configuracaoPagina : generator.generate(new Contos().size())) {
                        configuracaoPagina.setPagina(p++);
                        configuracaoPagina.setMaterialConfigurado((MaterialConfigurado) materialConfigurado);
                        paginas.put(configuracaoPagina.getPagina(), configuracaoPagina);
                    }
                    return paginas;
                }
            }).generate(80));

        persist(jNerator.prepare(Atividade.class).generate(30));

        persist(jNerator.prepare(Turma.class).generate(15));

        final List<Tarefa> tarefas = persist(jNerator.prepare(Tarefa.class).generate(100));

        List<TarefaEnviada> tarefasIndividuais = jNerator.prepare(TarefaEnviada.class)
            .setAttributeGenerator("tarefa", new AttributeGenerator<Tarefa>() {
                @Override
                public Tarefa generate(int index, AttributeConfiguration attributeConfiguration, Object instance) {
                    return tarefas.get(index % 100);
                }
            })
            .setAttributeGenerator("respostas", new AttributeGenerator<List<? extends Resposta>>() {
                @Override
                public List<? extends Resposta> generate(int index, AttributeConfiguration attributeConfiguration, Object instance) {
                    final List<Resposta> respostas = new ArrayList<Resposta>();
                    for (final ConfiguracaoPagina conf : tarefas.get(index % 100).getMaterialConfigurado().getConfiguracaoPaginas()
                        .values()) {
                        // sair a cada três falses
                        if (!(random.nextBoolean() || random.nextBoolean() || random.nextBoolean())) {
                            break;
                        }
                        if (conf.getQuestoes() != null) {
                            for (final Questao questao : conf.getQuestoes()) {
                                if (questao instanceof QuestaoDissertativa) {
                                    respostas.add(
                                        jNerator.prepare(RespostaDissertativa.class)
                                            .setAttributeGenerator("tarefaEnviada", of(instance))
                                            .setAttributeGenerator("questao", of(questao))
                                            .generate(1).get(0));
                                } else {
                                    respostas.addAll(
                                        jNerator
                                            .prepare(RespostaObjetiva.class)
                                            .setAttributeGenerator("tarefaEnviada", of(instance))
                                            .setAttributeGenerator("questao", of(questao))
                                            .setAttributeGenerator("alternativasSelecionadas",
                                                new AttributeGenerator<Set<QuestaoObjetivaAlternativa>>() {
                                                    @Override
                                                    public Set<QuestaoObjetivaAlternativa> generate(int index,
                                                        AttributeConfiguration attributeConfiguration, Object instance) {
                                                        return new HashSet<QuestaoObjetivaAlternativa>(((QuestaoObjetiva) questao)
                                                            .getAlternativas().subList(0, 2));
                                                    }
                                                })
                                            .generate(2));
                                }

                            }
                        }

                    }
                    return respostas;
                }
            })
            .setAttributeGenerator("leituras", new AttributeGenerator<Map<Integer, Leitura>>() {
                @Override
                public Map<Integer, Leitura> generate(int index, AttributeConfiguration attributeConfiguration, Object instance) {
                    int paginas = tarefas.get(index % 100).getMaterialConfigurado().getMaterial().getArquivoPaginado().size();
                    Map<Integer, Leitura> leituras = new HashMap<Integer, Leitura>();
                    Calendar cal = Calendar.getInstance();
                    for (int pagina = 1; pagina <= paginas; pagina++) {
                        // sair a cada três falses
                        if (!(random.nextBoolean() || random.nextBoolean() || random.nextBoolean())) {
                            break;
                        }
                        Leitura leitura = new Leitura();
                        cal.add(Calendar.MINUTE, pagina);
                        leitura.setDataInicial(cal.getTime());
                        cal.add(Calendar.MINUTE, pagina);
                        leitura.setDataFinal(cal.getTime());
                        leitura.setPagina(pagina);
                        leitura.setTarefaEnviada((TarefaEnviada) instance);
                        leituras.put(pagina, leitura);
                    }
                    return leituras;
                }
            })
            .generate(200);

        persist(tarefasIndividuais);

        persist(jNerator.prepare(Questionario.class)
            .setAttributeGenerator("questoes", new AttributeGenerator<List<? extends Questao>>() {
                @Override
                public List<? extends Questao> generate(int index, AttributeConfiguration attributeConfiguration, Object instance) {
                    return jNerator.prepare(QuestaoDissertativa.class).generate(20);
                }
            })
            .generate(100));

        persist(jNerator.prepare(RespostasQuestionario.class)
            .setAttributeGenerator("respostas", new AttributeGenerator<List<? extends Resposta>>() {
                @Override
                public List<? extends Resposta> generate(int index, AttributeConfiguration attributeConfiguration, Object instance) {
                    return jNerator.prepare(RespostaDissertativa.class).generate(20);
                }
            }).generate(1000));

        commitTransaction();

    }

    private <E, C extends Collection<E>, T> C persist(C entidades) {
        Class<?> tipo = entidades.iterator().next().getClass();
        logger.info("persistindo " + tipo);
        ForEach.element(entidades, new Each<E>() {
            @Override
            public void each(E object, int arg1) {
                entityManager.persist(object);
            }
        });
        entityManager.flush();

        return entidades;
    }

}


text:
<?php
namespace SEOstats\Services;

use SEOstats\SEOstats as SEOstats;
use SEOstats\Config as Config;
use SEOstats\Helper as Helper;

class Sistrix extends SEOstats
{
    /**
     * Returns the Sistrix visibility index
     *
     * @access        public
     * @param   url   string     The URL to check.
     * @return        integer    Returns the Sistrix visibility index.
     * @link    http://www.sistrix.com/blog/870-sistrix-visibilityindex.html
     */
    public static function getVisibilityIndex($url = false)
    {
        $url     = parent::getUrl($url);
        $domain  = Helper\Url::parseHost($url);
        $dataUrl = sprintf(Config\Services::SISTRIX_VI_URL, urlencode($domain));

        $html = parent::_getPage($dataUrl);
        @preg_match_all('#<h3>(.*?)<\/h3>#si', $html, $matches);

        return isset($matches[1][0]) ? $matches[1][0] : parent::noDataDefaultValue();
    }
}


text:
from msrest.serialization import Model

class ApplicationGatewayBackendHealth(Model):
    """List of ApplicationGatewayBackendHealthPool resources.

    :param backend_address_pools:
    :type backend_address_pools:
     list[~azure.mgmt.network.v2016_09_01.models.ApplicationGatewayBackendHealthPool]
    """

    _attribute_map = {
        'backend_address_pools': {'key': 'backendAddressPools', 'type': '[ApplicationGatewayBackendHealthPool]'},
    }

    def __init__(self, backend_address_pools=None):
        super(ApplicationGatewayBackendHealth, self).__init__()
        self.backend_address_pools = backend_address_pools


text:
import pytest
import numpy as np
import yaml
import tardis
import numpy.testing as nptesting
from astropy import units as u
import os
import h5py

from tardis.base import run_tardis

def data_path(fname):
    return os.path.join(tardis.__path__[0], 'plasma', 'tests', 'data', fname)

@pytest.fixture()
def plasma_compare_data_fname():
    return data_path('plasma_test_data.h5')

@pytest.fixture()
def plasma_compare_data(plasma_compare_data_fname):
    return h5py.File(plasma_compare_data_fname, 'r')

@pytest.mark.skipif(not pytest.config.getvalue("atomic-dataset"),
                    reason='--atomic_database was not specified')
class TestPlasmas():
    @classmethod
    @pytest.fixture(scope="class", autouse=True)
    def setup(self):
        self.atom_data_filename = os.path.expanduser(os.path.expandvars(
            pytest.config.getvalue('atomic-dataset')))
        assert os.path.exists(self.atom_data_filename), ("{0} atomic datafiles"
                                                         " does not seem to "
                                                         "exist".format(
            self.atom_data_filename))
        self.config_yaml = yaml.load(open(
            'tardis/plasma/tests/data/plasma_test_config_lte.yml'))
        self.config_yaml['atom_data'] = self.atom_data_filename
        self.lte_model = run_tardis(self.config_yaml)
        self.config_yaml = yaml.load(open(
            'tardis/plasma/tests/data/plasma_test_config_nlte.yml'))
        self.config_yaml['atom_data'] = self.atom_data_filename
        self.nlte_model = run_tardis(self.config_yaml)

    def test_lte_plasma(self, plasma_compare_data):
        old_plasma_t_rads = plasma_compare_data['test_lte1/t_rad']
        old_plasma_levels = plasma_compare_data['test_lte1/levels']

        new_plasma_t_rads = self.lte_model.t_rads / u.Unit('K')
        new_plasma_levels = \
            self.lte_model.plasma_array.get_value(
            'level_number_density').ix[8].ix[1][10].values
        np.testing.assert_allclose(
            new_plasma_t_rads, old_plasma_t_rads, atol=100)
        np.testing.assert_allclose(
            new_plasma_levels, old_plasma_levels, rtol=0.1)

    def test_nlte_plasma(self, plasma_compare_data):
        old_plasma_t_rads = plasma_compare_data['test_nlte1/t_rad']
        old_plasma_levels = plasma_compare_data['test_nlte1/levels']
        new_plasma_t_rads = self.nlte_model.t_rads / u.Unit('K')
        new_plasma_levels = \
            self.nlte_model.plasma_array.get_value(
            'level_number_density').ix[2].ix[1][10].values
        np.testing.assert_allclose(
            new_plasma_t_rads, old_plasma_t_rads, atol=150)
        np.testing.assert_allclose(
            new_plasma_levels, old_plasma_levels, rtol=0.1)


text:
/**
 * generated by Xtext 2.12.0
 */
package de.evorepair.feature.expression.ui.labeling;

import com.google.inject.Inject;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;

/**
 * Provides labels for EObjects.
 *
 * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider
 */
@SuppressWarnings("all")
public class EvoExpressionDslLabelProvider extends DefaultEObjectLabelProvider {
  @Inject
  public EvoExpressionDslLabelProvider(final AdapterFactoryLabelProvider delegate) {
    super(delegate);
  }
}


text:
<?php

namespace Doowebdev\Core\Database\Advertisements;

use Doowebdev\Core\Database\DbBaseRepository;

/**
 * Class AdvertisementDbRepository
 * @package Doowebdev\Core\Database\Advertisements
 */
class AdvertisementDbRepository  extends DbBaseRepository{

    /**
     * @var Advertisement
     */
    protected $model;

    public function __construct()
    {
        $this->model = New Advertisement();
    }

    //public function createOrUpdate($if, $flash_msg_name, array $createArray, array $updateArray, $updateId)

}