Does anyone know why some modules that take a list...
# modules
a
Does anyone know why some modules that take a list of paths use this pattern to define them for the script:
Copy code
input: 
tuple val(meta), path(gvcfs)
<...>

script:
def input = gvcfs.collect { it.toString() }

"""
mycommand ${input.join(' ')} 
"""
It’s my understanding that the following works fine:
Copy code
input: 
tuple val(meta), path(gvcfs)
<...>

script:
"""
mycommand $input
"""
s
That sort of pattern is generally used when the tool expects them to have a flag, e.g.
-i file1 -i file2 -i file3
, but I agree that I don't think it is required in general. Or for tools that process
foo file1 file2
differently to
foo file2 file1
, they should use AFAIK
files.sort{it -> it.toString()}.join(" ")
to ensure that the files are sorted (and doesn't use the full path including the work directory, which is what happens if you don't have
toString
there) But generally the modules repo has a whole bunch of modules that aren't 100% how they should be done
j
But it's definitely something we could write guidance on though?
e.g. I like the
.sort()
thingy
party this 1
s
It would be sensible to add the sort somewhere in the guidelines yes, as it is one of the gotchas
👍 1
party this 1
j
I shall leave that with you to find a good place 😬
🤣 1
s
I'll get on it just after someone invents the 48 hour day
🤣 1
m
Sign me up
j
and my sword