diff --git a/src/ISA/ISA.Json/Ontology.fs b/src/ISA/ISA.Json/Ontology.fs index 43bd68c6..2ad7dcce 100644 --- a/src/ISA/ISA.Json/Ontology.fs +++ b/src/ISA/ISA.Json/Ontology.fs @@ -109,27 +109,16 @@ module OntologyAnnotation = |> GEncode.choose |> Encode.object - let localIDDecoder : Decoder = - fun s json -> - match Decode.string s json with - | Ok (Regex.ActivePatterns.TermAnnotation tan) -> - Ok (tan.TermSourceREF) - | _ -> Ok "" - //| Ok s -> Error (DecoderError(s,ErrorReason.FailMessage "Could not parse local ID from string")) - //| Error e -> Error e - let decoder (options : ConverterOptions) : Decoder = Decode.object (fun get -> - { - ID = get.Optional.Field "@id" GDecode.uri - Name = get.Optional.Field "annotationValue" (AnnotationValue.decoder options) - TermSourceREF = get.Optional.Field "termSource" Decode.string - //LocalID = try get.Optional.Field "termAccession" localIDDecoder with | _ -> None - LocalID = get.Optional.Field "termAccession" localIDDecoder |> Option.bind (fun s -> if s = "" then None else Some s) - TermAccessionNumber = get.Optional.Field "termAccession" Decode.string - Comments = get.Optional.Field "comments" (Decode.array (Comment.decoder options)) - } + OntologyAnnotation.create( + ?Id = get.Optional.Field "@id" GDecode.uri, + ?Name = get.Optional.Field "annotationValue" (AnnotationValue.decoder options), + ?TermSourceREF = get.Optional.Field "termSource" Decode.string, + ?TermAccessionNumber = get.Optional.Field "termAccession" Decode.string, + ?Comments = get.Optional.Field "comments" (Decode.array (Comment.decoder options)) + ) ) let fromString (s:string) = diff --git a/src/ISA/ISA.Spreadsheet/CompositeHeader.fs b/src/ISA/ISA.Spreadsheet/CompositeHeader.fs index 8787555f..c0697e83 100644 --- a/src/ISA/ISA.Spreadsheet/CompositeHeader.fs +++ b/src/ISA/ISA.Spreadsheet/CompositeHeader.fs @@ -7,10 +7,10 @@ module ActivePattern = open ARCtrl.ISA.Regex.ActivePatterns - let mergeTerms tsr1 tan1 tsr2 tan2 = - if tsr1 <> tsr2 then failwithf "TermSourceRef %s and %s do not match" tsr1 tsr2 - if tan1 <> tan2 then failwithf "TermAccessionNumber %s and %s do not match" tan1 tan2 - {|TermSourceRef = tsr1; TermAccessionNumber = tan1|} + let mergeIDInfo idSpace1 localID1 idSpace2 localID2 = + if idSpace1 <> idSpace2 then failwithf "TermSourceRef %s and %s do not match" idSpace1 idSpace2 + if localID1 <> localID2 then failwithf "LocalID %s and %s do not match" localID1 localID2 + {|TermSourceRef = idSpace1; TermAccessionNumber = $"{idSpace1}:{localID1}"|} let (|Term|_|) (categoryParser : string -> string option) (f : OntologyAnnotation -> CompositeHeader) (cells : FsCell list) = let (|AC|_|) s = @@ -25,7 +25,7 @@ module ActivePattern = //| [AC name; TermAccessionNumber term1; TermSourceREF term2] //| [AC name; Unit; TermAccessionNumber term1; TermSourceREF term2] | [AC name; UnitColumnHeader; TSRColumnHeader term1; TANColumnHeader term2] -> - let term = mergeTerms term1.TermSourceREF term1.TermAccessionNumber term2.TermSourceREF term2.TermAccessionNumber + let term = mergeIDInfo term1.IDSpace term1.LocalID term2.IDSpace term2.LocalID let ont = OntologyAnnotation.fromString(name, term.TermSourceRef, term.TermAccessionNumber) f ont |> Some diff --git a/src/ISA/ISA/ArcTypes/CompositeCell.fs b/src/ISA/ISA/ArcTypes/CompositeCell.fs index e9967120..c1e8a1a2 100644 --- a/src/ISA/ISA/ArcTypes/CompositeCell.fs +++ b/src/ISA/ISA/ArcTypes/CompositeCell.fs @@ -75,10 +75,10 @@ type CompositeCell = // TODO: i would really love to have an overload here accepting string input static member createTerm (oa:OntologyAnnotation) = Term oa static member createTermFromString (?name: string, ?tsr: string, ?tan: string) = - Term <| OntologyAnnotation.fromString(?term = name, ?tsr = tsr, ?tan = tan) + Term <| OntologyAnnotation.fromString(?termName = name, ?tsr = tsr, ?tan = tan) static member createUnitized (value: string, ?oa:OntologyAnnotation) = Unitized (value, Option.defaultValue (OntologyAnnotation.empty) oa) static member createUnitizedFromString (value: string, ?name: string, ?tsr: string, ?tan: string) = - Unitized <| (value, OntologyAnnotation.fromString(?term = name, ?tsr = tsr, ?tan = tan)) + Unitized <| (value, OntologyAnnotation.fromString(?termName = name, ?tsr = tsr, ?tan = tan)) static member createFreeText (value: string) = FreeText value static member emptyTerm = Term OntologyAnnotation.empty diff --git a/src/ISA/ISA/ArcTypes/CompositeHeader.fs b/src/ISA/ISA/ArcTypes/CompositeHeader.fs index 04c439f2..e1d90f24 100644 --- a/src/ISA/ISA/ArcTypes/CompositeHeader.fs +++ b/src/ISA/ISA/ArcTypes/CompositeHeader.fs @@ -140,10 +140,10 @@ type CompositeHeader = // Input/Output have similiar naming as Term, but are more specific. // So they have to be called first. | Regex.ActivePatterns.Regex Regex.Pattern.InputPattern r -> - let iotype = r.Groups.["iotype"].Value + let iotype = r.Groups.[Regex.Pattern.MatchGroups.iotype].Value Input <| IOType.ofString (iotype) | Regex.ActivePatterns.Regex Regex.Pattern.OutputPattern r -> - let iotype = r.Groups.["iotype"].Value + let iotype = r.Groups.[Regex.Pattern.MatchGroups.iotype].Value Output <| IOType.ofString (iotype) // Is term column | Regex.ActivePatterns.TermColumn r -> diff --git a/src/ISA/ISA/JsonTypes/Component.fs b/src/ISA/ISA/JsonTypes/Component.fs index 3962e69d..f730f30c 100644 --- a/src/ISA/ISA/JsonTypes/Component.fs +++ b/src/ISA/ISA/JsonTypes/Component.fs @@ -69,7 +69,7 @@ type Component = /// Create a ISAJson Component from ISATab string entries static member fromString (?name: string, ?term:string, ?source:string, ?accession:string, ?comments : Comment []) = - let cType = OntologyAnnotation.fromString (?term = term, ?tsr=source, ?tan=accession, ?comments = comments) |> Option.fromValueWithDefault OntologyAnnotation.empty + let cType = OntologyAnnotation.fromString (?termName = term, ?tsr=source, ?tan=accession, ?comments = comments) |> Option.fromValueWithDefault OntologyAnnotation.empty match name with | Some n -> let v,u = Component.decomposeName n diff --git a/src/ISA/ISA/JsonTypes/OntologyAnnotation.fs b/src/ISA/ISA/JsonTypes/OntologyAnnotation.fs index e3a5bec5..58aad178 100644 --- a/src/ISA/ISA/JsonTypes/OntologyAnnotation.fs +++ b/src/ISA/ISA/JsonTypes/OntologyAnnotation.fs @@ -11,28 +11,31 @@ type OntologyAnnotation = ID : URI option Name : AnnotationValue option TermSourceREF : string option - LocalID : string option TermAccessionNumber : URI option Comments : Comment [] option } - static member make id name termSourceREF localID termAccessionNumber comments= + static member make id name termSourceREF termAccessionNumber comments= { ID = id Name = name TermSourceREF = termSourceREF - LocalID = localID TermAccessionNumber = termAccessionNumber Comments = comments } - + /// This function creates the type exactly as given. If you want a more streamlined approach use `OntologyAnnotation.fromString`. - static member create(?Id,?Name,?TermSourceREF,?LocalID,?TermAccessionNumber,?Comments) : OntologyAnnotation = - OntologyAnnotation.make Id Name TermSourceREF LocalID TermAccessionNumber Comments + static member create(?Id,?Name,?TermSourceREF,?TermAccessionNumber,?Comments) : OntologyAnnotation = + OntologyAnnotation.make Id Name TermSourceREF TermAccessionNumber Comments static member empty = OntologyAnnotation.create() + + member this.IDInfo = + this.TermAccessionNumber + |> Option.bind Regex.tryParseTermAnnotation + /// Returns the name of the ontology as string // TODO: Why is this called Text, while everything else is called string? member this.NameText = @@ -76,20 +79,12 @@ type OntologyAnnotation = /// ///Term source reference ///Term accession number - static member fromString (?term:string, ?tsr:string, ?tan:string, ?comments : Comment []) = - - let tsr,localID = - match tan with - | Some (Regex.ActivePatterns.TermAnnotation tan) -> - (if tsr.IsSome then tsr else Some tan.TermSourceREF), - Some tan.LocalTAN - | _ -> tsr,None + static member fromString (?termName:string, ?tsr:string, ?tan:string, ?comments : Comment []) = OntologyAnnotation.make None - (term |> Option.map AnnotationValue.fromString) + (termName |> Option.map AnnotationValue.fromString) tsr - localID tan comments @@ -99,20 +94,20 @@ type OntologyAnnotation = |> Regex.tryParseTermAnnotation |> Option.get |> fun r -> - let accession = r.TermSourceREF + ":" + r.LocalTAN - OntologyAnnotation.fromString ("", r.TermSourceREF, accession) + let accession = r.IDSpace + ":" + r.LocalID + OntologyAnnotation.fromString ("", r.IDSpace, accession) /// Parses any value in `TermAccessionString` to term accession format "termsourceref:localtan". Exmp.: "MS:000001". /// /// If `TermAccessionString` cannot be parsed to this format, returns empty string! member this.TermAccessionShort = - match this.TermSourceREF, this.LocalID with - | Some tsr, Some id -> $"{tsr}:{id}" + match this.IDInfo with + | Some id -> $"{id.IDSpace}:{id.LocalID}" | _ -> "" member this.TermAccessionOntobeeUrl = - match this.TermSourceREF, this.LocalID with - | Some tsr, Some id -> OntologyAnnotation.createUriAnnotation tsr id + match this.IDInfo with + | Some id -> OntologyAnnotation.createUriAnnotation id.IDSpace id.LocalID | _ -> "" member this.TermAccessionAndOntobeeUrlIfShort = @@ -234,4 +229,4 @@ type OntologyAnnotation = member this.Copy() = let nextComments = this.Comments |> Option.map (Array.map (fun c -> c.Copy())) - OntologyAnnotation.make this.ID this.Name this.TermSourceREF this.LocalID this.TermAccessionNumber nextComments \ No newline at end of file + OntologyAnnotation.make this.ID this.Name this.TermSourceREF this.TermAccessionNumber nextComments \ No newline at end of file diff --git a/src/ISA/ISA/Regex.fs b/src/ISA/ISA/Regex.fs index e06a5f61..0d000c0c 100644 --- a/src/ISA/ISA/Regex.fs +++ b/src/ISA/ISA/Regex.fs @@ -7,6 +7,20 @@ open System module Pattern = + module MatchGroups = + + [] + let numberFormat = "numberFormat" + + [] + let localID = "localid" + + [] + let idspace = "idspace" + + [] + let iotype = "iotype" + /// This pattern is only used to remove any leftover #id attributes from previous Swate version. /// `"Parameter [biological replicate#2]"` This #id is deprecated but the pattern can still be used to remove any from files. /// Was deprecated before 2023. @@ -21,8 +35,7 @@ module Pattern = let SquaredBracketsTermNamePattern = "\[.*\]" // @"(?<= \[)[^#\]]*(?=[\]#])" <- Cannot be used in IE11 /// Used to get unit name from Excel numberFormat: 0.00 "degree Celsius" --> degree Celsius - [] - let ExcelNumberFormat = "\"(?(.*?))\"" + let ExcelNumberFormat = $"\"(?<{MatchGroups.numberFormat}>(.*?))\"" /// Hits Unit column header [] @@ -55,29 +68,23 @@ module Pattern = let TermAccessionNumberColumnPattern = @"Term Accession Number\s\((?.*)\)" /// Hits term accession, without id: ENVO:01001831 - [] - let TermAnnotationShortPattern = @"(?\w+?):(?\w+)" //prev: @"[\w]+?:[\d]+" + let TermAnnotationShortPattern = $@"(?<{MatchGroups.idspace}>\w+?):(?<{MatchGroups.localID}>\w+)" //prev: @"[\w]+?:[\d]+" // https://obofoundry.org/id-policy.html#mapping-of-owl-ids-to-obo-format-ids /// Regex pattern is designed to hit only Foundry-compliant URIs. - [] - let TermAnnotationURIPattern = @"http://purl.obolibrary.org/obo/(?\w+?)_(?\w+)" + let TermAnnotationURIPattern = $@"http://purl.obolibrary.org/obo/(?<{MatchGroups.idspace}>\w+?)_(?<{MatchGroups.localID}>\w+)" /// Watch this closely, this could hit some edge cases we do not want to cover. - [] - let TermAnnotationURIPattern_lessRestrictive = @".*\/(?\w+?)[:_](?\w+)" + let TermAnnotationURIPattern_lessRestrictive = $@".*\/(?<{MatchGroups.idspace}>\w+?)[:_](?<{MatchGroups.localID}>\w+)" /// This pattern is used to match both Input and Output columns and capture the IOType as `iotype` group. - [] - let IOTypePattern = @"(Input|Output)\s\[(?.+)\]" + let IOTypePattern = $@"(Input|Output)\s\[(?<{MatchGroups.iotype}>.+)\]" /// This pattern is used to match Input column and capture the IOType as `iotype` group. - [] - let InputPattern = @"Input\s\[(?.+)\]" + let InputPattern = $@"Input\s\[(?<{MatchGroups.iotype}>.+)\]" /// This pattern is used to match Output column and capture the IOType as `iotype` group. - [] - let OutputPattern = @"Output\s\[(?.+)\]" + let OutputPattern = $@"Output\s\[(?<{MatchGroups.iotype}>.+)\]" /// This pattern matches any column header starting with some text, followed by one whitespace and a term name inside squared brackets. /// @@ -176,9 +183,9 @@ module ActivePatterns = let (|TermAnnotationShort|_|) input = match input with | Regex Pattern.TermAnnotationShortPattern value -> - let termsourceref = value.Groups.["termsourceref"].Value - let localtan = value.Groups.["localtan"].Value - {|TermSourceREF = termsourceref; LocalTAN = localtan|} + let idspace = value.Groups.[Pattern.MatchGroups.idspace].Value + let localID = value.Groups.[Pattern.MatchGroups.localID].Value + {|IDSpace = idspace; LocalID = localID|} |> Some | _ -> None @@ -193,9 +200,9 @@ module ActivePatterns = | Regex Pattern.TermAnnotationShortPattern value | Regex Pattern.TermAnnotationURIPattern value | Regex Pattern.TermAnnotationURIPattern_lessRestrictive value -> - let termsourceref = value.Groups.["termsourceref"].Value - let localtan = value.Groups.["localtan"].Value - {|TermSourceREF = termsourceref; LocalTAN = localtan; TermAccessionNumber = input|} + let idspace = value.Groups.[Pattern.MatchGroups.idspace].Value + let localID = value.Groups.[Pattern.MatchGroups.localID].Value + {|IDSpace = idspace; LocalID = localID|} |> Some | _ -> None @@ -208,7 +215,7 @@ module ActivePatterns = | Regex Pattern.TermSourceREFColumnPattern r -> match r.Groups.["id"].Value with | TermAnnotation r -> Some r - | _ -> Some {|LocalTAN = ""; TermAccessionNumber = ""; TermSourceREF = ""|} + | _ -> Some {|IDSpace = ""; LocalID = ""|} | _ -> None /// Matches a "Term Accession Number (ShortTerm)" column header and returns the ShortTerm as Term Source Ref and Annotation Number. @@ -219,21 +226,21 @@ module ActivePatterns = | Regex Pattern.TermAccessionNumberColumnPattern r -> match r.Groups.["id"].Value with | TermAnnotation r -> Some r - | _ -> Some {|LocalTAN = ""; TermAccessionNumber = ""; TermSourceREF = ""|} + | _ -> Some {|IDSpace = ""; LocalID = ""|} | _ -> None /// Matches a "Input [InputType]" column header and returns the InputType as string. let (|InputColumnHeader|_|) input = match input with | Regex Pattern.InputPattern r -> - Some r.Groups.["iotype"].Value + Some r.Groups.[Pattern.MatchGroups.iotype].Value | _ -> None /// Matches a "Output [OutputType]" column header and returns the OutputType as string. let (|OutputColumnHeader|_|) input = match input with | Regex Pattern.OutputPattern r -> - Some r.Groups.["iotype"].Value + Some r.Groups.[Pattern.MatchGroups.iotype].Value | _ -> None @@ -261,9 +268,9 @@ let tryParseReferenceColumnHeader (str : string) = let tryParseTermAnnotationShort (str:string) = match str.Trim() with | Regex TermAnnotationShortPattern value -> - let termsourceref = value.Groups.["termsourceref"].Value - let localtan = value.Groups.["localtan"].Value - {|TermSourceREF = termsourceref; LocalTAN = localtan|} + let idspace = value.Groups.[Pattern.MatchGroups.idspace].Value + let localid = value.Groups.[Pattern.MatchGroups.localID].Value + {|IDSpace = idspace; LocalID = localid|} |> Some | _ -> None @@ -279,9 +286,9 @@ let tryParseTermAnnotation (str:string) = | Regex TermAnnotationShortPattern value | Regex TermAnnotationURIPattern value | Regex TermAnnotationURIPattern_lessRestrictive value -> - let termsourceref = value.Groups.["termsourceref"].Value - let localtan = value.Groups.["localtan"].Value - {|TermSourceREF = termsourceref; LocalTAN = localtan|} + let idspace = value.Groups.[Pattern.MatchGroups.idspace].Value + let localid = value.Groups.[Pattern.MatchGroups.localID].Value + {|IDSpace = idspace; LocalID = localid|} |> Some | _ -> None @@ -289,7 +296,7 @@ let tryParseTermAnnotation (str:string) = /// Tries to parse 'str' to term accession and returns it in the format `Some "termsourceref:localtan"`. Exmp.: `Some "MS:000001"` let tryGetTermAnnotationShortString (str:string) = tryParseTermAnnotation str - |> Option.map (fun r -> r.TermSourceREF + ":" + r.LocalTAN) + |> Option.map (fun r -> r.IDSpace + ":" + r.LocalID) /// Parses 'str' to term accession and returns it in the format "termsourceref:localtan". Exmp.: "MS:000001" let getTermAnnotationShortString (str:string) = @@ -320,7 +327,7 @@ let tryParseIOTypeHeader (headerStr: string) = match headerStr.Trim() with | Regex IOTypePattern value -> // remove quotes at beginning and end of matched string - let numberFormat = value.Groups.["iotype"].Value + let numberFormat = value.Groups.[Pattern.MatchGroups.iotype].Value Some numberFormat | _ -> None diff --git a/tests/ISA/ISA.Json.Tests/Json.Tests.fs b/tests/ISA/ISA.Json.Tests/Json.Tests.fs index 05d21258..835093d4 100644 --- a/tests/ISA/ISA.Json.Tests/Json.Tests.fs +++ b/tests/ISA/ISA.Json.Tests/Json.Tests.fs @@ -160,7 +160,7 @@ let testOntoloyAnnotation = o_out |> Utils.wordFrequency - Expect.equal actual expected "Written processInput does not match read process input" + mySequenceEqual actual expected "Written processInput does not match read process input" ) ] @@ -191,7 +191,7 @@ let testOntoloyAnnotationLD = o_out |> Utils.wordFrequency - Expect.equal actual expected "Written processInput does not match read process input" + mySequenceEqual actual expected "Written processInput does not match read process input" ) testCase "WriterOutputMatchesInputDefaultIDs" (fun () -> @@ -206,7 +206,7 @@ let testOntoloyAnnotationLD = o_out |> Utils.wordFrequency - Expect.equal actual expected "Written processInput does not match read process input" + mySequenceEqual actual expected "Written processInput does not match read process input" ) ] @@ -239,7 +239,7 @@ let testProcessInput = o_out |> Utils.wordFrequency - Expect.equal actual expected "Written processInput does not match read process input" + mySequenceEqual actual expected "Written processInput does not match read process input" ) ] testList "Material" [ @@ -1242,7 +1242,6 @@ let testInvestigationFile = (Some "OntologyTerm/Published") (Some (AnnotationValue.Text "published")) (Some "pso") - (Some "published") (Some "http://purl.org/spar/pso/published") (Some [|comment|]) @@ -1260,7 +1259,6 @@ let testInvestigationFile = (Some "OntologyTerm/SoftwareDeveloperRole") (Some (AnnotationValue.Text "software developer role")) (Some "swo") - (Some "0000392") (Some "http://www.ebi.ac.uk/swo/SWO_0000392") (Some [|comment|]) @@ -1286,7 +1284,6 @@ let testInvestigationFile = (Some "OntologyTerm/Organism") (Some (AnnotationValue.Text "organism")) (Some "obi") - (Some "0100026") (Some "http://purl.obolibrary.org/obo/OBI_0100026") (Some [|comment|]) )) @@ -1300,7 +1297,6 @@ let testInvestigationFile = (Some "OntologyTerm/Organism") (Some (AnnotationValue.Text "Arabidopsis thaliana")) (Some "obi") - (Some "0100026") (Some "http://purl.obolibrary.org/obo/OBI_0100026") (Some [|comment|]) |> Value.Ontology @@ -1312,7 +1308,6 @@ let testInvestigationFile = (Some "OntologyTerm/TimeSeries") (Some (AnnotationValue.Text "Time Series Analysis")) (Some "ncit") - (Some "C18235") (Some "http://purl.obolibrary.org/obo/NCIT_C18235") (Some [|comment|]) @@ -1321,7 +1316,6 @@ let testInvestigationFile = (Some "OntologyTerm/GrowthProtocol") (Some (AnnotationValue.Text "growth protocol")) (Some "dfbo") - (Some "DFBA_0000001") (Some "http://purl.obolibrary.org/obo/DFBO_1000162") (Some [|comment|]) @@ -1333,7 +1327,6 @@ let testInvestigationFile = (Some "OntologyTerm/Temperature") (Some (AnnotationValue.Text "temperature unit")) (Some "uo") - (Some "UO_0000005") (Some "http://purl.obolibrary.org/obo/UO_0000005") (Some [|comment|]) )) @@ -1343,7 +1336,6 @@ let testInvestigationFile = (Some "OntologyTerm/DegreeCelsius") (Some (AnnotationValue.Text "degree celsius")) (Some "uo") - (Some "UO_0000027") (Some "http://purl.obolibrary.org/obo/UO_0000027") (Some [|comment|]) @@ -1361,7 +1353,6 @@ let testInvestigationFile = (Some "OntologyTerm/RTPCR") (Some (AnnotationValue.Text "real-time PCR machine")) (Some "obi") - (Some "0001110") (Some "http://purl.obolibrary.org/obo/OBI_0001110") (Some [|comment|]) |> Value.Ontology @@ -1372,7 +1363,6 @@ let testInvestigationFile = (Some "OntologyTerm/PCR") (Some (AnnotationValue.Text "PCR instrument")) (Some "obi") - (Some "0000989") (Some "http://purl.obolibrary.org/obo/OBI_0000989") (Some [|comment|]) )) @@ -1398,7 +1388,6 @@ let testInvestigationFile = (Some "OntologyTerm/Time") (Some (AnnotationValue.Text "time")) (Some "pato") - (Some "0000165") (Some "http://purl.obolibrary.org/obo/PATO_0000165") (Some [|comment|]) )) @@ -1409,7 +1398,6 @@ let testInvestigationFile = (Some "OntologyTerm/Hour") (Some (AnnotationValue.Text "hour")) (Some "uo") - (Some "0000032") (Some "http://purl.obolibrary.org/obo/UO_0000032") (Some [|comment|]) @@ -1498,7 +1486,6 @@ let testInvestigationFile = (Some "OntologyTerm/LFQuantification") (Some (AnnotationValue.Text "LC/MS Label-Free Quantification")) (Some "ncit") - (Some "C161813") (Some "http://purl.obolibrary.org/obo/NCIT_C161813") (Some [|comment|]) @@ -1507,7 +1494,6 @@ let testInvestigationFile = (Some "OntologyTerm/TOF") (Some (AnnotationValue.Text "Time-of-Flight")) (Some "ncit") - (Some "C70698") (Some "http://purl.obolibrary.org/obo/NCIT_C70698") (Some [|comment|]) @@ -1678,7 +1664,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/Published") (Some (AnnotationValue.Text "published")) (Some "pso") - (Some "published") (Some "http://purl.org/spar/pso/published") (Some [|comment|]) @@ -1696,7 +1681,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/SoftwareDeveloperRole") (Some (AnnotationValue.Text "software developer role")) (Some "swo") - (Some "0000392") (Some "http://www.ebi.ac.uk/swo/SWO_0000392") (Some [|comment|]) @@ -1722,7 +1706,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/Organism") (Some (AnnotationValue.Text "organism")) (Some "obi") - (Some "0100026") (Some "http://purl.obolibrary.org/obo/OBI_0100026") (Some [|comment|]) )) @@ -1736,7 +1719,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/Organism") (Some (AnnotationValue.Text "Arabidopsis thaliana")) (Some "obi") - (Some "0100026") (Some "http://purl.obolibrary.org/obo/OBI_0100026") (Some [|comment|]) |> Value.Ontology @@ -1748,7 +1730,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/TimeSeries") (Some (AnnotationValue.Text "Time Series Analysis")) (Some "ncit") - (Some "C18235") (Some "http://purl.obolibrary.org/obo/NCIT_C18235") (Some [|comment|]) @@ -1757,7 +1738,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/GrowthProtocol") (Some (AnnotationValue.Text "growth protocol")) (Some "dfbo") - (Some "0000001") (Some "http://purl.obolibrary.org/obo/DFBO_1000162") (Some [|comment|]) @@ -1769,7 +1749,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/Temperature") (Some (AnnotationValue.Text "temperature unit")) (Some "uo") - (Some "UO_0000005") (Some "http://purl.obolibrary.org/obo/UO_0000005") (Some [|comment|]) )) @@ -1779,7 +1758,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/DegreeCelsius") (Some (AnnotationValue.Text "degree celsius")) (Some "uo") - (Some "0000027") (Some "http://purl.obolibrary.org/obo/UO_0000027") (Some [|comment|]) @@ -1797,7 +1775,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/RTPCR") (Some (AnnotationValue.Text "real-time PCR machine")) (Some "obi") - (Some "0001110") (Some "http://purl.obolibrary.org/obo/OBI_0001110") (Some [|comment|]) |> Value.Ontology @@ -1808,7 +1785,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/PCR") (Some (AnnotationValue.Text "PCR instrument")) (Some "obi") - (Some "0000989") (Some "http://purl.obolibrary.org/obo/OBI_0000989") (Some [|comment|]) )) @@ -1834,7 +1810,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/Time") (Some (AnnotationValue.Text "time")) (Some "pato") - (Some "0000165") (Some "http://purl.obolibrary.org/obo/PATO_0000165") (Some [|comment|]) )) @@ -1845,7 +1820,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/Hour") (Some (AnnotationValue.Text "hour")) (Some "uo") - (Some "0000032") (Some "http://purl.obolibrary.org/obo/UO_0000032") (Some [|comment|]) @@ -1934,7 +1908,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/LFQuantification") (Some (AnnotationValue.Text "LC/MS Label-Free Quantification")) (Some "ncit") - (Some "C161813") (Some "http://purl.obolibrary.org/obo/NCIT_C161813") (Some [|comment|]) @@ -1943,7 +1916,6 @@ let testInvestigationFileLD = (Some "OntologyTerm/TOF") (Some (AnnotationValue.Text "Time-of-Flight")) (Some "ncit") - (Some "C70698") (Some "http://purl.obolibrary.org/obo/NCIT_C70698") (Some [|comment|]) diff --git a/tests/ISA/ISA.Tests/ArcTable.Tests.fs b/tests/ISA/ISA.Tests/ArcTable.Tests.fs index f781b976..185dabc3 100644 --- a/tests/ISA/ISA.Tests/ArcTable.Tests.fs +++ b/tests/ISA/ISA.Tests/ArcTable.Tests.fs @@ -446,21 +446,21 @@ let private tests_UpdateColumn = ) testCase "set valid, at invalid index = columnCount" (fun () -> let table = create_testTable() - let h = CompositeHeader.Component <| OntologyAnnotation.fromString(term="TestTerm") + let h = CompositeHeader.Component <| OntologyAnnotation.fromString(termName="TestTerm") let cells = createCells_Term 5 let eval() = table.UpdateColumn(table.ColumnCount, h, cells) Expect.throws eval "" ) testCase "set valid, at invalid negative index" (fun () -> let table = create_testTable() - let h = CompositeHeader.Component <| OntologyAnnotation.fromString(term="TestTerm") + let h = CompositeHeader.Component <| OntologyAnnotation.fromString(termName="TestTerm") let cells = createCells_Term 5 let eval() = table.UpdateColumn(-1, h, cells) Expect.throws eval "" ) testCase "set valid" (fun () -> let table = create_testTable() - let h = CompositeHeader.Component <| OntologyAnnotation.fromString(term="TestTerm") + let h = CompositeHeader.Component <| OntologyAnnotation.fromString(termName="TestTerm") let cells = createCells_Term 5 table.UpdateColumn(0, h, cells) Expect.equal table.RowCount 5 "RowCount" @@ -498,7 +498,7 @@ let private tests_UpdateColumn = ) testCase "set valid, less rows" (fun () -> let table = create_testTable() - let h = CompositeHeader.Component <| OntologyAnnotation.fromString(term="TestTerm") + let h = CompositeHeader.Component <| OntologyAnnotation.fromString(termName="TestTerm") let cells = createCells_Term 2 table.UpdateColumn(0, h, cells) Expect.equal table.RowCount 5 "RowCount" @@ -514,7 +514,7 @@ let private tests_UpdateColumn = ) testCase "set valid, more rows" (fun () -> let table = create_testTable() - let h = CompositeHeader.Component <| OntologyAnnotation.fromString(term="TestTerm") + let h = CompositeHeader.Component <| OntologyAnnotation.fromString(termName="TestTerm") let cells = createCells_Term 7 table.UpdateColumn(0, h, cells) Expect.equal table.RowCount 7 "RowCount" diff --git a/tests/ISA/ISA.Tests/Regex.Tests.fs b/tests/ISA/ISA.Tests/Regex.Tests.fs index d9383a83..00a5cf96 100644 --- a/tests/ISA/ISA.Tests/Regex.Tests.fs +++ b/tests/ISA/ISA.Tests/Regex.Tests.fs @@ -65,9 +65,8 @@ let private tests_AnnotationTableColums = | _ -> None Expect.isSome r "Could not match TSRColumnHeader" let rv = r.Value - Expect.equal rv.LocalTAN localID "LocalId did not match" - Expect.equal rv.TermSourceREF space "TermSourceREF did not match" - Expect.equal rv.TermAccessionNumber $"{space}:{localID}" "TermAccessionNumber did not match" + Expect.equal rv.LocalID localID "LocalId did not match" + Expect.equal rv.IDSpace space "TermSourceREF did not match" ) testCase "Term Source REF Empty" (fun () -> let testString = $"Term Source REF ()" @@ -77,9 +76,8 @@ let private tests_AnnotationTableColums = | _ -> None Expect.isSome r "Could not match TSRColumnHeader" let rv = r.Value - Expect.equal rv.LocalTAN "" "LocalID should be empty" - Expect.equal rv.TermSourceREF "" "TermSourceREF should be empty" - Expect.equal rv.TermAccessionNumber "" "TermAccessionNumber should be empty" + Expect.equal rv.LocalID "" "LocalID should be empty" + Expect.equal rv.IDSpace "" "TermSourceREF should be empty" ) testCase "Term Accession Number" (fun () -> let localID = "12345" @@ -91,9 +89,8 @@ let private tests_AnnotationTableColums = | _ -> None Expect.isSome r "Could not match TANColumnHeader" let rv = r.Value - Expect.equal rv.LocalTAN localID "LocalId did not match" - Expect.equal rv.TermSourceREF space "TermSourceREF did not match" - Expect.equal rv.TermAccessionNumber $"{space}:{localID}" "TermAccessionNumber did not match" + Expect.equal rv.LocalID localID "LocalId did not match" + Expect.equal rv.IDSpace space "TermSourceREF did not match" ) testCase "Term Accession Number Empty" (fun () -> let testString = $"Term Accession Number ()" @@ -103,9 +100,8 @@ let private tests_AnnotationTableColums = | _ -> None Expect.isSome r "Could not match TANColumnHeader" let rv = r.Value - Expect.equal rv.LocalTAN "" "LocalID should be empty" - Expect.equal rv.TermSourceREF "" "TermSourceREF should be empty" - Expect.equal rv.TermAccessionNumber "" "TermAccessionNumber should be empty" + Expect.equal rv.LocalID "" "LocalID should be empty" + Expect.equal rv.IDSpace "" "TermSourceREF should be empty" ) testCase "Reference Column Header Empty" (fun () ->