@nfdi4plants/arctrl 2.0.0-beta.8 → 2.0.1
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.
- package/ARC.js +44 -11
- package/Contract/ArcInvestigation.js +4 -4
- package/Contract/ValidationPackagesConfig.js +19 -18
- package/Core/ArcTypes.js +95 -92
- package/Core/Table/ArcTable.js +99 -11
- package/Core/Table/CompositeCell.js +26 -0
- package/Core/Table/CompositeColumn.js +7 -30
- package/Core/Table/CompositeHeader.js +5 -215
- package/FileSystem/Path.js +9 -1
- package/Json/context/rocrate/isa_data_context.js +1 -1
- package/Json/context/rocrate/isa_investigation_context.js +1 -1
- package/Spreadsheet/AnnotationTable/ArcTable.js +3 -2
- package/Spreadsheet/ArcAssay.js +40 -20
- package/Spreadsheet/ArcInvestigation.js +59 -38
- package/Spreadsheet/ArcStudy.js +31 -16
- package/Spreadsheet/Template.js +1 -1
- package/ValidationPackages/ValidationPackage.js +9 -2
- package/ValidationPackages/ValidationPackagesConfig.js +42 -9
- package/Xlsx.js +3 -3
- package/Yaml/ValidationPackagesConfig.js +2 -2
- package/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
package/Core/Table/ArcTable.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { boxHashValues, Unchecked_alignByHeaders, Unchecked_extendToRowCount, Unchecked_removeRowCells_withIndexChange, Unchecked_addRows, Unchecked_addRow, Unchecked_getEmptyCellForHeader, Unchecked_moveColumnTo, Unchecked_removeColumnCells_withIndexChange, tryFindDuplicateUniqueInArray, Unchecked_removeColumnCells, Unchecked_removeHeader, Unchecked_fillMissingCells, Unchecked_addColumn, tryFindDuplicateUnique, Unchecked_setCellAt,
|
|
1
|
+
import { boxHashValues, Unchecked_alignByHeaders, Unchecked_extendToRowCount, Unchecked_removeRowCells_withIndexChange, Unchecked_addRows, Unchecked_addRow, Unchecked_getEmptyCellForHeader, Unchecked_moveColumnTo, Unchecked_removeColumnCells_withIndexChange, tryFindDuplicateUniqueInArray, Unchecked_removeColumnCells, Unchecked_removeHeader, Unchecked_fillMissingCells, Unchecked_addColumn, SanityChecks_validateColumn, tryFindDuplicateUnique, Unchecked_setCellAt, SanityChecks_validateRowIndex, SanityChecks_validateColumnIndex, Unchecked_tryGetCellAt, getRowCount, getColumnCount, SanityChecks_validate } from "./ArcTableAux.js";
|
|
2
2
|
import { Dictionary } from "../../fable_modules/fable-library-js.4.16.0/MutableMap.js";
|
|
3
|
-
import { compareArrays, safeHash, comparePrimitives, equals, arrayHash, equalArrays } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
|
|
3
|
+
import { compareArrays, safeHash, comparePrimitives, equals, disposeSafe, getEnumerator, arrayHash, equalArrays } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
|
|
4
4
|
import { value as value_3, map as map_2, unwrap, defaultArg } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
|
|
5
5
|
import { item as item_1, fold, append as append_1, toList, indexed as indexed_1, choose, filter, length, tryFindIndex, empty, singleton, collect, removeAt, map, delay, toArray } from "../../fable_modules/fable-library-js.4.16.0/Seq.js";
|
|
6
6
|
import { rangeDouble } from "../../fable_modules/fable-library-js.4.16.0/Range.js";
|
|
7
|
+
import { join, printf, toFail } from "../../fable_modules/fable-library-js.4.16.0/String.js";
|
|
8
|
+
import { getItemFromDict } from "../../fable_modules/fable-library-js.4.16.0/MapUtil.js";
|
|
7
9
|
import { CompositeColumn } from "./CompositeColumn.js";
|
|
8
|
-
import { sortBy, indexed, mapIndexed,
|
|
10
|
+
import { sortBy, indexed, mapIndexed, item, sortDescending, iterateIndexed, initialize, map as map_1 } from "../../fable_modules/fable-library-js.4.16.0/Array.js";
|
|
9
11
|
import { append, iterate, isEmpty } from "../../fable_modules/fable-library-js.4.16.0/List.js";
|
|
10
12
|
import { StringBuilder__AppendLine_Z721C83C5, StringBuilder_$ctor } from "../../fable_modules/fable-library-js.4.16.0/System.Text.js";
|
|
11
13
|
import { toString } from "../../fable_modules/fable-library-js.4.16.0/Types.js";
|
|
12
|
-
import { join, printf, toFail } from "../../fable_modules/fable-library-js.4.16.0/String.js";
|
|
13
14
|
import { CompositeCell } from "./CompositeCell.js";
|
|
14
15
|
import { CompositeHeader } from "./CompositeHeader.js";
|
|
15
16
|
import { Array_groupBy } from "../../fable_modules/fable-library-js.4.16.0/Seq2.js";
|
|
16
|
-
import { getItemFromDict } from "../../fable_modules/fable-library-js.4.16.0/MapUtil.js";
|
|
17
17
|
import { boxHashSeq, boxHashArray } from "../Helper/HashCodes.js";
|
|
18
18
|
import { class_type } from "../../fable_modules/fable-library-js.4.16.0/Reflection.js";
|
|
19
19
|
|
|
@@ -104,6 +104,19 @@ export class ArcTable {
|
|
|
104
104
|
static tryGetCellAt(column, row) {
|
|
105
105
|
return (table) => table.TryGetCellAt(column, row);
|
|
106
106
|
}
|
|
107
|
+
GetCellAt(column, row) {
|
|
108
|
+
const this$ = this;
|
|
109
|
+
try {
|
|
110
|
+
return getItemFromDict(this$.Values, [column, row]);
|
|
111
|
+
}
|
|
112
|
+
catch (matchValue) {
|
|
113
|
+
const arg_2 = this$.Name;
|
|
114
|
+
return toFail(printf("Unable to find cell for index: (%i, %i) in table %s"))(column)(row)(arg_2);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
static getCellAt(column, row) {
|
|
118
|
+
return (table) => table.GetCellAt(column, row);
|
|
119
|
+
}
|
|
107
120
|
IterColumns(action) {
|
|
108
121
|
const this$ = this;
|
|
109
122
|
for (let columnIndex = 0; columnIndex <= (this$.ColumnCount - 1); columnIndex++) {
|
|
@@ -130,20 +143,83 @@ export class ArcTable {
|
|
|
130
143
|
return copy;
|
|
131
144
|
};
|
|
132
145
|
}
|
|
133
|
-
UpdateCellAt(columnIndex, rowIndex, c) {
|
|
146
|
+
UpdateCellAt(columnIndex, rowIndex, c, skipValidation) {
|
|
134
147
|
const this$ = this;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
148
|
+
if (!defaultArg(skipValidation, false)) {
|
|
149
|
+
SanityChecks_validateColumnIndex(columnIndex, this$.ColumnCount, false);
|
|
150
|
+
SanityChecks_validateRowIndex(rowIndex, this$.RowCount, false);
|
|
151
|
+
c.ValidateAgainstHeader(this$.Headers[columnIndex], true);
|
|
152
|
+
}
|
|
153
|
+
Unchecked_setCellAt(columnIndex, rowIndex, c, this$.Values);
|
|
154
|
+
}
|
|
155
|
+
static updateCellAt(columnIndex, rowIndex, cell, skipValidation) {
|
|
156
|
+
return (table) => {
|
|
157
|
+
const newTable = table.Copy();
|
|
158
|
+
newTable.UpdateCellAt(columnIndex, rowIndex, cell, unwrap(skipValidation));
|
|
159
|
+
return newTable;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
SetCellAt(columnIndex, rowIndex, c, skipValidation) {
|
|
163
|
+
const this$ = this;
|
|
164
|
+
if (!defaultArg(skipValidation, false)) {
|
|
165
|
+
SanityChecks_validateColumnIndex(columnIndex, this$.ColumnCount, false);
|
|
166
|
+
c.ValidateAgainstHeader(this$.Headers[columnIndex], true);
|
|
167
|
+
}
|
|
138
168
|
Unchecked_setCellAt(columnIndex, rowIndex, c, this$.Values);
|
|
139
169
|
}
|
|
140
|
-
static
|
|
170
|
+
static setCellAt(columnIndex, rowIndex, cell, skipValidation) {
|
|
141
171
|
return (table) => {
|
|
142
172
|
const newTable = table.Copy();
|
|
143
|
-
newTable.
|
|
173
|
+
newTable.SetCellAt(columnIndex, rowIndex, cell, unwrap(skipValidation));
|
|
144
174
|
return newTable;
|
|
145
175
|
};
|
|
146
176
|
}
|
|
177
|
+
UpdateCellsBy(f, skipValidation) {
|
|
178
|
+
const this$ = this;
|
|
179
|
+
const skipValidation_1 = defaultArg(skipValidation, false);
|
|
180
|
+
let enumerator = getEnumerator(this$.Values);
|
|
181
|
+
try {
|
|
182
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
183
|
+
const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
184
|
+
const patternInput = kv[0];
|
|
185
|
+
const ri = patternInput[1] | 0;
|
|
186
|
+
const ci = patternInput[0] | 0;
|
|
187
|
+
const newCell = f(ci, ri, kv[1]);
|
|
188
|
+
if (!skipValidation_1) {
|
|
189
|
+
newCell.ValidateAgainstHeader(this$.Headers[ci], true);
|
|
190
|
+
}
|
|
191
|
+
Unchecked_setCellAt(ci, ri, newCell, this$.Values);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
disposeSafe(enumerator);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
static updateCellsBy(f, skipValidation) {
|
|
199
|
+
return (table) => {
|
|
200
|
+
const newTable = table.Copy();
|
|
201
|
+
newTable.UpdateCellsBy(f, unwrap(skipValidation));
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
UpdateCellBy(columnIndex, rowIndex, f, skipValidation) {
|
|
205
|
+
const this$ = this;
|
|
206
|
+
const skipValidation_1 = defaultArg(skipValidation, false);
|
|
207
|
+
if (!skipValidation_1) {
|
|
208
|
+
SanityChecks_validateColumnIndex(columnIndex, this$.ColumnCount, false);
|
|
209
|
+
SanityChecks_validateRowIndex(rowIndex, this$.RowCount, false);
|
|
210
|
+
}
|
|
211
|
+
const newCell = f(this$.GetCellAt(columnIndex, rowIndex));
|
|
212
|
+
if (!skipValidation_1) {
|
|
213
|
+
newCell.ValidateAgainstHeader(this$.Headers[columnIndex], true);
|
|
214
|
+
}
|
|
215
|
+
Unchecked_setCellAt(columnIndex, rowIndex, newCell, this$.Values);
|
|
216
|
+
}
|
|
217
|
+
static updateCellBy(columnIndex, rowIndex, f, skipValidation) {
|
|
218
|
+
return (table) => {
|
|
219
|
+
const newTable = table.Copy();
|
|
220
|
+
newTable.UpdateCellBy(columnIndex, rowIndex, f, unwrap(skipValidation));
|
|
221
|
+
};
|
|
222
|
+
}
|
|
147
223
|
UpdateHeader(index, newHeader, forceConvertCells) {
|
|
148
224
|
const this$ = this;
|
|
149
225
|
const forceConvertCells_1 = defaultArg(forceConvertCells, false);
|
|
@@ -199,6 +275,18 @@ export class ArcTable {
|
|
|
199
275
|
return newTable;
|
|
200
276
|
};
|
|
201
277
|
}
|
|
278
|
+
AddColumnFill(header, cell, index, forceReplace) {
|
|
279
|
+
const this$ = this;
|
|
280
|
+
const cells = initialize(this$.RowCount, (_arg) => cell.Copy());
|
|
281
|
+
this$.AddColumn(header, cells, index, forceReplace);
|
|
282
|
+
}
|
|
283
|
+
static addColumnFill(header, cell, index, forceReplace) {
|
|
284
|
+
return (table) => {
|
|
285
|
+
const newTable = table.Copy();
|
|
286
|
+
newTable.AddColumnFill(header, cell, unwrap(index), unwrap(forceReplace));
|
|
287
|
+
return newTable;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
202
290
|
UpdateColumn(columnIndex, header, cells, skipFillMissing) {
|
|
203
291
|
const this$ = this;
|
|
204
292
|
SanityChecks_validateColumnIndex(columnIndex, this$.ColumnCount, false);
|
|
@@ -165,6 +165,32 @@ export class CompositeCell extends Union {
|
|
|
165
165
|
const this$ = this;
|
|
166
166
|
return (this$.tag === 1) ? (new CompositeCell(1, [this$.fields[0]])) : ((this$.tag === 2) ? (new CompositeCell(2, [this$.fields[0], this$.fields[1].Copy()])) : ((this$.tag === 3) ? (new CompositeCell(3, [this$.fields[0].Copy()])) : (new CompositeCell(0, [this$.fields[0].Copy()]))));
|
|
167
167
|
}
|
|
168
|
+
ValidateAgainstHeader(header, raiseException) {
|
|
169
|
+
const this$ = this;
|
|
170
|
+
const raiseExeption = defaultArg(raiseException, false);
|
|
171
|
+
const cell = this$;
|
|
172
|
+
if (header.IsDataColumn && (cell.isData ? true : cell.isFreeText)) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
else if (header.IsDataColumn) {
|
|
176
|
+
if (raiseExeption) {
|
|
177
|
+
throw new Error(`Invalid combination of header \`${header}\` and cell \`${cell}\`, Data header should have either Data or Freetext cells`);
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
else if (header.IsTermColumn && (cell.isTerm ? true : cell.isUnitized)) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
else if (!header.IsTermColumn && cell.isFreeText) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
if (raiseExeption) {
|
|
189
|
+
throw new Error(`Invalid combination of header \`${header}\` and cell \`${cell}\``);
|
|
190
|
+
}
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
168
194
|
static term(oa) {
|
|
169
195
|
return new CompositeCell(0, [oa]);
|
|
170
196
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { defaultArg } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
|
|
2
|
-
import {
|
|
3
|
-
import { fold, empty, singleton, collect, delay, toArray } from "../../fable_modules/fable-library-js.4.16.0/Seq.js";
|
|
1
|
+
import { unwrap, defaultArg } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
|
|
2
|
+
import { fold, empty, singleton, collect, delay, toArray, exists } from "../../fable_modules/fable-library-js.4.16.0/Seq.js";
|
|
4
3
|
import { CompositeCell_$reflection, CompositeCell } from "./CompositeCell.js";
|
|
5
4
|
import { Record } from "../../fable_modules/fable-library-js.4.16.0/Types.js";
|
|
6
5
|
import { CompositeHeader_$reflection } from "./CompositeHeader.js";
|
|
@@ -17,33 +16,7 @@ export class CompositeColumn extends Record {
|
|
|
17
16
|
}
|
|
18
17
|
Validate(raiseException) {
|
|
19
18
|
const this$ = this;
|
|
20
|
-
|
|
21
|
-
const header = this$.Header;
|
|
22
|
-
const cells = this$.Cells;
|
|
23
|
-
if (cells.length === 0) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
else if (header.IsDataColumn && (item(0, cells).isData ? true : item(0, cells).isFreeText)) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
else if (header.IsDataColumn) {
|
|
30
|
-
if (raiseExeption) {
|
|
31
|
-
throw new Error(`Invalid combination of header \`${header}\` and cells \`${item(0, cells)}\`, Data header should have either Data or Freetext cells`);
|
|
32
|
-
}
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
else if (header.IsTermColumn && (item(0, cells).isTerm ? true : item(0, cells).isUnitized)) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
else if (!header.IsTermColumn && item(0, cells).isFreeText) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
if (raiseExeption) {
|
|
43
|
-
throw new Error(`Invalid combination of header \`${header}\` and cells \`${item(0, cells)}\``);
|
|
44
|
-
}
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
19
|
+
return !exists((c) => !c.ValidateAgainstHeader(this$.Header, unwrap(raiseException)), this$.Cells);
|
|
47
20
|
}
|
|
48
21
|
TryGetColumnUnits() {
|
|
49
22
|
const this$ = this;
|
|
@@ -71,6 +44,10 @@ export class CompositeColumn extends Record {
|
|
|
71
44
|
return (patternInput[1] >= patternInput[0]) ? CompositeCell.emptyTerm : CompositeCell.emptyUnitized;
|
|
72
45
|
}
|
|
73
46
|
}
|
|
47
|
+
get IsUnique() {
|
|
48
|
+
const this$ = this;
|
|
49
|
+
return this$.Header.IsUnique;
|
|
50
|
+
}
|
|
74
51
|
}
|
|
75
52
|
|
|
76
53
|
export function CompositeColumn_$reflection() {
|
|
@@ -2,7 +2,6 @@ import { map } from "../../fable_modules/fable-library-js.4.16.0/Array.js";
|
|
|
2
2
|
import { union_type, string_type, getUnionCases, name } from "../../fable_modules/fable-library-js.4.16.0/Reflection.js";
|
|
3
3
|
import { Union, toString } from "../../fable_modules/fable-library-js.4.16.0/Types.js";
|
|
4
4
|
import { ActivePatterns_$007CTermColumn$007C_$007C, Pattern_CommentPattern, Pattern_OutputPattern, Pattern_InputPattern, ActivePatterns_$007CRegex$007C_$007C, tryParseIOTypeHeader } from "../Helper/Regex.js";
|
|
5
|
-
import { equals } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
|
|
6
5
|
import { printf, toFail } from "../../fable_modules/fable-library-js.4.16.0/String.js";
|
|
7
6
|
import { OntologyAnnotation_$reflection, OntologyAnnotation } from "../OntologyAnnotation.js";
|
|
8
7
|
|
|
@@ -98,79 +97,6 @@ export class IOType extends Union {
|
|
|
98
97
|
return IOType.ofString(s);
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
|
-
GetUITooltip() {
|
|
102
|
-
const this$ = this;
|
|
103
|
-
return IOType.getUITooltip(this$);
|
|
104
|
-
}
|
|
105
|
-
static getUITooltip(iotype) {
|
|
106
|
-
let matchResult;
|
|
107
|
-
if (typeof iotype === "string") {
|
|
108
|
-
if (equals(iotype, "Source")) {
|
|
109
|
-
matchResult = 0;
|
|
110
|
-
}
|
|
111
|
-
else if (equals(iotype, "Sample")) {
|
|
112
|
-
matchResult = 1;
|
|
113
|
-
}
|
|
114
|
-
else if (equals(iotype, "RawDataFile")) {
|
|
115
|
-
matchResult = 2;
|
|
116
|
-
}
|
|
117
|
-
else if (equals(iotype, "DerivedDataFile")) {
|
|
118
|
-
matchResult = 3;
|
|
119
|
-
}
|
|
120
|
-
else if (equals(iotype, "ImageFile")) {
|
|
121
|
-
matchResult = 4;
|
|
122
|
-
}
|
|
123
|
-
else if (equals(iotype, "Material")) {
|
|
124
|
-
matchResult = 5;
|
|
125
|
-
}
|
|
126
|
-
else if (equals(iotype, "FreeText")) {
|
|
127
|
-
matchResult = 6;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
matchResult = 7;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
switch (iotype.tag) {
|
|
135
|
-
case 1: {
|
|
136
|
-
matchResult = 1;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
case 2: {
|
|
140
|
-
matchResult = 2;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
case 3: {
|
|
144
|
-
matchResult = 5;
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case 4: {
|
|
148
|
-
matchResult = 6;
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
default:
|
|
152
|
-
matchResult = 0;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
switch (matchResult) {
|
|
156
|
-
case 0:
|
|
157
|
-
return "The source value must be a unique identifier for an organism or a sample.";
|
|
158
|
-
case 1:
|
|
159
|
-
return "The Sample Name column describes specifc laboratory samples with a unique identifier.";
|
|
160
|
-
case 2:
|
|
161
|
-
return "The Raw Data File column defines untransformed and unprocessed data files.";
|
|
162
|
-
case 3:
|
|
163
|
-
return "The Derived Data File column defines transformed and/or processed data files.";
|
|
164
|
-
case 4:
|
|
165
|
-
return "Placeholder";
|
|
166
|
-
case 5:
|
|
167
|
-
return "Placeholder";
|
|
168
|
-
case 6:
|
|
169
|
-
return "Placeholder";
|
|
170
|
-
default:
|
|
171
|
-
throw new Error(`Unable to parse combination to existing IOType: \`${iotype}\``);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
100
|
static source() {
|
|
175
101
|
return new IOType(0, []);
|
|
176
102
|
}
|
|
@@ -543,157 +469,21 @@ export class CompositeHeader extends Union {
|
|
|
543
469
|
return void 0;
|
|
544
470
|
}
|
|
545
471
|
}
|
|
546
|
-
|
|
472
|
+
get IsUnique() {
|
|
547
473
|
const this$ = this;
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
static getUITooltip(header) {
|
|
551
|
-
let matchResult;
|
|
552
|
-
if (typeof header === "string") {
|
|
553
|
-
if (equals(header, "Component")) {
|
|
554
|
-
matchResult = 0;
|
|
555
|
-
}
|
|
556
|
-
else if (equals(header, "Characteristic")) {
|
|
557
|
-
matchResult = 1;
|
|
558
|
-
}
|
|
559
|
-
else if (equals(header, "Factor")) {
|
|
560
|
-
matchResult = 2;
|
|
561
|
-
}
|
|
562
|
-
else if (equals(header, "Parameter")) {
|
|
563
|
-
matchResult = 3;
|
|
564
|
-
}
|
|
565
|
-
else if (equals(header, "ProtocolType")) {
|
|
566
|
-
matchResult = 4;
|
|
567
|
-
}
|
|
568
|
-
else if (equals(header, "ProtocolDescription")) {
|
|
569
|
-
matchResult = 5;
|
|
570
|
-
}
|
|
571
|
-
else if (equals(header, "ProtocolUri")) {
|
|
572
|
-
matchResult = 6;
|
|
573
|
-
}
|
|
574
|
-
else if (equals(header, "ProtocolVersion")) {
|
|
575
|
-
matchResult = 7;
|
|
576
|
-
}
|
|
577
|
-
else if (equals(header, "ProtocolREF")) {
|
|
578
|
-
matchResult = 8;
|
|
579
|
-
}
|
|
580
|
-
else if (equals(header, "Performer")) {
|
|
581
|
-
matchResult = 9;
|
|
582
|
-
}
|
|
583
|
-
else if (equals(header, "Date")) {
|
|
584
|
-
matchResult = 10;
|
|
585
|
-
}
|
|
586
|
-
else if (equals(header, "Input")) {
|
|
587
|
-
matchResult = 11;
|
|
588
|
-
}
|
|
589
|
-
else if (equals(header, "Output")) {
|
|
590
|
-
matchResult = 12;
|
|
591
|
-
}
|
|
592
|
-
else if (equals(header, "FreeText")) {
|
|
593
|
-
matchResult = 13;
|
|
594
|
-
}
|
|
595
|
-
else if (equals(header, "Comment")) {
|
|
596
|
-
matchResult = 14;
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
matchResult = 15;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
else {
|
|
603
|
-
switch (header.tag) {
|
|
604
|
-
case 1: {
|
|
605
|
-
matchResult = 1;
|
|
606
|
-
break;
|
|
607
|
-
}
|
|
608
|
-
case 2: {
|
|
609
|
-
matchResult = 2;
|
|
610
|
-
break;
|
|
611
|
-
}
|
|
612
|
-
case 3: {
|
|
613
|
-
matchResult = 3;
|
|
614
|
-
break;
|
|
615
|
-
}
|
|
616
|
-
case 4: {
|
|
617
|
-
matchResult = 4;
|
|
618
|
-
break;
|
|
619
|
-
}
|
|
620
|
-
case 5: {
|
|
621
|
-
matchResult = 5;
|
|
622
|
-
break;
|
|
623
|
-
}
|
|
624
|
-
case 6: {
|
|
625
|
-
matchResult = 6;
|
|
626
|
-
break;
|
|
627
|
-
}
|
|
628
|
-
case 7: {
|
|
629
|
-
matchResult = 7;
|
|
630
|
-
break;
|
|
631
|
-
}
|
|
632
|
-
case 8: {
|
|
633
|
-
matchResult = 8;
|
|
634
|
-
break;
|
|
635
|
-
}
|
|
636
|
-
case 9: {
|
|
637
|
-
matchResult = 9;
|
|
638
|
-
break;
|
|
639
|
-
}
|
|
640
|
-
case 10: {
|
|
641
|
-
matchResult = 10;
|
|
642
|
-
break;
|
|
643
|
-
}
|
|
644
|
-
case 11: {
|
|
645
|
-
matchResult = 11;
|
|
646
|
-
break;
|
|
647
|
-
}
|
|
648
|
-
case 12: {
|
|
649
|
-
matchResult = 12;
|
|
650
|
-
break;
|
|
651
|
-
}
|
|
652
|
-
case 13: {
|
|
653
|
-
matchResult = 13;
|
|
654
|
-
break;
|
|
655
|
-
}
|
|
656
|
-
case 14: {
|
|
657
|
-
matchResult = 14;
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
default:
|
|
661
|
-
matchResult = 0;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
switch (matchResult) {
|
|
665
|
-
case 0:
|
|
666
|
-
return "Component columns are used to describe physical components of a experiment, e.g. instrument names, software names, and reagents names.";
|
|
667
|
-
case 1:
|
|
668
|
-
return "Characteristic columns are used for study descriptions and describe inherent properties of the source material, e.g. a certain strain or organism part.";
|
|
669
|
-
case 2:
|
|
670
|
-
return "Use Factor columns to describe independent variables that result in a specific output of your experiment, e.g. the light intensity under which an organism was grown.";
|
|
671
|
-
case 3:
|
|
672
|
-
return "Parameter columns describe steps in your experimental workflow, e.g. the centrifugation time or the temperature used for your assay.";
|
|
474
|
+
switch (this$.tag) {
|
|
673
475
|
case 4:
|
|
674
|
-
|
|
476
|
+
case 8:
|
|
675
477
|
case 5:
|
|
676
|
-
return "Describe the protocol in free text.";
|
|
677
478
|
case 6:
|
|
678
|
-
return "Web or local address where the in-depth protocol is stored.";
|
|
679
479
|
case 7:
|
|
680
|
-
return "Defines the protocol version.";
|
|
681
|
-
case 8:
|
|
682
|
-
return "Defines the protocol name.";
|
|
683
480
|
case 9:
|
|
684
|
-
return "Defines the protocol performer.";
|
|
685
481
|
case 10:
|
|
686
|
-
return "Defines the date the protocol was performed.";
|
|
687
482
|
case 11:
|
|
688
|
-
return "Only one input column per table. E.g. experimental samples or files.";
|
|
689
483
|
case 12:
|
|
690
|
-
return
|
|
691
|
-
case 13:
|
|
692
|
-
return "Placeholder";
|
|
693
|
-
case 14:
|
|
694
|
-
return "Comment";
|
|
484
|
+
return true;
|
|
695
485
|
default:
|
|
696
|
-
|
|
486
|
+
return false;
|
|
697
487
|
}
|
|
698
488
|
}
|
|
699
489
|
static component(oa) {
|
package/FileSystem/Path.js
CHANGED
|
@@ -4,7 +4,15 @@ import { last, mapIndexed } from "../fable_modules/fable-library-js.4.16.0/Array
|
|
|
4
4
|
export const seperators = ["/", "\\"];
|
|
5
5
|
|
|
6
6
|
export function split(path) {
|
|
7
|
-
|
|
7
|
+
const array = split_1(path, seperators, void 0, 3);
|
|
8
|
+
return array.filter((p) => {
|
|
9
|
+
if (p !== "") {
|
|
10
|
+
return p !== ".";
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
8
16
|
}
|
|
9
17
|
|
|
10
18
|
export function combine(path1, path2) {
|
|
@@ -21,5 +21,5 @@ export function IContext_$reflection() {
|
|
|
21
21
|
|
|
22
22
|
export const context_jsonvalue = new Json(5, [[["sdo", new Json(0, ["http://schema.org/"])], ["Data", new Json(0, ["sdo:MediaObject"])], ["type", new Json(0, ["sdo:disambiguatingDescription"])], ["encodingFormat", new Json(0, ["sdo:encodingFormat"])], ["usageInfo", new Json(0, ["sdo:usageInfo"])], ["name", new Json(0, ["sdo:name"])], ["comments", new Json(0, ["sdo:comment"])]]]);
|
|
23
23
|
|
|
24
|
-
export const context_str = "\n{\n \"@context\": {\n \"sdo\": \"http://schema.org/\",\n \"arc\": \"http://purl.org/nfdi4plants/ontology/\",\n\n \"Data\": \"sdo:MediaObject\",\n \"ArcData\": \"arc:ARC#ARC_00000076\",\n\n \"type\": \"arc:ARC#ARC_00000107\",\n\n \"name\": \"sdo:name\",\n \"comments\": \"sdo:disambiguatingDescription\"\n }\n}\n ";
|
|
24
|
+
export const context_str = "\r\n{\r\n \"@context\": {\r\n \"sdo\": \"http://schema.org/\",\r\n \"arc\": \"http://purl.org/nfdi4plants/ontology/\",\r\n\r\n \"Data\": \"sdo:MediaObject\",\r\n \"ArcData\": \"arc:ARC#ARC_00000076\",\r\n\r\n \"type\": \"arc:ARC#ARC_00000107\",\r\n\r\n \"name\": \"sdo:name\",\r\n \"comments\": \"sdo:disambiguatingDescription\"\r\n }\r\n}\r\n ";
|
|
25
25
|
|
|
@@ -29,5 +29,5 @@ export function IContext_$reflection() {
|
|
|
29
29
|
|
|
30
30
|
export const context_jsonvalue = new Json(5, [[["sdo", new Json(0, ["http://schema.org/"])], ["Investigation", new Json(0, ["sdo:Dataset"])], ["identifier", new Json(0, ["sdo:identifier"])], ["title", new Json(0, ["sdo:headline"])], ["additionalType", new Json(0, ["sdo:additionalType"])], ["description", new Json(0, ["sdo:description"])], ["submissionDate", new Json(0, ["sdo:dateCreated"])], ["publicReleaseDate", new Json(0, ["sdo:datePublished"])], ["publications", new Json(0, ["sdo:citation"])], ["people", new Json(0, ["sdo:creator"])], ["studies", new Json(0, ["sdo:hasPart"])], ["ontologySourceReferences", new Json(0, ["sdo:mentions"])], ["comments", new Json(0, ["sdo:comment"])], ["filename", new Json(0, ["sdo:alternateName"])]]]);
|
|
31
31
|
|
|
32
|
-
export const context_str = "\n{\n \"@context\": {\n \"sdo\": \"http://schema.org/\",\n \"arc\": \"http://purl.org/nfdi4plants/ontology/\",\n\n \"Investigation\": \"sdo:Dataset\",\n\n \"identifier\" : \"sdo:identifier\",\n \"title\": \"sdo:headline\",\n \"description\": \"sdo:description\",\n \"submissionDate\": \"sdo:dateCreated\",\n \"publicReleaseDate\": \"sdo:datePublished\",\n \"publications\": \"sdo:citation\",\n \"people\": \"sdo:creator\",\n \"studies\": \"sdo:hasPart\",\n \"ontologySourceReferences\": \"sdo:mentions\",\n \"comments\": \"sdo:disambiguatingDescription\",\n\n \"publications?\": \"sdo:SubjectOf?\",\n \"filename\": \"sdo:alternateName\"\n }\n}\n ";
|
|
32
|
+
export const context_str = "\r\n{\r\n \"@context\": {\r\n \"sdo\": \"http://schema.org/\",\r\n \"arc\": \"http://purl.org/nfdi4plants/ontology/\",\r\n\r\n \"Investigation\": \"sdo:Dataset\",\r\n\r\n \"identifier\" : \"sdo:identifier\",\r\n \"title\": \"sdo:headline\",\r\n \"description\": \"sdo:description\",\r\n \"submissionDate\": \"sdo:dateCreated\",\r\n \"publicReleaseDate\": \"sdo:datePublished\",\r\n \"publications\": \"sdo:citation\",\r\n \"people\": \"sdo:creator\",\r\n \"studies\": \"sdo:hasPart\",\r\n \"ontologySourceReferences\": \"sdo:mentions\",\r\n \"comments\": \"sdo:disambiguatingDescription\",\r\n\r\n \"publications?\": \"sdo:SubjectOf?\",\r\n \"filename\": \"sdo:alternateName\"\r\n }\r\n}\r\n ";
|
|
33
33
|
|
|
@@ -118,7 +118,7 @@ export function tryFromFsWorksheet(sheet) {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
export function toFsWorksheet(table) {
|
|
121
|
+
export function toFsWorksheet(index, table) {
|
|
122
122
|
const stringCount = new Map([]);
|
|
123
123
|
const ws = new FsWorksheet(table.Name);
|
|
124
124
|
if (table.Columns.length === 0) {
|
|
@@ -130,7 +130,8 @@ export function toFsWorksheet(table) {
|
|
|
130
130
|
}));
|
|
131
131
|
const maxRow = length(head(columns)) | 0;
|
|
132
132
|
const maxCol = length(columns) | 0;
|
|
133
|
-
const
|
|
133
|
+
const name = (index == null) ? "annotationTable" : (`${"annotationTable"}${index}`);
|
|
134
|
+
const fsTable = ws.Table(name, FsRangeAddress_$ctor_7E77A4A0(FsAddress_$ctor_Z37302880(1, 1), FsAddress_$ctor_Z37302880(maxRow, maxCol)));
|
|
134
135
|
iterateIndexed((colI, col) => {
|
|
135
136
|
iterateIndexed((rowI, stringCell) => {
|
|
136
137
|
let value;
|
package/Spreadsheet/ArcAssay.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FsWorksheet } from "../fable_modules/FsSpreadsheet.6.2.0/FsWorksheet.fs.js";
|
|
2
|
-
import { iterate, isEmpty as isEmpty_1, tryPick, choose, tryHead, head, exists, map, singleton, append, delay, iterateIndexed } from "../fable_modules/fable-library-js.4.16.0/Seq.js";
|
|
2
|
+
import { iterate, isEmpty as isEmpty_1, tryPick, choose, tryFind, tryHead, head, exists, map, singleton, append, delay, iterateIndexed } from "../fable_modules/fable-library-js.4.16.0/Seq.js";
|
|
3
3
|
import { SparseRowModule_tryGetValueAt, SparseRowModule_fromFsRow, SparseRowModule_fromValues, SparseRowModule_writeToSheet } from "./Metadata/SparseTable.js";
|
|
4
4
|
import { fromRows as fromRows_1, toRows as toRows_1 } from "./Metadata/Assays.js";
|
|
5
5
|
import { empty, isEmpty, ofSeq, singleton as singleton_1 } from "../fable_modules/fable-library-js.4.16.0/List.js";
|
|
@@ -8,7 +8,7 @@ import { toConsole, printf, toFail } from "../fable_modules/fable-library-js.4.1
|
|
|
8
8
|
import { getEnumerator } from "../fable_modules/fable-library-js.4.16.0/Util.js";
|
|
9
9
|
import { ArcAssay } from "../Core/ArcTypes.js";
|
|
10
10
|
import { createMissingIdentifier } from "../Core/Helper/Identifier.js";
|
|
11
|
-
import { toArray, defaultArg } from "../fable_modules/fable-library-js.4.16.0/Option.js";
|
|
11
|
+
import { unwrap, toArray, defaultArg } from "../fable_modules/fable-library-js.4.16.0/Option.js";
|
|
12
12
|
import { toFsWorksheet as toFsWorksheet_1, tryFromFsWorksheet } from "./AnnotationTable/ArcTable.js";
|
|
13
13
|
import { toFsWorksheet, tryFromFsWorksheet as tryFromFsWorksheet_1 } from "./DataMapTable/DataMapTable.js";
|
|
14
14
|
import { FsWorkbook } from "../fable_modules/FsSpreadsheet.6.2.0/FsWorkbook.fs.js";
|
|
@@ -115,34 +115,45 @@ export function ArcAssay_fromMetadataSheet(sheet) {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
export function ArcAssay_isMetadataSheetName(name) {
|
|
119
|
+
if (name === "isa_assay") {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
return name === "Assay";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function ArcAssay_isMetadataSheet(sheet) {
|
|
128
|
+
return ArcAssay_isMetadataSheetName(sheet.Name);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function ArcAssay_tryGetMetadataSheet(doc) {
|
|
132
|
+
return tryFind(ArcAssay_isMetadataSheet, doc.GetWorksheets());
|
|
133
|
+
}
|
|
134
|
+
|
|
118
135
|
/**
|
|
119
136
|
* Reads an assay from a spreadsheet
|
|
120
137
|
*/
|
|
121
138
|
export function ARCtrl_ArcAssay__ArcAssay_fromFsWorkbook_Static_32154C9D(doc) {
|
|
122
139
|
try {
|
|
123
|
-
let
|
|
124
|
-
const matchValue = doc
|
|
140
|
+
let assayMetadata;
|
|
141
|
+
const matchValue = ArcAssay_tryGetMetadataSheet(doc);
|
|
125
142
|
if (matchValue == null) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
toConsole(printf("Cannot retrieve metadata: Assay file does not contain \"%s\" or \"%s\" sheet."))("isa_assay")("Assay");
|
|
129
|
-
assayMetaData = ArcAssay.create(createMissingIdentifier());
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
assayMetaData = ArcAssay_fromMetadataSheet(matchValue_1);
|
|
133
|
-
}
|
|
143
|
+
toConsole(printf("Cannot retrieve metadata: Assay file does not contain \"%s\" or \"%s\" sheet."))("isa_assay")("Assay");
|
|
144
|
+
assayMetadata = ArcAssay.create(createMissingIdentifier());
|
|
134
145
|
}
|
|
135
146
|
else {
|
|
136
|
-
|
|
147
|
+
assayMetadata = ArcAssay_fromMetadataSheet(matchValue);
|
|
137
148
|
}
|
|
138
149
|
const sheets = doc.GetWorksheets();
|
|
139
150
|
const annotationTables = choose(tryFromFsWorksheet, sheets);
|
|
140
151
|
const datamapSheet = tryPick(tryFromFsWorksheet_1, sheets);
|
|
141
152
|
if (!isEmpty_1(annotationTables)) {
|
|
142
|
-
|
|
153
|
+
assayMetadata.Tables = Array.from(annotationTables);
|
|
143
154
|
}
|
|
144
|
-
|
|
145
|
-
return
|
|
155
|
+
assayMetadata.DataMap = datamapSheet;
|
|
156
|
+
return assayMetadata;
|
|
146
157
|
}
|
|
147
158
|
catch (err) {
|
|
148
159
|
const arg_2 = err.message;
|
|
@@ -158,18 +169,27 @@ export function ARCtrl_ArcAssay__ArcAssay_fromFsWorkbook_Static_32154C9D(doc) {
|
|
|
158
169
|
export function ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(assay, datamapSheet) {
|
|
159
170
|
const datamapSheet_1 = defaultArg(datamapSheet, true);
|
|
160
171
|
const doc = new FsWorkbook();
|
|
161
|
-
const
|
|
162
|
-
doc.AddWorksheet(
|
|
172
|
+
const metadataSheet = ArcAssay_toMetadataSheet(assay);
|
|
173
|
+
doc.AddWorksheet(metadataSheet);
|
|
163
174
|
if (datamapSheet_1) {
|
|
164
175
|
iterate((arg) => {
|
|
165
176
|
const sheet = toFsWorksheet(arg);
|
|
166
177
|
doc.AddWorksheet(sheet);
|
|
167
178
|
}, toArray(assay.DataMap));
|
|
168
179
|
}
|
|
169
|
-
|
|
170
|
-
const sheet_1 = toFsWorksheet_1(arg_1);
|
|
180
|
+
iterateIndexed((i, arg_1) => {
|
|
181
|
+
const sheet_1 = toFsWorksheet_1(i, arg_1);
|
|
171
182
|
doc.AddWorksheet(sheet_1);
|
|
172
183
|
}, assay.Tables);
|
|
173
184
|
return doc;
|
|
174
185
|
}
|
|
175
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Write an assay to a spreadsheet
|
|
189
|
+
*
|
|
190
|
+
* If datamapSheet is true, the datamap will be written to a worksheet inside assay workbook.
|
|
191
|
+
*/
|
|
192
|
+
export function ARCtrl_ArcAssay__ArcAssay_ToFsWorkbook_6FCE9E49(this$, datamapSheet) {
|
|
193
|
+
return ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(this$, unwrap(datamapSheet));
|
|
194
|
+
}
|
|
195
|
+
|