jpayne@18: <tool id="seqsero_v2" name="SeqSero2 v1.3.1" version="9">
jpayne@0:     <description>Salmonella serotype prediction</description>
estrain@14:     <macros>
jpayne@17:         <token name="@VERSION@">1.3.1</token>
estrain@14:     </macros>
jpayne@0:     <requirements>
estrain@14:         <requirement type="package" version="@VERSION@">seqsero2</requirement>
jpayne@0:     </requirements>
jpayne@0:     <command detect_errors="exit_code"><![CDATA[
estrain@14:       mkdir ./output;
estrain@14: 
jpayne@3:       #if $reads.reads_select == 'history'
estrain@14:         #set $name = $reads.forward.name.split('.')[0].replace(' ','_')
estrain@14:         #set $forward = $reads.forward
estrain@14:         #set $reverse = $reads.reverse
estrain@14:         #set $infile = $name + "_1.fastq " +  $name + "_2.fastq" 
estrain@14:         #set $tval = 2
estrain@14:         #if $reverse.is_of_type('fastq.gz', 'fastqsanger.gz')
estrain@14:           gunzip -c $reverse > reverse.fastq;
estrain@14:           #set $reverse = './reverse.fastq'
estrain@14:           gunzip -c $forward > forward.fastq;
estrain@14:           #set $forward = './forward.fastq'
estrain@14:         #end if
jpayne@3:         ln -s $forward ${name}_1.fastq;
jpayne@3:         ln -s $reverse ${name}_2.fastq;
estrain@14:       #else if $reads.reads_select == 'collection'
estrain@14:         #set $name = $reads.coll.name.replace(' ', '_')
estrain@14:         #set $forward = $reads.coll.forward
estrain@14:         #set $reverse = $reads.coll.reverse
estrain@14:         #set $infile = $name + "_1.fastq " +  $name + "_2.fastq" 
estrain@14:         #set $tval = 2
estrain@14:         #if $reverse.is_of_type('fastq.gz', 'fastqsanger.gz')
estrain@14:           gunzip -c $reverse > reverse.fastq;
estrain@14:           #set $reverse = './reverse.fastq'
estrain@14:           gunzip -c $forward > forward.fastq;
estrain@14:           #set $forward = './forward.fastq'
estrain@14:         #end if
estrain@14:         ln -s $forward ${name}_1.fastq;
estrain@14:         ln -s $reverse ${name}_2.fastq;
estrain@14:       #else 
estrain@14:         #set $name = $reads.assembly.name.replace(' ', '_')
estrain@14:         #set $ga = $reads.assembly
estrain@14:         #set $infile = $name + ".fasta" 
estrain@14:         ln -s $ga ${name}.fasta;
estrain@14:         #set $tval = 4
estrain@14:         #set $mode='k'
estrain@14:       #end if
estrain@14:       echo $name ;
estrain@14:       echo "-=-=-=-=-" ;
estrain@14:       touch output/SeqSero_log.txt ;
jpayne@17:       SeqSero2_package.py --version ;
jpayne@17:       echo "-=-=-=-=-" ;
estrain@14:       SeqSero2_package.py
estrain@14:         -p \${GALAXY_SLOTS:-1}
estrain@14:         -t $tval 
jpayne@2:         -m $mode
jpayne@2:         -d ./output
jpayne@2:       #if $mode == 'a':
jpayne@2:         -b $maptype 
jpayne@2:       #end if
estrain@14:         -i $infile &&
jpayne@2:         echo "-=-=-=-=-" &&
jpayne@2:         cat output/SeqSero_log.txt &&
jpayne@2:         echo "-=-=-=-=-" &&
jpayne@2:         ls -lah ./output
jpayne@0:     ]]></command>
jpayne@0:     <inputs>
jpayne@0:         
jpayne@0:         <conditional name="reads">
estrain@14:             <param name="reads_select" type="select" label="Genome assembly,paired-end collection, or two datasets from your history">
jpayne@0:                 <option value="collection">Paired collection from your history</option>
jpayne@0:                 <option value="history">Two FASTQ datasets from your history</option>
estrain@14:                 <option value="genome">Genome Assembly</option>
jpayne@0:             </param>
jpayne@0:             <when value="collection">
jpayne@0:                 <param label="Paired reads" name="coll" type="data_collection" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz" collection_type="paired" />
jpayne@0:             </when>
jpayne@0:             <when value="history">
jpayne@0:                 <param label="Forward reads" type="data" name="forward" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz" />
jpayne@0:                 <param label="Reverse reads" type="data" name="reverse" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz" />
jpayne@0:             </when>
estrain@14:             <when value="genome">
estrain@14:                 <param label="Genome assembly" name="assembly" type="data" format="fasta"/>
estrain@14:             </when>
jpayne@0:         </conditional>
jpayne@0:      
jpayne@0:           <!-- <param name="fastq1" type="data" format="fastq" label="FASTQ paired end read 1" />
jpayne@0:           <param name="fastq2" type="data" format="fastq" label="FASTQ paired end read 2" /> -->
jpayne@0:           <!-- <param name="numofthr" type="select" label="Number of threads">
jpayne@0:           <option value="1">1</option>
jpayne@0:           <option value="2">2</option>
jpayne@0:           <option value="3">3</option>
jpayne@0:           <option value="4">4</option> -->
jpayne@0:         <!-- </param> -->
jpayne@2:         
jpayne@2:         <param label="Analysis mode" type="select" name="mode">
estrain@14:          <option value="a">allele mode</option>
estrain@14:          <option value="k">k-mer mode</option>
jpayne@2:         </param>
jpayne@2: 
jpayne@2:         <param name="maptype" type="select" label="Algorithms for BWA mapping">
jpayne@0:           <option value="mem">mem</option>
jpayne@0:           <option value="sam">sam</option>
jpayne@0:         </param>
jpayne@2: 
jpayne@0:     
jpayne@0: 
jpayne@0:     </inputs>
jpayne@0:     <outputs>
jpayne@17:       <data format="tabular" label="SeqSero Results" name="results" from_work_dir="output/SeqSero_result.tsv" />
jpayne@0:     </outputs>
jpayne@0:     <tests>
jpayne@1:        <!-- <test>
jpayne@1:          <param name="reads_select" value="history" />
jpayne@1:          <param name="forward" value="forward.fastq.gz" ftype="fastqsanger.gz" />
jpayne@1:          <param name="reverse" value="reverse.fastq.gz" ftype="fastqsanger.gz" />
jpayne@1:          <output name="results" file="Seqsero_result.tsv" />
jpayne@1:        </test>
jpayne@0:        <test>
jpayne@1:         <param name="reads_select" value="collection" />
jpayne@1:         <param name="coll">
jpayne@1:             <collection type="paired">
jpayne@1:                 <element name="forward" value="forward.fastq.gz" ftype="fastqsanger.gz" />
jpayne@1:                 <element name="reverse" value="reverse.fastq.gz" ftype="fastqsanger.gz" />
jpayne@1:             </collection>
jpayne@1:         </param>
jpayne@1:         <output name="results" file="Seqsero_result.tsv" />
jpayne@1:        </test> -->
jpayne@1:         <test>
jpayne@1:          <param name="mode" value="k" />
jpayne@0:          <param name="reads_select" value="history" />
jpayne@3:          <param name="forward" value="forward_25k.fastq.gz" ftype="fastqsanger" />
jpayne@3:          <param name="reverse" value="reverse_25k.fastq.gz" ftype="fastqsanger" />
jpayne@1:          <output name="results" file="Seqsero_result_25k.tsv" />
jpayne@0:        </test>
jpayne@0:        <test>
jpayne@1:         <param name="mode" value="k" />
jpayne@0:         <param name="reads_select" value="collection" />
jpayne@0:         <param name="coll">
jpayne@0:             <collection type="paired">
jpayne@0:                 <element name="forward" value="forward_25k.fastq.gz" ftype="fastqsanger.gz" />
jpayne@0:                 <element name="reverse" value="reverse_25k.fastq.gz" ftype="fastqsanger.gz" />
jpayne@0:             </collection>
jpayne@0:         </param>
jpayne@1:         <output name="results" file="Seqsero_result_25k_coll.tsv" />
jpayne@0:        </test>
jpayne@11:         <test>
jpayne@11:          <param name="mode" value="a" />
jpayne@11:          <param name="reads_select" value="history" />
jpayne@12:          <param name="forward" value="forward_250k.fastq.gz" ftype="fastqsanger" />
jpayne@12:          <param name="reverse" value="reverse_250k.fastq.gz" ftype="fastqsanger" />
jpayne@12:          <assert_stdout>
jpayne@17:           <has_text text="input genome cannot be identified as Salmonella" />
jpayne@12:          </assert_stdout>
jpayne@11:        </test>
jpayne@1:        <!-- <test>
jpayne@1:         <param name="mode" value="a" />
jpayne@1:         <param name="reads_select" value="collection" />
jpayne@1:         <param name="coll">
jpayne@1:             <collection type="paired">
jpayne@1:                 <element name="forward" value="forward_25k.fastq.gz" ftype="fastqsanger.gz" />
jpayne@1:                 <element name="reverse" value="reverse_25k.fastq.gz" ftype="fastqsanger.gz" />
jpayne@1:             </collection>
jpayne@1:         </param>
jpayne@1:         <output name="results" file="Seqsero_result_allele.tsv" />
jpayne@1:        </test> -->
jpayne@0:     </tests>
jpayne@0:     <help><![CDATA[
jpayne@0:     
jpayne@0: **Usage: SeqSero2.py** 
jpayne@0: 
jpayne@0: **Algorithms for BWA mapping**
jpayne@0: 
jpayne@0: 'mem' for mem, 'sam' for samse/sampe; default=mem; optional; for now SeqSero2 is only optimized for "mem" mode
jpayne@0:    
jpayne@0:     ]]></help>
jpayne@0:     <citations>
jpayne@0:        <citation type="bibtex">
jpayne@0:         @misc{zhang_yin_jones_zhang_deathrage_dinsmore_fitzgeral_fields_deng_2015,
jpayne@0:         title={Salmonella serotype determination utilizing high-throughput genome sequencing data.},
jpayne@0:         journal={J Clin Microbiol}, publisher={ASM},
jpayne@0:         author={Zhang S, Yin Y, Jones MB, Zhang Z, Deatherage Kaiser BL, Dinsmore BA, Fitzgerald C, Fields PI, Deng X.},
jpayne@0:         year={2015}, month={Max},
jpayne@0:         url={http://http://jcm.asm.org/content/early/2015/03/05/JCM.00323-15}},
jpayne@0:        }</citation>
jpayne@5:        <citation type="bibtex">
jpayne@5:         @misc{cfsan_biostatistics_group_2017,
jpayne@5:         title={CFSAN Biostatistics Group fork of SeqSero2},
jpayne@5:         url={https://github.com/CFSAN-Biostatistics/SeqSero2.git}},
jpayne@5:        </citation>
jpayne@0:     </citations>
jpayne@0: 
jpayne@0: </tool>