Skip to content

Commit 3cc79d2

Browse files
author
Peter Amstutz
committed
Port draft-3 changes to command line generation tests to draft-4.
1 parent f2a18c3 commit 3cc79d2

12 files changed

+129
-70
lines changed

draft-4/conformance_test_draft-4.yaml

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,52 @@
1-
- args: [bwa, mem, -t, '4', -I, '1,2,3,4', -m, '3', draft-4/rabix/tests/test-files/chr20.fa,
2-
draft-4/rabix/tests/test-files/example_human_Illumina.pe_1.fastq, draft-4/rabix/tests/test-files/example_human_Illumina.pe_2.fastq]
1+
- args:
32
job: draft-4/bwa-mem-job.json
4-
stdout: output.sam
53
tool: draft-4/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-4/rabix/tests/test-files/chr20.fa,
9-
"-XXX",
10-
"-YYY", draft-4/rabix/tests/test-files/example_human_Illumina.pe_1.fastq,
11-
"-YYY", draft-4/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-4/bwa-mem-job.json
1317
tool: draft-4/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-4/tmap-job.json
20-
stdin: draft-4/reads.fastq
21-
stdout: output.sam
2225
tool: draft-4/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-4/hello.txt]
28+
- output:
29+
args: [cat, hello.txt]
2630
job: draft-4/cat-job.json
27-
tool: draft-4/cat1-tool.cwl
31+
tool: draft-4/cat1-testcli.cwl
2832
doc: Test command line with optional input (missing)
2933

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

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

6851
- job: draft-4/cat-job.json
6952
output:

draft-4/draft-4/args.py

Lines changed: 7 additions & 0 deletions
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-4/draft-4/binding-test.cwl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,26 @@ class: CommandLineTool
44
cwlVersion: cwl:draft-4.dev2
55

66
inputs:
7-
reference:
7+
- id: reference
88
type: File
99
inputBinding: { position: 2 }
1010

11-
reads:
11+
- id: reads
1212
type:
1313
type: array
1414
items: File
1515
inputBinding: { prefix: "-YYY" }
1616
inputBinding: { position: 3, prefix: "-XXX" }
1717

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

20-
baseCommand: [bwa, mem]
28+
baseCommand: python
29+
arguments: ["bwa", "mem"]

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

Lines changed: 3 additions & 3 deletions
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-4/draft-4/bwa-mem-tool.cwl

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,57 @@
11
#!/usr/bin/env cwl-runner
22

3-
cwlVersion: cwl:draft-4.dev2
3+
cwlVersion: draft-4.dev2
44

55
class: CommandLineTool
66

77
hints:
8-
DockerRequirement:
9-
dockerPull: images.sbgenomics.com/rabix/bwa
10-
dockerImageId: 9d3b9b0359cf
11-
12-
ResourceRequirement:
8+
- class: ResourceRequirement
139
coresMin: 4
1410

1511
inputs:
16-
reference:
12+
- id: reference
1713
type: File
1814
inputBinding: { position: 2 }
1915

20-
reads:
16+
- id: reads
2117
type:
2218
type: array
2319
items: File
2420
inputBinding: { position: 3 }
2521

26-
minimum_seed_length:
22+
- id: minimum_seed_length
2723
type: int
2824
inputBinding: { position: 1, prefix: -m }
2925

30-
min_std_max_min:
26+
- id: min_std_max_min
3127
type: { type: array, items: int }
3228
inputBinding:
3329
position: 1
3430
prefix: -I
3531
itemSeparator: ","
3632

37-
outputs:
38-
sam:
33+
- id: args.py
3934
type: File
35+
default:
36+
class: File
37+
path: args.py
38+
inputBinding:
39+
position: -1
40+
41+
outputs:
42+
- id: sam
43+
type: ["null", File]
4044
outputBinding: { glob: output.sam }
45+
- id: args
46+
type:
47+
type: array
48+
items: string
4149

42-
baseCommand: [bwa, mem]
50+
baseCommand: python
4351

4452
arguments:
53+
- bwa
54+
- mem
4555
- valueFrom: $(runtime.cores)
4656
position: 1
4757
prefix: -t

draft-4/draft-4/cat1-testcli.cwl

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

draft-4/draft-4/chr20.fa

Whitespace-only changes.

draft-4/draft-4/example_human_Illumina.pe_1.fastq

Whitespace-only changes.

draft-4/draft-4/example_human_Illumina.pe_2.fastq

Whitespace-only changes.

draft-4/draft-4/reads.fastq

Whitespace-only changes.

draft-4/draft-4/template-tool.cwl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ requirements:
1111
- class: CreateFileRequirement
1212
fileDef:
1313
- filename: foo.txt
14-
fileContent: $(t("The file is <%= inputs.file1.path %>\n"))
14+
fileContent: >
15+
$(t("The file is <%= inputs.file1.path.split('/').slice(-1)[0] %>\n"))
1516
inputs:
1617
- id: file1
1718
type: File
18-
outputs: []
19+
outputs:
20+
- id: foo
21+
type: File
22+
outputBinding:
23+
glob: foo.txt
1924
baseCommand: [cat, foo.txt]

draft-4/draft-4/tmap-tool.cwl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,26 @@
1818
"type": "array",
1919
"items": "#Stage"
2020
}
21+
},
22+
{
23+
id: "#args.py",
24+
type: File,
25+
default: {
26+
class: File,
27+
path: args.py
28+
},
29+
inputBinding: {
30+
position: -1
2131
}
32+
}
2233
],
2334
"outputs": [
2435
{
2536
"id": "sam",
2637
"outputBinding": {
2738
"glob": "output.sam"
2839
},
29-
"type": "File"
40+
"type": ["null", "File"]
3041
}
3142
],
3243
"requirements": [
@@ -235,7 +246,6 @@
235246
]
236247
}
237248
]}],
238-
"baseCommand": ["tmap", "mapall"],
239-
"stdin": "$(inputs.reads.path)",
240-
"stdout": "output.sam"
249+
"baseCommand": "python",
250+
"arguments": ["tmap", "mapall"]
241251
}

0 commit comments

Comments
 (0)