changeset 13:d6dc477167f8 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 8ad854180e3be0934cdb1f0021886199a2edf9c3"
author iuc
date Fri, 05 Feb 2021 19:48:42 +0000
parents e522022137f6
children 92182c270ce4
files bcftools_consensus.xml macros.xml
diffstat 2 files changed, 33 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bcftools_consensus.xml	Wed Dec 25 12:25:37 2019 -0500
+++ b/bcftools_consensus.xml	Fri Feb 05 19:48:42 2021 +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@+galaxy1">
     <description>Create consensus sequence by applying VCF variants to a reference fasta file</description>
     <macros>
         <token name="@EXECUTABLE@">consensus</token>
@@ -34,6 +34,10 @@
 #end if
 @SAMPLE@
 
+#set $section = $sec_restrict
+@INCLUDE@
+@EXCLUDE@
+
 #if $chain:
   --chain '$chain_file'
 #end if
@@ -64,6 +68,10 @@
         </section>
         <param name="chain" type="boolean" truevalue="yes" falsevalue="no" label="Write a chain file for liftover" />
         <param name="rename" type="boolean" truevalue="yes" falsevalue="no" label="Set output FASTA ID from name of VCF" />
+        <section name="sec_restrict" expanded="false" title="Restrict to">    
+            <expand macro="macro_include" />
+            <expand macro="macro_exclude" />
+        </section>
     </inputs>
     <outputs>
         <data name="output_file" format="fasta" label="${tool.name} on ${on_string}: consensus fasta"/>
@@ -119,6 +127,18 @@
                 </assert_contents>
             </output>
         </test>
+        <test>
+            <expand macro="test_using_reference" ref="consensus.fa" />
+            <param name="input_file" ftype="vcf" value="consensus.vcf" />
+            <section name="sec_restrict">
+                <param name="include" value='TYPE="snp"' />
+            </section>
+            <output name="output_file">
+                <assert_contents>
+                    <has_text text="TACAAAATATGACATATCAAAAAGAACATAACCTACGTATCAACTAAAGTGGTTGTTTGA" />
+                </assert_contents>
+            </output>
+        </test>
     </tests>
     <help><![CDATA[
 =====================================
--- a/macros.xml	Wed Dec 25 12:25:37 2019 -0500
+++ b/macros.xml	Fri Feb 05 19:48:42 2021 +0000
@@ -436,11 +436,19 @@
 #end if
   </token>
 
+  <xml name="macro_include_exclude_validate_sanitize">
+    <validator type="expression" message="Single quote or trailing backslash not allowed">"'" not in value and value[-1] != "\\"</validator>
+    <sanitizer>
+      <valid initial="string.ascii_letters,string.digits,string.whitespace,string.punctuation">
+        <remove value="@" />
+        <remove value="'" />
+      </valid>
+    </sanitizer>
+  </xml>
 
   <xml name="macro_include">
     <param argument="--include" type="text" optional="true" label="Include" help="Select sites for which the expression is true">
-        <validator type="regex" message="Single quote not allowed">^[^']*$</validator>
-        <sanitizer sanitize="False"/>
+      <expand macro="macro_include_exclude_validate_sanitize" />
     </param>
   </xml>
   <token name="@INCLUDE@">
@@ -448,11 +456,10 @@
   --include '${section.include}'
 #end if
   </token>
-
+  
   <xml name="macro_exclude">
     <param argument="--exclude" type="text" optional="true" label="Exclude" help="Exclude sites for which the expression is true">
-        <validator type="regex" message="Single quote not allowed">^[^']*$</validator>
-        <sanitizer sanitize="False"/>
+      <expand macro="macro_include_exclude_validate_sanitize" />
     </param>
   </xml>
   <token name="@EXCLUDE@">