This Python tool converts WDL (Workflow Description Language) files into CWL (Common Workflow Language) format. It supports task-only WDLs, full workflow definitions, and import statements from external files.
Tested using:
- Broad Institute's Illumina Genotyping Array WDLs
- Seven Bridges' CAVATICA platform CWL workflows
- ✅ Converts individual WDL
taskblocks into CWLCommandLineTooldefinitions - ✅ Converts full
workflowblocks into CWLWorkflowdefinitions - ✅ Resolves local WDL
importstatements and rewrites them as.cwldependencies - ✅ Preserves runtime information such as
dockerPull - ✅ Handles Broad-style WDLs with optional/default inputs
Python 3.7 or later
Install dependencies with:
pip install -r requirements.txtThis converter focuses on translating WDL structure into CWL-compatible definitions, but it does not guarantee a fully executable pipeline out of the box.
If your WDL workflow imports tasks (e.g., Broad's IlluminaGenotypingArray workflow), you must:
✅ Convert each imported WDL file (e.g., IlluminaGenotypingArrayTasks.wdl, Qc.wdl) to CWL separately
✅ Ensure all converted .cwl tool files are present in the same directory as the main workflow CWL
🔧 You may need to manually adjust input wiring, runtime options, or expression logic for full compatibility
This tool is best used as a starting scaffold to help wrap existing WDL pipelines into CWL format. Final validation and polish is expected before production use.
- parse_wdl() uses miniwdl to load WDL files and resolve any imports
- convert_task_to_cwl() converts each task block into a valid CWL CommandLineTool
- convert_workflow_to_cwl() builds a CWL Workflow from the workflow block, generating steps and input mappings
- If a WDL has only tasks and no workflow, the script outputs one CWL file per task
python3 wdl_to_cwl.py <main_wdl_file> <output_cwl_file> [--import-dir <path_to_imports>]
Convert a full workflow with local imports: python3 wdl_to_cwl.py IlluminaGenotypingArray.wdl broad_IlluminaGenotypingArray.cwl --import-dir ./tasks/
python3 wdl_to_cwl.py Qc.wdl broad_QC.cwl
broad_QC_task0.cwl broad_QC_task1.cwl ...
| WDL Input Type | Output Type | Notes |
|---|---|---|
workflow |
Single CWL Workflow file | Tasks must be imported separately as .cwl |
task-only WDL |
Separate CWL per task | No workflow {} block required |
Feel free to fork, submit issues, or contribute to the project.
Author: Phillip Webster