From e9e8bc2e3eb2510760b1dff05e8890d574b68b82 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 27 Jul 2023 11:41:46 +0200 Subject: [PATCH] Add first simple integration test for annotation table parsing --- playground.fsx | 14 +--- .../ArcGraphModel.Tests.fsproj | 2 + ...ay_with_only_source_and_sample_column.xlsx | Bin 0 -> 11144 bytes .../assay_with_single_characteristics.xlsx | Bin 0 -> 11561 bytes .../IntegrationTests/Assay.fs | 75 ++++++++++++++++++ .../ParseInvestigationTests.fs | 1 - tests/ArcGraphModel.Tests/TestObjects.fs | 13 +++ tests/ArcGraphModel.Tests/TestUtils.fs | 61 ++++++++++++-- 8 files changed, 147 insertions(+), 19 deletions(-) create mode 100644 tests/ArcGraphModel.Tests/Fixtures/correct/assay_with_only_source_and_sample_column.xlsx create mode 100644 tests/ArcGraphModel.Tests/Fixtures/correct/assay_with_single_characteristics.xlsx create mode 100644 tests/ArcGraphModel.Tests/IntegrationTests/Assay.fs create mode 100644 tests/ArcGraphModel.Tests/TestObjects.fs diff --git a/playground.fsx b/playground.fsx index b7c78fb..a6faaf1 100644 --- a/playground.fsx +++ b/playground.fsx @@ -40,19 +40,7 @@ open ArcGraphModel // Assay annotation table parsing -let assay = FsWorkbook.fromXlsxFile (__SOURCE_DIRECTORY__ + "/tests/ArcGraphModel.Tests/Fixtures/isa.assay.xlsx") - -let sheet1 = FsWorkbook.getWorksheets assay |> Seq.item 0 -let sheet2 = FsWorkbook.getWorksheets assay |> Seq.item 1 - -sheet1.Rows[0] |> Seq.toList -sheet2.Rows[0] |> Seq.toList - -let assayTables = AnnotationTable.parseWorkbook assay - -assayTables[1] -|> snd -|> fun x -> x.TermRelatedBuildingBlocks +let assayTokens = Assay.parseAnnotationTablesFromFile (__SOURCE_DIRECTORY__ + "/tests/ArcGraphModel.Tests/Fixtures/correct/assay_with_only_source_and_sample_column.xlsx") // Investigation metadata parsing diff --git a/tests/ArcGraphModel.Tests/ArcGraphModel.Tests.fsproj b/tests/ArcGraphModel.Tests/ArcGraphModel.Tests.fsproj index 3b952cf..aa761b9 100644 --- a/tests/ArcGraphModel.Tests/ArcGraphModel.Tests.fsproj +++ b/tests/ArcGraphModel.Tests/ArcGraphModel.Tests.fsproj @@ -9,6 +9,8 @@ + + diff --git a/tests/ArcGraphModel.Tests/Fixtures/correct/assay_with_only_source_and_sample_column.xlsx b/tests/ArcGraphModel.Tests/Fixtures/correct/assay_with_only_source_and_sample_column.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..b4f7979a3a5179af9b7f652b61dad536a0bb20a8 GIT binary patch literal 11144 zcmeHtg;!PE`u0Y;LlBVeZlpoFyQI4tHqw%UqzG(MK%`T;K?J0`q`SLoBk*lK=YAeJ z-oM~?*BE=QvBz5PGuE8*ecqhPa?mi?05|{w001BZ@WA0TM?wJrH?RP}V*tVFlbD%!6hrJzXCd?z+48SAE`~SQC53fM6dXGa8D@OB+o#&*63{InB8X9E0 zuDmrdDZc(eZ;YU7)}3ow4wo3i>7QZ+BU6-ZHg~-@=bRqbsCx9KcMF6X2NfY~DM{Zf zJw3EX;cJ2E^)V+uG6ZA~HErhO$DLx&WF$WQR87;v(U7OB*k8xUgwcwxC#ono??vsB zrdf^_z>g3m-NT{^e&2M_sO)$P)up`H=j`*xA$}?}db5$;1C#c6c4PY-_GKA5L+k4| zR0|xGAp8TPkBma^P&#$-Q{wIsFFXy+qSUZ53!LuM#wmjw=|6LQN+nRE-W1VMPZ4;5 zFCE8Z>q08BD=f_j@X@Ctqpns4XWXFp)kO-tHXag9xkvswL8;Nh{rO!mbUBXd#H z|J5w9aAOkkvaqkWRNP3TzuF#iUq>q8(r3h1iGu!a)x`bFthrGrj3vXk@!6doleax! znAK1xoI|=cD&{KShpcSOG(OXqg!rIcf`hWCl)Wh|44%@Zy6Bk=aJO{C!3G-ovshBy zI!~?nRYQpW-QPn4lz$_!bvUUp5ro9c5RM{4NNnh0ZUZ6qK9IB9Kdjepak{;3^{ z0o&IEJ+f0fW>`Lj+?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XkKd_)VcLK{fyeXI9Qmxnh?3^@j1 zsawYm<%nHu6q!kmJm|ccZ<~Q93S2>Xw;%TGez(r$l~z={5C@@Vsr0o*xL!qPZY&U8 zR0J?Ko$J;vzDuV(*($kh8TBMCIKsw+*m^jxTRD5iPFNMd;Ah4l7%?ND!Q2&MZHzjE zU)xsYo6jO+yjrm%;B24X%J*ZaCr`z->U3i8=(q0VKdssObh<(eL}+`EMWcb*9wzq2 zicaYv8P`RZB=@dgma{0^+GpOyAlI5nDjAF*@`*My24x84H{0sgN#dr1An3vOGo*)5tlppqg;OL{am>AVPYTP z{tep)AbCADG&$d3JGJ8*^IoVAs1VQMJF9tMr$MNw1}EPPy+fcQ@KybQR+Cc-yx}WG z#gg%8mOlc6fi$4;UgiEX)x75r#$~k;cw&S3+alw<8p??Bgrm9mhRK-)uY=ev zZ;v}M=@mj=gUk1meTtFW`Iyj91lBk|Q#|HZ^!%`(6XEO6*xpdZ1#C(f_$YrM#4vFR zfR=385-iJ)!14Qmr1=aQbtef~rg3O-gQ|X~y;tv%H|A^vCQ1czV(`TT!B4*8$u`p@_;ha(kb{|@l? zqgekD{B7(5apErrv;HCY;?&76Q4CPs=EWJ5m%@MVbpH|s16v05s{Z%B_e-3Y?ayCG zsG!Qx|JDqBiSn}F^9#iU@UPvUmjEv-R=)s#fZ|xtYy7HTy%c?!;{Oso#{Wa~Wy1dw z;bl7e3qh3d4;}n1LjGH9{1WSBw)YFmf#_eb{*n8=#Cw^n{K5k#`2+9&le)YFe3=0J z0(|-t@Nbj--_n7XurCAZU$D?*zrW`{!t0j^e-C1Q$%BDSgR-=LgfuV3|L%zXDlSj` c7x6#clAy8VB-kxe(a@0Qok=_5c6? literal 0 HcmV?d00001 diff --git a/tests/ArcGraphModel.Tests/IntegrationTests/Assay.fs b/tests/ArcGraphModel.Tests/IntegrationTests/Assay.fs new file mode 100644 index 0000000..527ddef --- /dev/null +++ b/tests/ArcGraphModel.Tests/IntegrationTests/Assay.fs @@ -0,0 +1,75 @@ +module IntegrationTests.Assay + +open ControlledVocabulary +open FsSpreadsheet +open FsSpreadsheet.ExcelIO +open ArcGraphModel +open Xunit + +open TestUtils +open TestObjects + +module Correct = + + module ``Assay with only source and sample column`` = + + let assay = Assays.Correct.``assay with only source and sample column`` + + [] + let ``AnnotationTable count`` () = + Assert.Equal(assay.Length, 1) + + let table = assay.[0] |> snd + + [] + let ``TokenizedAnnotationTable IOColumn count`` () = + TokenizedAnnotationTable.hasIOColumnAmount 2 table + + [] + let ``TokenizedAnnotationTable TermRelatedBuildingBlocksAmount`` () = + TokenizedAnnotationTable.hasTermRelatedBuildingBlockAmount 0 table + + let expectedIOColumns = + [ + [ + CvParam( + id = "(n/a)", + name = "Source Name", + ref = "(n/a)", + pv = (ParamValue.Value "Source A"), + attributes = [] + ) + ] + [ + CvParam( + id = "(n/a)", + name = "Sample Name", + ref = "(n/a)", + pv = (ParamValue.Value "Sample A"), + attributes = [] + ) + ] + ] + + let expectedTermRelatedBuildingBlocks: CvParam list list = [] + + [] + let ``TokenizedAnnotationTable IOColumns`` () = + (expectedIOColumns, table.IOColumns) + ||> List.iter2 (fun expectedGroup actualGroup -> + (expectedGroup, actualGroup) + ||> List.iter2 (fun expectedParam actualParam -> + CvParam.structuralEquality expectedParam actualParam + ) + ) + + [] + let ``TokenizedAnnotationTable TermRelatedBuildingBlocks`` () = + (expectedTermRelatedBuildingBlocks, table.TermRelatedBuildingBlocks) + ||> List.iter2 (fun expectedGroup actualGroup -> + (expectedGroup, actualGroup) + ||> List.iter2 (fun expectedParam actualParam -> + CvParam.structuralEquality expectedParam actualParam + ) + ) + diff --git a/tests/ArcGraphModel.Tests/IntegrationTests/ParseInvestigationTests.fs b/tests/ArcGraphModel.Tests/IntegrationTests/ParseInvestigationTests.fs index 6a45e14..7349b0f 100644 --- a/tests/ArcGraphModel.Tests/IntegrationTests/ParseInvestigationTests.fs +++ b/tests/ArcGraphModel.Tests/IntegrationTests/ParseInvestigationTests.fs @@ -8,7 +8,6 @@ open Xunit open TestUtils - let inves = FsWorkbook.fromXlsxFile "Fixtures/isa.investigation.xlsx" let invesWs = FsWorkbook.getWorksheets inves |> Seq.head let invesWsParsed = Worksheet.parseRowsFlat invesWs diff --git a/tests/ArcGraphModel.Tests/TestObjects.fs b/tests/ArcGraphModel.Tests/TestObjects.fs new file mode 100644 index 0000000..5ce4b0a --- /dev/null +++ b/tests/ArcGraphModel.Tests/TestObjects.fs @@ -0,0 +1,13 @@ +module TestObjects + +open ArcGraphModel + +module Assays = + + module Correct = + + let ``assay with only source and sample column`` = + Assay.parseAnnotationTablesFromFile "Fixtures/correct/assay_with_only_source_and_sample_column.xlsx" + + let ``assay with characteristics`` = + Assay.parseAnnotationTablesFromFile "Fixtures/correct/assay_with_single_characteristics.xlsx" \ No newline at end of file diff --git a/tests/ArcGraphModel.Tests/TestUtils.fs b/tests/ArcGraphModel.Tests/TestUtils.fs index 4c78cba..9a98df2 100644 --- a/tests/ArcGraphModel.Tests/TestUtils.fs +++ b/tests/ArcGraphModel.Tests/TestUtils.fs @@ -7,14 +7,61 @@ open ArcGraphModel.AnnotationTable module CvParam = - open ArcGraphModel + let termNamesEqual (cvpExpectec : CvParam) (cvpActual : CvParam) = + Assert.Equal( + (CvBase.getCvName cvpExpectec), + (CvBase.getCvName cvpActual) + ) + + let hasTermName (expectedName : string) (cvpActual : CvParam) = + Assert.Equal( + expectedName, + (CvBase.getCvName cvpActual) + ) + + let accessionsEqual (cvpExpectec : CvParam) (cvpActual : CvParam) = + Assert.Equal( + (CvBase.getCvAccession cvpExpectec), + (CvBase.getCvAccession cvpActual) + ) + + let hasAccession (expectedID : string) (cvpActual : CvParam) = + Assert.Equal( + expectedID, + (CvBase.getCvAccession cvpActual) + ) - let termNamesEqual (cvpActual : CvParam) (cvpExpectec : CvParam) = + let refUrisEqual (cvpExpectec : CvParam) (cvpActual : CvParam) = Assert.Equal( - (CvBase.getCvName cvpActual), - (CvBase.getCvName cvpExpectec) + (CvBase.getCvRef cvpExpectec), + (CvBase.getCvRef cvpActual) ) + let hasRefUri (expectedRefUri : string) (cvpActual : CvParam) = + Assert.Equal( + expectedRefUri, + (CvBase.getCvRef cvpActual) + ) + + let valuesEqual (cvpExpectec : CvParam) (cvpActual : CvParam) = + Assert.Equal( + (Param.getParamValue cvpExpectec), + (Param.getParamValue cvpActual) + ) + + let hasValue (expectedValue : ParamValue) (cvpActual : CvParam) = + Assert.Equal( + expectedValue, + (Param.getParamValue cvpActual) + ) + + let structuralEquality (cvpExpectec : CvParam) (cvpActual : CvParam) = + termNamesEqual cvpExpectec cvpActual + accessionsEqual cvpExpectec cvpActual + refUrisEqual cvpExpectec cvpActual + valuesEqual cvpExpectec cvpActual + + module UserParam = open ArcGraphModel @@ -27,4 +74,8 @@ module UserParam = module TokenizedAnnotationTable = - () \ No newline at end of file + let hasIOColumnAmount (expectedIOColumnAmount : int) (table : TokenizedAnnotationTable) = + Assert.Equal(expectedIOColumnAmount, table.IOColumns.Length) + + let hasTermRelatedBuildingBlockAmount (expectedTermRelatedBuildingBlockAmount : int) (table : TokenizedAnnotationTable) = + Assert.Equal(expectedTermRelatedBuildingBlockAmount, table.TermRelatedBuildingBlocks.Length)