These are chat archives for nextflow-io/nextflow

2nd
Jan 2018
Tim Diels
@timdiels
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']])
ch1
    .join(ch2, by: 'species', remainder: true)
    .view()

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
@timdiels
Jan 02 2018 17:25
i.e.
ch1
    .phase(ch2, remainder: true) { it.species }
    .map { it[0] + (it[1] ?: []) }
    .view()
assuming ch2's keys is a subset of ch1's