view compose_text_param.xml @ 0:feb3acba1e0a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/compose_text_param commit 8aabc55146cdeb7ca2f0ab9d55d2f044ab59e569
author iuc
date Fri, 07 Jun 2019 09:22:41 -0400
parents
children e188c9826e0f
line wrap: on
line source

<tool name="Compose text parameter value" id="compose_text_param" version="0.1.0" profile="19.05" tool_type="expression">
    <description>from parameters</description>
    <expression type="ecma5.1">
{
    let s = "";
    for (const repeat of $job.components) {
        s += repeat.param_type.component_value
    };
    return {'output': s};
}
    </expression>
    <inputs>
        <repeat name="components" min="1">
            <conditional name="param_type">
                <param name="select_param_type" type="select" label="Choose the type of parameter for this field">
                    <option value="text">Text Parameter</option>
                    <option value="integer">Integer Parameter</option>
                    <option value="float">Float Parameter</option>
                </param>
                <when value="text">
                    <param name="component_value" type="text" label="Enter text that should be part of the computed value"/>
                </when>
                 <when value="integer">
                    <param name="component_value" value="" type="integer" label="Enter integer that should be part of the computed value"/>
                </when>
                 <when value="float">
                    <param name="component_value" value="" type="float" label="Enter float that should be part of the computed value"/>
                </when>
            </conditional>
        </repeat>
    </inputs>
    <outputs>
        <output type="text" name="out1" from="output" />
    </outputs>
    <tests>
        <test>
            <repeat name="components">
                <conditional name="param_type">
                    <param name="select_param_type" value="text"/>
                    <param name="component_value" value="Text: "/>
                </conditional>
            </repeat>
            <repeat name="components">
                <conditional name="param_type">
                    <param name="select_param_type" value="text"/>
                    <param name="component_value" value="value,"/>
                </conditional>
            </repeat>
            <repeat name="components">
                <conditional name="param_type">
                    <param name="select_param_type" value="text"/>
                    <param name="component_value" value=" Integer: "/>
                </conditional>
            </repeat>
            <repeat name="components">
                <conditional name="param_type">
                    <param name="select_param_type" value="integer"/>
                    <param name="component_value" value="1"/>
                </conditional>
            </repeat>
            <repeat name="components">
                <conditional name="param_type">
                    <param name="select_param_type" value="text"/>
                    <param name="component_value" value=", Float: "/>
                </conditional>
            </repeat>
            <repeat name="components">
                <conditional name="param_type">
                    <param name="select_param_type" value="float"/>
                    <param name="component_value" value="1.5"/>
                </conditional>
            </repeat>
            <output name="output">
                <assert_contents> 
                    <!-- <has_line line="'"Text: value, Integer: 1, Float: 1.5"'"/> -->
                    <has_line line="&quot;Text: value, Integer: 1, Float: 1.5&quot;"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
This tool concatenates each parameter value to a string.
If used in a workflow you can connect the output to any
text parameter value.
    ]]></help>
</tool>