Sane way of writing the `.params.yml` file
grst opened this issue · comments
Currently, I generate a yaml string and inject it into the script section:
script:
"""
${nxfvars(task)}
./do_stuff.sh
"""
where the result of nxfvars is something like
return """cat <<"END_PARAMS_SECTION" > ./.params.yml\n${yaml_str}\nEND_PARAMS_SECTION\n\n"""
This results in the entire yaml file being part of .command.sh
, which is 1) ugly and 2) causes issues like #6.
Ideally, we could write out the config fire directly in nxfvars()
, with the code snippet from above becoming
script:
nxfvars(task)
"""
./do_stuff.sh
"""
The issue is that
- when just writing the file, it goes to the nextflow working directory
- as a workaround, it is possible to use
task.workDir.resolve('.params.yml').text = yaml_str
(see https://groups.google.com/g/nextflow/c/tp_b1p0DBE4/m/2tRi2FAj26gJ), however that works only if there is no scripts section.