Chenyu Jin (Amend)
09/19/2025, 12:19 PMeach() in the process then it's not input as a file as path() does. How can I process each path?
workflow {
file = Channel.fromPath("${params.input_dir}/*", checkIfExists: true).view()
index_reference(files, params.threads)
}
process index_reference {
input:
each(input_ref)
val(threads)
...
}Alexander Nater
09/19/2025, 12:43 PMinput:
path input_ref
Path inputs can either take a single file or a list of files, so the only difference between these cases is how you call your process:
First case:
def ch_files = Channel.fromPath("${params.input_dir}/*", checkIfExists: true)
index_reference(ch_files)
ch_files here is a queue channel that contains 1 file per channel entry. Each entry will spawn a task of the index_reference task. In each task, input_ref is a single file. Nextflow will run these tasks in parallel if you executor has enough resources for it.
Second case:
def ch_files = Channel.value(files("${params.input_dir}/*", checkIfExists: true))
index_reference(ch_files)
Here, ch_files is a value channel with only a single entry that is a list of all your input files. The index_reference process is invoked only once and input_ref is a list of files.Chenyu Jin (Amend)
09/19/2025, 12:56 PMChenyu Jin (Amend)
09/19/2025, 12:58 PMinput:
path input_ref
it took all the files in the same process together than respectively, even if I tried to use ch_files.flatten() as inputAlexander Nater
09/19/2025, 1:50 PMview from the input channel looks like? You have a typo with file/files in your code example, so I assume that's not actually the code that you are running?Chenyu Jin (Amend)
09/19/2025, 2:18 PMpath() works. Thanks for helping!