nextflow
nextflow copied to clipboard
[New Feature] Group tuple size
Today I spent some time finding out how to group tuples when the group sizes vary. Currently, I have to do it this way.
Channel
.from( [1,'A'], [1,'B'], [2,'C'], [3, 'B'], [1,'C'], [2, 'A'], [3, 'D'] )
.map { key, value -> [ groupKey( key, key == 1 ? 3 : 2 ), value ] }
.groupTuple()
.view()
Doing it this way, requires an additional mapping, moreover it gets complex if more, and non-consecutive indexes are used. I propose to do it the following way. I implemented it as an alternative, keeping the other method valid.
Channel
.from( [1,'A'], [1,'B'], [2,'C'], [3, 'B'], [1,'C'], [2, 'A'], [3, 'D'] )
.groupTuple( size : { it == 1 ? 3 : 2} )
.view()
Hi @pditommaso, can you please review this PR.
:warning: 7 God Classes were detected by Lift in this project. Visit the Lift web console for more details.