output filter not working into a repeat param

Dear all,

I’m trying to develop a tool but I failed to properly filter output.
The aim is to repeat different type of analysis depending of the parameters. So I created a repeat parameters, with a conditional and with a select parameter. The analysis is okay but I cannot filter output data and I received empty files for non analyzed part of the code…
I tried to write the filter in different manner but it don’t work into a repeat parameter…
thanks !

An example of my code could be :

<inputs>
<repeat name="repeat" title="repeat1">
    <conditional name="conditional">
        <param name="select1" type="select">
            <option value="type1" >the type 1</option>
            <option value="type2">the type 2</option>
        </param>
        <when value="type1">
            <param name="data1" type="data" label="data1">
        </when>
        <when value="type2">
            <param name="data2" type="data" label="data2">
        </when>
    </conditional>
</repeat>.
</inputs>
<outputs>
<data name="output1" format="pdf" label="output1 from data1">
    <filter>repeat['conditional']['select1'] == 'type1' </filter>
<data name="output2" format="csv" label="output2 from data2">
    <filter>repeat['conditional']['select1'] == 'type2' </filter>
<outputs>

I think there’s a conceptual problem here. With the repeat you’re adding a variable number of conditionals, but it’s not clear what you would do in the output filter if you have multiple (conflicting?) options.

Generally speaking repeats should be represented as lists, so you would have to do something like

<data name="output1" format="pdf" label="output1 from data1">
    <filter>repeat[0]['conditional']['select1'] == 'type1' </filter>
</data>
<data name="output2" format="csv" label="output2 from data2">
    <filter>repeat[0]['conditional']['select1'] == 'type2' </filter>
</data>

I haven’t tested this, but I think it already shows the problem with the approach.

The aim is to repeat different type of analysis depending of the parameters.

I think for this purpose it would be better to create a workflow that you map over a collection of options (see Using Workflow Parameters for how to read parameters from a file).

Another approach that could work would be to discover the created outputs in a list (or two lists if you want to separate pdf and csv outputs).

2 Likes

Hi @mvdbeek thanks a lot,
Your solution with repeat[0] is great, but finally i used the collection type to extract the output.

Thank you !

2 Likes