We often have channel entries in the form of tuples containing some meta data and one or more paths. For a process, we might want to collect all the entries with collect(flat:false)
or toList()
and send the resulting list of tuples to a process. However, if we specify the process input as val(my_tuples)
, the files represented by the path objects in the tuples will not be staged properly, and path(my_tuples)
doesn’t work either. Rather, the input needs to be of the form val(metas), path(paths)
. The transformation of the channel entries of lists of tuples into tuples of lists can be done like this:
Channel.of(
["id1", file("my_file1.txt")],
["id2", file("my_file2.txt")],
["id3", file("my_file3.txt")],
).collect(flat: false)
.map { it.transpose() }
.view()