Skip to content

Commit

Permalink
remove underlying modules
Browse files Browse the repository at this point in the history
  • Loading branch information
caroott committed Oct 21, 2024
1 parent fedc6d4 commit 844ca8b
Show file tree
Hide file tree
Showing 14 changed files with 239 additions and 287 deletions.
106 changes: 52 additions & 54 deletions src/CWL/CWLTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,55 @@ 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
}

/// Primitive types with the concept of a file and directory as a builtin type.
type CWLType =
/// Represents a file (or group of files when secondaryFiles is provided)
| File of FileInstance
/// Represents a directory to present to a command line tool.
/// Directories are represented as objects with class of Directory. Directory objects have a number of properties that provide metadata about the directory.
| Directory of DirectoryInstance
/// Define a file or subdirectory that must be placed in the designated output directory prior to executing the command line tool.
/// May be the result of executing an expression, such as building a configuration file from a template.
| Dirent of DirentInstance
| String
| Int
| Long
| Float
| Double
| Boolean
| Stdout
| Null
| Array of CWLType

type InputRecordSchema () =
inherit DynamicObj ()

type InputEnumSchema () =
inherit DynamicObj ()

type InputArraySchema () =
inherit DynamicObj ()

type SchemaDefRequirementType (types, definitions) as this =
inherit DynamicObj ()
do
DynObj.setProperty (nameof types) definitions this

type SoftwarePackage = {
Package: string
Version: ResizeArray<string> option
Specs: ResizeArray<string> option
}
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
}

/// Primitive types with the concept of a file and directory as a builtin type.
type CWLType =
/// Represents a file (or group of files when secondaryFiles is provided)
| File of FileInstance
/// Represents a directory to present to a command line tool.
/// Directories are represented as objects with class of Directory. Directory objects have a number of properties that provide metadata about the directory.
| Directory of DirectoryInstance
/// Define a file or subdirectory that must be placed in the designated output directory prior to executing the command line tool.
/// May be the result of executing an expression, such as building a configuration file from a template.
| Dirent of DirentInstance
| String
| Int
| Long
| Float
| Double
| Boolean
| Stdout
| Null
| Array of CWLType

type InputRecordSchema () =
inherit DynamicObj ()

type InputEnumSchema () =
inherit DynamicObj ()

type InputArraySchema () =
inherit DynamicObj ()

type SchemaDefRequirementType (types, definitions) as this =
inherit DynamicObj ()
do
DynObj.setProperty (nameof types) definitions this

type SoftwarePackage = {
Package: string
Version: ResizeArray<string> option
Specs: ResizeArray<string> option
}
18 changes: 6 additions & 12 deletions src/CWL/Decode.fs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
namespace ARCtrl.CWL

open ARCtrl
open YAMLicious
open YAMLicious.YAMLiciousTypes
open CWLTypes
open Requirements
open Inputs
open Outputs
open WorkflowSteps
open DynamicObj

module ResizeArray =
Expand Down Expand Up @@ -141,7 +135,7 @@ module Decode =
)

/// Decode a YAMLElement into an Output Array
let outputArrayDecoder: (YAMLiciousTypes.YAMLElement -> ResizeArray<Output>) =
let outputArrayDecoder: (YAMLiciousTypes.YAMLElement -> ResizeArray<CWLOutput>) =
Decode.object (fun get ->
let dict = get.Overflow.FieldList []
[|
Expand All @@ -154,7 +148,7 @@ module Decode =
| YAMLElement.Object [YAMLElement.Value v] -> cwlTypeStringMatcher v.Value get |> fst
| _ -> cwlTypeDecoder value |> fst
let output =
Output(
CWLOutput(
key,
cwlType
)
Expand All @@ -168,7 +162,7 @@ module Decode =
)

/// Access the outputs field and decode a YAMLElement into an Output Array
let outputsDecoder: (YAMLiciousTypes.YAMLElement -> ResizeArray<Output>) =
let outputsDecoder: (YAMLiciousTypes.YAMLElement -> ResizeArray<CWLOutput>) =
Decode.object (fun get ->
let outputs = get.Required.Field "outputs" outputArrayDecoder
outputs
Expand Down Expand Up @@ -321,7 +315,7 @@ module Decode =
)

/// Decode a YAMLElement into an Input array
let inputArrayDecoder: (YAMLiciousTypes.YAMLElement -> ResizeArray<Input>) =
let inputArrayDecoder: (YAMLiciousTypes.YAMLElement -> ResizeArray<CWLInput>) =
Decode.object (fun get ->
let dict = get.Overflow.FieldList []
[|
Expand All @@ -333,7 +327,7 @@ module Decode =
| YAMLElement.Object [YAMLElement.Value v] -> cwlTypeStringMatcher v.Value get
| _ -> cwlTypeDecoder value
let input =
Input(
CWLInput(
key,
cwlType
)
Expand All @@ -347,7 +341,7 @@ module Decode =
)

/// Access the inputs field and decode the YAMLElements into an Input array
let inputsDecoder: (YAMLiciousTypes.YAMLElement -> ResizeArray<Input> option) =
let inputsDecoder: (YAMLiciousTypes.YAMLElement -> ResizeArray<CWLInput> option) =
Decode.object (fun get ->
let outputs = get.Optional.Field "inputs" inputArrayDecoder
outputs
Expand Down
47 changes: 22 additions & 25 deletions src/CWL/Inputs.fs
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
namespace ARCtrl.CWL

open CWLTypes
open DynamicObj
open Fable.Core

module Inputs =
type InputBinding = {
Prefix: string option
Position: int option
ItemSeparator: string option
Separate: bool option
}

type InputBinding = {
Prefix: string option
Position: int option
ItemSeparator: string option
Separate: bool option
}

[<AttachMembers>]
type Input (
name: string,
?type_: CWLType,
?inputBinding: InputBinding,
?optional: bool
) as this =
inherit DynamicObj ()
do
DynObj.setOptionalProperty ("type") type_ this
DynObj.setOptionalProperty ("inputBinding") inputBinding this
DynObj.setOptionalProperty ("optional") optional this
member this.Name = name
member this.Type_ = DynObj.tryGetTypedPropertyValue<CWLType> ("type") this
member this.InputBinding = DynObj.tryGetTypedPropertyValue<InputBinding> ("inputBinding") this
member this.Optional = DynObj.tryGetTypedPropertyValue<bool> ("optional") this
[<AttachMembers>]
type CWLInput (
name: string,
?type_: CWLType,
?inputBinding: InputBinding,
?optional: bool
) as this =
inherit DynamicObj ()
do
DynObj.setOptionalProperty ("type") type_ this
DynObj.setOptionalProperty ("inputBinding") inputBinding this
DynObj.setOptionalProperty ("optional") optional this
member this.Name = name
member this.Type_ = DynObj.tryGetTypedPropertyValue<CWLType> ("type") this
member this.InputBinding = DynObj.tryGetTypedPropertyValue<InputBinding> ("inputBinding") this
member this.Optional = DynObj.tryGetTypedPropertyValue<bool> ("optional") this
41 changes: 19 additions & 22 deletions src/CWL/Outputs.fs
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
namespace ARCtrl.CWL

open CWLTypes
open DynamicObj
open Fable.Core

module Outputs =
type OutputBinding = {
Glob: string option
}

type OutputBinding = {
Glob: string option
}

[<AttachMembers>]
type Output (
name: string,
?type_: CWLType,
?outputBinding: OutputBinding,
?outputSource: string
) as this =
inherit DynamicObj ()
do
DynObj.setOptionalProperty ("type") type_ this
DynObj.setOptionalProperty ("outputBinding") outputBinding this
DynObj.setOptionalProperty ("outputSource") outputSource this
member this.Name = name
member this.Type_ = DynObj.tryGetTypedPropertyValue<CWLType> ("type") this
member this.OutputBinding = DynObj.tryGetTypedPropertyValue<OutputBinding> ("outputBinding") this
member this.OutputSource = DynObj.tryGetTypedPropertyValue<string> ("outputSource") this
[<AttachMembers>]
type CWLOutput (
name: string,
?type_: CWLType,
?outputBinding: OutputBinding,
?outputSource: string
) as this =
inherit DynamicObj ()
do
DynObj.setOptionalProperty ("type") type_ this
DynObj.setOptionalProperty ("outputBinding") outputBinding this
DynObj.setOptionalProperty ("outputSource") outputSource this
member this.Name = name
member this.Type_ = DynObj.tryGetTypedPropertyValue<CWLType> ("type") this
member this.OutputBinding = DynObj.tryGetTypedPropertyValue<OutputBinding> ("outputBinding") this
member this.OutputSource = DynObj.tryGetTypedPropertyValue<string> ("outputSource") this
Loading

0 comments on commit 844ca8b

Please sign in to comment.