Optional steps in workflow can't be connected to one another

Hello !

I’m currently building a workflow in which I’d like to have an optional Kraken2 / Krona step, which the user could toggle on or off.

I’ve been trying to use a boolean input in order to implement that, but for some reason the output of the optional Kraken2 step refuses to serve as the input for the (also optional, same boolean) Krakentools conversion step.

I’m quite puzzled as to why that is, since the same configuration works just fine for the next step (the Krona piechart)

Server is usegalaxy.eu

Link to workflow here

Screenshots of unusual behavior:

Both steps rely on the same boolean, yet I cannot connect the two, with the error message “cannot connect an optional output to a non-optional input”. I believe it should work, but perhaps I’m not using the boolean as I should.

Thanks a lot !

Hi,

Galaxy currently isn’t clever enough to figure out the entire logic flow in your WF.

What it complains about is that you are connecting the output of an optional step to a non-optional input parameter.

There are a few ways around this:

the simplest and most elegant is to gather all the optional steps that are dependent on the same boolean into a sub-workflow and have the boolean control whether the entire sub-workflow will run or not.

if you prefer a flat WF, you can use the expression tool “Pick parameter value” to pick the first dataset connected to it and connect its dataset input to the output of an optional step. The result of running this tool configured like here:

will be the original dataset if the previous step has run, or a null dataset if it hasn’t, but your optional next step won’t run in that case anyway. However you will need to plug in this tool after each optional step in your WF.

1 Like

Thanks a lot! I’ve opted for the second solution, it seems to work perfectly!

If anyone with a similar issue happens to stumble on this thread later on, here’s what the solution looks like in the workflow editor:

With a “Pick parameter value” tool inserted in between each of the optional steps

2 Likes