From cab24bdac83130ce1ac8e188d32b5e54f7b0ec34 Mon Sep 17 00:00:00 2001 From: jasmezz Date: Mon, 27 Mar 2023 12:13:13 +0200 Subject: [PATCH 1/3] Update workflow files --- subworkflows/local/amp.nf | 2 +- subworkflows/local/bgc.nf | 2 +- subworkflows/local/input_check.nf | 2 +- workflows/funcscan.nf | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/subworkflows/local/amp.nf b/subworkflows/local/amp.nf index 2a02720d..4b9a5338 100644 --- a/subworkflows/local/amp.nf +++ b/subworkflows/local/amp.nf @@ -55,7 +55,7 @@ workflow AMP { // HMMSEARCH if ( !params.amp_skip_hmmsearch ) { - if ( params.amp_hmmsearch_models ) { ch_amp_hmm_models = Channel.fromPath( params.amp_hmmsearch_models, checkIfExists: true ) } else { exit 1, '[nf-core/funcscan] error: hmm model files not found for --amp_hmmsearch_models! Please check input.' } + if ( params.amp_hmmsearch_models ) { ch_amp_hmm_models = Channel.fromPath( params.amp_hmmsearch_models, checkIfExists: true ) } else { error('[nf-core/funcscan] error: hmm model files not found for --amp_hmmsearch_models! Please check input.') } ch_amp_hmm_models_meta = ch_amp_hmm_models .map { diff --git a/subworkflows/local/bgc.nf b/subworkflows/local/bgc.nf index 641a13a4..44888544 100644 --- a/subworkflows/local/bgc.nf +++ b/subworkflows/local/bgc.nf @@ -156,7 +156,7 @@ workflow BGC { // HMMSEARCH if ( !params.bgc_skip_hmmsearch ) { - if ( params.bgc_hmmsearch_models ) { ch_bgc_hmm_models = Channel.fromPath( params.bgc_hmmsearch_models, checkIfExists: true ) } else { exit 1, '[nf-core/funcscan] error: hmm model files not found for --bgc_hmmsearch_models! Please check input.' } + if ( params.bgc_hmmsearch_models ) { ch_bgc_hmm_models = Channel.fromPath( params.bgc_hmmsearch_models, checkIfExists: true ) } else { error('[nf-core/funcscan] error: hmm model files not found for --bgc_hmmsearch_models! Please check input.') } ch_bgc_hmm_models_meta = ch_bgc_hmm_models .map { diff --git a/subworkflows/local/input_check.nf b/subworkflows/local/input_check.nf index 85b435b7..d97e91e7 100644 --- a/subworkflows/local/input_check.nf +++ b/subworkflows/local/input_check.nf @@ -27,7 +27,7 @@ def create_input_channels(LinkedHashMap row) { def array = [] if (!file(row.fasta).exists()) { - exit 1, "[funscan] error: please check input samplesheet. FASTA file does not exist for: \n${row.fasta}" + error("[funscan] error: please check input samplesheet. FASTA file does not exist for: \n${row.fasta}") } else { array = [ meta, file(row.fasta) ] } diff --git a/workflows/funcscan.nf b/workflows/funcscan.nf index f2ba5bce..253208ca 100644 --- a/workflows/funcscan.nf +++ b/workflows/funcscan.nf @@ -18,7 +18,7 @@ def checkPathParamList = [ params.input, params.multiqc_config, params.annotatio 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 { error("Input samplesheet not specified!") } // Validate fARGene inputs // Split input into array, find the union with our valid classes, extract only @@ -34,17 +34,17 @@ def fargene_user_classes = fargene_classes.tokenize(',') def fargene_classes_valid = fargene_user_classes.intersect( fargene_valid_classes ) def fargene_classes_missing = fargene_user_classes - fargene_classes_valid -if ( fargene_classes_missing.size() > 0 ) exit 1, "[nf-core/funcscan] ERROR: invalid class present in --arg_fargene_hmmodel. Please check input. Invalid class: ${fargene_classes_missing.join(', ')}" +if ( fargene_classes_missing.size() > 0 ) error("[nf-core/funcscan] ERROR: invalid class present in --arg_fargene_hmmodel. Please check input. Invalid class: ${fargene_classes_missing.join(', ')}") // Validate antiSMASH inputs // 1. Make sure that either both or none of the antiSMASH directories are supplied -if ( ( params.run_bgc_screening && !params.bgc_antismash_databases && params.bgc_antismash_installationdirectory && !params.bgc_skip_antismash) || ( params.run_bgc_screening && params.bgc_antismash_databases && !params.bgc_antismash_installationdirectory && !params.bgc_skip_antismash ) ) exit 1, "[nf-core/funcscan] ERROR: You supplied either the antiSMASH database or its installation directory, but not both. Please either supply both directories or none (letting the pipeline download them instead)." +if ( ( params.run_bgc_screening && !params.bgc_antismash_databases && params.bgc_antismash_installationdirectory && !params.bgc_skip_antismash) || ( params.run_bgc_screening && params.bgc_antismash_databases && !params.bgc_antismash_installationdirectory && !params.bgc_skip_antismash ) ) error("[nf-core/funcscan] ERROR: You supplied either the antiSMASH database or its installation directory, but not both. Please either supply both directories or none (letting the pipeline download them instead).") // 2. If both are supplied: Exit if we have a name collision error else if ( params.run_bgc_screening && params.bgc_antismash_databases && params.bgc_antismash_installationdirectory && !params.bgc_skip_antismash ) { antismash_database_dir = new File(params.bgc_antismash_databases) antismash_install_dir = new File(params.bgc_antismash_installationdirectory) - if ( antismash_database_dir.name == antismash_install_dir.name ) exit 1, "[nf-core/funcscan] ERROR: Your supplied antiSMASH database and installation directories have identical names: \"" + antismash_install_dir.name + "\".\nPlease make sure to name them differently, for example:\n - Database directory: "+ antismash_database_dir.parent + "/antismash_db\n - Installation directory: " + antismash_install_dir.parent + "/antismash_dir" + if ( antismash_database_dir.name == antismash_install_dir.name ) error("[nf-core/funcscan] ERROR: Your supplied antiSMASH database and installation directories have identical names: \"" + antismash_install_dir.name + "\".\nPlease make sure to name them differently, for example:\n - Database directory: "+ antismash_database_dir.parent + "/antismash_db\n - Installation directory: " + antismash_install_dir.parent + "/antismash_dir") } // 3. Give warning if not using container system assuming conda From d5248318424877f3a82ee9d32f17f9f134e692c6 Mon Sep 17 00:00:00 2001 From: jasmezz Date: Mon, 27 Mar 2023 12:18:23 +0200 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb2337c..fa93e97d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#237](https://github.com/nf-core/funcscan/pull/237) Reactivate DeepARG automatic database downloading and CI tests as server is now back up. (by @jfy133) - [#235](https://github.com/nf-core/funcscan/pull/235) Improved annotation speed by switching off pipeline-irrelevant Bakta annotation steps by default. (by @jasmezz) - [#235](https://github.com/nf-core/funcscan/pull/235) Renamed parameter `annotation_bakta_db` to `annotation_bakta_db_localpath`. (by @jasmezz) +- [#248](https://github.com/nf-core/funcscan/pull/248) Applied best-practice `error("message")` to all (sub)workflow files. (by @jasmezz) ### `Dependencies` From 063db6f4a0ab178b71fc3d79f53c5d490100014d Mon Sep 17 00:00:00 2001 From: jasmezz Date: Mon, 27 Mar 2023 13:28:38 +0200 Subject: [PATCH 3/3] Need some commit to re-start GHA --- subworkflows/local/amp.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/amp.nf b/subworkflows/local/amp.nf index 4b9a5338..34eed9f1 100644 --- a/subworkflows/local/amp.nf +++ b/subworkflows/local/amp.nf @@ -104,7 +104,7 @@ workflow AMP { .multiMap{ input: [ it[0] ] summary: it[1] - } + } ch_tabix_input = Channel.of(['id':'ampcombi_complete_summary']) .combine(ch_ampcombi_summaries_out.summary.collectFile(name: 'ampcombi_complete_summary.csv', keepHeader:true))