Automatic escaping characters such as spaces in staged file names #4240
-
Hi, Something that trips me up sometimes using NF is when I put quotes around file names, in case they have spaces and other shell-interfering characters, mainly because I'm used to that being good practice. This is is usually fine, but sometimes I find cases where NF escapes these characters, and then the file which is quoted can not be found since it doesn't contain a backslash. So:
I assume that best practice in NF is to not use quotes, as it escapes the relevant characters. Since this sometimes works, I tried to investigate what is going on and got to the following:
Sometimes in "merge" processes I will have a list of undefined length, so I need to deal with this somehow. My somewhat ugly solution is to create a new variable in the process script scope: I'm not sure if I'm doing this right, and it has been a bit confusing, but I gladly receive any comments or an RTFM link :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In general, you should not quote your filenames because Nextflow will escape any special characters for you. As for the list issue, that is a long-standing aspect of process inputs that has annoyed many over the years. We intend to fix it with this PR #3706, after which you'll be able to specify |
Beta Was this translation helpful? Give feedback.
In general, you should not quote your filenames because Nextflow will escape any special characters for you.
As for the list issue, that is a long-standing aspect of process inputs that has annoyed many over the years. We intend to fix it with this PR #3706, after which you'll be able to specify
arity: true
and the input will always be a list if it's a glob. Until then, your instanceof hack is the standard workaround 😄