Possible to combine inputs using valueFrom for scatter
1
1
Entering edit mode
6.2 years ago
ionox0 ▴ 390

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.4k views
ADD COMMENT
0
Entering edit mode
6.2 years ago

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
ADD COMMENT

Login before adding your answer.

Traffic: 1810 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6