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"
}
}
1 answer
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
Log in to answer this question.