Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
- [#1012](https://github.com/nf-core/mag/pull/1012) - Prevent adapter trimming with Porechop on PacBio reads (by @dialvarezs)
- [#1011](https://github.com/nf-core/mag/pull/1011) - Fix issue making CheckM2 running only for one sample per run (by @dialvarezs)
- [#1017](https://github.com/nf-core/mag/pull/1017) - Prevent ALE running on long read assemblies when a sample has both LR and SR data (reported by @jfy133, fix by @dialvarezs)
- [#1021](https://github.com/nf-core/mag/pull/1021) - Prevent execution of `gtdbtk/summary` when no bins pass QC (reported by @jfy133, fix by @dialvarezs)

### `Dependencies`

Expand Down
18 changes: 14 additions & 4 deletions subworkflows/local/gtdbtk/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ workflow GTDBTK {
error("Unsupported object given to --gtdb, database must be supplied as either a directory or a .tar.gz file!")
}

// Warn if no QC data was available (all QC tools likely failed)
ch_bin_qc_summary
.count()
.filter { count -> count == 0 }
.subscribe { _count ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the subscribe do here 🤔 I never understood that operator...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subscribe() executes a function on each output of a channel, without generating an ouput (contrary to map() that returns something)

log.warn("No bin QC results were available. Skipping GTDB-Tk classification.")
Comment thread
dialvarezs marked this conversation as resolved.
Outdated
Comment thread
dialvarezs marked this conversation as resolved.
Outdated
}

GTDBTK_CLASSIFYWF(
ch_filtered_bins.passed.groupTuple(),
ch_db_for_gtdbtk,
Expand All @@ -94,20 +102,22 @@ workflow GTDBTK {
.combine(ch_filtered_bins.discarded.count())
.subscribe { passed, failed ->
if ((passed + failed) > 0 && passed == 0) {
log.warn("No contigs passed GTDB-TK min. completeness filters. GTDB-TK summary will execute but results will be empty!")
log.warn("No contigs passed GTDB-TK min. completeness filters.")
Comment thread
dialvarezs marked this conversation as resolved.
Outdated
Comment thread
dialvarezs marked this conversation as resolved.
Outdated
}
}

GTDBTK_SUMMARY(
ch_filtered_bins.discarded.map { _meta, bin -> bin }.collect().ifEmpty([]),
GTDBTK_CLASSIFYWF.out.summary.map { _meta, summary -> summary }.collect().ifEmpty { ([]) },
GTDBTK_CLASSIFYWF.out.summary.map { _meta, summary -> summary }.collect(),
[],
[],
)

ch_summary = channel.empty().mix(GTDBTK_SUMMARY.out.summary)
ch_versions = ch_versions.mix(GTDBTK_SUMMARY.out.versions)

emit:
summary = GTDBTK_SUMMARY.out.summary
multiqc_files = GTDBTK_SUMMARY.out.summary
summary = ch_summary
multiqc_files = ch_summary
versions = ch_versions
}
Loading