This is a test version of Biostars. For the public version, visit https://www.biostars.org.
CWL: Gathering outputs in folders.

Hi, this is a cwl syntax question. I have a simple python script that creates two files:

with open("A.txt", "w") as f:  
    f.write("lpha")

with open("x/x/B.txt", "w") as f:  
    f.write("eta")

And I want to run this with cwl.

The first file creation runs and works fine, because it deposits the file in the working directory. The second does not work because the folders "x/x" seem to not be recreated in the temporary folder that cwl uses. I've tried to specify these folders as inputs (which I think is correct?) with the following attempt:

cwlVersion: v1.0
class: CommandLineTool
baseCommand: python

inputs:
  - id: xdir
    type: Directory

  - id: src
    type: File
    inputBinding:
      position: 1

outputs:
  - id: A
    type: File
    outputBinding:
      glob: "A.txt"

Here is the .yml:

src:
  class: File
  path: makefile.py

xdir:
  class: Directory
  path: x/x

How should I write these so that this will run? Thanks!

cwl

1 answer

Hello lon.lightly,

The best thing would be to modify the script so that the user can specify the location (if not the filename) of "B.txt".

One workaround involves the InitialWorkDirRequirement but in testing it using nested directories I found a bug in the reference CWL runner: https://github.com/common-workflow-language/cwltool/issues/578

Log in to answer this question.