comparison map_param_value.xml @ 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
comparison
equal deleted inserted replaced
1:a01f088d0e5e 2:5ac8a4bf7a8d
1 <tool name="Map parameter value" id="map_param_value" version="0.1.1" tool_type="expression" profile="22.01"> 1 <tool name="Map parameter value" id="map_param_value" version="0.2.0" tool_type="expression" profile="22.01">
2 <macros> 2 <macros>
3 <xml name="when_element" tokens="type_selection"> 3 <xml name="when_element" tokens="type_selection">
4 <param name="input_param" type="@TYPE_SELECTION@" optional="true" label="Value to map"> 4 <param name="input_param" type="@TYPE_SELECTION@" optional="true" label="Value to map">
5 <sanitizer sanitize="false"/> 5 <sanitizer sanitize="false"/>
6 </param> 6 </param>
7 <repeat name="mappings" label="Add value mapping"> 7 <repeat name="mappings" title="Add value mapping">
8 <param name="from" type="@TYPE_SELECTION@" optional="true" label="Map from this value"> 8 <param name="from" type="@TYPE_SELECTION@" optional="true" label="Map from this value">
9 <sanitizer sanitize="false"/> 9 <sanitizer sanitize="false"/>
10 </param> 10 </param>
11 <param name="to" type="text" optional="true" label="to this value" help="This value must be coercable to the selected output parameter type"> 11 <param name="to" type="text" optional="true" label="to this value" help="This value must be coercable to the selected output parameter type">
12 <sanitizer sanitize="false"/> 12 <sanitizer sanitize="false"/>
53 <param name="type" type="select" label="Select type of input parameter to match"> 53 <param name="type" type="select" label="Select type of input parameter to match">
54 <option value="text" selected="true">Text</option> 54 <option value="text" selected="true">Text</option>
55 <option value="integer">Integer</option> 55 <option value="integer">Integer</option>
56 <option value="float">Float</option> 56 <option value="float">Float</option>
57 <option value="boolean">Boolean</option> 57 <option value="boolean">Boolean</option>
58 <option value="data">Dataset</option>
58 </param> 59 </param>
59 <when value="text"> 60 <when value="text">
60 <expand macro="when_element" type_selection="text"/> 61 <expand macro="when_element" type_selection="text"/>
61 </when> 62 </when>
62 <when value="integer"> 63 <when value="integer">
65 <when value="float"> 66 <when value="float">
66 <expand macro="when_element" type_selection="float"/> 67 <expand macro="when_element" type_selection="float"/>
67 </when> 68 </when>
68 <when value="boolean"> 69 <when value="boolean">
69 <expand macro="when_element" type_selection="boolean"/> 70 <expand macro="when_element" type_selection="boolean"/>
71 </when>
72 <when value="data">
73 <expand macro="when_element" type_selection="data"/>
70 </when> 74 </when>
71 </conditional> 75 </conditional>
72 <conditional name="unmapped"> 76 <conditional name="unmapped">
73 <param name="on_unmapped" type="select" label="Select how to handle unmapped values"> 77 <param name="on_unmapped" type="select" label="Select how to handle unmapped values">
74 <option value="input">Use unmodified input parameter value if input parameter value not found in mappings</option> 78 <option value="input">Use unmodified input parameter value if input parameter value not found in mappings</option>
249 </repeat> 253 </repeat>
250 </conditional> 254 </conditional>
251 <param name="output_param_type" value="integer"/> 255 <param name="output_param_type" value="integer"/>
252 <output name="output_param_integer" value_json="2" /> 256 <output name="output_param_integer" value_json="2" />
253 </test> 257 </test>
254 <test expect_num_outputs="1">A 258 <test expect_num_outputs="1">
255 <!-- map string False to boolean false --> 259 <!-- map string False to boolean false -->
256 <conditional name="input_param_type"> 260 <conditional name="input_param_type">
257 <param name="type" value="text" /> 261 <param name="type" value="text" />
258 <param name="input_param" value="False" /> 262 <param name="input_param" value="False" />
259 <repeat name="mappings"> 263 <repeat name="mappings">
342 </repeat> 346 </repeat>
343 </conditional> 347 </conditional>
344 <output name="output_param_text" value_json="null" /> 348 <output name="output_param_text" value_json="null" />
345 </test> 349 </test>
346 --> 350 -->
351 <!-- two tests (1 wo the optional input and one with the optional input) showing
352 how to map a optional input to True/False depending on if the dataset is
353 given/not -->
354 <test expect_num_outputs="1">
355 <conditional name="input_param_type">
356 <param name="type" value="data" />
357 <repeat name="mappings">
358 <param name="to" value_json="false" />
359 </repeat>
360 </conditional>
361 <conditional name="unmapped">
362 <param name="on_unmapped" value="default"/>
363 <param name="default_value" value="true"/>
364 </conditional>
365 <param name="output_param_type" value="boolean"/>
366 <output name="output_param_text" value_json="false" />
367 </test>
368 <test expect_num_outputs="1">
369 <conditional name="input_param_type">
370 <param name="input_param" value="test.txt" ftype="txt" />
371 <param name="type" value="data" />
372 <repeat name="mappings">
373 <param name="to" value_json="false" />
374 </repeat>
375 </conditional>
376 <conditional name="unmapped">
377 <param name="on_unmapped" value="default"/>
378 <param name="default_value" value="true"/>
379 </conditional>
380 <param name="output_param_type" value="boolean"/>
381 <output name="output_param_text" value_json="true" />
382 </test>
383 <!-- another test checking of two datasets are the same -->
384 <test expect_num_outputs="1">
385 <conditional name="input_param_type">
386 <param name="input_param" value="test.txt" ftype="txt" />
387 <param name="type" value="data" />
388 <repeat name="mappings">
389 <param name="from" value="test.txt" ftype="txt" />
390 <param name="to" value_json="true" />
391 </repeat>
392 </conditional>
393 <param name="output_param_type" value="boolean"/>
394 <output name="output_param_text" value_json="true" />
395 </test>
347 </tests> 396 </tests>
348 <help><![CDATA[ 397 <help><![CDATA[
349 **What it does** 398 **What it does**
350 399
351 Maps a parameter value to another value. 400 Maps a parameter value to another value.
352 This can be used to transform any non-data value (text, integer, float and boolean) to a different value of a different type. 401 This can be used to transform any value (text, integer, float and boolean, dataset) to a different non-dataset value of a different type.
353 402
354 **Settings** 403 **Settings**
355 404
356 If the value is not found in the mapping the unmodified value is returned by default. 405 If the value is not found in the mapping the unmodified value is returned by default.
357 Select ``Fail if input parameter value not found in mappings`` if you wish the job to fail if an input could not be mapped. 406 Select ``Fail if input parameter value not found in mappings`` if you wish the job to fail if an input could not be mapped.