From b32e74d4a08746c8a2f9e6fc4b70dcc8086ac72b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Apr 2026 10:54:52 +0000 Subject: [PATCH 1/2] fix: handle compound raw-file extensions in --local_input_type substitution The previous substitution stripped only the last '.ext', so SDRFs that contain compound extensions (e.g. '.d.zip' as in PXD065380 / test_dia_dotd, or '.d.tar.gz') produced wrong paths when combined with --root_folder. Examples of the bug: /root/sample.d.zip + local_input_type=d.zip -> /root/sample.d.d.zip /root/sample.d.tar.gz + local_input_type=d -> /root/sample.d.tar.d /root/sample.d.zip + local_input_type=raw -> /root/sample.d.raw Strip the longest matching known raw-data extension first so the resulting path targets the real file on disk. https://claude.ai/code/session_01CtVkdv9sgCm6WUnfZxYrPr --- .../local/create_input_channel/main.nf | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/subworkflows/local/create_input_channel/main.nf b/subworkflows/local/create_input_channel/main.nf index 96d28f6..cef51f8 100644 --- a/subworkflows/local/create_input_channel/main.nf +++ b/subworkflows/local/create_input_channel/main.nf @@ -19,6 +19,11 @@ workflow CREATE_INPUT_CHANNEL { exit(1, "ERROR: Unsupported --local_input_type '${params.local_input_type}'. Supported values: ${allowedLocalInputTypes.join(', ')}") } + // Known raw-data extensions (order matters: strip longest/compound ones first + // so 'sample.d.zip' -> 'sample', not 'sample.d'). + def knownRawExts = ['.d.tar.gz', '.d.tar', '.d.zip', '.mzML.gz', '.raw.gz', + '.mzML', '.raw', '.dia', '.d'] + // Always parse as SDRF using DIA-NN converter SDRF_PARSING(ch_sdrf) ch_versions = ch_versions.mix(SDRF_PARSING.out.versions) @@ -39,9 +44,19 @@ workflow CREATE_INPUT_CHANNEL { } else { filestr = row.Filename.toString() filestr = params.root_folder + File.separator + filestr - filestr = (params.local_input_type - ? filestr.take(filestr.lastIndexOf('.')) + '.' + params.local_input_type - : filestr) + if (params.local_input_type) { + // Strip the longest matching known raw-data extension (covers + // compound suffixes like .d.zip / .d.tar.gz from the SDRF), + // then append the target extension. + def stem = filestr + def matched = knownRawExts.find { stem.endsWith(it) } + if (matched) { + stem = stem.substring(0, stem.length() - matched.length()) + } else if (stem.lastIndexOf('.') > 0) { + stem = stem.take(stem.lastIndexOf('.')) + } + filestr = stem + '.' + params.local_input_type + } } return [filestr, experiment_id, row] } From 933c59bdb0fe633ae5a01d631e05dc7503f03589 Mon Sep 17 00:00:00 2001 From: yueqixuan Date: Sun, 26 Apr 2026 17:58:28 +0800 Subject: [PATCH 2/2] update --- subworkflows/local/create_input_channel/main.nf | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/subworkflows/local/create_input_channel/main.nf b/subworkflows/local/create_input_channel/main.nf index cef51f8..fd30d71 100644 --- a/subworkflows/local/create_input_channel/main.nf +++ b/subworkflows/local/create_input_channel/main.nf @@ -19,8 +19,8 @@ workflow CREATE_INPUT_CHANNEL { exit(1, "ERROR: Unsupported --local_input_type '${params.local_input_type}'. Supported values: ${allowedLocalInputTypes.join(', ')}") } - // Known raw-data extensions (order matters: strip longest/compound ones first - // so 'sample.d.zip' -> 'sample', not 'sample.d'). + // Known raw-data extensions; order matters, so strip longest/compound ones first + // so 'sample.d.zip' -> 'sample', not 'sample.d'. def knownRawExts = ['.d.tar.gz', '.d.tar', '.d.zip', '.mzML.gz', '.raw.gz', '.mzML', '.raw', '.dia', '.d'] @@ -49,7 +49,12 @@ workflow CREATE_INPUT_CHANNEL { // compound suffixes like .d.zip / .d.tar.gz from the SDRF), // then append the target extension. def stem = filestr - def matched = knownRawExts.find { stem.endsWith(it) } + def stemLower = stem.toLowerCase() + + def matched = knownRawExts.find { ext -> + stemLower.endsWith(ext.toLowerCase()) + } + if (matched) { stem = stem.substring(0, stem.length() - matched.length()) } else if (stem.lastIndexOf('.') > 0) {