CWL: How to add multiple files from two input parameters of type FILE and DIRECTORY to InitialWorkDirRequirement
1
2
Entering edit mode
7.7 years ago
awilke1972 ▴ 20

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": [
    "ls",
    "-l",
    "."
  ],

  "requirements": [
    {
      "class": "InitialWorkDirRequirement",
      "listing": [
        "$(inputs.in.listing)" ,
        "$(inputs.fasta)"
      ]
    }
  ],
  "stdout": "ls.log",
  "stderr": "error.log",
  "inputs": {
    "in": "Directory",
    "fasta": "File"
  },
  "outputs": {
    "output": "stdout",
    "error": "stderr"
  }
}
cwl • 3.3k views
ADD COMMENT
1
Entering edit mode
7.7 years ago

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.

http://www.commonwl.org/v1.0/CommandLineTool.html#InitialWorkDirRequirement

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

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

[and again in our typical YAML formatting]

requirements:
  InlineJavascriptRequirement: {}
  InitialWorkDirRequirement:
    listing: |
      ${
        var listing = inputs.in.listing;
        listing.push(inputs.fasta);
        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!

https://github.com/common-workflow-language/common-workflow-language/issues/412

ADD COMMENT

Login before adding your answer.

Traffic: 1520 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