Skip to content

Commit

Permalink
Update unix tool property names
Browse files Browse the repository at this point in the history
  • Loading branch information
illusional committed Jul 10, 2019
1 parent d0494e7 commit c578197
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 208 deletions.
4 changes: 3 additions & 1 deletion tools/cat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from janis import ToolOutput, Stdout

from janis.tool.commandtool import ToolInput
from janis.types.common_data_types import Array, File
from janis.unix.tools.unixtool import UnixTool
Expand All @@ -19,7 +21,7 @@ def inputs(self):
return [ToolInput("files", Array(File()))]

def outputs(self):
return []
return [ToolOutput("out", Stdout())]

@staticmethod
def docker():
Expand Down
8 changes: 4 additions & 4 deletions tools/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class Compile(UnixTool):
def tool():
return "javaCompiler"

def friendly_name(self):
return "Java compiler"

@staticmethod
def base_command():
return "javac"

def friendly_name(self):
return "Java compiler"

@staticmethod
def docker():
return "openjdk:8"
Expand All @@ -31,4 +31,4 @@ def inputs(self):
return [ToolInput("file", File(), position=1)]

def outputs(self):
return [ToolOutput("compiled", File(), glob=WildcardSelector("*.class"))]
return [ToolOutput("out", File(), glob=WildcardSelector("*.class"))]
6 changes: 1 addition & 5 deletions tools/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Echo(UnixTool):
@staticmethod
def tool():
return "Echo"
return "echo"

def friendly_name(self):
return "Echo - Print to console"
Expand All @@ -19,7 +19,3 @@ def inputs(self):

def outputs(self):
return [ToolOutput("out", Stdout())]

@staticmethod
def docker():
return "ubuntu:latest"
6 changes: 1 addition & 5 deletions tools/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ def inputs(self):
return [ToolInput("files", Array(File()))]

def outputs(self):
return [ToolOutput("merged", Stdout())]

@staticmethod
def docker():
return "ubuntu:latest"
return [ToolOutput("out", Stdout())]
32 changes: 0 additions & 32 deletions tools/scatterlines.py

This file was deleted.

90 changes: 3 additions & 87 deletions tools/tar.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Untar a file

from janis import Array, ToolInput, ToolOutput, InputSelector, File, Filename
from janis.unix.data_types.tarfile import TarFile
from janis.unix.tools.unixtool import UnixTool


Expand All @@ -21,96 +21,12 @@ def inputs(self):
return [
ToolInput("files", Array(File()), position=2),
ToolInput("files2", Array(File(), optional=True), position=3),
ToolInput("tarName", Filename(extension=".tar"), position=1),
ToolInput("outputFilename", Filename(extension=".tar"), position=1),
]

def outputs(self):
return [ToolOutput("tarred", File(), glob=InputSelector("tarName"))]

@staticmethod
def docker():
return "ubuntu:latest"
return [ToolOutput("out", TarFile(), glob=InputSelector("outputFilename"))]


if __name__ == "__main__":
print(Tar().help())

"""
EXAMPLE XML
<Step>
<title>Tar</title>
<author>Michael Franklin</author>
<cores>1</cores>
<ram>1024</ram>
<label>{{label}}</label>
<supportedTypes>
<type>cwl</type>
<type>wdl</type>
</supportedTypes>
<inputs>
<input>
<tag>input2</tag>
<type>File</type>
</input>
<input>
<tag>input2</tag>
<type>File</type>
</input>
</inputs>
<outputs>
<output>
<tag>output</tag>
<type>File</type>
</output>
</outputs>
</Step>
==============================
class: CommandLineTool
cwlVersion: v1.0
id: tar
baseCommand:
- tar
- cvf
inputs:
- id: tarName
type: string?
inputBinding:
position: 0
- id: input1
type:
- File
inputBinding:
position: 1
- id: input2
type:
- File
inputBinding:
position: 2
outputs:
- id: output
type: File?
outputBinding:
glob: '*'
label: tar
========================================
task SingleTar {
String tarName
File input1
File input2
command {
tar cvf ${tarName} ${input1} ${input2}
}
output {
File out = glob("*")[0]
}
}
"""
4 changes: 4 additions & 0 deletions tools/unixtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ class UnixTool(CommandTool, ABC):
@staticmethod
def tool_module():
return "unix"

@staticmethod
def docker():
return "ubuntu:latest"
79 changes: 5 additions & 74 deletions tools/untar.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,18 @@

class Untar(UnixTool):
@staticmethod
def base_command():
return ["tar", "xf"]
def tool():
return "untar"

def friendly_name(self):
return "Untar archive"

@staticmethod
def tool():
return "Untar"
def base_command():
return ["tar", "xf"]

def inputs(self):
return [ToolInput("tarFile", TarFile(), position=0)]

def outputs(self):
return [ToolOutput("files", Array(File()), glob=WildcardSelector("*.java"))]

@staticmethod
def docker():
return "ubuntu:latest"


"""
EXAMPLE XML
<Step>
<title>Untar</title>
<author>Michael Franklin</author>
<cores>1</cores>
<ram>1024</ram>
<label>{{label}}</label>
<supportedTypes>
<type>cwl</type>
<type>wdl</type>
</supportedTypes>
<inputs>
<input>
<tag>input</tag>
<type>File</type>
</input>
</inputs>
<outputs>
<output>
<tag>output</tag>
<type>File</type>
</output>
</outputs>
</Step>
+ provide CWL template
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
baseCommand: [tar, xf]
inputs:
input:
type: File
inputBinding:
position: 1
output:
type: string
inputBinding:
position: 2
outputs:
example_out:
type: File
outputBinding:
glob: $(inputs.outputfile)
+ wdl template
task {
File input
File output
command {
tar -xf ${input}
}
}
"""
return [ToolOutput("out", Array(File()), glob=WildcardSelector("*.java"))]

0 comments on commit c578197

Please sign in to comment.