How to encode conditionnal input with non equal test in the when statement

Dear all,

I develop a suite of tools which become too big and I want to reduce the number of wrappers and factorizing common input or param.

Imagine 3 tools and 3 parameters:

  • tool1 has one specific parameter parm1
  • tool2and tool3 share param2 and param3

My first idea was to use conditional statement

        <conditional name="tools">
            <param name="tool_name" type="select" label="">
                <option value="tool1"/>
                <option value="tool2"/>
                <option value="tool3"/>
            </param>

but the when tag do not accept negative test, like,

<when value != "tool1"> ... </when>

Then I thought to use same strategy as for conditional output using the filter tag (Galaxy Tool XML File — Galaxy Project 25.0.dev0 documentation) but it does not exist for input…

Do you have any idea how I could do thus thing (if it’s even possible).

Thanks for your advices.

Best regards

Maria

Welcome @mariabernard

Looking at some existing tool that have different “modes of operation” is one place to start. This is the first one I can think of offhand. You can find it in the Main ToolShed

Please give that a review. It seems the leading if/else statement is something interesting for you.

Plameno can help with testing the logic, too. You are probably using this already but I’m going to link it in as a reference.

Hopefully this helps but we can follow up more! :hammer_and_wrench:

Thank @jennaj for your quick reply.

Unfortunately it does not correspond to what I want.
I will look into it more deeper and maybe come again here to ask for advice.

Have a nice day

Maria

Hi @mariabernard

I’m sorry that didn’t help. It seemed to me that you could place each tool as mode of operation, then reuse the portions of the form that apply to common tools, and remove others based on how the user toggles the “mode” (where each mode corresponds to a tool).

Another example is in this tool. The form changes based on the initial selection.

You are welcome to share more details to help explain what is being misunderstood. Thanks! :hammer_and_wrench:

finally, I think that the classic

<conditional>
<when tool1>
<\when>
<when tool2>
<\when>
<\conditional

with repeating parameter inside when statetment should work. I was looking for a more nice code to avoid repeating <param\> line…

I will look deeper into it, but thanks for your help.

1 Like

Hi @mariabernard

Another option in those examples is the use of macros.

These are defined in the Planemo docs with examples here.

Maybe you could make one for your tool suite as a whole, then reference it in all of the components? Then cluster the highly similar components into tool forms with the toggle modes?

Let’s also bring in some of our tool developers. Maybe they have better ideas or can at least explain it clearer than I am! :slight_smile: Feel free to join the chat, too! You're invited to talk on Matrix

Macros are indeed the solution here.

one for your tool suite as a whole

This is certainly possible, but if the different tools have resource requirement this makes it harder for the admins.

Indeed it’s what I have starting to do.

It’s less sophisticated than what I was thinking, but simpler is sometimes better!

Again thanks for your help