Hello, I have a process whose emits a file (e.g., ...
# help
q
Hello, I have a process whose emits a file (e.g., let's say
sample/subdir/<INDEX>/counts.h5ad
) for each sample and each index. Then, I have a process which needs to access all these counts files for each sample. I'm waiting for all the indices before putting them all as an input of the other process, i.e. it will have an input
path(counts_files)
for a given sample. The problem is, all counts files end up in the current workdir (with the same name) instead of keeping the original hierarchy in
sample/subdir/<INDEX>
. How to keep this hierarchy? I tried to use
stageAs
, but couldn't find the right way to make it work
d
can you rename the files that the process emits? Maybe with a prefix? The prefix could be sample-specific, e.g. meta.id?
q
Yes this is definitely possible! Is it the only way? If so, I can do that, but if there is a direct solution it would be super nice 🙂
d
If the naming of the files is of no relevance in the work dir, you could also use:
Copy code
input:
tuple val(meta), path('input/counts_*.h5ad')
where * will be substituted by the file count, i.e 1,2,3,4,...
q
No unfortunately I need to keep the original file name with the right index
Do you think there is a way to do something like
path(count_files, stageAs: "${sample_path}/subdir/{index}/*")
where
index
would be preserved somehow?
More generally, is there no way to just say "keep the relative path"? I tried many things but it's a lot of complexity and lines of code for something very simple
d
Not sure. Maybe ask in the nextflow slack?
q
Actually I'll stick with the file renaming - it adds quite some lines of code, but it's working well, thanks 🙂
👍 1