Collection: flatten after fan-out
Tool
Use Galaxy built-in __FLATTEN__.
The corpus-attested operation is simple: collapse a nested collection such as list:list or list:paired into a flat list when the outer grouping axis has served its purpose.
When to reach for it
Use this after a tool fans out within each sample/group and downstream no longer needs that grouping.
Typical shape: a domain tool maps over a collection and produces nested outputs, the outer axis becomes only organizational, and __FLATTEN__ produces one flat list for pooling, relabeling, reporting, or MultiQC-style consumption.
Do not flatten if downstream needs to know which outer sample/group produced each element.
Parameters
tool_id: __FLATTEN__
tool_state:
input: { __class__: ConnectedValue }
The useful authoring decision is input collection type and whether the outer axis is truly no longer meaningful.
Pitfalls
- Flattening discards structure. Element identifiers may retain hints, but the Galaxy collection type no longer encodes the outer axis.
- Flatten only after the outer axis is done.
- If flattened identifiers collide or become unreadable, add an explicit relabel step.
- Do not use Apply Rules for plain flattening; the survey found
__FLATTEN__dominates simple cases.
See also
- iwc-transformations-survey — Recipe H and candidate boundary.
- collection-build-named-bundle — assemble named outputs into a collection.
- harmonize-by-sortlist-from-identifiers — order/intersect sibling collections by identifier file.