Skip to content

Commit 5573fca

Browse files
authored
Merge pull request #248 from nf-core/fix-error-messages
Fix error messages
2 parents 225d501 + 063db6f commit 5573fca

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- [#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)
1717
- [#235](https://github.com/nf-core/funcscan/pull/235) Improved annotation speed by switching off pipeline-irrelevant Bakta annotation steps by default. (by @jasmezz)
1818
- [#235](https://github.com/nf-core/funcscan/pull/235) Renamed parameter `annotation_bakta_db` to `annotation_bakta_db_localpath`. (by @jasmezz)
19+
- [#248](https://github.com/nf-core/funcscan/pull/248) Applied best-practice `error("message")` to all (sub)workflow files. (by @jasmezz)
1920

2021
### `Dependencies`
2122

subworkflows/local/amp.nf

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ workflow AMP {
5555

5656
// HMMSEARCH
5757
if ( !params.amp_skip_hmmsearch ) {
58-
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.' }
58+
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.') }
5959

6060
ch_amp_hmm_models_meta = ch_amp_hmm_models
6161
.map {
@@ -104,7 +104,7 @@ workflow AMP {
104104
.multiMap{
105105
input: [ it[0] ]
106106
summary: it[1]
107-
}
107+
}
108108

109109
ch_tabix_input = Channel.of(['id':'ampcombi_complete_summary'])
110110
.combine(ch_ampcombi_summaries_out.summary.collectFile(name: 'ampcombi_complete_summary.csv', keepHeader:true))

subworkflows/local/bgc.nf

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ workflow BGC {
156156

157157
// HMMSEARCH
158158
if ( !params.bgc_skip_hmmsearch ) {
159-
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.' }
159+
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.') }
160160

161161
ch_bgc_hmm_models_meta = ch_bgc_hmm_models
162162
.map {

subworkflows/local/input_check.nf

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def create_input_channels(LinkedHashMap row) {
2727

2828
def array = []
2929
if (!file(row.fasta).exists()) {
30-
exit 1, "[funscan] error: please check input samplesheet. FASTA file does not exist for: \n${row.fasta}"
30+
error("[funscan] error: please check input samplesheet. FASTA file does not exist for: \n${row.fasta}")
3131
} else {
3232
array = [ meta, file(row.fasta) ]
3333
}

workflows/funcscan.nf

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def checkPathParamList = [ params.input, params.multiqc_config, params.annotatio
1818
for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } }
1919

2020
// Check mandatory parameters
21-
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }
21+
if (params.input) { ch_input = file(params.input) } else { error("Input samplesheet not specified!") }
2222

2323
// Validate fARGene inputs
2424
// Split input into array, find the union with our valid classes, extract only
@@ -34,17 +34,17 @@ def fargene_user_classes = fargene_classes.tokenize(',')
3434
def fargene_classes_valid = fargene_user_classes.intersect( fargene_valid_classes )
3535
def fargene_classes_missing = fargene_user_classes - fargene_classes_valid
3636

37-
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(', ')}"
37+
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(', ')}")
3838

3939
// Validate antiSMASH inputs
4040
// 1. Make sure that either both or none of the antiSMASH directories are supplied
41-
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)."
41+
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).")
4242

4343
// 2. If both are supplied: Exit if we have a name collision error
4444
else if ( params.run_bgc_screening && params.bgc_antismash_databases && params.bgc_antismash_installationdirectory && !params.bgc_skip_antismash ) {
4545
antismash_database_dir = new File(params.bgc_antismash_databases)
4646
antismash_install_dir = new File(params.bgc_antismash_installationdirectory)
47-
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"
47+
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")
4848
}
4949

5050
// 3. Give warning if not using container system assuming conda

0 commit comments

Comments
 (0)