From e6cd1775575aaac5aca3d2a48ff26fd31b136038 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Tue, 9 Jan 2024 13:07:46 +0100 Subject: [PATCH] Add basic process graph tokenization: - Based on ARCtrl ARCTable - add ARC Process Graph Structural ontology (APGSO) --- build/ProjectInfo.fs | 1 + src/ARCTokenization/ARCTokenization.fsproj | 3 + src/ARCTokenization/Terms.fs | 51 ++++++- src/ARCTokenization/Tokenization.fs | 139 +++++++++++++++--- .../structural_ontologies/APGSO.fs | 42 ++++++ .../arc_file_structure_ontology.obo | 2 +- .../arc_process_graph_structural_ontology.obo | 129 ++++++++++++++++ .../arc_process_graph_structural_ontology.yml | 128 ++++++++++++++++ .../assay_metadata_structural_ontology.obo | 2 +- ...stigation_metadata_structural_ontology.obo | 2 +- .../study_metadata_structural_ontology.obo | 2 +- .../ARCTokenization.Tests.fsproj | 11 +- .../ARCTokenization.Tests/ReferenceObjects.fs | 26 ++++ .../StructuralOntologyTests.fs | 40 +++++ .../ControlledVocabulary.Tests.fsproj | 14 +- 15 files changed, 554 insertions(+), 38 deletions(-) create mode 100644 src/ARCTokenization/structural_ontologies/APGSO.fs create mode 100644 src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.obo create mode 100644 src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.yml diff --git a/build/ProjectInfo.fs b/build/ProjectInfo.fs index 9f90359..7d7d9bf 100644 --- a/build/ProjectInfo.fs +++ b/build/ProjectInfo.fs @@ -76,6 +76,7 @@ let structuralOntologySources = [ "src/ARCTokenization/structural_ontologies/investigation_metadata_structural_ontology.yml" "src/ARCTokenization/structural_ontologies/study_metadata_structural_ontology.yml" "src/ARCTokenization/structural_ontologies/assay_metadata_structural_ontology.yml" + "src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.yml" "src/ARCTokenization/structural_ontologies/arc_file_structure_ontology.yml" ] diff --git a/src/ARCTokenization/ARCTokenization.fsproj b/src/ARCTokenization/ARCTokenization.fsproj index eb9e129..8810615 100644 --- a/src/ARCTokenization/ARCTokenization.fsproj +++ b/src/ARCTokenization/ARCTokenization.fsproj @@ -19,14 +19,17 @@ + + + diff --git a/src/ARCTokenization/Terms.fs b/src/ARCTokenization/Terms.fs index 24f409a..b435c01 100644 --- a/src/ARCTokenization/Terms.fs +++ b/src/ARCTokenization/Terms.fs @@ -99,6 +99,7 @@ module StudyMetadata = let obsoleteCvTerms = obsoleteOboTerms |> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "STDMSO")) + module AssayMetadata = let internal obo = (EmbeddedResource.load "structural_ontologies.assay_metadata_structural_ontology.obo").Replace("\r\n", "\n").Split('\n') @@ -138,9 +139,57 @@ module AssayMetadata = |> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "ASSMSO")) let obsoleteCvTerms = - obsoleteOboTerms + obsoleteOboTerms |> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "ASSMSO")) +// equivalents of composite header / cell types in ARCtrl +module ProcessGraph = + + let internal obo = (EmbeddedResource.load "structural_ontologies.arc_process_graph_structural_ontology.obo").Replace("\r\n", "\n").Split('\n') + + let ontology = OboOntology.fromLines true obo + + let nonRootOboTerms = + ontology.Terms + |> List.filter (fun t -> + t.Name <> "Process Graph Header" + && t.Id <> "APGSO:00000001" + && t.Name <> "IOType" + && t.Id <> "APGSO:00000015" + ) + + let nonObsoleteOboTerms = + ontology.Terms + |> List.filter (fun t -> not t.IsObsolete) + + let nonObsoleteNonRootOboTerms = + nonRootOboTerms + |> List.filter (fun t -> not t.IsObsolete) + + let obsoleteOboTerms = + nonRootOboTerms + |> List.filter (fun t -> t.IsObsolete) + + let cvTerms = + ontology.Terms + |> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "APGSO")) + + let nonRootCvTerms = + nonRootOboTerms + |> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "APGSO")) + + let nonObsoleteCvTerms = + nonObsoleteOboTerms + |> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "APGSO")) + + let nonObsoleteNonRootCvTerms = + nonObsoleteNonRootOboTerms + |> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "APGSO")) + + let obsoleteCvTerms = + obsoleteOboTerms + |> List.map (fun t -> CvTerm.create(accession = t.Id, name = t.Name, ref = "APGSO")) + module StructuralTerms = diff --git a/src/ARCTokenization/Tokenization.fs b/src/ARCTokenization/Tokenization.fs index 2a2e236..93e35a2 100644 --- a/src/ARCTokenization/Tokenization.fs +++ b/src/ARCTokenization/Tokenization.fs @@ -42,23 +42,126 @@ module Tokenization = ) keyTerm :: cellTerms - let convertAnnotationValue (av: AnnotationValue) = - match av with - | Text t -> t :> System.IConvertible - | Float f -> f :> System.IConvertible - | Int i -> i :> System.IConvertible - - module OntologyAnnotation = - - let tryAsCvTerm (oa: OntologyAnnotation) = - match (oa.TermAccessionNumber, oa.Name, oa.TermSourceREF) with - | (Some accession, Some name, Some ref) -> - Some ( - CvTerm.create( - accession = accession, - name = name.ToString(), - ref = ref - ) + module ARCtrl = + + module AnnotationValue = + + let getValue (av: AnnotationValue) = + match av with + | Text t -> t :> System.IConvertible + | Float f -> f :> System.IConvertible + | Int i -> i :> System.IConvertible + + module OntologyAnnotation = + + let asCvTerm (oa: OntologyAnnotation) = + CvTerm.create( + accession = oa.TermAccessionString, + name = oa.NameText, + ref = oa.TermSourceREFString ) + module IOType = + + let asCvTerm (io: IOType) = + match io with + | IOType.Source -> StructuralOntology.APGSO.IOType.Source + | IOType.Sample -> StructuralOntology.APGSO.IOType.Sample + | IOType.RawDataFile -> StructuralOntology.APGSO.IOType.RawDataFile + | IOType.DerivedDataFile -> StructuralOntology.APGSO.IOType.DerivedDataFile + | IOType.ImageFile -> StructuralOntology.APGSO.IOType.ImageFile + | IOType.Material -> StructuralOntology.APGSO.IOType.Material + | IOType.FreeText s -> CvTerm.create (accession = "", name = s, ref = "") + + module CompositeHeader = + + let toCvTerm(ch: CompositeHeader) = + match ch with + | CompositeHeader.Characteristic _ -> StructuralOntology.APGSO.``Process Graph Header``.Characteristic + | CompositeHeader.Factor _ -> StructuralOntology.APGSO.``Process Graph Header``.Factor + | CompositeHeader.Parameter _ -> StructuralOntology.APGSO.``Process Graph Header``.Parameter + | CompositeHeader.Component _ -> StructuralOntology.APGSO.``Process Graph Header``.Component + | CompositeHeader.ProtocolType -> StructuralOntology.APGSO.``Process Graph Header``.ProtocolType + | CompositeHeader.ProtocolDescription -> StructuralOntology.APGSO.``Process Graph Header``.ProtocolDescription + | CompositeHeader.ProtocolUri -> StructuralOntology.APGSO.``Process Graph Header``.ProtocolUri + | CompositeHeader.ProtocolVersion -> StructuralOntology.APGSO.``Process Graph Header``.ProtocolVersion + | CompositeHeader.ProtocolREF -> StructuralOntology.APGSO.``Process Graph Header``.ProtocolREF + | CompositeHeader.Performer -> StructuralOntology.APGSO.``Process Graph Header``.Performer + | CompositeHeader.Date -> StructuralOntology.APGSO.``Process Graph Header``.Date + | CompositeHeader.Input _ -> StructuralOntology.APGSO.``Process Graph Header``.Input + | CompositeHeader.Output _ -> StructuralOntology.APGSO.``Process Graph Header``.Output + | CompositeHeader.FreeText _ -> StructuralOntology.APGSO.FreeText + + let toHeaderParam (ch: CompositeHeader) : IParam = + match ch with + | CompositeHeader.Characteristic term -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.Characteristic, ParamValue.CvValue (OntologyAnnotation.asCvTerm term)) + + | CompositeHeader.Factor term -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.Factor, ParamValue.CvValue (OntologyAnnotation.asCvTerm term)) + + | CompositeHeader.Parameter term -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.Parameter, ParamValue.CvValue (OntologyAnnotation.asCvTerm term)) + + | CompositeHeader.Component term -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.Component, ParamValue.CvValue (OntologyAnnotation.asCvTerm term)) + + | CompositeHeader.ProtocolType -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.ProtocolType, ParamValue.Value "") + + | CompositeHeader.ProtocolDescription -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.ProtocolDescription, ParamValue.Value "") + + | CompositeHeader.ProtocolUri -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.ProtocolUri, ParamValue.Value "") + + | CompositeHeader.ProtocolVersion -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.ProtocolVersion, ParamValue.Value "") - | _ -> None \ No newline at end of file + | CompositeHeader.ProtocolREF -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.ProtocolREF, ParamValue.Value "") + + | CompositeHeader.Performer -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.Performer, ParamValue.Value "") + + | CompositeHeader.Date -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.Date, ParamValue.Value "") + + | CompositeHeader.Input io -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.Input, ParamValue.CvValue (IOType.asCvTerm io)) + + | CompositeHeader.Output io -> + CvParam(StructuralOntology.APGSO.``Process Graph Header``.Output, ParamValue.CvValue (IOType.asCvTerm io)) + + | CompositeHeader.FreeText f -> + UserParam(f, ParamValue.CvValue StructuralOntology.APGSO.FreeText) + + module CompositeCell = + + let toCvParam (ch: CompositeHeader) (cc: CompositeCell) : IParam = + + let headerTerm = CompositeHeader.toCvTerm ch + + match cc with + | CompositeCell.FreeText t -> + CvParam(headerTerm, ParamValue.Value t) + + | CompositeCell.Term term -> + CvParam(headerTerm, ParamValue.CvValue (OntologyAnnotation.asCvTerm term)) + + | CompositeCell.Unitized (v, unit) -> + CvParam(headerTerm, ParamValue.WithCvUnitAccession (v, OntologyAnnotation.asCvTerm unit)) + + module CompositeColumn = + + let tokenize (cc: CompositeColumn) : IParam list= + [ + CompositeHeader.toHeaderParam cc.Header + yield! (Array.map (CompositeCell.toCvParam cc.Header) cc.Cells) + ] + + module ARCTable = + + let tokenizeColumns (at: ArcTable) = + at.Columns + |> Array.map CompositeColumn.tokenize + |> List.ofArray diff --git a/src/ARCTokenization/structural_ontologies/APGSO.fs b/src/ARCTokenization/structural_ontologies/APGSO.fs new file mode 100644 index 0000000..06702a7 --- /dev/null +++ b/src/ARCTokenization/structural_ontologies/APGSO.fs @@ -0,0 +1,42 @@ +// This file should eventually be auto-generated from the respective obo files, to have a safe way of updating it from the same source. +// For now, it is manually created and updated. It is not complete, just a collectAFSOn of terms needed for baseline WIP validatAFSOn + +namespace ARCTokenization.StructuralOntology + +open ControlledVocabulary + +module APGSO = + + let FreeText = CvTerm.create(accession = "APGSO:00000022", name = "FreeText", ref = "APGSO") + + module ``Process Graph Header`` = + + let key = CvTerm.create(accession = "APGSO:00000001", name = "Process Graph Header", ref = "APGSO") + + let Characteristic = CvTerm.create(accession = "APGSO:00000002", name = "Characteristic", ref = "APGSO") + let Factor = CvTerm.create(accession = "APGSO:00000003", name = "Factor", ref = "APGSO") + let Parameter = CvTerm.create(accession = "APGSO:00000004", name = "Parameter", ref = "APGSO") + let Component = CvTerm.create(accession = "APGSO:00000005", name = "Component", ref = "APGSO") + let ProtocolType = CvTerm.create(accession = "APGSO:00000006", name = "ProtocolType", ref = "APGSO") + let ProtocolDescription = CvTerm.create(accession = "APGSO:00000007", name = "ProtocolDescription", ref = "APGSO") + let ProtocolUri = CvTerm.create(accession = "APGSO:00000008", name = "ProtocolUri", ref = "APGSO") + let ProtocolVersion = CvTerm.create(accession = "APGSO:00000009", name = "ProtocolVersion", ref = "APGSO") + let ProtocolREF = CvTerm.create(accession = "APGSO:00000010", name = "ProtocolREF", ref = "APGSO") + let Performer = CvTerm.create(accession = "APGSO:00000011", name = "Performer", ref = "APGSO") + let Date = CvTerm.create(accession = "APGSO:00000012", name = "Date", ref = "APGSO") + let Input = CvTerm.create(accession = "APGSO:00000013", name = "Input", ref = "APGSO") + let Output = CvTerm.create(accession = "APGSO:00000014", name = "Output", ref = "APGSO") + + module IOType = + + let key = CvTerm.create(accession = "APGSO:00000016", name = "IOType", ref = "APGSO") + + let Source = CvTerm.create(accession = "APGSO:00000016", name = "Source", ref = "APGSO") + let Sample = CvTerm.create(accession = "APGSO:00000017", name = "Sample", ref = "APGSO") + let RawDataFile = CvTerm.create(accession = "APGSO:00000018", name = "RawDataFile", ref = "APGSO") + let DerivedDataFile = CvTerm.create(accession = "APGSO:00000019", name = "DerivedDataFile", ref = "APGSO") + let ImageFile = CvTerm.create(accession = "APGSO:00000020", name = "ImageFile", ref = "APGSO") + let Material = CvTerm.create(accession = "APGSO:00000021", name = "Material", ref = "APGSO") + + + diff --git a/src/ARCTokenization/structural_ontologies/arc_file_structure_ontology.obo b/src/ARCTokenization/structural_ontologies/arc_file_structure_ontology.obo index ea5c0e9..704337a 100644 --- a/src/ARCTokenization/structural_ontologies/arc_file_structure_ontology.obo +++ b/src/ARCTokenization/structural_ontologies/arc_file_structure_ontology.obo @@ -1,4 +1,4 @@ -!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. +!This file was auto generated on 2024-01-09. 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 diff --git a/src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.obo b/src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.obo new file mode 100644 index 0000000..c0b95b9 --- /dev/null +++ b/src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.obo @@ -0,0 +1,129 @@ +!This file was auto generated on 2024-01-09. Do not edit it. All manual changes will be overwritten by the next generator run eventually. +format-version: 1.2 +data-version: init/2024-01-09 +saved-by: Kevin Schneider +default-namespace: apgso +ontology: APGSO + +[Term] +id: APGSO:00000001 +name: Process Graph Header +def: "" + +[Term] +id: APGSO:00000002 +name: Characteristic +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000003 +name: Factor +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000004 +name: Parameter +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000005 +name: Component +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000006 +name: ProtocolType +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000007 +name: ProtocolDescription +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000008 +name: ProtocolUri +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000009 +name: ProtocolVersion +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000010 +name: ProtocolREF +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000011 +name: Performer +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000012 +name: Date +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000013 +name: Input +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000014 +name: Output +def: "" +relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000015 +name: IOType +def: "" + +[Term] +id: APGSO:00000016 +name: Source +relationship: is_a APGSO:00000014 ! IOType + +[Term] +id: APGSO:00000017 +name: Sample +relationship: is_a APGSO:00000014 ! IOType + +[Term] +id: APGSO:00000018 +name: RawDataFile +relationship: is_a APGSO:00000014 ! IOType + +[Term] +id: APGSO:00000019 +name: DerivedDataFile +relationship: is_a APGSO:00000014 ! IOType + +[Term] +id: APGSO:00000020 +name: ImageFile +relationship: is_a APGSO:00000014 ! IOType + +[Term] +id: APGSO:00000021 +name: Material +relationship: is_a APGSO:00000014 ! IOType + +[Term] +id: APGSO:00000022 +name: FreeText +def: "" diff --git a/src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.yml b/src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.yml new file mode 100644 index 0000000..83e7891 --- /dev/null +++ b/src/ARCTokenization/structural_ontologies/arc_process_graph_structural_ontology.yml @@ -0,0 +1,128 @@ +format-version: 1.2 +data-version: init/2024-01-09 +saved-by: Kevin Schneider +default-namespace: apgso +ontology: APGSO + +[Term] +id: APGSO:00000001 +name: Process Graph Header +def: "" + + [Term] + id: APGSO:00000002 + name: Characteristic + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000003 + name: Factor + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000004 + name: Parameter + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000005 + name: Component + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000006 + name: ProtocolType + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000007 + name: ProtocolDescription + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000008 + name: ProtocolUri + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000009 + name: ProtocolVersion + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000010 + name: ProtocolREF + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000011 + name: Performer + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000012 + name: Date + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000013 + name: Input + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + + [Term] + id: APGSO:00000014 + name: Output + def: "" + relationship: is_a APGSO:00000001 ! Process Graph Header + +[Term] +id: APGSO:00000015 +name: IOType +def: "" + + [Term] + id: APGSO:00000016 + name: Source + relationship: is_a APGSO:00000014 ! IOType + + [Term] + id: APGSO:00000017 + name: Sample + relationship: is_a APGSO:00000014 ! IOType + + [Term] + id: APGSO:00000018 + name: RawDataFile + relationship: is_a APGSO:00000014 ! IOType + + [Term] + id: APGSO:00000019 + name: DerivedDataFile + relationship: is_a APGSO:00000014 ! IOType + + [Term] + id: APGSO:00000020 + name: ImageFile + relationship: is_a APGSO:00000014 ! IOType + + [Term] + id: APGSO:00000021 + name: Material + relationship: is_a APGSO:00000014 ! IOType + +[Term] +id: APGSO:00000022 +name: FreeText +def: "" \ No newline at end of file diff --git a/src/ARCTokenization/structural_ontologies/assay_metadata_structural_ontology.obo b/src/ARCTokenization/structural_ontologies/assay_metadata_structural_ontology.obo index 0cfeedb..3fb2b41 100644 --- a/src/ARCTokenization/structural_ontologies/assay_metadata_structural_ontology.obo +++ b/src/ARCTokenization/structural_ontologies/assay_metadata_structural_ontology.obo @@ -1,4 +1,4 @@ -!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. +!This file was auto generated on 2024-01-09. 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 diff --git a/src/ARCTokenization/structural_ontologies/investigation_metadata_structural_ontology.obo b/src/ARCTokenization/structural_ontologies/investigation_metadata_structural_ontology.obo index e2f5848..dac71f7 100644 --- a/src/ARCTokenization/structural_ontologies/investigation_metadata_structural_ontology.obo +++ b/src/ARCTokenization/structural_ontologies/investigation_metadata_structural_ontology.obo @@ -1,4 +1,4 @@ -!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. +!This file was auto generated on 2024-01-09. 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 diff --git a/src/ARCTokenization/structural_ontologies/study_metadata_structural_ontology.obo b/src/ARCTokenization/structural_ontologies/study_metadata_structural_ontology.obo index ed62060..4b7c425 100644 --- a/src/ARCTokenization/structural_ontologies/study_metadata_structural_ontology.obo +++ b/src/ARCTokenization/structural_ontologies/study_metadata_structural_ontology.obo @@ -1,4 +1,4 @@ -!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. +!This file was auto generated on 2024-01-09. 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 diff --git a/tests/ARCTokenization.Tests/ARCTokenization.Tests.fsproj b/tests/ARCTokenization.Tests/ARCTokenization.Tests.fsproj index 5725122..beda029 100644 --- a/tests/ARCTokenization.Tests/ARCTokenization.Tests.fsproj +++ b/tests/ARCTokenization.Tests/ARCTokenization.Tests.fsproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false false @@ -25,14 +25,13 @@ - - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/ARCTokenization.Tests/ReferenceObjects.fs b/tests/ARCTokenization.Tests/ReferenceObjects.fs index 100a413..e078f18 100644 --- a/tests/ARCTokenization.Tests/ReferenceObjects.fs +++ b/tests/ARCTokenization.Tests/ReferenceObjects.fs @@ -208,6 +208,32 @@ module Terms = ] + module ProcessGraph = + + let referenceOntologyName = "APGSO" + + let expectedNonObsoleteNonRootTerms = [ + CvTerm.create(accession = "APGSO:00000002", name = "Characteristic", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000003", name = "Factor", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000004", name = "Parameter", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000005", name = "Component", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000006", name = "ProtocolType", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000007", name = "ProtocolDescription", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000008", name = "ProtocolUri", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000009", name = "ProtocolVersion", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000010", name = "ProtocolREF", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000011", name = "Performer", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000012", name = "Date", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000013", name = "Input", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000014", name = "Output", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000016", name = "Source", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000017", name = "Sample", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000018", name = "RawDataFile", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000019", name = "DerivedDataFile", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000020", name = "ImageFile", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000021", name = "Material", ref = "APGSO") + CvTerm.create(accession = "APGSO:00000022", name = "FreeText", ref = "APGSO") + ] diff --git a/tests/ARCTokenization.Tests/StructuralOntologyTests.fs b/tests/ARCTokenization.Tests/StructuralOntologyTests.fs index 8def730..dcdd862 100644 --- a/tests/ARCTokenization.Tests/StructuralOntologyTests.fs +++ b/tests/ARCTokenization.Tests/StructuralOntologyTests.fs @@ -210,4 +210,44 @@ module AssayMetadata = && (actual.RefUri = expected.RefUri) ) ) + ) + +module ProcessGraph = + + [] + let ``no duplicate term ids`` () = + let expected = [1 .. ProcessGraph.ontology.Terms.Length] + let actual = + ProcessGraph.ontology.Terms + |> List.map (fun t -> + t.Id.Replace("APGSO:","") |> int + ) + |> List.sort + Assert.All( + List.zip expected actual, + (fun (e,a) -> Assert.Equal(e,a)) + ) + + [] + let ``all ontology names correct`` () = + Assert.All( + ProcessGraph.cvTerms, + (fun t -> Assert.True(t.RefUri = ReferenceObjects.Terms.ProcessGraph.referenceOntologyName)) + ) + + [] + let ``all non root non obsolete CvTerms are correct`` () = + Assert.All( + ( + List.zip + ProcessGraph.nonObsoleteNonRootCvTerms + ReferenceObjects.Terms.ProcessGraph.expectedNonObsoleteNonRootTerms + ), + (fun (actual, expected) -> + Assert.True( + (actual.Name = expected.Name) + && (actual.Accession = expected.Accession) + && (actual.RefUri = expected.RefUri) + ) + ) ) \ No newline at end of file diff --git a/tests/ControlledVocabulary.Tests/ControlledVocabulary.Tests.fsproj b/tests/ControlledVocabulary.Tests/ControlledVocabulary.Tests.fsproj index 3c313ae..3f16e63 100644 --- a/tests/ControlledVocabulary.Tests/ControlledVocabulary.Tests.fsproj +++ b/tests/ControlledVocabulary.Tests/ControlledVocabulary.Tests.fsproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false false @@ -16,13 +16,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -32,8 +32,4 @@ - - - -