From ef8e7a6745c83933064d459e02547f304db73287 Mon Sep 17 00:00:00 2001 From: zxBIB Schcolnicov Date: Mon, 23 Sep 2024 16:22:56 +0200 Subject: [PATCH 1/3] Fixed adapter removal --- CHANGELOG.md | 1 + workflows/demultiplex.nf | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d6d600..97d81a5b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Fixed` - [#253](https://github.com/nf-core/demultiplex/pull/253) Fixed mkfastq output channels. +- [#264](https://github.com/nf-core/demultiplex/pull/264) Fixed adapter removal for input samplesheets without lane information. ## 1.5.0 - 2024-08-12 diff --git a/workflows/demultiplex.nf b/workflows/demultiplex.nf index fad8d5e5..0324cbeb 100644 --- a/workflows/demultiplex.nf +++ b/workflows/demultiplex.nf @@ -76,9 +76,9 @@ workflow DEMULTIPLEX { def suffix = item[0].lane ? ".lane${item[0].lane}" : "" //need to produce one file per item in the channel else join fails [ "${item[0].id}${suffix}_no_adapters.csv", AdapterRemover.removeAdaptersFromSampleSheet(item[1]) ] } - .map { file -> //build meta again from file name - def meta_id = (file =~ /([^\/]+)(?=\.(lane|_no_adapters))/)[0][1] //extracts everything from the last "/" until ".lane" or "_no_adapters" - def meta_lane = (file =~ /\.lane(\d+)/)[0][1].toInteger() //extracts number after ".lane" until next "_", must be int to match lane value from meta + .map { file -> //build meta again from file name + def meta_id = (file =~ /.*\/(.*?)(\.lane|_no_adapters)/)[0][1] //extracts everything from the last "/" until ".lane" or "_no_adapters" + def meta_lane = (file.contains('.lane')) ? (file =~ /\.lane(\d+)/)[0][1].toInteger() : null //extracts number after ".lane" until next "_", must be int to match lane value from meta [[id: meta_id, lane: meta_lane],file] } ch_samplesheet_new = ch_samplesheet From e0de68fa3c4414c8883982857d6fb8ac4e2da882 Mon Sep 17 00:00:00 2001 From: zxBIB Schcolnicov Date: Mon, 23 Sep 2024 16:24:30 +0200 Subject: [PATCH 2/3] removed trailing spaces --- workflows/demultiplex.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/demultiplex.nf b/workflows/demultiplex.nf index 0324cbeb..9dd1bf94 100644 --- a/workflows/demultiplex.nf +++ b/workflows/demultiplex.nf @@ -76,7 +76,7 @@ workflow DEMULTIPLEX { def suffix = item[0].lane ? ".lane${item[0].lane}" : "" //need to produce one file per item in the channel else join fails [ "${item[0].id}${suffix}_no_adapters.csv", AdapterRemover.removeAdaptersFromSampleSheet(item[1]) ] } - .map { file -> //build meta again from file name + .map { file -> //build meta again from file name def meta_id = (file =~ /.*\/(.*?)(\.lane|_no_adapters)/)[0][1] //extracts everything from the last "/" until ".lane" or "_no_adapters" def meta_lane = (file.contains('.lane')) ? (file =~ /\.lane(\d+)/)[0][1].toInteger() : null //extracts number after ".lane" until next "_", must be int to match lane value from meta [[id: meta_id, lane: meta_lane],file] From 627d3682d46e39415c7cb89dc2e7fb63a6f2ee05 Mon Sep 17 00:00:00 2001 From: zxBIB Schcolnicov Date: Mon, 23 Sep 2024 16:38:30 +0200 Subject: [PATCH 3/3] Fixed lane handling --- workflows/demultiplex.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/demultiplex.nf b/workflows/demultiplex.nf index 9dd1bf94..eae296d4 100644 --- a/workflows/demultiplex.nf +++ b/workflows/demultiplex.nf @@ -78,7 +78,7 @@ workflow DEMULTIPLEX { } .map { file -> //build meta again from file name def meta_id = (file =~ /.*\/(.*?)(\.lane|_no_adapters)/)[0][1] //extracts everything from the last "/" until ".lane" or "_no_adapters" - def meta_lane = (file.contains('.lane')) ? (file =~ /\.lane(\d+)/)[0][1].toInteger() : null //extracts number after ".lane" until next "_", must be int to match lane value from meta + def meta_lane = (file.getName().contains('.lane')) ? (file =~ /\.lane(\d+)/)[0][1].toInteger() : null //extracts number after ".lane" until next "_", must be int to match lane value from meta [[id: meta_id, lane: meta_lane],file] } ch_samplesheet_new = ch_samplesheet