Step 7 - Use a Map
to store parameters
Let us use a simple Map
to add 2 configuration parameters:
// Step - 7
process addTupleWithMap {
input:
tuple val(id), val(input), val(config)
output:
tuple val("${id}"), val(output)
exec:
output = (config.operator == "+")
? input + config.term
: input - config.term
}
workflow step7 {
Channel.from( [ 1, 2, 3 ] ) \
| map{ el ->
[
el.toString(),
el,
[ "operator" : "-", "term" : 10 ]
] } \
| addTupleWithMap \
| view{ it }
}
The result is:
> nextflow -q run . -entry step7
WARN: DSL 2 IS AN EXPERIMENTAL FEATURE UNDER DEVELOPMENT -- SYNTAX MAY CHANGE IN FUTURE RELEASE
[2, -8]
[3, -7]
[1, -9]