Parameter: derive from file
Tool
Use param_value_from_file when an upstream dataset contains exactly one scalar value that must become a connected Galaxy runtime parameter.
The corpus-backed shape is:
dataset -> param_value_from_file -> downstream tool parameter
param_type selects the typed output port: integer_param, float_param, text_param, or boolean_param. In the observed scalar-read examples, remove_newlines: true is the normal setting.
When to reach for it
Use this when a workflow computes or receives a small file containing one value, and a downstream tool needs that value as a typed parameter rather than as a dataset input.
Good fits include computed genome sizes, coverage estimates, minimum counts, repeat counts, line counts, file-derived text, and boolean shims.
Do not use this for ordinary tabular transformations whose output remains a dataset; use tabular patterns such as tabular-compute-new-column.
Do not use this for dynamic expression strings built directly from parameters; use compose-runtime-text-parameter.
Do not center non-empty gating here. If the user story is “skip downstream work when empty,” use conditional-gate-on-nonempty-result.
Operation Boundary
This pattern covers file-to-parameter bridging:
- input fact: a dataset contains one scalar value, or an upstream count recipe produces one scalar value;
- output action: expose that scalar as a Galaxy typed runtime parameter port;
- bridge mechanism:
param_value_from_file.
It covers file-to-integer, file-to-float, file-to-text, file-to-boolean, count-to-integer, and collection-size-to-boolean when explaining the bridge.
It does not cover enum mapping, runtime text composition, branch topology after a boolean exists, general column computation, or collection cleanup.
Parameters
input1: connected scalar dataset.param_type: set tointeger,float,text, orboolean; downstream steps must connect the matching typed output port.remove_newlines: settruefor one-value files unless the downstream text parameter explicitly needs line breaks.
Changing param_type changes which output port is meaningful. A generated workflow must connect integer_param to integer inputs, float_param to float inputs, and so on.
Count, Then Parameterize
Use wc_gnu with options: [lines] when a line count must drive a downstream integer parameter. For collections, first expose element identifiers with collection_element_identifiers, then count those identifier rows.
The reusable operation is still “produce a scalar file, then parameterize it”:
dataset -> wc_gnu(options: [lines]) -> param_value_from_file(param_type: integer)
For collection non-empty booleans, the corpus adds a tabular boolean step:
collection -> collection_element_identifiers -> wc_gnu -> column_maker(c1 != 0) -> param_value_from_file(param_type: boolean)
That final shape belongs operationally to conditional-gate-on-nonempty-result when it feeds when.
Tabular Scalar Round Trip
Some workflows compute one value in tabular-land, then escape back to parameter-land. Consensus peaks uses table_compute to get a minimum value, then reads that value back with param_value_from_file. MGnify uses column_maker only to turn a count into c1 != 0 before reading the result as a boolean.
Keep the tabular mechanics on the tabular page. This page owns the escape hatch from one-value dataset to typed parameter.
Idiomatic Shapes
Conceptual scalar read:
tool_id: param_value_from_file
in:
- id: input1
source: upstream_scalar_file
out:
- id: integer_param
tool_state:
input1:
__class__: ConnectedValue
param_type: integer
remove_newlines: true
Conceptual count-to-integer:
dataset -> wc_gnu(options: [lines]) -> param_value_from_file(param_type: integer)
Conceptual collection non-empty boolean:
collection -> collection_element_identifiers -> wc_gnu -> column_maker(c1 != 0) -> param_value_from_file(param_type: boolean)
Pitfalls
- Do not connect the dataset output when the downstream tool expects a typed parameter port.
- Do not connect the wrong typed output port after changing
param_type. - Do not leave newlines in one-value scalar files unless downstream text syntax requires them.
- Do not treat
wc_gnuoutput as numeric untilparam_value_from_fileconverts it. - Do not bury the operation under
wc_gnu; counts are just one upstream scalar-producing recipe. - Do not duplicate conditional-gate-on-nonempty-result. If the user story is “skip when empty,” the conditional page owns the recommendation.
- Do not present MGnify’s four-step boolean shim as best. It is corpus-backed but clunky and pending verified-pattern issue #84.
See Also
- iwc-parameter-derivation-survey — Candidate A/B decision record.
- conditional-gate-on-nonempty-result — when a derived boolean feeds
when. - tabular-compute-new-column — when the main operation is tabular computation, not file-to-parameter bridging.
- compose-runtime-text-parameter — when the goal is to build a text parameter from runtime pieces.