Skip to content

Commit 2970101

Browse files
committed
Fix warning if no BGC hits found
1 parent 18afe1f commit 2970101

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

subworkflows/local/bgc.nf

+17-12
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,22 @@ workflow BGC {
7373
ANTISMASH_ANTISMASHLITE ( gbks, ch_antismash_databases, ch_antismash_directory, [] )
7474

7575
ch_versions = ch_versions.mix( ANTISMASH_ANTISMASHLITE.out.versions )
76-
ch_antismashresults_for_combgc = ANTISMASH_ANTISMASHLITE.out.knownclusterblast_dir
76+
ch_antismashresults = ANTISMASH_ANTISMASHLITE.out.knownclusterblast_dir
7777
.mix( ANTISMASH_ANTISMASHLITE.out.gbk_input )
7878
.groupTuple()
7979
.map{
8080
meta, files ->
81-
[meta, files.flatten()]
81+
[ meta, files.flatten() ]
8282
}
83-
ANTISMASH_ANTISMASHLITE.out.gbk_results.ifEmpty(
84-
ch_antismashresults_for_combgc = Channel.empty()
85-
)
83+
84+
// Filter out samples with no BGC hits
85+
ch_antismashresults_for_combgc = ch_antismashresults
86+
.join(fastas, remainder: false)
87+
.join(ANTISMASH_ANTISMASHLITE.out.gbk_results, remainder: false)
88+
.map {
89+
meta, gbk_input, fasta, gbk_results ->
90+
[ meta, gbk_input ]
91+
}
8692

8793
ch_bgcresults_for_combgc = ch_bgcresults_for_combgc.mix( ch_antismashresults_for_combgc )
8894
}
@@ -151,15 +157,14 @@ workflow BGC {
151157
}
152158

153159
// COMBGC
154-
ch_bgc_warning = fastas
155-
.map {
156-
meta, fasta ->
157-
"[nf-core/funcscan] BGC workflow: No hits found by BGC tools; comBGC summary tool will not be run for sample: ${meta.id}"
158-
}
159-
.collect()
160160

161161
ch_bgcresults_for_combgc
162-
.ifEmpty { log.warn(ch_bgc_warning.val[0]) }
162+
.join(fastas, remainder: true)
163+
.filter {
164+
meta, bgcfile, fasta ->
165+
if ( !bgcfile ) { log.warn("[nf-core/funcscan] BGC workflow: No hits found by BGC tools; comBGC summary tool will not be run for sample: ${meta.id}") }
166+
return [meta, bgcfile, fasta]
167+
}
163168

164169
COMBGC ( ch_bgcresults_for_combgc )
165170
ch_versions = ch_versions.mix( COMBGC.out.versions )

0 commit comments

Comments
 (0)