From 7e1f164a0028b0e96f710a6423ccf6fb2ef08219 Mon Sep 17 00:00:00 2001 From: darcy220606 Date: Wed, 8 Jan 2025 12:05:09 +0100 Subject: [PATCH] fix ampcombi when only one file passes parsetables --- subworkflows/local/amp.nf | 14 +++++++++++--- workflows/funcscan.nf | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/subworkflows/local/amp.nf b/subworkflows/local/amp.nf index 316b944d..b50aacd0 100644 --- a/subworkflows/local/amp.nf +++ b/subworkflows/local/amp.nf @@ -29,7 +29,7 @@ workflow AMP { ch_ampcombi_summaries = Channel.empty() ch_macrel_faa = Channel.empty() ch_ampcombi_complete = Channel.empty() - ch_ampcombi_for_cluster = Channel.empty() + ch_ampcombi_summaries = Channel.empty() // When adding new tool that requires FAA, make sure to update conditions // in funcscan.nf around annotation and AMP subworkflow execution @@ -114,6 +114,7 @@ workflow AMP { interpro: it [4] } + // AMPCOMBI2::PARSETABLES if ( params.amp_ampcombi_db != null ) { AMPCOMBI2_PARSETABLES ( ch_input_for_ampcombi.input, ch_input_for_ampcombi.faa, ch_input_for_ampcombi.gbk, params.amp_ampcombi_db_id, params.amp_ampcombi_db, ch_input_for_ampcombi.interpro ) } else { @@ -125,13 +126,20 @@ workflow AMP { ch_versions = ch_versions.mix( AMPCOMBI2_PARSETABLES.out.versions ) ch_ampcombi_summaries = AMPCOMBI2_PARSETABLES.out.tsv.map{ it[1] }.collect() + ch_ampcombi_summaries_count = ch_ampcombi_summaries.map{ it.size() } - AMPCOMBI2_COMPLETE ( ch_ampcombi_summaries ) + // AMPCOMBI2::COMPLETE + ch_more_than_one = ch_ampcombi_summaries_count.filter { it > 1 }.map { ch_ampcombi_summaries } + AMPCOMBI2_COMPLETE(ch_more_than_one) ch_versions = ch_versions.mix( AMPCOMBI2_COMPLETE.out.versions ) - ch_ampcombi_complete = AMPCOMBI2_COMPLETE.out.tsv .filter { file -> file.countLines() > 1 } + ch_ampcombi_summaries_count.filter { it < 2 }.subscribe { count -> + log.warn("[nf-core/funcscan] AMPCOMBI2: $count file passed AMPCOMBI2:parsetables. Skipping AMPCOMBI2_COMPLETE, AMPCOMBI2_CLUSTER, and TAXONOMY MERGING steps.") + } + + // AMPCOMBI2::CLUSTER if ( ch_ampcombi_complete != null ) { AMPCOMBI2_CLUSTER ( ch_ampcombi_complete ) ch_versions = ch_versions.mix( AMPCOMBI2_CLUSTER.out.versions ) diff --git a/workflows/funcscan.nf b/workflows/funcscan.nf index 1a587b80..6e47e55b 100644 --- a/workflows/funcscan.nf +++ b/workflows/funcscan.nf @@ -195,7 +195,6 @@ workflow FUNCSCAN { ch_input_for_function ) ch_versions = ch_versions.mix(FUNCTION.out.versions) - //ch_interproscan_tsv = FUNCTION.out.tsv.map{ it[1] }.collect() ch_interproscan_tsv = FUNCTION.out.tsv } else { ch_interproscan_tsv = Channel.empty()