Question: CWL: How to add multiple files from two input parameters of type FILE and DIRECTORY to InitialWorkDirRequirement
1
gravatar for awilke1972
9 days ago by
awilke197210
awilke197210 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": [
    "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 • 95 views
ADD COMMENTlink modified 8 days ago by Michael R. Crusoe360 • written 9 days ago by awilke197210
1
gravatar for Michael R. Crusoe
8 days ago by
currently based out of Vilnius, Lithuania / Common Workflow Language project
Michael R. Crusoe360 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.

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 COMMENTlink written 8 days ago by Michael R. Crusoe360
Please log in to add an answer.

Help
Access

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