diff bcftools_filter.xml @ 16:e7452697afd9 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit db275932cbb485cb44ae91e0b421d6f57698db49
author iuc
date Tue, 20 Sep 2022 13:17:14 +0000
parents e4988fd4d503
children
line wrap: on
line diff
--- a/bcftools_filter.xml	Sat Jul 23 13:39:59 2022 +0000
+++ b/bcftools_filter.xml	Tue Sep 20 13:17:14 2022 +0000
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='utf-8'?>
-<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@">
+<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
     <description>Apply fixed-threshold filters</description>
     <macros>
         <token name="@EXECUTABLE@">filter</token>
@@ -29,8 +29,9 @@
   #set $mode = str($section.mode).replace(',','')
   --mode '$mode'
 #end if
-#if $section.soft_filter:
-  --soft-filter "${section.soft_filter}"
+#if $section.conditional_soft_filter.selector == 'enabled':
+  --soft-filter '${section.conditional_soft_filter.soft_filter}'
+  @MASK@
 #end if
 #if $section.select_set_GTs:
   --set-GTs "${section.select_set_GTs}"
@@ -70,11 +71,22 @@
                 <option value="+">(+) append new FILTER strings of failed sites instead of replacing them</option>
                 <option value="x">(x) resets filters of sites which pass to "PASS"</option>
             </param>
-            <param name="soft_filter" type="text" value="" label="Soft Filter" optional="true">
-                <help><![CDATA[ (-s) 
-                   Annotate FILTER column with STRING or, with +, a unique filter name generated by the program ("Filter%d").
-                ]]></help>
-            </param>
+            <conditional name="conditional_soft_filter">
+                <param name="selector" type="select" label="Perform soft filtering">
+                    <option value="disabled">Disabled</option>
+                    <option value="enabled">Enabled</option>
+                </param>
+                <when value="disabled"/>
+                <when value="enabled">
+                    <param argument="--soft-filter" type="text" value="" label="Soft Filter" optional="true">
+                        <help><![CDATA[ (-s) 
+                           Annotate FILTER column with STRING or, with +, a unique filter name generated by the program ("Filter%d").
+                        ]]></help>
+                    </param>
+                    <expand macro="macro_restrict" type="mask" label_type="Mask"/>
+                </when>
+            </conditional>
+
             <param name="select_set_GTs" type="select" label="Set genotypes of failed samples"  optional="true" help="(-S)">
                 <option value=".">to missing (.)</option>
                 <option value="0">to REF (0)</option>
@@ -107,9 +119,9 @@
             <param name="output_type" value="v" />
             <output name="output_file">
                 <assert_contents>
-                    <has_text text="Modified" />
+                    <has_text text="genotypes" />
                     <has_text text="AN=2;AC=1" />
-                    <has_text_matching expression="TAAAA\tTA,T\t61.5\tModified" />
+                    <has_text_matching expression="TAAAA\tTA,T\t61.5\tPASS" />
                 </assert_contents>
             </output>
         </test>
@@ -128,7 +140,12 @@
         <test>
             <param name="input_file" ftype="vcf" value="filter.3.vcf" />
             <param name="exclude" value="INFO/DP=19" />
-            <param name="soft_filter" value="XX" />
+            <section name="sec_filter">
+                <conditional name="conditional_soft_filter">
+                    <param name="selector" value="enabled"/>
+                    <param name="soft_filter" value="XX" />
+                </conditional>
+            </section>
             <param name="output_type" value="v" />
             <output name="output_file">
                 <assert_contents>
@@ -140,12 +157,17 @@
         <test>
             <param name="input_file" ftype="vcf" value="filter.3.vcf" />
             <param name="exclude" value="INFO/DP=19" />
-            <param name="soft_filter" value="XX" />
-            <param name="mode" value="+" />
+            <section name="sec_filter">
+                <conditional name="conditional_soft_filter">
+                    <param name="selector" value="enabled"/>
+                    <param name="soft_filter" value="XX" />
+                    <param name="mode" value="+" />
+                </conditional>
+            </section>
             <param name="output_type" value="v" />
             <output name="output_file">
                 <assert_contents>
-                    <has_text_matching expression="\tq20;XX\tDP=19" />
+                    <has_text_matching expression="238\tXX\tDP=19" />
                     <has_text_matching expression="\tq20\tAO" />
                 </assert_contents>
             </output>
@@ -153,26 +175,36 @@
         <test>
             <param name="input_file" ftype="vcf" value="filter.3.vcf" />
             <param name="exclude" value="INFO/DP=19" />
-            <param name="soft_filter" value="XX" />
-            <param name="mode" value="x" />
+            <section name="sec_filter">
+                <conditional name="conditional_soft_filter">
+                    <param name="selector" value="enabled"/>
+                    <param name="soft_filter" value="XX" />
+                    <param name="mode" value="+" />
+                </conditional>
+            </section>
             <param name="output_type" value="v" />
             <output name="output_file">
                 <assert_contents>
                     <has_text_matching expression="\tXX\tDP=19" />
-                    <has_text_matching expression="\tPASS\tAO" />
+                    <has_text_matching expression="\tq20\tAO=52101" />
                 </assert_contents>
             </output>
         </test>
         <test>
             <param name="input_file" ftype="vcf" value="filter.3.vcf" />
             <param name="exclude" value="INFO/DP=19" />
-            <param name="soft_filter" value="XX" />
-            <param name="mode" value="+,x" />
+            <section name="sec_filter">
+                <conditional name="conditional_soft_filter">
+                    <param name="selector" value="enabled"/>
+                    <param name="soft_filter" value="XX" />
+                    <param name="mode" value="+" />
+                </conditional>
+            </section>
             <param name="output_type" value="v" />
             <output name="output_file">
                 <assert_contents>
-                    <has_text_matching expression="\tq20;XX\tDP=19" />
-                    <has_text_matching expression="\tPASS\tAO" />
+                    <has_text_matching expression="\t238\tXX\tDP=19" />
+                    <has_text_matching expression="\t238\tq20\tAO" />
                 </assert_contents>
             </output>
         </test>
@@ -198,6 +230,48 @@
                 </assert_contents>
             </output>
         </test>
+        <!-- Test region overlap -->
+        <test>
+            <param name="input_file" ftype="vcf" value="filter.2.vcf" />
+            <param name="include" value="FMT/GT=&quot;0/0&quot; &amp;&amp; AC[*]=2" />
+            <param name="output_type" value="v" />
+            <section name="sec_restrict">
+                <param name="regions_overlap" value="1"/>
+            </section>
+            <output name="output_file">
+                <assert_contents>
+                    <has_text text="AN=4;AC=2" />
+                    <not_has_text text="AN=4;AC=0" />
+                </assert_contents>
+            </output>
+            <assert_command>
+                <has_text text="--regions-overlap" />
+            </assert_command>
+        </test>
+        <!-- Test mask options-->
+        <test>
+            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
+            <param name="exclude" value="INFO/DP=19" />
+            <section name="sec_filter">
+                <param name="mode" value="+,x" />
+                <conditional name="conditional_soft_filter">
+                    <param name="selector" value="enabled"/>
+                    <param name="soft_filter" value="XX" />
+                    <param name="masks_overlap" value="1"/>
+                </conditional>
+            </section>
+
+            <param name="output_type" value="v" />
+            <output name="output_file">
+                <assert_contents>
+                    <has_text_matching expression="\tq20;XX\tDP=19" />
+                    <has_text_matching expression="\tPASS\tAO" />
+                </assert_contents>
+            </output>
+            <assert_command>
+                <has_text text="--mask-overlap" />
+            </assert_command>
+        </test>
     </tests>
     <help><![CDATA[
 =====================================