From d271419fe753234173fb7eea7064f6ca38033396 Mon Sep 17 00:00:00 2001 From: Adam Talbot Date: Mon, 5 Jun 2023 10:51:10 +0100 Subject: [PATCH 1/3] Use Nextflow.error --- CHANGELOG.md | 6 ++++++ modules/nf-core/bases2fastq/main.nf | 2 +- modules/nf-core/bcl2fastq/main.nf | 2 +- modules/nf-core/bclconvert/main.nf | 2 +- workflows/demultiplex.nf | 14 +++++++------- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 060bf818..1e29e3c7 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## dev + +### `Fixed` + +- Fails gracefully if an error is encountered + ## 1.3.0 - 2023-05-31 ### `Added` diff --git a/modules/nf-core/bases2fastq/main.nf b/modules/nf-core/bases2fastq/main.nf index 89c04456..e031aff2 100644 --- a/modules/nf-core/bases2fastq/main.nf +++ b/modules/nf-core/bases2fastq/main.nf @@ -6,7 +6,7 @@ process BASES2FASTQ { // Exit if running this module with -profile conda / -profile mamba if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - exit 1, "BASES2FASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." + Nextflow.error "BASES2FASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." } input: diff --git a/modules/nf-core/bcl2fastq/main.nf b/modules/nf-core/bcl2fastq/main.nf index c34e1081..97abedc2 100644 --- a/modules/nf-core/bcl2fastq/main.nf +++ b/modules/nf-core/bcl2fastq/main.nf @@ -6,7 +6,7 @@ process BCL2FASTQ { // Exit if running this module with -profile conda / -profile mamba if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - exit 1, "BCL2FASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." + Nextflow.error "BCL2FASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." } input: diff --git a/modules/nf-core/bclconvert/main.nf b/modules/nf-core/bclconvert/main.nf index 8624930b..9f0975ff 100644 --- a/modules/nf-core/bclconvert/main.nf +++ b/modules/nf-core/bclconvert/main.nf @@ -6,7 +6,7 @@ process BCLCONVERT { // Exit if running this module with -profile conda / -profile mamba if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - exit 1, "BCLCONVERT module does not support Conda. Please use Docker / Singularity / Podman instead." + Nextflow.error "BCLCONVERT module does not support Conda. Please use Docker / Singularity / Podman instead." } input: diff --git a/workflows/demultiplex.nf b/workflows/demultiplex.nf index b99e6d39..8ec08f2a 100644 --- a/workflows/demultiplex.nf +++ b/workflows/demultiplex.nf @@ -21,7 +21,7 @@ def checkPathParamList = [ for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } } // Check mandatory parameters -if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' } +if (params.input) { ch_input = file(params.input) } else { Nextflow.error 'Input samplesheet not specified!' } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONFIG FILES @@ -190,7 +190,7 @@ workflow DEMULTIPLEX { ch_versions = ch_versions.mix(SINGULAR_DEMULTIPLEX.out.versions) break default: - exit 1, "Unknown demultiplexer: ${demultiplexer}" + Nextflow.error "Unknown demultiplexer: ${demultiplexer}" } ch_raw_fastq.dump(tag: "DEMULTIPLEX::Demultiplexed Fastq",{FormattingService.prettyFormat(it)}) @@ -319,14 +319,14 @@ def extract_csv(input_csv, input_schema=null) { diff in all_columns ? missing_columns.add(diff) : wrong_columns.add(diff) } if(missing_columns.size() > 0){ - exit 1, "[Samplesheet Error] The column(s) $missing_columns is/are not present. The header should look like: $all_columns" + Nextflow.error "[Samplesheet Error] The column(s) $missing_columns is/are not present. The header should look like: $all_columns" } else { - exit 1, "[Samplesheet Error] The column(s) $wrong_columns should not be in the header. The header should look like: $all_columns" + Nextflow.error "[Samplesheet Error] The column(s) $wrong_columns should not be in the header. The header should look like: $all_columns" } } else { - exit 1, "[Samplesheet Error] The columns $row are not in the right order. The header should look like: $all_columns" + Nextflow.error "[Samplesheet Error] The columns $row are not in the right order. The header should look like: $all_columns" } } @@ -343,7 +343,7 @@ def extract_csv(input_csv, input_schema=null) { row[column] ?: missing_mandatory_columns.add(column) } if(missing_mandatory_columns.size > 0){ - exit 1, "[Samplesheet Error] The mandatory column(s) $missing_mandatory_columns is/are empty on line $row_count" + Nextflow.error "[Samplesheet Error] The mandatory column(s) $missing_mandatory_columns is/are empty on line $row_count" } def output = [] @@ -353,7 +353,7 @@ def extract_csv(input_csv, input_schema=null) { content = row[key] if(!(content ==~ col.value['pattern']) && col.value['pattern'] != '' && content != '') { - exit 1, "[Samplesheet Error] The content of column '$key' on line $row_count does not match the pattern '${col.value['pattern']}'" + Nextflow.error "[Samplesheet Error] The content of column '$key' on line $row_count does not match the pattern '${col.value['pattern']}'" } if(col.value['content'] == 'path'){ From b9dd0fcf36eaf7c19f26ab831310d961c1e236e3 Mon Sep 17 00:00:00 2001 From: Adam Talbot Date: Mon, 5 Jun 2023 10:52:54 +0100 Subject: [PATCH 2/3] Changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e29e3c7..9fdd450e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Fixed` -- Fails gracefully if an error is encountered +- [#122](https://github.com/nf-core/demultiplex/pull/122) Fails gracefully if an error is encountered ## 1.3.0 - 2023-05-31 From 31990f1f8c8e0d7d13b9564445861265a4dfedb9 Mon Sep 17 00:00:00 2001 From: Adam Talbot Date: Mon, 5 Jun 2023 10:54:27 +0100 Subject: [PATCH 3/3] Revert nf-core modules --- modules/nf-core/bases2fastq/main.nf | 2 +- modules/nf-core/bcl2fastq/main.nf | 2 +- modules/nf-core/bclconvert/main.nf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/nf-core/bases2fastq/main.nf b/modules/nf-core/bases2fastq/main.nf index e031aff2..89c04456 100644 --- a/modules/nf-core/bases2fastq/main.nf +++ b/modules/nf-core/bases2fastq/main.nf @@ -6,7 +6,7 @@ process BASES2FASTQ { // Exit if running this module with -profile conda / -profile mamba if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - Nextflow.error "BASES2FASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." + exit 1, "BASES2FASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." } input: diff --git a/modules/nf-core/bcl2fastq/main.nf b/modules/nf-core/bcl2fastq/main.nf index 97abedc2..c34e1081 100644 --- a/modules/nf-core/bcl2fastq/main.nf +++ b/modules/nf-core/bcl2fastq/main.nf @@ -6,7 +6,7 @@ process BCL2FASTQ { // Exit if running this module with -profile conda / -profile mamba if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - Nextflow.error "BCL2FASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." + exit 1, "BCL2FASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." } input: diff --git a/modules/nf-core/bclconvert/main.nf b/modules/nf-core/bclconvert/main.nf index 9f0975ff..8624930b 100644 --- a/modules/nf-core/bclconvert/main.nf +++ b/modules/nf-core/bclconvert/main.nf @@ -6,7 +6,7 @@ process BCLCONVERT { // Exit if running this module with -profile conda / -profile mamba if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - Nextflow.error "BCLCONVERT module does not support Conda. Please use Docker / Singularity / Podman instead." + exit 1, "BCLCONVERT module does not support Conda. Please use Docker / Singularity / Podman instead." } input: