From 948b7d43be552ccdece7592caf3cdbc95afe0c34 Mon Sep 17 00:00:00 2001 From: Michael Franklin Date: Wed, 1 Sep 2021 22:45:59 +1000 Subject: [PATCH] Fix find-replace error --- janisdk/fromwdl/__init__.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 janisdk/fromwdl/__init__.py diff --git a/janisdk/fromwdl/__init__.py b/janisdk/fromwdl/__init__.py new file mode 100644 index 00000000..68a55a3d --- /dev/null +++ b/janisdk/fromwdl/__init__.py @@ -0,0 +1,37 @@ +def add_fromwdl_args(parser): + parser.description = ( + "Parse a WDL command line tool / workflow and write it as a Janis file" + ) + + parser.add_argument( + "-o", + "--output", + help="Directory to output the workflow / tools to, otherwise this is written to stdout", + ) + + parser.add_argument("wdlfile", help="The path to the WDL file") + + parser.add_argument( + "translation", default="janis", choices=["cwl", "wdl", "janis"], nargs="?" + ) + + return parser + + +def do_fromwdl(args): + from janis_core import WdlParser, Logger + + + Logger.info(f"Loading WDL file: {args.wdlfile}") + tool = WdlParser.from_doc(args.wdlfile) + + Logger.info(f"Loaded {tool.type()}: {tool.versioned_id()}") + + translated = tool.translate( + args.translation, + to_console=args.output is None, + to_disk=args.output is not None, + export_path=args.output, + ) + + return translated