Hi all!
I’ve been really enjoying using Nextflow recently for setting up ML pipelines. I previously used Snakemake, but found that the path-based logic became too complex as the pipeline grew in complexity.
There is one quirk that irritates me slightly though. This is strongly related to a previous post, which asked the same question but for legacy, untyped synax: DRY Principle in Nextflow: Reusing Output Path Definitions in `output:` and `script:` sections
According to Processes (typed) | Seqera Docs, I can define a process like
process myProcess {
input:
message: String
output:
out_file: Path = file("${message}.txt")
script:
"""
echo "${message}" > "${message}.txt"
"""
}
but this forces me to repeat the same output path logic twice. I would like to just use ${out_file} in the script block, like this:
process myProcess {
input:
message: String
output:
out_file: Path = file("${message}.txt")
script:
"""
echo "${message}" > "${out_file}"
"""
}
but if I try this then I get the error
`out_file` is not defined
Is there any chance of this getting added in the future? I really like the new typed syntax and would like to use it to the greatest extent possible.
BR, Valter