Taking directory path for reading as well as writing files
1
0
Entering edit mode
6.2 years ago
ionox0 ▴ 390

Iā€™m using a tool that takes a directory parameter. The tool uses this directory parameter to look for a file that should be used as an input, and also writes to that same directory:

File firstPassFile = new File(outputFolder, "first-pass.mate-position-sorted.txt");
...
BufferedWriter fastq1 = new BufferedWriter(new FileWriter(new File(outputFolder, "collapsed_R1_.fastq")));

What I would like to do is specify this directory parameter as ā€™.ā€™ and then supply the input file as another cwl input to the current directory that the tool is running in.

What I would expect is that the tool would find this input file in said directory, and then write its output to that directory as well. I was expecting that by specifying . as the value of this parameter I would be able to read the other inputs files from the current directory and write outputs to the current directory as well. However, when I specify . for the value of directory the input file is not found.

Processing data/test_marianas_processumibam/tmpaWA9PT/./first-pass.mate-position-sorted.txt to produce fastqs

Exception in thread "main" java.io.FileNotFoundException: ./first-pass.mate-position-sorted.txt

I've also tried using $(runtime.outdir) and $(runtime.tmpdir) which also result in the file not being found:

Exception in thread "main" java.io.FileNotFoundException: data/test_marianas_processumibam/tmp/toil-fbd473f0-e71c-4ede-9615-ec3f3f932837/tmp9e7EdZ/6696a477-1c6e-4acd-9e4b-3a9c001ff65c/ttjv5ax/tmp/first-pass.mate-position-sorted.txt

It turns out, I can get it to find the input file by using default: $( inputs.input_file.dirname ) for the directory parameter, which I think means that the tool will read the file from it's original directory. However in this case I believe what is happening is the output files get written to this same directory, and thus aren't found in the outputs of the tool.

Did not find output file with glob pattern: '['data/test_marianas_processumibam/tmpaWA9PT/**/collapsed_R1_.fastq']'

I've then tried using absolute paths to the output file with $(runtime.outdir) or $(runtime.tmpdir) which result in:

../../../tools/marianas/DuplexUMIBamToCollapsedFastqSecondPass.cwl:107:3: Error collecting output for parameter 'collapsed_fastq_1':
:1:1:   glob patterns must not start with '/'

Is there any way to supply this directory parameter or does this tool not conform to the CWL spec?

cwl toil cwltoil • 1.8k views
ADD COMMENT
2
Entering edit mode
6.2 years ago
ionox0 ▴ 390

I just found the solution to this using initialWorkDirRequirement:

Output files in the input directory

Apologies for the premature question

ADD COMMENT

Login before adding your answer.

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