From e6becb8973ad26cea064968a81a0fe83a0fa195a Mon Sep 17 00:00:00 2001 From: patrick blume Date: Thu, 10 Oct 2024 16:25:27 +0200 Subject: [PATCH 01/11] Enable Sequence based metadata data creation for arc assays --- src/ARCtrl/packages.lock.json | 109 ++++++++++++++---- src/Spreadsheet/ArcAssay.fs | 57 +++++++++ tests/Spreadsheet/AssayFileTests.fs | 16 ++- .../Spreadsheet.Assay.fs | 7 +- 4 files changed, 161 insertions(+), 28 deletions(-) diff --git a/src/ARCtrl/packages.lock.json b/src/ARCtrl/packages.lock.json index 74c257d7..264dde03 100644 --- a/src/ARCtrl/packages.lock.json +++ b/src/ARCtrl/packages.lock.json @@ -8,6 +8,18 @@ "resolved": "1.1.0", "contentHash": "YEMSyiB/HCpBgDSZUr0LHaTa9vYH+xj8Fvd/AvzUAVbLQ3Bc2l9xHOI9g4+Bh1wGsLFrhMwFW+U39D7m5a6oOw==" }, + "Fable.SimpleHttp": { + "type": "Direct", + "requested": "[3.5.0, )", + "resolved": "3.5.0", + "contentHash": "SWYshvAI90JcdGLsUmTWBG9eaazY6ihdIk/uehrEz/VqMx9qX+e7+PzYaw31DMwGYSva9/mpq9s69T/z8Ubl5Q==", + "dependencies": { + "FSharp.Core": "4.6.2", + "Fable.Browser.Dom": "1.0.0", + "Fable.Browser.XMLHttpRequest": "1.1.0", + "Fable.Core": "3.0.0" + } + }, "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", @@ -17,26 +29,68 @@ "Microsoft.NETCore.Platforms": "1.1.0" } }, - "Thoth.Json.Python": { + "Thoth.Json.Newtonsoft": { "type": "Direct", - "requested": "[0.4.0, )", - "resolved": "0.4.0", - "contentHash": "O86Oisv/91NpbHENz11poZh9zrTRJdAjDXHVC1JqvDDsscelI7HxOmWgks8ZFvYxbBzNJCG+FKQHC10KzyMf8g==", + "requested": "[0.2.0, )", + "resolved": "0.2.0", + "contentHash": "dMQOT6TJftO97c8gHWFegfSw/0/E+VdhGaSkf3e1Ba+DjrAESLA9HMlYyE30x7nhn7w5SfH1WO9YyzSRTV4Ysg==", "dependencies": { "FSharp.Core": "5.0.0", "Fable.Core": "4.1.0", - "Fable.Package.SDK": "1.0.0", - "Fable.Python": "4.3.0", - "Thoth.Json.Core": "0.4.0" + "Fable.Package.SDK": "0.1.0", + "Newtonsoft.Json": "13.0.1", + "Thoth.Json.Core": "0.3.0" } }, - "Fable.Python": { + "Fable.Browser.Blob": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "KT5PI4NyMtVLDcmDkf5SeqwtFjVO17u27xr45qXfYWG12UePHxGjQJoI16OafIzlEQ6cHfAuRljhZGKIlvOJNQ==", + "resolved": "1.1.0", + "contentHash": "xMX7hPFwBUGuj75xLlH6VsVThZjRlGW4zOqXb1X+byRPLSBE91vtn9EueNUB+YpGhE9LfrtakIPNGy+dkoMkjg==", "dependencies": { - "FSharp.Core": "4.7.2", - "Fable.Core": "[4.1.0, 5.0.0)" + "FSharp.Core": "4.6.2", + "Fable.Core": "3.0.0" + } + }, + "Fable.Browser.Dom": { + "type": "Transitive", + "resolved": "1.0.0", + "contentHash": "ZodpIKYuKnUnqN71Fi103mh0joFYrRPGwpYOrpbZ149PkVAW7DNKXgxad5lsi9df7vAe5+sBhhO71TPREZaWlw==", + "dependencies": { + "FSharp.Core": "4.5.2", + "Fable.Browser.Blob": "1.0.0", + "Fable.Browser.Event": "1.0.0", + "Fable.Browser.WebStorage": "1.0.0", + "Fable.Core": "3.0.0" + } + }, + "Fable.Browser.Event": { + "type": "Transitive", + "resolved": "1.0.0", + "contentHash": "T1bGrlRJ4A2fxOfAVPzJpxanR6lkzPgJroPdSN1IU5CLdKtvRakWmYq6QKqu4dz6ZV9Z3fIPTWLZkoGKEOEo3w==", + "dependencies": { + "FSharp.Core": "4.5.2", + "Fable.Core": "3.0.0" + } + }, + "Fable.Browser.WebStorage": { + "type": "Transitive", + "resolved": "1.0.0", + "contentHash": "ZqnZKYkhPO+wmJPxQqtiwSc3zCC/mB37SPlVi4ZLiHoPFnra7SQ3qaRn4/ENYTeaVtVq92eVaYbTyAOnFn+GPA==", + "dependencies": { + "FSharp.Core": "4.5.2", + "Fable.Browser.Event": "1.0.0", + "Fable.Core": "3.0.0" + } + }, + "Fable.Browser.XMLHttpRequest": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "27p/F8781NrnV9vQ23RhX10ww9MDkX+Yi3yTiV9s8U8Bufi/VCCjS4swX0LXvgKQANN3k87CwaNeiO75r2U7gw==", + "dependencies": { + "FSharp.Core": "4.6.2", + "Fable.Browser.Blob": "1.1.0", + "Fable.Browser.Event": "1.0.0", + "Fable.Core": "3.0.0" } }, "Microsoft.NETCore.Platforms": { @@ -44,20 +98,25 @@ "resolved": "1.1.0", "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" }, + "Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.1", + "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==" + }, "arctrl.contract": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )", - "ARCtrl.Json": "[2.1.0, )", - "ARCtrl.Spreadsheet": "[2.1.0, )", - "ARCtrl.Yaml": "[2.1.0, )" + "ARCtrl.Core": "[1.0.0, )", + "ARCtrl.Json": "[1.0.0, )", + "ARCtrl.Spreadsheet": "[1.0.0, )", + "ARCtrl.Yaml": "[1.0.0, )" } }, "arctrl.core": { "type": "Project", "dependencies": { - "ARCtrl.CWL": "[2.1.0, )", - "ARCtrl.FileSystem": "[2.1.0, )" + "ARCtrl.CWL": "[1.0.0, )", + "ARCtrl.FileSystem": "[1.0.0, )" } }, "arctrl.cwl": { @@ -72,8 +131,8 @@ "arctrl.json": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )", - "ARCtrl.ROCrate": "[2.1.0, )", + "ARCtrl.Core": "[1.0.0, )", + "ARCtrl.ROCrate": "[1.0.0, )", "Thoth.Json.Core": "[0.4.0, )" } }, @@ -87,22 +146,22 @@ "arctrl.spreadsheet": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )", - "ARCtrl.FileSystem": "[2.1.0, )", + "ARCtrl.Core": "[1.0.0, )", + "ARCtrl.FileSystem": "[1.0.0, )", "FsSpreadsheet": "[6.3.0-alpha.4, )" } }, "arctrl.validationpackages": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )" + "ARCtrl.Core": "[1.0.0, )" } }, "arctrl.yaml": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )", - "ARCtrl.ValidationPackages": "[2.1.0, )", + "ARCtrl.Core": "[1.0.0, )", + "ARCtrl.ValidationPackages": "[1.0.0, )", "YAMLicious": "[0.0.1, )" } }, diff --git a/src/Spreadsheet/ArcAssay.fs b/src/Spreadsheet/ArcAssay.fs index 287ce5de..ae5967d9 100644 --- a/src/Spreadsheet/ArcAssay.fs +++ b/src/Spreadsheet/ArcAssay.fs @@ -76,6 +76,63 @@ module ArcAssay = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message + let toMetadataCollection (assay: ArcAssay) = + let toRows (assay: ArcAssay) = + seq { + yield SparseRow.fromValues [assaysLabel] + yield! Assays.toRows (Some assaysPrefix) [assay] + + yield SparseRow.fromValues [contactsLabel] + yield! Contacts.toRows (Some contactsPrefix) (List.ofSeq assay.Performers) + } + assay + |> toRows + |> Seq.map (fun row -> SparseRow.getAllValues row) + + let fromMetadataCollection (collection: seq>) : ArcAssay = + try + let fromRows (usePrefixes: bool) (rows: seq) = + let aPrefix, cPrefix = + if usePrefixes then + Some assaysPrefix, Some contactsPrefix + else None, None + let en = rows.GetEnumerator() + let rec loop lastRow assays contacts rowNumber = + + match lastRow with + | Some prefix when prefix = assaysLabel || prefix = obsoleteAssaysLabel -> + let currentRow, rowNumber, _, assays = Assays.fromRows aPrefix (rowNumber + 1) en + loop currentRow assays contacts rowNumber + + | Some prefix when prefix = contactsLabel -> + let currentLine, rowNumber, _, contacts = Contacts.fromRows cPrefix (rowNumber + 1) en + loop currentLine assays contacts rowNumber + | _ -> + match assays, contacts with + | [], [] -> ArcAssay.create(Identifier.createMissingIdentifier()) + | assays, contacts -> + assays + |> Seq.tryHead + |> Option.defaultValue (ArcAssay.create(Identifier.createMissingIdentifier())) + |> ArcAssay.setPerformers (ResizeArray contacts) + + if en.MoveNext () then + let currentLine = en.Current |> SparseRow.tryGetValueAt 0 + loop currentLine [] [] 1 + + else + failwith "empty assay metadata sheet" + let rows = + collection + |> Seq.map SparseRow.fromAllValues + let hasPrefix = + rows + |> Seq.exists (fun row -> row |> Seq.head |> snd |> fun s -> s.StartsWith(assaysPrefix)) + rows + |> fromRows hasPrefix + with + | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message + let isMetadataSheetName (name:string) = name = metadataSheetName || name = obsoleteMetadataSheetName diff --git a/tests/Spreadsheet/AssayFileTests.fs b/tests/Spreadsheet/AssayFileTests.fs index 23fb7d95..ec6f2aaa 100644 --- a/tests/Spreadsheet/AssayFileTests.fs +++ b/tests/Spreadsheet/AssayFileTests.fs @@ -1,4 +1,4 @@ -module ArcAssayTests +module ArcAssayTests open ARCtrl @@ -73,6 +73,20 @@ let testMetaDataFunctions = |> Seq.iter (fun c -> Expect.notEqual (c.ValueAsString().Trim()) "" $"Cell {c.Address.ToString()} should not contain empty string") ) + testCase "TestMetadataFromCollection" (fun () -> + + let assay = + Assay.Proteome.assayMetadataCollection + |> ArcAssay.fromMetadataCollection + + Expect.isSome assay.MeasurementType "protein expression profiling" + Expect.isSome assay.TechnologyPlatform "iTRAQ" + Expect.isSome assay.TechnologyType "mass spectrometry" + Expect.isSome (assay.Performers.Item 0).LastName "Oliver" + Expect.isSome (assay.Performers.Item 1).LastName "Juan" + Expect.isSome (assay.Performers.Item 2).LastName "Leo" + ) + testCase "WriterSuccessObsoleteSheetName" (fun () -> let a = ArcAssay.fromMetadataSheet Assay.Proteome.assayMetadataObsoleteSheetName diff --git a/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Assay.fs b/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Assay.fs index c03ddff7..35a4cbdf 100644 --- a/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Assay.fs +++ b/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Assay.fs @@ -1,4 +1,4 @@ -module TestObjects.Spreadsheet.Assay +module TestObjects.Spreadsheet.Assay open FsSpreadsheet @@ -87,6 +87,10 @@ module Proteome = row23.[4].Value <- "0000-0002-1825-0098" ws + let assayMetadataCollection = + let assay = ARCtrl.Spreadsheet.ArcAssay.fromMetadataSheet assayMetadata + ARCtrl.Spreadsheet.ArcAssay.toMetadataCollection assay + let assayMetadataDeprecatedKeys = let ws = FsWorksheet("isa_assay") let row1 = ws.Row(1) @@ -221,7 +225,6 @@ module Proteome = row22.[1].Value <- "Comment[Worksheet]" ws - let assayMetadataEmptyObsoleteSheetName = let cp = assayMetadataEmpty.Copy() cp.Name <- "Assay" From 3c383de5768fd4609b2db00bfc35c243b9dc01e4 Mon Sep 17 00:00:00 2001 From: patrick blume Date: Thu, 10 Oct 2024 16:48:55 +0200 Subject: [PATCH 02/11] Enable the creation of study metadata based on sequences --- src/Spreadsheet/ArcStudy.fs | 19 +++++++++++++++++++ tests/Spreadsheet/StudyFileTests.fs | 17 ++++++++++++++++- .../Spreadsheet.Study.fs | 9 +++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/Spreadsheet/ArcStudy.fs b/src/Spreadsheet/ArcStudy.fs index c8e7e321..d02ae768 100644 --- a/src/Spreadsheet/ArcStudy.fs +++ b/src/Spreadsheet/ArcStudy.fs @@ -39,6 +39,25 @@ module ArcStudy = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message + let toMetadataCollection (study : ArcStudy) (assays : ArcAssay list option) = + Studies.toRows study assays + |> Seq.append [SparseRow.fromValues [studiesLabel]] + |> Seq.map (fun r -> SparseRow.getAllValues r) + + let fromMetadataCollection (collection: seq>) : ArcStudy*ArcAssay list = + try + let fromRows (rows: seq) = + let en = rows.GetEnumerator() + en.MoveNext() |> ignore + let _,_,_,study = Studies.fromRows 2 en + study + collection + |> Seq.map SparseRow.fromAllValues + |> fromRows + |> Option.defaultValue (ArcStudy.create(Identifier.createMissingIdentifier()),[]) + with + | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message + let isMetadataSheetName (name : string) = name = metadataSheetName || name = obsoleteMetadataSheetName diff --git a/tests/Spreadsheet/StudyFileTests.fs b/tests/Spreadsheet/StudyFileTests.fs index fe6520ba..7b3626db 100644 --- a/tests/Spreadsheet/StudyFileTests.fs +++ b/tests/Spreadsheet/StudyFileTests.fs @@ -1,4 +1,4 @@ -module ArcStudyTests +module ArcStudyTests open TestingUtils @@ -60,6 +60,21 @@ let testMetaDataFunctions = Expect.isOk writingSuccess (Result.getMessage writingSuccess) ) + testCase "TestMetadataFromCollection" (fun () -> + + let study, assays = + Study.BII_S_1.studyMetadataCollection + |> ArcStudy.fromMetadataCollection + + Expect.isSome study.Title "Study of the impact of changes in flux on the transcriptome, proteome, endometabolome and exometabolome of the yeast Saccharomyces cerevisiae under different nutrient limitations" + Expect.isSome study.Description "We wished to study the impact of growth rate on the total complement of mRNA molecules, proteins, and metabolites in S. cerevisiae, independent of any nutritional or other physiological effects. To achieve this, we carried out our analyses on yeast grown in steady-state chemostat culture under four different nutrient limitations (glucose, ammonium, phosphate, and sulfate) at three different dilution (that is, growth) rates (D = u = 0.07, 0.1, and 0.2/hour, equivalent to population doubling times (Td) of 10 hours, 7 hours, and 3.5 hours, respectively; u = specific growth rate defined as grams of biomass generated per gram of biomass present per unit time)." + Expect.isSome study.SubmissionDate "2007-04-30" + + Expect.isSome assays.[0].MeasurementType "protein expression profiling" + Expect.isSome assays.[1].MeasurementType "etabolite profiling" + Expect.isSome assays.[2].MeasurementType "transcription profiling" + ) + testCase "OutputMatchesInputEmpty" (fun () -> let o = diff --git a/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Study.fs b/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Study.fs index 9d799662..19f4dd9b 100644 --- a/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Study.fs +++ b/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Study.fs @@ -313,6 +313,15 @@ module BII_S_1 = row61.[1].Value <- "Comment[Study Person REF]" ws + let studyMetadataCollection = + let study, assays = ARCtrl.Spreadsheet.ArcStudy.fromMetadataSheet studyMetadata + + let assays = + if assays.IsEmpty then None + else Some assays + + ARCtrl.Spreadsheet.ArcStudy.toMetadataCollection study assays + let studyMetadataEmptyObsoleteSheetName = let cp = studyMetadataEmpty.Copy() cp.Name <- "Study" From 12e5d75da146a9e7831c82a665a41dbe096f854f Mon Sep 17 00:00:00 2001 From: patrick blume Date: Thu, 10 Oct 2024 17:24:06 +0200 Subject: [PATCH 03/11] Add excel get and create template meta data from sequence of strings --- src/Spreadsheet/ArcStudy.fs | 2 +- src/Spreadsheet/Template.fs | 13 ++++++++++--- tests/Spreadsheet/TemplateTests.fs | 19 ++++++++++++++++++- .../Spreadsheet.Template.fs | 7 ++++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/Spreadsheet/ArcStudy.fs b/src/Spreadsheet/ArcStudy.fs index d02ae768..2278ec5d 100644 --- a/src/Spreadsheet/ArcStudy.fs +++ b/src/Spreadsheet/ArcStudy.fs @@ -42,7 +42,7 @@ module ArcStudy = let toMetadataCollection (study : ArcStudy) (assays : ArcAssay list option) = Studies.toRows study assays |> Seq.append [SparseRow.fromValues [studiesLabel]] - |> Seq.map (fun r -> SparseRow.getAllValues r) + |> Seq.map (fun row -> SparseRow.getAllValues row) let fromMetadataCollection (collection: seq>) : ArcStudy*ArcAssay list = try diff --git a/src/Spreadsheet/Template.fs b/src/Spreadsheet/Template.fs index 063b994d..ae0d3ec2 100644 --- a/src/Spreadsheet/Template.fs +++ b/src/Spreadsheet/Template.fs @@ -226,7 +226,6 @@ module Template = let [] metaDataSheetName = "isa_template" let [] obsoletemetaDataSheetName = "SwateTemplateMetadata" - let fromParts (templateInfo:TemplateInfo) (ers:OntologyAnnotation list) (tags: OntologyAnnotation list) (authors : Person list) (table : ArcTable) (lastUpdated : System.DateTime)= Template.make (System.Guid templateInfo.Id) @@ -240,8 +239,7 @@ module Template = (ResizeArray tags) (lastUpdated) - let toMetadataSheet (template : Template) : FsWorksheet = - + let toMetadataSheet (template : Template) : FsWorksheet = let sheet = FsWorksheet(metaDataSheetName) Template.toRows template |> Seq.iteri (fun rowI r -> SparseRow.writeToSheet (rowI + 1) r sheet) @@ -252,6 +250,15 @@ module Template = |> Seq.map SparseRow.fromFsRow |> Template.fromRows + let toMetadataCollection (template : Template) = + Template.toRows template + |> Seq.map (fun row -> SparseRow.getAllValues row) + + let fromMetadataCollection (collection: seq>) = + collection + |> Seq.map SparseRow.fromAllValues + |> Template.fromRows + /// Reads an assay from a spreadsheet let fromFsWorkbook (doc:FsWorkbook) = // Reading the "Assay" metadata sheet. Here metadata diff --git a/tests/Spreadsheet/TemplateTests.fs b/tests/Spreadsheet/TemplateTests.fs index 773f43f9..24ff75b0 100644 --- a/tests/Spreadsheet/TemplateTests.fs +++ b/tests/Spreadsheet/TemplateTests.fs @@ -1,4 +1,4 @@ -module TemplateTests +module TemplateTests open ARCtrl @@ -51,6 +51,23 @@ let tests_Spreadsheet = testList "Template_Spreadsheet" [ let sheet = Spreadsheet.Template.toMetadataSheet template Expect.workSheetEqual sheet TestObjects.Spreadsheet.Template.templateMetadata "Metadata sheet should be equal" + testCase "TestMetadataFromCollection" (fun _ -> + + let table = ArcTable.init(TestObjects.Spreadsheet.Template.templateTableName) + let templateInfo, ers,tags,authors = Spreadsheet.Template.fromMetadataCollection (TestObjects.Spreadsheet.Template.templateetadataCollection table) + + let template = ARCtrl.Spreadsheet.Template.fromParts templateInfo ers tags authors table System.DateTime.Now + + Expect.stringEqual template.Name "Plant growth" "Name should be equal" + Expect.stringEqual template.Version "1.2.0" "Version should be equal" + + Expect.isSome (template.EndpointRepositories.Item 0).TermAccessionNumber (ARCtrl.Helper.Url.createOAUri "DPBO" "1000096") + Expect.isSome (template.EndpointRepositories.Item 0).TermAccessionNumber (ARCtrl.Helper.Url.createOAUri "NFDI4PSO" "1000097") + Expect.isSome (template.EndpointRepositories.Item 0).TermAccessionNumber (ARCtrl.Helper.Url.createOAUri "NFDI4PSO" "1000098") + Expect.isSome (template.EndpointRepositories.Item 0).TermAccessionNumber (ARCtrl.Helper.Url.createOAUri "NFDI4PSO" "0010002") + Expect.isSome (template.EndpointRepositories.Item 0).TermAccessionNumber (ARCtrl.Helper.Url.createOAUri "DPBO" "0010000") + + ) ] testList "fullFile" [ testCase "simple" <| fun _ -> diff --git a/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Template.fs b/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Template.fs index 8dff37d7..e61dde86 100644 --- a/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Template.fs +++ b/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.Template.fs @@ -1,4 +1,4 @@ -module TestObjects.Spreadsheet.Template +module TestObjects.Spreadsheet.Template open FsSpreadsheet @@ -163,6 +163,11 @@ let templateMetadata = row28.[6].Value <- "" ws +let templateetadataCollection table = + let template, ers, tags, authors = ARCtrl.Spreadsheet.Template.fromMetadataSheet templateMetadata + ARCtrl.Spreadsheet.Template.fromParts template ers tags authors table System.DateTime.Now + |> ARCtrl.Spreadsheet.Template.toMetadataCollection + let templateMetadata_deprecatedKeys = let ws = FsWorksheet("SwateTemplateMetadata") let row1 = ws.Row(1) From 38b9ce8e0ec768d356c8a448fd92c0e7375143e6 Mon Sep 17 00:00:00 2001 From: patrick blume Date: Mon, 14 Oct 2024 11:37:32 +0200 Subject: [PATCH 04/11] Adapt styling --- src/Spreadsheet/ArcAssay.fs | 22 ++-- src/Spreadsheet/ArcInvestigation.fs | 72 ++++++------- src/Spreadsheet/ArcStudy.fs | 22 ++-- src/Spreadsheet/DataMap.fs | 5 +- src/Spreadsheet/Template.fs | 156 ++++++++++++++-------------- 5 files changed, 138 insertions(+), 139 deletions(-) diff --git a/src/Spreadsheet/ArcAssay.fs b/src/Spreadsheet/ArcAssay.fs index ae5967d9..9174f573 100644 --- a/src/Spreadsheet/ArcAssay.fs +++ b/src/Spreadsheet/ArcAssay.fs @@ -16,7 +16,7 @@ module ArcAssay = let [] obsoleteMetadataSheetName = "Assay" let [] metadataSheetName = "isa_assay" - let toMetadataSheet (assay : ArcAssay) : FsWorksheet = + let toMetadataSheet (assay: ArcAssay) : FsWorksheet = let toRows (assay:ArcAssay) = seq { yield SparseRow.fromValues [assaysLabel] @@ -31,10 +31,10 @@ module ArcAssay = |> Seq.iteri (fun rowI r -> SparseRow.writeToSheet (rowI + 1) r sheet) sheet - let fromMetadataSheet (sheet : FsWorksheet) : ArcAssay = + let fromMetadataSheet (sheet: FsWorksheet) : ArcAssay = try - let fromRows (usePrefixes : bool) (rows: seq) = - let aPrefix,cPrefix = + let fromRows (usePrefixes: bool) (rows: seq) = + let aPrefix, cPrefix = if usePrefixes then Some assaysPrefix,Some contactsPrefix else None,None @@ -44,11 +44,11 @@ module ArcAssay = match lastLine with | Some k when k = assaysLabel || k = obsoleteAssaysLabel -> - let currentLine,lineNumber,_,assays = Assays.fromRows aPrefix (lineNumber + 1) en + let currentLine, lineNumber, _, assays = Assays.fromRows aPrefix (lineNumber + 1) en loop currentLine assays contacts lineNumber | Some k when k = contactsLabel -> - let currentLine,lineNumber,_,contacts = Contacts.fromRows cPrefix (lineNumber + 1) en + let currentLine, lineNumber, _, contacts = Contacts.fromRows cPrefix (lineNumber + 1) en loop currentLine assays contacts lineNumber | k -> match assays, contacts with @@ -133,13 +133,13 @@ module ArcAssay = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message - let isMetadataSheetName (name:string) = + let isMetadataSheetName (name: string) = name = metadataSheetName || name = obsoleteMetadataSheetName - let isMetadataSheet (sheet : FsWorksheet) = + let isMetadataSheet (sheet: FsWorksheet) = isMetadataSheetName sheet.Name - let tryGetMetadataSheet (doc:FsWorkbook) = + let tryGetMetadataSheet (doc: FsWorkbook) = doc.GetWorksheets() |> Seq.tryFind isMetadataSheet @@ -149,7 +149,7 @@ module ArcAssayExtensions = type ArcAssay with /// Reads an assay from a spreadsheet - static member fromFsWorkbook (doc:FsWorkbook) : ArcAssay = + static member fromFsWorkbook (doc: FsWorkbook) : ArcAssay = try // Reading the "Assay" metadata sheet. Here metadata let assayMetadata = @@ -179,7 +179,7 @@ module ArcAssayExtensions = /// /// /// Default: true - static member toFsWorkbook (assay : ArcAssay, ?datamapSheet: bool) = + static member toFsWorkbook (assay: ArcAssay, ?datamapSheet: bool) = let datamapSheet = defaultArg datamapSheet true let doc = new FsWorkbook() let metadataSheet = ArcAssay.toMetadataSheet (assay) diff --git a/src/Spreadsheet/ArcInvestigation.fs b/src/Spreadsheet/ArcInvestigation.fs index 8e008d53..56d2f1a2 100644 --- a/src/Spreadsheet/ArcInvestigation.fs +++ b/src/Spreadsheet/ArcInvestigation.fs @@ -30,12 +30,12 @@ module ArcInvestigation = type InvestigationInfo = { - Identifier : string - Title : string - Description : string - SubmissionDate : string - PublicReleaseDate : string - Comments : Comment list + Identifier : string + Title : string + Description : string + SubmissionDate : string + PublicReleaseDate : string + Comments : Comment list } static member create identifier title description submissionDate publicReleaseDate comments = @@ -50,21 +50,21 @@ module ArcInvestigation = static member Labels = [identifierLabel;titleLabel;descriptionLabel;submissionDateLabel;publicReleaseDateLabel] - static member FromSparseTable (matrix : SparseTable) = + static member FromSparseTable (matrix: SparseTable) = let i = 0 let comments = matrix.CommentKeys |> List.map (fun k -> - Comment.fromString k (matrix.TryGetValueDefault("",(k,i)))) + Comment.fromString k (matrix.TryGetValueDefault("", (k, i)))) InvestigationInfo.create - (matrix.TryGetValueDefault("",(identifierLabel,i))) - (matrix.TryGetValueDefault("",(titleLabel,i))) - (matrix.TryGetValueDefault("",(descriptionLabel,i))) - (matrix.TryGetValueDefault("",(submissionDateLabel,i))) - (matrix.TryGetValueDefault("",(publicReleaseDateLabel,i))) + (matrix.TryGetValueDefault("", (identifierLabel, i))) + (matrix.TryGetValueDefault("", (titleLabel, i))) + (matrix.TryGetValueDefault("", (descriptionLabel, i))) + (matrix.TryGetValueDefault("", (submissionDateLabel, i))) + (matrix.TryGetValueDefault("", (publicReleaseDateLabel, i))) comments @@ -73,32 +73,32 @@ module ArcInvestigation = let matrix = SparseTable.Create (keys = InvestigationInfo.Labels,length=2) let mutable commentKeys = [] - do matrix.Matrix.Add ((identifierLabel,i), (investigation.Identifier)) - do matrix.Matrix.Add ((titleLabel,i), (Option.defaultValue "" investigation.Title)) - do matrix.Matrix.Add ((descriptionLabel,i), (Option.defaultValue "" investigation.Description)) - do matrix.Matrix.Add ((submissionDateLabel,i), (Option.defaultValue "" investigation.SubmissionDate)) - do matrix.Matrix.Add ((publicReleaseDateLabel,i), (Option.defaultValue "" investigation.PublicReleaseDate)) + do matrix.Matrix.Add ((identifierLabel, i), (investigation.Identifier)) + do matrix.Matrix.Add ((titleLabel, i), (Option.defaultValue "" investigation.Title)) + do matrix.Matrix.Add ((descriptionLabel, i), (Option.defaultValue "" investigation.Description)) + do matrix.Matrix.Add ((submissionDateLabel, i), (Option.defaultValue "" investigation.SubmissionDate)) + do matrix.Matrix.Add ((publicReleaseDateLabel, i), (Option.defaultValue "" investigation.PublicReleaseDate)) investigation.Comments |> ResizeArray.iter (fun comment -> - let n,v = comment |> Comment.toString + let n, v = comment |> Comment.toString commentKeys <- n :: commentKeys - matrix.Matrix.Add((n,i),v) + matrix.Matrix.Add((n, i), v) ) {matrix with CommentKeys = commentKeys |> List.distinct |> List.rev} - static member fromRows lineNumber (rows : IEnumerator) = - SparseTable.FromRows(rows,InvestigationInfo.Labels,lineNumber) - |> fun (s,ln,rs,sm) -> (s,ln,rs, InvestigationInfo.FromSparseTable sm) + static member fromRows lineNumber (rows: IEnumerator) = + SparseTable.FromRows(rows, InvestigationInfo.Labels, lineNumber) + |> fun (s, ln, rs, sm) -> (s, ln, rs, InvestigationInfo.FromSparseTable sm) - static member toRows (investigation : ArcInvestigation) = + static member toRows (investigation: ArcInvestigation) = investigation |> InvestigationInfo.ToSparseTable |> SparseTable.ToRows - let fromParts (investigationInfo:InvestigationInfo) (ontologySourceReference:OntologySourceReference list) (publications: Publication list) (contacts: Person list) (studies: ArcStudy list) (assays: ArcAssay list) (remarks: Remark list) = + let fromParts (investigationInfo: InvestigationInfo) (ontologySourceReference: OntologySourceReference list) (publications: Publication list) (contacts: Person list) (studies: ArcStudy list) (assays: ArcAssay list) (remarks: Remark list) = let studyIdentifiers = studies |> List.map (fun s -> s.Identifier) ArcInvestigation.make (investigationInfo.Identifier) @@ -116,7 +116,7 @@ module ArcInvestigation = (ResizeArray remarks) - let fromRows (rows:seq) = + let fromRows (rows: seq) = let en = rows.GetEnumerator() let emptyInvestigationInfo = InvestigationInfo.create "" "" "" "" "" [] @@ -125,7 +125,7 @@ module ArcInvestigation = match lastLine with | Some k when k = ontologySourceReferenceLabel -> - let currentLine,lineNumber,newRemarks,ontologySourceReferences = OntologySourceReference.fromRows (lineNumber + 1) en + let currentLine, lineNumber, newRemarks, ontologySourceReferences = OntologySourceReference.fromRows (lineNumber + 1) en loop currentLine ontologySourceReferences investigationInfo publications contacts studies (List.append remarks newRemarks) lineNumber | Some k when k = investigationLabel -> @@ -148,10 +148,10 @@ module ArcInvestigation = loop currentLine ontologySourceReferences investigationInfo publications contacts studies (List.append remarks newRemarks) lineNumber | k -> - let studies,assays = + let studies, assays = studies |> List.unzip - |> fun (s,a) -> + |> fun (s, a) -> s |> List.rev, a |> List.concat |> List.distinctBy (fun a -> a.Identifier) fromParts investigationInfo ontologySourceReferences publications contacts studies assays remarks @@ -164,8 +164,8 @@ module ArcInvestigation = failwith "emptyInvestigationFile" - let toRows (investigation:ArcInvestigation) : seq = - let insertRemarks (remarks:Remark list) (rows:seq) = + let toRows (investigation: ArcInvestigation) : seq = + let insertRemarks (remarks: Remark list) (rows: seq) = try let rm = remarks |> List.map Remark.toTuple |> Map.ofList let rec loop i l nl = @@ -202,13 +202,13 @@ module ArcInvestigation = |> insertRemarks (List.ofSeq investigation.Remarks) |> seq - let isMetadataSheetName (name : string) = + let isMetadataSheetName (name: string) = name = metadataSheetName || name = obsoleteMetadataSheetName - let isMetadataSheet (sheet : FsWorksheet) = + let isMetadataSheet (sheet: FsWorksheet) = isMetadataSheetName sheet.Name - let tryGetMetadataSheet (doc:FsWorkbook) = + let tryGetMetadataSheet (doc: FsWorkbook) = doc.GetWorksheets() |> Seq.tryFind isMetadataSheet @@ -220,7 +220,7 @@ module ArcInvestigationExtensions = type ArcInvestigation with - static member fromFsWorkbook (doc:FsWorkbook) = + static member fromFsWorkbook (doc: FsWorkbook) = try match ArcInvestigation.tryGetMetadataSheet doc with | Some sheet -> sheet @@ -231,7 +231,7 @@ module ArcInvestigationExtensions = with | err -> failwithf "Could not read investigation from spreadsheet: %s" err.Message - static member toFsWorkbook (investigation:ArcInvestigation) : FsWorkbook = + static member toFsWorkbook (investigation: ArcInvestigation) : FsWorkbook = try let wb = new FsWorkbook() let sheet = FsWorksheet(metadataSheetName) diff --git a/src/Spreadsheet/ArcStudy.fs b/src/Spreadsheet/ArcStudy.fs index 2278ec5d..c19a10e1 100644 --- a/src/Spreadsheet/ArcStudy.fs +++ b/src/Spreadsheet/ArcStudy.fs @@ -13,7 +13,7 @@ module ArcStudy = let [] obsoleteMetadataSheetName = "Study" let [] metadataSheetName = "isa_study" - let toMetadataSheet (study : ArcStudy) (assays : ArcAssay list option) : FsWorksheet = + let toMetadataSheet (study: ArcStudy) (assays: ArcAssay list option) : FsWorksheet = //let toRows (study:ArcStudy) assays = // seq { // yield SparseRow.fromValues [studiesLabel] @@ -25,12 +25,12 @@ module ArcStudy = |> Seq.iteri (fun rowI r -> SparseRow.writeToSheet (rowI + 1) r sheet) sheet - let fromMetadataSheet (sheet : FsWorksheet) : ArcStudy*ArcAssay list = + let fromMetadataSheet (sheet: FsWorksheet) : ArcStudy*ArcAssay list = try let fromRows (rows: seq) = let en = rows.GetEnumerator() en.MoveNext() |> ignore - let _,_,_,study = Studies.fromRows 2 en + let _, _, _,study = Studies.fromRows 2 en study sheet.Rows |> Seq.map SparseRow.fromFsRow @@ -39,7 +39,7 @@ module ArcStudy = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message - let toMetadataCollection (study : ArcStudy) (assays : ArcAssay list option) = + let toMetadataCollection (study: ArcStudy) (assays: ArcAssay list option) = Studies.toRows study assays |> Seq.append [SparseRow.fromValues [studiesLabel]] |> Seq.map (fun row -> SparseRow.getAllValues row) @@ -49,7 +49,7 @@ module ArcStudy = let fromRows (rows: seq) = let en = rows.GetEnumerator() en.MoveNext() |> ignore - let _,_,_,study = Studies.fromRows 2 en + let _, _, _,study = Studies.fromRows 2 en study collection |> Seq.map SparseRow.fromAllValues @@ -58,13 +58,13 @@ module ArcStudy = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message - let isMetadataSheetName (name : string) = + let isMetadataSheetName (name: string) = name = metadataSheetName || name = obsoleteMetadataSheetName - let isMetadataSheet (sheet : FsWorksheet) = + let isMetadataSheet (sheet: FsWorksheet) = isMetadataSheetName sheet.Name - let tryGetMetadataSheet (doc:FsWorkbook) = + let tryGetMetadataSheet (doc: FsWorkbook) = doc.GetWorksheets() |> Seq.tryFind isMetadataSheet @@ -74,7 +74,7 @@ module ArcStudyExtensions = type ArcStudy with /// Reads an assay from a spreadsheet - static member fromFsWorkbook (doc:FsWorkbook) = + static member fromFsWorkbook (doc: FsWorkbook) = try // Reading the "Assay" metadata sheet. Here metadata let studyMetadata,assays = @@ -116,7 +116,7 @@ module ArcStudyExtensions = /// /// /// - static member toFsWorkbook (study : ArcStudy, ?assays : ArcAssay list, ?datamapSheet: bool) = + static member toFsWorkbook (study: ArcStudy, ?assays: ArcAssay list, ?datamapSheet: bool) = let datamapSheet = defaultArg datamapSheet true let doc = new FsWorkbook() let metadataSheet = ArcStudy.toMetadataSheet study assays @@ -131,5 +131,5 @@ module ArcStudyExtensions = doc - member this.ToFsWorkbook (?assays : ArcAssay list, ?datamapSheet: bool) = + member this.ToFsWorkbook (?assays: ArcAssay list, ?datamapSheet: bool) = ArcStudy.toFsWorkbook (this, ?assays = assays, ?datamapSheet = datamapSheet) \ No newline at end of file diff --git a/src/Spreadsheet/DataMap.fs b/src/Spreadsheet/DataMap.fs index 0d3a4d4f..eaf37eba 100644 --- a/src/Spreadsheet/DataMap.fs +++ b/src/Spreadsheet/DataMap.fs @@ -4,9 +4,8 @@ open ARCtrl open ArcTable open FsSpreadsheet - /// Reads an datamap from a spreadsheet -let fromFsWorkbook (doc:FsWorkbook) = +let fromFsWorkbook (doc: FsWorkbook) = try let dataMapTable = doc.GetWorksheets() @@ -17,7 +16,7 @@ let fromFsWorkbook (doc:FsWorkbook) = with | err -> failwithf "Could not parse datamap: \n%s" err.Message -let toFsWorkbook (dataMap : DataMap) = +let toFsWorkbook (dataMap: DataMap) = let doc = new FsWorkbook() DataMapTable.toFsWorksheet dataMap diff --git a/src/Spreadsheet/Template.fs b/src/Spreadsheet/Template.fs index ae0d3ec2..be7aa7b1 100644 --- a/src/Spreadsheet/Template.fs +++ b/src/Spreadsheet/Template.fs @@ -19,17 +19,17 @@ module Metadata = let labels = [erLabel;erTermAccessionNumberLabel;erTermSourceREFLabel] - let fromSparseTable (matrix : SparseTable) = + let fromSparseTable (matrix: SparseTable) = OntologyAnnotationSection.fromSparseTable erLabel erTermSourceREFLabel erTermAccessionNumberLabel matrix let toSparseTable (designs: OntologyAnnotation list) = OntologyAnnotationSection.toSparseTable erLabel erTermSourceREFLabel erTermAccessionNumberLabel designs - let fromRows (prefix : string option) (rows : IEnumerator) = + let fromRows (prefix: string option) (rows: IEnumerator) = let nextHeader, _, _, ers = OntologyAnnotationSection.fromRows prefix erLabel erTermSourceREFLabel erTermAccessionNumberLabel 0 rows nextHeader,ers - let toRows (prefix : string option) (designs : OntologyAnnotation list) = + let toRows (prefix: string option) (designs: OntologyAnnotation list) = OntologyAnnotationSection.toRows prefix erLabel erTermSourceREFLabel erTermAccessionNumberLabel designs module Tags = @@ -38,19 +38,19 @@ module Metadata = let [] tagsTermAccessionNumberLabel = "Tags Term Accession Number" let [] tagsTermSourceREFLabel = "Tags Term Source REF" - let labels = [tagsLabel;tagsTermAccessionNumberLabel;tagsTermSourceREFLabel] + let labels = [tagsLabel; tagsTermAccessionNumberLabel; tagsTermSourceREFLabel] - let fromSparseTable (matrix : SparseTable) = + let fromSparseTable (matrix: SparseTable) = OntologyAnnotationSection.fromSparseTable tagsLabel tagsTermSourceREFLabel tagsTermAccessionNumberLabel matrix let toSparseTable (designs: OntologyAnnotation list) = OntologyAnnotationSection.toSparseTable tagsLabel tagsTermSourceREFLabel tagsTermAccessionNumberLabel designs - let fromRows (prefix : string option) (rows : IEnumerator) = + let fromRows (prefix: string option) (rows: IEnumerator) = let nextHeader, _, _, tags = OntologyAnnotationSection.fromRows prefix tagsLabel tagsTermSourceREFLabel tagsTermAccessionNumberLabel 0 rows nextHeader, tags - let toRows (prefix : string option) (designs : OntologyAnnotation list) = + let toRows (prefix: string option) (designs: OntologyAnnotation list) = OntologyAnnotationSection.toRows prefix tagsLabel tagsTermSourceREFLabel tagsTermAccessionNumberLabel designs module Authors = @@ -80,129 +80,129 @@ module Metadata = type TemplateInfo = { - Id : string - Name : string - Version : string - Description : string - Organisation : string - Table : string - Comments : Comment list + Id : string + Name : string + Version : string + Description : string + Organisation : string + Table : string + Comments : Comment list } static member create id name version description organisation table comments = - {Id = id;Name = name;Version = version;Description = description;Organisation = organisation;Table = table;Comments = comments} + {Id = id; Name = name; Version = version; Description = description; Organisation = organisation; Table = table; Comments = comments} static member empty = TemplateInfo.create "" "" "" "" "" "" [] static member Labels = - [identifierLabel;nameLabel;versionLabel;descriptionLabel;organisationLabel;tableLabel] + [identifierLabel; nameLabel; versionLabel; descriptionLabel; organisationLabel; tableLabel] - static member FromSparseTable (matrix : SparseTable) = + static member FromSparseTable (matrix: SparseTable) = let i = 0 let comments = matrix.CommentKeys |> List.map (fun k -> - Comment.fromString k (matrix.TryGetValueDefault("",(k,i)))) + Comment.fromString k (matrix.TryGetValueDefault("", (k, i)))) TemplateInfo.create - (matrix.TryGetValueDefault(Identifier.createMissingIdentifier(),(identifierLabel,i))) - (matrix.TryGetValueDefault("",(nameLabel,i))) - (matrix.TryGetValueDefault("",(versionLabel,i))) - (matrix.TryGetValueDefault("",(descriptionLabel,i))) - (matrix.TryGetValueDefault("",(organisationLabel,i))) - (matrix.TryGetValueDefault("",(tableLabel,i))) + (matrix.TryGetValueDefault(Identifier.createMissingIdentifier(), (identifierLabel, i))) + (matrix.TryGetValueDefault("", (nameLabel, i))) + (matrix.TryGetValueDefault("", (versionLabel, i))) + (matrix.TryGetValueDefault("", (descriptionLabel, i))) + (matrix.TryGetValueDefault("", (organisationLabel, i))) + (matrix.TryGetValueDefault("", (tableLabel, i))) comments static member ToSparseTable (template: Template) = let i = 1 - let matrix = SparseTable.Create (keys = TemplateInfo.Labels,length = 2) + let matrix = SparseTable.Create (keys = TemplateInfo.Labels, length = 2) let mutable commentKeys = [] let processedIdentifier = if template.Id.ToString().StartsWith(Identifier.MISSING_IDENTIFIER) then "" else template.Id.ToString() - do matrix.Matrix.Add ((identifierLabel,i), processedIdentifier) - do matrix.Matrix.Add ((nameLabel,i), (template.Name)) - do matrix.Matrix.Add ((versionLabel,i), (template.Version)) - do matrix.Matrix.Add ((descriptionLabel,i), (template.Description)) - do matrix.Matrix.Add ((organisationLabel,i), (template.Organisation.ToString())) - do matrix.Matrix.Add ((tableLabel,i), template.Table.Name) + do matrix.Matrix.Add ((identifierLabel, i), processedIdentifier) + do matrix.Matrix.Add ((nameLabel, i), (template.Name)) + do matrix.Matrix.Add ((versionLabel, i), (template.Version)) + do matrix.Matrix.Add ((descriptionLabel, i), (template.Description)) + do matrix.Matrix.Add ((organisationLabel, i), (template.Organisation.ToString())) + do matrix.Matrix.Add ((tableLabel, i), template.Table.Name) {matrix with CommentKeys = commentKeys |> List.distinct |> List.rev} - static member fromRows (rows : IEnumerator) = - SparseTable.FromRows(rows,TemplateInfo.Labels,0) - |> fun (s,ln,rs,sm) -> (s,TemplateInfo.FromSparseTable sm) + static member fromRows (rows: IEnumerator) = + SparseTable.FromRows(rows,TemplateInfo.Labels, 0) + |> fun (s, _, _, sm) -> (s, TemplateInfo.FromSparseTable sm) - static member toRows (template : Template) = + static member toRows (template: Template) = template |> TemplateInfo.ToSparseTable |> SparseTable.ToRows - let mapDeprecatedKeys (rows : seq) = + let mapDeprecatedKeys (rows: seq) = rows |> Seq.map (fun r -> r - |> Seq.map (fun (k,v) -> + |> Seq.map (fun (k, v) -> if k = 0 then match v with - | v when v = obsoleteAuthorsLabel -> k,authorsLabel - | v when v = obsoleteErLabel -> k,erLabel - | v when v = obsoleteTagsLabel -> k,tagsLabel - - | v when v = Authors.obsoleteORCIDLabel -> k,$"Comment[{ARCtrl.Process.Conversion.Person.orcidKey}]" - - | v when v = "Authors Last Name" -> k,"Author Last Name" - | v when v = "Authors First Name" -> k,"Author First Name" - | v when v = "Authors Mid Initials" -> k,"Author Mid Initials" - | v when v = "Authors Email" -> k,"Author Email" - | v when v = "Authors Phone" -> k,"Author Phone" - | v when v = "Authors Fax" -> k,"Author Fax" - | v when v = "Authors Address" -> k,"Author Address" - | v when v = "Authors Affiliation" -> k,"Author Affiliation" - | v when v = "Authors Role" -> k,"Author Roles" - | v when v = "Authors Role Term Accession Number" -> k,"Author Roles Term Accession Number" - | v when v = "Authors Role Term Source REF" -> k,"Author Roles Term Source REF" - | v -> (k,v) - else (k,v) + | v when v = obsoleteAuthorsLabel -> k, authorsLabel + | v when v = obsoleteErLabel -> k, erLabel + | v when v = obsoleteTagsLabel -> k, tagsLabel + + | v when v = Authors.obsoleteORCIDLabel -> k, $"Comment[{ARCtrl.Process.Conversion.Person.orcidKey}]" + + | v when v = "Authors Last Name" -> k, "Author Last Name" + | v when v = "Authors First Name" -> k, "Author First Name" + | v when v = "Authors Mid Initials" -> k, "Author Mid Initials" + | v when v = "Authors Email" -> k, "Author Email" + | v when v = "Authors Phone" -> k, "Author Phone" + | v when v = "Authors Fax" -> k, "Author Fax" + | v when v = "Authors Address" -> k, "Author Address" + | v when v = "Authors Affiliation" -> k, "Author Affiliation" + | v when v = "Authors Role" -> k, "Author Roles" + | v when v = "Authors Role Term Accession Number" -> k, "Author Roles Term Accession Number" + | v when v = "Authors Role Term Source REF" -> k, "Author Roles Term Source REF" + | v -> (k, v) + else (k, v) ) ) |> fun s -> if Seq.head s |> SparseRow.tryGetValueAt 0 |> Option.exists (fun v -> v = templateLabel) then s else Seq.append (SparseRow.fromValues [templateLabel] |> Seq.singleton) s - let fromRows (rows : seq) = + let fromRows (rows: seq) = - let rec loop en lastLine (templateInfo : TemplateInfo) ers tags authors = + let rec loop en lastLine (templateInfo: TemplateInfo) ers tags authors = match lastLine with | Some k when k = erLabel -> - let currentLine,newERs = ER.fromRows None en + let currentLine, newERs = ER.fromRows None en loop en currentLine templateInfo (List.append ers newERs) tags authors | Some k when k = tagsLabel -> - let currentLine,newTags = Tags.fromRows None en + let currentLine, newTags = Tags.fromRows None en loop en currentLine templateInfo ers (List.append tags newTags) authors | Some k when k = authorsLabel -> - let currentLine,_,_,newAuthors = Contacts.fromRows (Some authorsLabelPrefix) 0 en + let currentLine, _, _, newAuthors = Contacts.fromRows (Some authorsLabelPrefix) 0 en loop en currentLine templateInfo ers tags (List.append authors newAuthors) | k -> - templateInfo,ers,tags,authors + templateInfo, ers, tags, authors let rows = mapDeprecatedKeys rows let en = rows.GetEnumerator() en.MoveNext() |> ignore - let currentLine,item = TemplateInfo.fromRows en + let currentLine, item = TemplateInfo.fromRows en loop en currentLine item [] [] [] - let toRows (template : Template) = + let toRows (template: Template) = seq { yield SparseRow.fromValues [templateLabel] yield! TemplateInfo.toRows template @@ -226,31 +226,31 @@ module Template = let [] metaDataSheetName = "isa_template" let [] obsoletemetaDataSheetName = "SwateTemplateMetadata" - let fromParts (templateInfo:TemplateInfo) (ers:OntologyAnnotation list) (tags: OntologyAnnotation list) (authors : Person list) (table : ArcTable) (lastUpdated : System.DateTime)= + let fromParts (templateInfo: TemplateInfo) (ers: OntologyAnnotation list) (tags: OntologyAnnotation list) (authors: Person list) (table: ArcTable) (lastUpdated: System.DateTime) = Template.make (System.Guid templateInfo.Id) table - (templateInfo.Name) - (templateInfo.Description) + templateInfo.Name + templateInfo.Description (Organisation.ofString templateInfo.Organisation) - (templateInfo.Version) + templateInfo.Version (ResizeArray authors) (ResizeArray ers) (ResizeArray tags) - (lastUpdated) + lastUpdated - let toMetadataSheet (template : Template) : FsWorksheet = + let toMetadataSheet (template: Template) : FsWorksheet = let sheet = FsWorksheet(metaDataSheetName) Template.toRows template |> Seq.iteri (fun rowI r -> SparseRow.writeToSheet (rowI + 1) r sheet) sheet - let fromMetadataSheet (sheet : FsWorksheet) = + let fromMetadataSheet (sheet: FsWorksheet) = sheet.Rows |> Seq.map SparseRow.fromFsRow |> Template.fromRows - let toMetadataCollection (template : Template) = + let toMetadataCollection (template: Template) = Template.toRows template |> Seq.map (fun row -> SparseRow.getAllValues row) @@ -260,9 +260,9 @@ module Template = |> Template.fromRows /// Reads an assay from a spreadsheet - let fromFsWorkbook (doc:FsWorkbook) = + let fromFsWorkbook (doc: FsWorkbook) = // Reading the "Assay" metadata sheet. Here metadata - let templateInfo,ers,tags,authors = + let templateInfo, ers, tags, authors = match doc.TryGetWorksheetByName metaDataSheetName with | Option.Some sheet -> @@ -272,12 +272,12 @@ module Template = | Option.Some sheet -> fromMetadataSheet sheet | None -> - Metadata.Template.TemplateInfo.empty,[],[],[] + Metadata.Template.TemplateInfo.empty, [], [], [] - let tryTableNameMatches (ws : FsWorksheet) = + let tryTableNameMatches (ws: FsWorksheet) = if ws.Tables |> Seq.exists (fun t -> t.Name = templateInfo.Table) then Some ws else None - let tryWSNameMatches (ws : FsWorksheet) = + let tryWSNameMatches (ws: FsWorksheet) = if ws.Name = templateInfo.Table then Some ws else None let sheets = doc.GetWorksheets() @@ -301,7 +301,7 @@ module Template = fromParts templateInfo ers tags authors table (System.DateTime.Now) - let toFsWorkbook (template : Template) = + let toFsWorkbook (template: Template) = let doc = new FsWorkbook() let metaDataSheet = toMetadataSheet template doc.AddWorksheet metaDataSheet From 5e0e10ef961ee858710535ac362ac291e9f7a338 Mon Sep 17 00:00:00 2001 From: patrick blume Date: Mon, 14 Oct 2024 12:05:21 +0200 Subject: [PATCH 05/11] Add from and to seq for arc investigation --- src/Spreadsheet/ArcInvestigation.fs | 31 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/Spreadsheet/ArcInvestigation.fs b/src/Spreadsheet/ArcInvestigation.fs index 56d2f1a2..c4f132fb 100644 --- a/src/Spreadsheet/ArcInvestigation.fs +++ b/src/Spreadsheet/ArcInvestigation.fs @@ -27,7 +27,6 @@ module ArcInvestigation = let [] metadataSheetName = "isa_investigation" let [] obsoleteMetadataSheetName = "Investigation" - type InvestigationInfo = { Identifier : string @@ -40,15 +39,15 @@ module ArcInvestigation = static member create identifier title description submissionDate publicReleaseDate comments = { - Identifier = identifier - Title = title - Description = description - SubmissionDate = submissionDate - PublicReleaseDate = publicReleaseDate - Comments = comments + Identifier = identifier + Title = title + Description = description + SubmissionDate = submissionDate + PublicReleaseDate = publicReleaseDate + Comments = comments } - static member Labels = [identifierLabel;titleLabel;descriptionLabel;submissionDateLabel;publicReleaseDateLabel] + static member Labels = [identifierLabel; titleLabel; descriptionLabel; submissionDateLabel; publicReleaseDateLabel] static member FromSparseTable (matrix: SparseTable) = @@ -101,7 +100,7 @@ module ArcInvestigation = let fromParts (investigationInfo: InvestigationInfo) (ontologySourceReference: OntologySourceReference list) (publications: Publication list) (contacts: Person list) (studies: ArcStudy list) (assays: ArcAssay list) (remarks: Remark list) = let studyIdentifiers = studies |> List.map (fun s -> s.Identifier) ArcInvestigation.make - (investigationInfo.Identifier) + investigationInfo.Identifier (Option.fromValueWithDefault "" investigationInfo.Title) (Option.fromValueWithDefault "" investigationInfo.Description) (Option.fromValueWithDefault "" investigationInfo.SubmissionDate) @@ -115,7 +114,6 @@ module ArcInvestigation = (ResizeArray investigationInfo.Comments) (ResizeArray remarks) - let fromRows (rows: seq) = let en = rows.GetEnumerator() @@ -137,11 +135,11 @@ module ArcInvestigation = loop currentLine ontologySourceReferences investigationInfo publications contacts studies (List.append remarks newRemarks) lineNumber | Some k when k = contactsLabel -> - let currentLine,lineNumber,newRemarks,contacts = Contacts.fromRows (Some contactsLabelPrefix) (lineNumber + 1) en + let currentLine,lineNumber, newRemarks, contacts = Contacts.fromRows (Some contactsLabelPrefix) (lineNumber + 1) en loop currentLine ontologySourceReferences investigationInfo publications contacts studies (List.append remarks newRemarks) lineNumber | Some k when k = studyLabel -> - let currentLine,lineNumber,newRemarks,study = Studies.fromRows (lineNumber + 1) en + let currentLine, lineNumber, newRemarks, study = Studies.fromRows (lineNumber + 1) en if study.IsSome then loop currentLine ontologySourceReferences investigationInfo publications contacts (study.Value::studies) (List.append remarks newRemarks) lineNumber else @@ -202,6 +200,15 @@ module ArcInvestigation = |> insertRemarks (List.ofSeq investigation.Remarks) |> seq + let toMetadataCollection (investigation: ArcInvestigation) = + toRows investigation + |> Seq.map (fun row -> SparseRow.getAllValues row) + + let fromMetadataCollection (collection: seq>) = + collection + |> Seq.map SparseRow.fromAllValues + |> fromRows + let isMetadataSheetName (name: string) = name = metadataSheetName || name = obsoleteMetadataSheetName From d4687f3e4c61f7495fb9fd4ec913841d12e61d60 Mon Sep 17 00:00:00 2001 From: patrick blume Date: Mon, 14 Oct 2024 14:10:34 +0200 Subject: [PATCH 06/11] Added unit tests for investigation --- src/Spreadsheet/ArcInvestigation.fs | 2 +- src/Spreadsheet/Template.fs | 22 ++++++++-------- tests/Spreadsheet/InvestigationFileTests.fs | 25 +++++++++++-------- .../Spreadsheet.InvestigationFile.fs | 3 ++- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/Spreadsheet/ArcInvestigation.fs b/src/Spreadsheet/ArcInvestigation.fs index c4f132fb..3f186956 100644 --- a/src/Spreadsheet/ArcInvestigation.fs +++ b/src/Spreadsheet/ArcInvestigation.fs @@ -145,7 +145,7 @@ module ArcInvestigation = else loop currentLine ontologySourceReferences investigationInfo publications contacts studies (List.append remarks newRemarks) lineNumber - | k -> + | _ -> let studies, assays = studies |> List.unzip diff --git a/src/Spreadsheet/Template.fs b/src/Spreadsheet/Template.fs index be7aa7b1..0980d841 100644 --- a/src/Spreadsheet/Template.fs +++ b/src/Spreadsheet/Template.fs @@ -227,17 +227,17 @@ module Template = let [] obsoletemetaDataSheetName = "SwateTemplateMetadata" let fromParts (templateInfo: TemplateInfo) (ers: OntologyAnnotation list) (tags: OntologyAnnotation list) (authors: Person list) (table: ArcTable) (lastUpdated: System.DateTime) = - Template.make - (System.Guid templateInfo.Id) - table - templateInfo.Name - templateInfo.Description - (Organisation.ofString templateInfo.Organisation) - templateInfo.Version - (ResizeArray authors) - (ResizeArray ers) - (ResizeArray tags) - lastUpdated + Template.make + (System.Guid templateInfo.Id) + table + templateInfo.Name + templateInfo.Description + (Organisation.ofString templateInfo.Organisation) + templateInfo.Version + (ResizeArray authors) + (ResizeArray ers) + (ResizeArray tags) + lastUpdated let toMetadataSheet (template: Template) : FsWorksheet = let sheet = FsWorksheet(metaDataSheetName) diff --git a/tests/Spreadsheet/InvestigationFileTests.fs b/tests/Spreadsheet/InvestigationFileTests.fs index d34a35d2..76f2cdc8 100644 --- a/tests/Spreadsheet/InvestigationFileTests.fs +++ b/tests/Spreadsheet/InvestigationFileTests.fs @@ -1,4 +1,4 @@ -module ArcInvestigationTests +module ArcInvestigationTests open ARCtrl @@ -180,22 +180,25 @@ let private testInvestigationFile = let studyIdentifiers = ResizeArray ["MyStudy"] let i = - ArcInvestigation.create("Identifier",registeredStudyIdentifiers = studyIdentifiers) + ArcInvestigation.create("Identifier", registeredStudyIdentifiers = studyIdentifiers) |> ArcInvestigation.toFsWorkbook |> ArcInvestigation.fromFsWorkbook Expect.sequenceEqual i.RegisteredStudyIdentifiers studyIdentifiers "Registered study Identifier were not written and read correctly" ) - testCase "WriteWithAssayOnlyRegistered" (fun () -> - let studyIdentifier = "MyStudy" - let assayIdentifiers = ResizeArray ["MyAssay"] - let study = ArcStudy.create("MyStudy",registeredAssayIdentifiers = assayIdentifiers) - let i = - ArcInvestigation.create("Identifier") - |> ArcInvestigation.addRegisteredStudy study - |> ArcInvestigation.toFsWorkbook + testCase "TestMetadataCollection" (fun () -> + let investigation = + Investigation.BII_I_1.fullInvestigation |> ArcInvestigation.fromFsWorkbook - Expect.sequenceEqual (i.GetStudy(studyIdentifier).RegisteredAssayIdentifiers) assayIdentifiers "Registered assay Identifier weres not written and read correctly" + |> ArcInvestigation.toMetadataCollection + |> ArcInvestigation.fromMetadataCollection + + Expect.isSome investigation.Description "Background Cell growth underlies many key cellular and developmental processes, yet a limited number of studies have been carried out on cell-growth regulation. Comprehensive studies at the transcriptional, proteomic and metabolic levels under defined controlled conditions are currently lacking. Results Metabolic control analysis is being exploited in a systems biology study of the eukaryotic cell. Using chemostat culture, we have measured the impact of changes in flux (growth rate) on the transcriptome, proteome, endometabolome and exometabolome of the yeast Saccharomyces cerevisiae. Each functional genomic level shows clear growth-rate-associated trends and discriminates between carbon-sufficient and carbon-limited conditions. Genes consistently and significantly upregulated with increasing growth rate are frequently essential and encode evolutionarily conserved proteins of known function that participate in many protein-protein interactions. In contrast, more unknown, and fewer essential, genes are downregulated with increasing growth rate; their protein products rarely interact with one another. A large proportion of yeast genes under positive growth-rate control share orthologs with other eukaryotes, including humans. Significantly, transcription of genes encoding components of the TOR complex (a major controller of eukaryotic cell growth) is not subject to growth-rate regulation. Moreover, integrative studies reveal the extent and importance of post-transcriptional control, patterns of control of metabolic fluxes at the level of enzyme synthesis, and the relevance of specific enzymatic reactions in the control of metabolic fluxes during cell growth. Conclusion This work constitutes a first comprehensive systems biology study on growth-rate control in the eukaryotic cell. The results have direct implications for advanced studies on cell growth, in vivo regulation of metabolic fluxes for comprehensive metabolic engineering, and for the design of genome-scale systems biology models of the eukaryotic cell." + Expect.equal investigation.Identifier "BII-I-1" "Identifier" + Expect.isSome investigation.Title "Growth control of the eukaryote cell: a systems biology study in yeast" + Expect.equal investigation.AssayCount 3 "AssayCount" + Expect.equal investigation.StudyCount 2 "StudyCount" ) + //testCase "OutputMatchesInputEmpty" (fun () -> // let i = diff --git a/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.InvestigationFile.fs b/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.InvestigationFile.fs index cd373af1..b5cd45d6 100644 --- a/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.InvestigationFile.fs +++ b/tests/TestingUtils/TestObjects.Spreadsheet/Spreadsheet.InvestigationFile.fs @@ -1,7 +1,8 @@ -module TestObjects.Spreadsheet.Investigation +module TestObjects.Spreadsheet.Investigation open FsSpreadsheet.DSL open FsSpreadsheet +open ARCtrl.Spreadsheet let emptyInvestigation = let wb = new FsWorkbook() From 8301e0246d1c8584d9097faee19146b9c5d465fa Mon Sep 17 00:00:00 2001 From: patrick blume Date: Mon, 14 Oct 2024 14:14:38 +0200 Subject: [PATCH 07/11] restore package.json of ARCtrl --- src/ARCtrl/packages.lock.json | 130 ++++++++-------------------------- 1 file changed, 28 insertions(+), 102 deletions(-) diff --git a/src/ARCtrl/packages.lock.json b/src/ARCtrl/packages.lock.json index 264dde03..fac00902 100644 --- a/src/ARCtrl/packages.lock.json +++ b/src/ARCtrl/packages.lock.json @@ -8,89 +8,33 @@ "resolved": "1.1.0", "contentHash": "YEMSyiB/HCpBgDSZUr0LHaTa9vYH+xj8Fvd/AvzUAVbLQ3Bc2l9xHOI9g4+Bh1wGsLFrhMwFW+U39D7m5a6oOw==" }, - "Fable.SimpleHttp": { - "type": "Direct", - "requested": "[3.5.0, )", - "resolved": "3.5.0", - "contentHash": "SWYshvAI90JcdGLsUmTWBG9eaazY6ihdIk/uehrEz/VqMx9qX+e7+PzYaw31DMwGYSva9/mpq9s69T/z8Ubl5Q==", - "dependencies": { - "FSharp.Core": "4.6.2", - "Fable.Browser.Dom": "1.0.0", - "Fable.Browser.XMLHttpRequest": "1.1.0", - "Fable.Core": "3.0.0" - } - }, "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", - "resolved": "2.0.3", - "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", - "dependencies": { +@@ -17,47 +29,94 @@ "Microsoft.NETCore.Platforms": "1.1.0" } }, - "Thoth.Json.Newtonsoft": { + "Thoth.Json.Python": { "type": "Direct", - "requested": "[0.2.0, )", - "resolved": "0.2.0", - "contentHash": "dMQOT6TJftO97c8gHWFegfSw/0/E+VdhGaSkf3e1Ba+DjrAESLA9HMlYyE30x7nhn7w5SfH1WO9YyzSRTV4Ysg==", + "requested": "[0.4.0, )", + "resolved": "0.4.0", + "contentHash": "O86Oisv/91NpbHENz11poZh9zrTRJdAjDXHVC1JqvDDsscelI7HxOmWgks8ZFvYxbBzNJCG+FKQHC10KzyMf8g==", "dependencies": { "FSharp.Core": "5.0.0", "Fable.Core": "4.1.0", - "Fable.Package.SDK": "0.1.0", - "Newtonsoft.Json": "13.0.1", - "Thoth.Json.Core": "0.3.0" - } - }, - "Fable.Browser.Blob": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "xMX7hPFwBUGuj75xLlH6VsVThZjRlGW4zOqXb1X+byRPLSBE91vtn9EueNUB+YpGhE9LfrtakIPNGy+dkoMkjg==", - "dependencies": { - "FSharp.Core": "4.6.2", - "Fable.Core": "3.0.0" - } - }, - "Fable.Browser.Dom": { - "type": "Transitive", - "resolved": "1.0.0", - "contentHash": "ZodpIKYuKnUnqN71Fi103mh0joFYrRPGwpYOrpbZ149PkVAW7DNKXgxad5lsi9df7vAe5+sBhhO71TPREZaWlw==", - "dependencies": { - "FSharp.Core": "4.5.2", - "Fable.Browser.Blob": "1.0.0", - "Fable.Browser.Event": "1.0.0", - "Fable.Browser.WebStorage": "1.0.0", - "Fable.Core": "3.0.0" - } - }, - "Fable.Browser.Event": { - "type": "Transitive", - "resolved": "1.0.0", - "contentHash": "T1bGrlRJ4A2fxOfAVPzJpxanR6lkzPgJroPdSN1IU5CLdKtvRakWmYq6QKqu4dz6ZV9Z3fIPTWLZkoGKEOEo3w==", - "dependencies": { - "FSharp.Core": "4.5.2", - "Fable.Core": "3.0.0" - } - }, - "Fable.Browser.WebStorage": { - "type": "Transitive", - "resolved": "1.0.0", - "contentHash": "ZqnZKYkhPO+wmJPxQqtiwSc3zCC/mB37SPlVi4ZLiHoPFnra7SQ3qaRn4/ENYTeaVtVq92eVaYbTyAOnFn+GPA==", - "dependencies": { - "FSharp.Core": "4.5.2", - "Fable.Browser.Event": "1.0.0", - "Fable.Core": "3.0.0" + "Fable.Package.SDK": "1.0.0", + "Fable.Python": "4.3.0", + "Thoth.Json.Core": "0.4.0" } }, - "Fable.Browser.XMLHttpRequest": { + "Fable.Python": { "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "27p/F8781NrnV9vQ23RhX10ww9MDkX+Yi3yTiV9s8U8Bufi/VCCjS4swX0LXvgKQANN3k87CwaNeiO75r2U7gw==", + "resolved": "4.3.0", + "contentHash": "KT5PI4NyMtVLDcmDkf5SeqwtFjVO17u27xr45qXfYWG12UePHxGjQJoI16OafIzlEQ6cHfAuRljhZGKIlvOJNQ==", "dependencies": { - "FSharp.Core": "4.6.2", - "Fable.Browser.Blob": "1.1.0", - "Fable.Browser.Event": "1.0.0", - "Fable.Core": "3.0.0" + "FSharp.Core": "4.7.2", + "Fable.Core": "[4.1.0, 5.0.0)" } }, "Microsoft.NETCore.Platforms": { @@ -98,70 +42,52 @@ "resolved": "1.1.0", "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" }, - "Newtonsoft.Json": { - "type": "Transitive", - "resolved": "13.0.1", - "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==" - }, "arctrl.contract": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )", - "ARCtrl.Json": "[1.0.0, )", - "ARCtrl.Spreadsheet": "[1.0.0, )", - "ARCtrl.Yaml": "[1.0.0, )" + "ARCtrl.Core": "[2.1.0, )", + "ARCtrl.Json": "[2.1.0, )", + "ARCtrl.Spreadsheet": "[2.1.0, )", + "ARCtrl.Yaml": "[2.1.0, )" } }, "arctrl.core": { "type": "Project", "dependencies": { - "ARCtrl.CWL": "[1.0.0, )", - "ARCtrl.FileSystem": "[1.0.0, )" + "ARCtrl.CWL": "[2.1.0, )", + "ARCtrl.FileSystem": "[2.1.0, )" } }, "arctrl.cwl": { - "type": "Project" - }, - "arctrl.filesystem": { - "type": "Project", - "dependencies": { - "Fable.Core": "[4.3.0, )" - } - }, +@@ -72,8 +131,8 @@ "arctrl.json": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )", - "ARCtrl.ROCrate": "[1.0.0, )", - "Thoth.Json.Core": "[0.4.0, )" - } - }, - "arctrl.rocrate": { - "type": "Project", - "dependencies": { - "DynamicObj": "[4.0.0, )", + "ARCtrl.Core": "[2.1.0, )", + "ARCtrl.ROCrate": "[2.1.0, )", "Thoth.Json.Core": "[0.4.0, )" } }, +@@ -87,22 +146,22 @@ "arctrl.spreadsheet": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )", - "ARCtrl.FileSystem": "[1.0.0, )", + "ARCtrl.Core": "[2.1.0, )", + "ARCtrl.FileSystem": "[2.1.0, )", "FsSpreadsheet": "[6.3.0-alpha.4, )" } }, "arctrl.validationpackages": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )" + "ARCtrl.Core": "[2.1.0, )" } }, "arctrl.yaml": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )", - "ARCtrl.ValidationPackages": "[1.0.0, )", + "ARCtrl.Core": "[2.1.0, )", + "ARCtrl.ValidationPackages": "[2.1.0, )", "YAMLicious": "[0.0.1, )" } }, From f5256198da2c8b4beef2c25fcbc0eaa6b4d1e480 Mon Sep 17 00:00:00 2001 From: patrick blume Date: Mon, 14 Oct 2024 14:18:51 +0200 Subject: [PATCH 08/11] restore pagages.lock.json of ARCtrl --- src/ARCtrl/packages.lock.json | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/ARCtrl/packages.lock.json b/src/ARCtrl/packages.lock.json index fac00902..74c257d7 100644 --- a/src/ARCtrl/packages.lock.json +++ b/src/ARCtrl/packages.lock.json @@ -11,7 +11,9 @@ "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", -@@ -17,47 +29,94 @@ + "resolved": "2.0.3", + "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "dependencies": { "Microsoft.NETCore.Platforms": "1.1.0" } }, @@ -59,7 +61,14 @@ } }, "arctrl.cwl": { -@@ -72,8 +131,8 @@ + "type": "Project" + }, + "arctrl.filesystem": { + "type": "Project", + "dependencies": { + "Fable.Core": "[4.3.0, )" + } + }, "arctrl.json": { "type": "Project", "dependencies": { @@ -68,7 +77,13 @@ "Thoth.Json.Core": "[0.4.0, )" } }, -@@ -87,22 +146,22 @@ + "arctrl.rocrate": { + "type": "Project", + "dependencies": { + "DynamicObj": "[4.0.0, )", + "Thoth.Json.Core": "[0.4.0, )" + } + }, "arctrl.spreadsheet": { "type": "Project", "dependencies": { From 536b988e182fe35aa3ae0c6bf697197c7e4a31bd Mon Sep 17 00:00:00 2001 From: patrick blume Date: Tue, 15 Oct 2024 11:13:57 +0200 Subject: [PATCH 09/11] Apply review changes --- src/ARCtrl/packages.lock.json | 109 ++++++++++++---- src/Spreadsheet/ArcAssay.fs | 132 +++++++------------- src/Spreadsheet/ArcStudy.fs | 21 ++-- src/Spreadsheet/Template.fs | 2 +- tests/Spreadsheet/InvestigationFileTests.fs | 1 + 5 files changed, 141 insertions(+), 124 deletions(-) diff --git a/src/ARCtrl/packages.lock.json b/src/ARCtrl/packages.lock.json index 74c257d7..264dde03 100644 --- a/src/ARCtrl/packages.lock.json +++ b/src/ARCtrl/packages.lock.json @@ -8,6 +8,18 @@ "resolved": "1.1.0", "contentHash": "YEMSyiB/HCpBgDSZUr0LHaTa9vYH+xj8Fvd/AvzUAVbLQ3Bc2l9xHOI9g4+Bh1wGsLFrhMwFW+U39D7m5a6oOw==" }, + "Fable.SimpleHttp": { + "type": "Direct", + "requested": "[3.5.0, )", + "resolved": "3.5.0", + "contentHash": "SWYshvAI90JcdGLsUmTWBG9eaazY6ihdIk/uehrEz/VqMx9qX+e7+PzYaw31DMwGYSva9/mpq9s69T/z8Ubl5Q==", + "dependencies": { + "FSharp.Core": "4.6.2", + "Fable.Browser.Dom": "1.0.0", + "Fable.Browser.XMLHttpRequest": "1.1.0", + "Fable.Core": "3.0.0" + } + }, "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", @@ -17,26 +29,68 @@ "Microsoft.NETCore.Platforms": "1.1.0" } }, - "Thoth.Json.Python": { + "Thoth.Json.Newtonsoft": { "type": "Direct", - "requested": "[0.4.0, )", - "resolved": "0.4.0", - "contentHash": "O86Oisv/91NpbHENz11poZh9zrTRJdAjDXHVC1JqvDDsscelI7HxOmWgks8ZFvYxbBzNJCG+FKQHC10KzyMf8g==", + "requested": "[0.2.0, )", + "resolved": "0.2.0", + "contentHash": "dMQOT6TJftO97c8gHWFegfSw/0/E+VdhGaSkf3e1Ba+DjrAESLA9HMlYyE30x7nhn7w5SfH1WO9YyzSRTV4Ysg==", "dependencies": { "FSharp.Core": "5.0.0", "Fable.Core": "4.1.0", - "Fable.Package.SDK": "1.0.0", - "Fable.Python": "4.3.0", - "Thoth.Json.Core": "0.4.0" + "Fable.Package.SDK": "0.1.0", + "Newtonsoft.Json": "13.0.1", + "Thoth.Json.Core": "0.3.0" } }, - "Fable.Python": { + "Fable.Browser.Blob": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "KT5PI4NyMtVLDcmDkf5SeqwtFjVO17u27xr45qXfYWG12UePHxGjQJoI16OafIzlEQ6cHfAuRljhZGKIlvOJNQ==", + "resolved": "1.1.0", + "contentHash": "xMX7hPFwBUGuj75xLlH6VsVThZjRlGW4zOqXb1X+byRPLSBE91vtn9EueNUB+YpGhE9LfrtakIPNGy+dkoMkjg==", "dependencies": { - "FSharp.Core": "4.7.2", - "Fable.Core": "[4.1.0, 5.0.0)" + "FSharp.Core": "4.6.2", + "Fable.Core": "3.0.0" + } + }, + "Fable.Browser.Dom": { + "type": "Transitive", + "resolved": "1.0.0", + "contentHash": "ZodpIKYuKnUnqN71Fi103mh0joFYrRPGwpYOrpbZ149PkVAW7DNKXgxad5lsi9df7vAe5+sBhhO71TPREZaWlw==", + "dependencies": { + "FSharp.Core": "4.5.2", + "Fable.Browser.Blob": "1.0.0", + "Fable.Browser.Event": "1.0.0", + "Fable.Browser.WebStorage": "1.0.0", + "Fable.Core": "3.0.0" + } + }, + "Fable.Browser.Event": { + "type": "Transitive", + "resolved": "1.0.0", + "contentHash": "T1bGrlRJ4A2fxOfAVPzJpxanR6lkzPgJroPdSN1IU5CLdKtvRakWmYq6QKqu4dz6ZV9Z3fIPTWLZkoGKEOEo3w==", + "dependencies": { + "FSharp.Core": "4.5.2", + "Fable.Core": "3.0.0" + } + }, + "Fable.Browser.WebStorage": { + "type": "Transitive", + "resolved": "1.0.0", + "contentHash": "ZqnZKYkhPO+wmJPxQqtiwSc3zCC/mB37SPlVi4ZLiHoPFnra7SQ3qaRn4/ENYTeaVtVq92eVaYbTyAOnFn+GPA==", + "dependencies": { + "FSharp.Core": "4.5.2", + "Fable.Browser.Event": "1.0.0", + "Fable.Core": "3.0.0" + } + }, + "Fable.Browser.XMLHttpRequest": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "27p/F8781NrnV9vQ23RhX10ww9MDkX+Yi3yTiV9s8U8Bufi/VCCjS4swX0LXvgKQANN3k87CwaNeiO75r2U7gw==", + "dependencies": { + "FSharp.Core": "4.6.2", + "Fable.Browser.Blob": "1.1.0", + "Fable.Browser.Event": "1.0.0", + "Fable.Core": "3.0.0" } }, "Microsoft.NETCore.Platforms": { @@ -44,20 +98,25 @@ "resolved": "1.1.0", "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" }, + "Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.1", + "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==" + }, "arctrl.contract": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )", - "ARCtrl.Json": "[2.1.0, )", - "ARCtrl.Spreadsheet": "[2.1.0, )", - "ARCtrl.Yaml": "[2.1.0, )" + "ARCtrl.Core": "[1.0.0, )", + "ARCtrl.Json": "[1.0.0, )", + "ARCtrl.Spreadsheet": "[1.0.0, )", + "ARCtrl.Yaml": "[1.0.0, )" } }, "arctrl.core": { "type": "Project", "dependencies": { - "ARCtrl.CWL": "[2.1.0, )", - "ARCtrl.FileSystem": "[2.1.0, )" + "ARCtrl.CWL": "[1.0.0, )", + "ARCtrl.FileSystem": "[1.0.0, )" } }, "arctrl.cwl": { @@ -72,8 +131,8 @@ "arctrl.json": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )", - "ARCtrl.ROCrate": "[2.1.0, )", + "ARCtrl.Core": "[1.0.0, )", + "ARCtrl.ROCrate": "[1.0.0, )", "Thoth.Json.Core": "[0.4.0, )" } }, @@ -87,22 +146,22 @@ "arctrl.spreadsheet": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )", - "ARCtrl.FileSystem": "[2.1.0, )", + "ARCtrl.Core": "[1.0.0, )", + "ARCtrl.FileSystem": "[1.0.0, )", "FsSpreadsheet": "[6.3.0-alpha.4, )" } }, "arctrl.validationpackages": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )" + "ARCtrl.Core": "[1.0.0, )" } }, "arctrl.yaml": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[2.1.0, )", - "ARCtrl.ValidationPackages": "[2.1.0, )", + "ARCtrl.Core": "[1.0.0, )", + "ARCtrl.ValidationPackages": "[1.0.0, )", "YAMLicious": "[0.0.1, )" } }, diff --git a/src/Spreadsheet/ArcAssay.fs b/src/Spreadsheet/ArcAssay.fs index 9174f573..9e0de8db 100644 --- a/src/Spreadsheet/ArcAssay.fs +++ b/src/Spreadsheet/ArcAssay.fs @@ -16,15 +16,51 @@ module ArcAssay = let [] obsoleteMetadataSheetName = "Assay" let [] metadataSheetName = "isa_assay" + let fromRows (rows: seq) = + let hasPrefix = + rows + |> Seq.exists (fun row -> row |> Seq.head |> snd |> fun s -> s.StartsWith(assaysPrefix)) + let aPrefix, cPrefix = + if hasPrefix then + Some assaysPrefix, Some contactsPrefix + else None, None + let en = rows.GetEnumerator() + let rec loop lastRow assays contacts rowNumber = + + match lastRow with + | Some prefix when prefix = assaysLabel || prefix = obsoleteAssaysLabel -> + let currentRow, rowNumber, _, assays = Assays.fromRows aPrefix (rowNumber + 1) en + loop currentRow assays contacts rowNumber + + | Some prefix when prefix = contactsLabel -> + let currentLine, rowNumber, _, contacts = Contacts.fromRows cPrefix (rowNumber + 1) en + loop currentLine assays contacts rowNumber + | _ -> + match assays, contacts with + | [], [] -> ArcAssay.create(Identifier.createMissingIdentifier()) + | assays, contacts -> + assays + |> Seq.tryHead + |> Option.defaultValue (ArcAssay.create(Identifier.createMissingIdentifier())) + |> ArcAssay.setPerformers (ResizeArray contacts) + + if en.MoveNext () then + let currentLine = en.Current |> SparseRow.tryGetValueAt 0 + loop currentLine [] [] 1 + + else + failwith "empty assay metadata sheet" + + let toRows (assay: ArcAssay) = + seq { + yield SparseRow.fromValues [assaysLabel] + yield! Assays.toRows (Some assaysPrefix) [assay] + + yield SparseRow.fromValues [contactsLabel] + yield! Contacts.toRows (Some contactsPrefix) (List.ofSeq assay.Performers) + } + let toMetadataSheet (assay: ArcAssay) : FsWorksheet = - let toRows (assay:ArcAssay) = - seq { - yield SparseRow.fromValues [assaysLabel] - yield! Assays.toRows (Some assaysPrefix) [assay] - - yield SparseRow.fromValues [contactsLabel] - yield! Contacts.toRows (Some contactsPrefix) (List.ofSeq assay.Performers) - } let sheet = FsWorksheet(metadataSheetName) assay |> toRows @@ -33,38 +69,6 @@ module ArcAssay = let fromMetadataSheet (sheet: FsWorksheet) : ArcAssay = try - let fromRows (usePrefixes: bool) (rows: seq) = - let aPrefix, cPrefix = - if usePrefixes then - Some assaysPrefix,Some contactsPrefix - else None,None - let en = rows.GetEnumerator() - let rec loop lastLine assays contacts lineNumber = - - match lastLine with - - | Some k when k = assaysLabel || k = obsoleteAssaysLabel -> - let currentLine, lineNumber, _, assays = Assays.fromRows aPrefix (lineNumber + 1) en - loop currentLine assays contacts lineNumber - - | Some k when k = contactsLabel -> - let currentLine, lineNumber, _, contacts = Contacts.fromRows cPrefix (lineNumber + 1) en - loop currentLine assays contacts lineNumber - | k -> - match assays, contacts with - | [], [] -> ArcAssay.create(Identifier.createMissingIdentifier()) - | assays, contacts -> - assays - |> Seq.tryHead - |> Option.defaultValue (ArcAssay.create(Identifier.createMissingIdentifier())) - |> ArcAssay.setPerformers (ResizeArray contacts) - - if en.MoveNext () then - let currentLine = en.Current |> SparseRow.tryGetValueAt 0 - loop currentLine [] [] 1 - - else - failwith "empty assay metadata sheet" let rows = sheet.Rows |> Seq.map SparseRow.fromFsRow @@ -72,64 +76,22 @@ module ArcAssay = rows |> Seq.exists (fun row -> row |> Seq.head |> snd |> fun s -> s.StartsWith(assaysPrefix)) rows - |> fromRows hasPrefix + |> fromRows with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message let toMetadataCollection (assay: ArcAssay) = - let toRows (assay: ArcAssay) = - seq { - yield SparseRow.fromValues [assaysLabel] - yield! Assays.toRows (Some assaysPrefix) [assay] - - yield SparseRow.fromValues [contactsLabel] - yield! Contacts.toRows (Some contactsPrefix) (List.ofSeq assay.Performers) - } assay |> toRows |> Seq.map (fun row -> SparseRow.getAllValues row) let fromMetadataCollection (collection: seq>) : ArcAssay = try - let fromRows (usePrefixes: bool) (rows: seq) = - let aPrefix, cPrefix = - if usePrefixes then - Some assaysPrefix, Some contactsPrefix - else None, None - let en = rows.GetEnumerator() - let rec loop lastRow assays contacts rowNumber = - - match lastRow with - | Some prefix when prefix = assaysLabel || prefix = obsoleteAssaysLabel -> - let currentRow, rowNumber, _, assays = Assays.fromRows aPrefix (rowNumber + 1) en - loop currentRow assays contacts rowNumber - - | Some prefix when prefix = contactsLabel -> - let currentLine, rowNumber, _, contacts = Contacts.fromRows cPrefix (rowNumber + 1) en - loop currentLine assays contacts rowNumber - | _ -> - match assays, contacts with - | [], [] -> ArcAssay.create(Identifier.createMissingIdentifier()) - | assays, contacts -> - assays - |> Seq.tryHead - |> Option.defaultValue (ArcAssay.create(Identifier.createMissingIdentifier())) - |> ArcAssay.setPerformers (ResizeArray contacts) - - if en.MoveNext () then - let currentLine = en.Current |> SparseRow.tryGetValueAt 0 - loop currentLine [] [] 1 - - else - failwith "empty assay metadata sheet" let rows = collection - |> Seq.map SparseRow.fromAllValues - let hasPrefix = - rows - |> Seq.exists (fun row -> row |> Seq.head |> snd |> fun s -> s.StartsWith(assaysPrefix)) + |> Seq.map SparseRow.fromAllValues rows - |> fromRows hasPrefix + |> fromRows with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message diff --git a/src/Spreadsheet/ArcStudy.fs b/src/Spreadsheet/ArcStudy.fs index c19a10e1..5b6e6c99 100644 --- a/src/Spreadsheet/ArcStudy.fs +++ b/src/Spreadsheet/ArcStudy.fs @@ -1,9 +1,8 @@ namespace ARCtrl.Spreadsheet open ARCtrl -open FsSpreadsheet - open ARCtrl.Helper +open FsSpreadsheet module ArcStudy = @@ -25,13 +24,14 @@ module ArcStudy = |> Seq.iteri (fun rowI r -> SparseRow.writeToSheet (rowI + 1) r sheet) sheet + let fromRows (rows: seq) = + let en = rows.GetEnumerator() + en.MoveNext() |> ignore + let _, _, _,study = Studies.fromRows 2 en + study + let fromMetadataSheet (sheet: FsWorksheet) : ArcStudy*ArcAssay list = - try - let fromRows (rows: seq) = - let en = rows.GetEnumerator() - en.MoveNext() |> ignore - let _, _, _,study = Studies.fromRows 2 en - study + try sheet.Rows |> Seq.map SparseRow.fromFsRow |> fromRows @@ -46,11 +46,6 @@ module ArcStudy = let fromMetadataCollection (collection: seq>) : ArcStudy*ArcAssay list = try - let fromRows (rows: seq) = - let en = rows.GetEnumerator() - en.MoveNext() |> ignore - let _, _, _,study = Studies.fromRows 2 en - study collection |> Seq.map SparseRow.fromAllValues |> fromRows diff --git a/src/Spreadsheet/Template.fs b/src/Spreadsheet/Template.fs index 0980d841..7215c231 100644 --- a/src/Spreadsheet/Template.fs +++ b/src/Spreadsheet/Template.fs @@ -1,9 +1,9 @@ namespace ARCtrl.Spreadsheet open FsSpreadsheet +open ARCtrl open ARCtrl.Helper open ARCtrl.Spreadsheet -open ARCtrl open System.Collections.Generic exception TemplateReadError of string diff --git a/tests/Spreadsheet/InvestigationFileTests.fs b/tests/Spreadsheet/InvestigationFileTests.fs index 76f2cdc8..fb66712c 100644 --- a/tests/Spreadsheet/InvestigationFileTests.fs +++ b/tests/Spreadsheet/InvestigationFileTests.fs @@ -186,6 +186,7 @@ let private testInvestigationFile = Expect.sequenceEqual i.RegisteredStudyIdentifiers studyIdentifiers "Registered study Identifier were not written and read correctly" ) testCase "TestMetadataCollection" (fun () -> + let investigation = Investigation.BII_I_1.fullInvestigation |> ArcInvestigation.fromFsWorkbook From 79f4fdef1c2ee756872e33ca7cfdaa0484ea5a2b Mon Sep 17 00:00:00 2001 From: patrick blume Date: Tue, 15 Oct 2024 11:28:58 +0200 Subject: [PATCH 10/11] Adapt parameter styling --- src/ARCtrl/packages.lock.json | 109 +++++++--------------------- src/Spreadsheet/ArcAssay.fs | 24 +++--- src/Spreadsheet/ArcInvestigation.fs | 30 ++++---- src/Spreadsheet/ArcStudy.fs | 22 +++--- src/Spreadsheet/Template.fs | 52 ++++++------- 5 files changed, 89 insertions(+), 148 deletions(-) diff --git a/src/ARCtrl/packages.lock.json b/src/ARCtrl/packages.lock.json index 264dde03..74c257d7 100644 --- a/src/ARCtrl/packages.lock.json +++ b/src/ARCtrl/packages.lock.json @@ -8,18 +8,6 @@ "resolved": "1.1.0", "contentHash": "YEMSyiB/HCpBgDSZUr0LHaTa9vYH+xj8Fvd/AvzUAVbLQ3Bc2l9xHOI9g4+Bh1wGsLFrhMwFW+U39D7m5a6oOw==" }, - "Fable.SimpleHttp": { - "type": "Direct", - "requested": "[3.5.0, )", - "resolved": "3.5.0", - "contentHash": "SWYshvAI90JcdGLsUmTWBG9eaazY6ihdIk/uehrEz/VqMx9qX+e7+PzYaw31DMwGYSva9/mpq9s69T/z8Ubl5Q==", - "dependencies": { - "FSharp.Core": "4.6.2", - "Fable.Browser.Dom": "1.0.0", - "Fable.Browser.XMLHttpRequest": "1.1.0", - "Fable.Core": "3.0.0" - } - }, "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", @@ -29,68 +17,26 @@ "Microsoft.NETCore.Platforms": "1.1.0" } }, - "Thoth.Json.Newtonsoft": { + "Thoth.Json.Python": { "type": "Direct", - "requested": "[0.2.0, )", - "resolved": "0.2.0", - "contentHash": "dMQOT6TJftO97c8gHWFegfSw/0/E+VdhGaSkf3e1Ba+DjrAESLA9HMlYyE30x7nhn7w5SfH1WO9YyzSRTV4Ysg==", + "requested": "[0.4.0, )", + "resolved": "0.4.0", + "contentHash": "O86Oisv/91NpbHENz11poZh9zrTRJdAjDXHVC1JqvDDsscelI7HxOmWgks8ZFvYxbBzNJCG+FKQHC10KzyMf8g==", "dependencies": { "FSharp.Core": "5.0.0", "Fable.Core": "4.1.0", - "Fable.Package.SDK": "0.1.0", - "Newtonsoft.Json": "13.0.1", - "Thoth.Json.Core": "0.3.0" - } - }, - "Fable.Browser.Blob": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "xMX7hPFwBUGuj75xLlH6VsVThZjRlGW4zOqXb1X+byRPLSBE91vtn9EueNUB+YpGhE9LfrtakIPNGy+dkoMkjg==", - "dependencies": { - "FSharp.Core": "4.6.2", - "Fable.Core": "3.0.0" - } - }, - "Fable.Browser.Dom": { - "type": "Transitive", - "resolved": "1.0.0", - "contentHash": "ZodpIKYuKnUnqN71Fi103mh0joFYrRPGwpYOrpbZ149PkVAW7DNKXgxad5lsi9df7vAe5+sBhhO71TPREZaWlw==", - "dependencies": { - "FSharp.Core": "4.5.2", - "Fable.Browser.Blob": "1.0.0", - "Fable.Browser.Event": "1.0.0", - "Fable.Browser.WebStorage": "1.0.0", - "Fable.Core": "3.0.0" - } - }, - "Fable.Browser.Event": { - "type": "Transitive", - "resolved": "1.0.0", - "contentHash": "T1bGrlRJ4A2fxOfAVPzJpxanR6lkzPgJroPdSN1IU5CLdKtvRakWmYq6QKqu4dz6ZV9Z3fIPTWLZkoGKEOEo3w==", - "dependencies": { - "FSharp.Core": "4.5.2", - "Fable.Core": "3.0.0" - } - }, - "Fable.Browser.WebStorage": { - "type": "Transitive", - "resolved": "1.0.0", - "contentHash": "ZqnZKYkhPO+wmJPxQqtiwSc3zCC/mB37SPlVi4ZLiHoPFnra7SQ3qaRn4/ENYTeaVtVq92eVaYbTyAOnFn+GPA==", - "dependencies": { - "FSharp.Core": "4.5.2", - "Fable.Browser.Event": "1.0.0", - "Fable.Core": "3.0.0" + "Fable.Package.SDK": "1.0.0", + "Fable.Python": "4.3.0", + "Thoth.Json.Core": "0.4.0" } }, - "Fable.Browser.XMLHttpRequest": { + "Fable.Python": { "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "27p/F8781NrnV9vQ23RhX10ww9MDkX+Yi3yTiV9s8U8Bufi/VCCjS4swX0LXvgKQANN3k87CwaNeiO75r2U7gw==", + "resolved": "4.3.0", + "contentHash": "KT5PI4NyMtVLDcmDkf5SeqwtFjVO17u27xr45qXfYWG12UePHxGjQJoI16OafIzlEQ6cHfAuRljhZGKIlvOJNQ==", "dependencies": { - "FSharp.Core": "4.6.2", - "Fable.Browser.Blob": "1.1.0", - "Fable.Browser.Event": "1.0.0", - "Fable.Core": "3.0.0" + "FSharp.Core": "4.7.2", + "Fable.Core": "[4.1.0, 5.0.0)" } }, "Microsoft.NETCore.Platforms": { @@ -98,25 +44,20 @@ "resolved": "1.1.0", "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" }, - "Newtonsoft.Json": { - "type": "Transitive", - "resolved": "13.0.1", - "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==" - }, "arctrl.contract": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )", - "ARCtrl.Json": "[1.0.0, )", - "ARCtrl.Spreadsheet": "[1.0.0, )", - "ARCtrl.Yaml": "[1.0.0, )" + "ARCtrl.Core": "[2.1.0, )", + "ARCtrl.Json": "[2.1.0, )", + "ARCtrl.Spreadsheet": "[2.1.0, )", + "ARCtrl.Yaml": "[2.1.0, )" } }, "arctrl.core": { "type": "Project", "dependencies": { - "ARCtrl.CWL": "[1.0.0, )", - "ARCtrl.FileSystem": "[1.0.0, )" + "ARCtrl.CWL": "[2.1.0, )", + "ARCtrl.FileSystem": "[2.1.0, )" } }, "arctrl.cwl": { @@ -131,8 +72,8 @@ "arctrl.json": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )", - "ARCtrl.ROCrate": "[1.0.0, )", + "ARCtrl.Core": "[2.1.0, )", + "ARCtrl.ROCrate": "[2.1.0, )", "Thoth.Json.Core": "[0.4.0, )" } }, @@ -146,22 +87,22 @@ "arctrl.spreadsheet": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )", - "ARCtrl.FileSystem": "[1.0.0, )", + "ARCtrl.Core": "[2.1.0, )", + "ARCtrl.FileSystem": "[2.1.0, )", "FsSpreadsheet": "[6.3.0-alpha.4, )" } }, "arctrl.validationpackages": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )" + "ARCtrl.Core": "[2.1.0, )" } }, "arctrl.yaml": { "type": "Project", "dependencies": { - "ARCtrl.Core": "[1.0.0, )", - "ARCtrl.ValidationPackages": "[1.0.0, )", + "ARCtrl.Core": "[2.1.0, )", + "ARCtrl.ValidationPackages": "[2.1.0, )", "YAMLicious": "[0.0.1, )" } }, diff --git a/src/Spreadsheet/ArcAssay.fs b/src/Spreadsheet/ArcAssay.fs index 9e0de8db..08703e7a 100644 --- a/src/Spreadsheet/ArcAssay.fs +++ b/src/Spreadsheet/ArcAssay.fs @@ -16,7 +16,7 @@ module ArcAssay = let [] obsoleteMetadataSheetName = "Assay" let [] metadataSheetName = "isa_assay" - let fromRows (rows: seq) = + let fromRows (rows : seq) = let hasPrefix = rows |> Seq.exists (fun row -> row |> Seq.head |> snd |> fun s -> s.StartsWith(assaysPrefix)) @@ -51,7 +51,7 @@ module ArcAssay = else failwith "empty assay metadata sheet" - let toRows (assay: ArcAssay) = + let toRows (assay : ArcAssay) = seq { yield SparseRow.fromValues [assaysLabel] yield! Assays.toRows (Some assaysPrefix) [assay] @@ -60,14 +60,14 @@ module ArcAssay = yield! Contacts.toRows (Some contactsPrefix) (List.ofSeq assay.Performers) } - let toMetadataSheet (assay: ArcAssay) : FsWorksheet = + let toMetadataSheet (assay : ArcAssay) : FsWorksheet = let sheet = FsWorksheet(metadataSheetName) assay |> toRows |> Seq.iteri (fun rowI r -> SparseRow.writeToSheet (rowI + 1) r sheet) sheet - let fromMetadataSheet (sheet: FsWorksheet) : ArcAssay = + let fromMetadataSheet (sheet : FsWorksheet) : ArcAssay = try let rows = sheet.Rows @@ -80,12 +80,12 @@ module ArcAssay = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message - let toMetadataCollection (assay: ArcAssay) = + let toMetadataCollection (assay : ArcAssay) = assay |> toRows |> Seq.map (fun row -> SparseRow.getAllValues row) - let fromMetadataCollection (collection: seq>) : ArcAssay = + let fromMetadataCollection (collection : seq>) : ArcAssay = try let rows = collection @@ -95,13 +95,13 @@ module ArcAssay = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message - let isMetadataSheetName (name: string) = + let isMetadataSheetName (name : string) = name = metadataSheetName || name = obsoleteMetadataSheetName - let isMetadataSheet (sheet: FsWorksheet) = + let isMetadataSheet (sheet : FsWorksheet) = isMetadataSheetName sheet.Name - let tryGetMetadataSheet (doc: FsWorkbook) = + let tryGetMetadataSheet (doc : FsWorkbook) = doc.GetWorksheets() |> Seq.tryFind isMetadataSheet @@ -111,7 +111,7 @@ module ArcAssayExtensions = type ArcAssay with /// Reads an assay from a spreadsheet - static member fromFsWorkbook (doc: FsWorkbook) : ArcAssay = + static member fromFsWorkbook (doc : FsWorkbook) : ArcAssay = try // Reading the "Assay" metadata sheet. Here metadata let assayMetadata = @@ -141,7 +141,7 @@ module ArcAssayExtensions = /// /// /// Default: true - static member toFsWorkbook (assay: ArcAssay, ?datamapSheet: bool) = + static member toFsWorkbook (assay : ArcAssay, ?datamapSheet : bool) = let datamapSheet = defaultArg datamapSheet true let doc = new FsWorkbook() let metadataSheet = ArcAssay.toMetadataSheet (assay) @@ -159,5 +159,5 @@ module ArcAssayExtensions = /// Write an assay to a spreadsheet /// /// If datamapSheet is true, the datamap will be written to a worksheet inside assay workbook. - member this.ToFsWorkbook (?datamapSheet: bool) = + member this.ToFsWorkbook (?datamapSheet : bool) = ArcAssay.toFsWorkbook (this, ?datamapSheet = datamapSheet) \ No newline at end of file diff --git a/src/Spreadsheet/ArcInvestigation.fs b/src/Spreadsheet/ArcInvestigation.fs index 3f186956..31959f65 100644 --- a/src/Spreadsheet/ArcInvestigation.fs +++ b/src/Spreadsheet/ArcInvestigation.fs @@ -49,7 +49,7 @@ module ArcInvestigation = static member Labels = [identifierLabel; titleLabel; descriptionLabel; submissionDateLabel; publicReleaseDateLabel] - static member FromSparseTable (matrix: SparseTable) = + static member FromSparseTable (matrix : SparseTable) = let i = 0 @@ -67,7 +67,7 @@ module ArcInvestigation = comments - static member ToSparseTable (investigation: ArcInvestigation) = + static member ToSparseTable (investigation : ArcInvestigation) = let i = 1 let matrix = SparseTable.Create (keys = InvestigationInfo.Labels,length=2) let mutable commentKeys = [] @@ -88,16 +88,16 @@ module ArcInvestigation = {matrix with CommentKeys = commentKeys |> List.distinct |> List.rev} - static member fromRows lineNumber (rows: IEnumerator) = + static member fromRows lineNumber (rows : IEnumerator) = SparseTable.FromRows(rows, InvestigationInfo.Labels, lineNumber) |> fun (s, ln, rs, sm) -> (s, ln, rs, InvestigationInfo.FromSparseTable sm) - static member toRows (investigation: ArcInvestigation) = + static member toRows (investigation : ArcInvestigation) = investigation |> InvestigationInfo.ToSparseTable |> SparseTable.ToRows - let fromParts (investigationInfo: InvestigationInfo) (ontologySourceReference: OntologySourceReference list) (publications: Publication list) (contacts: Person list) (studies: ArcStudy list) (assays: ArcAssay list) (remarks: Remark list) = + let fromParts (investigationInfo : InvestigationInfo) (ontologySourceReference : OntologySourceReference list) (publications : Publication list) (contacts : Person list) (studies : ArcStudy list) (assays : ArcAssay list) (remarks : Remark list) = let studyIdentifiers = studies |> List.map (fun s -> s.Identifier) ArcInvestigation.make investigationInfo.Identifier @@ -114,7 +114,7 @@ module ArcInvestigation = (ResizeArray investigationInfo.Comments) (ResizeArray remarks) - let fromRows (rows: seq) = + let fromRows (rows : seq) = let en = rows.GetEnumerator() let emptyInvestigationInfo = InvestigationInfo.create "" "" "" "" "" [] @@ -162,8 +162,8 @@ module ArcInvestigation = failwith "emptyInvestigationFile" - let toRows (investigation: ArcInvestigation) : seq = - let insertRemarks (remarks: Remark list) (rows: seq) = + let toRows (investigation : ArcInvestigation) : seq = + let insertRemarks (remarks : Remark list) (rows : seq) = try let rm = remarks |> List.map Remark.toTuple |> Map.ofList let rec loop i l nl = @@ -200,22 +200,22 @@ module ArcInvestigation = |> insertRemarks (List.ofSeq investigation.Remarks) |> seq - let toMetadataCollection (investigation: ArcInvestigation) = + let toMetadataCollection (investigation : ArcInvestigation) = toRows investigation |> Seq.map (fun row -> SparseRow.getAllValues row) - let fromMetadataCollection (collection: seq>) = + let fromMetadataCollection (collection : seq>) = collection |> Seq.map SparseRow.fromAllValues |> fromRows - let isMetadataSheetName (name: string) = + let isMetadataSheetName (name : string) = name = metadataSheetName || name = obsoleteMetadataSheetName - let isMetadataSheet (sheet: FsWorksheet) = + let isMetadataSheet (sheet : FsWorksheet) = isMetadataSheetName sheet.Name - let tryGetMetadataSheet (doc: FsWorkbook) = + let tryGetMetadataSheet (doc : FsWorkbook) = doc.GetWorksheets() |> Seq.tryFind isMetadataSheet @@ -227,7 +227,7 @@ module ArcInvestigationExtensions = type ArcInvestigation with - static member fromFsWorkbook (doc: FsWorkbook) = + static member fromFsWorkbook (doc : FsWorkbook) = try match ArcInvestigation.tryGetMetadataSheet doc with | Some sheet -> sheet @@ -238,7 +238,7 @@ module ArcInvestigationExtensions = with | err -> failwithf "Could not read investigation from spreadsheet: %s" err.Message - static member toFsWorkbook (investigation: ArcInvestigation) : FsWorkbook = + static member toFsWorkbook (investigation : ArcInvestigation) : FsWorkbook = try let wb = new FsWorkbook() let sheet = FsWorksheet(metadataSheetName) diff --git a/src/Spreadsheet/ArcStudy.fs b/src/Spreadsheet/ArcStudy.fs index 5b6e6c99..eab64843 100644 --- a/src/Spreadsheet/ArcStudy.fs +++ b/src/Spreadsheet/ArcStudy.fs @@ -12,7 +12,7 @@ module ArcStudy = let [] obsoleteMetadataSheetName = "Study" let [] metadataSheetName = "isa_study" - let toMetadataSheet (study: ArcStudy) (assays: ArcAssay list option) : FsWorksheet = + let toMetadataSheet (study : ArcStudy) (assays : ArcAssay list option) : FsWorksheet = //let toRows (study:ArcStudy) assays = // seq { // yield SparseRow.fromValues [studiesLabel] @@ -24,13 +24,13 @@ module ArcStudy = |> Seq.iteri (fun rowI r -> SparseRow.writeToSheet (rowI + 1) r sheet) sheet - let fromRows (rows: seq) = + let fromRows (rows : seq) = let en = rows.GetEnumerator() en.MoveNext() |> ignore let _, _, _,study = Studies.fromRows 2 en study - let fromMetadataSheet (sheet: FsWorksheet) : ArcStudy*ArcAssay list = + let fromMetadataSheet (sheet : FsWorksheet) : ArcStudy*ArcAssay list = try sheet.Rows |> Seq.map SparseRow.fromFsRow @@ -39,12 +39,12 @@ module ArcStudy = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message - let toMetadataCollection (study: ArcStudy) (assays: ArcAssay list option) = + let toMetadataCollection (study : ArcStudy) (assays : ArcAssay list option) = Studies.toRows study assays |> Seq.append [SparseRow.fromValues [studiesLabel]] |> Seq.map (fun row -> SparseRow.getAllValues row) - let fromMetadataCollection (collection: seq>) : ArcStudy*ArcAssay list = + let fromMetadataCollection (collection : seq>) : ArcStudy*ArcAssay list = try collection |> Seq.map SparseRow.fromAllValues @@ -53,13 +53,13 @@ module ArcStudy = with | err -> failwithf "Failed while parsing metadatasheet: %s" err.Message - let isMetadataSheetName (name: string) = + let isMetadataSheetName (name : string) = name = metadataSheetName || name = obsoleteMetadataSheetName - let isMetadataSheet (sheet: FsWorksheet) = + let isMetadataSheet (sheet : FsWorksheet) = isMetadataSheetName sheet.Name - let tryGetMetadataSheet (doc: FsWorkbook) = + let tryGetMetadataSheet (doc : FsWorkbook) = doc.GetWorksheets() |> Seq.tryFind isMetadataSheet @@ -69,7 +69,7 @@ module ArcStudyExtensions = type ArcStudy with /// Reads an assay from a spreadsheet - static member fromFsWorkbook (doc: FsWorkbook) = + static member fromFsWorkbook (doc : FsWorkbook) = try // Reading the "Assay" metadata sheet. Here metadata let studyMetadata,assays = @@ -111,7 +111,7 @@ module ArcStudyExtensions = /// /// /// - static member toFsWorkbook (study: ArcStudy, ?assays: ArcAssay list, ?datamapSheet: bool) = + static member toFsWorkbook (study : ArcStudy, ?assays : ArcAssay list, ?datamapSheet : bool) = let datamapSheet = defaultArg datamapSheet true let doc = new FsWorkbook() let metadataSheet = ArcStudy.toMetadataSheet study assays @@ -126,5 +126,5 @@ module ArcStudyExtensions = doc - member this.ToFsWorkbook (?assays: ArcAssay list, ?datamapSheet: bool) = + member this.ToFsWorkbook (?assays : ArcAssay list, ?datamapSheet : bool) = ArcStudy.toFsWorkbook (this, ?assays = assays, ?datamapSheet = datamapSheet) \ No newline at end of file diff --git a/src/Spreadsheet/Template.fs b/src/Spreadsheet/Template.fs index 7215c231..bf4efd08 100644 --- a/src/Spreadsheet/Template.fs +++ b/src/Spreadsheet/Template.fs @@ -19,17 +19,17 @@ module Metadata = let labels = [erLabel;erTermAccessionNumberLabel;erTermSourceREFLabel] - let fromSparseTable (matrix: SparseTable) = + let fromSparseTable (matrix : SparseTable) = OntologyAnnotationSection.fromSparseTable erLabel erTermSourceREFLabel erTermAccessionNumberLabel matrix - let toSparseTable (designs: OntologyAnnotation list) = + let toSparseTable (designs : OntologyAnnotation list) = OntologyAnnotationSection.toSparseTable erLabel erTermSourceREFLabel erTermAccessionNumberLabel designs - let fromRows (prefix: string option) (rows: IEnumerator) = + let fromRows (prefix : string option) (rows : IEnumerator) = let nextHeader, _, _, ers = OntologyAnnotationSection.fromRows prefix erLabel erTermSourceREFLabel erTermAccessionNumberLabel 0 rows nextHeader,ers - let toRows (prefix: string option) (designs: OntologyAnnotation list) = + let toRows (prefix : string option) (designs : OntologyAnnotation list) = OntologyAnnotationSection.toRows prefix erLabel erTermSourceREFLabel erTermAccessionNumberLabel designs module Tags = @@ -40,17 +40,17 @@ module Metadata = let labels = [tagsLabel; tagsTermAccessionNumberLabel; tagsTermSourceREFLabel] - let fromSparseTable (matrix: SparseTable) = + let fromSparseTable (matrix : SparseTable) = OntologyAnnotationSection.fromSparseTable tagsLabel tagsTermSourceREFLabel tagsTermAccessionNumberLabel matrix - let toSparseTable (designs: OntologyAnnotation list) = + let toSparseTable (designs : OntologyAnnotation list) = OntologyAnnotationSection.toSparseTable tagsLabel tagsTermSourceREFLabel tagsTermAccessionNumberLabel designs - let fromRows (prefix: string option) (rows: IEnumerator) = + let fromRows (prefix : string option) (rows : IEnumerator) = let nextHeader, _, _, tags = OntologyAnnotationSection.fromRows prefix tagsLabel tagsTermSourceREFLabel tagsTermAccessionNumberLabel 0 rows nextHeader, tags - let toRows (prefix: string option) (designs: OntologyAnnotation list) = + let toRows (prefix : string option) (designs : OntologyAnnotation list) = OntologyAnnotationSection.toRows prefix tagsLabel tagsTermSourceREFLabel tagsTermAccessionNumberLabel designs module Authors = @@ -98,7 +98,7 @@ module Metadata = static member Labels = [identifierLabel; nameLabel; versionLabel; descriptionLabel; organisationLabel; tableLabel] - static member FromSparseTable (matrix: SparseTable) = + static member FromSparseTable (matrix : SparseTable) = let i = 0 @@ -117,7 +117,7 @@ module Metadata = comments - static member ToSparseTable (template: Template) = + static member ToSparseTable (template : Template) = let i = 1 let matrix = SparseTable.Create (keys = TemplateInfo.Labels, length = 2) let mutable commentKeys = [] @@ -134,17 +134,17 @@ module Metadata = {matrix with CommentKeys = commentKeys |> List.distinct |> List.rev} - static member fromRows (rows: IEnumerator) = - SparseTable.FromRows(rows,TemplateInfo.Labels, 0) + static member fromRows (rows : IEnumerator) = + SparseTable.FromRows(rows, TemplateInfo.Labels, 0) |> fun (s, _, _, sm) -> (s, TemplateInfo.FromSparseTable sm) - static member toRows (template: Template) = + static member toRows (template : Template) = template |> TemplateInfo.ToSparseTable |> SparseTable.ToRows - let mapDeprecatedKeys (rows: seq) = + let mapDeprecatedKeys (rows : seq) = rows |> Seq.map (fun r -> r @@ -176,9 +176,9 @@ module Metadata = if Seq.head s |> SparseRow.tryGetValueAt 0 |> Option.exists (fun v -> v = templateLabel) then s else Seq.append (SparseRow.fromValues [templateLabel] |> Seq.singleton) s - let fromRows (rows: seq) = + let fromRows (rows : seq) = - let rec loop en lastLine (templateInfo: TemplateInfo) ers tags authors = + let rec loop en lastLine (templateInfo : TemplateInfo) ers tags authors = match lastLine with @@ -202,7 +202,7 @@ module Metadata = loop en currentLine item [] [] [] - let toRows (template: Template) = + let toRows (template : Template) = seq { yield SparseRow.fromValues [templateLabel] yield! TemplateInfo.toRows template @@ -226,7 +226,7 @@ module Template = let [] metaDataSheetName = "isa_template" let [] obsoletemetaDataSheetName = "SwateTemplateMetadata" - let fromParts (templateInfo: TemplateInfo) (ers: OntologyAnnotation list) (tags: OntologyAnnotation list) (authors: Person list) (table: ArcTable) (lastUpdated: System.DateTime) = + let fromParts (templateInfo : TemplateInfo) (ers : OntologyAnnotation list) (tags : OntologyAnnotation list) (authors : Person list) (table : ArcTable) (lastUpdated : System.DateTime) = Template.make (System.Guid templateInfo.Id) table @@ -239,28 +239,28 @@ module Template = (ResizeArray tags) lastUpdated - let toMetadataSheet (template: Template) : FsWorksheet = + let toMetadataSheet (template : Template) : FsWorksheet = let sheet = FsWorksheet(metaDataSheetName) Template.toRows template |> Seq.iteri (fun rowI r -> SparseRow.writeToSheet (rowI + 1) r sheet) sheet - let fromMetadataSheet (sheet: FsWorksheet) = + let fromMetadataSheet (sheet : FsWorksheet) = sheet.Rows |> Seq.map SparseRow.fromFsRow |> Template.fromRows - let toMetadataCollection (template: Template) = + let toMetadataCollection (template : Template) = Template.toRows template |> Seq.map (fun row -> SparseRow.getAllValues row) - let fromMetadataCollection (collection: seq>) = + let fromMetadataCollection (collection : seq>) = collection |> Seq.map SparseRow.fromAllValues |> Template.fromRows /// Reads an assay from a spreadsheet - let fromFsWorkbook (doc: FsWorkbook) = + let fromFsWorkbook (doc : FsWorkbook) = // Reading the "Assay" metadata sheet. Here metadata let templateInfo, ers, tags, authors = @@ -274,10 +274,10 @@ module Template = | None -> Metadata.Template.TemplateInfo.empty, [], [], [] - let tryTableNameMatches (ws: FsWorksheet) = + let tryTableNameMatches (ws : FsWorksheet) = if ws.Tables |> Seq.exists (fun t -> t.Name = templateInfo.Table) then Some ws else None - let tryWSNameMatches (ws: FsWorksheet) = + let tryWSNameMatches (ws : FsWorksheet) = if ws.Name = templateInfo.Table then Some ws else None let sheets = doc.GetWorksheets() @@ -301,7 +301,7 @@ module Template = fromParts templateInfo ers tags authors table (System.DateTime.Now) - let toFsWorkbook (template: Template) = + let toFsWorkbook (template : Template) = let doc = new FsWorkbook() let metaDataSheet = toMetadataSheet template doc.AddWorksheet metaDataSheet From 36f78d425a11f7a11015cecab8b42af52910516e Mon Sep 17 00:00:00 2001 From: Heinrich Lukas Weil Date: Tue, 15 Oct 2024 12:00:18 +0200 Subject: [PATCH 11/11] small undo of styling change --- src/Spreadsheet/DataMap.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Spreadsheet/DataMap.fs b/src/Spreadsheet/DataMap.fs index eaf37eba..0e3076d3 100644 --- a/src/Spreadsheet/DataMap.fs +++ b/src/Spreadsheet/DataMap.fs @@ -5,7 +5,7 @@ open ArcTable open FsSpreadsheet /// Reads an datamap from a spreadsheet -let fromFsWorkbook (doc: FsWorkbook) = +let fromFsWorkbook (doc : FsWorkbook) = try let dataMapTable = doc.GetWorksheets() @@ -16,7 +16,7 @@ let fromFsWorkbook (doc: FsWorkbook) = with | err -> failwithf "Could not parse datamap: \n%s" err.Message -let toFsWorkbook (dataMap: DataMap) = +let toFsWorkbook (dataMap : DataMap) = let doc = new FsWorkbook() DataMapTable.toFsWorksheet dataMap