Skip to content

Fix error messages #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
4 changes: 2 additions & 2 deletions subworkflows/local/amp.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/local/bgc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/local/input_check.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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) ]
}
Expand Down
8 changes: 4 additions & 4 deletions workflows/funcscan.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down