Skip to content

Commit ebf39cc

Browse files
committed
input schema generation tests: use local files, not remote
1 parent 7af7522 commit ebf39cc

14 files changed

+404
-43
lines changed

testdata/bwa-mem-job.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"reference": {
3+
"class": "File",
4+
"location": "chr20.fa",
5+
"size": 123,
6+
"checksum": "sha1$hash"
7+
},
8+
"reads": [
9+
{
10+
"class": "File",
11+
"location": "example_human_Illumina.pe_1.fastq"
12+
},
13+
{
14+
"class": "File",
15+
"location": "example_human_Illumina.pe_2.fastq"
16+
}
17+
],
18+
"min_std_max_min": [
19+
1,
20+
2,
21+
3,
22+
4
23+
],
24+
"minimum_seed_length": 3
25+
}

testdata/bwa-mem-tool.cwl

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env cwl-runner
2+
3+
cwlVersion: v1.2
4+
5+
class: CommandLineTool
6+
7+
hints:
8+
- class: ResourceRequirement
9+
coresMin: 2
10+
- class: DockerRequirement
11+
dockerPull: docker.io/python:3-slim
12+
13+
inputs:
14+
- id: reference
15+
type: File
16+
inputBinding: { position: 2 }
17+
18+
- id: reads
19+
type:
20+
type: array
21+
items: File
22+
inputBinding: { position: 3 }
23+
24+
- id: minimum_seed_length
25+
type: int
26+
inputBinding: { position: 1, prefix: -m }
27+
28+
- id: min_std_max_min
29+
type: { type: array, items: int }
30+
inputBinding:
31+
position: 1
32+
prefix: -I
33+
itemSeparator: ","
34+
35+
- id: args.py
36+
type: File
37+
default:
38+
class: File
39+
location: args.py
40+
inputBinding:
41+
position: -1
42+
43+
outputs:
44+
- id: sam
45+
type: ["null", File]
46+
outputBinding: { glob: output.sam }
47+
- id: args
48+
type:
49+
type: array
50+
items: string
51+
52+
baseCommand: python
53+
54+
arguments:
55+
- bwa
56+
- mem
57+
- valueFrom: $(runtime.cores)
58+
position: 1
59+
prefix: -t
60+
61+
stdout: output.sam

testdata/dir-job.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
indir:
2+
class: Directory
3+
location: testdir

testdata/dir.cwl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class: CommandLineTool
2+
cwlVersion: v1.2
3+
requirements:
4+
- class: ShellCommandRequirement
5+
inputs:
6+
indir: Directory
7+
outputs:
8+
outlist:
9+
type: File
10+
outputBinding:
11+
glob: output.txt
12+
arguments: ["cd", "$(inputs.indir.path)",
13+
{shellQuote: false, valueFrom: "&&"},
14+
"find", ".",
15+
{shellQuote: false, valueFrom: "|"},
16+
"sort"]
17+
stdout: output.txt

testdata/env-job.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"in": "hello test env"
3+
}

testdata/env-tool1.cwl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class: CommandLineTool
2+
cwlVersion: v1.2
3+
inputs:
4+
in: string
5+
outputs:
6+
out:
7+
type: File
8+
outputBinding:
9+
glob: out
10+
11+
requirements:
12+
EnvVarRequirement:
13+
envDef:
14+
TEST_ENV: $(inputs.in)
15+
16+
baseCommand: ["/bin/sh", "-c", "echo $TEST_ENV"]
17+
18+
stdout: out

testdata/rename-inputs.cwl

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env cwl-runner
2+
id: InputSecondaryFileConformanceTest
3+
class: CommandLineTool
4+
cwlVersion: v1.2
5+
doc: |
6+
Simple test to confirm the implementation of expressions returning a File within a CommandInputParameter.secondaryFile field.
7+
8+
Use GREP to filter the result from ls to ensure we only get the secondary files in there.
9+
10+
Related links:
11+
- Issue: https://github.com/common-workflow-language/cwltool/issues/1232
12+
- PR: https://github.com/common-workflow-language/cwltool/pull/1233
13+
- Discourse: https://cwl.discourse.group/t/ask-cwl-to-rename-a-secondary-file/72
14+
15+
inputs:
16+
- id: inputWithSecondary
17+
type: File
18+
doc: |
19+
This input will with a secondary file `.accessory`. You could create these files (and its accessory) with:
20+
```bash
21+
touch secondary_file_test.txt
22+
touch secondary_file_test.txt.accessory
23+
```
24+
secondaryFiles:
25+
- |
26+
${
27+
function resolveSecondary(base, secPattern) {
28+
if (secPattern[0] == '^') {
29+
var spl = base.split('.');
30+
var endIndex = spl.length > 1 ? spl.length - 1 : 1;
31+
return resolveSecondary(spl.slice(undefined, endIndex).join("."), secPattern.slice(1));
32+
}
33+
return base + secPattern;
34+
}
35+
return [{
36+
"class": "File",
37+
"location": inputs.accessory.location,
38+
"basename": resolveSecondary(self.basename, '^.accessory')
39+
}];
40+
}
41+
- id: accessory
42+
type: File
43+
44+
45+
arguments:
46+
- "ls"
47+
- $(inputs.inputWithSecondary.dirname)
48+
- valueFrom: "|"
49+
shellQuote: false
50+
- "grep"
51+
- "secondary"
52+
53+
outputs:
54+
- id: output_file
55+
type: stdout
56+
stdout: result
57+
requirements:
58+
InlineJavascriptRequirement: {}
59+
ShellCommandRequirement: {}

testdata/rename-inputs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
inputWithSecondary:
2+
class: File
3+
location: secondary_file_test.txt
4+
accessory:
5+
class: File
6+
location: secondary_file_test.txt.accessory

testdata/revsort-job.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"input": {
3+
"class": "File",
4+
"location": "whale.txt"
5+
}
6+
}

testdata/revsort-packed.cwl

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"cwlVersion": "v1.2",
3+
"$graph": [
4+
{
5+
"class": "Workflow",
6+
"doc": "Reverse the lines in a document, then sort those lines.",
7+
"hints": [
8+
{
9+
"class": "DockerRequirement",
10+
"dockerPull": "docker.io/debian:stable-slim"
11+
}
12+
],
13+
"inputs": [
14+
{
15+
"type": "File",
16+
"doc": "The input file to be processed.",
17+
"id": "#main/input"
18+
},
19+
{
20+
"type": "boolean",
21+
"default": true,
22+
"doc": "If true, reverse (descending) sort",
23+
"id": "#main/reverse_sort"
24+
}
25+
],
26+
"outputs": [
27+
{
28+
"type": "File",
29+
"outputSource": "#main/sorted/output",
30+
"doc": "The output with the lines reversed and sorted.",
31+
"id": "#main/output"
32+
}
33+
],
34+
"steps": [
35+
{
36+
"in": [
37+
{
38+
"source": "#main/input",
39+
"id": "#main/rev/input"
40+
}
41+
],
42+
"out": [
43+
"#main/rev/output"
44+
],
45+
"run": "#revtool.cwl",
46+
"id": "#main/rev"
47+
},
48+
{
49+
"in": [
50+
{
51+
"source": "#main/rev/output",
52+
"id": "#main/sorted/input"
53+
},
54+
{
55+
"source": "#main/reverse_sort",
56+
"id": "#main/sorted/reverse"
57+
}
58+
],
59+
"out": [
60+
"#main/sorted/output"
61+
],
62+
"run": "#sorttool.cwl",
63+
"id": "#main/sorted"
64+
}
65+
],
66+
"id": "#main"
67+
},
68+
{
69+
"class": "CommandLineTool",
70+
"doc": "Reverse each line using the `rev` command",
71+
"inputs": [
72+
{
73+
"type": "File",
74+
"inputBinding": {},
75+
"id": "#revtool.cwl/input"
76+
}
77+
],
78+
"outputs": [
79+
{
80+
"type": "File",
81+
"outputBinding": {
82+
"glob": "output.txt"
83+
},
84+
"id": "#revtool.cwl/output"
85+
}
86+
],
87+
"baseCommand": "rev",
88+
"stdout": "output.txt",
89+
"id": "#revtool.cwl"
90+
},
91+
{
92+
"class": "CommandLineTool",
93+
"doc": "Sort lines using the `sort` command",
94+
"inputs": [
95+
{
96+
"id": "#sorttool.cwl/reverse",
97+
"type": "boolean",
98+
"inputBinding": {
99+
"position": 1,
100+
"prefix": "-r"
101+
}
102+
},
103+
{
104+
"id": "#sorttool.cwl/input",
105+
"type": "File",
106+
"inputBinding": {
107+
"position": 2
108+
}
109+
}
110+
],
111+
"outputs": [
112+
{
113+
"id": "#sorttool.cwl/output",
114+
"type": "File",
115+
"outputBinding": {
116+
"glob": "output.txt"
117+
}
118+
}
119+
],
120+
"baseCommand": "sort",
121+
"stdout": "output.txt",
122+
"id": "#sorttool.cwl"
123+
}
124+
]
125+
}

0 commit comments

Comments
 (0)