How to unpack a channel that is a tuple with a key and a list #2705
-
Hi there, index_ch.concat(cloud_ch)
.map { file ->
def key = file.name.toString().tokenize('_').get(1)
return tuple(key, file)
}
.groupTuple()
.set{ dates_ch } and for example, dates_ch looks like this:
and then I need to process each date and get the date two files.
which obviously doesn't work. Could someone let me know what the right way of declaring the input would be? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Ok, I think I found a way around it; in case it is useful to someone else, the trick was to create channels with the date as a key and the filenames as values for the two inputs and then use join to synchronize them using the key. Like: out_a_ch.map { file -> tuple(file.name.toString().tokenize('_').get(1), file) }
.set{ out_a_ch_tuple }
out_b_ch.map { file -> tuple(file.name.toString().tokenize('_').get(1), file) }
.set{ out_b_ch_tuple }
foo_in_ch = out_a_ch_tuple.join(out_b_ch_tuple)
process foo {
input:
set date, file(WI), file(WM) from water_in_ch
|
Beta Was this translation helpful? Give feedback.
-
Hi,
|
Beta Was this translation helpful? Give feedback.
Ok, I think I found a way around it; in case it is useful to someone else, the trick was to create channels with the date as a key and the filenames as values for the two inputs and then use join to synchronize them using the key. Like: