aboutsummaryrefslogtreecommitdiff
path: root/ccwl
diff options
context:
space:
mode:
authorArun Isaac2023-11-07 23:04:36 +0000
committerArun Isaac2023-11-07 23:15:59 +0000
commit808e44bd4e717f0ad7f89c5f97ee8d401935d856 (patch)
tree9c45920f8dfc6dda114d213ec5ad4d3472791be4 /ccwl
parentea8611f2cb62c378848b6a2ab90afb40bd10dc70 (diff)
downloadccwl-808e44bd4e717f0ad7f89c5f97ee8d401935d856.tar.gz
ccwl-808e44bd4e717f0ad7f89c5f97ee8d401935d856.tar.lz
ccwl-808e44bd4e717f0ad7f89c5f97ee8d401935d856.zip
cwl: Deduplicate input to CWL rendering.
* ccwl/cwl.scm (input->cwl-scm): New function. (workflow->cwl-scm, command->cwl-scm): Use input->cwl-scm.
Diffstat (limited to 'ccwl')
-rw-r--r--ccwl/cwl.scm39
1 files changed, 20 insertions, 19 deletions
diff --git a/ccwl/cwl.scm b/ccwl/cwl.scm
index f5d7f6a..d751def 100644
--- a/ccwl/cwl.scm
+++ b/ccwl/cwl.scm
@@ -65,14 +65,7 @@ association list."
(class . Workflow)
(requirements (SubworkflowFeatureRequirement))
,@(workflow-other workflow)
- (inputs . ,(map (lambda (input)
- `(,(input-id input)
- ,@(filter-alist
- `((type . ,(input-type input))
- (label . ,(input-label input))
- (default . ,(and (not (unspecified-default? (input-default input)))
- (input-default input)))))
- ,@(input-other input)))
+ (inputs . ,(map input->cwl-scm
(workflow-inputs workflow)))
(outputs . ,(map (lambda (output)
`(,(output-id output)
@@ -117,6 +110,24 @@ CWL YAML specification."
(scm->yaml (command->cwl-scm command)
port))
+(define (input->cwl-scm input)
+ "Render @var{input}, a @code{<input>} object, into a CWL tree."
+ `(,(input-id input)
+ (type . ,(input-type input))
+ ,@(or (filter-alist
+ `((label . ,(input-label input))
+ (default . ,(and (not (unspecified-default? (input-default input)))
+ (input-default input)))
+ ;; inputBinding is only relevant to commands, not
+ ;; workflows. But, the input position and prefix are not set
+ ;; for worklow inputs and therefore this sub-expression has
+ ;; no effect. So, leave this be.
+ (inputBinding . ,(filter-alist
+ `((position . ,(input-position input))
+ (prefix . ,(input-prefix input)))))))
+ '())
+ ,@(input-other input)))
+
(define (command->cwl-scm command)
"Render COMMAND, a <command> object, into a CWL tree."
`((cwlVersion . ,%cwl-version)
@@ -142,17 +153,7 @@ CWL YAML specification."
`((position . ,index)
(valueFrom . ,arg))))
(command-args command))))
- (inputs . ,(map (lambda (input)
- `(,(input-id input)
- ,@(filter-alist
- `((type . ,(input-type input))
- (label . ,(input-label input))
- (default . ,(and (not (unspecified-default? (input-default input)))
- (input-default input)))
- (inputBinding . ,(filter-alist
- `((position . ,(input-position input))
- (prefix . ,(input-prefix input)))))))
- ,@(input-other input)))
+ (inputs . ,(map input->cwl-scm
(command-inputs command)))
(outputs . ,(map output->cwl-scm (command-outputs command)))
,@(if (command-stdin command)