This is a test version of Biostars. For the public version, visit https://www.biostars.org.
CWL: array of files as an input

I'm trying to create a workflow wit scatter that takes also files and I'm not sure what should be the syntax for my input.yml file. This is my main cwl file:

#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: Workflow
requirements:
   - class: ScatterFeatureRequirement
inputs:
  file_orig: File
  script_mv: File
  script_edit:
    type:
      type: array
      items: File
outputs:
  file_changed:
    type:
      type: array
      items: File
    outputSource: edit/output_files

steps:
  move:
    run: cwl_move.cwl
    in:
      script: script_mv
      input_file: file_orig
    out: [output_files_mv]
  edit:
    run: cwl_edit.cwl
    scatter: [input_file, script]
    scatterMethod: dotproduct
    in:
      script: script_edit
      input_file: move/output_files_mv
    out: [output_files]

So the first field from scatter, input_file, is taken from previous step move, but the second field, script, I'd like to provide as an input to the workflow. I already changed my cwl file, so script_edit is an array, but I don't know what should be the syntax of input.yml (I only found a simple example with input that does not require additional filed like class or path). This is my current input.yml file with rather random syntax for script_edit array:

script_mv:
  class: File
  path: /path/mv.py
script_edit:[
  {class: File,
  path: /path/edit_0.py},
  {class: File,
  path: /path/edit_1.py}]
file_orig:
  class: File
  path: /path/myfile.txt
cwl

1 answer

I generally do arrays of files like this:

fastq:
- {class: File, path: sample1_R1_001.fastq.gz}
- {class: File, path: sample2_R1_001.fastq.gz}

But your way may also work, I would format it like:

script_edit: [
  {class: File, path: /path/edit_0.py},
  {class: File, path: /path/edit_1.py}
]

I think the space after script_edit: is necessary

Log in to answer this question.