Skip to content

Commit

Permalink
Update to FsSpreadsheet 3.4 (soon 4.0), fix nbackwards incompatible s…
Browse files Browse the repository at this point in the history
…tuff, use dense rows
  • Loading branch information
kMutagene committed Aug 11, 2023
1 parent 28599f7 commit c6e2072
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/ARCTokenization/ARCTokenization.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<ProjectReference Include="..\ControlledVocabulary\ControlledVocabulary.fsproj" PackageVersion="[0.0.0, 1.0.0)" />
<PackageReference Include="FSharpAux.Core" Version="[2.0.0]" />
<PackageReference Include="FsOboParser" Version="[0.1.0]" />
<PackageReference Include="FsSpreadsheet" Version="[3.1.1]" />
<PackageReference Include="FsSpreadsheet.ExcelIO" Version="[3.1.1]" />
<PackageReference Include="FsSpreadsheet" Version="[3.4.0]" />
<PackageReference Include="FsSpreadsheet.ExcelIO" Version="[3.4.0]" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>

Expand Down
11 changes: 6 additions & 5 deletions src/ARCTokenization/AnnotationTable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module AnnotationTable =
/// Takes an FsWorkbook and returns all Annotation Tables it contains.
/// </summary>
let getAnnotationTables workbook =
let tables = FsWorkbook.getTables workbook
let tables = FsWorkbook.getTables workbook |> List.ofArray
tables |> List.filter (fun t -> String.contains "annotationTable" t.Name)

/// <summary>
Expand Down Expand Up @@ -254,19 +254,19 @@ module AnnotationTable =
// get worksheet and its AnnotationTable as tuple
let worksheetsAndTables =
tables
|> List.map (
|> Seq.map (
fun t ->
let associatedWs =
worksheets
|> List.find (
|> Seq.find (
fun ws ->
ws.Tables
|> List.exists (fun t2 -> t2.Name = t.Name)
|> Seq.exists (fun t2 -> t2.Name = t.Name)
)
associatedWs, t
)
worksheetsAndTables
|> List.map (
|> Seq.map (
fun (ws,t) ->
let ioHeaderCells, termRelatedBuildingBlockHeaderCells =
getHeaderCellsOf ws.CellCollection t
Expand All @@ -282,6 +282,7 @@ module AnnotationTable =
ws.Name,
TokenizedAnnotationTable.create ioColumns termRelatedBuildingBlocks
)
|> List.ofSeq

/// <summary>
/// Takes a CvParam and returns the type of Node it contains.
Expand Down
6 changes: 3 additions & 3 deletions src/ARCTokenization/Workbook.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Workbook =
with _ ->
if useLastSheetOnIncorrectName then
FsWorkbook.getWorksheets investigation
|> List.last
|> Seq.last
else
failwith "No worksheet named 'isa_investigation' found in the workbook"

Expand All @@ -24,7 +24,7 @@ module Workbook =
with _ ->
if useLastSheetOnIncorrectName then
FsWorkbook.getWorksheets study
|> List.last
|> Seq.last
else
failwith "No worksheet named 'Study' or 'isa_study' found in the workbook"

Expand All @@ -35,6 +35,6 @@ module Workbook =
with _ ->
if useLastSheetOnIncorrectName then
FsWorkbook.getWorksheets assay
|> List.last
|> Seq.last
else
failwith "No worksheet named 'Assay' or 'isa_assay' found in the workbook"
4 changes: 2 additions & 2 deletions src/ARCTokenization/Worksheet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ module Worksheet =

/// Parses rows of a given FsWorksheet via a given tokenization function and returns the resulting IParam list.
let parseRowsWith tokenizationFunction (worksheet : FsWorksheet) =
parseCellsWith (worksheet.Rows) tokenizationFunction worksheet
parseCellsWith (worksheet.Rows |> Seq.map FsRow.toDenseRow |> Seq.toList) tokenizationFunction worksheet

/// Parses rows of a given FsWorksheet via a given tokenization function and returns the resulting IParam list.
/// Concatenates the resulting lists of IParams into a single list.
let parseRowsFlatWith tokenizationFunction (worksheet : FsWorksheet) =
parseCellsFlatWith (worksheet.Rows) tokenizationFunction worksheet
parseCellsFlatWith (worksheet.Rows |> Seq.map FsRow.toDenseRow |> Seq.toList) tokenizationFunction worksheet

/// Parses columns of a given FsWorksheet via a given tokenization function and returns the resulting IParam list.
let parseColumnsWith tokenizationFunction (worksheet : FsWorksheet) =
Expand Down
16 changes: 8 additions & 8 deletions src/ARCTokenization/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@
},
"FsSpreadsheet": {
"type": "Direct",
"requested": "[3.1.1, 3.1.1]",
"resolved": "3.1.1",
"contentHash": "dD9Je8u6XO8J2ZMrfRTljmlD992pW+8tvxsbCtvnvmDnzzuos/cxP1jYRjsEneSG4FSpRRQhzwtqkyvhCqxS1Q==",
"requested": "[3.4.0, 3.4.0]",
"resolved": "3.4.0",
"contentHash": "Uza3yL6hh/kiFhj+SYq91oeR08FVH95ce1b5gr64nPx3MXTo7bHJ2j5YJB63WaRwMwBKonsASD1fws58FC/ARA==",
"dependencies": {
"FSharp.Core": "6.0.6",
"FSharp.Core": "6.0.7",
"Fable.Core": "4.0.0"
}
},
"FsSpreadsheet.ExcelIO": {
"type": "Direct",
"requested": "[3.1.1, 3.1.1]",
"resolved": "3.1.1",
"contentHash": "HVxKVw2lF+/1EWr6571thtHbEVcCP7MjFS1+OMEpQLTMZH3M8dJbNA0xFKaP2mMVzK2HESobbn7hrMzc6hi6zQ==",
"requested": "[3.4.0, 3.4.0]",
"resolved": "3.4.0",
"contentHash": "UVPbuoQQDsfrjVdpN88396HUgX0OwtYBaDb2N4u29FxNRzcKaK6VVMlIVRatMURnHy4ofqLW9PkPqYBzNvgz4w==",
"dependencies": {
"DocumentFormat.OpenXml": "[2.12.3]",
"FSharp.Core": "6.0.6",
"FSharp.Core": "6.0.7",
"FsSpreadsheet": "[3.0.0, 4.0.0)"
}
},
Expand Down
4 changes: 0 additions & 4 deletions tests/ARCTokenization.Tests/ARCTokenization.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@

<ItemGroup>
<ProjectReference Include="..\..\src\ARCTokenization\ARCTokenization.fsproj" />
<PackageReference Include="FSharp.FGL.ArrayAdjacencyGraph" Version="[0.0.2]" />
<PackageReference Include="FSharpAux.Core" Version="[2.0.0]" />
<PackageReference Include="FsSpreadsheet" Version="[3.1.1]" />
<PackageReference Include="FsSpreadsheet.ExcelIO" Version="[3.1.1]" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ let expectedTermValuesSimple =
[""]
[""]
[""]
[""; "Maus"; "Keider"; "müller"; "oih"]
[""; "Oliver"; "andreas"]
[""; "Maus"; "Keider"; "müller"; ""; "oih"]
[""; "Oliver"; ""; "andreas";]
[""; "L. I."; "C."]
[""; "maus@nfdi4plants.org"]
[""]
[""]
[""]
[""; "Affe"]
[""; ""; "Affe"]
[""]
[""]
[""]
Expand Down Expand Up @@ -206,7 +206,7 @@ let expectedTermValuesSimple =
[""]
[""]
[""; "weil"]
[""; "lukas"]
[""; ""; "lukas"]
[""]
[""]
[""]
Expand Down

0 comments on commit c6e2072

Please sign in to comment.