-
Notifications
You must be signed in to change notification settings - Fork 243
Description
Part 1 of the "Hello nextflow" tutorial contains a basic example:
/*
* Use echo to print 'Hello World!' to a file
*/
process sayHello {
output:
path 'output.txt'
script:
"""
echo 'Hello World!' > output.txt
"""
}
And then a warning:
This example is brittle because we hardcoded the output filename in two separate places (the script and the output blocks). If we change one but not the other, the script will break. Later, you'll learn how to use variables to avoid this problem.
However, it looks to me like the rest of the examples in the tutorial continue to use this exact same "brittle" pattern, with the script
duplicating the output path defined under output
. E.g. in Part 5:
#!/usr/bin/env nextflow
// Generate ASCII art with cowpy
process cowpy {
publishDir 'results', mode: 'copy'
input:
path input_file
val character
output:
path "cowpy-${input_file}"
script:
"""
cat $input_file | cowpy -c "$character" > cowpy-${input_file}
"""
}
cowpy-${input_file}
is still manually written out twice in both the output
and script
blocks.
If there is in fact a suggested way to "use variables to avoid this problem", then it should be included in the tutorial and/or linked to from the warning message (such that those curious about it can see what the solution is.)
Or is the pattern in this later example, where the output path is dynamically generated from the input but with a still-hardcoded prefix, the sort of solution the warning was trying to refer to? If so, it would be nice to make that a bit more explicit.