Tabular: cut and reorder columns
Tool
Cut1 (Galaxy core; bundled, no toolshed owner). Display name “Cut columns from a table”. Source: $GALAXY/tools/filters/cutWrapper.xml.
When to reach for it
Project a tabular to a subset of columns, and/or reorder existing columns. By far the most-used tabular tool in the IWC corpus (127 step occurrences in the survey). Use Cut1 when the operation is purely “pick columns” — no computation, no row filtering, no aggregation.
For project + compute fused, see tabular-sql-query or tabular-compute-new-column.
Parameters
columnList: a single comma-separated string ofcNreferences — e.g.c4,c6,c7. Range syntaxc2-c5is also accepted (per the tool’s tests). Order matters: the output column order is the list order, so listing columns out of input order reorders them. The IWC corpus uses long enumerations rather than ranges; either is valid.delimiter: select enum from the wrapper. Values:T(Tab),Sp(Whitespace — collapses runs),Dt(Dot),C(Comma),D(Dash),U(Underscore),P(Pipe). Tab dominates the corpus; always set explicitly.- The connected
inputport is the tabular dataset.
Idiomatic shapes
Pure projection (preserve order, drop unwanted columns):
tool_id: Cut1
tool_state:
columnList: c1,c2,c5
delimiter: T
Projection + reorder in one step (note c20 placed after c26,c24,c25):
tool_id: Cut1
tool_state:
columnList: c4,c6,c7,c13,c14,c15,c16,c17,c18,c19,c21,c22,c23,c26,c24,c25,c20
delimiter: T
Anchored by the SARS-CoV-2 variation reporting IWC exemplar.
Pitfalls
- No header awareness. The header row is cut and reordered identically to data rows. Usually what you want; flagging only because
Filter1/Grouping1do takeheader_lines. delimitermust match the input. Mismatched delimiter (e.g.delimiter: Ton comma-separated input) treats each line as a single field —c1echoes the whole row,c2…produce a.(the wrapper’s missing-column fill) per row. Silent.- Cut breaks Galaxy column metadata. The wrapper warns: re-cutting may invalidate column-assignment metadata (chrom/start/end for interval/BED). Re-establish via the dataset’s “edit attributes” if downstream tools need it.
- Reorder-then-rename is not
Cut1’s job. Renaming columns means rewriting the header row — handle that with tabular-compute-new-column or with atp_replace_in_linepass. - Adding a constant column belongs to tabular-compute-new-column (
column_maker/Add_a_column1), notCut1+Paste1. The latter is legacy.
Legacy alternative
None for Cut1 itself — it is the modern tool. The legacy idiom of “add a constant column with Paste1 then re-Cut1” survives but should be replaced by column_maker/Add_a_column1 (see tabular-compute-new-column).
See also
- iwc-tabular-operations-survey — corpus survey and decision record.
- tabular-compute-new-column — when projection needs to add or replace a column.
- tabular-sql-query — project + compute fused via
query_tabular.