Guard against running on an empty per-sample input list in tximport/quantify_rsem#12378
Open
pinin4fjords wants to merge 2 commits into
Open
Guard against running on an empty per-sample input list in tximport/quantify_rsem#12378pinin4fjords wants to merge 2 commits into
pinin4fjords wants to merge 2 commits into
Conversation
toSortedList() always emits (even []) on an empty upstream, unlike the collect() it replaced which emits nothing at all. Without a guard, that turns a channel that previously never triggered its downstream process into one that always does, running CUSTOM_RSEMMERGECOUNTS/TXIMETA_TXIMPORT once with zero staged files whenever no samples reach this point (e.g. all samples filtered out upstream). Filter to size() > 0 to restore the original no-op-on-empty behaviour.
pinin4fjords
added a commit
to pinin4fjords/rnaseq
that referenced
this pull request
Jul 15, 2026
toSortedList() always emits (even []) on an empty upstream, unlike the collect() it replaced which emits nothing at all. Without a guard, a channel that previously never triggered its downstream process now always does, running CUSTOM_RSEMMERGECOUNTS/TXIMETA_TXIMPORT once with zero staged files whenever no samples reach this point (e.g. all samples filtered out upstream). Filter to size() > 0 to restore the original no-op-on-empty behaviour. Applied here ahead of the modules.json bump; nf-core/modules#12378 carries the same fix upstream. Once that merges, only the pinned git_sha needs updating.
jscgh
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #12377, caught by downstream CI on the nf-core/rnaseq consuming PR (nf-core/rnaseq#1885).
#12377swappedcollect()fortoSortedList()on the per-sample inputs feedingTXIMETA_TXIMPORTandCUSTOM_RSEMMERGECOUNTS, to make the staged input order (and therefore the task hash) deterministic. That swap has a side effect:toSortedList()always emits exactly one value, even[], on an empty upstream, whereas thecollect()it replaced emits nothing at all when the upstream is empty.In a pipeline run where every sample is filtered out before reaching this point (e.g. all samples fail a trim-length threshold), the per-sample channel closes with zero elements. With the old
collect(), that meantTXIMETA_TXIMPORT/CUSTOM_RSEMMERGECOUNTSwere never invoked at all - a queue channel with no matching emission on one side means no invocation. WithtoSortedList(), the channel now emits a single[]value, so the process fires once with zero staged files, producing empty output files instead of being skipped.Changes
Add
.filter { sorted -> sorted.size() > 0 }after eachtoSortedList()in both subworkflows, matching the guard already used forCUSTOM_TX2GENE's input in the same subworkflow. Restores the original no-op-on-empty behaviour while keeping the ordering deterministic for the non-empty case.PR checklist
nf-core subworkflows test quant_tximport_summarizedexperiment --profile dockerpasses, snapshot unchanged.nf-core subworkflows test quantify_rsem --profile dockerpasses, snapshot unchanged.