was : https://gitter.im/nextflow-io/nextflow?at=5b335342d2abe466888df6e4
saving the content of a channel to a file
Example with picard GatherVcf.
GatherVcf can be used to concatenante a large number of small vcf files. If the input ends with .list , it will be interpreted as a file containing a list of paths
java -jar picard.jar GatherVcf I=subvcf.list O=out.vcf
for now, in the script section I write:
cat << __EOF__ > subvcf.list
${vcf_list.join("\n")}
__EOF__
java -jar picard.jar GatherVcf I=subvcf.list O=out.vcf
it works but I wonder if there is a more elegant version (as the joined string can be very large).
Something like an operator .toFile("subvcf.list") ?
Currently the best workaround consists in using a echo instead of heredocs, eg:
echo "${vcf_list.join('\n')}" > subvcf.list
I like the idea of having a specific method, tho is more complicated than it seems. The main problem is that the actual task work is only resolved at execution time (think for example to the scratch dir assigned by the cluster) therefore it's not trivial to infer that.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
+1 for the toFile operator
Most helpful comment
Currently the best workaround consists in using a
echoinstead of heredocs, eg:I like the idea of having a specific method, tho is more complicated than it seems. The main problem is that the actual task work is only resolved at execution time (think for example to the scratch dir assigned by the cluster) therefore it's not trivial to infer that.