-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7256865
commit 948b7d4
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |