List of input files in external yaml file

Hello,
I’m trying to create a workflow which gets as input a File[] (let’s call it parameter par1) and several other inputs (booleans, ints, other File…).

Given that the quantity of Files constituting par1 is quite large, I’d like to find a way to simplify and isolate the par1 part when writing the inputs.
Currently I’m compiling a yaml file with something like:

par1:
  - {class: File, path: ../path/to/file_001.lv0}
  - {class: File, path: ../path/to/file_002.lv0}
  - {class: File, path: ../path/to/file_003.lv0}
  - {class: File, path: ../path/to/file_004.lv0}
  - {class: File, path: ../path/to/file_005.lv0}
  - {class: File, path: ../path/to/file_006.lv0}
  - {class: File, path: ../path/to/file_007.lv0}
  - {class: File, path: ../path/to/file_008.lv0}
  - {class: File, path: ../path/to/file_009.lv0}

Is there a way to get the input filenames from an external file?
I saw there’s the $include directive but I believe is not applicable to yaml file.

If it’s not possible, I’m headed towards the creation of an Expression Tool which tries to generates the File[] from a file.txt. Do you have better ideas?

Thanks,
Michele

You can try to pass a Directory as input instead of several files if your files are in the same directory.

Pass the directory as input and add it to the InitialWorkDirRequirement of the CWL tool.

InitialWorkDirRequirement:
  listing:
   - '$({class: "Directory", basename: inputs.par1.location, listing: []})'
1 Like

Thanks! Interesting. Unfortunately they may not be in the same dir

That’s clever, but alas that won’t work. You can’t pull in arbitrary Files from the filesystem in CWL like that.

I recommend making a script in your language of choice to generate the input file before sending it and the workflow to your chosen CWL runner.

1 Like