With multiple input files in channels we can use * and ? to introduce a cardinality counter to avoid having duplicate filenames (https://www.nextflow.io/docs/latest/process.html#multiple-input-files).. However, this forces the filenames to be renamed which cause problems.
Is there a way to maintain original input files but add in a cardinality number earlier in the path? For example:
dir/??/* -> dir/01/foo.txt, dir/01/bar.csv, dir/02/foo.txt, dir/02/bar.csv
Numbers themselves not important - I just want to avoid having duplicate filenames (and so overwriting stuff) whilst also keeping the original filenames (so that MultiQC recognises the files).
Using the existing functionality doesn't work as we have a bunch of different file types with different filenames that match different patterns in MultiQC.
Originally from discussion on gitter: https://gitter.im/nextflow-io/nextflow?at=5a57561c5a9ebe4f7573cf82
It should be possible to implement that having a wildcard in a directory path components, it will be expanded to file index index.
Now it's possible to use wildcard also in the parent path component as suggest. Both * and ? expand to current file index. You can try it using version 0.28.1-SNAPSHOT.
Brilliant - thanks @pditommaso!
Most helpful comment
Now it's possible to use wildcard also in the parent path component as suggest. Both
*and?expand to current file index. You can try it using version0.28.1-SNAPSHOT.