Nextflow: Feature request: operator to save a channel to a file

Created on 28 Jun 2018  路  3Comments  路  Source: nextflow-io/nextflow

was : https://gitter.im/nextflow-io/nextflow?at=5b335342d2abe466888df6e4

What

saving the content of a channel to a file

Use case

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") ?

kinenhancement prlow stale

Most helpful comment

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.

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olgabot picture olgabot  路  7Comments

ewels picture ewels  路  3Comments

ewels picture ewels  路  6Comments

stevekm picture stevekm  路  5Comments

jaquol picture jaquol  路  7Comments