Arthur
08/27/2025, 6:35 AMstats.txt) instead of one with a customisable prefix (e.g. {prefix}.stats.txt) is it acceptable to have the files renamed within the module using mv?
I have found this situation is quite frustrating when a file is used downstream and there are name clashes.James Fellows Yates
08/27/2025, 6:37 AMPhil Ewels
08/27/2025, 6:43 AMwhen a file is used downstream and there are name clashes.Remember also that you can stage files into a process with wildcards to avoid this
Phil Ewels
08/27/2025, 6:43 AMJames Fellows Yates
08/27/2025, 6:44 AMJames Fellows Yates
08/27/2025, 6:44 AMArthur
08/27/2025, 6:46 AMnf-core do use e.g. stageAs: 'input/*' but I find that itβs rareSimon Pearce
08/27/2025, 8:24 AMmvSimon Pearce
08/27/2025, 8:24 AMstats )James Fellows Yates
08/27/2025, 8:24 AMArthur
08/27/2025, 8:27 AM(I would also put the tool name into the filename as well as justFor me the additional prefix is up to the user)stats
Simon Pearce
08/27/2025, 8:30 AMJames Fellows Yates
08/27/2025, 8:30 AMext.args.prefix in modules.confgSimon Pearce
08/27/2025, 8:31 AMJames Fellows Yates
08/27/2025, 8:31 AMArthur
08/27/2025, 8:31 AMSimon Pearce
08/27/2025, 8:31 AMJames Fellows Yates
08/27/2025, 8:31 AMArthur
08/27/2025, 8:33 AMSimon Pearce
08/27/2025, 8:36 AM${prefix}.stats.txt you end up with similar issues downstream, but we don't worry about that for e.g. ${prefix}.bam so maybe it doesn't matter anyway. And multiqc sorts it out by just staging everything in separate files anywayJames Fellows Yates
08/27/2025, 8:37 AMstats on everything, they may want to distinguish with another termArthur
08/27/2025, 8:37 AMArthur
08/27/2025, 8:38 AMSimon Pearce
08/27/2025, 8:55 AMBut I mean a developer might not wantBut we can't do that without also changing the name of the actual output fileon everything, they may want to distinguish with another termstats
Adam Talbot
09/01/2025, 9:58 AMmv.
Rules:
1. Accept that hitting the filesystem is sloowwwwww so you should try to avoid it. If your tool writes to -o ${prefix} do it! Do you really need to rename the files? Really really really? Nextflow handles the file stuff for you so you can normally avoid it, e.g. pass around the tuple meta, output.txt and rename on publish.
2. Don't assume you have a full, happy complete filesystem and can do any of the weird tricks. For example don't do ln to rename files.
3. Remember not everyone is using the same filesystem as you, so avoid doing something because it's super fast for you. For example, mv is often a cp && rm on my many different filesystems.
To summarise: keep it as simple as possible and no simpler.Arthur
09/02/2025, 5:17 AMnf-core/modules modules there are:
β’ 30 modules using ln -s
β’ 135 modules using mv
β’ 47 modules using cp
How bad are these, how often do they break?Adam Talbot
09/02/2025, 8:33 AMcp and mv are inefficient but work, but ln -s doesn't work in a number of situations.Arthur
09/02/2025, 8:42 AMmv I think is used often to either rename or move files to subdir for capture. Occasionally it seems to be used as part of the process for e.g. renaming tmp files.
ln -s I think is mostly used to rename existing input files.
Here is one justification: // Added soft-links to original fastqs for consistent naming in MultiQC
It is also used in a some places to put input files in the correct path alongside other index files for a tool (e.g. biscuit align)
cp seems to be used mostly as an alternative to mv for renaming (this feels like it is probably bad)Adam Talbot
09/02/2025, 8:43 AMmvAdam Talbot
09/02/2025, 8:44 AMArthur
09/02/2025, 8:44 AMmv is not good for renaming inputs since that would
β’ break resume
β’ often target symlinks
β’ mess with the state of files possibly coming from outside the pipelineArthur
09/02/2025, 8:45 AMstageAs cannot be dynamic and these inputs need to be dynamically renamedAdam Talbot
09/02/2025, 8:47 AMcp inputs, mv outputs?Adam Talbot
09/02/2025, 8:47 AMmv wouldn't break resumeAdam Talbot
09/02/2025, 8:47 AMAdam Talbot
09/02/2025, 8:48 AMJames Fellows Yates
09/02/2025, 9:00 AMJames Fellows Yates
09/02/2025, 9:00 AMArthur
09/02/2025, 9:42 AMmv. I'm still unclear whether moving a staged input symlink would break resume though (I thought it would, but maybe you're right and nothing happens)