Skip to content

Commit

Permalink
fix #47, add full test for structural ontologies
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Jan 8, 2024
1 parent c932215 commit 3510453
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/ARCTokenization/ARCMock.fs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ type ARCMock =
?Assay_Measurement_Type_Term_Accession_Number: seq<string>,
?Assay_Measurement_Type_Term_Source_REF: seq<string>,
?Assay_Technology_Type: seq<string>,
?Assay_Technology_Type_Term_Accession_Number: seq<string>,
?Assay_Technology_Type_Term_Source_REF: seq<string>,
?Assay_Technology_Platform: seq<string>,
?Assay_File_Name: seq<string>,
Expand All @@ -388,6 +389,7 @@ type ARCMock =
[""; yield! Assay_Measurement_Type_Term_Accession_Number |> Option.defaultValue Seq.empty ]
[""; yield! Assay_Measurement_Type_Term_Source_REF |> Option.defaultValue Seq.empty ]
[""; yield! Assay_Technology_Type |> Option.defaultValue Seq.empty ]
[""; yield! Assay_Technology_Type_Term_Accession_Number |> Option.defaultValue Seq.empty ]
[""; yield! Assay_Technology_Type_Term_Source_REF |> Option.defaultValue Seq.empty ]
[""; yield! Assay_Technology_Platform |> Option.defaultValue Seq.empty ]
[""; yield! Assay_File_Name |> Option.defaultValue Seq.empty ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!This file was auto generated on 2024-01-05. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
!This file was auto generated on 1/8/2024. 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 2024-01-05. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
!This file was auto generated on 1/8/2024. 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 Expand Up @@ -125,7 +125,6 @@ id: ASSMSO:00000013
name: Assay Technology Type Term Accession Number
def: ""
synonym: "Technology Type Term Accession Number" EXACT []
is_obsolete: true
relationship: part_of ASSMSO:00000002 ! ASSAY
relationship: part_of ASSMSO:00000003 ! ASSAY METADATA
relationship: follows ASSMSO:00000010 ! Technology Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def: ""
name: Assay Technology Type Term Accession Number
def: ""
synonym: "Technology Type Term Accession Number" EXACT []
is_obsolete: true
relationship: part_of ASSMSO:00000002 ! ASSAY
relationship: part_of ASSMSO:00000003 ! ASSAY METADATA
relationship: follows ASSMSO:00000010 ! Technology Type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!This file was auto generated on 2024-01-05. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
!This file was auto generated on 1/8/2024. 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 2024-01-05. Do not edit it. All manual changes will be overwritten by the next generator run eventually.
!This file was auto generated on 1/8/2024. 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
211 changes: 204 additions & 7 deletions tests/ARCTokenization.Tests/ReferenceObjects.fs

Large diffs are not rendered by default.

84 changes: 78 additions & 6 deletions tests/ARCTokenization.Tests/StructuralOntologyTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,38 @@ module InvestigationMetadata =
(fun (e,a) -> Assert.Equal(e,a))
)

[<Fact>]
let ``all ontology names correct`` () =
Assert.All(
InvestigationMetadata.cvTerms,
(fun t -> Assert.True(t.RefUri = ReferenceObjects.Terms.InvestigationMetadata.referenceOntologyName))
)

[<Fact>]
let ``no root term in non root terms`` () =
Assert.All(
InvestigationMetadata.nonRootCvTerms,
(fun t ->
Assert.True(
t.Name <> ReferenceObjects.Terms.referenceInvestigationMetadataOntologyRootTerm.Name
&& t.Accession <> ReferenceObjects.Terms.referenceInvestigationMetadataOntologyRootTerm.Accession
t.Name <> ReferenceObjects.Terms.InvestigationMetadata.referenceOntologyRootTerm.Name
&& t.Accession <> ReferenceObjects.Terms.InvestigationMetadata.referenceOntologyRootTerm.Accession
)
)
)

[<Fact>]
let ``all non root non obsolete CvTerms are correct`` () =
Assert.All(
(
List.zip
InvestigationMetadata.nonObsoleteNonRootCvTerms
ReferenceObjects.Terms.InvestigationMetadata.epectedNonObsoleteNonRootTerms
),
(fun (actual, expected) ->
Assert.True(
(actual.Name = expected.Name)
&& (actual.Accession = expected.Accession)
&& (actual.RefUri = expected.RefUri)
)
)
)
Expand All @@ -51,14 +75,38 @@ module StudyMetadata =
(fun (e,a) -> Assert.Equal(e,a))
)

[<Fact>]
let ``all ontology names correct`` () =
Assert.All(
StudyMetadata.cvTerms,
(fun t -> Assert.True(t.RefUri = ReferenceObjects.Terms.StudyMetadata.referenceOntologyName))
)

[<Fact>]
let ``no root term in non root terms`` () =
Assert.All(
StudyMetadata.nonRootCvTerms,
(fun t ->
Assert.True(
t.Name <> ReferenceObjects.Terms.referenceStudyMetadataOntologyRootTerm.Name
&& t.Accession <> ReferenceObjects.Terms.referenceStudyMetadataOntologyRootTerm.Accession
t.Name <> ReferenceObjects.Terms.StudyMetadata.referenceOntologyRootTerm.Name
&& t.Accession <> ReferenceObjects.Terms.StudyMetadata.referenceOntologyRootTerm.Accession
)
)
)

[<Fact>]
let ``all non root non obsolete CvTerms are correct`` () =
Assert.All(
(
List.zip
StudyMetadata.nonObsoleteNonRootCvTerms
ReferenceObjects.Terms.StudyMetadata.epectedNonObsoleteNonRootTerms
),
(fun (actual, expected) ->
Assert.True(
(actual.Name = expected.Name)
&& (actual.Accession = expected.Accession)
&& (actual.RefUri = expected.RefUri)
)
)
)
Expand Down Expand Up @@ -128,14 +176,38 @@ module AssayMetadata =
(fun (e,a) -> Assert.Equal(e,a))
)

[<Fact>]
let ``all ontology names correct`` () =
Assert.All(
AssayMetadata.cvTerms,
(fun t -> Assert.True(t.RefUri = ReferenceObjects.Terms.AssayMetadata.referenceOntologyName))
)

[<Fact>]
let ``no root term in non root terms`` () =
Assert.All(
AssayMetadata.nonRootCvTerms,
(fun t ->
Assert.True(
t.Name <> ReferenceObjects.Terms.referenceAssayMetadataOntologyRootTerm.Name
&& t.Accession <> ReferenceObjects.Terms.referenceAssayMetadataOntologyRootTerm.Accession
t.Name <> ReferenceObjects.Terms.AssayMetadata.referenceOntologyRootTerm.Name
&& t.Accession <> ReferenceObjects.Terms.AssayMetadata.referenceOntologyRootTerm.Accession
)
)
)

[<Fact>]
let ``all non root non obsolete CvTerms are correct`` () =
Assert.All(
(
List.zip
AssayMetadata.nonObsoleteNonRootCvTerms
ReferenceObjects.Terms.AssayMetadata.epectedNonObsoleteNonRootTerms
),
(fun (actual, expected) ->
Assert.True(
(actual.Name = expected.Name)
&& (actual.Accession = expected.Accession)
&& (actual.RefUri = expected.RefUri)
)
)
)

0 comments on commit 3510453

Please sign in to comment.