diff options
author | Arun Isaac | 2021-02-21 19:44:54 +0530 |
---|---|---|
committer | Arun Isaac | 2021-02-21 19:45:30 +0530 |
commit | 2ed13ca5e4c779b59d04e574a496b6cb69bcba44 (patch) | |
tree | 6104bf692835df3a082be204bd5cd16ff18691a6 | |
parent | 364cd0a987c2a6644ceb2803f92c01d16356d7a1 (diff) | |
download | bh20-seq-resource-2ed13ca5e4c779b59d04e574a496b6cb69bcba44.tar.gz bh20-seq-resource-2ed13ca5e4c779b59d04e574a496b6cb69bcba44.tar.lz bh20-seq-resource-2ed13ca5e4c779b59d04e574a496b6cb69bcba44.zip |
Add CWL generator for Workflow workflows
-rw-r--r-- | scripts/generate-cwl.scm | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/generate-cwl.scm b/scripts/generate-cwl.scm index a28cdb0..1a26dfb 100644 --- a/scripts/generate-cwl.scm +++ b/scripts/generate-cwl.scm @@ -128,3 +128,56 @@ lists---the base command and the actual arguments." ,@(if stderr `((stderr . ,stderr)) '())))) + +(define-record-type (<workflow-output> make-workflow-output workflow-output?) + (fields (immutable id workflow-output-id) + (immutable type workflow-output-type) + (immutable source workflow-output-source) + (immutable other workflow-output-other))) + +(define* (workflow-output id #:key type source (other '())) + "Build and return a <workflow-output> object." + (make-workflow-output id type source other)) + +(define-record-type (<step> step step?) + (fields (immutable id step-id) + (immutable run step-run) + (immutable in step-in) + (immutable out step-out))) + +(define* (workflow steps outputs #:key (other '())) + "Build a Workflow class CWL workflow." + `((cwlVersion . "v1.1") + (class . Workflow) + ,@other + (inputs . ,(delete-duplicates + (map input->tree + (append + (append-map (lambda (step) + (filter-map (match-lambda + ((id . (? input? input)) input) + (_ #f)) + (step-in step))) + steps) + (filter-map (lambda (output) + (and (input? (workflow-output-source output)) + (workflow-output-source output))) + outputs))))) + (outputs . ,(map (lambda (output) + `(,(workflow-output-id output) + (type . ,(workflow-output-type output)) + (output-source . ,(match (workflow-output-source output) + ((? string? source) source) + ((? input? input) (input-id input)))))) + outputs)) + (steps . ,(map (lambda (step) + `(,(step-id step) + (in . ,(map (match-lambda + ((id . input) + (cons id (if (input? input) + (input-id input) + input)))) + (step-in step))) + (out . ,(list->vector (step-out step))) + (run . ,(step-run step)))) + steps)))) |