Question: CWL: How to add multiple files from two input parameters of type FILE and DIRECTORY to InitialWorkDirRequirement
gravatar for awilke1972
5 months ago by
awilke197220 wrote:

I am struggling creating a tool definition which has multiple files as InitialWorkDirRequirement. The problem is that I have two input parameters, one is of type File and the other one of type Directory. I need all files from the Directory to be staged into the working directory. Below is a simple tool definition for testing. The example below is clearly not working since one expression in "listing" evaluates to a list, resulting in [ [File] , File].

  "cwlVersion": "v1.0",
  "class": "CommandLineTool",
  "baseCommand": [

  "requirements": [
      "class": "InitialWorkDirRequirement",
      "listing": [
        "$(" ,
  "stdout": "ls.log",
  "stderr": "error.log",
  "inputs": {
    "in": "Directory",
    "fasta": "File"
  "outputs": {
    "output": "stdout",
    "error": "stderr"
cwl • 412 views
ADD COMMENTlink modified 5 months ago by Michael R. Crusoe660 • written 5 months ago by awilke197220
gravatar for Michael R. Crusoe
5 months ago by
currently based out of Vilnius, Lithuania / Common Workflow Language project
Michael R. Crusoe660 wrote:

Hello awilke1972,

Thank you for your question. As you have discovered, CWL v1.0 does not allow for specifying other than a File, Directory, Dirent, or Expression when providing an array to the listing of a InitialWorkDirRequirement; specifically an array of Files can't be a member of that array response.

As a workaround, you can use InlineJavascriptRequirement and an expression like so:

  "requirements": {
    "InlineJavascriptRequirement": {},
    "InitialWorkDirRequirement": {
       "listing": "${var listing =; listing.push(inputs.fasta); return listing; }"

[and again in our typical YAML formatting]

  InlineJavascriptRequirement: {}
    listing: |
        var listing =;
        return listing;

I've created an issue so we can fix this in a future revision of the specification. Thank you for bringing this to our attention!

ADD COMMENTlink written 5 months ago by Michael R. Crusoe660
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1262 users visited in the last hour