diff --git a/tools/cat.py b/tools/cat.py index 48d59d1..a621c56 100644 --- a/tools/cat.py +++ b/tools/cat.py @@ -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 @@ -19,7 +21,7 @@ def inputs(self): return [ToolInput("files", Array(File()))] def outputs(self): - return [] + return [ToolOutput("out", Stdout())] @staticmethod def docker(): diff --git a/tools/compile.py b/tools/compile.py index 32e4b2b..bd357b7 100644 --- a/tools/compile.py +++ b/tools/compile.py @@ -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" @@ -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"))] diff --git a/tools/echo.py b/tools/echo.py index 2c91ca4..cea543b 100644 --- a/tools/echo.py +++ b/tools/echo.py @@ -5,7 +5,7 @@ class Echo(UnixTool): @staticmethod def tool(): - return "Echo" + return "echo" def friendly_name(self): return "Echo - Print to console" @@ -19,7 +19,3 @@ def inputs(self): def outputs(self): return [ToolOutput("out", Stdout())] - - @staticmethod - def docker(): - return "ubuntu:latest" diff --git a/tools/merge.py b/tools/merge.py index b91bc32..10efa51 100644 --- a/tools/merge.py +++ b/tools/merge.py @@ -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())] diff --git a/tools/scatterlines.py b/tools/scatterlines.py deleted file mode 100644 index 3548fc2..0000000 --- a/tools/scatterlines.py +++ /dev/null @@ -1,32 +0,0 @@ -# from typing import List -# -# from janis import ToolInput, File, ToolOutput, Array, String -# from janis.tool.expressiontool import ExpressionTool -# from janis.unix.tools.unixtool import UnixTool -# -# -# class ScatterLines(ExpressionTool, UnixTool): -# -# @staticmethod -# def base_command(): -# return None -# -# def friendly_name(self) -> str: -# return "Scatter across lines" -# -# @staticmethod -# def tool(): -# return "parse-file" -# -# def expression(self): -# return """ -# ${return { lines: inputs.file.contents.split("\n") -# .filter(function(q) { return q.length > 0; }) }}""".strip() -# -# def inputs(self) -> List[ToolInput]: -# return [ -# ToolInput("file", File()) -# ] -# -# def outputs(self): -# return [ToolOutput("lines", Array(String()))] diff --git a/tools/tar.py b/tools/tar.py index 584df4c..b049be6 100644 --- a/tools/tar.py +++ b/tools/tar.py @@ -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 @@ -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 - - - Tar - Michael Franklin - 1 - 1024 - - - cwl - wdl - - - - - input2 - File - - - input2 - File - - - - - output - File - - - - -============================== - - 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] - } - } -""" diff --git a/tools/unixtool.py b/tools/unixtool.py index c96dd9a..8476d52 100644 --- a/tools/unixtool.py +++ b/tools/unixtool.py @@ -7,3 +7,7 @@ class UnixTool(CommandTool, ABC): @staticmethod def tool_module(): return "unix" + + @staticmethod + def docker(): + return "ubuntu:latest" diff --git a/tools/untar.py b/tools/untar.py index d55988f..918363e 100644 --- a/tools/untar.py +++ b/tools/untar.py @@ -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 - - - Untar - Michael Franklin - 1 - 1024 - - - cwl - wdl - - - - - input - File - - - - - output - File - - - - -+ 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"))]