diff snippy.xml @ 2:4e478a5f2742 draft

planemo upload commit c9db1bf13e663b9e2122fc610007679a2f117aa6-dirty
author thanhlv
date Sun, 08 Sep 2019 16:16:50 -0400
parents 8cdc3f9c2dc5
children e10e0c41a6f3
line wrap: on
line diff
--- a/snippy.xml	Tue Jun 25 11:09:37 2019 -0400
+++ b/snippy.xml	Sun Sep 08 16:16:50 2019 -0400
@@ -1,73 +1,89 @@
-<tool id="snippy" name="snippy_qib" version="@VERSION@+galaxy1">
-  <description>
+<tool id="snippy" name="snippy" version="@VERSION@+galaxy2">
+    <description>
       Snippy finds SNPs between a haploid reference genome and your NGS sequence reads.
-  </description>
-  <macros>
-      <import>macros.xml</import>
-  </macros>
-  <expand macro="requirements" />
-  <expand macro="version_command" />
+    </description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <expand macro="version_command" />
 
     <command detect_errors="exit_code"><![CDATA[
 
-        
-        ln -f -s '$snippy_ref.fields.path' 'foo.fna' &&
-    
+        #if $reference_source.reference_source_selector == 'history'
+            ln -sf '$reference_source.ref_file' 'ref' &&
+        #elif $reference_source.reference_source_selector == 'cached'
+            ln -sf '$reference_source.ref_file.fields.path' 'ref' &&
+        #end if
 
         snippy
             --outdir 'out'
-            --cpus "\${GALAXY_SLOTS:-1}"
-            --ref 'foo.fna'
+            --cpus \${GALAXY_SLOTS:-1}
+            --ram \$((\${GALAXY_MEMORY_MB:-4096}/1024))
+            --ref 'ref'
             --mapqual $adv.mapqual
             --mincov $adv.mincov
             --minfrac $adv.minfrac
+            --minqual $adv.minqual
             #if $adv.rgid
-                --rgid '$advanced.rgid'
+                --rgid '$adv.rgid'
             #end if
             #if $adv.bwaopt
-                --bwaopt '$advanced.bwaopt'
+                --bwaopt '$adv.bwaopt'
             #end if
 
             #if str( $fastq_input.fastq_input_selector ) == "paired"
-                --pe1 '$fastq_input.fastq_input1'
-                --pe2 '$fastq_input.fastq_input2'
-            #end if
-            #if str( $fastq_input.fastq_input_selector ) == "paired_collection"
-                --pe1 '$fastq_input.fastq_input.forward'
-                --pe2 '$fastq_input.fastq_input.reverse'
+                --R1 '$fastq_input.fastq_input1'
+                --R2 '$fastq_input.fastq_input2'
+            #elif str( $fastq_input.fastq_input_selector ) == "paired_collection"
+                --R1 '$fastq_input.fastq_input.forward'
+                --R2 '$fastq_input.fastq_input.reverse'
+            #elif str( $fastq_input.fastq_input_selector ) == "single"
+                --se '$fastq_input.fastq_input_single'
+            #elif str( $fastq_input.fastq_input_selector ) == "paired_iv"
+                --peil '$fastq_input.fastq_input_interleaved'
             #end if
-            #if str( $fastq_input.fastq_input_selector ) == "single"
-                --se '$fastq_input.fastq_input'
-            #end if
-            #if str( $fastq_input.fastq_input_selector ) == "paired_iv"
-                --peil '$fastq_input.fastq_input'
-            #end if
-
-        &&
-
-        gunzip out/snps.depth.gz
 
         &&
 
         #import re
         #if str( $fastq_input.fastq_input_selector ) == "paired"
             #set $dir_name = re.sub('[^\w_]', '_', $fastq_input.fastq_input1.element_identifier)
-        #else
-            #set $dir_name = re.sub('[^\w_]', '_', $fastq_input.fastq_input.element_identifier)
+        #elif str( $fastq_input.fastq_input_selector ) == "paired_collection"
+            #set $dir_name = re.sub('[^\w_]', '_', $fastq_input.fastq_input.name)
+        #elif str( $fastq_input.fastq_input_selector ) == "single"
+            #set $dir_name = re.sub('[^\w_]', '_', $fastq_input.fastq_input_single.element_identifier)
+        #elif str( $fastq_input.fastq_input_selector ) == "paired_iv"
+            #set $dir_name = re.sub('[^\w_]', '_', $fastq_input.fastq_input_interleaved.element_identifier)
         #end if
 
-        mkdir -p ${dir_name} && cp -r out/reference out/snps.tab out/snps.aligned.fa ${dir_name}/ &&
+        mkdir -p ${dir_name} && cp -r out/reference out/snps.tab out/snps.aligned.fa out/snps.vcf ${dir_name}/ &&
         tar -czf out.tgz ${dir_name}
+        #if "outcon" in str($outputs) and $adv.rename_cons
+          && sed -i 's/>.*/>${dir_name}/' out/snps.consensus.fa
+        #end if
 
 
-    ]]></command>
+    ]]>    </command>
 
     <inputs>
-        <param label="Select a reference" name="snippy_ref" type="select">
-            <options from_data_table="snippy">
-                <validator message="No database is available" type="no_options" />
-            </options>
-        </param>
+
+        <conditional name="reference_source">
+            <param name="reference_source_selector" 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. See `Indexes` section of help below. If you would like to perform self-mapping select `history` here, then choose your input file as reference.">
+                <option value="cached">Use a built-in genome index</option>
+                <option value="history">Use a genome from history and build index</option>
+            </param>
+            <when value="cached">
+                <param name="ref_file" type="select" label="Using reference genome" help="Select genome from the list">
+                    <options from_data_table="all_fasta">
+                        <validator type="no_options" message="No reference genomes are available" />
+                    </options>
+                </param>
+            </when>
+            <when value="history">
+                <param name="ref_file" type="data" format="fasta" label="Use the following dataset as the reference sequence" help="You can upload a FASTA or FASTQ sequence to the history and use it as reference" />
+            </when>
+        </conditional>
         <conditional name="fastq_input">
             <param name="fastq_input_selector" type="select" label="Single or Paired-end reads" help="Select between paired and single end data">
                 <option value="paired">Paired</option>
@@ -80,13 +96,13 @@
                 <param name="fastq_input2" type="data" format="fastqsanger,fasta" label="Select second set of reads" help="Specify dataset with reverse reads"/>
             </when>
             <when value="single">
-                <param name="fastq_input" type="data" format="fastqsanger,fasta" label="Select fastq dataset" help="Specify dataset with single reads"/>
+                <param name="fastq_input_single" type="data" format="fastqsanger,fasta" label="Select fastq dataset" help="Specify dataset with single reads"/>
             </when>
             <when value="paired_collection">
                 <param name="fastq_input" format="fastqsanger,fasta" type="data_collection" collection_type="paired" label="Select a paired collection" help="See help section for an explanation of dataset collections"/>
             </when>
             <when value="paired_iv">
-                <param name="fastq_input" type="data" format="fastqsanger" label="Select fastq dataset" help="Specify dataset with interleaved reads"/>
+                <param name="fastq_input_interleaved" type="data" format="fastqsanger" label="Select fastq dataset" help="Specify dataset with interleaved reads"/>
             </when>
         </conditional>
 
@@ -94,8 +110,10 @@
             <param name="mapqual" type="integer" value="60" label="Minimum mapping quality" help="Minimum mapping quality to allow" />
             <param name="mincov" type="integer" value="10" label="Minimum coverage" help="Minimum coverage to call a snp" />
             <param name="minfrac" type="float" value="0.9" label="Minumum proportion for variant evidence" help="Minumum proportion for variant evidence" />
+            <param name="minqual" type="float" value="100.0" label="Minumum QUALITY in VCF column 6" help="Minumum QUALITY in VCF column 6" />
             <param name="rgid" type="text" value="" label="Bam header @RG ID" help="Use this @RG ID: in the BAM header" />
             <param name="bwaopt" type="text" value="" label="Extra BWA MEM options" help="Extra BWA MEM options, eg. -x pacbio" />
+            <param name="rename_cons" type="boolean" truevalue="rename_cons" falsevalue="" help="When producing an output of the reference genome with variants instantiated, edit the header so that it is named after the input VCF" />
         </section>
 
         <param name="outputs" type="select" multiple="true" display="checkboxes" label="Output selection">
@@ -150,73 +168,76 @@
 
     <tests>
 
-        <test> <!-- test 1 - fasta ref default -->
-            <param name="ref" value="wildtype.fna" ftype="fasta" />
+        <test>            <!-- test 0 - fasta ref no snps -->
+            <!-- <param name="ref" value="reference.fasta" ftype="fasta" /> -->
+            <param name="reference_source|reference_source_selector" value="history"/>
+            <param name="reference_source|ref_file" value="reference.fasta" ftype="fasta"/>
             <param name="fastq_input_selector" value="paired" />
-            <param name="fastq_input1" ftype="fastqsanger" value="mutant_R1.fastq" />
-            <param name="fastq_input2" ftype="fastqsanger" value="mutant_R2.fastq" />
+            <param name="fastq_input1" ftype="fastqsanger" value="a_1.fastq" />
+            <param name="fastq_input2" ftype="fastqsanger" value="a_2.fastq" />
+            <param name="mincov" value="2" />
+            <param name="minqual" value="60" />
             <param name="outputs" value="outgff,outsum" />
-            <output name="snpsum" ftype="tabular" file="fna_ref/snps.txt" lines_diff="6" />
-            <output name="snpgff" ftype="gff3" file="fna_ref/snps.gff" />
-        </test>
-
-        <test> <!-- test 2 - gbk ref default -->
-            <param name="ref" value="wildtype.gbk" ftype="genbank" />
-            <param name="fastq_input_selector" value="paired" />
-            <param name="fastq_input1" ftype="fastqsanger" value="mutant_R1.fastq" />
-            <param name="fastq_input2" ftype="fastqsanger" value="mutant_R2.fastq" />
-            <param name="outputs" value="outgff,outsum" />
-            <output name="snpsum" ftype="tabular" file="gbk_ref/snps.txt" lines_diff="6" />
-            <output name="snpgff" ftype="gff3" file="gbk_ref/snps.gff" />
+            <output name="snpsum" ftype="tabular" file="a_fna_ref_mincov_2_minqual_60.snps.txt" lines_diff="6" />
+            <output name="snpgff" ftype="gff3" file="a_fna_ref_mincov_2_minqual_60.snps.gff" />
         </test>
 
-        <test> <!-- test 3 - gbk mapqual=40 -->
-            <param name="ref" value="wildtype.gbk" ftype="genbank" />
+        <test>            <!-- test 1 - fasta ref one snp -->
+            <!-- <param name="ref" value="reference.fasta" ftype="fasta" /> -->
+            <param name="reference_source|reference_source_selector" value="history"/>
+            <param name="reference_source|ref_file" value="reference.fasta" ftype="fasta"/>
             <param name="fastq_input_selector" value="paired" />
-            <param name="fastq_input1" ftype="fastqsanger" value="mutant_R1.fastq" />
-            <param name="fastq_input2" ftype="fastqsanger" value="mutant_R2.fastq" />
+            <param name="fastq_input1" ftype="fastqsanger" value="b_1.fastq" />
+            <param name="fastq_input2" ftype="fastqsanger" value="b_2.fastq" />
+            <param name="mincov" value="2" />
+            <param name="minqual" value="60" />
             <param name="outputs" value="outgff,outsum" />
-            <param name="mapqual" value="40" />
-            <output name="snpsum" ftype="tabular" file="map_qual/snps.txt" lines_diff="6" />
-            <output name="snpgff" ftype="gff3" file="map_qual/snps.gff" />
+            <output name="snpsum" ftype="tabular" file="b_fna_ref_mincov_2_minqual_60.snps.txt" lines_diff="6" />
+            <output name="snpgff" ftype="gff3" file="b_fna_ref_mincov_2_minqual_60.snps.gff" />
         </test>
 
-        <test> <!-- test 4 - gbk mincov=15 -->
-            <param name="ref" value="wildtype.gbk" ftype="genbank" />
-            <param name="fastq_input_selector" value="paired" />
-            <param name="fastq_input1" ftype="fastqsanger" value="mutant_R1.fastq" />
-            <param name="fastq_input2" ftype="fastqsanger" value="mutant_R2.fastq" />
-            <param name="mincov" value="15" />
-            <param name="outputs" value="outgff,outsum" />
-            <output name="snpsum" ftype="tabular" file="min_cov/snps.txt" lines_diff="6" />
-            <output name="snpgff" ftype="gff3" file="min_cov/snps.gff" />
-        </test>
-
-        <test> <!-- test 5 - gbk minfrac=0.7 -->
-            <param name="ref" value="wildtype.gbk" ftype="genbank" />
-            <param name="fastq_input_selector" value="paired" />
-            <param name="fastq_input1" ftype="fastqsanger" value="mutant_R1.fastq" />
-            <param name="fastq_input2" ftype="fastqsanger" value="mutant_R2.fastq" />
-            <param name="minfrac" value="0.7" />
-            <param name="outputs" value="outgff,outsum" />
-            <output name="snpsum" ftype="tabular" file="min_frac/snps.txt" lines_diff="6" />
-            <output name="snpgff" ftype="gff3" file="min_frac/snps.gff" />
-        </test>
-
-        <test> <!-- test 6 - fasta ref default paired_collection -->
-	    <param name="ref" value="wildtype.fna" ftype="fasta" />
+        <test>            <!-- test 2 - fasta ref one snp paired_collection -->
+            <!-- <param name="ref" value="reference.fasta" ftype="fasta" /> -->
+            <param name="reference_source|reference_source_selector" value="history"/>
+            <param name="reference_source|ref_file" value="reference.fasta" ftype="fasta"/>
             <param name="fastq_input_selector" value="paired_collection" />
             <param name="fastq_input">
                 <collection type="paired">
-                    <element name="forward" ftype="fastqsanger" value="mutant_R1.fastq" />
-                    <element name="reverse" ftype="fastqsanger" value="mutant_R2.fastq" />
+                    <element name="forward" ftype="fastqsanger" value="b_1.fastq" />
+                    <element name="reverse" ftype="fastqsanger" value="b_2.fastq" />
                 </collection>
             </param>
+            <param name="mincov" value="2" />
+            <param name="minqual" value="60" />
             <param name="outputs" value="outgff,outsum" />
-            <output name="snpsum" ftype="tabular" file="fna_ref/snps.txt" lines_diff="6" />
-            <output name="snpgff" ftype="gff3" file="fna_ref/snps.gff" />
+            <output name="snpsum" ftype="tabular" file="b_fna_ref_mincov_2_minqual_60.snps.txt" lines_diff="6" />
+            <output name="snpgff" ftype="gff3" file="b_fna_ref_mincov_2_minqual_60.snps.gff" />
         </test>
 
+        <test>            <!-- test 3 - fasta ref one snp single -->
+            <!-- <param name="ref" value="reference.fasta" ftype="fasta" /> -->
+            <param name="reference_source|reference_source_selector" value="history"/>
+            <param name="reference_source|ref_file" value="reference.fasta" ftype="fasta"/>
+            <param name="fastq_input_selector" value="single" />
+            <param name="fastq_input_single" value="b_2.fastq" ftype="fastqsanger" />
+            <param name="mincov" value="2" />
+            <param name="minqual" value="60" />
+            <param name="outputs" value="outgff,outsum" />
+            <output name="snpsum" ftype="tabular" file="b_fna_ref_mincov_2_minqual_60.snps.txt" lines_diff="6" />
+            <output name="snpgff" ftype="gff3" file="b_2_fna_ref_mincov_2_minqual_60.snps.gff" />
+        </test>
+
+        <test>            <!-- test 4 - reference source as cached -->
+            <param name="reference_source|reference_source_selector" value="cached"/>
+            <param name="reference_source|ref_file" value="test_id"/>
+            <param name="fastq_input_selector" value="single" />
+            <param name="fastq_input_single" value="b_2.fastq" ftype="fastqsanger" />
+            <param name="mincov" value="2" />
+            <param name="minqual" value="60" />
+            <param name="outputs" value="outgff,outsum" />
+            <output name="snpsum" ftype="tabular" file="b_fna_ref_mincov_2_minqual_60.snps.txt" lines_diff="6" />
+            <output name="snpgff" ftype="gff3" file="b_2_fna_ref_mincov_2_minqual_60.snps.gff" />
+        </test>
     </tests>
 
 
@@ -245,6 +266,8 @@
 
     - minimum fraction - Float - Minumum proportion for variant evidence (default '0.9')
 
+    - minimum quality - Float - Minumum QUALITY in VCF column 6 (default '100.0')
+
     - rgid - String -         Use this @RG ID: in the BAM header (default '')
 
     - bwaopt - Extra BWA MEM options, eg. -x pacbio (default '')
@@ -253,7 +276,7 @@
 
     For a much more in depth description of snippy and how it works, see https://github.com/tseemann/snippy
 
-    ]]></help>
-  <expand macro="citations"/>
+    ]]>    </help>
+    <expand macro="citations"/>
 
 </tool>