From 081ca0452bad26245525872637662e18bdb16bef Mon Sep 17 00:00:00 2001 From: Caroline Ott Date: Fri, 19 Jul 2024 10:42:20 +0200 Subject: [PATCH] Add cwl model --- src/CWL/CWL.fs | 56 +++++++++++++++++++++++++++++++++++++++++ src/CWL/CWLTypes.fs | 37 +++++++++++++++++++++++++++ src/CWL/Inputs.fs | 18 +++++++++++++ src/CWL/Outputs.fs | 16 ++++++++++++ src/CWL/Requirements.fs | 51 +++++++++++++++++++++++++++++++++++++ 5 files changed, 178 insertions(+) create mode 100644 src/CWL/CWL.fs create mode 100644 src/CWL/CWLTypes.fs create mode 100644 src/CWL/Inputs.fs create mode 100644 src/CWL/Outputs.fs create mode 100644 src/CWL/Requirements.fs diff --git a/src/CWL/CWL.fs b/src/CWL/CWL.fs new file mode 100644 index 00000000..1f12b369 --- /dev/null +++ b/src/CWL/CWL.fs @@ -0,0 +1,56 @@ +namespace ARCtrl.CWL + +open DynamicObj +open CWLTypes +open Requirements +open Inputs +open Outputs + +module CWL = + + type CWL ( + cwlVersion: string, + cls: Class, + outputs: Output [], + ?baseCommand: string [], + ?requirements: Requirement [], + ?hints: Requirement [], + ?inputs: Input [] + ) = + inherit DynamicObj () + + let mutable _cwlVersion: string = cwlVersion + let mutable _class: Class = cls + let mutable _outputs: Output [] = outputs + let mutable _baseCommand: string [] option = baseCommand + let mutable _requirements: Requirement [] option = requirements + let mutable _hints: Requirement [] option = hints + let mutable _inputs: Input [] option = inputs + + member this.CWLVersion + with get() = _cwlVersion + and set(version) = _cwlVersion <- version + + member this.Class + with get() = _class + and set(cls) = _class <- cls + + member this.Outputs + with get() = _outputs + and set(outputs) = _outputs <- outputs + + member this.BaseCommand + with get() = _baseCommand + and set(baseCommand) = _baseCommand <- baseCommand + + member this.Requirements + with get() = _requirements + and set(requirements) = _requirements <- requirements + + member this.Hints + with get() = _hints + and set(hints) = _hints <- hints + + member this.Inputs + with get() = _inputs + and set(inputs) = _inputs <- inputs \ No newline at end of file diff --git a/src/CWL/CWLTypes.fs b/src/CWL/CWLTypes.fs new file mode 100644 index 00000000..fcfa5c74 --- /dev/null +++ b/src/CWL/CWLTypes.fs @@ -0,0 +1,37 @@ +namespace ARCtrl.CWL + +open DynamicObj + +module CWLTypes = + + type FileInstance () = + inherit DynamicObj () + + type DirectoryInstance () = + inherit DynamicObj () + + type DirentInstance = { + // can be string or expression, but expression is string as well + Entry: string + Entryname: string option + Writable: bool option + } + + type CWLType = + | File of FileInstance + | Directory of DirectoryInstance + | Dirent of DirentInstance + | String + | Int + | Long + | Float + | Double + | Boolean + | Stdout + | Null + | Array of CWLType + + type Class = + | Workflow + | CommandLineTool + | ExpressionTool diff --git a/src/CWL/Inputs.fs b/src/CWL/Inputs.fs new file mode 100644 index 00000000..9e03907d --- /dev/null +++ b/src/CWL/Inputs.fs @@ -0,0 +1,18 @@ +namespace ARCtrl.CWL + +open CWLTypes + +module Inputs = + + type InputBinding = { + Prefix: string option + Position: int option + ItemSeparator: string option + Separate: bool option + } + + type Input = { + Name: string + Type: CWLType + InputBinding: InputBinding option + } diff --git a/src/CWL/Outputs.fs b/src/CWL/Outputs.fs new file mode 100644 index 00000000..f6240ec3 --- /dev/null +++ b/src/CWL/Outputs.fs @@ -0,0 +1,16 @@ +namespace ARCtrl.CWL + +open CWLTypes + +module Outputs = + + type OutputBinding = { + Glob: string option + } + + type Output = { + Name: string + Type: CWLType + OutputBinding: OutputBinding option + } + diff --git a/src/CWL/Requirements.fs b/src/CWL/Requirements.fs new file mode 100644 index 00000000..f00a0929 --- /dev/null +++ b/src/CWL/Requirements.fs @@ -0,0 +1,51 @@ +namespace ARCtrl.CWL + +open DynamicObj +open CWLTypes + +module Requirements = + type DockerRequirement = { + DockerPull: string option + DockerFile: string option + DockerImageId: string option + } + + type InputRecordSchema () = + inherit DynamicObj () + + type InputEnumSchema () = + inherit DynamicObj () + + type InputArraySchema () = + inherit DynamicObj () + + type SchemaDefRequirementType = + | InputRecordSchema of InputRecordSchema + | InputEnumSchema of InputEnumSchema + | InputArraySchema of InputArraySchema + + type SoftwarePackage = { + Package: string + Version: string [] option + Specs: string [] option + } + + type EnvironmentDef = { + EnvName: string + EnvValue: string + } + + type ResourceRequirementInstance () = + inherit DynamicObj () + + type Requirement = + | InlineJavascriptRequirement + | SchemaDefRequirement of SchemaDefRequirementType [] + | DockerRequirement of DockerRequirement + | SoftwareRequirement of SoftwarePackage [] + | InitialWorkDirRequirement of CWLType [] + | EnvVarRequirement of EnvironmentDef + | ShellCommandRequirement + | ResourceRequirement of ResourceRequirementInstance + | NetworkAccessRequirement +