From 26f9073f9f22375a29e635f350ffe03dbd003786 Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Wed, 19 Jul 2023 10:45:17 +0200 Subject: [PATCH 1/3] Filter out annotation files that are empty to prevent failures during screening --- CHANGELOG.md | 2 ++ workflows/funcscan.nf | 42 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a482e93..64f069dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Fixed` +- [#296](https://github.com/nf-core/funcscan/pull/296) Added check for empty annotation files prior going into screening (❤️ to @alexhbnr for requesting, added by @jfy133) + ### `Dependencies` ### `Deprecated` diff --git a/workflows/funcscan.nf b/workflows/funcscan.nf index ad317a20..f27c8685 100644 --- a/workflows/funcscan.nf +++ b/workflows/funcscan.nf @@ -241,7 +241,15 @@ workflow FUNCSCAN { AMPs */ if ( params.run_amp_screening ) { - AMP ( ch_prepped_input, ch_annotation_faa ) + AMP ( + ch_prepped_input, + ch_annotation_faa + .filter { + meta, file -> + if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty FAA file) and will not be sent to AMP screening: ${meta.id}") + !file.isEmpty() + } + ) ch_versions = ch_versions.mix(AMP.out.versions) } @@ -252,7 +260,15 @@ workflow FUNCSCAN { if (params.arg_skip_deeparg) { ARG ( ch_prepped_input, [] ) } else { - ARG ( ch_prepped_input, ch_annotation_faa ) + ARG ( + ch_prepped_input, + ch_annotation_faa + .filter { + meta, file -> + if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty FAA file) and will not be sent to ARG screening: ${meta.id}") + !file.isEmpty() + } + ) } ch_versions = ch_versions.mix(ARG.out.versions) } @@ -261,7 +277,27 @@ workflow FUNCSCAN { BGCs */ if ( params.run_bgc_screening ) { - BGC ( ch_prepped_input, ch_annotation_gff, ch_annotation_faa, ch_annotation_gbk ) + BGC ( + ch_prepped_input, + ch_annotation_gff + .filter { + meta, file -> + if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty GFF file) and will not be sent to BGC screening: ${meta.id}") + !file.isEmpty() + }, + ch_annotation_faa + .filter { + meta, file -> + if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty FAA file) and will not be sent to BGC screening: ${meta.id}") + !file.isEmpty() + }, + ch_annotation_gbk + .filter { + meta, file -> + if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty GBK file) and will not be sent to BGC screening: ${meta.id}") + !file.isEmpty() + } + ) ch_versions = ch_versions.mix(BGC.out.versions) } From 2eae640724fce82631ab4069cdb53904bb339c95 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 19 Jul 2023 10:46:10 +0200 Subject: [PATCH 2/3] Apply suggestions from code review --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64f069dc..cfb7d25d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Fixed` -- [#296](https://github.com/nf-core/funcscan/pull/296) Added check for empty annotation files prior going into screening (❤️ to @alexhbnr for requesting, added by @jfy133) +- [#296](https://github.com/nf-core/funcscan/pull/296) Added check for empty annotation files prior going into screening. (❤️ to @alexhbnr for requesting, added by @jfy133) ### `Dependencies` From c4bff8941d825cb5bcc7ceb14ea0d3b1fc6d801f Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Wed, 19 Jul 2023 11:37:03 +0200 Subject: [PATCH 3/3] Tweak error message --- workflows/funcscan.nf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/workflows/funcscan.nf b/workflows/funcscan.nf index f27c8685..7ef947c5 100644 --- a/workflows/funcscan.nf +++ b/workflows/funcscan.nf @@ -246,7 +246,7 @@ workflow FUNCSCAN { ch_annotation_faa .filter { meta, file -> - if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty FAA file) and will not be sent to AMP screening: ${meta.id}") + if ( file.isEmpty() ) log.warn("Annotation of following sample produced produced an empty FAA file. AMP screening tools requiring this file will not be executed: ${meta.id}") !file.isEmpty() } ) @@ -265,7 +265,7 @@ workflow FUNCSCAN { ch_annotation_faa .filter { meta, file -> - if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty FAA file) and will not be sent to ARG screening: ${meta.id}") + if ( file.isEmpty() ) log.warn("Annotation of following sample produced produced an empty FAA file. AMP screening tools requiring this file will not be executed: ${meta.id}") !file.isEmpty() } ) @@ -282,19 +282,19 @@ workflow FUNCSCAN { ch_annotation_gff .filter { meta, file -> - if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty GFF file) and will not be sent to BGC screening: ${meta.id}") + if ( file.isEmpty() ) log.warn("Annotation of following sample produced produced an empty GFF file. AMP screening tools requiring this file will not be executed: ${meta.id}") !file.isEmpty() }, ch_annotation_faa .filter { meta, file -> - if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty FAA file) and will not be sent to BGC screening: ${meta.id}") + if ( file.isEmpty() ) log.warn("Annotation of following sample produced produced an empty FAA file. AMP screening tools requiring this file will not be executed: ${meta.id}") !file.isEmpty() }, ch_annotation_gbk .filter { meta, file -> - if ( file.isEmpty() ) log.warn("The following sample produced no annotations (empty GBK file) and will not be sent to BGC screening: ${meta.id}") + if ( file.isEmpty() ) log.warn("Annotation of following sample produced produced an empty GBK file. AMP screening tools requiring this file will not be executed: ${meta.id}") !file.isEmpty() } )