Reshape, relabel, and remap by collection axis
Use this recipe when an upstream domain fan-out produces the right datasets but nests or labels them along the wrong axis for the next mapped tool.
This is a high-density recipe with narrow corpus evidence. Keep it grounded in explicit identifier transformations and review it carefully before applying it to unrelated tuple/grouping structures.
The reusable move is not relabeling alone; it is correcting which collection level Galaxy will map over after domain fan-out, while preserving a visible identifier derivation path.
Recipe
- Identify the downstream tool input that will be mapped and the collection level it should iterate over.
- Compare that expected axis with the current nested collection shape and labels.
- Use Apply Rules to expose, swap, or restore the axis that should become the mapped collection level.
- Extract identifiers from the collection level whose labels must drive downstream mapping.
- Rewrite labels deterministically when domain names contain extra suffixes, prefixes, or compound keys.
- Relabel the collection from the derived label file.
- Reshape again if relabeling fixed names but left the wrong collection type or nesting order.
- Connect the corrected collection to the downstream mapped tool and verify element labels/order.
Reach For This When
- A tool fans out by region, segment, sample, replicate, or other domain axis, but the next tool needs a different axis.
- Collection element identifiers encode multiple fields that must become separate nested axes or cleaner labels.
- A Nextflow
groupTuple()ortranspose()idiom has been reviewed as a real domain grouping axis, not arbitrary tuple reshaping, and Galaxy needs concrete collection axes for the equivalent map-over.
Operation Handoffs
- Use collection-swap-nesting-with-apply-rules when the main problem is
list:listaxis order. - Use collection-split-identifier-via-rules when one identifier string contains multiple axis labels.
- Use relabel-via-rules-and-find-replace or regex-relabel-via-tabular when labels need deterministic cleanup.
- Use collection-flatten-after-fanout when the outer fan-out axis no longer matters.
Pitfalls
- Do not treat arbitrary Nextflow tuple grouping as automatically representable in Galaxy collections.
- Do not relabel without preserving a visible derivation path; hidden label magic breaks review and tests.
- Do not generalize from a single dense workflow to all domain fan-out cases without a second exemplar or manual review.
See Also
- iwc-map-over-lifecycle-survey — Shape C evidence and review caveat.
- nextflow-operators-to-galaxy-collection-recipes — source-operator pressure points.