From f60edbdc8e4e76c56fe726bd45feb54b90322b8a Mon Sep 17 00:00:00 2001 From: Heinrich Weil Date: Sat, 9 Oct 2021 23:36:32 +0200 Subject: [PATCH] adjust xlsx io to FSharpSpreadsheetML 0.0.7 --- .../AssayFile/AnnotationNode.fs | 34 +++++------ .../AssayFile/AnnotationTable.fs | 2 +- src/ISADotNet.XLSX/AssayFile/Assay.fs | 26 ++++---- src/ISADotNet.XLSX/ISADotNet.XLSX.fsproj | 2 +- .../InvestigationFile/Investigation.fs | 2 +- .../ISADotNet.XLSX/AssayFileTests.fs | 60 ++++++++++--------- 6 files changed, 68 insertions(+), 58 deletions(-) diff --git a/src/ISADotNet.XLSX/AssayFile/AnnotationNode.fs b/src/ISADotNet.XLSX/AssayFile/AnnotationNode.fs index 12e13d30..e4560dfc 100644 --- a/src/ISADotNet.XLSX/AssayFile/AnnotationNode.fs +++ b/src/ISADotNet.XLSX/AssayFile/AnnotationNode.fs @@ -135,12 +135,12 @@ module AnnotationNode = Seq.tryPick tryParseUnitHeader headers |> Option.map (fun h -> let unitNameGetter matrix i = - Dictionary.tryGetValue (h.HeaderString,i) matrix + Dictionary.tryGetValue (i,h.HeaderString) matrix let termAccessionGetter = match Seq.tryPick (tryParseTermAccessionNumberHeader h) headers with | Some h -> fun matrix i -> - match Dictionary.tryGetValue (h.HeaderString,i) matrix with + match Dictionary.tryGetValue (i,h.HeaderString) matrix with | Some "user-specific" -> None | Some v -> Some v | _ -> None @@ -149,12 +149,12 @@ module AnnotationNode = match Seq.tryPick (tryParseTermSourceReferenceHeader h) headers with | Some h -> fun matrix i -> - match Dictionary.tryGetValue (h.HeaderString,i) matrix with + match Dictionary.tryGetValue (i,h.HeaderString) matrix with | Some "user-specific" -> None | Some v -> Some v | _ -> None | None -> fun _ _ -> None - fun (matrix : System.Collections.Generic.Dictionary<(string * int),string>) i -> + fun (matrix : System.Collections.Generic.Dictionary<(int * string),string>) i -> OntologyAnnotation.make None (unitNameGetter matrix i |> Option.map AnnotationValue.fromString) @@ -169,8 +169,8 @@ module AnnotationNode = match Seq.tryPick (tryParseTermAccessionNumberHeader valueHeader) headers with | Some h -> h.Term, - fun matrix i -> - match Dictionary.tryGetValue (h.HeaderString,i) matrix with + fun (matrix:System.Collections.Generic.Dictionary) (i:int) -> + match Dictionary.tryGetValue (i,h.HeaderString) matrix with | Some "user-specific" -> None | Some v -> Some v | _ -> None @@ -180,7 +180,7 @@ module AnnotationNode = | Some h -> h.Term, fun matrix i -> - match Dictionary.tryGetValue (h.HeaderString,i) matrix with + match Dictionary.tryGetValue (i,h.HeaderString) matrix with | Some "user-specific" -> None | Some v -> Some v | _ -> None @@ -199,7 +199,7 @@ module AnnotationNode = let valueGetter = fun matrix i -> let value = - match Dictionary.tryGetValue (valueHeader.HeaderString,i) matrix with + match Dictionary.tryGetValue (i,valueHeader.HeaderString) matrix with | Some "user-specific" -> None // Trim() should remove any accidental whitespaces at the beginning or end of a term | Some v -> Some v @@ -235,7 +235,7 @@ module AnnotationNode = let parameter = category |> Option.map (Some >> ProtocolParameter.make None) parameter, - fun (matrix : System.Collections.Generic.Dictionary<(string * int),string>) i -> + fun (matrix : System.Collections.Generic.Dictionary<(int * string),string>) i -> ProcessParameterValue.make parameter (valueGetter matrix i) @@ -257,7 +257,7 @@ module AnnotationNode = ) factor, - fun (matrix : System.Collections.Generic.Dictionary<(string * int),string>) i -> + fun (matrix : System.Collections.Generic.Dictionary<(int * string),string>) i -> FactorValue.make None factor @@ -276,7 +276,7 @@ module AnnotationNode = let characteristic = category |> Option.map (Some >> MaterialAttribute.make None) characteristic, - fun (matrix : System.Collections.Generic.Dictionary<(string * int),string>) i -> + fun (matrix : System.Collections.Generic.Dictionary<(int * string),string>) i -> MaterialAttributeValue.make None characteristic @@ -296,11 +296,11 @@ module AnnotationNode = else None let numberComment = h.Number |> Option.map (string >> (Comment.fromString "Number") >> List.singleton) - fun (matrix : System.Collections.Generic.Dictionary<(string * int),string>) i -> + fun (matrix : System.Collections.Generic.Dictionary<(int * string),string>) i -> Data.make None - (Dictionary.tryGetValue (h.HeaderString,i) matrix) + (Dictionary.tryGetValue (i,h.HeaderString) matrix) dataType numberComment ) @@ -309,16 +309,16 @@ module AnnotationNode = let tryGetSampleNameGetter (headers:string seq) = Seq.tryPick tryParseSampleName headers |> Option.map (fun h -> - fun (matrix : System.Collections.Generic.Dictionary<(string * int),string>) i -> - Dictionary.tryGetValue (h.HeaderString,i) matrix + fun (matrix : System.Collections.Generic.Dictionary<(int * string),string>) i -> + Dictionary.tryGetValue (i,h.HeaderString) matrix ) /// If the headers of a node depict a source name, returns a function for parsing the values of the matrix to the source names let tryGetSourceNameGetter (headers:string seq) = Seq.tryPick tryParseSourceName headers |> Option.map (fun h -> - fun (matrix : System.Collections.Generic.Dictionary<(string * int),string>) i -> - Dictionary.tryGetValue (h.HeaderString,i) matrix + fun (matrix : System.Collections.Generic.Dictionary<(int * string),string>) i -> + Dictionary.tryGetValue (i,h.HeaderString) matrix ) /// Returns true, if the headers contain a value node: characteristic, parameter or factor diff --git a/src/ISADotNet.XLSX/AssayFile/AnnotationTable.fs b/src/ISADotNet.XLSX/AssayFile/AnnotationTable.fs index 30a16393..1bae5535 100644 --- a/src/ISADotNet.XLSX/AssayFile/AnnotationTable.fs +++ b/src/ISADotNet.XLSX/AssayFile/AnnotationTable.fs @@ -118,7 +118,7 @@ module AnnotationTable = characteristics, factors, protocol, - fun (matrix : System.Collections.Generic.Dictionary<(string * int),string>) i -> + fun (matrix : System.Collections.Generic.Dictionary<(int * string),string>) i -> Process.make None None diff --git a/src/ISADotNet.XLSX/AssayFile/Assay.fs b/src/ISADotNet.XLSX/AssayFile/Assay.fs index 5efea78e..eda3ed0a 100644 --- a/src/ISADotNet.XLSX/AssayFile/Assay.fs +++ b/src/ISADotNet.XLSX/AssayFile/Assay.fs @@ -14,11 +14,11 @@ module Process = /// matrixHeaders are the column headers of the table /// /// sparseMatrix is a sparse representation of the sheet table, with the first part of the key being the column header and the second part being a zero based row index - let fromSparseMatrix (processNameRoot:string) matrixHeaders (sparseMatrix : Dictionary) = + let fromSparseMatrix (processNameRoot:string) matrixHeaders (sparseMatrix : Dictionary) = let len = let mutable i = 0 for kv in sparseMatrix do - let j = kv.Key |> snd + let j = kv.Key |> fst if j > i then i <- j i + 1 let characteristic,factors,protocol,processGetter = @@ -46,14 +46,14 @@ module Assay = /// matrixHeaders are the column headers of the table /// /// sparseMatrix is a sparse representation of the sheet table, with the first part of the key being the column header and the second part being a zero based row index - let fromSparseMatrix (processNameRoot:string) matrixHeaders (sparseMatrix : Dictionary) = + let fromSparseMatrix (processNameRoot:string) matrixHeaders (sparseMatrix : Dictionary) = let characteristics,factors,protocols,processes = Process.fromSparseMatrix processNameRoot matrixHeaders sparseMatrix factors,protocols,Assay.create(CharacteristicCategories = characteristics,ProcessSequence = Seq.toList processes) /// Returns an assay from a sequence of sparseMatrix representations of assay.xlsx sheets /// /// See "fromSparseMatrix" function for parameter documentation - let fromSparseMatrices (sheets : (string*(string seq)*Dictionary) seq) = + let fromSparseMatrices (sheets : (string*(string seq)*Dictionary) seq) = let characteristics,factors,protocols,processes = sheets |> Seq.map (fun (name,matrixHeaders,matrix) -> Process.fromSparseMatrix name matrixHeaders matrix) @@ -72,16 +72,20 @@ module Assay = /// Create a new ISADotNet.XLSX assay file constisting of two sheets. The first has the name of the assayIdentifier and is meant to store parameters used in the assay. The second stores additional assay metadata let init metadataSheetName assayIdentifier path = - Spreadsheet.initWithSST assayIdentifier path + Spreadsheet.initWithSst assayIdentifier path |> MetaData.init metadataSheetName |> Spreadsheet.close - /// Parses the assay file + /// Reads an assay from an xlsx spreadsheetdocument + /// + /// As factors and protocols are used for the investigation file, they are returned individually + /// + /// The persons from the metadata sheet are returned independently as they are not a part of the assay object let fromSpreadsheet (doc:DocumentFormat.OpenXml.Packaging.SpreadsheetDocument) = let sst = Spreadsheet.tryGetSharedStringTable doc - // Get the metadata from the metadata sheet + // Reading the "Investigation" metadata sheet. Here metadata let assayMetaData,contacts = Spreadsheet.tryGetSheetBySheetName "Investigation" doc |> Option.map (fun sheet -> @@ -93,7 +97,8 @@ module Assay = |> fun (a,p) -> Option.defaultValue Assay.empty a, p ) |> Option.defaultValue (Assay.empty,[]) - + + // All sheetnames in the spreadsheetDocument let sheetNames = Spreadsheet.getWorkbookPart doc |> Workbook.get @@ -108,6 +113,7 @@ module Assay = | Some wsp -> match Table.tryGetByNameBy (fun s -> s.StartsWith "annotationTable") wsp with | Some table -> + // Extract the sheetdata as a sparse matrix let sheet = Worksheet.getSheetData wsp.Worksheet let headers = Table.getColumnHeaders table let m = Table.toSparseValueMatrix sst sheet table @@ -115,12 +121,12 @@ module Assay = | None -> Seq.empty | None -> Seq.empty ) - |> fromSparseMatrices + |> fromSparseMatrices // Feed the sheets (represented as sparse matrices) into the assay parser function factors, protocols |> Seq.toList, contacts, - API.Update.UpdateByExisting.updateRecordType assayMetaData assay + API.Update.UpdateByExisting.updateRecordType assayMetaData assay // Merges the assay containing the assay meta data and the assay containing the processes retrieved from the sheets /// Parses the assay file let fromFile (path:string) = diff --git a/src/ISADotNet.XLSX/ISADotNet.XLSX.fsproj b/src/ISADotNet.XLSX/ISADotNet.XLSX.fsproj index fc3be68b..befb01c8 100644 --- a/src/ISADotNet.XLSX/ISADotNet.XLSX.fsproj +++ b/src/ISADotNet.XLSX/ISADotNet.XLSX.fsproj @@ -29,7 +29,7 @@ - + diff --git a/src/ISADotNet.XLSX/InvestigationFile/Investigation.fs b/src/ISADotNet.XLSX/InvestigationFile/Investigation.fs index 238fd964..29744c82 100644 --- a/src/ISADotNet.XLSX/InvestigationFile/Investigation.fs +++ b/src/ISADotNet.XLSX/InvestigationFile/Investigation.fs @@ -232,7 +232,7 @@ module Investigation = |> ignore let toFile (path : string) (investigation:Investigation) = - let doc = Spreadsheet.initWithSST "isa_investigation" path + let doc = Spreadsheet.initWithSst "isa_investigation" path try toSpreadsheet doc investigation finally diff --git a/tests/ISADotNet.Tests/ISADotNet.XLSX/AssayFileTests.fs b/tests/ISADotNet.Tests/ISADotNet.XLSX/AssayFileTests.fs index fe246367..78de3b90 100644 --- a/tests/ISADotNet.Tests/ISADotNet.XLSX/AssayFileTests.fs +++ b/tests/ISADotNet.Tests/ISADotNet.XLSX/AssayFileTests.fs @@ -93,7 +93,7 @@ let testNodeGetterFunctions = if b then Some v else None - let v = tryGetValue ("Unit",0) m + let v = tryGetValue (0,"Unit") m Expect.isSome v "Value could not be retrieved from matrix" @@ -131,7 +131,7 @@ let testNodeGetterFunctions = let headers = ["Characteristics [leaf size]";"Unit";"Term Source REF (TO:0002637)";"Term Accession Number (TO:0002637)"] - let characteristicGetterOption = AnnotationNode.tryGetCharacteristicGetter headers + let characteristicGetterOption = AnnotationNode.tryGetCharacteristicGetter 0 headers Expect.isSome characteristicGetterOption "Characteristic Getter was not returned even though headers should have matched" @@ -139,7 +139,7 @@ let testNodeGetterFunctions = Expect.isSome characteristic "CharacteristGetter was returned but not characteristic was returned" - let expectedCharacteristic = MaterialAttribute.fromString "leaf size" "TO" "http://purl.obolibrary.org/obo/TO_0002637" + let expectedCharacteristic = MaterialAttribute.fromStringWithValueOrder "leaf size" "TO" "http://purl.obolibrary.org/obo/TO_0002637" 0 Expect.equal characteristic.Value expectedCharacteristic "Retrieved Characteristic is wrong" @@ -157,7 +157,7 @@ let testNodeGetterFunctions = let headers = ["Parameter [square centimeter] (#h; #tUO:0000081; #u)";"Term Source REF [square centimeter] (#h; #tUO:0000081; #u)";"Term Accession Number [square centimeter] (#h; #tUO:0000081; #u)"] - let unitGetterOption = AnnotationNode.tryGetCharacteristicGetter headers + let unitGetterOption = AnnotationNode.tryGetCharacteristicGetter 0 headers Expect.isNone unitGetterOption "Characteristic Getter was returned even though headers should not have matched" ) @@ -165,7 +165,7 @@ let testNodeGetterFunctions = let headers = ["Factor [time]";"Unit (#2)";"Term Source REF (PATO:0000165)";"Term Accession Number (PATO:0000165)"] - let factorGetterOption = AnnotationNode.tryGetFactorGetter headers + let factorGetterOption = AnnotationNode.tryGetFactorGetter 0 headers Expect.isSome factorGetterOption "Factor Getter was not returned even though headers should have matched" @@ -173,7 +173,7 @@ let testNodeGetterFunctions = Expect.isSome factor "FactorGetter was returned but no factor was returned" - let expectedFactor = Factor.fromString "time" "time" "PATO" "http://purl.obolibrary.org/obo/PATO_0000165" + let expectedFactor = Factor.fromStringWithValueOrder "time" "time" "PATO" "http://purl.obolibrary.org/obo/PATO_0000165" 0 Expect.equal factor.Value expectedFactor "Retrieved Factor is wrong" @@ -191,7 +191,7 @@ let testNodeGetterFunctions = let headers = ["Parameter [square centimeter] (#h; #tUO:0000081; #u)";"Term Source REF [square centimeter] (#h; #tUO:0000081; #u)";"Term Accession Number [square centimeter] (#h; #tUO:0000081; #u)"] - let unitGetterOption = AnnotationNode.tryGetFactorGetter headers + let unitGetterOption = AnnotationNode.tryGetFactorGetter 0 headers Expect.isNone unitGetterOption "Facotr Getter was returned even though headers should not have matched" ) @@ -199,7 +199,7 @@ let testNodeGetterFunctions = let headers = ["Parameter [temperature unit]";"Unit (#3)";"Term Source REF (UO:0000005)";"Term Accession Number (UO:0000005)"] - let parameterGetterOption = AnnotationNode.tryGetParameterGetter headers + let parameterGetterOption = AnnotationNode.tryGetParameterGetter 0 headers Expect.isSome parameterGetterOption "Parameter Getter was not returned even though headers should have matched" @@ -207,7 +207,7 @@ let testNodeGetterFunctions = Expect.isSome parameter "ParameterGetter was returned but no parameter was returned" - let expectedParameter = ProtocolParameter.fromString "temperature unit" "UO" "http://purl.obolibrary.org/obo/UO_0000005" + let expectedParameter = ProtocolParameter.fromStringWithValueOrder "temperature unit" "UO" "http://purl.obolibrary.org/obo/UO_0000005" 0 Expect.equal parameter.Value expectedParameter "Retrieved Parameter is wrong" @@ -225,7 +225,7 @@ let testNodeGetterFunctions = let headers = ["Parameter [measurement device]";"Term Source REF (OBI:0000832)";"Term Accession Number (OBI:0000832)"] - let parameterGetterOption = AnnotationNode.tryGetParameterGetter headers + let parameterGetterOption = AnnotationNode.tryGetParameterGetter 0 headers Expect.isSome parameterGetterOption "Parameter Getter was not returned even though headers should have matched" @@ -235,7 +235,7 @@ let testNodeGetterFunctions = Expect.isSome parameter.Value.ParameterName.Value.TermSourceREF "Parameter has no TermSourceRef" - let expectedParameter = ProtocolParameter.fromString "measurement device" "OBI" "http://purl.obolibrary.org/obo/OBI_0000832" + let expectedParameter = ProtocolParameter.fromStringWithValueOrder "measurement device" "OBI" "http://purl.obolibrary.org/obo/OBI_0000832" 0 Expect.equal parameter.Value expectedParameter "Retrieved Parameter is wrong" @@ -251,7 +251,7 @@ let testNodeGetterFunctions = let headers = ["Parameter [heating block]";"Term Source REF (OBI:0400108)";"Term Accession Number (OBI:0400108)"] - let parameterGetterOption = AnnotationNode.tryGetParameterGetter headers + let parameterGetterOption = AnnotationNode.tryGetParameterGetter 0 headers Expect.isSome parameterGetterOption "Parameter Getter was not returned even though headers should have matched" @@ -259,7 +259,7 @@ let testNodeGetterFunctions = Expect.isSome parameter "ParameterGetter was returned but no parameter was returned" - let expectedParameter = ProtocolParameter.fromString "heating block" "OBI" "http://purl.obolibrary.org/obo/OBI_0400108" + let expectedParameter = ProtocolParameter.fromStringWithValueOrder "heating block" "OBI" "http://purl.obolibrary.org/obo/OBI_0400108" 0 Expect.equal parameter.Value expectedParameter "Retrieved Parameter is wrong" @@ -275,7 +275,7 @@ let testNodeGetterFunctions = let headers = ["Factor [square centimeter]";"Term Source REF (UO:0000081)";"Term Accession Number (UO:0000081)"] - let unitGetterOption = AnnotationNode.tryGetParameterGetter headers + let unitGetterOption = AnnotationNode.tryGetParameterGetter 0 headers Expect.isNone unitGetterOption "Facotr Getter was returned even though headers should not have matched" ) @@ -296,17 +296,17 @@ let testProcessGetter = let m = Table.toSparseValueMatrix sst (Worksheet.getSheetData wsp.Worksheet) table let characteristicHeaders = ["Characteristics [leaf size]";"Unit";"Term Source REF (TO:0002637)";"Term Accession Number (TO:0002637)"] - let expectedCharacteristic = MaterialAttribute.fromString "leaf size" "TO" "http://purl.obolibrary.org/obo/TO_0002637" + let expectedCharacteristic = MaterialAttribute.fromStringWithValueOrder "leaf size" "TO" "http://purl.obolibrary.org/obo/TO_0002637" 0 let expectedCharacteristicUnit = OntologyAnnotation.fromString "square centimeter" "UO" "http://purl.obolibrary.org/obo/UO_0000081" |> Some let expectedCharacteristicValue = MaterialAttributeValue.make None (Some expectedCharacteristic) (Value.fromOptions (Some "10") None None) expectedCharacteristicUnit let factorHeaders = ["Factor [time]";"Unit (#2)";"Term Source REF (PATO:0000165)";"Term Accession Number (PATO:0000165)"] - let expectedFactor = Factor.fromString "time" "time" "PATO" "http://purl.obolibrary.org/obo/PATO_0000165" + let expectedFactor = Factor.fromStringWithValueOrder "time" "time" "PATO" "http://purl.obolibrary.org/obo/PATO_0000165" 1 let expectedFactorUnit = OntologyAnnotation.fromString "hour" "UO" "http://purl.obolibrary.org/obo/UO_0000032"|> Some let expectedFactorValue = FactorValue.make None (Some expectedFactor) (Value.fromOptions (Some "5") None None) expectedFactorUnit let parameterHeaders = ["Parameter [temperature unit]";"Unit (#3)";"Term Source REF (UO:0000005)";"Term Accession Number (UO:0000005)"] - let expectedParameter = ProtocolParameter.fromString "temperature unit" "UO" "http://purl.obolibrary.org/obo/UO_0000005" + let expectedParameter = ProtocolParameter.fromStringWithValueOrder "temperature unit" "UO" "http://purl.obolibrary.org/obo/UO_0000005" 2 let expectedParameterUnit = OntologyAnnotation.fromString "degree Celsius" "UO" "http://purl.obolibrary.org/obo/UO_0000027" |> Some let expectedParameterValue = ProcessParameterValue.make (Some expectedParameter) (Value.fromOptions (Some "27") None None) expectedParameterUnit @@ -570,6 +570,7 @@ let testMetaDataFunctions = |> Option.get |> SheetData.getRows |> Seq.map (Row.mapCells (Cell.includeSharedStringValue sst)) + |> Seq.map (Row.getIndexedValues None >> Seq.map (fun (i,v) -> (int i) - 1, v)) let readingSuccess = try @@ -591,6 +592,7 @@ let testMetaDataFunctions = |> Option.get |> SheetData.getRows |> Seq.map (Row.mapCells (Cell.includeSharedStringValue sst)) + |> Seq.map (Row.getIndexedValues None >> Seq.map (fun (i,v) -> (int i) - 1, v)) let assay,contacts = AssayFile.MetaData.fromRows rows @@ -627,28 +629,30 @@ let testAssayFileReader = let fileName = @"GreatAssay\assay.isa.xlsx" - let temperatureUnit = ProtocolParameter.fromString "temperature unit" "UO" "http://purl.obolibrary.org/obo/UO_0000005" + let temperatureUnit = ProtocolParameter.fromStringWithValueOrder "temperature unit" "UO" "http://purl.obolibrary.org/obo/UO_0000005" 0 + - let temperature = ProtocolParameter.fromString "temperature" "" "" + let temperature = ProtocolParameter.fromStringWithValueOrder "temperature" "" "" 2 - let peptidase = ProtocolParameter.fromString "enzyme unit" "UO" "http://purl.obolibrary.org/obo/UO_0000181" + let peptidase = ProtocolParameter.fromStringWithValueOrder "enzyme unit" "UO" "http://purl.obolibrary.org/obo/UO_0000181" 1 - let time1 = ProtocolParameter.fromString "time unit" "UO" "http://purl.obolibrary.org/obo/UO_0000003" + let time1 = ProtocolParameter.fromStringWithValueOrder "time unit" "UO" "http://purl.obolibrary.org/obo/UO_0000003" 3 - let time2Comment = Comment.fromString "Number" "2" - let time2Ontology = OntologyAnnotation.make None (Some (AnnotationValue.Text "time unit")) (Some "UO") (Some "http://purl.obolibrary.org/obo/UO_0000003") (Some [time2Comment]) - let time2 = Factor.make None (Some "time unit") (Some time2Ontology) None + //let time2Comment = Comment.fromString "Number" "2" + //let time2Ontology = OntologyAnnotation.make None (Some (AnnotationValue.Text "time unit")) (Some "UO") (Some "http://purl.obolibrary.org/obo/UO_0000003") (Some [time2Comment]) + let time2 = Factor.fromStringWithNumberValueOrder "time unit" "time unit#2" "UO" "http://purl.obolibrary.org/obo/UO_0000003" 4 - let leafSize = MaterialAttribute.fromString "leaf size" "TO" "http://purl.obolibrary.org/obo/TO_0002637" + let leafSize = MaterialAttribute.fromStringWithValueOrder "leaf size" "TO" "http://purl.obolibrary.org/obo/TO_0002637" 0 + let temperatureUnit2 = ProtocolParameter.fromStringWithValueOrder "temperature unit" "UO" "http://purl.obolibrary.org/obo/UO_0000005" 1 testList "AssayFileReaderTests" [ testCase "ReaderSuccess" (fun () -> let readingSuccess = try - AssayFile.fromFile assayFilePath |> ignore + Assay.fromFile assayFilePath |> ignore Result.Ok "DidRun" with | err -> Result.Error(sprintf "Reading the test file failed: %s" err.Message) @@ -657,12 +661,12 @@ let testAssayFileReader = ) testCase "ReadsCorrectly" (fun () -> - let factors,protocols,persons,assay = AssayFile.fromFile assayFilePath + let factors,protocols,persons,assay = Assay.fromFile assayFilePath let expectedProtocols = [ Protocol.make None (Some "GreatAssay") None None None None (Some [temperatureUnit;peptidase;temperature;time1]) None None - Protocol.make None (Some "SecondAssay") None None None None (Some [temperatureUnit]) None None + Protocol.make None (Some "SecondAssay") None None None None (Some [temperatureUnit2]) None None ] let expectedFactors = [time2]