changeset 2:5ac8a4bf7a8d draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/map_param_value commit 709b05fd21b4adba511917aa49adcb99eabed3e5
author iuc
date Wed, 10 Jan 2024 18:19:21 +0000
parents a01f088d0e5e
children
files map_param_value.xml test-data/test.txt
diffstat 2 files changed, 54 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/map_param_value.xml	Wed Oct 19 11:37:19 2022 +0000
+++ b/map_param_value.xml	Wed Jan 10 18:19:21 2024 +0000
@@ -1,10 +1,10 @@
-<tool name="Map parameter value" id="map_param_value" version="0.1.1" tool_type="expression" profile="22.01">
+<tool name="Map parameter value" id="map_param_value" version="0.2.0" tool_type="expression" profile="22.01">
     <macros>
         <xml name="when_element" tokens="type_selection">
             <param name="input_param" type="@TYPE_SELECTION@" optional="true" label="Value to map">
                 <sanitizer sanitize="false"/>
             </param>
-            <repeat name="mappings" label="Add value mapping">
+            <repeat name="mappings" title="Add value mapping">
                 <param name="from" type="@TYPE_SELECTION@" optional="true" label="Map from this value">
                     <sanitizer sanitize="false"/>
                 </param>
@@ -55,6 +55,7 @@
                 <option value="integer">Integer</option>
                 <option value="float">Float</option>
                 <option value="boolean">Boolean</option>
+                <option value="data">Dataset</option>
             </param>
             <when value="text">
                 <expand macro="when_element" type_selection="text"/>
@@ -68,6 +69,9 @@
             <when value="boolean">
                 <expand macro="when_element" type_selection="boolean"/>
             </when>
+            <when value="data">
+                <expand macro="when_element" type_selection="data"/>
+            </when>
         </conditional>
         <conditional name="unmapped">
             <param name="on_unmapped" type="select" label="Select how to handle unmapped values">
@@ -251,7 +255,7 @@
             <param name="output_param_type" value="integer"/>
             <output name="output_param_integer" value_json="2" />
         </test>
-        <test expect_num_outputs="1">A
+        <test expect_num_outputs="1">
             <!-- map string False to boolean false -->
             <conditional name="input_param_type">
                 <param name="type" value="text" />
@@ -344,12 +348,57 @@
                 <output name="output_param_text" value_json="null" />
             </test>
         -->
+        <!-- two tests (1 wo the optional input and one with the optional input) showing
+             how to map a optional input to True/False depending on if the dataset is
+             given/not -->
+        <test expect_num_outputs="1">
+            <conditional name="input_param_type">
+                <param name="type" value="data" />
+                <repeat name="mappings">
+                    <param name="to" value_json="false" />
+                </repeat>
+            </conditional>
+            <conditional name="unmapped">
+                <param name="on_unmapped" value="default"/>
+                <param name="default_value" value="true"/>
+            </conditional>
+            <param name="output_param_type" value="boolean"/>
+            <output name="output_param_text" value_json="false" />
+        </test>
+        <test expect_num_outputs="1">
+            <conditional name="input_param_type">
+                <param name="input_param" value="test.txt" ftype="txt" />
+                <param name="type" value="data" />
+                <repeat name="mappings">
+                    <param name="to" value_json="false" />
+                </repeat>
+            </conditional>
+            <conditional name="unmapped">
+                <param name="on_unmapped" value="default"/>
+                <param name="default_value" value="true"/>
+            </conditional>
+            <param name="output_param_type" value="boolean"/>
+            <output name="output_param_text" value_json="true" />
+        </test>
+        <!-- another test checking of two datasets are the same -->
+        <test expect_num_outputs="1">
+            <conditional name="input_param_type">
+                <param name="input_param" value="test.txt" ftype="txt" />
+                <param name="type" value="data" />
+                <repeat name="mappings">
+                    <param name="from" value="test.txt" ftype="txt" />
+                    <param name="to" value_json="true" />
+                </repeat>
+            </conditional>
+            <param name="output_param_type" value="boolean"/>
+            <output name="output_param_text" value_json="true" />
+        </test>
     </tests>
     <help><![CDATA[
 **What it does**
 
 Maps a parameter value to another value.
-This can be used to transform any non-data value (text, integer, float and boolean) to a different value of a different type.
+This can be used to transform any value (text, integer, float and boolean, dataset) to a different non-dataset value of a different type.
 
 **Settings**
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.txt	Wed Jan 10 18:19:21 2024 +0000
@@ -0,0 +1,1 @@
+test