Home Pattern

Parameter: map workflow enum to tool parameter

Use map_param_value to translate workflow enum values into downstream tool codes, flags, or snippets.

Revised
2026-05-03
Rev
3

Pattern health

warn
  • IWC exemplar anchors

    3 abstract workflow anchors declared.

  • Foundry verification fixture

    1 verification path declared.

  • Pattern map coverage

    No pattern map links to this leaf yet.

  • Metadata contract

    Pattern frontmatter matches the site contract.

Parameter: map workflow enum to tool parameter

Tool

Use toolshed.g2.bx.psu.edu/repos/iuc/map_param_value/map_param_value/0.2.0 when a workflow input uses a human-facing enum or label, but downstream tools require exact codes, flags, snippets, or naming fragments.

The corpus-backed shape is:

workflow enum/string -> map_param_value -> downstream tool parameter

When to reach for it

Use this when one logical workflow option must feed multiple downstream tools with different parameter vocabularies.

Good fits include strandedness codes, tool flags, suffix abbreviations, and snippets selected from an enum.

Do not use this page for when gate booleans. If the mapped output controls branch topology, use conditional-route-between-alternative-outputs or conditional-run-optional-step.

Do not use this for arithmetic or row-wise computation; use tabular patterns such as tabular-compute-new-column.

If the mapped value becomes one component inside a larger expression string, this page covers the enum-to-fragment step; compose-runtime-text-parameter covers the concatenation.

Operation Boundary

This pattern covers parameter dialect normalization:

  • input fact: a workflow-facing value is readable to users;
  • output action: a downstream tool receives the exact dialect it expects;
  • mapping mechanism: map_param_value.

It does not cover enum-to-boolean route selection, direct optional gates, tabular row computation, or runtime string assembly from multiple pieces.

Parameters

  • input_param_type.type: usually text for enum/string values.
  • input_param_type.input_param: connected upstream workflow value.
  • input_param_type.mappings: list of {from, to} pairs.
  • output_param_type: usually text for tool dialects and snippets.
  • unmapped.on_unmapped: prefer fail for closed enums and exact downstream dialects.

on_unmapped: input can intentionally pass through labels, but it can also leak a human-facing label into a strict tool parameter. Use it only when passthrough is deliberate.

Idiomatic Shapes

RNA-seq strandedness mapped to featureCounts codes:

tool_id: toolshed.g2.bx.psu.edu/repos/iuc/map_param_value/map_param_value/0.2.0
in:
  - id: input_param_type|input_param
    source: Strandedness
out:
  - id: output_param_text
    hide: true
tool_state:
  input_param_type:
    type: text
    input_param:
      __class__: ConnectedValue
    mappings:
      - from: stranded - forward
        to: "1"
      - from: stranded - reverse
        to: "2"
      - from: unstranded
        to: "0"
  output_param_type: text
  unmapped:
    on_unmapped: fail

The same workflow enum maps through sibling map_param_value steps into Cufflinks library types and StringTie flags. Keep those as separate mapper steps because the downstream dialects are incompatible.

Pitfalls

  • Do not duplicate enum comparisons inside every downstream tool. Normalize once with map_param_value, then connect the resulting typed parameter.
  • Do not use this page as the main reference for booleans that feed when; that is conditional routing.
  • Do not drop empty string mappings as missing. StringTie maps unstranded to "", which is meaningful.
  • Do not silently change quoted numeric codes into numeric output types unless the downstream parameter expects a numeric type.
  • Do not use one mapper output for incompatible tool dialects. One workflow value may need several mapper steps.
  • Treat long generated snippets as brittle. The taxonomy awk examples prove the mechanism, but a clearer wrapper or smaller expression is easier to maintain when available.

See Also

IWC exemplars3 anchors

IWC Exemplars

transcriptomics/rnaseq-pe/rnaseq-pehigh

Shows one workflow enum normalized into several downstream tool dialects with separate mapper steps.

  • Strandedness to featureCounts codes
  • Strandedness to Cufflinks library types
  • Strandedness to StringTie flags
VGP-assembly-v2/Scaffolding-HiC-VGP8/Scaffolding-HiC-VGP8high

Shows label-to-fragment mapping consumed later by runtime text composition.

  • Map haplotype labels to suffix abbreviations
amplicon/amplicon-mgnify/taxonomic-rank-abundance-summary-table/taxonomic-rank-abundance-summary-tablehigh

Shows enum mapping into executable text for a downstream text-processing parameter.

  • Map taxonomic rank to awk program text

Incoming References (4)