Skip to content

Commit

Permalink
Add ARCMock module
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Jan 2, 2024
1 parent ee6390f commit 7ba5548
Show file tree
Hide file tree
Showing 9 changed files with 460 additions and 113 deletions.
424 changes: 424 additions & 0 deletions src/ARCTokenization/ARCMock.fs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/ARCTokenization/ARCTokenization.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<Compile Include="Worksheet.fs" />
<Compile Include="FileSystem.fs" />
<Compile Include="TopLevelParsers.fs" />
<Compile Include="ARCMock.fs" />
</ItemGroup>

<PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/ARCTokenization/Terms.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ module InvestigationMetadata =

let ontology = OboOntology.fromLines true obo

let nonObsoleteCvTerms =
ontology.Terms
|> List.filter (fun t -> not t.IsObsolete)
|> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "INVMSO"))

let obsoleteCvTerms =
ontology.Terms
|> List.filter (fun t -> t.IsObsolete)
Expand All @@ -37,6 +42,11 @@ module StudyMetadata =

let ontology = OboOntology.fromLines true obo

let nonObsoleteCvTerms =
ontology.Terms
|> List.filter (fun t -> not t.IsObsolete)
|> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "INVMSO"))

let obsoleteCvTerms =
ontology.Terms
|> List.filter (fun t -> t.IsObsolete)
Expand All @@ -52,6 +62,11 @@ module AssayMetadata =

let ontology = OboOntology.fromLines true obo

let nonObsoleteCvTerms =
ontology.Terms
|> List.filter (fun t -> not t.IsObsolete)
|> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "INVMSO"))

let cvTerms =
ontology.Terms
|> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "ASSMSO"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!This file was auto generated on 18.12.2023. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
!This file was auto generated on 2024-01-02. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
format-version: 1.2
data-version: init/2023-10-26
saved-by: Kevin Schneider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!This file was auto generated on 18.12.2023. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
!This file was auto generated on 2024-01-02. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
format-version: 1.2
data-version: init/2023-07-27
saved-by: Kevin Schneider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!This file was auto generated on 18.12.2023. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
!This file was auto generated on 2024-01-02. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
format-version: 1.2
data-version: init/2023-07-20
saved-by: Kevin Schneider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!This file was auto generated on 18.12.2023. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
!This file was auto generated on 2024-01-02. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
format-version: 1.2
data-version: init/2023-07-27
saved-by: Kevin Schneider
Expand Down
Binary file not shown.
125 changes: 16 additions & 109 deletions tests/ARCTokenization.Tests/IntegrationTests/InvestigationMetadata.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,117 +33,24 @@ module InvestigationMetadata =
CvParam.structuralEquality (expected) (actual :?> CvParam)
))

let expectedTermValuesSimple =
[
[""]
[""]
[""]
[""]
[""]
[""]
[""; "iid"]
[""; "ititle"]
[""; "idesc"]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""; "Maus"; "Keider"; "müller"; ""; "oih"]
[""; "Oliver"; ""; "andreas";]
[""; "L. I."; "C."]
[""; "maus@nfdi4plants.org"]
[""]
[""]
[""]
[""; ""; "Affe"]
[""]
[""]
[""]
[""]
[""; "sid"]
[""; "stitle"]
[""; "sdesc"]
[""]
[""]
[""; @"sid\isa.study.xlsx"]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""; @"aid\isa.assay.xlsx"; @"aid2\isa.assay.xlsx"]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""; "weil"]
[""; ""; "lukas"]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
[""]
]

let allExpectedMetadataTermsFull =
Terms.InvestigationMetadata.cvTerms
|> List.skip 1 //(ignore root term)
|> List.filter (fun t -> not (t.Name.StartsWith("Comment"))) // ignore orcids
|> List.filter (fun t -> not (List.contains t Terms.InvestigationMetadata.obsoleteCvTerms)) // ignore obsolete terms
|> List.zip expectedTermValuesSimple
|> List.map (fun (values,term) ->
values
|> List.mapi (fun i v ->
if i = 0 then
CvParam(term, ParamValue.CvValue (CvTerm.create(accession = "AGMO:00000001", name = "Metadata Section Key", ref = "AGMO")), [])
else
CvParam(term, ParamValue.Value v, [])
)
ARCMock.InvestigationMetadataTokens(
Investigation_Identifier = ["iid"],
Investigation_Title = ["ititle"],
Investigation_Description = ["idesc"],
Investigation_Person_Last_Name = ["Maus"; "Keider"; "müller"; ""; "oih"],
Investigation_Person_First_Name = ["Oliver"; ""; "andreas";],
Investigation_Person_Mid_Initials = ["L. I."; "C."],
Investigation_Person_Email = ["maus@nfdi4plants.org"],
Investigation_Person_Affiliation = [""; "Affe"],
Study_Identifier = ["sid"],
Study_Title = ["stitle"],
Study_Description = ["sdesc"],
Study_File_Name = [@"sid\isa.study.xlsx"],
Study_Assay_File_Name = [@"aid\isa.assay.xlsx"; @"aid2\isa.assay.xlsx"],
Study_Person_Last_Name = ["weil"],
Study_Person_First_Name = [""; "lukas"]
)
|> List.concat

[<Fact>]
let ``Simple investigation is parsed with all structural ontology terms in order`` () =
Expand Down

0 comments on commit 7ba5548

Please sign in to comment.