-
Notifications
You must be signed in to change notification settings - Fork 752
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
Module parameter inheritance and parameter wrapping #32
Comments
Copied from Slack: As ugly as it sounds I think the easiest and possibly the most flexible option is to only define inputs and outputs in the actual module file and no other parameter definitions (other than Additional parameters would then be provided by a string of some sort with the hope that the downstream tool validates these parameters! Would be nice if we can make the variable name for optional parameters standardised e.g. |
Agreed - my way of saying basically the same thing (I think) is this: I think that the default module command should be as simple as possible, with dedicated parameters for the required options (will often not be any if the essential options are covered by input and output channels). Then any additional optional flags could go in a generic string param as @drpatelh suggests above. So using the cutadapt example above, if it was impossible to run cutadapt with the As mentioned on slack, the Remember that pipeline authors can make these generic strings however they like, so can define their own convenience Phil |
Note that @FelixKrueger is using the "simple string" approach in his DSL2 modules. See #30 for example. Also note that starting with the "simple string" approach is not incompatible with manually adding other params - these can be added on to that string as done in #28 - though maybe we should avoid this and keep things simple (at risk of being a complete hypocrite here, sorry). |
We have agreed on passing all optional parameters via an |
* Adding module for miniprot_index. * Adding module for miniprot_index. * Adding module for miniprot_index. * Adding module for miniprot_index. * Adding module for miniprot_index. * Adding module for miniprot_index. * Adding module for miniprot_index. * update the wrong file name * put back the test data path * change index file name Co-authored-by: Guoying Qi <[email protected]> * Adding module for miniprot/align (#31) * Adding module for miniprot/align. Closes #1 * Adding module for miniprot/align. Closes #1 * Adding module for <software/tool>. Closes #<issue_number>. * removed gtf flag from main.nf and meta.yml * removed gtf flag from main.nf and meta.yml * incorporate comments * incorporate comments * fixed a bug, swapped the order of reference and protein (#32) * Fixed the paths for the new modules structure * Switched to the nf-core test data and the biocontainer * This output is actually named "index" * linting * Fixed the tool name * Added a meta map to the reference index too, as per the latest nf-core usage * Added another keyword Co-authored-by: YSims <[email protected]> Co-authored-by: Guoying Qi <[email protected]> Co-authored-by: Matthias De Smet <[email protected]>
Copied from the slack channel:
Hi guys,
Can I get your feedback on a custom parameter inheritance model we have built-in for our modules?
Our user story is such that we wanted a set of default params defined inside the module to run the process in the case that the user imports the module and does nothing else.
We then wanted to be able to override the params with those from the parent nf file, but without making large boilerplate calls using addParams or by passing arguments as channels as we feel these should be retained for data.
Finally, we wanted to be able to set group parameters on multiple includes of the same module but retaining the ability to override the module params individually if we wanted to.
We found during our testing that any module params defined actually override the global parameters which is the opposite of what we wanted. This forces either the route via addParams or the route via channels, neither of which we wanted to use.
I constructed a custom groovy class which automatically overrides the params by matching names. First, the module params are prefixed with
internal_*
- then any parameter in the parent nf file can override an internal param by prefixing with the module name (e.g for cutadaptparams.cutadapt_adapter_seq
would overrideparams.internal_adapter_seq
inside the module.This provides a model where defaults are used unless explicitly overridden in the parent. The same param is overridden in all module instances unless specifically overridden using
addParams
. This gives us the flexibility for example to define a global adapter sequence for cutadapt, but define separate output directories for each module instance.The functionality requires 3 lines of code per module to implement.
I have posted the code below - please ignore the rest of the module parameter wise as we are still building out and generalising (we also know there is a cutadapt module, its just an easy example)
The text was updated successfully, but these errors were encountered: