Question: Filter synthax for nested conditionals
gravatar for Rob
2.8 years ago by
Rob50 wrote:


I write a tool and I have a problem with the outputs generated :

My script is :

<tool id=Pl" name="Parallel">
<command interpreter="bash">
#if ($Step.Multithread.threads is True): $input $Step.Multithread.nb_threads $output
#else $input
#end if
    <param name="input" type="data" label="Input" />
    <conditional name="Step">
        <param name="step_select" type="select" label="Choose a step>
            <option value="step1" selected="true">Step 1</option>
            <option value="step2">Step 2</option>
        <when value="step1">
            <param name="A" type="integer" label="A" value="1"/>
        <when value="step2">
            <conditional name="Multithread">
                <param name="threads" type="boolean" checked="no" label="Multithreads" value="1"/>
                <when value="true">
                    <param name="nb_threads" type="integer" label="Number threads" value="32"/>
                    <!-- If it's yes, I want to return a file, if it's no, I don't.-->
                <when value="false"></when>

    <data name="output1" label="${}_${Step.Multithread.nb_threads}.out">
            <!-- output name : input_32.out-->
            <filter>(Step['step_select'] == 'step2') and (Step.Multithread['threads'] is True)</filter>

In this case, Galaxy return an output every time, and doesn't care about which value in the boolean threads is selected.
I read the doc multiple time, and I don't see where the error come from (Is there a problem with the nested conditional ?).
Can you see what I am doing wrong ?

Thanks for your help,

synthax conditional galaxy filter • 1.0k views
ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by Rob50
gravatar for Rob
2.8 years ago by
Rob50 wrote:


After multiple tests, it appears that the problem was in the filter syntax.

The proper syntax is :

<filter>(Step['step_select'] == 'step2') and (Step['Multithread']['threads'] is True)</filter>

and not :

<filter>(Step['step_select'] == 'step2') and (Step.Multithread['threads'] is True)</filter>

So... for access to a boolean value contain in multiple conditional we are suppose to do :
- in <command> : $Step.Multithread.threads
- in <data> : ${Step.Multithread.threads}
- in <filter> : Step['Multithread']['threads']

In my opinion, this syntax doesn't have any sense. If a conditional is an object, the right way to access it should be :

Step.Multithreads.getvalue() or Step.Multithreads['threads'] if you code your getvalue() by ['threads'] but never Step['Multithread']['threads']. (This ['....'] syntax is strange btw, where does this come from ?)

But, it's my opinion, maybe there is some raison why it's like that (I'd be glad to know which one).

The main problem is in fact this information is not available on the documentation or somewhere else (or I just didn't find it) and imo it should be, because it's not obvious.


ADD COMMENTlink written 2.8 years ago by Rob50
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 171 users visited in the last hour