Skip to content

Commit

Permalink
Add cwl model
Browse files Browse the repository at this point in the history
  • Loading branch information
caroott authored and kMutagene committed Oct 21, 2024
1 parent 76e9b62 commit 081ca04
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/CWL/CWL.fs
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions src/CWL/CWLTypes.fs
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions src/CWL/Inputs.fs
Original file line number Diff line number Diff line change
@@ -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
}
16 changes: 16 additions & 0 deletions src/CWL/Outputs.fs
Original file line number Diff line number Diff line change
@@ -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
}

51 changes: 51 additions & 0 deletions src/CWL/Requirements.fs
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 081ca04

Please sign in to comment.