Skip to content

Commit

Permalink
Add CWLs for the tools used in disease-genome
Browse files Browse the repository at this point in the history
Rename tool/curl to tool/wget

Imelement tool/wget

Add test for wget

Rename output object of wget from `output` to `downloaded`

Implement tool/tar

Minor fix for tar

Remove {tar,wget}.sh

Implement tool/cat

Implement tool/gunzip

Fix `doc` for gunzip

Implement tool/gzip

Implement tool/wc

Minor tweaks
  • Loading branch information
tom-tan authored and suecharo committed Jan 31, 2020
1 parent 5400760 commit fae8e0d
Show file tree
Hide file tree
Showing 20 changed files with 212 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/data/sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aaaa
Binary file added test/data/test.tar.gz
Binary file not shown.
3 changes: 3 additions & 0 deletions test/tool/test_job/cat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
files:
- class: File
location: ../../data/chr22.fa
3 changes: 3 additions & 0 deletions test/tool/test_job/gunzip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file:
class: File
location: ../../data/test.tar.gz
3 changes: 3 additions & 0 deletions test/tool/test_job/gzip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file:
class: File
location: ../../data/chr22.fa
6 changes: 6 additions & 0 deletions test/tool/test_job/tar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file:
class: File
location: ../../data/test.tar.gz
extract: true
gzip: true
verbose: true
3 changes: 3 additions & 0 deletions test/tool/test_job/wc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file:
class: File
location: ../../data/sample.txt
3 changes: 3 additions & 0 deletions test/tool/test_job/wget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use_remote_name: true # type "boolean"
url: https://raw.githubusercontent.com/pitagora-network/DAT2-cwl/master/README.md # type "string"
track_location: false # type "boolean"
17 changes: 17 additions & 0 deletions tool/cat/cat.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
doc: concatenate files and print on the standard output
requirements:
DockerRequirement:
dockerPull: alpine:3.9
baseCommand: cat
inputs:
files:
type: File[]
inputBinding: {}
outputs:
concatinated: stdout
stderr: stderr
stdout: cat-stdout.log
stderr: cat-stderr.log
3 changes: 3 additions & 0 deletions tool/cat/cat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
files: # array of type "File"
- class: File
path: a/file/path
17 changes: 17 additions & 0 deletions tool/gunzip/gunzip.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
doc: decompression tool using Lempel-Ziv coding (LZ77)
requirements:
DockerRequirement:
dockerPull: alpine:3.9
baseCommand: [gunzip, --stdout]
inputs:
file:
type: File
inputBinding: {}
outputs:
decompressed: stdout
stderr: stderr
stdout: $(inputs.file.nameroot)
stderr: gunzip-stderr.log
3 changes: 3 additions & 0 deletions tool/gunzip/gunzip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file: # type "File"
class: File
path: a/file/path
17 changes: 17 additions & 0 deletions tool/gzip/gzip.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
doc: compression/decompression tool using Lempel-Ziv coding (LZ77)
requirements:
DockerRequirement:
dockerPull: alpine:3.9
baseCommand: [gzip, -c]
inputs:
file:
type: File
inputBinding: {}
outputs:
compressed: stdout
stderr: stderr
stdout: $(inputs.file.basename).gz
stderr: gzip-stderr.log
3 changes: 3 additions & 0 deletions tool/gzip/gzip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file: # type "File"
class: File
path: a/file/path
43 changes: 43 additions & 0 deletions tool/tar/tar.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
doc: manipulate tape archives
requirements:
DockerRequirement:
dockerPull: alpine:3.9
InlineJavascriptRequirement: {}
baseCommand: tar
inputs:
file:
type: File
inputBinding:
prefix: --file=
separate: false
extract:
type: boolean
default: false
inputBinding:
prefix: -x
gzip:
type: boolean
default: false
inputBinding:
prefix: -z
verbose:
type: boolean
default: false
inputBinding:
prefix: -v
outputs:
output:
type: Directory
outputBinding:
glob: |
${
var extlen = inputs.gzip ? 2 : 1;
return inputs.file.basename.split('.').slice(0, -extlen).join('.');
}
stdout: stdout
stderr: stderr
stdout: tar-stdout.log
stderr: tar-stderr.log
6 changes: 6 additions & 0 deletions tool/tar/tar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
verbose: false # type "boolean"
gzip: false # type "boolean"
file: # type "File"
class: File
path: a/file/path
extract: false # type "boolean"
35 changes: 35 additions & 0 deletions tool/wc/wc.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
doc: print newline, word, and byte counts for each file
requirements:
DockerRequirement:
dockerPull: alpine:3.9
InlineJavascriptRequirement: {}
baseCommand: wc
inputs:
file:
type: File
inputBinding: {}
outputs:
lines:
type: int
outputBinding:
loadContents: true
glob: wc-stdout.txt
outputEval: $(Number(self[0].contents.trim().split(/\s+/)[0]))
words:
type: int
outputBinding:
loadContents: true
glob: wc-stdout.txt
outputEval: $(Number(self[0].contents.trim().split(/\s+/)[1]))
bytes:
type: int
outputBinding:
loadContents: true
glob: wc-stdout.txt
outputEval: $(Number(self[0].contents.trim().split(/\s+/)[2]))
stderr: stderr
stdout: wc-stdout.txt
stderr: wc-stderr.log
3 changes: 3 additions & 0 deletions tool/wc/wc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file: # type "File"
class: File
path: a/file/path
39 changes: 39 additions & 0 deletions tool/wget/wget.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
doc: The non-interactive network downloader
requirements:
DockerRequirement:
dockerPull: alpine:3.9
InlineJavascriptRequirement: {}
baseCommand: wget
inputs:
url:
doc: Download target URL
type: string
inputBinding: {}
output_name:
doc: Output file name (use `wget-stdout.txt` by default)
type: string
default: wget-stdout.txt
inputBinding:
prefix: --output-document=
separate: false
valueFrom: "$(inputs.use_remote_name ? inputs.url.split('/').pop() : self)"
use_remote_name:
doc: Use the basename of `url` parameter as an output file name. It is equivalent to `curl -O`.
type: boolean
default: false
track_location:
doc: Equivalent to `curl -L`
type: boolean
default: false
inputBinding:
prefix: --trusted-server-names
outputs:
downloaded:
type: File
outputBinding:
glob: "$(inputs.use_remote_name ? inputs.url.split('/').pop() : inputs.output_name)"
stderr: stderr
stderr: wget-stderr.log
4 changes: 4 additions & 0 deletions tool/wget/wget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use_remote_name: false # type "boolean"
url: a_string # type "string"
track_location: false # type "boolean"
output_name: wget-stdout.txt # default value of type "string".

0 comments on commit fae8e0d

Please sign in to comment.