This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Possible to combine inputs using valueFrom for scatter

Is it possible to combine multiple inputs from another step using valueFrom so that they can be scattered over?

For example something like:

inputs:

  input_one: Directory
  input_two: Directory

steps: 

  a_step:
    run: ../../cwl_tools/noise/calculate_noise.cwl
    in:
      input_thing:
        valueFrom: |
          ${
            return [
              inputs.input_one,
              inputs.input_two
            ]
          }

    out: [output_thing]
    scatter: input_thing

I get this error:

[workflow workflow.cwl] starting step a_step
Unhandled exception
Traceback (most recent call last):
  File "/home/johnsoni/virtualenvs/pipeline_test/lib/python2.7/site-packages/cwltool-1.0.20180306140409-py2.7.egg/cwltool/workflow.py", line 401, in try_make_job
    emptyscatter = [shortname(s) for s in scatter if len(inputobj[s]) == 0]
TypeError: object of type 'NoneType' has no len()
cwl

1 answer

Hello ionox0,

Yes, this is possible. Just wire up the other inputs to non-existent names and reference them from your expression

inputs:

  input_one: Directory
  input_two: Directory

steps: 

  a_step:
    run: ../../cwl_tools/noise/calculate_noise.cwl
    in:
      fake_input_two: input_two
      input_thing:
        source: input_one
        valueFrom: |
          ${
            return [
              self,
              inputs.fake_input_two
            ]
          }

    out: [output_thing]
    scatter: input_thing

Though, in your case this can be accomplished using linkMerge: merge_flattened

requirements:
  MultipleInputFeatureRequirement: {}

inputs:

  input_one: Directory
  input_two: Directory

steps: 

  a_step:
    run: ../../cwl_tools/noise/calculate_noise.cwl
    in:
      input_thing:
        source: input_one, input_two
        linkMerge: merge_flattened

    out: [output_thing]
    scatter: input_thing

Log in to answer this question.