These are chat archives for nextflow-io/nextflow

Jan 2018
Tim Diels
Jan 02 2018 17:16

It would be handy to have a channel.join(channel2, by: 'key'), I like to name my values using maps instead of passing plain lists. For example:

ch1= Channel.from([[species: 'a', blah: 'blah'], [species: 'b', blah: 'blahb'], [species: 'c', blah: 'blahc']])
ch2=Channel.from([[species: 'a', val: 'val'], [species: 'c', val:'cval']])
    .join(ch2, by: 'species', remainder: true)

with as output

[species: 'a', blah: 'blah', val: 'val']
[species: 'b', blah: 'blahb']
[species: 'c', blah: 'blahc', val: 'cval']
How can I do this now? I suppose map both to [it.species, it], join with remainder, then map it[1]?
Seems the deprecated phase would work for this case.
Tim Diels
Jan 02 2018 17:25
    .phase(ch2, remainder: true) { it.species }
    .map { it[0] + (it[1] ?: []) }
assuming ch2's keys is a subset of ch1's