toil
toil copied to clipboard
select_first() implemented as WDL.
Description of WDL function to be added:
## X select_first(Array[X?])
Given an array of optional values, `select_first` will select the first defined value and return it. Note that this is a runtime check and requires that at least one defined value will exist: if no defined value is found when select_first is evaluated, the workflow will fail.https://github.com/openwdl/wdl/blob/main/versions/development/SPEC.md#x-select_firstarrayx
- [x] Add the following WDL function to https://github.com/DataBiosphere/toil/blob/master/src/toil/wdl/wdl_functions.py
- Implemented here: https://github.com/DataBiosphere/toil/blob/master/src/toil/wdl/wdl_functions.py#L457
- [ ] Add a test that runs a wdl/json with toil and then checks against cromwell to verify that toil and cromwell have the same behavior See: https://github.com/DailyDreaming/wdl-conformance-tests/tree/master/tests/standard_library
For example:
version 1.0
workflow SelectFirst {
input {
Int? maybe_five = 5
Int? maybe_four_but_is_not = None
Int? maybe_three = 3
}
Int five = select_first([maybe_five, maybe_four_but_is_not, maybe_three]) # This evaluates to 5
Int five = select_first([maybe_four_but_is_not, maybe_five, maybe_three]) # This also evaluates to 5
}
┆Issue is synchronized with this Jira Story ┆epic: WDL Standard Library Implementation ┆friendlyId: TOIL-650