Skip to content

Commit f1f1002

Browse files
kinowmr-c
authored andcommitted
Add test for SchemaDefRequirement with a workflow and the types containing an $import statement. Used example written by @jeremiahsavage (thanks!)
1 parent 8b7a2d8 commit f1f1002

6 files changed

+112
-1
lines changed

conformance_tests.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3561,4 +3561,15 @@
35613561
`echo a && echo b > out.txt`, but instead will produce the correct `echo a && echo b`,
35623562
and capture the output correctly.
35633563
tags: [ shell_command, command_line_tool ]
3564-
3564+
3565+
- tool: tests/schemadef_types_with_import-wf.cwl
3566+
job: tests/schemadef_types_with_import-job.json
3567+
output: {
3568+
"out": "1970-01-01T00:00:00Z\n"
3569+
}
3570+
label: schemadef_types_with_import
3571+
doc: >-
3572+
Test SchemaDefRequirement with a workflow, with the `$import` under types.
3573+
It is similar to schemadef-wf, but the `$import` is different.
3574+
tags: [ workflow, schema_def ]
3575+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"readgroups_bam":
3+
{
4+
"bam": {
5+
"class": "File",
6+
"format": "edam:format_2572",
7+
"location": "schemadef_types_with_import-test.bam"
8+
},
9+
"readgroup_meta_list":
10+
[
11+
{
12+
"CN": "UNKNOWN",
13+
"DT": "1970-01-01T00:00:00Z",
14+
"ID": "SRR622461",
15+
"LB": "Illumina NA12878",
16+
"PI": "250",
17+
"PL": "ILLUMINA",
18+
"SM": "NA12878"
19+
}
20+
]
21+
}
22+
}

tests/schemadef_types_with_import-test.bam

Whitespace-only changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env cwl-runner
2+
class: CommandLineTool
3+
cwlVersion: v1.2
4+
5+
requirements:
6+
- class: InlineJavascriptRequirement
7+
- class: SchemaDefRequirement
8+
types:
9+
- $import: schemadef_types_with_import_readgroup.yml
10+
11+
inputs:
12+
- id: message
13+
type: "schemadef_types_with_import_readgroup.yml#readgroups_bam_file"
14+
inputBinding:
15+
valueFrom: $(self.readgroup_meta_list[0]['DT'])
16+
17+
outputs:
18+
- id: out
19+
type: string
20+
outputBinding:
21+
glob: output.txt
22+
loadContents: true
23+
outputEval: $(self[0].contents)
24+
25+
stdout: output.txt
26+
baseCommand: echo
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env cwl-runner
2+
# See https://github.com/jeremiahsavage/cwl_schemadef/, thanks to Jeremiah H. Savage.
3+
cwlVersion: v1.2
4+
class: Workflow
5+
6+
requirements:
7+
- class: SchemaDefRequirement
8+
types:
9+
- $import: schemadef_types_with_import_readgroup.yml
10+
11+
inputs:
12+
readgroups_bam:
13+
type: "schemadef_types_with_import_readgroup.yml#readgroups_bam_file"
14+
15+
steps:
16+
step1:
17+
run: schemadef_types_with_import-tool.cwl
18+
in:
19+
message: readgroups_bam
20+
out: [out]
21+
22+
outputs:
23+
out:
24+
type: string
25+
outputSource: step1/out
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
- name: readgroup_meta
2+
type: record
3+
fields:
4+
- name: CN
5+
type: string
6+
- name: DT
7+
type: string
8+
- name: ID
9+
type: string
10+
- name: LB
11+
type: string
12+
- name: PI
13+
type: string
14+
- name: PL
15+
type: string
16+
- name: SM
17+
type: string
18+
19+
- name: readgroups_bam_file
20+
type: record
21+
fields:
22+
- name: bam
23+
type: File
24+
- name: readgroup_meta_list
25+
type:
26+
type: array
27+
items: readgroup_meta

0 commit comments

Comments
 (0)