Hello, I am grouping a set of samples by sample, which I do by the following:
SAMTOOLS_MERGE.out.bam.mix(CREATEREADNUM.out.readnum).mix(CLIPPER.out.bed)
.groupTuple(by: [0])
.map {
meta,result →
[meta, meta.sample, result[0], result[1], result[2] ]}
.groupTuple(by: [1])
.map {
result →
[[id:result[0].sample[0],sample:result[0].sample[0],single_end:result[0].single_end[0]],result[2],result[3],result[4]]}
.set { ch_bamreadbed }
and I end up with this, which is what I want:
[[id:test1, sample:test1, single_end:false], [test1_signal.bam,test1_background.bam], [test1_signal.readnum.txt, test1_background.readnum.txt], [test1_signal.clip.peakClusters.bed, test1_background.clip.peakClusters.bed]]
However, I would like to ensure that a certain order is always preserved: signal always goes before background (or viceversa). What command could help me with that? I could not find a sort and I am not sure how I would apply it here.