Skip to content

Commit ddf417b

Browse files
author
Peter Amstutz
committed
Command line generation tests now work by executing a small script that copies
the command line to the output. Allows cwl-runner implementations to drop the --conformance-test code path.
1 parent c4cecad commit ddf417b

13 files changed

+119
-82
lines changed

draft-2/conformance_test_draft-2.yaml

+28-39
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,52 @@
1-
- args: [bwa, mem, -t, '4', -I, '1,2,3,4', -m, '3', draft-2/rabix/tests/test-files/chr20.fa,
2-
draft-2/rabix/tests/test-files/example_human_Illumina.pe_1.fastq, draft-2/rabix/tests/test-files/example_human_Illumina.pe_2.fastq]
1+
- args:
32
job: draft-2/bwa-mem-job.json
4-
stdout: output.sam
53
tool: draft-2/bwa-mem-tool.cwl
4+
output:
5+
args: [bwa, mem, -t, '4', -I, '1,2,3,4', -m, '3',
6+
chr20.fa,
7+
example_human_Illumina.pe_1.fastq,
8+
example_human_Illumina.pe_2.fastq]
69
doc: General test of command line generation
710

8-
- args: [bwa, mem, draft-2/rabix/tests/test-files/chr20.fa,
9-
"-XXX",
10-
"-YYY", draft-2/rabix/tests/test-files/example_human_Illumina.pe_1.fastq,
11-
"-YYY", draft-2/rabix/tests/test-files/example_human_Illumina.pe_2.fastq]
11+
- output:
12+
args: [bwa, mem, chr20.fa,
13+
"-XXX",
14+
"-YYY", example_human_Illumina.pe_1.fastq,
15+
"-YYY", example_human_Illumina.pe_2.fastq]
1216
job: draft-2/bwa-mem-job.json
1317
tool: draft-2/binding-test.cwl
1418
doc: Test nested prefixes with arrays
1519

16-
- args: [tmap, mapall, stage1, map1, --min-seq-length, '20', map2, --min-seq-length,
20+
- output:
21+
args: [tmap, mapall, stage1, map1, --min-seq-length, '20', map2, --min-seq-length,
1722
'20', stage2, map1, --max-seq-length, '20', --min-seq-length, '10', --seed-length,
1823
'16', map2, --max-seed-hits, '-1', --max-seq-length, '20', --min-seq-length, '10']
1924
job: draft-2/tmap-job.json
20-
stdin: draft-2/reads.fastq
21-
stdout: output.sam
2225
tool: draft-2/tmap-tool.cwl
23-
doc: Test nested command line bindings and stdin/stdout redirection
26+
doc: Test nested command line bindings
2427

25-
- args: [cat, draft-2/hello.txt]
28+
- output:
29+
args: [cat, hello.txt]
2630
job: draft-2/cat-job.json
27-
tool: draft-2/cat1-tool.cwl
31+
tool: draft-2/cat1-testcli.cwl
2832
doc: Test command line with optional input (missing)
2933

30-
- args: [cat, -n, draft-2/hello.txt]
34+
- output:
35+
args: [cat, -n, hello.txt]
3136
job: draft-2/cat-n-job.json
32-
tool: draft-2/cat1-tool.cwl
37+
tool: draft-2/cat1-testcli.cwl
3338
doc: Test command line with optional input (provided)
3439

35-
- args: [cat]
36-
job: draft-2/cat-job.json
37-
stdin: draft-2/hello.txt
38-
tool: draft-2/cat2-tool.cwl
39-
doc: Test command line with stdin redirection
40-
41-
- args: [cat, draft-2/hello.txt]
42-
job: draft-2/cat-job.json
43-
stdout: output.txt
44-
tool: draft-2/cat3-tool.cwl
45-
doc: Test command line with stdout redirection
46-
47-
- args: [cat]
48-
job: draft-2/cat-job.json
49-
stdin: draft-2/hello.txt
50-
stdout: output.txt
51-
tool: draft-2/cat4-tool.cwl
52-
doc: Test command line with stdin and stdout redirection
53-
54-
- args: [cat, foo.txt]
55-
createfiles: {foo.txt: 'The file is draft-2/hello.txt
56-
57-
'}
40+
- output:
41+
"foo": {
42+
"checksum": "sha1$63da67422622fbf9251a046d7a34b7ea0fd4fead",
43+
"class": "File",
44+
"path": "foo.txt",
45+
"size": 22
46+
}
5847
job: draft-2/cat-job.json
5948
tool: draft-2/template-tool.cwl
60-
doc: Test CreateFileRequirement ExpressionEngineRequirement.engineConfig features
49+
doc: Test CreateFileRequirement ExpressionEngineRequirement.engineConfig feature
6150

6251
- job: draft-2/cat-job.json
6352
output:

draft-2/draft-2/args.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env python
2+
import sys
3+
import json
4+
import os
5+
args = [os.path.basename(a) for a in sys.argv[1:]]
6+
with open("cwl.output.json", "w") as f:
7+
json.dump({"args": args}, f)

draft-2/draft-2/binding-test.cwl

+10-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ inputs:
1414
inputBinding: { prefix: "-YYY" }
1515
inputBinding: { position: 3, prefix: "-XXX" }
1616

17+
- id: "#args.py"
18+
type: File
19+
default:
20+
class: File
21+
path: args.py
22+
inputBinding:
23+
position: -1
24+
1725
outputs: []
1826

19-
baseCommand: ["bwa", "mem"]
27+
baseCommand: python
28+
arguments: ["bwa", "mem"]

draft-2/draft-2/bwa-mem-job.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"reference": {
33
"class": "File",
4-
"path": "rabix/tests/test-files/chr20.fa",
4+
"path": "chr20.fa",
55
"size": 123,
66
"checksum": "sha1$hash"
77
},
88
"reads": [
99
{
1010
"class": "File",
11-
"path": "rabix/tests/test-files/example_human_Illumina.pe_1.fastq"
11+
"path": "example_human_Illumina.pe_1.fastq"
1212
},
1313
{
1414
"class": "File",
15-
"path": "rabix/tests/test-files/example_human_Illumina.pe_2.fastq"
15+
"path": "example_human_Illumina.pe_2.fastq"
1616
}
1717
],
1818
"min_std_max_min": [

draft-2/draft-2/bwa-mem-tool.cwl

+16-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ class: CommandLineTool
44
requirements:
55
- import: node-engine.cwl
66

7-
hints:
8-
- class: DockerRequirement
9-
dockerPull: images.sbgenomics.com/rabix/bwa
10-
dockerImageId: 9d3b9b0359cf
11-
127
inputs:
138
- id: "#reference"
149
type: File
@@ -31,14 +26,28 @@ inputs:
3126
prefix: "-I"
3227
itemSeparator: ","
3328

29+
- id: "#args.py"
30+
type: File
31+
default:
32+
class: File
33+
path: args.py
34+
inputBinding:
35+
position: -1
36+
3437
outputs:
3538
- id: "#sam"
36-
type: "File"
39+
type: ["null", "File"]
3740
outputBinding: { "glob": "output.sam" }
41+
- id: "#args"
42+
type:
43+
type: array
44+
items: string
3845

39-
baseCommand: ["bwa", "mem"]
46+
baseCommand: python
4047

4148
arguments:
49+
- "bwa"
50+
- "mem"
4251
- valueFrom:
4352
engine: "node-engine.cwl"
4453
script: "$job.allocatedResources.cpu"

draft-2/draft-2/cat1-testcli.cwl

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env cwl-runner
2+
{
3+
"class": "CommandLineTool",
4+
"description": "Print the contents of a file to stdout using 'cat' running in a docker container.",
5+
"inputs": [
6+
{
7+
"id": "#file1",
8+
"type": "File",
9+
"inputBinding": {"position": 1}
10+
},
11+
{
12+
"id": "#numbering",
13+
"type": ["null", "boolean"],
14+
"inputBinding": {
15+
"position": 0,
16+
"prefix": "-n"
17+
}
18+
},
19+
{
20+
id: "#args.py",
21+
type: File,
22+
default: {
23+
class: File,
24+
path: args.py
25+
},
26+
inputBinding: {
27+
position: -1
28+
}
29+
}
30+
],
31+
"outputs": [],
32+
"baseCommand": "python",
33+
"arguments": ["cat"]
34+
}

draft-2/draft-2/cat2-tool.cwl

-23
This file was deleted.

draft-2/draft-2/chr20.fa

Whitespace-only changes.

draft-2/draft-2/example_human_Illumina.pe_1.fastq

Whitespace-only changes.

draft-2/draft-2/example_human_Illumina.pe_2.fastq

Whitespace-only changes.

draft-2/draft-2/reads.fastq

Whitespace-only changes.

draft-2/draft-2/template-tool.cwl

+7-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ requirements:
1717
- filename: foo.txt
1818
fileContent:
1919
engine: "#js"
20-
script: 't("The file is <%= $job.file1.path %>\n")'
20+
script: >
21+
t("The file is <%= $job.file1.path.split('/').slice(-1)[0] %>\n")
2122
inputs:
2223
- id: "#file1"
2324
type: File
24-
outputs: []
25+
outputs:
26+
- id: "#foo"
27+
type: File
28+
outputBinding:
29+
glob: foo.txt
2530
baseCommand: ["cat", "foo.txt"]

draft-2/draft-2/tmap-tool.cwl

+14-7
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,26 @@
1616
"type": "array",
1717
"items": "Stage"
1818
}
19+
},
20+
{
21+
id: "#args.py",
22+
type: File,
23+
default: {
24+
class: File,
25+
path: args.py
26+
},
27+
inputBinding: {
28+
position: -1
1929
}
30+
}
2031
],
2132
"outputs": [
2233
{
2334
"id": "#sam",
2435
"outputBinding": {
2536
"glob": "output.sam"
2637
},
27-
"type": "File"
38+
"type": ["null", "File"]
2839
}
2940
],
3041
"requirements": [
@@ -233,10 +244,6 @@
233244
]
234245
}
235246
]}],
236-
"baseCommand": ["tmap", "mapall"],
237-
"stdin": {
238-
"engine": "cwl:JsonPointer",
239-
"script": "job/reads/path"
240-
},
241-
"stdout": "output.sam"
247+
"baseCommand": "python",
248+
"arguments": ["tmap", "mapall"]
242249
}

0 commit comments

Comments
 (0)