Skip to content

Commit 86b1420

Browse files
authored
Merge pull request #41 from common-workflow-language/toil-3095
Test based on toil bug report, condition on default (null) inputs
2 parents 58291ca + 8400cc7 commit 86b1420

File tree

5 files changed

+117
-9
lines changed

5 files changed

+117
-9
lines changed

tests/conditionals/action.cwl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.2.0-dev4
4+
inputs:
5+
initial_file: File
6+
out_file_name: string
7+
outputs:
8+
processed_file: stdout
9+
stdout: $(inputs.out_file_name)
10+
arguments: [echo, $(inputs.initial_file.basename)]

tests/conditionals/cond-job.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
forward_reads:
2+
class: File
3+
location: ../example_human_Illumina.pe_1.fastq
4+
reverse_reads:
5+
class: File
6+
location: ../example_human_Illumina.pe_2.fastq

tests/conditionals/cond-job2.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
single_reads:
2+
class: File
3+
location: ../reads.fastq
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env cwl-runner
2+
class: Workflow
3+
cwlVersion: v1.2.0-dev4
4+
5+
requirements:
6+
MultipleInputFeatureRequirement: {}
7+
InlineJavascriptRequirement: {}
8+
StepInputExpressionRequirement: {}
9+
ScatterFeatureRequirement: {}
10+
11+
inputs:
12+
forward_reads: File?
13+
reverse_reads: File?
14+
single_reads: File?
15+
16+
outputs:
17+
out_file:
18+
type: File[]
19+
outputSource:
20+
- step_paired/processed_file
21+
- step_single/processed_file
22+
linkMerge: merge_flattened
23+
pickValue: all_non_null
24+
25+
steps:
26+
27+
step_paired:
28+
run: action.cwl
29+
when: $(inputs.single === null)
30+
scatter: [initial_file, suffix]
31+
scatterMethod: dotproduct
32+
in:
33+
single: single_reads
34+
suffix:
35+
default: ["1", "2"]
36+
initial_file:
37+
- forward_reads
38+
- reverse_reads
39+
out_file_name: { valueFrom: "filename_paired$(inputs.suffix)" }
40+
out: [ processed_file ]
41+
42+
step_single:
43+
run: action.cwl
44+
when: $(inputs.single !== null)
45+
in:
46+
single: single_reads
47+
initial_file: single_reads
48+
out_file_name: { default: 'filename_single' }
49+
out: [ processed_file ]

tests/conditionals/test-index.yaml

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@
8282
output:
8383
out1: "Direct"
8484
tags: [ conditional, inline_javascript, multiple_input ]
85-
85+
8686
- id: cond-8
8787
label: pass_through_required_fail
8888
doc: "pickValue: the_only_non_null will fail due to multiple non nulls"
8989
tool: cond-wf-004.cwl
9090
job: val.3.job.yaml
9191
should_fail: True
9292
tags: [ conditional, inline_javascript, multiple_input ]
93-
93+
9494
- id: cond-9
9595
label: all_non_null_multi_with_non_array_output
9696
doc: "pickValue: all_non_null will fail validation"
@@ -176,9 +176,9 @@
176176
tool: cond-wf-011.cwl
177177
job: cond18.job.yaml
178178
output:
179-
out1:
179+
out1:
180180
[
181-
[
181+
[
182182
[ null, "112", null, "114" ],
183183
[ null, "122", null, "124" ],
184184
[ null, "132", null, "134" ]
@@ -206,7 +206,7 @@
206206
job: cond20.job.yaml
207207
output:
208208
out1: [
209-
"foo 2", "foo 4", "foo 6",
209+
"foo 2", "foo 4", "foo 6",
210210
"bar 1", "bar 3", "bar 5"]
211211
tags: [ conditional, inline_javascript, scatter, multiple ]
212212

@@ -289,7 +289,7 @@
289289
output:
290290
out1: "Direct"
291291
tags: [ conditional, multiple_input ]
292-
292+
293293
- id: cond-8_nojs
294294
label: pass_through_required_fail
295295
doc: "pickValue: the_only_non_null will fail due to multiple non nulls; no javascript"
@@ -383,9 +383,9 @@
383383
tool: cond-wf-011_nojs.cwl
384384
job: ../empty.json
385385
output:
386-
out1:
386+
out1:
387387
[
388-
[
388+
[
389389
[ null, "1123", null, "1123" ],
390390
[ null, "1223", null, "1223" ],
391391
[ null, "1323", null, "1323" ]
@@ -413,6 +413,46 @@
413413
job: ../empty.json
414414
output:
415415
out1: [
416-
"foo 2", "foo 4", "foo 6",
416+
"foo 2", "foo 4", "foo 6",
417417
"bar 1", "bar 3", "bar 5"]
418418
tags: [ conditional, scatter, multiple ]
419+
420+
421+
- id: cond-with-defaults-1
422+
doc: "Default inputs, choose step to run based on what was provided, first case"
423+
tool: cond-with-defaults.cwl
424+
job: cond-job.yaml
425+
output:
426+
"out_file": [
427+
{
428+
"location": "filename_paired1",
429+
"basename": "filename_paired1",
430+
"class": "File",
431+
"checksum": "sha1$668326847b11f0fcaf4a0fba94d79ccf8b9f9213",
432+
"size": 34
433+
},
434+
{
435+
"location": "filename_paired2",
436+
"basename": "filename_paired2",
437+
"class": "File",
438+
"checksum": "sha1$da959696a42552d21c03f5f1df5d1949a856845e",
439+
"size": 34
440+
}
441+
]
442+
tags: [ conditional, scatter, multiple ]
443+
444+
- id: cond-with-defaults-2
445+
doc: "Default inputs, choose step to run based on what was provided, second case"
446+
tool: cond-with-defaults.cwl
447+
job: cond-job2.yaml
448+
output:
449+
"out_file": [
450+
{
451+
"location": "filename_single",
452+
"basename": "filename_single",
453+
"class": "File",
454+
"checksum": "sha1$648695b8ae770ae22b24ff7fe798801c9c370dc1",
455+
"size": 12
456+
}
457+
]
458+
tags: [ conditional, scatter, multiple ]

0 commit comments

Comments
 (0)