-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest adding the process "when:" as a process directive. #2518
Comments
If you are using DSL2, you can also just use if statements to control when processes get invoked. DSL2 has kinda made the |
There are cases when it can still be useful though. While I agree |
I see. Since the
That would actually be a real use case for using |
It works using a #! /usr/bin/env nextflow
nextflow.enable.dsl = 2
workflow {
FOO()
}
process FOO {
echo true
when:
!task.ext.args.tokenize().contains('help')
script:
def args = task.ext.args?: ''
"""
echo $args
"""
}
process {
withName: 'FOO' {
ext.args = 'save me'
// ext.args = 'help me'
}
} However, to put this back into context, nf-core modules don't include |
So how does the viralrecon workflow handle this issue if it can't use Perhaps the nf-core guidelines should be changed to allow the use of |
It looks like another workflow parameter was added to viralrecon to take care of it, and the logic is based on that. One of the aims of using nf-core modules is that there shouldn't need to be any modifications to the modules. They should be just plug and play. Any modifications mean maintaining a local copy in the workflow instead. I think someone is developing a patch system for modules, but I can't remember it's original intent. |
Yes, it is actually a guideline not to use the The only other alternative is to use |
@drpatelh What do you think about this situation with |
Yup, you're right. In this case, it wouldn't matter much but it still begs the question of whether one man's I suspect we will see more of this now though where we will need to somehow evaluate the |
Yes. The safe navigation operator isn't suitable here, but just using && will work.
|
And I just realized now we can implement this ourselves....
see: nf-core/tools#1393 |
New feature
The proposal is to add
when
as a process directive as an alternative to the processwhen:
block.Usage scenario
It allows configuration of when a process executes directly from the configuration, allowing a set of processes to be labeled and then executed as a set, for example running a set of processes that use GPU's otherwise use processes that use CPU's.
Alternatively, running a process if a param's is set without putting it directly in the process definition.
Suggest implementation
Using the same functionality of a
when:
but that conditional would be in a closure, while otherwise it would be resolved directly in the config.The text was updated successfully, but these errors were encountered: