Repository 'ivar_variants'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/ivar_variants

Changeset 7:252dfb042563 (2021-06-11)
Previous changeset 6:147465efa99c (2021-06-10) Next changeset 8:aea7008fe1f1 (2021-08-05)
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ivar/ commit 80ad6146e8852fb04fbdbe7b14ab120eee605e3a"
modified:
ivar_variants.xml
added:
test-data/zika/Z52_a_pass.vcf
b
diff -r 147465efa99c -r 252dfb042563 ivar_variants.xml
--- a/ivar_variants.xml Thu Jun 10 22:06:04 2021 +0000
+++ b/ivar_variants.xml Fri Jun 11 15:42:14 2021 +0000
[
@@ -1,4 +1,4 @@
-<tool id="ivar_variants" name="ivar variants" version="@VERSION@+galaxy1">
+<tool id="ivar_variants" name="ivar variants" version="@VERSION@+galaxy2">
     <description>Call variants from aligned BAM file</description>
     <macros>
         <import>macros.xml</import>
@@ -13,13 +13,14 @@
         samtools mpileup -A -d 0 --reference ref.fa -B -Q 0 sorted.bam | ivar variants 
         -p variants
         -q $min_qual
-        -t $min_freq &&
-        #if str($output_format.choice) == 'vcf'
-            python '${__tool_directory__}/ivar_variants_to_vcf.py' 
+        -t $min_freq 
+        #if str($output_format.choice) == "tabular" or str($output_format.choice) == "tabular_and_vcf"
+            && cp variants.tsv '$output_variants_tabular'
+        #end if
+        #if str($output_format.choice) == 'vcf' or str($output_format.choice) == "tabular_and_vcf"
+            && python '${__tool_directory__}/ivar_variants_to_vcf.py' 
             ${output_format.pass_only}
-            variants.tsv '$output_variants'
-        #else
-            cp variants.tsv '$output_variants'
+            variants.tsv '$output_variants_vcf'
         #end if
     ]]>    </command>
     <inputs>
@@ -31,25 +32,33 @@
             <param name="choice" type="select" label="Output format">
                 <option value="tabular">Tabular (native tool output)</option>
                 <option value="vcf">VCF</option>
+                <option value="tabular_and_vcf">Both Tabular and 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_and_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}">
-            <change_format>
-                <when input="output_format.choice" value="vcf" format="vcf" />
-            </change_format>
+        <data name="output_variants_tabular" format="tabular" label="${tool.name} tabular output on ${on_string}">
+            <filter>output_format['choice'] == 'tabular' or output_format['choice'] == 'tabular_and_vcf'</filter>
+            <actions>
+                <action name="column_names" type="metadata" default="REGION,POS,REF,ALT,REF_DP,REF_RV,REF_QUAL,ALT_DP,ALT_RV,ALT_QUAL,ALT_FREQ,TOTAL_DP,PVAL,PASS,GFF_FEATURE,REF_CODON,REF_AA,ALT_CODON,ALT_AA" />
+            </actions>
+        </data>
+        <data name="output_variants_vcf" format="vcf" label="${tool.name} VCF on ${on_string}">
+            <filter>output_format['choice'] == 'vcf' or output_format['choice'] == 'tabular_and_vcf'</filter>
         </data>
     </outputs>
     <tests>
         <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" ftype="tabular" lines_diff="10"/>
+            <output name="output_variants_tabular" 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" />
@@ -57,8 +66,19 @@
             <conditional name="output_format">
                 <param name="choice" value="vcf" />
             </conditional>
-            <output name="output_variants" file="zika/Z52_a.vcf" ftype="vcf"/>
+            <output name="output_variants_vcf" file="zika/Z52_a.vcf" ftype="vcf"/>
         </test>
+        <test expect_num_outputs="2">
+            <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="tabular_and_vcf" />
+                <param name="pass_only" value="true" />
+            </conditional>
+            <output name="output_variants_tabular" file="zika/Z52_a.tsv" ftype="tabular" lines_diff="10"/>
+            <output name="output_variants_vcf" file="zika/Z52_a_pass.vcf" ftype="vcf"/>
+        </test>
+
     </tests>
     <help><![CDATA[
         iVar uses the output of the samtools mpileup command to call variants -
b
diff -r 147465efa99c -r 252dfb042563 test-data/zika/Z52_a_pass.vcf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/zika/Z52_a_pass.vcf Fri Jun 11 15:42:14 2021 +0000
b
@@ -0,0 +1,24 @@
+##fileformat=VCFv4.2
+##source=iVar
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=REF_DP,Number=1,Type=Integer,Description="Depth of reference base">
+##INFO=<ID=REF_RV,Number=1,Type=Integer,Description="Depth of reference base on reverse reads">
+##INFO=<ID=REF_QUAL,Number=1,Type=Integer,Description="Mean quality of reference base">
+##INFO=<ID=ALT_DP,Number=1,Type=Integer,Description="Depth of alternate base">
+##INFO=<ID=ALT_RV,Number=1,Type=Integer,Description="Deapth of alternate base on reverse reads">
+##INFO=<ID=ALT_QUAL,Number=1,Type=Integer,Description="Mean quality of alternate base">
+##INFO=<ID=AF,Number=1,Type=Float,Description="Frequency of alternate base">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FILTER=<ID=PASS,Description="Result of p-value <= 0.05">
+##FILTER=<ID=FAIL,Description="Result of p-value > 0.05">
+#CHROM POS ID REF ALT QUAL FILTER INFO
+PRV 1682 . C T . PASS DP=1133;REF_DP=1097;REF_RV=984;REF_QUAL=37;ALT_DP=34;ALT_RV=33;ALT_QUAL=37;AF=0.0300088
+PRV 1965 . T G . PASS DP=365;REF_DP=302;REF_RV=113;REF_QUAL=37;ALT_DP=63;ALT_RV=25;ALT_QUAL=37;AF=0.172603
+PRV 2781 . T G . PASS DP=408;REF_DP=354;REF_RV=70;REF_QUAL=37;ALT_DP=48;ALT_RV=8;ALT_QUAL=36;AF=0.117647
+PRV 2922 . C T . PASS DP=275;REF_DP=264;REF_RV=0;REF_QUAL=36;ALT_DP=11;ALT_RV=0;ALT_QUAL=36;AF=0.04
+PRV 3148 . Y T . PASS DP=1707;REF_DP=0;REF_RV=0;REF_QUAL=0;ALT_DP=1324;ALT_RV=264;ALT_QUAL=36;AF=0.77563
+PRV 3148 . Y C . PASS DP=1707;REF_DP=0;REF_RV=0;REF_QUAL=0;ALT_DP=381;ALT_RV=75;ALT_QUAL=36;AF=0.223199
+PRV 3295 . A G . PASS DP=1040;REF_DP=1002;REF_RV=1002;REF_QUAL=35;ALT_DP=38;ALT_RV=38;ALT_QUAL=33;AF=0.0365385
+PRV 5680 . C T . PASS DP=35;REF_DP=27;REF_RV=5;REF_QUAL=44;ALT_DP=8;ALT_RV=2;ALT_QUAL=46;AF=0.228571
+PRV 7916 . C T . PASS DP=432;REF_DP=351;REF_RV=289;REF_QUAL=36;ALT_DP=81;ALT_RV=78;ALT_QUAL=37;AF=0.1875
+PRV 9713 . C T . PASS DP=387;REF_DP=374;REF_RV=0;REF_QUAL=37;ALT_DP=13;ALT_RV=0;ALT_QUAL=35;AF=0.0335917