Skip to content

Commit

Permalink
fix ampcombi when only one file passes parsetables
Browse files Browse the repository at this point in the history
  • Loading branch information
Darcy220606 committed Jan 8, 2025
1 parent 0340ba9 commit 7e1f164
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 11 additions & 3 deletions subworkflows/local/amp.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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 )
Expand Down
1 change: 0 additions & 1 deletion workflows/funcscan.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 7e1f164

Please sign in to comment.