From 2c9527972ed58cfa3a88f68709ef8fd140faff85 Mon Sep 17 00:00:00 2001 From: "J. Christian Heide" Date: Tue, 4 Feb 2025 17:04:31 +0100 Subject: [PATCH] Make order of `lane`, `colour_chemistry`, and `shard_number` consistent --- subworkflows/local/map.nf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subworkflows/local/map.nf b/subworkflows/local/map.nf index cbd4e20f9..bb2dc0676 100644 --- a/subworkflows/local/map.nf +++ b/subworkflows/local/map.nf @@ -133,6 +133,11 @@ workflow MAP { // Only run merge lanes if we have more than one BAM to merge! ch_input_for_lane_merge = ch_mapped_lane_bam + .toSortedList { + a, b -> + a[0]['lane'] <=> b[0]['lane'] ?: a[0]['colour_chemistry'] <=> b[0]['colour_chemistry'] ?: a[0]['shard_number'] <=> b[0]['shard_number'] + } + .flatMap() .map { meta, bam -> new_meta = meta.clone().findAll{ it.key !in ['lane', 'colour_chemistry', 'shard_number'] }