@nfdi4plants/arctrl 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/ARC.js +39 -3
  2. package/Contracts/Contracts.ArcTypes.js +20 -8
  3. package/ISA/ISA/ArcTypes/ArcTable.js +5 -16
  4. package/ISA/ISA/ArcTypes/ArcTableAux.js +111 -68
  5. package/ISA/ISA/ArcTypes/ArcTypes.js +108 -73
  6. package/ISA/ISA.Json/ArcTypes/ArcAssay.js +74 -3
  7. package/ISA/ISA.Json/ArcTypes/ArcStudy.js +82 -3
  8. package/ISA/ISA.Json/ArcTypes/ArcTable.js +125 -4
  9. package/ISA/ISA.Json/ArcTypes/CellTable.js +46 -0
  10. package/ISA/ISA.Json/ArcTypes/CompositeCell.js +26 -0
  11. package/ISA/ISA.Json/ArcTypes/OATable.js +48 -0
  12. package/ISA/ISA.Json/Ontology.js +30 -0
  13. package/ISA/ISA.Json/StringTable.js +43 -0
  14. package/ISA/ISA.Spreadsheet/AnnotationTable/ArcTable.js +52 -39
  15. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeCell.js +1 -1
  16. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeColumn.js +3 -3
  17. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeHeader.js +1 -1
  18. package/ISA/ISA.Spreadsheet/ArcAssay.js +96 -84
  19. package/ISA/ISA.Spreadsheet/ArcInvestigation.js +2 -2
  20. package/ISA/ISA.Spreadsheet/ArcStudy.js +32 -20
  21. package/ISA/ISA.Spreadsheet/Metadata/SparseTable.js +7 -7
  22. package/Templates/Template.Spreadsheet.js +2 -2
  23. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsAddress.fs +22 -8
  24. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsAddress.fs.js +20 -10
  25. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsWorksheet.fs +12 -6
  26. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsWorksheet.fs.js +12 -8
  27. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +3 -3
  28. package/fable_modules/project_cracked.json +1 -1
  29. package/package.json +1 -1
  30. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Cells/FsCell.fs +0 -0
  31. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Cells/FsCell.fs.js +0 -0
  32. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Cells/FsCellsCollection.fs +0 -0
  33. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Cells/FsCellsCollection.fs.js +0 -0
  34. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/CellBuilder.fs +0 -0
  35. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/CellBuilder.fs.js +0 -0
  36. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/ColumnBuilder.fs +0 -0
  37. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/ColumnBuilder.fs.js +0 -0
  38. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/DSL.fs +0 -0
  39. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/DSL.fs.js +0 -0
  40. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Expression.fs +0 -0
  41. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Expression.fs.js +0 -0
  42. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Operators.fs +0 -0
  43. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Operators.fs.js +0 -0
  44. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/RowBuilder.fs +0 -0
  45. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/RowBuilder.fs.js +0 -0
  46. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/SheetBuilder.fs +0 -0
  47. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/SheetBuilder.fs.js +0 -0
  48. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/TableBuilder.fs +0 -0
  49. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/TableBuilder.fs.js +0 -0
  50. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Transform.fs +0 -0
  51. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Transform.fs.js +0 -0
  52. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Types.fs +0 -0
  53. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Types.fs.js +0 -0
  54. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/WorkbookBuilder.fs +0 -0
  55. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/WorkbookBuilder.fs.js +0 -0
  56. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsColumn.fs +0 -0
  57. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsColumn.fs.js +0 -0
  58. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsRow.fs +0 -0
  59. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsRow.fs.js +0 -0
  60. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsSpreadsheet.fableproj +0 -0
  61. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsWorkbook.fs +0 -0
  62. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsWorkbook.fs.js +0 -0
  63. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRange.fs +0 -0
  64. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRange.fs.js +0 -0
  65. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeAddress.fs +0 -0
  66. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeAddress.fs.js +0 -0
  67. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeBase.fs +0 -0
  68. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeBase.fs.js +0 -0
  69. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeColumn.fs +0 -0
  70. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeColumn.fs.js +0 -0
  71. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeRow.fs +0 -0
  72. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeRow.fs.js +0 -0
  73. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/SheetBuilder.fs +0 -0
  74. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/SheetBuilder.fs.js +0 -0
  75. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTable.fs +0 -0
  76. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTable.fs.js +0 -0
  77. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTableField.fs +0 -0
  78. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTableField.fs.js +0 -0
  79. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTableRow.fs +0 -0
  80. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTableRow.fs.js +0 -0
  81. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  82. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
  83. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
@@ -1,15 +1,21 @@
1
1
  import { toString, tuple2, map as map_1, list, object } from "../../../fable_modules/Thoth.Json.10.1.0/Encode.fs.js";
2
- import { collect, empty, map, singleton, append, delay, toList } from "../../../fable_modules/fable-library.4.5.0/Seq.js";
2
+ import { iterate, toArray, collect, empty, map, singleton, append, delay, toList } from "../../../fable_modules/fable-library.4.5.0/Seq.js";
3
3
  import { CompositeHeader_decoder, CompositeHeader_encoder } from "./CompositeHeader.js";
4
4
  import { CompositeCell_decoder, CompositeCell_encoder } from "./CompositeCell.js";
5
5
  import { empty as empty_2, ofSeq } from "../../../fable_modules/fable-library.4.5.0/Map.js";
6
- import { arrayHash, equalArrays, uncurry2, compareArrays } from "../../../fable_modules/fable-library.4.5.0/Util.js";
7
- import { fromString, string, int, tuple2 as tuple2_1, map$0027, list as list_1, object as object_1 } from "../../../fable_modules/Thoth.Json.10.1.0/Decode.fs.js";
8
- import { defaultArg } from "../../../fable_modules/fable-library.4.5.0/Option.js";
6
+ import { safeHash, equals, arrayHash, equalArrays, uncurry2, compareArrays } from "../../../fable_modules/fable-library.4.5.0/Util.js";
7
+ import { fromString, value as value_5, array as array_1, string, int, tuple2 as tuple2_1, map$0027, list as list_1, object as object_1 } from "../../../fable_modules/Thoth.Json.10.1.0/Decode.fs.js";
8
+ import { toArray as toArray_1, defaultArg } from "../../../fable_modules/fable-library.4.5.0/Option.js";
9
9
  import { empty as empty_1 } from "../../../fable_modules/fable-library.4.5.0/List.js";
10
10
  import { Dictionary } from "../../../fable_modules/fable-library.4.5.0/MutableMap.js";
11
11
  import { ArcTable } from "../../ISA/ArcTypes/ArcTable.js";
12
+ import { CellTable_arrayFromMap, CellTable_encoder, CellTable_decoder, CellTable_decodeCell, CellTable_encodeCell } from "./CellTable.js";
13
+ import { addToDict, getItemFromDict } from "../../../fable_modules/fable-library.4.5.0/MapUtil.js";
14
+ import { rangeDouble } from "../../../fable_modules/fable-library.4.5.0/Range.js";
15
+ import { iterateIndexed } from "../../../fable_modules/fable-library.4.5.0/Array.js";
16
+ import { StringTable_arrayFromMap, StringTable_encoder, StringTable_decoder, StringTable_decodeString, StringTable_encodeString } from "../StringTable.js";
12
17
  import { printf, toFail } from "../../../fable_modules/fable-library.4.5.0/String.js";
18
+ import { OATable_arrayFromMap, OATable_encoder, OATable_decoder } from "./OATable.js";
13
19
 
14
20
  export function ArcTable_encoder(table) {
15
21
  return object(toList(delay(() => append(singleton(["name", table.Name]), delay(() => append((table.Headers.length !== 0) ? singleton(["header", list(toList(delay(() => map(CompositeHeader_encoder, table.Headers))))]) : empty(), delay(() => ((table.Values.size !== 0) ? singleton(["values", map_1((tupledArg) => tuple2((value) => value, (value_2) => value_2, tupledArg[0], tupledArg[1]), CompositeCell_encoder, ofSeq(toList(delay(() => collect((matchValue) => {
@@ -37,6 +43,80 @@ export const ArcTable_decoder = (path_2) => ((v) => object_1((get$) => {
37
43
  return ArcTable.create((objectArg_2 = get$.Required, objectArg_2.Field("name", string)), decodedHeader, decodedValues);
38
44
  }, path_2, v));
39
45
 
46
+ export function ArcTable_compressedColumnEncoder(columnIndex, rowCount, cellTable, table) {
47
+ if (table.Headers[columnIndex].IsIOType ? true : (rowCount < 100)) {
48
+ return toArray(delay(() => map((r) => CellTable_encodeCell(cellTable, getItemFromDict(table.Values, [columnIndex, r])), rangeDouble(0, 1, rowCount - 1))));
49
+ }
50
+ else {
51
+ let current = getItemFromDict(table.Values, [columnIndex, 0]);
52
+ let from = 0;
53
+ return toArray(delay(() => append(collect((i) => {
54
+ const next = getItemFromDict(table.Values, [columnIndex, i]);
55
+ return !equals(next, current) ? append(singleton(object([["f", from], ["t", i - 1], ["v", CellTable_encodeCell(cellTable, current)]])), delay(() => {
56
+ current = next;
57
+ from = (i | 0);
58
+ return empty();
59
+ })) : empty();
60
+ }, rangeDouble(1, 1, rowCount - 1)), delay(() => singleton(object([["f", from], ["t", rowCount - 1], ["v", CellTable_encodeCell(cellTable, current)]]))))));
61
+ }
62
+ }
63
+
64
+ export function ArcTable_compressedColumnDecoder(columnIndex, cellTable, table, column) {
65
+ const matchValue = array_1((s, o) => CellTable_decodeCell(cellTable, s, o), "", column);
66
+ if (matchValue.tag === 1) {
67
+ array_1((s_1, jv) => object_1((get$) => {
68
+ let from;
69
+ const objectArg = get$.Required;
70
+ from = objectArg.Field("f", uncurry2(int));
71
+ let to_;
72
+ const objectArg_1 = get$.Required;
73
+ to_ = objectArg_1.Field("t", uncurry2(int));
74
+ let value;
75
+ const objectArg_2 = get$.Required;
76
+ value = objectArg_2.Field("v", (s_2, o_1) => CellTable_decodeCell(cellTable, s_2, o_1));
77
+ for (let i = from; i <= to_; i++) {
78
+ addToDict(table.Values, [columnIndex, i], value);
79
+ }
80
+ }, s_1, jv), "", column);
81
+ }
82
+ else {
83
+ iterateIndexed((r, cell) => {
84
+ addToDict(table.Values, [columnIndex, r], cell);
85
+ }, matchValue.fields[0]);
86
+ }
87
+ }
88
+
89
+ export function ArcTable_compressedEncoder(stringTable, oaTable, cellTable, table) {
90
+ return object(toList(delay(() => append(singleton(["n", StringTable_encodeString(stringTable, table.Name)]), delay(() => append((table.Headers.length !== 0) ? singleton(["h", list(toList(delay(() => map(CompositeHeader_encoder, table.Headers))))]) : empty(), delay(() => {
91
+ if (table.Values.size !== 0) {
92
+ const rowCount = table.RowCount | 0;
93
+ return singleton(["c", toArray(delay(() => map((c) => ArcTable_compressedColumnEncoder(c, rowCount, cellTable, table), rangeDouble(0, 1, table.ColumnCount - 1))))]);
94
+ }
95
+ else {
96
+ return empty();
97
+ }
98
+ })))))));
99
+ }
100
+
101
+ export function ArcTable_compressedDecoder(stringTable, oaTable, cellTable) {
102
+ return (path_2) => ((v_1) => object_1((get$) => {
103
+ let objectArg, objectArg_1, objectArg_2;
104
+ let decodedHeader;
105
+ const collection = defaultArg((objectArg = get$.Optional, objectArg.Field("h", (path, value) => list_1(uncurry2(CompositeHeader_decoder), path, value))), empty_1());
106
+ decodedHeader = Array.from(collection);
107
+ const table = ArcTable.create((objectArg_1 = get$.Required, objectArg_1.Field("n", (s, o) => StringTable_decodeString(stringTable, s, o))), decodedHeader, new Dictionary([], {
108
+ Equals: equalArrays,
109
+ GetHashCode: arrayHash,
110
+ }));
111
+ iterate((array) => {
112
+ iterateIndexed((c, col) => {
113
+ ArcTable_compressedColumnDecoder(c, cellTable, table, col);
114
+ }, array);
115
+ }, toArray_1((objectArg_2 = get$.Optional, objectArg_2.Field("c", (path_1, value_2) => array_1(value_5, path_1, value_2)))));
116
+ return table;
117
+ }, path_2, v_1));
118
+ }
119
+
40
120
  export function ARCtrl_ISA_ArcTable__ArcTable_fromJsonString_Static_Z721C83C5(jsonString) {
41
121
  const matchValue = fromString(uncurry2(ArcTable_decoder), jsonString);
42
122
  if (matchValue.tag === 1) {
@@ -55,3 +135,44 @@ export function ARCtrl_ISA_ArcTable__ArcTable_toJsonString_Static_1B2566EA(a) {
55
135
  return ARCtrl_ISA_ArcTable__ArcTable_ToJsonString_71136F3F(a);
56
136
  }
57
137
 
138
+ export function ARCtrl_ISA_ArcTable__ArcTable_fromCompressedJsonString_Static_Z721C83C5(jsonString) {
139
+ const matchValue = fromString((path, v) => object_1((get$) => {
140
+ let arg_5, objectArg_2;
141
+ let stringTable;
142
+ const objectArg = get$.Required;
143
+ stringTable = objectArg.Field("stringTable", uncurry2(StringTable_decoder));
144
+ let oaTable;
145
+ const arg_3 = OATable_decoder(stringTable);
146
+ const objectArg_1 = get$.Required;
147
+ oaTable = objectArg_1.Field("oaTable", uncurry2(arg_3));
148
+ const arg_7 = ArcTable_compressedDecoder(stringTable, oaTable, (arg_5 = CellTable_decoder(stringTable, oaTable), (objectArg_2 = get$.Required, objectArg_2.Field("cellTable", uncurry2(arg_5)))));
149
+ const objectArg_3 = get$.Required;
150
+ return objectArg_3.Field("table", uncurry2(arg_7));
151
+ }, path, v), jsonString);
152
+ if (matchValue.tag === 1) {
153
+ return toFail(printf("Error. Unable to parse json string to ArcTable: %s"))(matchValue.fields[0]);
154
+ }
155
+ else {
156
+ return matchValue.fields[0];
157
+ }
158
+ }
159
+
160
+ export function ARCtrl_ISA_ArcTable__ArcTable_ToCompressedJsonString_71136F3F(this$, spaces) {
161
+ const spaces_1 = defaultArg(spaces, 0) | 0;
162
+ const stringTable = new Map([]);
163
+ const oaTable = new Dictionary([], {
164
+ Equals: equals,
165
+ GetHashCode: safeHash,
166
+ });
167
+ const cellTable = new Dictionary([], {
168
+ Equals: equals,
169
+ GetHashCode: safeHash,
170
+ });
171
+ const arcTable = ArcTable_compressedEncoder(stringTable, oaTable, cellTable, this$);
172
+ return toString(spaces_1, object([["cellTable", CellTable_encoder(stringTable, oaTable, CellTable_arrayFromMap(cellTable))], ["oaTable", OATable_encoder(stringTable, OATable_arrayFromMap(oaTable))], ["stringTable", StringTable_encoder(StringTable_arrayFromMap(stringTable))], ["table", arcTable]]));
173
+ }
174
+
175
+ export function ARCtrl_ISA_ArcTable__ArcTable_toCompressedJsonString_Static_1B2566EA(a) {
176
+ return ARCtrl_ISA_ArcTable__ArcTable_ToCompressedJsonString_71136F3F(a);
177
+ }
178
+
@@ -0,0 +1,46 @@
1
+ import { sortBy, map, toArray } from "../../../fable_modules/fable-library.4.5.0/Seq.js";
2
+ import { uncurry2, comparePrimitives } from "../../../fable_modules/fable-library.4.5.0/Util.js";
3
+ import { map as map_1 } from "../../../fable_modules/fable-library.4.5.0/Array.js";
4
+ import { CompositeCell_compressedDecoder, CompositeCell_compressedEncoder } from "./CompositeCell.js";
5
+ import { int, array as array_1 } from "../../../fable_modules/Thoth.Json.10.1.0/Decode.fs.js";
6
+ import { Dict_tryFind } from "../../ISA/Helper.js";
7
+ import { addToDict } from "../../../fable_modules/fable-library.4.5.0/MapUtil.js";
8
+ import { FSharpResult$2 } from "../../../fable_modules/fable-library.4.5.0/Choice.js";
9
+
10
+ export function CellTable_arrayFromMap(otm) {
11
+ return toArray(map((kv_1) => kv_1[0], sortBy((kv) => kv[1], otm, {
12
+ Compare: comparePrimitives,
13
+ })));
14
+ }
15
+
16
+ export function CellTable_encoder(stringTable, oaTable, ot) {
17
+ return map_1((cc) => CompositeCell_compressedEncoder(stringTable, oaTable, cc), ot);
18
+ }
19
+
20
+ export function CellTable_decoder(stringTable, oaTable) {
21
+ const decoder = CompositeCell_compressedDecoder(stringTable, oaTable);
22
+ return (path) => ((value) => array_1(uncurry2(decoder), path, value));
23
+ }
24
+
25
+ export function CellTable_encodeCell(otm, cc) {
26
+ const matchValue = Dict_tryFind(cc, otm);
27
+ if (matchValue == null) {
28
+ const i_1 = otm.size | 0;
29
+ addToDict(otm, cc, i_1);
30
+ return i_1;
31
+ }
32
+ else {
33
+ return matchValue;
34
+ }
35
+ }
36
+
37
+ export function CellTable_decodeCell(ot, s, o) {
38
+ const matchValue = int(s)(o);
39
+ if (matchValue.tag === 1) {
40
+ return new FSharpResult$2(1, [matchValue.fields[0]]);
41
+ }
42
+ else {
43
+ return new FSharpResult$2(0, [ot[matchValue.fields[0]]]);
44
+ }
45
+ }
46
+
@@ -6,6 +6,8 @@ import { fromString, index, string, object as object_1 } from "../../../fable_mo
6
6
  import { CompositeCell } from "../../ISA/ArcTypes/CompositeCell.js";
7
7
  import { uncurry2 } from "../../../fable_modules/fable-library.4.5.0/Util.js";
8
8
  import { printf, toFail } from "../../../fable_modules/fable-library.4.5.0/String.js";
9
+ import { OATable_decodeOA, OATable_encodeOA } from "./OATable.js";
10
+ import { StringTable_decodeString, StringTable_encodeString } from "../StringTable.js";
9
11
  import { defaultArg } from "../../../fable_modules/fable-library.4.5.0/Option.js";
10
12
 
11
13
  export function CompositeCell_encoder(cc) {
@@ -31,6 +33,30 @@ export const CompositeCell_decoder = (path_7) => ((v_1) => object_1((get$) => {
31
33
  }
32
34
  }, path_7, v_1));
33
35
 
36
+ export function CompositeCell_compressedEncoder(stringTable, oaTable, cc) {
37
+ const patternInput = (cc.tag === 0) ? ["Term", singleton(OATable_encodeOA(oaTable, cc.fields[0]))] : ((cc.tag === 2) ? ["Unitized", ofArray([StringTable_encodeString(stringTable, cc.fields[0]), OATable_encodeOA(oaTable, cc.fields[1])])] : ["FreeText", singleton(StringTable_encodeString(stringTable, cc.fields[0]))]);
38
+ return object([["t", StringTable_encodeString(stringTable, patternInput[0])], ["v", list(patternInput[1])]]);
39
+ }
40
+
41
+ export function CompositeCell_compressedDecoder(stringTable, oaTable) {
42
+ return (path_4) => ((v_1) => object_1((get$) => {
43
+ let objectArg_1, objectArg_2, objectArg_3, objectArg_4;
44
+ let matchValue;
45
+ const objectArg = get$.Required;
46
+ matchValue = objectArg.Field("t", (s, o) => StringTable_decodeString(stringTable, s, o));
47
+ switch (matchValue) {
48
+ case "FreeText":
49
+ return new CompositeCell(1, [(objectArg_1 = get$.Required, objectArg_1.Field("v", (path, value) => index(0, (s_1, o_1) => StringTable_decodeString(stringTable, s_1, o_1), path, value)))]);
50
+ case "Term":
51
+ return new CompositeCell(0, [(objectArg_2 = get$.Required, objectArg_2.Field("v", (path_1, value_1) => index(0, (s_3, o_2) => OATable_decodeOA(oaTable, s_3, o_2), path_1, value_1)))]);
52
+ case "Unitized":
53
+ return new CompositeCell(2, [(objectArg_3 = get$.Required, objectArg_3.Field("v", (path_2, value_2) => index(0, (s_4, o_3) => StringTable_decodeString(stringTable, s_4, o_3), path_2, value_2))), (objectArg_4 = get$.Required, objectArg_4.Field("v", (path_3, value_3) => index(1, (s_5, o_4) => OATable_decodeOA(oaTable, s_5, o_4), path_3, value_3)))]);
54
+ default:
55
+ return toFail(printf("Error reading CompositeCell from json string: %A"))(matchValue);
56
+ }
57
+ }, path_4, v_1));
58
+ }
59
+
34
60
  export function ARCtrl_ISA_CompositeCell__CompositeCell_fromJsonString_Static_Z721C83C5(jsonString) {
35
61
  const matchValue = fromString(uncurry2(CompositeCell_decoder), jsonString);
36
62
  if (matchValue.tag === 1) {
@@ -0,0 +1,48 @@
1
+ import { sortBy, map, toArray } from "../../../fable_modules/fable-library.4.5.0/Seq.js";
2
+ import { uncurry2, comparePrimitives } from "../../../fable_modules/fable-library.4.5.0/Util.js";
3
+ import { map as map_1 } from "../../../fable_modules/fable-library.4.5.0/Array.js";
4
+ import { ConverterOptions_$ctor } from "../ConverterOptions.js";
5
+ import { OntologyAnnotation_compressedDecoder, OntologyAnnotation_compressedEncoder } from "../Ontology.js";
6
+ import { int, array as array_1 } from "../../../fable_modules/Thoth.Json.10.1.0/Decode.fs.js";
7
+ import { Dict_tryFind } from "../../ISA/Helper.js";
8
+ import { addToDict } from "../../../fable_modules/fable-library.4.5.0/MapUtil.js";
9
+ import { FSharpResult$2 } from "../../../fable_modules/fable-library.4.5.0/Choice.js";
10
+
11
+ export function OATable_arrayFromMap(otm) {
12
+ return toArray(map((kv_1) => kv_1[0], sortBy((kv) => kv[1], otm, {
13
+ Compare: comparePrimitives,
14
+ })));
15
+ }
16
+
17
+ export function OATable_encoder(stringTable, ot) {
18
+ let options;
19
+ return map_1((options = ConverterOptions_$ctor(), (oa) => OntologyAnnotation_compressedEncoder(stringTable, options, oa)), ot);
20
+ }
21
+
22
+ export function OATable_decoder(stringTable) {
23
+ const decoder = OntologyAnnotation_compressedDecoder(stringTable, ConverterOptions_$ctor());
24
+ return (path) => ((value) => array_1(uncurry2(decoder), path, value));
25
+ }
26
+
27
+ export function OATable_encodeOA(otm, oa) {
28
+ const matchValue = Dict_tryFind(oa, otm);
29
+ if (matchValue == null) {
30
+ const i_1 = otm.size | 0;
31
+ addToDict(otm, oa, i_1);
32
+ return i_1;
33
+ }
34
+ else {
35
+ return matchValue;
36
+ }
37
+ }
38
+
39
+ export function OATable_decodeOA(ot, s, o) {
40
+ const matchValue = int(s)(o);
41
+ if (matchValue.tag === 1) {
42
+ return new FSharpResult$2(1, [matchValue.fields[0]]);
43
+ }
44
+ else {
45
+ return new FSharpResult$2(0, [ot[matchValue.fields[0]]]);
46
+ }
47
+ }
48
+
@@ -13,6 +13,7 @@ import { OntologySourceReference } from "../ISA/JsonTypes/OntologySourceReferenc
13
13
  import { URIModule_toString } from "../ISA/JsonTypes/URI.js";
14
14
  import { OntologyAnnotation } from "../ISA/JsonTypes/OntologyAnnotation.js";
15
15
  import { unwrap } from "../../fable_modules/fable-library.4.5.0/Option.js";
16
+ import { StringTable_decodeString, StringTable_encodeString } from "./StringTable.js";
16
17
 
17
18
  /**
18
19
  * This decodes from integer, float or string to string only!
@@ -175,6 +176,35 @@ export function OntologyAnnotation_decoder(options) {
175
176
  }, path_3, v));
176
177
  }
177
178
 
179
+ export function OntologyAnnotation_compressedEncoder(stringTable, options, oa) {
180
+ return object_10(choose((tupledArg) => {
181
+ const v = tupledArg[1];
182
+ if (equals(v, nil)) {
183
+ return void 0;
184
+ }
185
+ else {
186
+ return [tupledArg[0], v];
187
+ }
188
+ }, toList(delay(() => {
189
+ let value, s;
190
+ return append(ConverterOptions__get_SetID(options) ? singleton(["@id", (value = OntologyAnnotation_genID(oa), (typeof value === "string") ? ((s = value, s)) : nil)]) : singleton(tryInclude("@id", (value_2) => {
191
+ let s_1;
192
+ const value_3 = value_2;
193
+ return (typeof value_3 === "string") ? ((s_1 = value_3, s_1)) : nil;
194
+ }, oa["ID"])), delay(() => {
195
+ let value_5, s_2;
196
+ return append(ConverterOptions__get_IncludeType(options) ? singleton(["@type", (value_5 = "OntologyAnnotation", (typeof value_5 === "string") ? ((s_2 = value_5, s_2)) : nil)]) : empty(), delay(() => append(singleton(tryInclude("a", (s_3) => StringTable_encodeString(stringTable, s_3), oa["Name"])), delay(() => append(singleton(tryInclude("ts", (s_4) => StringTable_encodeString(stringTable, s_4), oa["TermSourceREF"])), delay(() => append(singleton(tryInclude("ta", (s_5) => StringTable_encodeString(stringTable, s_5), oa["TermAccessionNumber"])), delay(() => singleton(tryInclude("comments", (comment) => encoder(options, comment), oa["Comments"]))))))))));
197
+ }));
198
+ }))));
199
+ }
200
+
201
+ export function OntologyAnnotation_compressedDecoder(stringTable, options) {
202
+ return (path_1) => ((v) => object_11((get$) => {
203
+ let objectArg, objectArg_1, objectArg_2, objectArg_3, arg_9, decoder, objectArg_4;
204
+ return OntologyAnnotation.create(unwrap((objectArg = get$.Optional, objectArg.Field("@id", uri))), unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("a", (s_1, o) => StringTable_decodeString(stringTable, s_1, o)))), unwrap((objectArg_2 = get$.Optional, objectArg_2.Field("ts", (s_2, o_1) => StringTable_decodeString(stringTable, s_2, o_1)))), unwrap((objectArg_3 = get$.Optional, objectArg_3.Field("ta", (s_3, o_2) => StringTable_decodeString(stringTable, s_3, o_2)))), unwrap((arg_9 = ((decoder = decoder_1(options), (path) => ((value) => array(uncurry2(decoder), path, value)))), (objectArg_4 = get$.Optional, objectArg_4.Field("comments", uncurry2(arg_9))))));
205
+ }, path_1, v));
206
+ }
207
+
178
208
  export function OntologyAnnotation_fromJsonString(s) {
179
209
  return fromJsonString(uncurry2(OntologyAnnotation_decoder(ConverterOptions_$ctor())), s);
180
210
  }
@@ -0,0 +1,43 @@
1
+ import { sortBy, map, toArray } from "../../fable_modules/fable-library.4.5.0/Seq.js";
2
+ import { comparePrimitives } from "../../fable_modules/fable-library.4.5.0/Util.js";
3
+ import { map as map_1 } from "../../fable_modules/fable-library.4.5.0/Array.js";
4
+ import { int, string, array as array_1 } from "../../fable_modules/Thoth.Json.10.1.0/Decode.fs.js";
5
+ import { Dict_tryFind } from "../ISA/Helper.js";
6
+ import { addToDict } from "../../fable_modules/fable-library.4.5.0/MapUtil.js";
7
+ import { FSharpResult$2 } from "../../fable_modules/fable-library.4.5.0/Choice.js";
8
+
9
+ export function StringTable_arrayFromMap(otm) {
10
+ return toArray(map((kv_1) => kv_1[0], sortBy((kv) => kv[1], otm, {
11
+ Compare: comparePrimitives,
12
+ })));
13
+ }
14
+
15
+ export function StringTable_encoder(ot) {
16
+ return map_1((value) => value, ot);
17
+ }
18
+
19
+ export const StringTable_decoder = (path_1) => ((value_1) => array_1(string, path_1, value_1));
20
+
21
+ export function StringTable_encodeString(otm, s) {
22
+ const s_1 = s;
23
+ const matchValue = Dict_tryFind(s_1, otm);
24
+ if (matchValue == null) {
25
+ const i_1 = otm.size | 0;
26
+ addToDict(otm, s_1, i_1);
27
+ return i_1;
28
+ }
29
+ else {
30
+ return matchValue;
31
+ }
32
+ }
33
+
34
+ export function StringTable_decodeString(ot, s, o) {
35
+ const matchValue = int(s)(o);
36
+ if (matchValue.tag === 1) {
37
+ return new FSharpResult$2(1, [matchValue.fields[0]]);
38
+ }
39
+ else {
40
+ return new FSharpResult$2(0, [ot[matchValue.fields[0]]]);
41
+ }
42
+ }
43
+
@@ -2,14 +2,15 @@ import { iterateIndexed, length, ofArray, sortBy, collect, toArray, empty, tail,
2
2
  import { tryParseReferenceColumnHeader } from "../../ISA/Regex.js";
3
3
  import { map as map_1, toList, tryFind } from "../../../fable_modules/fable-library.4.5.0/Seq.js";
4
4
  import { toFsColumns, fixDeprecatedIOHeader, fromFsColumns } from "./CompositeColumn.js";
5
+ import { printf, toFail } from "../../../fable_modules/fable-library.4.5.0/String.js";
5
6
  import { ArcTable } from "../../ISA/ArcTypes/ArcTable.js";
6
- import { FsWorksheet } from "../../../fable_modules/FsSpreadsheet.5.1.1/FsWorksheet.fs.js";
7
+ import { FsWorksheet } from "../../../fable_modules/FsSpreadsheet.5.1.3/FsWorksheet.fs.js";
7
8
  import { comparePrimitives } from "../../../fable_modules/fable-library.4.5.0/Util.js";
8
- import { FsRangeAddress_$ctor_7E77A4A0 } from "../../../fable_modules/FsSpreadsheet.5.1.1/Ranges/FsRangeAddress.fs.js";
9
- import { FsAddress_$ctor_Z37302880 } from "../../../fable_modules/FsSpreadsheet.5.1.1/FsAddress.fs.js";
10
- import { Dictionary_tryGet } from "../../../fable_modules/FsSpreadsheet.5.1.1/Cells/FsCellsCollection.fs.js";
9
+ import { FsRangeAddress_$ctor_7E77A4A0 } from "../../../fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeAddress.fs.js";
10
+ import { FsAddress_$ctor_Z37302880 } from "../../../fable_modules/FsSpreadsheet.5.1.3/FsAddress.fs.js";
11
+ import { Dictionary_tryGet } from "../../../fable_modules/FsSpreadsheet.5.1.3/Cells/FsCellsCollection.fs.js";
11
12
  import { addToDict } from "../../../fable_modules/fable-library.4.5.0/MapUtil.js";
12
- import { FsRangeBase__Cell_Z3407A44B } from "../../../fable_modules/FsSpreadsheet.5.1.1/Ranges/FsRangeBase.fs.js";
13
+ import { FsRangeBase__Cell_Z3407A44B } from "../../../fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeBase.fs.js";
13
14
 
14
15
  /**
15
16
  * Iterates over elements of the input list and groups adjacent elements.
@@ -91,49 +92,61 @@ export function composeColumns(columns) {
91
92
  * Returns the protocol described by the headers and a function for parsing the values of the matrix to the processes of this protocol
92
93
  */
93
94
  export function tryFromFsWorksheet(sheet) {
94
- const matchValue = tryAnnotationTable(sheet);
95
- if (matchValue == null) {
96
- return void 0;
95
+ try {
96
+ const matchValue = tryAnnotationTable(sheet);
97
+ if (matchValue == null) {
98
+ return void 0;
99
+ }
100
+ else {
101
+ const t = matchValue;
102
+ const compositeColumns = composeColumns(map_1(fixDeprecatedIOHeader, t.GetColumns(sheet.CellCollection)));
103
+ return ArcTable.addColumns(compositeColumns, void 0, true)(ArcTable.init(sheet.Name));
104
+ }
97
105
  }
98
- else {
99
- const t = matchValue;
100
- const compositeColumns = composeColumns(map_1(fixDeprecatedIOHeader, t.GetColumns(sheet.CellCollection)));
101
- return ArcTable.addColumns(compositeColumns, void 0, true)(ArcTable.init(sheet.Name));
106
+ catch (err) {
107
+ const arg = sheet.Name;
108
+ const arg_1 = err.message;
109
+ return toFail(printf("Could not parse table with name \"%s\":\n%s"))(arg)(arg_1);
102
110
  }
103
111
  }
104
112
 
105
113
  export function toFsWorksheet(table) {
106
114
  const stringCount = new Map([]);
107
115
  const ws = new FsWorksheet(table.Name);
108
- const columns = collect(toFsColumns, sortBy(classifyColumnOrder, ofArray(table.Columns), {
109
- Compare: comparePrimitives,
110
- }));
111
- const maxRow = length(head(columns)) | 0;
112
- const maxCol = length(columns) | 0;
113
- const fsTable = ws.Table("annotationTable", FsRangeAddress_$ctor_7E77A4A0(FsAddress_$ctor_Z37302880(1, 1), FsAddress_$ctor_Z37302880(maxRow, maxCol)));
114
- iterateIndexed((colI, col) => {
115
- iterateIndexed((rowI, cell) => {
116
- let value;
117
- const v = cell.ValueAsString();
118
- if (rowI === 0) {
119
- const matchValue = Dictionary_tryGet(v, stringCount);
120
- if (matchValue == null) {
121
- addToDict(stringCount, cell.ValueAsString(), "");
122
- value = v;
116
+ if (table.Columns.length === 0) {
117
+ return ws;
118
+ }
119
+ else {
120
+ const columns = collect(toFsColumns, sortBy(classifyColumnOrder, ofArray(table.Columns), {
121
+ Compare: comparePrimitives,
122
+ }));
123
+ const maxRow = length(head(columns)) | 0;
124
+ const maxCol = length(columns) | 0;
125
+ const fsTable = ws.Table("annotationTable", FsRangeAddress_$ctor_7E77A4A0(FsAddress_$ctor_Z37302880(1, 1), FsAddress_$ctor_Z37302880(maxRow, maxCol)));
126
+ iterateIndexed((colI, col) => {
127
+ iterateIndexed((rowI, cell) => {
128
+ let value;
129
+ const v = cell.ValueAsString();
130
+ if (rowI === 0) {
131
+ const matchValue = Dictionary_tryGet(v, stringCount);
132
+ if (matchValue == null) {
133
+ addToDict(stringCount, cell.ValueAsString(), "");
134
+ value = v;
135
+ }
136
+ else {
137
+ const spaces = matchValue;
138
+ stringCount.set(v, spaces + " ");
139
+ value = ((v + " ") + spaces);
140
+ }
123
141
  }
124
142
  else {
125
- const spaces = matchValue;
126
- stringCount.set(v, spaces + " ");
127
- value = ((v + " ") + spaces);
143
+ value = v;
128
144
  }
129
- }
130
- else {
131
- value = v;
132
- }
133
- const address = FsAddress_$ctor_Z37302880(rowI + 1, colI + 1);
134
- FsRangeBase__Cell_Z3407A44B(fsTable, address, ws.CellCollection).SetValueAs(value);
135
- }, col);
136
- }, columns);
137
- return ws;
145
+ const address = FsAddress_$ctor_Z37302880(rowI + 1, colI + 1);
146
+ FsRangeBase__Cell_Z3407A44B(fsTable, address, ws.CellCollection).SetValueAs(value);
147
+ }, col);
148
+ }, columns);
149
+ return ws;
150
+ }
138
151
  }
139
152
 
@@ -1,7 +1,7 @@
1
1
  import { singleton, ofArray, head, tail, isEmpty, map } from "../../../fable_modules/fable-library.4.5.0/List.js";
2
2
  import { CompositeCell } from "../../ISA/ArcTypes/CompositeCell.js";
3
3
  import { printf, toFail } from "../../../fable_modules/fable-library.4.5.0/String.js";
4
- import { FsCell } from "../../../fable_modules/FsSpreadsheet.5.1.1/Cells/FsCell.fs.js";
4
+ import { FsCell } from "../../../fable_modules/FsSpreadsheet.5.1.3/Cells/FsCell.fs.js";
5
5
 
6
6
  export function fromFsCells(cells) {
7
7
  const cellValues = map((c) => c.ValueAsString(), cells);
@@ -2,9 +2,9 @@ import { CompositeHeader, IOType } from "../../ISA/ArcTypes/CompositeHeader.js";
2
2
  import { toString } from "../../../fable_modules/fable-library.4.5.0/Types.js";
3
3
  import { toFsCells, fromFsCells } from "./CompositeHeader.js";
4
4
  import { singleton as singleton_1, ofArray, item, map } from "../../../fable_modules/fable-library.4.5.0/List.js";
5
- import { FsAddress__get_RowNumber } from "../../../fable_modules/FsSpreadsheet.5.1.1/FsAddress.fs.js";
6
- import { FsRangeAddress__get_LastAddress } from "../../../fable_modules/FsSpreadsheet.5.1.1/Ranges/FsRangeAddress.fs.js";
7
- import { FsRangeBase__get_RangeAddress } from "../../../fable_modules/FsSpreadsheet.5.1.1/Ranges/FsRangeBase.fs.js";
5
+ import { FsAddress__get_RowNumber } from "../../../fable_modules/FsSpreadsheet.5.1.3/FsAddress.fs.js";
6
+ import { FsRangeAddress__get_LastAddress } from "../../../fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeAddress.fs.js";
7
+ import { FsRangeBase__get_RangeAddress } from "../../../fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeBase.fs.js";
8
8
  import { singleton, append, toList, exists, map as map_1, delay, toArray } from "../../../fable_modules/fable-library.4.5.0/Seq.js";
9
9
  import { toFsCells as toFsCells_1, fromFsCells as fromFsCells_1 } from "./CompositeCell.js";
10
10
  import { rangeDouble } from "../../../fable_modules/fable-library.4.5.0/Range.js";
@@ -3,7 +3,7 @@ import { singleton, tail, head, isEmpty, map } from "../../../fable_modules/fabl
3
3
  import { OntologyAnnotation } from "../../ISA/JsonTypes/OntologyAnnotation.js";
4
4
  import { ActivePatterns_$007COutputColumnHeader$007C_$007C, ActivePatterns_$007CInputColumnHeader$007C_$007C, tryParseComponentColumnHeader, tryParseCharacteristicColumnHeader, tryParseFactorColumnHeader, tryParseParameterColumnHeader, ActivePatterns_$007CUnitColumnHeader$007C_$007C, ActivePatterns_$007CTANColumnHeader$007C_$007C, ActivePatterns_$007CTSRColumnHeader$007C_$007C } from "../../ISA/Regex.js";
5
5
  import { IOType, CompositeHeader } from "../../ISA/ArcTypes/CompositeHeader.js";
6
- import { FsCell } from "../../../fable_modules/FsSpreadsheet.5.1.1/Cells/FsCell.fs.js";
6
+ import { FsCell } from "../../../fable_modules/FsSpreadsheet.5.1.3/Cells/FsCell.fs.js";
7
7
  import { toString } from "../../../fable_modules/fable-library.4.5.0/Types.js";
8
8
  import { empty, singleton as singleton_1, append, delay, toList } from "../../../fable_modules/fable-library.4.5.0/Seq.js";
9
9