@nfdi4plants/arctrl 2.0.0-alpha.2 → 2.0.0-alpha.4

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 (115) hide show
  1. package/ARC.js +110 -15
  2. package/Contract/ARC.js +9 -1
  3. package/Contract/Datamap.js +180 -0
  4. package/Core/ArcTypes.js +148 -121
  5. package/Core/Conversion.js +99 -67
  6. package/Core/Data.js +119 -0
  7. package/Core/{Process/DataFile.js → DataFile.js} +3 -3
  8. package/Core/Helper/Identifier.js +40 -0
  9. package/Core/OntologyAnnotation.js +14 -4
  10. package/Core/Process/ColumnIndex.js +13 -3
  11. package/Core/Process/ProcessInput.js +5 -5
  12. package/Core/Process/ProcessOutput.js +5 -5
  13. package/Core/Process/Value.js +1 -1
  14. package/Core/Table/ArcTableAux.js +14 -3
  15. package/Core/Table/CompositeCell.js +67 -10
  16. package/Core/Table/CompositeColumn.js +9 -0
  17. package/Core/Table/CompositeHeader.js +58 -68
  18. package/Core/Table/DataMap.js +166 -0
  19. package/FileSystem/FileSystemTree.js +18 -4
  20. package/Json/Assay.js +4 -4
  21. package/Json/Process/Data.js +56 -18
  22. package/Json/Process/DataFile.js +5 -5
  23. package/Json/Process/PropertyValue.js +126 -5
  24. package/Json/Study.js +6 -6
  25. package/Json/Table/CompositeCell.js +7 -6
  26. package/Spreadsheet/AnnotationTable/ArcTable.js +9 -13
  27. package/Spreadsheet/AnnotationTable/CompositeCell.js +32 -50
  28. package/Spreadsheet/AnnotationTable/CompositeColumn.js +16 -10
  29. package/Spreadsheet/AnnotationTable/CompositeHeader.js +262 -143
  30. package/Spreadsheet/ArcAssay.js +2 -2
  31. package/Spreadsheet/ArcInvestigation.js +2 -2
  32. package/Spreadsheet/ArcStudy.js +2 -2
  33. package/Spreadsheet/DataMap.js +31 -0
  34. package/Spreadsheet/DataMapTable/DataMapColumn.js +36 -0
  35. package/Spreadsheet/DataMapTable/DataMapHeader.js +417 -0
  36. package/Spreadsheet/DataMapTable/DataMapTable.js +98 -0
  37. package/Spreadsheet/Metadata/Assays.js +2 -2
  38. package/Spreadsheet/Metadata/SparseTable.js +7 -7
  39. package/Spreadsheet/Metadata/Study.js +1 -1
  40. package/Spreadsheet/Template.js +2 -2
  41. package/Xlsx.js +29 -6
  42. package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsSpreadsheet.fableproj +9 -3
  43. package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsWorksheet.fs +1 -0
  44. package/fable_modules/FsSpreadsheet.6.1.2/Json/Cell.fs +23 -0
  45. package/fable_modules/FsSpreadsheet.6.1.2/Json/Cell.fs.js +21 -0
  46. package/fable_modules/FsSpreadsheet.6.1.2/Json/Row.fs +23 -0
  47. package/fable_modules/FsSpreadsheet.6.1.2/Json/Row.fs.js +19 -0
  48. package/fable_modules/FsSpreadsheet.6.1.2/Json/Table.fs +24 -0
  49. package/fable_modules/FsSpreadsheet.6.1.2/Json/Table.fs.js +15 -0
  50. package/fable_modules/FsSpreadsheet.6.1.2/Json/Value.fs +70 -0
  51. package/fable_modules/FsSpreadsheet.6.1.2/Json/Value.fs.js +48 -0
  52. package/fable_modules/FsSpreadsheet.6.1.2/Json/Workbook.fs +20 -0
  53. package/fable_modules/FsSpreadsheet.6.1.2/Json/Workbook.fs.js +21 -0
  54. package/fable_modules/FsSpreadsheet.6.1.2/Json/Worksheet.fs +49 -0
  55. package/fable_modules/FsSpreadsheet.6.1.2/Json/Worksheet.fs.js +44 -0
  56. package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +3 -3
  57. package/fable_modules/project_cracked.json +1 -1
  58. package/package.json +1 -1
  59. package/Core/Process/Data.js +0 -55
  60. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Cells/FsCell.fs +0 -0
  61. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Cells/FsCell.fs.js +0 -0
  62. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Cells/FsCellsCollection.fs +0 -0
  63. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Cells/FsCellsCollection.fs.js +0 -0
  64. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/CellBuilder.fs +0 -0
  65. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/CellBuilder.fs.js +0 -0
  66. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/ColumnBuilder.fs +0 -0
  67. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/ColumnBuilder.fs.js +0 -0
  68. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/DSL.fs +0 -0
  69. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/DSL.fs.js +0 -0
  70. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/Expression.fs +0 -0
  71. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/Expression.fs.js +0 -0
  72. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/Operators.fs +0 -0
  73. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/Operators.fs.js +0 -0
  74. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/RowBuilder.fs +0 -0
  75. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/RowBuilder.fs.js +0 -0
  76. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/SheetBuilder.fs +0 -0
  77. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/SheetBuilder.fs.js +0 -0
  78. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/TableBuilder.fs +0 -0
  79. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/TableBuilder.fs.js +0 -0
  80. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/Transform.fs +0 -0
  81. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/Transform.fs.js +0 -0
  82. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/Types.fs +0 -0
  83. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/Types.fs.js +0 -0
  84. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/WorkbookBuilder.fs +0 -0
  85. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/DSL/WorkbookBuilder.fs.js +0 -0
  86. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsAddress.fs +0 -0
  87. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsAddress.fs.js +0 -0
  88. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsColumn.fs +0 -0
  89. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsColumn.fs.js +0 -0
  90. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsRow.fs +0 -0
  91. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsRow.fs.js +0 -0
  92. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsWorkbook.fs +0 -0
  93. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsWorkbook.fs.js +0 -0
  94. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/FsWorksheet.fs.js +0 -0
  95. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRange.fs +0 -0
  96. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRange.fs.js +0 -0
  97. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRangeAddress.fs +0 -0
  98. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRangeAddress.fs.js +0 -0
  99. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRangeBase.fs +0 -0
  100. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRangeBase.fs.js +0 -0
  101. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRangeColumn.fs +0 -0
  102. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRangeColumn.fs.js +0 -0
  103. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRangeRow.fs +0 -0
  104. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Ranges/FsRangeRow.fs.js +0 -0
  105. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/SheetBuilder.fs +0 -0
  106. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/SheetBuilder.fs.js +0 -0
  107. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Tables/FsTable.fs +0 -0
  108. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Tables/FsTable.fs.js +0 -0
  109. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Tables/FsTableField.fs +0 -0
  110. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Tables/FsTableField.fs.js +0 -0
  111. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Tables/FsTableRow.fs +0 -0
  112. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/Tables/FsTableRow.fs.js +0 -0
  113. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  114. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
  115. /package/fable_modules/{FsSpreadsheet.5.1.3 → FsSpreadsheet.6.1.2}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
@@ -0,0 +1,31 @@
1
+ import { printf, toFail } from "../fable_modules/fable-library-js.4.16.0/String.js";
2
+ import { tryPick } from "../fable_modules/fable-library-js.4.16.0/Seq.js";
3
+ import { toFsWorksheet, tryFromFsWorksheet } from "./DataMapTable/DataMapTable.js";
4
+ import { FsWorkbook } from "../fable_modules/FsSpreadsheet.6.1.2/FsWorkbook.fs.js";
5
+
6
+ /**
7
+ * Reads an assay from a spreadsheet
8
+ */
9
+ export function fromFsWorkbook(doc) {
10
+ try {
11
+ const dataMapTable = tryPick(tryFromFsWorksheet, doc.GetWorksheets());
12
+ if (dataMapTable == null) {
13
+ throw new Error("No DataMapTable found in workbook");
14
+ }
15
+ else {
16
+ return dataMapTable;
17
+ }
18
+ }
19
+ catch (err) {
20
+ const arg = err.message;
21
+ return toFail(printf("Could not parse datamap: \n%s"))(arg);
22
+ }
23
+ }
24
+
25
+ export function toFsWorkbook(dataMap) {
26
+ const doc = new FsWorkbook();
27
+ const sheet = toFsWorksheet(dataMap);
28
+ doc.AddWorksheet(sheet);
29
+ return doc;
30
+ }
31
+
@@ -0,0 +1,36 @@
1
+ import { toFsCells, fromFsCells } from "./DataMapHeader.js";
2
+ import { singleton as singleton_1, ofArray, item, map } from "../../fable_modules/fable-library-js.4.16.0/List.js";
3
+ import { FsAddress__get_RowNumber } from "../../fable_modules/FsSpreadsheet.6.1.2/FsAddress.fs.js";
4
+ import { FsRangeAddress__get_LastAddress } from "../../fable_modules/FsSpreadsheet.6.1.2/Ranges/FsRangeAddress.fs.js";
5
+ import { FsRangeBase__get_RangeAddress } from "../../fable_modules/FsSpreadsheet.6.1.2/Ranges/FsRangeBase.fs.js";
6
+ import { empty, exists, singleton, append, toList, map as map_1, delay, toArray } from "../../fable_modules/fable-library-js.4.16.0/Seq.js";
7
+ import { rangeDouble } from "../../fable_modules/fable-library-js.4.16.0/Range.js";
8
+ import { CompositeColumn } from "../../Core/Table/CompositeColumn.js";
9
+ import { item as item_1, map as map_2 } from "../../fable_modules/fable-library-js.4.16.0/Array.js";
10
+ import { toFsCells as toFsCells_1 } from "../AnnotationTable/CompositeCell.js";
11
+
12
+ export function fromFsColumns(columns) {
13
+ const patternInput = fromFsCells(map((c) => c.Item(1), columns));
14
+ const l = FsAddress__get_RowNumber(FsRangeAddress__get_LastAddress(FsRangeBase__get_RangeAddress(item(0, columns)))) | 0;
15
+ const cells_1 = toArray(delay(() => map_1((i) => patternInput[1](map((c_1) => c_1.Item(i), columns)), rangeDouble(2, 1, l))));
16
+ return CompositeColumn.create(patternInput[0], cells_1);
17
+ }
18
+
19
+ export function toFsColumns(column) {
20
+ const isTerm = column.Header.IsTermColumn;
21
+ const isData = column.Header.IsDataColumn;
22
+ const header = toFsCells(column.Header);
23
+ const cells = map_2((cell) => toFsCells_1(isTerm, false, cell), column.Cells);
24
+ if (isTerm) {
25
+ return ofArray([toList(delay(() => append(singleton(item(0, header)), delay(() => map_1((i) => item(0, item_1(i, cells)), rangeDouble(0, 1, column.Cells.length - 1)))))), toList(delay(() => append(singleton(item(1, header)), delay(() => map_1((i_1) => item(1, item_1(i_1, cells)), rangeDouble(0, 1, column.Cells.length - 1)))))), toList(delay(() => append(singleton(item(2, header)), delay(() => map_1((i_2) => item(2, item_1(i_2, cells)), rangeDouble(0, 1, column.Cells.length - 1))))))]);
26
+ }
27
+ else if (isData) {
28
+ const hasFormat = exists((c) => (c.AsData.Format != null), column.Cells);
29
+ const hasSelectorFormat = exists((c_1) => (c_1.AsData.SelectorFormat != null), column.Cells);
30
+ return toList(delay(() => append(singleton(toList(delay(() => append(singleton(item(0, header)), delay(() => map_1((i_3) => item(0, item_1(i_3, cells)), rangeDouble(0, 1, column.Cells.length - 1))))))), delay(() => append(hasFormat ? singleton(toList(delay(() => append(singleton(item(1, header)), delay(() => map_1((i_4) => item(1, item_1(i_4, cells)), rangeDouble(0, 1, column.Cells.length - 1))))))) : empty(), delay(() => (hasSelectorFormat ? singleton(toList(delay(() => append(singleton(item(2, header)), delay(() => map_1((i_5) => item(2, item_1(i_5, cells)), rangeDouble(0, 1, column.Cells.length - 1))))))) : empty())))))));
31
+ }
32
+ else {
33
+ return singleton_1(toList(delay(() => append(singleton(item(0, header)), delay(() => map_1((i_6) => item(0, item_1(i_6, cells)), rangeDouble(0, 1, column.Cells.length - 1)))))));
34
+ }
35
+ }
36
+
@@ -0,0 +1,417 @@
1
+ import { singleton, ofArray, tryFindIndex, tail, head, isEmpty, map } from "../../fable_modules/fable-library-js.4.16.0/List.js";
2
+ import { dataFromFsCells, freeTextFromFsCells, termFromFsCells } from "../AnnotationTable/CompositeCell.js";
3
+ import { DataMapAux_generatedByHeader, DataMapAux_descriptionHeader, DataMapAux_objectTypeHeader, DataMapAux_unitHeader, DataMapAux_explicationHeader } from "../../Core/Table/DataMap.js";
4
+ import { map as map_1 } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
5
+ import { CompositeHeader, IOType } from "../../Core/Table/CompositeHeader.js";
6
+ import { printf, toFail } from "../../fable_modules/fable-library-js.4.16.0/String.js";
7
+ import { FsCell } from "../../fable_modules/FsSpreadsheet.6.1.2/Cells/FsCell.fs.js";
8
+ import { equals } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
9
+
10
+ export function ActivePattern_$007CTerm$007C_$007C(categoryString, categoryHeader, cells) {
11
+ const $007CAC$007C_$007C = (s) => {
12
+ if (s === categoryString) {
13
+ return categoryHeader;
14
+ }
15
+ else {
16
+ return void 0;
17
+ }
18
+ };
19
+ const $007CTSRColumnHeaderRaw$007C_$007C = (s_1) => {
20
+ if (s_1.indexOf("Term Source REF") === 0) {
21
+ return s_1;
22
+ }
23
+ else {
24
+ return void 0;
25
+ }
26
+ };
27
+ const $007CTANColumnHeaderRaw$007C_$007C = (s_2) => {
28
+ if (s_2.indexOf("Term Accession Number") === 0) {
29
+ return s_2;
30
+ }
31
+ else {
32
+ return void 0;
33
+ }
34
+ };
35
+ const cellValues = map((c) => c.ValueAsString(), cells);
36
+ let matchResult, header;
37
+ if (!isEmpty(cellValues)) {
38
+ const activePatternResult = $007CAC$007C_$007C(head(cellValues));
39
+ if (activePatternResult != null) {
40
+ if (isEmpty(tail(cellValues))) {
41
+ matchResult = 0;
42
+ header = activePatternResult;
43
+ }
44
+ else {
45
+ matchResult = 1;
46
+ }
47
+ }
48
+ else {
49
+ matchResult = 1;
50
+ }
51
+ }
52
+ else {
53
+ matchResult = 1;
54
+ }
55
+ switch (matchResult) {
56
+ case 0:
57
+ return [header, (cells_1) => termFromFsCells(void 0, void 0, cells_1)];
58
+ default: {
59
+ let matchResult_1, header_1;
60
+ if (!isEmpty(cellValues)) {
61
+ const activePatternResult_1 = $007CAC$007C_$007C(head(cellValues));
62
+ if (activePatternResult_1 != null) {
63
+ if (!isEmpty(tail(cellValues))) {
64
+ if ($007CTSRColumnHeaderRaw$007C_$007C(head(tail(cellValues))) != null) {
65
+ if (!isEmpty(tail(tail(cellValues)))) {
66
+ if ($007CTANColumnHeaderRaw$007C_$007C(head(tail(tail(cellValues)))) != null) {
67
+ if (isEmpty(tail(tail(tail(cellValues))))) {
68
+ matchResult_1 = 0;
69
+ header_1 = activePatternResult_1;
70
+ }
71
+ else {
72
+ matchResult_1 = 1;
73
+ }
74
+ }
75
+ else {
76
+ matchResult_1 = 1;
77
+ }
78
+ }
79
+ else {
80
+ matchResult_1 = 1;
81
+ }
82
+ }
83
+ else {
84
+ matchResult_1 = 1;
85
+ }
86
+ }
87
+ else {
88
+ matchResult_1 = 1;
89
+ }
90
+ }
91
+ else {
92
+ matchResult_1 = 1;
93
+ }
94
+ }
95
+ else {
96
+ matchResult_1 = 1;
97
+ }
98
+ switch (matchResult_1) {
99
+ case 0:
100
+ return [header_1, (cells_2) => termFromFsCells(1, 2, cells_2)];
101
+ default: {
102
+ let matchResult_2, header_2;
103
+ if (!isEmpty(cellValues)) {
104
+ const activePatternResult_4 = $007CAC$007C_$007C(head(cellValues));
105
+ if (activePatternResult_4 != null) {
106
+ if (!isEmpty(tail(cellValues))) {
107
+ if ($007CTANColumnHeaderRaw$007C_$007C(head(tail(cellValues))) != null) {
108
+ if (!isEmpty(tail(tail(cellValues)))) {
109
+ if ($007CTSRColumnHeaderRaw$007C_$007C(head(tail(tail(cellValues)))) != null) {
110
+ if (isEmpty(tail(tail(tail(cellValues))))) {
111
+ matchResult_2 = 0;
112
+ header_2 = activePatternResult_4;
113
+ }
114
+ else {
115
+ matchResult_2 = 1;
116
+ }
117
+ }
118
+ else {
119
+ matchResult_2 = 1;
120
+ }
121
+ }
122
+ else {
123
+ matchResult_2 = 1;
124
+ }
125
+ }
126
+ else {
127
+ matchResult_2 = 1;
128
+ }
129
+ }
130
+ else {
131
+ matchResult_2 = 1;
132
+ }
133
+ }
134
+ else {
135
+ matchResult_2 = 1;
136
+ }
137
+ }
138
+ else {
139
+ matchResult_2 = 1;
140
+ }
141
+ switch (matchResult_2) {
142
+ case 0:
143
+ return [header_2, (cells_3) => termFromFsCells(2, 1, cells_3)];
144
+ default:
145
+ return void 0;
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+
153
+ export function ActivePattern_$007CExplication$007C_$007C(cells) {
154
+ const activePatternResult = ActivePattern_$007CTerm$007C_$007C("Explication", DataMapAux_explicationHeader, cells);
155
+ if (activePatternResult != null) {
156
+ const r = activePatternResult;
157
+ return r;
158
+ }
159
+ else {
160
+ return void 0;
161
+ }
162
+ }
163
+
164
+ export function ActivePattern_$007CUnit$007C_$007C(cells) {
165
+ const activePatternResult = ActivePattern_$007CTerm$007C_$007C("Unit", DataMapAux_unitHeader, cells);
166
+ if (activePatternResult != null) {
167
+ const r = activePatternResult;
168
+ return r;
169
+ }
170
+ else {
171
+ return void 0;
172
+ }
173
+ }
174
+
175
+ export function ActivePattern_$007CObjectType$007C_$007C(cells) {
176
+ const activePatternResult = ActivePattern_$007CTerm$007C_$007C("Object Type", DataMapAux_objectTypeHeader, cells);
177
+ if (activePatternResult != null) {
178
+ const r = activePatternResult;
179
+ return r;
180
+ }
181
+ else {
182
+ return void 0;
183
+ }
184
+ }
185
+
186
+ export function ActivePattern_$007CDescription$007C_$007C(cells) {
187
+ const cellValues = map((c) => c.ValueAsString(), cells);
188
+ let matchResult;
189
+ if (!isEmpty(cellValues)) {
190
+ if (head(cellValues) === "Description") {
191
+ if (isEmpty(tail(cellValues))) {
192
+ matchResult = 0;
193
+ }
194
+ else {
195
+ matchResult = 1;
196
+ }
197
+ }
198
+ else {
199
+ matchResult = 1;
200
+ }
201
+ }
202
+ else {
203
+ matchResult = 1;
204
+ }
205
+ switch (matchResult) {
206
+ case 0:
207
+ return [DataMapAux_descriptionHeader, freeTextFromFsCells];
208
+ default:
209
+ return void 0;
210
+ }
211
+ }
212
+
213
+ export function ActivePattern_$007CGeneratedBy$007C_$007C(cells) {
214
+ const cellValues = map((c) => c.ValueAsString(), cells);
215
+ let matchResult;
216
+ if (!isEmpty(cellValues)) {
217
+ if (head(cellValues) === "Generated By") {
218
+ if (isEmpty(tail(cellValues))) {
219
+ matchResult = 0;
220
+ }
221
+ else {
222
+ matchResult = 1;
223
+ }
224
+ }
225
+ else {
226
+ matchResult = 1;
227
+ }
228
+ }
229
+ else {
230
+ matchResult = 1;
231
+ }
232
+ switch (matchResult) {
233
+ case 0:
234
+ return [DataMapAux_generatedByHeader, freeTextFromFsCells];
235
+ default:
236
+ return void 0;
237
+ }
238
+ }
239
+
240
+ export function ActivePattern_$007CData$007C_$007C(cells) {
241
+ const cellValues = map((c) => c.ValueAsString(), cells);
242
+ let matchResult, cols;
243
+ if (!isEmpty(cellValues)) {
244
+ if (head(cellValues) === "Data") {
245
+ matchResult = 0;
246
+ cols = tail(cellValues);
247
+ }
248
+ else {
249
+ matchResult = 1;
250
+ }
251
+ }
252
+ else {
253
+ matchResult = 1;
254
+ }
255
+ switch (matchResult) {
256
+ case 0: {
257
+ const format = map_1((y) => (1 + y), tryFindIndex((s) => (s.indexOf("Data Format") === 0), cols));
258
+ const selectorFormat = map_1((y_1) => (1 + y_1), tryFindIndex((s_1) => (s_1.indexOf("Data Selector Format") === 0), cols));
259
+ return [new CompositeHeader(11, [new IOType(2, [])]), (cells_1) => dataFromFsCells(format, selectorFormat, cells_1)];
260
+ }
261
+ default:
262
+ return void 0;
263
+ }
264
+ }
265
+
266
+ export function ActivePattern_$007CFreeText$007C_$007C(cells) {
267
+ const cellValues = map((c) => c.ValueAsString(), cells);
268
+ let matchResult, text;
269
+ if (!isEmpty(cellValues)) {
270
+ if (isEmpty(tail(cellValues))) {
271
+ matchResult = 0;
272
+ text = head(cellValues);
273
+ }
274
+ else {
275
+ matchResult = 1;
276
+ }
277
+ }
278
+ else {
279
+ matchResult = 1;
280
+ }
281
+ switch (matchResult) {
282
+ case 0:
283
+ return [new CompositeHeader(13, [text]), freeTextFromFsCells];
284
+ default:
285
+ return void 0;
286
+ }
287
+ }
288
+
289
+ export function fromFsCells(cells) {
290
+ const activePatternResult = ActivePattern_$007CData$007C_$007C(cells);
291
+ if (activePatternResult != null) {
292
+ const d = activePatternResult;
293
+ return d;
294
+ }
295
+ else {
296
+ const activePatternResult_1 = ActivePattern_$007CExplication$007C_$007C(cells);
297
+ if (activePatternResult_1 != null) {
298
+ const e = activePatternResult_1;
299
+ return e;
300
+ }
301
+ else {
302
+ const activePatternResult_2 = ActivePattern_$007CUnit$007C_$007C(cells);
303
+ if (activePatternResult_2 != null) {
304
+ const u = activePatternResult_2;
305
+ return u;
306
+ }
307
+ else {
308
+ const activePatternResult_3 = ActivePattern_$007CObjectType$007C_$007C(cells);
309
+ if (activePatternResult_3 != null) {
310
+ const ot = activePatternResult_3;
311
+ return ot;
312
+ }
313
+ else {
314
+ const activePatternResult_4 = ActivePattern_$007CDescription$007C_$007C(cells);
315
+ if (activePatternResult_4 != null) {
316
+ const d_1 = activePatternResult_4;
317
+ return d_1;
318
+ }
319
+ else {
320
+ const activePatternResult_5 = ActivePattern_$007CGeneratedBy$007C_$007C(cells);
321
+ if (activePatternResult_5 != null) {
322
+ const gb = activePatternResult_5;
323
+ return gb;
324
+ }
325
+ else {
326
+ const activePatternResult_6 = ActivePattern_$007CFreeText$007C_$007C(cells);
327
+ if (activePatternResult_6 != null) {
328
+ const ft = activePatternResult_6;
329
+ return ft;
330
+ }
331
+ else {
332
+ return toFail(printf("Could not parse header group %O"))(cells);
333
+ }
334
+ }
335
+ }
336
+ }
337
+ }
338
+ }
339
+ }
340
+ }
341
+
342
+ export function toFsCells(header) {
343
+ let matchResult, h_9, h_10, h_11, text;
344
+ switch (header.tag) {
345
+ case 11: {
346
+ if (header.fields[0].tag === 2) {
347
+ matchResult = 0;
348
+ }
349
+ else if (equals(header, DataMapAux_explicationHeader)) {
350
+ matchResult = 1;
351
+ h_9 = header;
352
+ }
353
+ else if (equals(header, DataMapAux_unitHeader)) {
354
+ matchResult = 2;
355
+ h_10 = header;
356
+ }
357
+ else if (equals(header, DataMapAux_objectTypeHeader)) {
358
+ matchResult = 3;
359
+ h_11 = header;
360
+ }
361
+ else {
362
+ matchResult = 5;
363
+ }
364
+ break;
365
+ }
366
+ case 13: {
367
+ if (equals(header, DataMapAux_explicationHeader)) {
368
+ matchResult = 1;
369
+ h_9 = header;
370
+ }
371
+ else if (equals(header, DataMapAux_unitHeader)) {
372
+ matchResult = 2;
373
+ h_10 = header;
374
+ }
375
+ else if (equals(header, DataMapAux_objectTypeHeader)) {
376
+ matchResult = 3;
377
+ h_11 = header;
378
+ }
379
+ else {
380
+ matchResult = 4;
381
+ text = header.fields[0];
382
+ }
383
+ break;
384
+ }
385
+ default:
386
+ if (equals(header, DataMapAux_explicationHeader)) {
387
+ matchResult = 1;
388
+ h_9 = header;
389
+ }
390
+ else if (equals(header, DataMapAux_unitHeader)) {
391
+ matchResult = 2;
392
+ h_10 = header;
393
+ }
394
+ else if (equals(header, DataMapAux_objectTypeHeader)) {
395
+ matchResult = 3;
396
+ h_11 = header;
397
+ }
398
+ else {
399
+ matchResult = 5;
400
+ }
401
+ }
402
+ switch (matchResult) {
403
+ case 0:
404
+ return ofArray([new FsCell("Data"), new FsCell("Data Format"), new FsCell("Data Selector Format")]);
405
+ case 1:
406
+ return ofArray([new FsCell("Explication"), new FsCell("Term Source REF"), new FsCell("Term Accession Number")]);
407
+ case 2:
408
+ return ofArray([new FsCell("Unit"), new FsCell("Term Source REF"), new FsCell("Term Accession Number")]);
409
+ case 3:
410
+ return ofArray([new FsCell("Object Type"), new FsCell("Term Source REF"), new FsCell("Term Accession Number")]);
411
+ case 4:
412
+ return singleton(new FsCell(text));
413
+ default:
414
+ return toFail(printf("Could not parse DataMap header %O."))(header);
415
+ }
416
+ }
417
+
@@ -0,0 +1,98 @@
1
+ import { iterateIndexed, head, length, sortBy, collect, map, toArray, exists, ofArray } from "../../fable_modules/fable-library-js.4.16.0/List.js";
2
+ import { classifyColumnOrder, Aux_List_groupWhen } from "../AnnotationTable/ArcTable.js";
3
+ import { toList, tryFind } from "../../fable_modules/fable-library-js.4.16.0/Seq.js";
4
+ import { toFsColumns, fromFsColumns } from "./DataMapColumn.js";
5
+ import { printf, toFail } from "../../fable_modules/fable-library-js.4.16.0/String.js";
6
+ import { DataMap__get_Table, DataMap_init, DataMap_addColumns_6369C010 } from "../../Core/Table/DataMap.js";
7
+ import { FsWorksheet } from "../../fable_modules/FsSpreadsheet.6.1.2/FsWorksheet.fs.js";
8
+ import { comparePrimitives } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
9
+ import { FsRangeAddress_$ctor_7E77A4A0 } from "../../fable_modules/FsSpreadsheet.6.1.2/Ranges/FsRangeAddress.fs.js";
10
+ import { FsAddress_$ctor_Z37302880 } from "../../fable_modules/FsSpreadsheet.6.1.2/FsAddress.fs.js";
11
+ import { Dictionary_tryGet } from "../../fable_modules/FsSpreadsheet.6.1.2/Cells/FsCellsCollection.fs.js";
12
+ import { addToDict } from "../../fable_modules/fable-library-js.4.16.0/MapUtil.js";
13
+ import { FsRangeBase__Cell_Z3407A44B } from "../../fable_modules/FsSpreadsheet.6.1.2/Ranges/FsRangeBase.fs.js";
14
+
15
+ export const helperColumnStrings = ofArray(["Term Source REF", "Term Accession Number", "Data Format", "Data Selector Format"]);
16
+
17
+ export function groupColumnsByHeader(columns) {
18
+ return Aux_List_groupWhen((c) => {
19
+ const v = c.Item(1).ValueAsString();
20
+ return !exists((s) => (v.indexOf(s) === 0), helperColumnStrings);
21
+ }, columns);
22
+ }
23
+
24
+ /**
25
+ * Returns the annotation table of the worksheet if it exists, else returns None
26
+ */
27
+ export function tryDataMapTable(sheet) {
28
+ return tryFind((t) => (t.Name.indexOf("datamapTable") === 0), sheet.Tables);
29
+ }
30
+
31
+ /**
32
+ * Groups and parses a collection of single columns into the according ISA composite columns
33
+ */
34
+ export function composeColumns(columns) {
35
+ return toArray(map(fromFsColumns, groupColumnsByHeader(toList(columns))));
36
+ }
37
+
38
+ /**
39
+ * Returns the protocol described by the headers and a function for parsing the values of the matrix to the processes of this protocol
40
+ */
41
+ export function tryFromFsWorksheet(sheet) {
42
+ try {
43
+ const matchValue = tryDataMapTable(sheet);
44
+ if (matchValue == null) {
45
+ return void 0;
46
+ }
47
+ else {
48
+ const t = matchValue;
49
+ return DataMap_addColumns_6369C010(composeColumns(t.GetColumns(sheet.CellCollection)), true)(DataMap_init());
50
+ }
51
+ }
52
+ catch (err) {
53
+ const arg = sheet.Name;
54
+ const arg_1 = err.message;
55
+ return toFail(printf("Could not parse datamap table with name \"%s\":\n%s"))(arg)(arg_1);
56
+ }
57
+ }
58
+
59
+ export function toFsWorksheet(table) {
60
+ const stringCount = new Map([]);
61
+ const ws = new FsWorksheet("isa_datamap");
62
+ if (DataMap__get_Table(table).Columns.length === 0) {
63
+ return ws;
64
+ }
65
+ else {
66
+ const columns = collect(toFsColumns, sortBy(classifyColumnOrder, ofArray(DataMap__get_Table(table).Columns), {
67
+ Compare: comparePrimitives,
68
+ }));
69
+ const maxRow = length(head(columns)) | 0;
70
+ const maxCol = length(columns) | 0;
71
+ const fsTable = ws.Table("datamapTable", FsRangeAddress_$ctor_7E77A4A0(FsAddress_$ctor_Z37302880(1, 1), FsAddress_$ctor_Z37302880(maxRow, maxCol)));
72
+ iterateIndexed((colI, col) => {
73
+ iterateIndexed((rowI, cell) => {
74
+ let value;
75
+ const v = cell.ValueAsString();
76
+ if (rowI === 0) {
77
+ const matchValue = Dictionary_tryGet(v, stringCount);
78
+ if (matchValue == null) {
79
+ addToDict(stringCount, cell.ValueAsString(), "");
80
+ value = v;
81
+ }
82
+ else {
83
+ const spaces = matchValue;
84
+ stringCount.set(v, spaces + " ");
85
+ value = ((v + " ") + spaces);
86
+ }
87
+ }
88
+ else {
89
+ value = v;
90
+ }
91
+ const address = FsAddress_$ctor_Z37302880(rowI + 1, colI + 1);
92
+ FsRangeBase__Cell_Z3407A44B(fsTable, address, ws.CellCollection).SetValueAs(value);
93
+ }, col);
94
+ }, columns);
95
+ return ws;
96
+ }
97
+ }
98
+
@@ -19,13 +19,13 @@ export function fromString(measurementType, measurementTypeTermSourceREF, measur
19
19
  const measurementType_2 = Option_fromValueWithDefault(new OntologyAnnotation(), measurementType_1);
20
20
  const technologyType_2 = Option_fromValueWithDefault(new OntologyAnnotation(), technologyType_1);
21
21
  const technologyPlatform_1 = map(JsonTypes_decomposeTechnologyPlatform, technologyPlatform);
22
- return ArcAssay.make(fileName, measurementType_2, technologyType_2, technologyPlatform_1, [], [], comments);
22
+ return ArcAssay.make(fileName, measurementType_2, technologyType_2, technologyPlatform_1, [], void 0, [], comments);
23
23
  }
24
24
 
25
25
  export function fromSparseTable(matrix) {
26
26
  if ((matrix.ColumnCount === 0) && (length(matrix.CommentKeys) !== 0)) {
27
27
  const comments = SparseTable_GetEmptyComments_3ECCA699(matrix);
28
- return singleton(ArcAssay.create(createMissingIdentifier(), void 0, void 0, void 0, void 0, void 0, comments));
28
+ return singleton(ArcAssay.create(createMissingIdentifier(), void 0, void 0, void 0, void 0, void 0, void 0, comments));
29
29
  }
30
30
  else {
31
31
  return initialize(matrix.ColumnCount, (i) => {
@@ -2,14 +2,14 @@ import { append as append_1, delay, tryItem, length as length_1, isEmpty, iterat
2
2
  import { defaultArg, map as map_1 } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
3
3
  import { tryFind, ofSeq } from "../../fable_modules/fable-library-js.4.16.0/Map.js";
4
4
  import { arrayHash, equalArrays, equals, comparePrimitives } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
5
- import { RowBuilder_get_Empty, RowBuilder__Combine_19F30600, RowBuilder_$ctor } from "../../fable_modules/FsSpreadsheet.5.1.3/DSL/RowBuilder.fs.js";
6
- import { CellBuilder_$ctor, CellBuilder__AsCellElement_6F87C2ED } from "../../fable_modules/FsSpreadsheet.5.1.3/DSL/CellBuilder.fs.js";
7
- import { Messages_format, SheetEntity$1_some_2B595 } from "../../fable_modules/FsSpreadsheet.5.1.3/DSL/Types.fs.js";
8
- import { DataType } from "../../fable_modules/FsSpreadsheet.5.1.3/Cells/FsCell.fs.js";
5
+ import { RowBuilder_get_Empty, RowBuilder__Combine_19F30600, RowBuilder_$ctor } from "../../fable_modules/FsSpreadsheet.6.1.2/DSL/RowBuilder.fs.js";
6
+ import { CellBuilder_$ctor, CellBuilder__AsCellElement_6F87C2ED } from "../../fable_modules/FsSpreadsheet.6.1.2/DSL/CellBuilder.fs.js";
7
+ import { Messages_format, SheetEntity$1_some_2B595 } from "../../fable_modules/FsSpreadsheet.6.1.2/DSL/Types.fs.js";
8
+ import { DataType } from "../../fable_modules/FsSpreadsheet.6.1.2/Cells/FsCell.fs.js";
9
9
  import { map as map_2, initialize as initialize_1, exists, find, cons, append, empty, singleton } from "../../fable_modules/fable-library-js.4.16.0/List.js";
10
- import { ColumnIndex, RowElement } from "../../fable_modules/FsSpreadsheet.5.1.3/DSL/Types.fs.js";
11
- import { FsRangeAddress_$ctor_7E77A4A0 } from "../../fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeAddress.fs.js";
12
- import { FsAddress_$ctor_Z37302880 } from "../../fable_modules/FsSpreadsheet.5.1.3/FsAddress.fs.js";
10
+ import { ColumnIndex, RowElement } from "../../fable_modules/FsSpreadsheet.6.1.2/DSL/Types.fs.js";
11
+ import { FsRangeAddress_$ctor_7E77A4A0 } from "../../fable_modules/FsSpreadsheet.6.1.2/Ranges/FsRangeAddress.fs.js";
12
+ import { FsAddress_$ctor_Z37302880 } from "../../fable_modules/FsSpreadsheet.6.1.2/FsAddress.fs.js";
13
13
  import { Record } from "../../fable_modules/fable-library-js.4.16.0/Types.js";
14
14
  import { record_type, list_type, class_type, tuple_type, int32_type, string_type } from "../../fable_modules/fable-library-js.4.16.0/Reflection.js";
15
15
  import { Seq_trySkip, Dictionary_tryGetValue } from "../CollectionAux.js";
@@ -97,7 +97,7 @@ export function fromParts(studyInfo, designDescriptors, publications, factors, a
97
97
  const studyDesignDescriptors = Array.from(designDescriptors);
98
98
  const registeredAssayIdentifiers = Array.from(assayIdentifiers);
99
99
  const comments = Array.from(studyInfo.Comments);
100
- arcstudy = ArcStudy.make(studyInfo.Identifier, title, description, submissionDate, publicReleaseDate, publications_1, contacts_1, studyDesignDescriptors, [], registeredAssayIdentifiers, comments);
100
+ arcstudy = ArcStudy.make(studyInfo.Identifier, title, description, submissionDate, publicReleaseDate, publications_1, contacts_1, studyDesignDescriptors, [], void 0, registeredAssayIdentifiers, comments);
101
101
  if (arcstudy.isEmpty && (arcstudy.Identifier === "")) {
102
102
  return void 0;
103
103
  }
@@ -15,10 +15,10 @@ import { toArray } from "../fable_modules/fable-library-js.4.16.0/Option.js";
15
15
  import { toRows as toRows_1, fromRows as fromRows_1 } from "./Metadata/Contacts.js";
16
16
  import { parse } from "../fable_modules/fable-library-js.4.16.0/Guid.js";
17
17
  import { Template, Organisation } from "../Core/Template.js";
18
- import { FsWorksheet } from "../fable_modules/FsSpreadsheet.5.1.3/FsWorksheet.fs.js";
18
+ import { FsWorksheet } from "../fable_modules/FsSpreadsheet.6.1.2/FsWorksheet.fs.js";
19
19
  import { toFsWorksheet, tryFromFsWorksheet } from "./AnnotationTable/ArcTable.js";
20
20
  import { now } from "../fable_modules/fable-library-js.4.16.0/Date.js";
21
- import { FsWorkbook } from "../fable_modules/FsSpreadsheet.5.1.3/FsWorkbook.fs.js";
21
+ import { FsWorkbook } from "../fable_modules/FsSpreadsheet.6.1.2/FsWorkbook.fs.js";
22
22
 
23
23
  export class TemplateReadError extends FSharpException {
24
24
  constructor(Data0) {