@nfdi4plants/arctrl 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/ARC.js +39 -3
  2. package/Contracts/Contracts.ArcTypes.js +20 -8
  3. package/ISA/ISA/ArcTypes/ArcTable.js +5 -16
  4. package/ISA/ISA/ArcTypes/ArcTableAux.js +111 -68
  5. package/ISA/ISA/ArcTypes/ArcTypes.js +108 -73
  6. package/ISA/ISA.Json/ArcTypes/ArcAssay.js +74 -3
  7. package/ISA/ISA.Json/ArcTypes/ArcStudy.js +82 -3
  8. package/ISA/ISA.Json/ArcTypes/ArcTable.js +125 -4
  9. package/ISA/ISA.Json/ArcTypes/CellTable.js +46 -0
  10. package/ISA/ISA.Json/ArcTypes/CompositeCell.js +26 -0
  11. package/ISA/ISA.Json/ArcTypes/OATable.js +48 -0
  12. package/ISA/ISA.Json/Ontology.js +30 -0
  13. package/ISA/ISA.Json/StringTable.js +43 -0
  14. package/ISA/ISA.Spreadsheet/AnnotationTable/ArcTable.js +52 -39
  15. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeCell.js +1 -1
  16. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeColumn.js +3 -3
  17. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeHeader.js +1 -1
  18. package/ISA/ISA.Spreadsheet/ArcAssay.js +96 -84
  19. package/ISA/ISA.Spreadsheet/ArcInvestigation.js +2 -2
  20. package/ISA/ISA.Spreadsheet/ArcStudy.js +32 -20
  21. package/ISA/ISA.Spreadsheet/Metadata/SparseTable.js +7 -7
  22. package/Templates/Template.Spreadsheet.js +2 -2
  23. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsAddress.fs +22 -8
  24. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsAddress.fs.js +20 -10
  25. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsWorksheet.fs +12 -6
  26. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsWorksheet.fs.js +12 -8
  27. package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +3 -3
  28. package/fable_modules/project_cracked.json +1 -1
  29. package/package.json +1 -1
  30. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Cells/FsCell.fs +0 -0
  31. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Cells/FsCell.fs.js +0 -0
  32. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Cells/FsCellsCollection.fs +0 -0
  33. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Cells/FsCellsCollection.fs.js +0 -0
  34. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/CellBuilder.fs +0 -0
  35. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/CellBuilder.fs.js +0 -0
  36. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/ColumnBuilder.fs +0 -0
  37. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/ColumnBuilder.fs.js +0 -0
  38. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/DSL.fs +0 -0
  39. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/DSL.fs.js +0 -0
  40. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Expression.fs +0 -0
  41. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Expression.fs.js +0 -0
  42. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Operators.fs +0 -0
  43. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Operators.fs.js +0 -0
  44. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/RowBuilder.fs +0 -0
  45. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/RowBuilder.fs.js +0 -0
  46. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/SheetBuilder.fs +0 -0
  47. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/SheetBuilder.fs.js +0 -0
  48. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/TableBuilder.fs +0 -0
  49. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/TableBuilder.fs.js +0 -0
  50. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Transform.fs +0 -0
  51. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Transform.fs.js +0 -0
  52. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Types.fs +0 -0
  53. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/Types.fs.js +0 -0
  54. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/WorkbookBuilder.fs +0 -0
  55. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/DSL/WorkbookBuilder.fs.js +0 -0
  56. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsColumn.fs +0 -0
  57. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsColumn.fs.js +0 -0
  58. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsRow.fs +0 -0
  59. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsRow.fs.js +0 -0
  60. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsSpreadsheet.fableproj +0 -0
  61. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsWorkbook.fs +0 -0
  62. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/FsWorkbook.fs.js +0 -0
  63. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRange.fs +0 -0
  64. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRange.fs.js +0 -0
  65. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeAddress.fs +0 -0
  66. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeAddress.fs.js +0 -0
  67. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeBase.fs +0 -0
  68. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeBase.fs.js +0 -0
  69. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeColumn.fs +0 -0
  70. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeColumn.fs.js +0 -0
  71. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeRow.fs +0 -0
  72. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Ranges/FsRangeRow.fs.js +0 -0
  73. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/SheetBuilder.fs +0 -0
  74. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/SheetBuilder.fs.js +0 -0
  75. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTable.fs +0 -0
  76. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTable.fs.js +0 -0
  77. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTableField.fs +0 -0
  78. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTableField.fs.js +0 -0
  79. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTableRow.fs +0 -0
  80. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/Tables/FsTableRow.fs.js +0 -0
  81. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  82. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
  83. /package/fable_modules/{FsSpreadsheet.5.1.1 → FsSpreadsheet.5.1.3}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
@@ -1,16 +1,16 @@
1
- import { FsWorksheet } from "../../fable_modules/FsSpreadsheet.5.1.1/FsWorksheet.fs.js";
1
+ import { FsWorksheet } from "../../fable_modules/FsSpreadsheet.5.1.3/FsWorksheet.fs.js";
2
2
  import { iterate, isEmpty as isEmpty_1, choose, tryHead, head, exists, map, singleton, append, delay, iterateIndexed } from "../../fable_modules/fable-library.4.5.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, toArray, ofArray, singleton as singleton_1 } from "../../fable_modules/fable-library.4.5.0/List.js";
6
6
  import { fromRows as fromRows_2, toRows as toRows_2 } from "./Metadata/Contacts.js";
7
+ import { toConsole, printf, toFail } from "../../fable_modules/fable-library.4.5.0/String.js";
7
8
  import { getEnumerator } from "../../fable_modules/fable-library.4.5.0/Util.js";
8
9
  import { ArcAssay } from "../ISA/ArcTypes/ArcTypes.js";
9
10
  import { createMissingIdentifier } from "../ISA/Identifier.js";
10
11
  import { defaultArg } from "../../fable_modules/fable-library.4.5.0/Option.js";
11
- import { printf, toConsole } from "../../fable_modules/fable-library.4.5.0/String.js";
12
12
  import { toFsWorksheet, tryFromFsWorksheet } from "./AnnotationTable/ArcTable.js";
13
- import { FsWorkbook } from "../../fable_modules/FsSpreadsheet.5.1.1/FsWorkbook.fs.js";
13
+ import { FsWorkbook } from "../../fable_modules/FsSpreadsheet.5.1.3/FsWorkbook.fs.js";
14
14
 
15
15
  export function toMetadataSheet(assay) {
16
16
  let assay_1;
@@ -22,89 +22,95 @@ export function toMetadataSheet(assay) {
22
22
  }
23
23
 
24
24
  export function fromMetadataSheet(sheet) {
25
- const rows_1 = map(SparseRowModule_fromFsRow, sheet.Rows);
26
- const patternInput = exists((row) => {
27
- const s = head(row)[1];
28
- return s.indexOf("Assay") === 0;
29
- }, rows_1) ? ["Assay", "Assay Person"] : [void 0, void 0];
30
- const en = getEnumerator(rows_1);
31
- const loop = (lastLine_mut, assays_mut, contacts_mut, lineNumber_mut) => {
32
- let k;
33
- loop:
34
- while (true) {
35
- const lastLine = lastLine_mut, assays = assays_mut, contacts = contacts_mut, lineNumber = lineNumber_mut;
36
- let matchResult, k_2, k_3, k_4;
37
- if (lastLine != null) {
38
- if ((k = lastLine, (k === "ASSAY") ? true : (k === "ASSAY METADATA"))) {
39
- matchResult = 0;
40
- k_2 = lastLine;
41
- }
42
- else if (lastLine === "ASSAY PERFORMERS") {
43
- matchResult = 1;
44
- k_3 = lastLine;
25
+ try {
26
+ const rows_1 = map(SparseRowModule_fromFsRow, sheet.Rows);
27
+ const patternInput = exists((row) => {
28
+ const s = head(row)[1];
29
+ return s.indexOf("Assay") === 0;
30
+ }, rows_1) ? ["Assay", "Assay Person"] : [void 0, void 0];
31
+ const en = getEnumerator(rows_1);
32
+ const loop = (lastLine_mut, assays_mut, contacts_mut, lineNumber_mut) => {
33
+ let k;
34
+ loop:
35
+ while (true) {
36
+ const lastLine = lastLine_mut, assays = assays_mut, contacts = contacts_mut, lineNumber = lineNumber_mut;
37
+ let matchResult, k_2, k_3, k_4;
38
+ if (lastLine != null) {
39
+ if ((k = lastLine, (k === "ASSAY") ? true : (k === "ASSAY METADATA"))) {
40
+ matchResult = 0;
41
+ k_2 = lastLine;
42
+ }
43
+ else if (lastLine === "ASSAY PERFORMERS") {
44
+ matchResult = 1;
45
+ k_3 = lastLine;
46
+ }
47
+ else {
48
+ matchResult = 2;
49
+ k_4 = lastLine;
50
+ }
45
51
  }
46
52
  else {
47
53
  matchResult = 2;
48
54
  k_4 = lastLine;
49
55
  }
50
- }
51
- else {
52
- matchResult = 2;
53
- k_4 = lastLine;
54
- }
55
- switch (matchResult) {
56
- case 0: {
57
- const patternInput_1 = fromRows_1(patternInput[0], lineNumber + 1, en);
58
- lastLine_mut = patternInput_1[0];
59
- assays_mut = patternInput_1[3];
60
- contacts_mut = contacts;
61
- lineNumber_mut = patternInput_1[1];
62
- continue loop;
63
- }
64
- case 1: {
65
- const patternInput_2 = fromRows_2(patternInput[1], lineNumber + 1, en);
66
- lastLine_mut = patternInput_2[0];
67
- assays_mut = assays;
68
- contacts_mut = patternInput_2[3];
69
- lineNumber_mut = patternInput_2[1];
70
- continue loop;
71
- }
72
- default: {
73
- let matchResult_1, assays_2, contacts_2;
74
- if (isEmpty(assays)) {
75
- if (isEmpty(contacts)) {
76
- matchResult_1 = 0;
56
+ switch (matchResult) {
57
+ case 0: {
58
+ const patternInput_1 = fromRows_1(patternInput[0], lineNumber + 1, en);
59
+ lastLine_mut = patternInput_1[0];
60
+ assays_mut = patternInput_1[3];
61
+ contacts_mut = contacts;
62
+ lineNumber_mut = patternInput_1[1];
63
+ continue loop;
64
+ }
65
+ case 1: {
66
+ const patternInput_2 = fromRows_2(patternInput[1], lineNumber + 1, en);
67
+ lastLine_mut = patternInput_2[0];
68
+ assays_mut = assays;
69
+ contacts_mut = patternInput_2[3];
70
+ lineNumber_mut = patternInput_2[1];
71
+ continue loop;
72
+ }
73
+ default: {
74
+ let matchResult_1, assays_2, contacts_2;
75
+ if (isEmpty(assays)) {
76
+ if (isEmpty(contacts)) {
77
+ matchResult_1 = 0;
78
+ }
79
+ else {
80
+ matchResult_1 = 1;
81
+ assays_2 = assays;
82
+ contacts_2 = contacts;
83
+ }
77
84
  }
78
85
  else {
79
86
  matchResult_1 = 1;
80
87
  assays_2 = assays;
81
88
  contacts_2 = contacts;
82
89
  }
83
- }
84
- else {
85
- matchResult_1 = 1;
86
- assays_2 = assays;
87
- contacts_2 = contacts;
88
- }
89
- switch (matchResult_1) {
90
- case 0:
91
- return ArcAssay.create(createMissingIdentifier());
92
- default: {
93
- const performers = toArray(contacts_2);
94
- const assay = defaultArg(tryHead(assays_2), ArcAssay.create(createMissingIdentifier()));
95
- return ArcAssay.setPerformers(performers, assay);
90
+ switch (matchResult_1) {
91
+ case 0:
92
+ return ArcAssay.create(createMissingIdentifier());
93
+ default: {
94
+ const performers = toArray(contacts_2);
95
+ const assay = defaultArg(tryHead(assays_2), ArcAssay.create(createMissingIdentifier()));
96
+ return ArcAssay.setPerformers(performers, assay);
97
+ }
96
98
  }
97
99
  }
98
100
  }
101
+ break;
99
102
  }
100
- break;
103
+ };
104
+ if (en["System.Collections.IEnumerator.MoveNext"]()) {
105
+ return loop(SparseRowModule_tryGetValueAt(0, en["System.Collections.Generic.IEnumerator`1.get_Current"]()), empty(), empty(), 1);
106
+ }
107
+ else {
108
+ throw new Error("empty assay metadata sheet");
101
109
  }
102
- };
103
- if (en["System.Collections.IEnumerator.MoveNext"]()) {
104
- return loop(SparseRowModule_tryGetValueAt(0, en["System.Collections.Generic.IEnumerator`1.get_Current"]()), empty(), empty(), 1);
105
110
  }
106
- else {
107
- throw new Error("empty assay metadata sheet");
111
+ catch (err) {
112
+ const arg = err.message;
113
+ return toFail(printf("Failed while parsing metadatasheet: %s"))(arg);
108
114
  }
109
115
  }
110
116
 
@@ -112,26 +118,32 @@ export function fromMetadataSheet(sheet) {
112
118
  * Reads an assay from a spreadsheet
113
119
  */
114
120
  export function fromFsWorkbook(doc) {
115
- let assayMetaData;
116
- const matchValue = doc.TryGetWorksheetByName("isa_assay");
117
- if (matchValue == null) {
118
- const matchValue_1 = doc.TryGetWorksheetByName("Assay");
119
- if (matchValue_1 == null) {
120
- toConsole(printf("Cannot retrieve metadata: Assay file does not contain \"%s\" or \"%s\" sheet."))("isa_assay")("Assay");
121
- assayMetaData = ArcAssay.create(createMissingIdentifier());
121
+ try {
122
+ let assayMetaData;
123
+ const matchValue = doc.TryGetWorksheetByName("isa_assay");
124
+ if (matchValue == null) {
125
+ const matchValue_1 = doc.TryGetWorksheetByName("Assay");
126
+ if (matchValue_1 == null) {
127
+ toConsole(printf("Cannot retrieve metadata: Assay file does not contain \"%s\" or \"%s\" sheet."))("isa_assay")("Assay");
128
+ assayMetaData = ArcAssay.create(createMissingIdentifier());
129
+ }
130
+ else {
131
+ assayMetaData = fromMetadataSheet(matchValue_1);
132
+ }
122
133
  }
123
134
  else {
124
- assayMetaData = fromMetadataSheet(matchValue_1);
135
+ assayMetaData = fromMetadataSheet(matchValue);
125
136
  }
137
+ const annotationTables = choose(tryFromFsWorksheet, doc.GetWorksheets());
138
+ if (!isEmpty_1(annotationTables)) {
139
+ assayMetaData.Tables = Array.from(annotationTables);
140
+ }
141
+ return assayMetaData;
126
142
  }
127
- else {
128
- assayMetaData = fromMetadataSheet(matchValue);
129
- }
130
- const annotationTables = choose(tryFromFsWorksheet, doc.GetWorksheets());
131
- if (!isEmpty_1(annotationTables)) {
132
- assayMetaData.Tables = Array.from(annotationTables);
143
+ catch (err) {
144
+ const arg_2 = err.message;
145
+ return toFail(printf("Could not parse assay: \n%s"))(arg_2);
133
146
  }
134
- return assayMetaData;
135
147
  }
136
148
 
137
149
  export function toFsWorkbook(assay) {
@@ -17,8 +17,8 @@ import { toRows as toRows_4, fromRows as fromRows_4 } from "./Metadata/Study.js"
17
17
  import { iterateIndexed, map as map_1, toList, empty as empty_1, collect, singleton, append as append_1, delay } from "../../fable_modules/fable-library.4.5.0/Seq.js";
18
18
  import { tryFind, ofList } from "../../fable_modules/fable-library.4.5.0/Map.js";
19
19
  import { printf, toFail } from "../../fable_modules/fable-library.4.5.0/String.js";
20
- import { FsWorksheet } from "../../fable_modules/FsSpreadsheet.5.1.1/FsWorksheet.fs.js";
21
- import { FsWorkbook } from "../../fable_modules/FsSpreadsheet.5.1.1/FsWorkbook.fs.js";
20
+ import { FsWorksheet } from "../../fable_modules/FsSpreadsheet.5.1.3/FsWorksheet.fs.js";
21
+ import { FsWorkbook } from "../../fable_modules/FsSpreadsheet.5.1.3/FsWorkbook.fs.js";
22
22
 
23
23
  export class InvestigationInfo extends Record {
24
24
  constructor(Identifier, Title, Description, SubmissionDate, PublicReleaseDate, Comments) {
@@ -1,16 +1,16 @@
1
- import { FsWorksheet } from "../../fable_modules/FsSpreadsheet.5.1.1/FsWorksheet.fs.js";
1
+ import { FsWorksheet } from "../../fable_modules/FsSpreadsheet.5.1.3/FsWorksheet.fs.js";
2
2
  import { map, append, iterateIndexed } from "../../fable_modules/fable-library.4.5.0/Seq.js";
3
3
  import { SparseRowModule_fromFsRow, SparseRowModule_fromValues, SparseRowModule_writeToSheet } from "./Metadata/SparseTable.js";
4
4
  import { fromRows as fromRows_1, toRows } from "./Metadata/Study.js";
5
+ import { toConsole, printf, toFail } from "../../fable_modules/fable-library.4.5.0/String.js";
5
6
  import { defaultArg } from "../../fable_modules/fable-library.4.5.0/Option.js";
6
7
  import { getEnumerator } from "../../fable_modules/fable-library.4.5.0/Util.js";
7
8
  import { ArcStudy } from "../ISA/ArcTypes/ArcTypes.js";
8
9
  import { createMissingIdentifier } from "../ISA/Identifier.js";
9
10
  import { empty } from "../../fable_modules/fable-library.4.5.0/List.js";
10
- import { printf, toConsole } from "../../fable_modules/fable-library.4.5.0/String.js";
11
11
  import { ResizeArray_iter, ResizeArray_isEmpty, ResizeArray_choose } from "../ISA/Helper.js";
12
12
  import { toFsWorksheet, tryFromFsWorksheet } from "./AnnotationTable/ArcTable.js";
13
- import { FsWorkbook } from "../../fable_modules/FsSpreadsheet.5.1.1/FsWorkbook.fs.js";
13
+ import { FsWorkbook } from "../../fable_modules/FsSpreadsheet.5.1.3/FsWorkbook.fs.js";
14
14
 
15
15
  export function ArcStudy_toMetadataSheet(study, assays) {
16
16
  let source_1;
@@ -23,34 +23,46 @@ export function ArcStudy_toMetadataSheet(study, assays) {
23
23
 
24
24
  export function ArcStudy_fromMetadataSheet(sheet) {
25
25
  let en;
26
- return defaultArg((en = getEnumerator(map(SparseRowModule_fromFsRow, sheet.Rows)), (void en["System.Collections.IEnumerator.MoveNext"](), fromRows_1(2, en)[3])), [ArcStudy.create(createMissingIdentifier()), empty()]);
26
+ try {
27
+ return defaultArg((en = getEnumerator(map(SparseRowModule_fromFsRow, sheet.Rows)), (void en["System.Collections.IEnumerator.MoveNext"](), fromRows_1(2, en)[3])), [ArcStudy.create(createMissingIdentifier()), empty()]);
28
+ }
29
+ catch (err) {
30
+ const arg = err.message;
31
+ return toFail(printf("Failed while parsing metadatasheet: %s"))(arg);
32
+ }
27
33
  }
28
34
 
29
35
  /**
30
36
  * Reads an assay from a spreadsheet
31
37
  */
32
38
  export function ARCtrl_ISA_ArcStudy__ArcStudy_fromFsWorkbook_Static_32154C9D(doc) {
33
- let patternInput;
34
- const matchValue = doc.TryGetWorksheetByName("isa_study");
35
- if (matchValue == null) {
36
- const matchValue_1 = doc.TryGetWorksheetByName("Study");
37
- if (matchValue_1 == null) {
38
- toConsole(printf("Cannot retrieve metadata: Study file does not contain \"%s\" or \"%s\" sheet."))("isa_study")("Study");
39
- patternInput = [ArcStudy.create(createMissingIdentifier()), empty()];
39
+ try {
40
+ let patternInput;
41
+ const matchValue = doc.TryGetWorksheetByName("isa_study");
42
+ if (matchValue == null) {
43
+ const matchValue_1 = doc.TryGetWorksheetByName("Study");
44
+ if (matchValue_1 == null) {
45
+ toConsole(printf("Cannot retrieve metadata: Study file does not contain \"%s\" or \"%s\" sheet."))("isa_study")("Study");
46
+ patternInput = [ArcStudy.create(createMissingIdentifier()), empty()];
47
+ }
48
+ else {
49
+ patternInput = ArcStudy_fromMetadataSheet(matchValue_1);
50
+ }
40
51
  }
41
52
  else {
42
- patternInput = ArcStudy_fromMetadataSheet(matchValue_1);
53
+ patternInput = ArcStudy_fromMetadataSheet(matchValue);
43
54
  }
55
+ const studyMetadata = patternInput[0];
56
+ const annotationTables = ResizeArray_choose(tryFromFsWorksheet, doc.GetWorksheets());
57
+ if (!ResizeArray_isEmpty(annotationTables)) {
58
+ studyMetadata.Tables = annotationTables;
59
+ }
60
+ return [studyMetadata, patternInput[1]];
44
61
  }
45
- else {
46
- patternInput = ArcStudy_fromMetadataSheet(matchValue);
47
- }
48
- const studyMetadata = patternInput[0];
49
- const annotationTables = ResizeArray_choose(tryFromFsWorksheet, doc.GetWorksheets());
50
- if (!ResizeArray_isEmpty(annotationTables)) {
51
- studyMetadata.Tables = annotationTables;
62
+ catch (err) {
63
+ const arg_2 = err.message;
64
+ return toFail(printf("Could not parse study: \n%s"))(arg_2);
52
65
  }
53
- return [studyMetadata, patternInput[1]];
54
66
  }
55
67
 
56
68
  export function ARCtrl_ISA_ArcStudy__ArcStudy_toFsWorkbook_Static_Z2A9662E9(study, assays) {
@@ -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.4.5.0/Option.js";
3
3
  import { tryFind, ofSeq } from "../../../fable_modules/fable-library.4.5.0/Map.js";
4
4
  import { arrayHash, equalArrays, equals, comparePrimitives } from "../../../fable_modules/fable-library.4.5.0/Util.js";
5
- import { RowBuilder_get_Empty, RowBuilder__Combine_19F30600, RowBuilder_$ctor } from "../../../fable_modules/FsSpreadsheet.5.1.1/DSL/RowBuilder.fs.js";
6
- import { CellBuilder_$ctor, CellBuilder__AsCellElement_6F87C2ED } from "../../../fable_modules/FsSpreadsheet.5.1.1/DSL/CellBuilder.fs.js";
7
- import { Messages_format, SheetEntity$1_some_2B595 } from "../../../fable_modules/FsSpreadsheet.5.1.1/DSL/Types.fs.js";
8
- import { DataType } from "../../../fable_modules/FsSpreadsheet.5.1.1/Cells/FsCell.fs.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";
9
9
  import { map as map_2, toArray, initialize as initialize_1, exists, find, cons, append, empty, singleton } from "../../../fable_modules/fable-library.4.5.0/List.js";
10
- import { ColumnIndex, RowElement } from "../../../fable_modules/FsSpreadsheet.5.1.1/DSL/Types.fs.js";
11
- import { FsRangeAddress_$ctor_7E77A4A0 } from "../../../fable_modules/FsSpreadsheet.5.1.1/Ranges/FsRangeAddress.fs.js";
12
- import { FsAddress_$ctor_Z37302880 } from "../../../fable_modules/FsSpreadsheet.5.1.1/FsAddress.fs.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";
13
13
  import { Record } from "../../../fable_modules/fable-library.4.5.0/Types.js";
14
14
  import { record_type, list_type, class_type, tuple_type, int32_type, string_type } from "../../../fable_modules/fable-library.4.5.0/Reflection.js";
15
15
  import { Seq_trySkip, Dictionary_tryGetValue } from "../CollectionAux.js";
@@ -15,10 +15,10 @@ import { toArray } from "../fable_modules/fable-library.4.5.0/Option.js";
15
15
  import { toRows as toRows_1, fromRows as fromRows_1 } from "../ISA/ISA.Spreadsheet/Metadata/Contacts.js";
16
16
  import { parse } from "../fable_modules/fable-library.4.5.0/Guid.js";
17
17
  import { Template, Organisation } from "./Template.js";
18
- import { FsWorksheet } from "../fable_modules/FsSpreadsheet.5.1.1/FsWorksheet.fs.js";
18
+ import { FsWorksheet } from "../fable_modules/FsSpreadsheet.5.1.3/FsWorksheet.fs.js";
19
19
  import { toFsWorksheet, tryFromFsWorksheet } from "../ISA/ISA.Spreadsheet/AnnotationTable/ArcTable.js";
20
20
  import { now } from "../fable_modules/fable-library.4.5.0/Date.js";
21
- import { FsWorkbook } from "../fable_modules/FsSpreadsheet.5.1.1/FsWorkbook.fs.js";
21
+ import { FsWorkbook } from "../fable_modules/FsSpreadsheet.5.1.3/FsWorkbook.fs.js";
22
22
 
23
23
  export class TemplateReadError extends FSharpException {
24
24
  constructor(Data0) {
@@ -4,6 +4,13 @@
4
4
  /// Module containing functions to work with "A1" style excel cell references.
5
5
  module CellReference =
6
6
 
7
+ [<Literal>]
8
+ let indexPattern =
9
+ "([A-Z]*)(\d*)"
10
+
11
+ let indexRegex =
12
+ System.Text.RegularExpressions.Regex(indexPattern)
13
+
7
14
  /// Transforms excel column string indices (e.g. A, B, Z, AA, CD) to index number (starting with A = 1).
8
15
  let colAdressToIndex (columnAdress : string) =
9
16
  let length = columnAdress.Length
@@ -30,17 +37,24 @@ module CellReference =
30
37
  let ofIndices column (row : uint32) =
31
38
  sprintf "%s%i" (indexToColAdress column) row
32
39
 
40
+
41
+
33
42
  /// Maps a "A1" style excel cell reference to a column * row index tuple (1 Based indices).
34
43
  let toIndices (reference : string) =
35
- let inp = reference.ToUpper()
36
- let pattern = "([A-Z]*)(\d*)"
37
- let regex = System.Text.RegularExpressions.Regex.Match(inp,pattern)
44
+ let charPart = System.Text.StringBuilder()
45
+ let numPart = System.Text.StringBuilder()
38
46
 
39
- if regex.Success then
40
- regex.Groups
41
- |> fun a -> colAdressToIndex a.[1].Value, uint32 a.[2].Value
42
- else
43
- failwithf "Reference %s does not match Excel A1-style" reference
47
+ reference
48
+ |> Seq.iter (fun c ->
49
+ if System.Char.IsLetter c then
50
+ charPart.Append c |> ignore
51
+ elif System.Char.IsDigit c then
52
+ numPart.Append c |> ignore
53
+ else
54
+ failwithf "Reference %s does not match Excel A1-style" reference
55
+ )
56
+ colAdressToIndex (charPart.ToString()), uint32 (numPart.ToString())
57
+
44
58
 
45
59
  /// Maps a "A1" style excel cell reference to a column (1 Based indices).
46
60
  let toColIndex (reference : string) =
@@ -1,9 +1,14 @@
1
1
  import { toFail, printf, toText } from "../fable-library.4.5.0/String.js";
2
- import { create, match } from "../fable-library.4.5.0/RegExp.js";
2
+ import { StringBuilder__Append_244C7CD6, StringBuilder_$ctor } from "../fable-library.4.5.0/System.Text.js";
3
+ import { iterate } from "../fable-library.4.5.0/Seq.js";
4
+ import { isDigit, isLetter } from "../fable-library.4.5.0/Char.js";
5
+ import { toString } from "../fable-library.4.5.0/Types.js";
3
6
  import { parse } from "../fable-library.4.5.0/Int32.js";
4
7
  import { toUInt32, fromInt32, fromUInt32, op_Addition, toInt64 } from "../fable-library.4.5.0/BigInt.js";
5
8
  import { class_type } from "../fable-library.4.5.0/Reflection.js";
6
9
 
10
+ export const CellReference_indexRegex = /([A-Z]*)(\d*)/gu;
11
+
7
12
  /**
8
13
  * Transforms excel column string indices (e.g. A, B, Z, AA, CD) to index number (starting with A = 1).
9
14
  */
@@ -57,15 +62,20 @@ export function CellReference_ofIndices(column, row) {
57
62
  * Maps a "A1" style excel cell reference to a column * row index tuple (1 Based indices).
58
63
  */
59
64
  export function CellReference_toIndices(reference) {
60
- const inp = reference.toLocaleUpperCase();
61
- const regex = match(create("([A-Z]*)(\\d*)"), inp);
62
- if (regex != null) {
63
- const a = regex;
64
- return [CellReference_colAdressToIndex(a[1] || ""), parse(a[2] || "", 511, true, 32)];
65
- }
66
- else {
67
- return toFail(printf("Reference %s does not match Excel A1-style"))(reference);
68
- }
65
+ const charPart = StringBuilder_$ctor();
66
+ const numPart = StringBuilder_$ctor();
67
+ iterate((c) => {
68
+ if (isLetter(c)) {
69
+ StringBuilder__Append_244C7CD6(charPart, c);
70
+ }
71
+ else if (isDigit(c)) {
72
+ StringBuilder__Append_244C7CD6(numPart, c);
73
+ }
74
+ else {
75
+ toFail(printf("Reference %s does not match Excel A1-style"))(reference);
76
+ }
77
+ }, reference.split(""));
78
+ return [CellReference_colAdressToIndex(toString(charPart)), parse(toString(numPart), 511, true, 32)];
69
79
  }
70
80
 
71
81
  /**
@@ -366,13 +366,19 @@ type FsWorksheet (name, ?fsRows, ?fsTables, ?fsCellsCollection) =
366
366
  _cells.GetCells()
367
367
  |> Seq.groupBy (fun c -> c.RowNumber)
368
368
  |> Seq.iter (fun (rowIndex,cells) ->
369
+ let mutable min = 1
370
+ let mutable max = 1
371
+ cells
372
+ |> Seq.iter (fun c ->
373
+ let cn = c.ColumnNumber
374
+ if cn < min then min <- cn
375
+ if cn > max then max <- cn
376
+ )
369
377
  let newRange =
370
- cells
371
- |> Seq.sortBy (fun c -> c.ColumnNumber)
372
- |> fun cells ->
373
- FsAddress(rowIndex,Seq.head cells |> fun c -> c.ColumnNumber),
374
- FsAddress(rowIndex,Seq.last cells |> fun c -> c.ColumnNumber)
375
- |> FsRangeAddress
378
+ FsRangeAddress(
379
+ FsAddress(rowIndex,min),
380
+ FsAddress(rowIndex,max)
381
+ )
376
382
  match Map.tryFind rowIndex rows with
377
383
  | Some row ->
378
384
  row.RangeAddress <- newRange
@@ -240,15 +240,19 @@ export class FsWorksheet {
240
240
  Compare: comparePrimitives,
241
241
  });
242
242
  iterate((tupledArg) => {
243
- let c_2, c_3;
244
243
  const rowIndex = tupledArg[0] | 0;
245
- let newRange;
246
- let tupledArg_1;
247
- const cells_1 = sortBy((c_1) => c_1.ColumnNumber, tupledArg[1], {
248
- Compare: comparePrimitives,
249
- });
250
- tupledArg_1 = [FsAddress_$ctor_Z37302880(rowIndex, (c_2 = head(cells_1), c_2.ColumnNumber)), FsAddress_$ctor_Z37302880(rowIndex, (c_3 = last(cells_1), c_3.ColumnNumber))];
251
- newRange = FsRangeAddress_$ctor_7E77A4A0(tupledArg_1[0], tupledArg_1[1]);
244
+ let min = 1;
245
+ let max = 1;
246
+ iterate((c_1) => {
247
+ const cn = c_1.ColumnNumber | 0;
248
+ if (cn < min) {
249
+ min = (cn | 0);
250
+ }
251
+ if (cn > max) {
252
+ max = (cn | 0);
253
+ }
254
+ }, tupledArg[1]);
255
+ const newRange = FsRangeAddress_$ctor_7E77A4A0(FsAddress_$ctor_Z37302880(rowIndex, min), FsAddress_$ctor_Z37302880(rowIndex, max));
252
256
  const matchValue = tryFind_1(rowIndex, rows);
253
257
  if (matchValue == null) {
254
258
  self.RowWithRange(newRange, true);
@@ -10,10 +10,10 @@ open System.Reflection
10
10
  [<assembly: System.Reflection.AssemblyCompanyAttribute("Heinrich Lukas Weil, Oliver Maus, Kevin Schneider, Kevin Frey, Timo Mühlhaus")>]
11
11
  [<assembly: System.Reflection.AssemblyConfigurationAttribute("Release")>]
12
12
  [<assembly: System.Reflection.AssemblyDescriptionAttribute("Fable compliant Spreadsheet creation and manipulation in FSharp")>]
13
- [<assembly: System.Reflection.AssemblyFileVersionAttribute("5.1.1.0")>]
14
- [<assembly: System.Reflection.AssemblyInformationalVersionAttribute("5.1.1")>]
13
+ [<assembly: System.Reflection.AssemblyFileVersionAttribute("5.1.3.0")>]
14
+ [<assembly: System.Reflection.AssemblyInformationalVersionAttribute("5.1.3")>]
15
15
  [<assembly: System.Reflection.AssemblyProductAttribute("FsSpreadsheet")>]
16
16
  [<assembly: System.Reflection.AssemblyTitleAttribute("FsSpreadsheet")>]
17
- [<assembly: System.Reflection.AssemblyVersionAttribute("5.1.1.0")>]
17
+ [<assembly: System.Reflection.AssemblyVersionAttribute("5.1.3.0")>]
18
18
  [<assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/CSBiology/FsSpreadsheet")>]
19
19
  do()