Skip to content

Commit

Permalink
Port draft-3 changes to command line generation tests to draft-4.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Amstutz committed Jun 10, 2016
1 parent f2a18c3 commit 3cc79d2
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 70 deletions.
73 changes: 28 additions & 45 deletions draft-4/conformance_test_draft-4.yaml
Original file line number Diff line number Diff line change
@@ -1,69 +1,52 @@
- args: [bwa, mem, -t, '4', -I, '1,2,3,4', -m, '3', draft-4/rabix/tests/test-files/chr20.fa,
draft-4/rabix/tests/test-files/example_human_Illumina.pe_1.fastq, draft-4/rabix/tests/test-files/example_human_Illumina.pe_2.fastq]
- args:
job: draft-4/bwa-mem-job.json
stdout: output.sam
tool: draft-4/bwa-mem-tool.cwl
output:
args: [bwa, mem, -t, '4', -I, '1,2,3,4', -m, '3',
chr20.fa,
example_human_Illumina.pe_1.fastq,
example_human_Illumina.pe_2.fastq]
doc: General test of command line generation

- args: [bwa, mem, draft-4/rabix/tests/test-files/chr20.fa,
"-XXX",
"-YYY", draft-4/rabix/tests/test-files/example_human_Illumina.pe_1.fastq,
"-YYY", draft-4/rabix/tests/test-files/example_human_Illumina.pe_2.fastq]
- output:
args: [bwa, mem, chr20.fa,
"-XXX",
"-YYY", example_human_Illumina.pe_1.fastq,
"-YYY", example_human_Illumina.pe_2.fastq]
job: draft-4/bwa-mem-job.json
tool: draft-4/binding-test.cwl
doc: Test nested prefixes with arrays

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

- args: [cat, draft-4/hello.txt]
- output:
args: [cat, hello.txt]
job: draft-4/cat-job.json
tool: draft-4/cat1-tool.cwl
tool: draft-4/cat1-testcli.cwl
doc: Test command line with optional input (missing)

- args: [cat, -n, draft-4/hello.txt]
- output:
args: [cat, -n, hello.txt]
job: draft-4/cat-n-job.json
tool: draft-4/cat1-tool.cwl
tool: draft-4/cat1-testcli.cwl
doc: Test command line with optional input (provided)

- args: [cat]
job: draft-4/cat-job.json
stdin: draft-4/hello.txt
tool: draft-4/cat2-tool.cwl
doc: Test command line with stdin redirection

- args: [cat, draft-4/hello.txt]
job: draft-4/cat-job.json
stdout: output.txt
tool: draft-4/cat3-tool.cwl
doc: Test command line with stdout redirection

- args: [egrep]
stderr: error.txt
job:
tool: draft-4/egrep-stderr.cwl
doc: Test command line with stdout redirection

- args: [cat]
job: draft-4/cat-job.json
stdin: draft-4/hello.txt
stdout: output.txt
tool: draft-4/cat4-tool.cwl
doc: Test command line with stdin and stdout redirection

- args: [cat, foo.txt]
createfiles: {foo.txt: 'The file is draft-4/hello.txt

'}
- output:
"foo": {
"checksum": "sha1$63da67422622fbf9251a046d7a34b7ea0fd4fead",
"class": "File",
"path": "foo.txt",
"size": 22
}
job: draft-4/cat-job.json
tool: draft-4/template-tool.cwl
doc: Test CreateFileRequirement ExpressionEngineRequirement.engineConfig features
doc: Test CreateFileRequirement ExpressionEngineRequirement.engineConfig feature

- job: draft-4/cat-job.json
output:
Expand Down
7 changes: 7 additions & 0 deletions draft-4/draft-4/args.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python
import sys
import json
import os
args = [os.path.basename(a) for a in sys.argv[1:]]
with open("cwl.output.json", "w") as f:
json.dump({"args": args}, f)
15 changes: 12 additions & 3 deletions draft-4/draft-4/binding-test.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@ class: CommandLineTool
cwlVersion: cwl:draft-4.dev2

inputs:
reference:
- id: reference
type: File
inputBinding: { position: 2 }

reads:
- id: reads
type:
type: array
items: File
inputBinding: { prefix: "-YYY" }
inputBinding: { position: 3, prefix: "-XXX" }

- id: "#args.py"
type: File
default:
class: File
path: args.py
inputBinding:
position: -1

outputs: []

baseCommand: [bwa, mem]
baseCommand: python
arguments: ["bwa", "mem"]
6 changes: 3 additions & 3 deletions draft-4/draft-4/bwa-mem-job.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"reference": {
"class": "File",
"path": "rabix/tests/test-files/chr20.fa",
"path": "chr20.fa",
"size": 123,
"checksum": "sha1$hash"
},
"reads": [
{
"class": "File",
"path": "rabix/tests/test-files/example_human_Illumina.pe_1.fastq"
"path": "example_human_Illumina.pe_1.fastq"
},
{
"class": "File",
"path": "rabix/tests/test-files/example_human_Illumina.pe_2.fastq"
"path": "example_human_Illumina.pe_2.fastq"
}
],
"min_std_max_min": [
Expand Down
36 changes: 23 additions & 13 deletions draft-4/draft-4/bwa-mem-tool.cwl
Original file line number Diff line number Diff line change
@@ -1,47 +1,57 @@
#!/usr/bin/env cwl-runner

cwlVersion: cwl:draft-4.dev2
cwlVersion: draft-4.dev2

class: CommandLineTool

hints:
DockerRequirement:
dockerPull: images.sbgenomics.com/rabix/bwa
dockerImageId: 9d3b9b0359cf

ResourceRequirement:
- class: ResourceRequirement
coresMin: 4

inputs:
reference:
- id: reference
type: File
inputBinding: { position: 2 }

reads:
- id: reads
type:
type: array
items: File
inputBinding: { position: 3 }

minimum_seed_length:
- id: minimum_seed_length
type: int
inputBinding: { position: 1, prefix: -m }

min_std_max_min:
- id: min_std_max_min
type: { type: array, items: int }
inputBinding:
position: 1
prefix: -I
itemSeparator: ","

outputs:
sam:
- id: args.py
type: File
default:
class: File
path: args.py
inputBinding:
position: -1

outputs:
- id: sam
type: ["null", File]
outputBinding: { glob: output.sam }
- id: args
type:
type: array
items: string

baseCommand: [bwa, mem]
baseCommand: python

arguments:
- bwa
- mem
- valueFrom: $(runtime.cores)
position: 1
prefix: -t
Expand Down
35 changes: 35 additions & 0 deletions draft-4/draft-4/cat1-testcli.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env cwl-runner
{
"class": "CommandLineTool",
"cwlVersion": "cwl:draft-4.dev2",
"description": "Print the contents of a file to stdout using 'cat' running in a docker container.",
"inputs": [
{
"id": "file1",
"type": "File",
"inputBinding": {"position": 1}
},
{
"id": "numbering",
"type": ["null", "boolean"],
"inputBinding": {
"position": 0,
"prefix": "-n"
}
},
{
id: "args.py",
type: File,
default: {
class: File,
path: args.py
},
inputBinding: {
position: -1
}
}
],
"outputs": [],
"baseCommand": "python",
"arguments": ["cat"]
}
Empty file added draft-4/draft-4/chr20.fa
Empty file.
Empty file.
Empty file.
Empty file added draft-4/draft-4/reads.fastq
Empty file.
9 changes: 7 additions & 2 deletions draft-4/draft-4/template-tool.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ requirements:
- class: CreateFileRequirement
fileDef:
- filename: foo.txt
fileContent: $(t("The file is <%= inputs.file1.path %>\n"))
fileContent: >
$(t("The file is <%= inputs.file1.path.split('/').slice(-1)[0] %>\n"))
inputs:
- id: file1
type: File
outputs: []
outputs:
- id: foo
type: File
outputBinding:
glob: foo.txt
baseCommand: [cat, foo.txt]
18 changes: 14 additions & 4 deletions draft-4/draft-4/tmap-tool.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,26 @@
"type": "array",
"items": "#Stage"
}
},
{
id: "#args.py",
type: File,
default: {
class: File,
path: args.py
},
inputBinding: {
position: -1
}
}
],
"outputs": [
{
"id": "sam",
"outputBinding": {
"glob": "output.sam"
},
"type": "File"
"type": ["null", "File"]
}
],
"requirements": [
Expand Down Expand Up @@ -235,7 +246,6 @@
]
}
]}],
"baseCommand": ["tmap", "mapall"],
"stdin": "$(inputs.reads.path)",
"stdout": "output.sam"
"baseCommand": "python",
"arguments": ["tmap", "mapall"]
}

0 comments on commit 3cc79d2

Please sign in to comment.