nextflow-io / patterns

A curated collection of Nextflow implementation patterns
http://nextflow-io.github.io/patterns/
MIT License
332 stars 71 forks source link

Update process-collect.nf #25

Open meowcat opened 3 years ago

meowcat commented 3 years ago

Fixes cases with a single file. Note that this example with cat would still work with a single file, but ls *.fq would not. https://github.com/nextflow-io/nextflow/issues/2410

pditommaso commented 2 years ago

not understanding why ls *.fq is not working for a single file

keiranmraine commented 2 years ago

In the example if only a single input is passed the file is linked into the workspace as .fq, a hidden file as far as bash is concerned which is not available via *.fq.

Two issues:

  1. it would be preferable to always include the numeric, but I understand the possible implications of changing that.
  2. the example it should include a prefix so that hidden files aren't the default from the example:
    process bar {
    echo true
    input:
    file 'in_*.fq' from unzipped_ch.collect()
    """
    cat in_*.fq
    """
    }
keiranmraine commented 2 years ago
  1. file 'in_*.fq' from unzipped_ch.collect() a single file is file_.fq
  2. file 'in_?.fq' from unzipped_ch.collect() a single file is file_1.fq

(2) is certainly more consistent and obvious for the example