-
Notifications
You must be signed in to change notification settings - Fork 734
Description
New feature
In order to increase reusability of processes and (sub)workflows across pipelines we need flexibility in terms of what
arguments are customized at each invocation. The most convenient syntax would include both:
- defining default values for arguments as well as
- the possibility of skipping arguments by naming those that we are giving values to explicitly.
Number (2) is compatible to continue support of positional arguments even with mixtures as is supported by other languages like R.
Usage scenario
Improve dramatically reusability of processes and workflows across pipelines
Very often the same tools are used over and over by different analyses pipelines. These pipeline may need to customize the same tool invocation in different way. Therefore in order to be able to reuse the same code the tool wrapping process/workflow has to be
a "common multiple" in terms of arguments provide forcing each pipeline to provide sensible defaults for those arguments that are not relevant to them.
Shift tool wrapper development to the source
Adding support for optional arguments would give tool providing projects the chance to produce their own Nextflow API/bindings to access their tools for the benefit of Nextflow users. They wouldn't need to guess how their tools are going to be used by third parties. They simply produce flexible wrappers that expose every possible argument where only required one need to be explicitly set.
(What's the main usage case and the deployment scenario addressed by this proposal)
Suggest implementation
The syntax for processes definition would be something similar to this:
process tabix {
input:
path(input_file)
val(regions = []) // empty means whole genome
val(csi = false)
val(comment = "#")
val(skip_lines = 0)
....
}
Then you can invoke it like so:
tabix(vcf_files, ["chr1", "chr2", "chr3:10000-200000"])
tabix(input_file = vcf_files, regions = ["chr1", "chr2", "chr3:10000-200000"])
tabix(vcf_files, comment = ";")
tabix(comment = ";", vcf_files) // anonymous parameters are taken in their declaration order.
By adding a default value you are implicitly declaring the input 'optional' and so there is no need for the 'optional' tag/keyword.