The conditional process example is a great example, but it only covers a conditional based on a pre-set param value (params.flag in the example), and does not cover dynamic conditionals based on process/workflow output. For example, one may want to run Sub-workflow1 if Process1 generates non-empty files, while Sub-workflow2 is run if the files are all empty.
...since MY_PROCESS.out.map{ it.size() }.sum() is not considered an integer that can be compared to 0. So how can one handle dynamic flow control in Nextflow, based on process/workflow output?
The conditional process example is a great example, but it only covers a conditional based on a pre-set
param
value (params.flag
in the example), and does not cover dynamic conditionals based on process/workflow output. For example, one may want to run Sub-workflow1 if Process1 generates non-empty files, while Sub-workflow2 is run if the files are all empty.Code like the following does not work:
...since
MY_PROCESS.out.map{ it.size() }.sum()
is not considered an integer that can be compared to0
. So how can one handle dynamic flow control in Nextflow, based on process/workflow output?