diff ivar_variants.xml @ 6:147465efa99c draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ivar/ commit 847ec10cd36ea4f3cd4c257d5742f0fb401e364e"
author iuc
date Thu, 10 Jun 2021 22:06:04 +0000
parents 12d66d0d05ac
children 252dfb042563
line wrap: on
line diff
--- a/ivar_variants.xml	Wed May 19 16:49:13 2021 +0000
+++ b/ivar_variants.xml	Thu Jun 10 22:06:04 2021 +0000
@@ -1,9 +1,11 @@
-<tool id="ivar_variants" name="ivar variants" version="@VERSION@+galaxy0">
+<tool id="ivar_variants" name="ivar variants" version="@VERSION@+galaxy1">
     <description>Call variants from aligned BAM file</description>
     <macros>
         <import>macros.xml</import>
     </macros>
-    <expand macro="requirements" />
+    <expand macro="requirements">
+        <requirement type="package" version="3">python</requirement>
+    </expand>
     <expand macro="version_command" />
     <command detect_errors="exit_code"><![CDATA[
         ln -s '$ref' ref.fa &&
@@ -11,22 +13,51 @@
         samtools mpileup -A -d 0 --reference ref.fa -B -Q 0 sorted.bam | ivar variants 
         -p variants
         -q $min_qual
-        -t $min_freq
+        -t $min_freq &&
+        #if str($output_format.choice) == 'vcf'
+            python '${__tool_directory__}/ivar_variants_to_vcf.py' 
+            ${output_format.pass_only}
+            variants.tsv '$output_variants'
+        #else
+            cp variants.tsv '$output_variants'
+        #end if
     ]]>    </command>
     <inputs>
         <param name="input_bam" type="data" format="bam" label="Bam file" help="Aligned reads, to trim primers and quality"/>
         <param name="ref" type="data" format="fasta" label="Reference"/>
         <param name="min_qual" argument="-q" type="integer" min="1" value="20" label="Minimum quality score threshold to count base"/>
         <param name="min_freq" argument="-t" type="float" min="0" max="1" value="0.03" label="Minimum frequency threshold"/>
+        <conditional name="output_format">
+            <param name="choice" type="select" label="Output format">
+                <option value="tabular">Tabular (native tool output)</option>
+                <option value="vcf">VCF</option>
+            </param>
+            <when value="vcf">
+                <param argument="--pass_only" type="boolean" truevalue="--pass_only" falsevalue="" label="In VCF only output variants that PASS all filters" />
+            </when>
+            <when value="tabular" />
+        </conditional>    
     </inputs>
     <outputs>
-        <data name="output_variants" format="tabular" label="${tool.name} on ${on_string}" from_work_dir="variants.tsv"/>
+        <data name="output_variants" format="tabular" label="${tool.name} on ${on_string}">
+            <change_format>
+                <when input="output_format.choice" value="vcf" format="vcf" />
+            </change_format>
+        </data>
     </outputs>
     <tests>
-        <test>
+        <test expect_num_outputs="1">
             <param name="input_bam" value="zika/Z52_a.masked.sorted.bam" />
             <param name="ref" value="zika/db/PRV.fa" />
-            <output name="output_variants" file="zika/Z52_a.tsv" lines_diff="10"/>
+            <output name="output_variants" file="zika/Z52_a.tsv" ftype="tabular" lines_diff="10"/>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="input_bam" value="zika/Z52_a.masked.sorted.bam" />
+            <param name="ref" value="zika/db/PRV.fa" />
+            <conditional name="output_format">
+                <param name="choice" value="vcf" />
+            </conditional>
+            <output name="output_variants" file="zika/Z52_a.vcf" ftype="vcf"/>
         </test>
     </tests>
     <help><![CDATA[
@@ -43,6 +74,15 @@
         required for a SNV or indel to be reported.
         
         Documentation can be found at `<https://andersen-lab.github.io/ivar/html/manualpage.html>`_.
+
+        Optionally output is converted to VCF using a version of the `ivar_variants_to_vcf.py script <https://github.com/nf-core/viralrecon/blob/dev/bin/ivar_variants_to_vcf.py>`_,
+        that has been modified to store attributes in INFO fields.
     ]]>    </help>
-    <expand macro="citations" />
+    <expand macro="citations">
+        <citation type="bibtex">@misc{githubivar_variants_to_vcf,
+            author = {Fernandez, Sarai Varona and Patel, Harshil},
+            year = {2021},
+            title = {ivar_variants_to_vcf},
+            url = {https://github.com/nf-core/viralrecon/blob/dev/bin/ivar_variants_to_vcf.py}
+        }</citation>    </expand>
 </tool>