@nfdi4plants/arctrl 2.1.0-alpha.2 → 2.1.0-alpha.3
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 +85 -20
- package/Contract/ArcAssay.js +10 -33
- package/Contract/ArcStudy.js +10 -33
- package/Spreadsheet/ArcAssay.js +110 -87
- package/Spreadsheet/ArcInvestigation.js +12 -7
- package/Spreadsheet/ArcStudy.js +25 -5
- package/Spreadsheet/Template.js +9 -1
- package/package.json +1 -1
package/ARC.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { append as append_1, contains as contains_1, concat, fold, map, exactlyOne, tryPick, choose } from "./fable_modules/fable-library-js.4.22.0/Array.js";
|
|
2
|
-
import {
|
|
3
|
-
import { ARCtrl_DataMap__DataMap_tryFromReadContractForStudy_Static, ARCtrl_DataMap__DataMap_tryFromReadContractForAssay_Static } from "./Contract/Datamap.js";
|
|
4
|
-
import {
|
|
2
|
+
import { ARCtrl_ArcAssay__ArcAssay_ToUpdateContract, ARCtrl_ArcAssay__ArcAssay_ToCreateContract_6FCE9E49, ARCtrl_ArcAssay__ArcAssay_ToDeleteContract, ARCtrl_ArcAssay__ArcAssay_tryFromReadContract_Static_7570923F } from "./Contract/ArcAssay.js";
|
|
3
|
+
import { ARCtrl_DataMap__DataMap_ToUpdateContractForAssay_Z721C83C5, ARCtrl_DataMap__DataMap_ToCreateContractForAssay_Z721C83C5, ARCtrl_DataMap__DataMap_ToUpdateContractForStudy_Z721C83C5, ARCtrl_DataMap__DataMap_ToCreateContractForStudy_Z721C83C5, ARCtrl_DataMap__DataMap_tryFromReadContractForStudy_Static, ARCtrl_DataMap__DataMap_tryFromReadContractForAssay_Static } from "./Contract/Datamap.js";
|
|
4
|
+
import { ARCtrl_ArcStudy__ArcStudy_ToCreateContract_6FCE9E49, ARCtrl_ArcStudy__ArcStudy_ToUpdateContract, ARCtrl_ArcStudy__ArcStudy_tryFromReadContract_Static_7570923F } from "./Contract/ArcStudy.js";
|
|
5
5
|
import { ARCtrl_ArcInvestigation__ArcInvestigation_ToUpdateContract, ARCtrl_ArcInvestigation__ArcInvestigation_tryFromReadContract_Static_7570923F } from "./Contract/ArcInvestigation.js";
|
|
6
|
-
import { empty, iterate, find, tryFind,
|
|
6
|
+
import { collect, empty, iterate, find, tryFind, map as map_1, singleton, append, delay, toList, contains, toArray } from "./fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
7
7
|
import { FileSystemTree } from "./FileSystem/FileSystemTree.js";
|
|
8
8
|
import { FileSystem } from "./FileSystem/FileSystem.js";
|
|
9
|
-
import { bind, map as
|
|
9
|
+
import { bind, map as map_2, defaultArg, value as value_2, unwrap } from "./fable_modules/fable-library-js.4.22.0/Option.js";
|
|
10
10
|
import { comparePrimitives, safeHash, stringHash } from "./fable_modules/fable-library-js.4.22.0/Util.js";
|
|
11
11
|
import { getStudyFolderPath, getAssayFolderPath } from "./FileSystem/Path.js";
|
|
12
12
|
import { printf, toText, replace } from "./fable_modules/fable-library-js.4.22.0/String.js";
|
|
@@ -19,7 +19,7 @@ import { ARCtrl_ArcInvestigation__ArcInvestigation_toFsWorkbook_Static_Z720BD3FF
|
|
|
19
19
|
import { ArcInvestigation } from "./Core/ArcTypes.js";
|
|
20
20
|
import { Assay_datamapFileNameFromIdentifier, Assay_fileNameFromIdentifier, Study_datamapFileNameFromIdentifier, Study_fileNameFromIdentifier } from "./Core/Helper/Identifier.js";
|
|
21
21
|
import { ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522 } from "./Spreadsheet/ArcStudy.js";
|
|
22
|
-
import { DataMap__set_StaticHash_Z524259A4 } from "./Core/DataMap.js";
|
|
22
|
+
import { DataMap__get_StaticHash, DataMap__set_StaticHash_Z524259A4 } from "./Core/DataMap.js";
|
|
23
23
|
import { toFsWorkbook } from "./Spreadsheet/DataMap.js";
|
|
24
24
|
import { ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F } from "./Spreadsheet/ArcAssay.js";
|
|
25
25
|
import { Dictionary_tryGet } from "./fable_modules/FsSpreadsheet.6.3.0-alpha.4/Cells/FsCellsCollection.fs.js";
|
|
@@ -143,7 +143,7 @@ export class ARC {
|
|
|
143
143
|
const assayFolderPath = getAssayFolderPath(assayIdentifier);
|
|
144
144
|
const filteredPaths = paths.filter((p) => !p.startsWith(assayFolderPath));
|
|
145
145
|
this$.SetFilePaths(filteredPaths);
|
|
146
|
-
const collection = toList(delay(() => append(singleton(ARCtrl_ArcAssay__ArcAssay_ToDeleteContract(assay)), delay(() => append(singleton(ARCtrl_ArcInvestigation__ArcInvestigation_ToUpdateContract(isa)), delay(() =>
|
|
146
|
+
const collection = toList(delay(() => append(singleton(ARCtrl_ArcAssay__ArcAssay_ToDeleteContract(assay)), delay(() => append(singleton(ARCtrl_ArcInvestigation__ArcInvestigation_ToUpdateContract(isa)), delay(() => map_1(ARCtrl_ArcStudy__ArcStudy_ToUpdateContract, studies)))))));
|
|
147
147
|
return Array.from(collection);
|
|
148
148
|
}
|
|
149
149
|
RenameAssay(oldAssayIdentifier, newAssayIdentifier) {
|
|
@@ -297,9 +297,8 @@ export class ARC {
|
|
|
297
297
|
newFS = ARCAux_updateFSByCWL(this$._cwl, fs);
|
|
298
298
|
this$._fs = newFS;
|
|
299
299
|
}
|
|
300
|
-
GetWriteContracts(
|
|
300
|
+
GetWriteContracts() {
|
|
301
301
|
const this$ = this;
|
|
302
|
-
const datamapAsFile_1 = defaultArg(datamapAsFile, false);
|
|
303
302
|
const workbooks = new Map([]);
|
|
304
303
|
const matchValue = this$.ISA;
|
|
305
304
|
if (matchValue == null) {
|
|
@@ -311,8 +310,8 @@ export class ARC {
|
|
|
311
310
|
inv.StaticHash = (inv.GetLightHashCode() | 0);
|
|
312
311
|
iterate((s) => {
|
|
313
312
|
s.StaticHash = (s.GetLightHashCode() | 0);
|
|
314
|
-
addToDict(workbooks, Study_fileNameFromIdentifier(s.Identifier), ["ISA_Study", ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(s
|
|
315
|
-
if (
|
|
313
|
+
addToDict(workbooks, Study_fileNameFromIdentifier(s.Identifier), ["ISA_Study", ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(s)]);
|
|
314
|
+
if (s.DataMap != null) {
|
|
316
315
|
const dm = value_2(s.DataMap);
|
|
317
316
|
DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm));
|
|
318
317
|
addToDict(workbooks, Study_datamapFileNameFromIdentifier(s.Identifier), ["ISA_Datamap", toFsWorkbook(dm)]);
|
|
@@ -320,8 +319,8 @@ export class ARC {
|
|
|
320
319
|
}, inv.Studies);
|
|
321
320
|
iterate((a) => {
|
|
322
321
|
a.StaticHash = (a.GetLightHashCode() | 0);
|
|
323
|
-
addToDict(workbooks, Assay_fileNameFromIdentifier(a.Identifier), ["ISA_Assay", ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(a
|
|
324
|
-
if (
|
|
322
|
+
addToDict(workbooks, Assay_fileNameFromIdentifier(a.Identifier), ["ISA_Assay", ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(a)]);
|
|
323
|
+
if (a.DataMap != null) {
|
|
325
324
|
const dm_1 = value_2(a.DataMap);
|
|
326
325
|
DataMap__set_StaticHash_Z524259A4(dm_1, safeHash(dm_1));
|
|
327
326
|
addToDict(workbooks, Assay_datamapFileNameFromIdentifier(a.Identifier), ["ISA_Datamap", toFsWorkbook(dm_1)]);
|
|
@@ -340,7 +339,7 @@ export class ARC {
|
|
|
340
339
|
}
|
|
341
340
|
}, this$._fs.Tree.ToFilePaths(true));
|
|
342
341
|
}
|
|
343
|
-
GetUpdateContracts(
|
|
342
|
+
GetUpdateContracts() {
|
|
344
343
|
let inv, inv_1, inv_2;
|
|
345
344
|
const this$ = this;
|
|
346
345
|
const matchValue = this$.ISA;
|
|
@@ -350,15 +349,81 @@ export class ARC {
|
|
|
350
349
|
inv_2.StaticHash = (hash | 0);
|
|
351
350
|
return append(collect((s) => {
|
|
352
351
|
const hash_1 = s.GetLightHashCode() | 0;
|
|
353
|
-
return append((s.StaticHash === 0) ?
|
|
352
|
+
return append((s.StaticHash === 0) ? ARCtrl_ArcStudy__ArcStudy_ToCreateContract_6FCE9E49(s, true) : ((s.StaticHash !== hash_1) ? singleton(ARCtrl_ArcStudy__ArcStudy_ToUpdateContract(s)) : empty()), delay(() => {
|
|
353
|
+
let dm_1;
|
|
354
354
|
s.StaticHash = (hash_1 | 0);
|
|
355
|
-
|
|
355
|
+
const matchValue_1 = s.DataMap;
|
|
356
|
+
let matchResult, dm_2, dm_3;
|
|
357
|
+
if (matchValue_1 != null) {
|
|
358
|
+
if (DataMap__get_StaticHash(matchValue_1) === 0) {
|
|
359
|
+
matchResult = 0;
|
|
360
|
+
dm_2 = matchValue_1;
|
|
361
|
+
}
|
|
362
|
+
else if ((dm_1 = matchValue_1, DataMap__get_StaticHash(dm_1) !== safeHash(dm_1))) {
|
|
363
|
+
matchResult = 1;
|
|
364
|
+
dm_3 = matchValue_1;
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
matchResult = 2;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
matchResult = 2;
|
|
372
|
+
}
|
|
373
|
+
switch (matchResult) {
|
|
374
|
+
case 0:
|
|
375
|
+
return append(singleton(ARCtrl_DataMap__DataMap_ToCreateContractForStudy_Z721C83C5(dm_2, s.Identifier)), delay(() => {
|
|
376
|
+
DataMap__set_StaticHash_Z524259A4(dm_2, safeHash(dm_2));
|
|
377
|
+
return empty();
|
|
378
|
+
}));
|
|
379
|
+
case 1:
|
|
380
|
+
return append(singleton(ARCtrl_DataMap__DataMap_ToUpdateContractForStudy_Z721C83C5(dm_3, s.Identifier)), delay(() => {
|
|
381
|
+
DataMap__set_StaticHash_Z524259A4(dm_3, safeHash(dm_3));
|
|
382
|
+
return empty();
|
|
383
|
+
}));
|
|
384
|
+
default: {
|
|
385
|
+
return empty();
|
|
386
|
+
}
|
|
387
|
+
}
|
|
356
388
|
}));
|
|
357
389
|
}, inv_2.Studies), delay(() => collect((a) => {
|
|
358
390
|
const hash_2 = a.GetLightHashCode() | 0;
|
|
359
|
-
return append((a.StaticHash === 0) ?
|
|
391
|
+
return append((a.StaticHash === 0) ? ARCtrl_ArcAssay__ArcAssay_ToCreateContract_6FCE9E49(a, true) : ((a.StaticHash !== hash_2) ? singleton(ARCtrl_ArcAssay__ArcAssay_ToUpdateContract(a)) : empty()), delay(() => {
|
|
392
|
+
let dm_5;
|
|
360
393
|
a.StaticHash = (hash_2 | 0);
|
|
361
|
-
|
|
394
|
+
const matchValue_2 = a.DataMap;
|
|
395
|
+
let matchResult_1, dm_6, dm_7;
|
|
396
|
+
if (matchValue_2 != null) {
|
|
397
|
+
if (DataMap__get_StaticHash(matchValue_2) === 0) {
|
|
398
|
+
matchResult_1 = 0;
|
|
399
|
+
dm_6 = matchValue_2;
|
|
400
|
+
}
|
|
401
|
+
else if ((dm_5 = matchValue_2, DataMap__get_StaticHash(dm_5) !== safeHash(dm_5))) {
|
|
402
|
+
matchResult_1 = 1;
|
|
403
|
+
dm_7 = matchValue_2;
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
matchResult_1 = 2;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
matchResult_1 = 2;
|
|
411
|
+
}
|
|
412
|
+
switch (matchResult_1) {
|
|
413
|
+
case 0:
|
|
414
|
+
return append(singleton(ARCtrl_DataMap__DataMap_ToCreateContractForAssay_Z721C83C5(dm_6, a.Identifier)), delay(() => {
|
|
415
|
+
DataMap__set_StaticHash_Z524259A4(dm_6, safeHash(dm_6));
|
|
416
|
+
return empty();
|
|
417
|
+
}));
|
|
418
|
+
case 1:
|
|
419
|
+
return append(singleton(ARCtrl_DataMap__DataMap_ToUpdateContractForAssay_Z721C83C5(dm_7, a.Identifier)), delay(() => {
|
|
420
|
+
DataMap__set_StaticHash_Z524259A4(dm_7, safeHash(dm_7));
|
|
421
|
+
return empty();
|
|
422
|
+
}));
|
|
423
|
+
default: {
|
|
424
|
+
return empty();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
362
427
|
}));
|
|
363
428
|
}, inv_2.Assays)));
|
|
364
429
|
}));
|
|
@@ -373,14 +438,14 @@ export class ARC {
|
|
|
373
438
|
}
|
|
374
439
|
Copy() {
|
|
375
440
|
const this$ = this;
|
|
376
|
-
const isaCopy =
|
|
441
|
+
const isaCopy = map_2((i) => i.Copy(), this$._isa);
|
|
377
442
|
const fsCopy = this$._fs.Copy();
|
|
378
443
|
return new ARC(unwrap(isaCopy), this$._cwl, fsCopy);
|
|
379
444
|
}
|
|
380
445
|
GetRegisteredPayload(IgnoreHidden) {
|
|
381
446
|
let tree, paths, array_3;
|
|
382
447
|
const this$ = this;
|
|
383
|
-
const registeredStudies = defaultArg(
|
|
448
|
+
const registeredStudies = defaultArg(map_2((isa) => isa.Studies.slice(), map_2((i) => i.Copy(), this$._isa)), []);
|
|
384
449
|
const registeredAssays = concat(map((s) => s.RegisteredAssays.slice(), registeredStudies));
|
|
385
450
|
const includeFiles = unionMany([ofSeq(["isa.investigation.xlsx", "README.md"], {
|
|
386
451
|
Compare: comparePrimitives,
|
package/Contract/ArcAssay.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { equalsWith, item } from "../fable_modules/fable-library-js.4.22.0/Array.js";
|
|
2
2
|
import { getAssayFolderPath, combineMany } from "../FileSystem/Path.js";
|
|
3
|
-
import {
|
|
4
|
-
import { unwrap,
|
|
3
|
+
import { defaultOf } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
4
|
+
import { unwrap, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
5
5
|
import { Assay_fileNameFromIdentifier } from "../Core/Helper/Identifier.js";
|
|
6
|
-
import { ARCtrl_ArcAssay__ArcAssay_fromFsWorkbook_Static_32154C9D, ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F } from "../Spreadsheet/ArcAssay.js";
|
|
7
6
|
import { Contract } from "./Contract.js";
|
|
7
|
+
import { ARCtrl_ArcAssay__ArcAssay_fromFsWorkbook_Static_32154C9D, ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F } from "../Spreadsheet/ArcAssay.js";
|
|
8
8
|
import { empty, singleton, collect, append, delay, toArray } from "../fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
9
9
|
import { FileSystemTree } from "../FileSystem/FileSystemTree.js";
|
|
10
|
-
import { DataMap__get_StaticHash, DataMap__set_StaticHash_Z524259A4 } from "../Core/DataMap.js";
|
|
11
|
-
import { ARCtrl_DataMap__DataMap_ToUpdateContractForAssay_Z721C83C5, ARCtrl_DataMap__DataMap_ToCreateContractForAssay_Z721C83C5 } from "./Datamap.js";
|
|
12
10
|
|
|
13
11
|
export function $007CAssayPath$007C_$007C(input) {
|
|
14
12
|
let matchResult;
|
|
@@ -38,40 +36,19 @@ export function $007CAssayPath$007C_$007C(input) {
|
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
export function
|
|
39
|
+
export function ARCtrl_ArcAssay__ArcAssay_ToCreateContract_6FCE9E49(this$, WithFolder) {
|
|
42
40
|
const withFolder = defaultArg(WithFolder, false);
|
|
43
|
-
const dataMapAsFile = defaultArg(datamapAsFile, false);
|
|
44
41
|
const path = Assay_fileNameFromIdentifier(this$.Identifier);
|
|
45
|
-
const
|
|
46
|
-
const c = Contract.createCreate(path, "ISA_Assay", dto);
|
|
42
|
+
const c = Contract.createCreate(path, "ISA_Assay", ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(this$));
|
|
47
43
|
return toArray(delay(() => {
|
|
48
44
|
let folderFS;
|
|
49
|
-
return append(withFolder ? ((folderFS = FileSystemTree.createAssaysFolder([FileSystemTree.createAssayFolder(this$.Identifier)]), collect((p) => (((p !== path) && (p !== "assays/.gitkeep")) ? singleton(Contract.createCreate(p, "PlainText")) : empty()), folderFS.ToFilePaths(false)))) : empty(), delay(() =>
|
|
50
|
-
let matchValue, dm;
|
|
51
|
-
return append((matchValue = this$.DataMap, (matchValue != null) ? ((dm = matchValue, (DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm)), dataMapAsFile ? singleton(ARCtrl_DataMap__DataMap_ToCreateContractForAssay_Z721C83C5(dm, this$.Identifier)) : empty()))) : (empty())), delay(() => singleton(c)));
|
|
52
|
-
}));
|
|
45
|
+
return append(withFolder ? ((folderFS = FileSystemTree.createAssaysFolder([FileSystemTree.createAssayFolder(this$.Identifier)]), collect((p) => (((p !== path) && (p !== "assays/.gitkeep")) ? singleton(Contract.createCreate(p, "PlainText")) : empty()), folderFS.ToFilePaths(false)))) : empty(), delay(() => singleton(c)));
|
|
53
46
|
}));
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
export function
|
|
57
|
-
const datamapAsFile_1 = defaultArg(datamapAsFile, false);
|
|
49
|
+
export function ARCtrl_ArcAssay__ArcAssay_ToUpdateContract(this$) {
|
|
58
50
|
const path = Assay_fileNameFromIdentifier(this$.Identifier);
|
|
59
|
-
|
|
60
|
-
let datamapHasChanged;
|
|
61
|
-
const matchValue = this$.DataMap;
|
|
62
|
-
if (matchValue != null) {
|
|
63
|
-
const dm = matchValue;
|
|
64
|
-
const hc = safeHash(dm) !== DataMap__get_StaticHash(dm);
|
|
65
|
-
DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm));
|
|
66
|
-
datamapHasChanged = hc;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
datamapHasChanged = false;
|
|
70
|
-
}
|
|
71
|
-
return toArray(delay(() => {
|
|
72
|
-
let dto;
|
|
73
|
-
return append(((hash !== this$.StaticHash) ? true : (datamapHasChanged && !datamapAsFile_1)) ? singleton((dto = ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(this$, !datamapAsFile_1), Contract.createUpdate(path, "ISA_Assay", dto))) : empty(), delay(() => ((datamapHasChanged && datamapAsFile_1) ? singleton(ARCtrl_DataMap__DataMap_ToUpdateContractForAssay_Z721C83C5(value(this$.DataMap), this$.Identifier)) : empty())));
|
|
74
|
-
}));
|
|
51
|
+
return Contract.createUpdate(path, "ISA_Assay", ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(this$));
|
|
75
52
|
}
|
|
76
53
|
|
|
77
54
|
export function ARCtrl_ArcAssay__ArcAssay_ToDeleteContract(this$) {
|
|
@@ -84,11 +61,11 @@ export function ARCtrl_ArcAssay__ArcAssay_toDeleteContract_Static_1501C0F8(assay
|
|
|
84
61
|
}
|
|
85
62
|
|
|
86
63
|
export function ARCtrl_ArcAssay__ArcAssay_toCreateContract_Static_Z2508BE4F(assay, WithFolder) {
|
|
87
|
-
return
|
|
64
|
+
return ARCtrl_ArcAssay__ArcAssay_ToCreateContract_6FCE9E49(assay, unwrap(WithFolder));
|
|
88
65
|
}
|
|
89
66
|
|
|
90
67
|
export function ARCtrl_ArcAssay__ArcAssay_toUpdateContract_Static_1501C0F8(assay) {
|
|
91
|
-
return
|
|
68
|
+
return ARCtrl_ArcAssay__ArcAssay_ToUpdateContract(assay);
|
|
92
69
|
}
|
|
93
70
|
|
|
94
71
|
export function ARCtrl_ArcAssay__ArcAssay_tryFromReadContract_Static_7570923F(c) {
|
package/Contract/ArcStudy.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { equalsWith, item } from "../fable_modules/fable-library-js.4.22.0/Array.js";
|
|
2
2
|
import { getStudyFolderPath, combineMany } from "../FileSystem/Path.js";
|
|
3
|
-
import {
|
|
4
|
-
import { unwrap,
|
|
3
|
+
import { defaultOf } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
4
|
+
import { unwrap, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
5
5
|
import { Study_fileNameFromIdentifier } from "../Core/Helper/Identifier.js";
|
|
6
|
-
import { ARCtrl_ArcStudy__ArcStudy_fromFsWorkbook_Static_32154C9D, ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522 } from "../Spreadsheet/ArcStudy.js";
|
|
7
6
|
import { Contract } from "./Contract.js";
|
|
7
|
+
import { ARCtrl_ArcStudy__ArcStudy_fromFsWorkbook_Static_32154C9D, ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522 } from "../Spreadsheet/ArcStudy.js";
|
|
8
8
|
import { empty, singleton, collect, append, delay, toArray } from "../fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
9
9
|
import { FileSystemTree } from "../FileSystem/FileSystemTree.js";
|
|
10
|
-
import { DataMap__get_StaticHash, DataMap__set_StaticHash_Z524259A4 } from "../Core/DataMap.js";
|
|
11
|
-
import { ARCtrl_DataMap__DataMap_ToUpdateContractForStudy_Z721C83C5, ARCtrl_DataMap__DataMap_ToCreateContractForStudy_Z721C83C5 } from "./Datamap.js";
|
|
12
10
|
|
|
13
11
|
export function $007CStudyPath$007C_$007C(input) {
|
|
14
12
|
let matchResult;
|
|
@@ -38,40 +36,19 @@ export function $007CStudyPath$007C_$007C(input) {
|
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
export function
|
|
39
|
+
export function ARCtrl_ArcStudy__ArcStudy_ToCreateContract_6FCE9E49(this$, WithFolder) {
|
|
42
40
|
const withFolder = defaultArg(WithFolder, false);
|
|
43
|
-
const dataMapAsFile = defaultArg(datamapAsFile, false);
|
|
44
41
|
const path = Study_fileNameFromIdentifier(this$.Identifier);
|
|
45
|
-
const
|
|
46
|
-
const c = Contract.createCreate(path, "ISA_Study", dto);
|
|
42
|
+
const c = Contract.createCreate(path, "ISA_Study", ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(this$));
|
|
47
43
|
return toArray(delay(() => {
|
|
48
44
|
let folderFS;
|
|
49
|
-
return append(withFolder ? ((folderFS = FileSystemTree.createStudiesFolder([FileSystemTree.createStudyFolder(this$.Identifier)]), collect((p) => (((p !== path) && (p !== "studies/.gitkeep")) ? singleton(Contract.createCreate(p, "PlainText")) : empty()), folderFS.ToFilePaths(false)))) : empty(), delay(() =>
|
|
50
|
-
let matchValue, dm;
|
|
51
|
-
return append((matchValue = this$.DataMap, (matchValue != null) ? ((dm = matchValue, (DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm)), dataMapAsFile ? singleton(ARCtrl_DataMap__DataMap_ToCreateContractForStudy_Z721C83C5(dm, this$.Identifier)) : empty()))) : (empty())), delay(() => singleton(c)));
|
|
52
|
-
}));
|
|
45
|
+
return append(withFolder ? ((folderFS = FileSystemTree.createStudiesFolder([FileSystemTree.createStudyFolder(this$.Identifier)]), collect((p) => (((p !== path) && (p !== "studies/.gitkeep")) ? singleton(Contract.createCreate(p, "PlainText")) : empty()), folderFS.ToFilePaths(false)))) : empty(), delay(() => singleton(c)));
|
|
53
46
|
}));
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
export function
|
|
57
|
-
const datamapAsFile_1 = defaultArg(datamapAsFile, false);
|
|
49
|
+
export function ARCtrl_ArcStudy__ArcStudy_ToUpdateContract(this$) {
|
|
58
50
|
const path = Study_fileNameFromIdentifier(this$.Identifier);
|
|
59
|
-
|
|
60
|
-
let datamapHasChanged;
|
|
61
|
-
const matchValue = this$.DataMap;
|
|
62
|
-
if (matchValue != null) {
|
|
63
|
-
const dm = matchValue;
|
|
64
|
-
const hc = safeHash(dm) !== DataMap__get_StaticHash(dm);
|
|
65
|
-
DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm));
|
|
66
|
-
datamapHasChanged = hc;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
datamapHasChanged = false;
|
|
70
|
-
}
|
|
71
|
-
return toArray(delay(() => {
|
|
72
|
-
let dto;
|
|
73
|
-
return append(((hash !== this$.StaticHash) ? true : (datamapHasChanged && !datamapAsFile_1)) ? singleton((dto = ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(this$, undefined, !datamapAsFile_1), Contract.createUpdate(path, "ISA_Study", dto))) : empty(), delay(() => ((datamapHasChanged && datamapAsFile_1) ? singleton(ARCtrl_DataMap__DataMap_ToUpdateContractForStudy_Z721C83C5(value(this$.DataMap), this$.Identifier)) : empty())));
|
|
74
|
-
}));
|
|
51
|
+
return Contract.createUpdate(path, "ISA_Study", ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(this$));
|
|
75
52
|
}
|
|
76
53
|
|
|
77
54
|
export function ARCtrl_ArcStudy__ArcStudy_ToDeleteContract(this$) {
|
|
@@ -84,11 +61,11 @@ export function ARCtrl_ArcStudy__ArcStudy_toDeleteContract_Static_1680536E(study
|
|
|
84
61
|
}
|
|
85
62
|
|
|
86
63
|
export function ARCtrl_ArcStudy__ArcStudy_toCreateContract_Static_Z76BBA099(study, WithFolder) {
|
|
87
|
-
return
|
|
64
|
+
return ARCtrl_ArcStudy__ArcStudy_ToCreateContract_6FCE9E49(study, unwrap(WithFolder));
|
|
88
65
|
}
|
|
89
66
|
|
|
90
67
|
export function ARCtrl_ArcStudy__ArcStudy_toUpdateContract_Static_1680536E(study) {
|
|
91
|
-
return
|
|
68
|
+
return ARCtrl_ArcStudy__ArcStudy_ToUpdateContract(study);
|
|
92
69
|
}
|
|
93
70
|
|
|
94
71
|
export function ARCtrl_ArcStudy__ArcStudy_tryFromReadContract_Static_7570923F(c) {
|
package/Spreadsheet/ArcAssay.js
CHANGED
|
@@ -1,113 +1,136 @@
|
|
|
1
|
-
import {
|
|
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.22.0/Seq.js";
|
|
3
|
-
import { SparseRowModule_tryGetValueAt, SparseRowModule_fromFsRow, SparseRowModule_fromValues, SparseRowModule_writeToSheet } from "./Metadata/SparseTable.js";
|
|
4
|
-
import { fromRows as fromRows_1, toRows as toRows_1 } from "./Metadata/Assays.js";
|
|
5
|
-
import { empty, isEmpty, ofSeq, singleton as singleton_1 } from "../fable_modules/fable-library-js.4.22.0/List.js";
|
|
6
|
-
import { fromRows as fromRows_2, toRows as toRows_2 } from "./Metadata/Contacts.js";
|
|
7
|
-
import { toConsole, printf, toFail } from "../fable_modules/fable-library-js.4.22.0/String.js";
|
|
1
|
+
import { iterate, isEmpty as isEmpty_1, tryPick, choose, tryFind, map, iterateIndexed, singleton, append, delay, tryHead, head, exists } from "../fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
8
2
|
import { getEnumerator } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
3
|
+
import { toRows, fromRows } from "./Metadata/Assays.js";
|
|
4
|
+
import { toRows as toRows_1, fromRows as fromRows_1 } from "./Metadata/Contacts.js";
|
|
9
5
|
import { ArcAssay } from "../Core/ArcTypes.js";
|
|
10
6
|
import { createMissingIdentifier } from "../Core/Helper/Identifier.js";
|
|
11
7
|
import { unwrap, toArray, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
8
|
+
import { ofSeq, singleton as singleton_1, empty, isEmpty } from "../fable_modules/fable-library-js.4.22.0/List.js";
|
|
9
|
+
import { SparseRowModule_fromAllValues, SparseRowModule_getAllValues, SparseRowModule_fromFsRow, SparseRowModule_writeToSheet, SparseRowModule_fromValues, SparseRowModule_tryGetValueAt } from "./Metadata/SparseTable.js";
|
|
10
|
+
import { FsWorksheet } from "../fable_modules/FsSpreadsheet.6.3.0-alpha.4/FsWorksheet.fs.js";
|
|
11
|
+
import { toConsole, printf, toFail } from "../fable_modules/fable-library-js.4.22.0/String.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.3.0-alpha.4/FsWorkbook.fs.js";
|
|
15
15
|
|
|
16
|
-
export function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
while (true) {
|
|
37
|
-
const lastLine = lastLine_mut, assays = assays_mut, contacts = contacts_mut, lineNumber = lineNumber_mut;
|
|
38
|
-
let matchResult, k_2, k_3, k_4;
|
|
39
|
-
if (lastLine != null) {
|
|
40
|
-
if ((k = lastLine, (k === "ASSAY") ? true : (k === "ASSAY METADATA"))) {
|
|
41
|
-
matchResult = 0;
|
|
42
|
-
k_2 = lastLine;
|
|
43
|
-
}
|
|
44
|
-
else if (lastLine === "ASSAY PERFORMERS") {
|
|
45
|
-
matchResult = 1;
|
|
46
|
-
k_3 = lastLine;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
matchResult = 2;
|
|
50
|
-
k_4 = lastLine;
|
|
51
|
-
}
|
|
16
|
+
export function ArcAssay_fromRows(rows) {
|
|
17
|
+
const patternInput = exists((row) => {
|
|
18
|
+
const s = head(row)[1];
|
|
19
|
+
return s.startsWith("Assay");
|
|
20
|
+
}, rows) ? ["Assay", "Assay Person"] : [undefined, undefined];
|
|
21
|
+
const en = getEnumerator(rows);
|
|
22
|
+
const loop = (lastRow_mut, assays_mut, contacts_mut, rowNumber_mut) => {
|
|
23
|
+
let prefix;
|
|
24
|
+
loop:
|
|
25
|
+
while (true) {
|
|
26
|
+
const lastRow = lastRow_mut, assays = assays_mut, contacts = contacts_mut, rowNumber = rowNumber_mut;
|
|
27
|
+
let matchResult, prefix_2, prefix_3;
|
|
28
|
+
if (lastRow != null) {
|
|
29
|
+
if ((prefix = lastRow, (prefix === "ASSAY") ? true : (prefix === "ASSAY METADATA"))) {
|
|
30
|
+
matchResult = 0;
|
|
31
|
+
prefix_2 = lastRow;
|
|
32
|
+
}
|
|
33
|
+
else if (lastRow === "ASSAY PERFORMERS") {
|
|
34
|
+
matchResult = 1;
|
|
35
|
+
prefix_3 = lastRow;
|
|
52
36
|
}
|
|
53
37
|
else {
|
|
54
38
|
matchResult = 2;
|
|
55
|
-
k_4 = lastLine;
|
|
56
39
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
contacts_2 = contacts;
|
|
84
|
-
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
matchResult = 2;
|
|
43
|
+
}
|
|
44
|
+
switch (matchResult) {
|
|
45
|
+
case 0: {
|
|
46
|
+
const patternInput_1 = fromRows(patternInput[0], rowNumber + 1, en);
|
|
47
|
+
lastRow_mut = patternInput_1[0];
|
|
48
|
+
assays_mut = patternInput_1[3];
|
|
49
|
+
contacts_mut = contacts;
|
|
50
|
+
rowNumber_mut = patternInput_1[1];
|
|
51
|
+
continue loop;
|
|
52
|
+
}
|
|
53
|
+
case 1: {
|
|
54
|
+
const patternInput_2 = fromRows_1(patternInput[1], rowNumber + 1, en);
|
|
55
|
+
lastRow_mut = patternInput_2[0];
|
|
56
|
+
assays_mut = assays;
|
|
57
|
+
contacts_mut = patternInput_2[3];
|
|
58
|
+
rowNumber_mut = patternInput_2[1];
|
|
59
|
+
continue loop;
|
|
60
|
+
}
|
|
61
|
+
default: {
|
|
62
|
+
let matchResult_1, assays_2, contacts_2;
|
|
63
|
+
if (isEmpty(assays)) {
|
|
64
|
+
if (isEmpty(contacts)) {
|
|
65
|
+
matchResult_1 = 0;
|
|
85
66
|
}
|
|
86
67
|
else {
|
|
87
68
|
matchResult_1 = 1;
|
|
88
69
|
assays_2 = assays;
|
|
89
70
|
contacts_2 = contacts;
|
|
90
71
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
matchResult_1 = 1;
|
|
75
|
+
assays_2 = assays;
|
|
76
|
+
contacts_2 = contacts;
|
|
77
|
+
}
|
|
78
|
+
switch (matchResult_1) {
|
|
79
|
+
case 0:
|
|
80
|
+
return ArcAssay.create(createMissingIdentifier());
|
|
81
|
+
default: {
|
|
82
|
+
const performers = Array.from(contacts_2);
|
|
83
|
+
const assay = defaultArg(tryHead(assays_2), ArcAssay.create(createMissingIdentifier()));
|
|
84
|
+
return ArcAssay.setPerformers(performers, assay);
|
|
99
85
|
}
|
|
100
86
|
}
|
|
101
87
|
}
|
|
102
|
-
break;
|
|
103
88
|
}
|
|
104
|
-
|
|
105
|
-
if (en["System.Collections.IEnumerator.MoveNext"]()) {
|
|
106
|
-
return loop(SparseRowModule_tryGetValueAt(0, en["System.Collections.Generic.IEnumerator`1.get_Current"]()), empty(), empty(), 1);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
throw new Error("empty assay metadata sheet");
|
|
89
|
+
break;
|
|
110
90
|
}
|
|
91
|
+
};
|
|
92
|
+
if (en["System.Collections.IEnumerator.MoveNext"]()) {
|
|
93
|
+
return loop(SparseRowModule_tryGetValueAt(0, en["System.Collections.Generic.IEnumerator`1.get_Current"]()), empty(), empty(), 1);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
throw new Error("empty assay metadata sheet");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function ArcAssay_toRows(assay) {
|
|
101
|
+
return delay(() => append(singleton(SparseRowModule_fromValues(["ASSAY"])), delay(() => append(toRows("Assay", singleton_1(assay)), delay(() => append(singleton(SparseRowModule_fromValues(["ASSAY PERFORMERS"])), delay(() => toRows_1("Assay Person", ofSeq(assay.Performers)))))))));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function ArcAssay_toMetadataSheet(assay) {
|
|
105
|
+
const sheet = new FsWorksheet("isa_assay");
|
|
106
|
+
iterateIndexed((rowI, r) => {
|
|
107
|
+
SparseRowModule_writeToSheet(rowI + 1, r, sheet);
|
|
108
|
+
}, ArcAssay_toRows(assay));
|
|
109
|
+
return sheet;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function ArcAssay_fromMetadataSheet(sheet) {
|
|
113
|
+
try {
|
|
114
|
+
const rows = map(SparseRowModule_fromFsRow, sheet.Rows);
|
|
115
|
+
const hasPrefix = exists((row) => {
|
|
116
|
+
const s = head(row)[1];
|
|
117
|
+
return s.startsWith("Assay");
|
|
118
|
+
}, rows);
|
|
119
|
+
return ArcAssay_fromRows(rows);
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
const arg = err.message;
|
|
123
|
+
return toFail(printf("Failed while parsing metadatasheet: %s"))(arg);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function ArcAssay_toMetadataCollection(assay) {
|
|
128
|
+
return map(SparseRowModule_getAllValues, ArcAssay_toRows(assay));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function ArcAssay_fromMetadataCollection(collection) {
|
|
132
|
+
try {
|
|
133
|
+
return ArcAssay_fromRows(map(SparseRowModule_fromAllValues, collection));
|
|
111
134
|
}
|
|
112
135
|
catch (err) {
|
|
113
136
|
const arg = err.message;
|
|
@@ -3,7 +3,7 @@ import { record_type, list_type, string_type } from "../fable_modules/fable-libr
|
|
|
3
3
|
import { Remark, Comment$_$reflection } from "../Core/Comment.js";
|
|
4
4
|
import { head, tail, isEmpty, ofSeq, concat, unzip, append, reverse, cons, empty, map, ofArray } from "../fable_modules/fable-library-js.4.22.0/List.js";
|
|
5
5
|
import { Remark_wrapRemark, Comment_toString, Comment_fromString } from "./Metadata/Comment.js";
|
|
6
|
-
import { SparseRowModule_writeToSheet, SparseRowModule_fromFsRow, SparseRowModule_fromValues, SparseRowModule_tryGetValueAt, SparseTable_ToRows_759CAFC1, SparseTable_FromRows_Z5579EC29, SparseTable, SparseTable_Create_Z2192E64B, SparseTable__TryGetValueDefault_5BAE6133 } from "./Metadata/SparseTable.js";
|
|
6
|
+
import { SparseRowModule_writeToSheet, SparseRowModule_fromFsRow, SparseRowModule_fromAllValues, SparseRowModule_getAllValues, SparseRowModule_fromValues, SparseRowModule_tryGetValueAt, SparseTable_ToRows_759CAFC1, SparseTable_FromRows_Z5579EC29, SparseTable, SparseTable_Create_Z2192E64B, SparseTable__TryGetValueDefault_5BAE6133 } from "./Metadata/SparseTable.js";
|
|
7
7
|
import { addToDict } from "../fable_modules/fable-library-js.4.22.0/MapUtil.js";
|
|
8
8
|
import { value as value_1, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
9
9
|
import { Option_fromValueWithDefault, ResizeArray_iter } from "../Core/Helper/Collections.js";
|
|
@@ -14,7 +14,7 @@ import { toRows, fromRows } from "./Metadata/OntologySourceReference.js";
|
|
|
14
14
|
import { toRows as toRows_1, fromRows as fromRows_1 } from "./Metadata/Publication.js";
|
|
15
15
|
import { toRows as toRows_2, fromRows as fromRows_2 } from "./Metadata/Contacts.js";
|
|
16
16
|
import { toRows as toRows_3, fromRows as fromRows_3 } from "./Metadata/Study.js";
|
|
17
|
-
import { iterateIndexed,
|
|
17
|
+
import { iterateIndexed, tryFind as tryFind_1, map as map_1, toList, collect, singleton, append as append_1, delay } from "../fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
18
18
|
import { tryFind, ofList } from "../fable_modules/fable-library-js.4.22.0/Map.js";
|
|
19
19
|
import { printf, toFail } from "../fable_modules/fable-library-js.4.22.0/String.js";
|
|
20
20
|
import { FsWorksheet } from "../fable_modules/FsSpreadsheet.6.3.0-alpha.4/FsWorksheet.fs.js";
|
|
@@ -102,7 +102,7 @@ export function ArcInvestigation_fromRows(rows) {
|
|
|
102
102
|
loop:
|
|
103
103
|
while (true) {
|
|
104
104
|
const lastLine = lastLine_mut, ontologySourceReferences = ontologySourceReferences_mut, investigationInfo = investigationInfo_mut, publications = publications_mut, contacts = contacts_mut, studies = studies_mut, remarks = remarks_mut, lineNumber = lineNumber_mut;
|
|
105
|
-
let matchResult, k_5, k_6, k_7, k_8, k_9
|
|
105
|
+
let matchResult, k_5, k_6, k_7, k_8, k_9;
|
|
106
106
|
if (lastLine != null) {
|
|
107
107
|
switch (lastLine) {
|
|
108
108
|
case "ONTOLOGY SOURCE REFERENCE": {
|
|
@@ -130,15 +130,12 @@ export function ArcInvestigation_fromRows(rows) {
|
|
|
130
130
|
k_9 = lastLine;
|
|
131
131
|
break;
|
|
132
132
|
}
|
|
133
|
-
default:
|
|
133
|
+
default:
|
|
134
134
|
matchResult = 5;
|
|
135
|
-
k_10 = lastLine;
|
|
136
|
-
}
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
else {
|
|
140
138
|
matchResult = 5;
|
|
141
|
-
k_10 = lastLine;
|
|
142
139
|
}
|
|
143
140
|
switch (matchResult) {
|
|
144
141
|
case 0: {
|
|
@@ -283,6 +280,14 @@ export function ArcInvestigation_toRows(investigation) {
|
|
|
283
280
|
})()));
|
|
284
281
|
}
|
|
285
282
|
|
|
283
|
+
export function ArcInvestigation_toMetadataCollection(investigation) {
|
|
284
|
+
return map_1(SparseRowModule_getAllValues, ArcInvestigation_toRows(investigation));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export function ArcInvestigation_fromMetadataCollection(collection) {
|
|
288
|
+
return ArcInvestigation_fromRows(map_1(SparseRowModule_fromAllValues, collection));
|
|
289
|
+
}
|
|
290
|
+
|
|
286
291
|
export function ArcInvestigation_isMetadataSheetName(name) {
|
|
287
292
|
if (name === "isa_investigation") {
|
|
288
293
|
return true;
|
package/Spreadsheet/ArcStudy.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FsWorksheet } from "../fable_modules/FsSpreadsheet.6.3.0-alpha.4/FsWorksheet.fs.js";
|
|
2
2
|
import { iterate, tryPick, tryFind, map, append, iterateIndexed } from "../fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
3
|
-
import { SparseRowModule_fromFsRow, SparseRowModule_fromValues, SparseRowModule_writeToSheet } from "./Metadata/SparseTable.js";
|
|
4
|
-
import { fromRows
|
|
3
|
+
import { SparseRowModule_fromAllValues, SparseRowModule_getAllValues, SparseRowModule_fromFsRow, SparseRowModule_fromValues, SparseRowModule_writeToSheet } from "./Metadata/SparseTable.js";
|
|
4
|
+
import { fromRows, toRows } from "./Metadata/Study.js";
|
|
5
|
+
import { getEnumerator } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
5
6
|
import { toConsole, printf, toFail } from "../fable_modules/fable-library-js.4.22.0/String.js";
|
|
6
7
|
import { unwrap, toArray, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
7
|
-
import { getEnumerator } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
8
8
|
import { ArcStudy } from "../Core/ArcTypes.js";
|
|
9
9
|
import { createMissingIdentifier } from "../Core/Helper/Identifier.js";
|
|
10
10
|
import { empty } from "../fable_modules/fable-library-js.4.22.0/List.js";
|
|
@@ -22,10 +22,30 @@ export function ArcStudy_toMetadataSheet(study, assays) {
|
|
|
22
22
|
return sheet;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export function ArcStudy_fromRows(rows) {
|
|
26
|
+
const en = getEnumerator(rows);
|
|
27
|
+
en["System.Collections.IEnumerator.MoveNext"]();
|
|
28
|
+
return fromRows(2, en)[3];
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
export function ArcStudy_fromMetadataSheet(sheet) {
|
|
26
|
-
let en;
|
|
27
32
|
try {
|
|
28
|
-
return defaultArg((
|
|
33
|
+
return defaultArg(ArcStudy_fromRows(map(SparseRowModule_fromFsRow, sheet.Rows)), [ArcStudy.create(createMissingIdentifier()), empty()]);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
const arg = err.message;
|
|
37
|
+
return toFail(printf("Failed while parsing metadatasheet: %s"))(arg);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function ArcStudy_toMetadataCollection(study, assays) {
|
|
42
|
+
let source_1;
|
|
43
|
+
return map(SparseRowModule_getAllValues, (source_1 = toRows(study, assays), append([SparseRowModule_fromValues(["STUDY"])], source_1)));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function ArcStudy_fromMetadataCollection(collection) {
|
|
47
|
+
try {
|
|
48
|
+
return defaultArg(ArcStudy_fromRows(map(SparseRowModule_fromAllValues, collection)), [ArcStudy.create(createMissingIdentifier()), empty()]);
|
|
29
49
|
}
|
|
30
50
|
catch (err) {
|
|
31
51
|
const arg = err.message;
|
package/Spreadsheet/Template.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ofSeq, append as append_1, reverse, map, empty, ofArray } from "../fabl
|
|
|
4
4
|
import { toRows, fromRows, toSparseTable, fromSparseTable } from "./Metadata/OntologyAnnotation.js";
|
|
5
5
|
import { Comment$_$reflection } from "../Core/Comment.js";
|
|
6
6
|
import { Comment_fromString } from "./Metadata/Comment.js";
|
|
7
|
-
import { SparseRowModule_fromFsRow, SparseRowModule_writeToSheet, SparseRowModule_fromValues, SparseRowModule_tryGetValueAt, SparseTable_ToRows_759CAFC1, SparseTable_FromRows_Z5579EC29, SparseTable, SparseTable_Create_Z2192E64B, SparseTable__TryGetValueDefault_5BAE6133 } from "./Metadata/SparseTable.js";
|
|
7
|
+
import { SparseRowModule_fromAllValues, SparseRowModule_getAllValues, SparseRowModule_fromFsRow, SparseRowModule_writeToSheet, SparseRowModule_fromValues, SparseRowModule_tryGetValueAt, SparseTable_ToRows_759CAFC1, SparseTable_FromRows_Z5579EC29, SparseTable, SparseTable_Create_Z2192E64B, SparseTable__TryGetValueDefault_5BAE6133 } from "./Metadata/SparseTable.js";
|
|
8
8
|
import { createMissingIdentifier } from "../Core/Helper/Identifier.js";
|
|
9
9
|
import { addToDict } from "../fable_modules/fable-library-js.4.22.0/MapUtil.js";
|
|
10
10
|
import { List_distinct } from "../fable_modules/fable-library-js.4.22.0/Seq2.js";
|
|
@@ -281,6 +281,14 @@ export function Template_fromMetadataSheet(sheet) {
|
|
|
281
281
|
return Metadata_Template_fromRows(map_1(SparseRowModule_fromFsRow, sheet.Rows));
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
+
export function Template_toMetadataCollection(template) {
|
|
285
|
+
return map_1(SparseRowModule_getAllValues, Metadata_Template_toRows(template));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export function Template_fromMetadataCollection(collection) {
|
|
289
|
+
return Metadata_Template_fromRows(map_1(SparseRowModule_fromAllValues, collection));
|
|
290
|
+
}
|
|
291
|
+
|
|
284
292
|
/**
|
|
285
293
|
* Reads an assay from a spreadsheet
|
|
286
294
|
*/
|