The context for this problem is that I am trying to create an input record for one step in a workflow. Depending on how certain parameters for the workflow were set, this record should either pull values from a prior step or (if the prior step wasn’t run) pull the value from the user-input parameters in the yml for the workflow. For my non-record inputs this is fairly straightforward to work with, as the following works to define the input to the variable:
round_offset:
source: [stagedSorted/round_offset, round_offset]
pickValue: first_non_null
However, it does not seem to be possible to generate a record as output from the stagedSorted
step without setting up a custom datatype (which I would then have to use everywhere this record is used). Because this same pickValue
doesn’t work when one item is a complete record and the other needs to be generated with an expression, I used the following valueFrom
, thinking it would let me create the appropriate record in-line.
aux_tilesets:
source: [aux_tilesets, stagedSorted/aux_names, stagedSorted/aux_file_formats, stagedSorted/aux_file_vars, stagedSorted/aux_cache_read_order, channel_count, stagedSorted/aux_channel_slope, stagedSorted/aux_channel_intercept]
linkMerge: merge_flattened
valueFrom: |
${
if(!self[1]){
return {
aux_names: self[0].aux_names,
aux_file_formats: self[0].aux_file_formats,
aux_file_vars: self[0].aux_file_vars,
aux_cache_read_order: self[0].aux_cache_read_order,
aux_channel_count: self[0].aux_channel_count,
aux_channel_slope: self[0].aux_channel_slope,
aux_channel_intercept: self[0].aux_channel_intercept
};
} else {
return {
aux_names: self[1],
aux_file_formats: self[2],
aux_file_vars: self[3],
aux_cache_read_order: self[4],
aux_channel_count: self[5],
aux_channel_slope: self[6],
aux_channel_intercept: self[7]
};
};
}
This looks similar to other times when I have manipulated records with expressions, but this time I get the following error when I try to validate the cwl
:
ERROR Tool definition failed validation:
pipeline.cwl:409:9: while scanning a simple key
pipeline.cwl:412:26: could not find expected ':'
(The line numbers refer to the first return in the if statement)
The only things that are different this time than the other times I’ve made a record with an expression are the linkMerge and the if statement-- is what I’m trying to do even possible, or is there some other way I could get the same result?