My understanding of an inner join (from Nextflow documentation: “It is equivalent to an inner join in SQL”) is that it is supposed to return every match on the key between the left and right rows. However, in my code it is only returning one match.
Minimal example:
workflow {
ch1 = Channel.of([0, 1], [0, 2])
ch2 = Channel.of([0, "A"])
ch1.join(ch2) | view
}
Output:
[0, 1, A]
Expected output:
[0, 1, A]
[0, 2, A]
If I do ch2.join(ch1) | view
instead its output is:
[0, A, 1]
And similarly, I would have expected:
[0, A, 1]
[0, A, 2]
If I replace join
with cross` in the last workflow line, I get:
[[0, 1], [0, A]]
Given that cross is supposed to return ‘every pairwise combination of two channels for which the pair has a matching key,’ I would have instead expected to get:
[[0, 1], [0, A]]
[[0, 2], [0, A]]
If I do ch2.cross(ch1)
it gives:
[[0, A], [0, 1]]
[[0, A], [0, 2]]
Which is what I expect.
Thanks for any clarification you can offer.