Home Source Pattern

Nextflow: branch, filter, and ifEmpty to Galaxy filters and gates

Route Nextflow branch, filter, and ifEmpty channel idioms to Galaxy collection cleanup, identifier filters, when gates, or review.

Revised
2026-05-04
Rev
1
Review Triggers
  • Per-element branch routing uses non-trivial predicates.
  • Branch or filter closure inspects file contents or mutates tuple metadata.
  • Branch has default, unknown, or discarded data whose Galaxy fate is unclear.
  • filter drops channel items that must keep sibling collections aligned.
  • ifEmpty fallback changes required outputs, collection shape, or report semantics.
  • Translation would rely on FILTER_NULL as primary cleanup.

Nextflow: branch, filter, and ifEmpty to Galaxy filters and gates

Use this when a Nextflow summary reports .branch, .filter, or .ifEmpty. Do not translate syntax directly; first classify the source intent.

Source idiom classification

  • Static workflow-level condition -> Galaxy when gate.
  • Mutually exclusive alternative route -> when alternatives plus pick_value.
  • Optional transform with original fallback -> optional branch plus pick_value.
  • Per-element cleanup after sparse map-over -> collection cleanup/filter recipes.
  • Whole-result empty/non-empty report admission -> data-derived boolean gate.
  • Arbitrary per-element branch/filter -> review trigger.

Translation table

Nextflow source shapeGalaxy target patternNotes
branch separates workflow modes from a user parameterconditional-run-optional-step or conditional-route-between-alternative-outputsGate whole steps; merge if downstream needs one value.
branch selects among peer outputsconditional-route-between-alternative-outputsRequire compatible branch outputs.
filter removes empty or failed mapped outputscollection-cleanup-after-mapover-failurePrefer empty/failed filters, not when.
Cleaned result membership subsets a sibling collectionsync-collections-by-identifierExtract identifiers from the truth collection.
ifEmpty controls final report/exportconditional-gate-on-nonempty-resultDerive a boolean, then gate report/export.
cleanup + sibling sync + publish gatecleanup-sync-and-publish-nonempty-resultsUse the lifecycle recipe.

Pitfalls

  • Galaxy when is step-level, not arbitrary per-channel-item routing.
  • Collection filters clean collection elements; they do not choose branches.
  • Identifier filtering filters by labels; it does not inspect dataset state.
  • If dropping elements, decide whether sibling collections need membership or order sync.

Evidence posture

This page is grounded in existing Foundry conditional and transformation surveys. Direct .filter and .ifEmpty fixture evidence was not regenerated during authoring.

Incoming References (1)

  • Nextflow: source pattern maprelated note— Use this source-pattern map to route recurring Nextflow channel and operator idioms to Galaxy implementation patterns.