@nfdi4plants/arctrl 2.0.0-alpha.6 → 2.0.0-alpha.7

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 (41) hide show
  1. package/Core/Data.js +53 -4
  2. package/Core/DataContext.js +92 -0
  3. package/Core/Helper/Regex.js +26 -10
  4. package/Core/Helper/Url.js +38 -0
  5. package/Core/OntologyAnnotation.js +2 -1
  6. package/Core/Table/ArcTableAux.js +2 -2
  7. package/Core/Table/CompositeCell.js +4 -0
  8. package/Core/Table/DataMap.js +95 -82
  9. package/Json/Assay.js +16 -0
  10. package/Json/Comment.js +17 -5
  11. package/Json/Investigation.js +17 -1
  12. package/Json/OntologyAnnotation.js +17 -5
  13. package/Json/OntologySourceReference.js +17 -5
  14. package/Json/Person.js +17 -5
  15. package/Json/Process/Component.js +9 -0
  16. package/Json/Process/Data.js +8 -0
  17. package/Json/Process/DataFile.js +9 -0
  18. package/Json/Process/Factor.js +5 -1
  19. package/Json/Process/FactorValue.js +5 -0
  20. package/Json/Process/Material.js +9 -0
  21. package/Json/Process/MaterialAttribute.js +5 -0
  22. package/Json/Process/MaterialAttributeValue.js +9 -0
  23. package/Json/Process/MaterialType.js +5 -0
  24. package/Json/Process/Process.js +9 -0
  25. package/Json/Process/ProcessInput.js +5 -0
  26. package/Json/Process/ProcessOutput.js +9 -0
  27. package/Json/Process/ProcessParameterValue.js +9 -0
  28. package/Json/Process/Protocol.js +10 -2
  29. package/Json/Process/ProtocolParameter.js +5 -0
  30. package/Json/Process/Sample.js +9 -1
  31. package/Json/Process/Source.js +9 -0
  32. package/Json/Publication.js +17 -5
  33. package/Json/Study.js +26 -10
  34. package/Json/Table/CellTable.js +4 -1
  35. package/Json/Table/Templates.js +10 -2
  36. package/Spreadsheet/DataMapTable/DataMapColumn.js +36 -30
  37. package/Spreadsheet/DataMapTable/DataMapHeader.js +146 -122
  38. package/Spreadsheet/DataMapTable/DataMapTable.js +17 -12
  39. package/Template.Web.js +1 -1
  40. package/fable_modules/project_cracked.json +1 -1
  41. package/package.json +1 -1
package/Core/Data.js CHANGED
@@ -1,15 +1,39 @@
1
+ import { printf, toText } from "../fable_modules/fable-library-js.4.16.0/String.js";
2
+ import { item } from "../fable_modules/fable-library-js.4.16.0/Array.js";
1
3
  import { defaultArg, unwrap } from "../fable_modules/fable-library-js.4.16.0/Option.js";
2
4
  import { ResizeArray_map } from "./Helper/Collections.js";
3
5
  import { hash, boxHashSeq, boxHashOption, boxHashArray } from "./Helper/HashCodes.js";
4
6
  import { toString } from "../fable_modules/fable-library-js.4.16.0/Types.js";
5
- import { printf, toText } from "../fable_modules/fable-library-js.4.16.0/String.js";
6
7
  import { DataFile__get_AsString } from "./DataFile.js";
7
8
  import { class_type } from "../fable_modules/fable-library-js.4.16.0/Reflection.js";
8
9
 
10
+ export function DataAux_nameFromPathAndSelector(path, selector) {
11
+ return toText(printf("%s#%s"))(path)(selector);
12
+ }
13
+
14
+ export function DataAux_pathAndSelectorFromName(name) {
15
+ const parts = name.split("#");
16
+ if (parts.length === 2) {
17
+ return [item(0, parts), item(1, parts)];
18
+ }
19
+ else {
20
+ return [name, void 0];
21
+ }
22
+ }
23
+
9
24
  export class Data {
10
25
  constructor(id, name, dataType, format, selectorFormat, comments) {
11
26
  this._id = id;
12
- this._name = name;
27
+ let patternInput_1;
28
+ if (name == null) {
29
+ patternInput_1 = [void 0, void 0];
30
+ }
31
+ else {
32
+ const patternInput = DataAux_pathAndSelectorFromName(name);
33
+ patternInput_1 = [patternInput[0], patternInput[1]];
34
+ }
35
+ this._selector = patternInput_1[1];
36
+ this._filePath = patternInput_1[0];
13
37
  this._dataType = dataType;
14
38
  this._format = format;
15
39
  this._selectorFormat = selectorFormat;
@@ -24,12 +48,37 @@ export class Data {
24
48
  this$._id = id;
25
49
  }
26
50
  get Name() {
51
+ let matchValue, matchValue_1, p_1, p, s;
27
52
  const this$ = this;
28
- return unwrap(this$._name);
53
+ return unwrap((matchValue = this$._filePath, (matchValue_1 = this$._selector, (matchValue == null) ? void 0 : ((matchValue_1 == null) ? ((p_1 = matchValue, p_1)) : ((p = matchValue, (s = matchValue_1, DataAux_nameFromPathAndSelector(p, s))))))));
29
54
  }
30
55
  set Name(name) {
31
56
  const this$ = this;
32
- this$._name = name;
57
+ if (name == null) {
58
+ this$._filePath = void 0;
59
+ this$._selector = void 0;
60
+ }
61
+ else {
62
+ const patternInput = DataAux_pathAndSelectorFromName(name);
63
+ this$._filePath = patternInput[0];
64
+ this$._selector = patternInput[1];
65
+ }
66
+ }
67
+ get FilePath() {
68
+ const this$ = this;
69
+ return unwrap(this$._filePath);
70
+ }
71
+ set FilePath(filePath) {
72
+ const this$ = this;
73
+ this$._filePath = filePath;
74
+ }
75
+ get Selector() {
76
+ const this$ = this;
77
+ return unwrap(this$._selector);
78
+ }
79
+ set Selector(selector) {
80
+ const this$ = this;
81
+ this$._selector = selector;
33
82
  }
34
83
  get DataType() {
35
84
  const this$ = this;
@@ -0,0 +1,92 @@
1
+ import { hash, boxHashSeq, boxHashOption, boxHashArray } from "./Helper/HashCodes.js";
2
+ import { Data_$reflection, Data } from "./Data.js";
3
+ import { unwrap } from "../fable_modules/fable-library-js.4.16.0/Option.js";
4
+ import { class_type } from "../fable_modules/fable-library-js.4.16.0/Reflection.js";
5
+
6
+ export class DataContext extends Data {
7
+ constructor(id, name, dataType, format, selectorFormat, explication, unit, objectType, description, generatedBy, comments) {
8
+ super(unwrap(id), unwrap(name), unwrap(dataType), unwrap(format), unwrap(selectorFormat), unwrap(comments));
9
+ this._explication = explication;
10
+ this._unit = unit;
11
+ this._objectType = objectType;
12
+ this._description = description;
13
+ this._generatedBy = generatedBy;
14
+ }
15
+ GetHashCode() {
16
+ const this$ = this;
17
+ return boxHashArray([boxHashOption(this$.ID), boxHashOption(this$.Name), boxHashOption(this$.DataType), boxHashOption(this$.Format), boxHashOption(this$.SelectorFormat), boxHashSeq(this$.Comments), boxHashOption(DataContext__get_Explication(this$)), boxHashOption(DataContext__get_Unit(this$)), boxHashOption(DataContext__get_ObjectType(this$)), boxHashOption(DataContext__get_Description(this$)), boxHashOption(DataContext__get_GeneratedBy(this$))]) | 0;
18
+ }
19
+ Equals(obj) {
20
+ const this$ = this;
21
+ return hash(this$) === hash(obj);
22
+ }
23
+ }
24
+
25
+ export function DataContext_$reflection() {
26
+ return class_type("ARCtrl.DataContext", void 0, DataContext, Data_$reflection());
27
+ }
28
+
29
+ export function DataContext_$ctor_Z2FD70A12(id, name, dataType, format, selectorFormat, explication, unit, objectType, description, generatedBy, comments) {
30
+ return new DataContext(id, name, dataType, format, selectorFormat, explication, unit, objectType, description, generatedBy, comments);
31
+ }
32
+
33
+ export function DataContext__get_Explication(this$) {
34
+ return this$._explication;
35
+ }
36
+
37
+ export function DataContext__set_Explication_279AAFF2(this$, explication) {
38
+ this$._explication = explication;
39
+ }
40
+
41
+ export function DataContext__get_Unit(this$) {
42
+ return this$._unit;
43
+ }
44
+
45
+ export function DataContext__set_Unit_279AAFF2(this$, unit) {
46
+ this$._unit = unit;
47
+ }
48
+
49
+ export function DataContext__get_ObjectType(this$) {
50
+ return this$._objectType;
51
+ }
52
+
53
+ export function DataContext__set_ObjectType_279AAFF2(this$, objectType) {
54
+ this$._objectType = objectType;
55
+ }
56
+
57
+ export function DataContext__get_Description(this$) {
58
+ return this$._description;
59
+ }
60
+
61
+ export function DataContext__set_Description_6DFDD678(this$, description) {
62
+ this$._description = description;
63
+ }
64
+
65
+ export function DataContext__get_GeneratedBy(this$) {
66
+ return this$._generatedBy;
67
+ }
68
+
69
+ export function DataContext__set_GeneratedBy_6DFDD678(this$, generatedBy) {
70
+ this$._generatedBy = generatedBy;
71
+ }
72
+
73
+ export function DataContext__AsData(this$) {
74
+ return new Data(unwrap(this$.ID), unwrap(this$.Name), unwrap(this$.DataType), unwrap(this$.Format), unwrap(this$.SelectorFormat), this$.Comments);
75
+ }
76
+
77
+ export function DataContext__Copy(this$) {
78
+ const copy = DataContext_$ctor_Z2FD70A12();
79
+ copy.ID = this$.ID;
80
+ copy.Name = this$.Name;
81
+ copy.DataType = this$.DataType;
82
+ copy.Format = this$.Format;
83
+ copy.SelectorFormat = this$.SelectorFormat;
84
+ DataContext__set_Explication_279AAFF2(copy, DataContext__get_Explication(this$));
85
+ DataContext__set_Unit_279AAFF2(copy, DataContext__get_Unit(this$));
86
+ DataContext__set_ObjectType_279AAFF2(copy, DataContext__get_ObjectType(this$));
87
+ DataContext__set_Description_6DFDD678(copy, DataContext__get_Description(this$));
88
+ DataContext__set_GeneratedBy_6DFDD678(copy, DataContext__get_GeneratedBy(this$));
89
+ copy.Comments = this$.Comments;
90
+ return copy;
91
+ }
92
+
@@ -14,13 +14,15 @@ export const Pattern_TermAnnotationURIPattern = `http://purl.obolibrary.org/obo/
14
14
 
15
15
  export const Pattern_TermAnnotationURIPattern_lessRestrictive = `.*\\/(?<${"idspace"}>\\w+?)[:_](?<${"localid"}>\\w+)`;
16
16
 
17
- export const Pattern_IOTypePattern = `(Input|Output)\\s\\[(?<${"iotype"}>.+)\\]`;
17
+ export const Pattern_TermAnnotationURIPattern_MS_RO_PO = `.*252F(?<${"idspace"}>\\w+?)_(?<${"localid"}>\\w+)`;
18
18
 
19
- export const Pattern_InputPattern = `Input\\s\\[(?<${"iotype"}>.+)\\]`;
19
+ export const Pattern_IOTypePattern = `(Input|Output)\\s*\\[(?<${"iotype"}>.+)\\]`;
20
20
 
21
- export const Pattern_OutputPattern = `Output\\s\\[(?<${"iotype"}>.+)\\]`;
21
+ export const Pattern_InputPattern = `Input\\s*\\[(?<${"iotype"}>.+)\\]`;
22
22
 
23
- export const Pattern_CommentPattern = `Comment\\s\\[(?<${"commentKey"}>.+)\\]`;
23
+ export const Pattern_OutputPattern = `Output\\s*\\[(?<${"iotype"}>.+)\\]`;
24
+
25
+ export const Pattern_CommentPattern = `Comment\\s*\\[(?<${"commentKey"}>.+)\\]`;
24
26
 
25
27
  /**
26
28
  * Matches, if the input string matches the given regex pattern.
@@ -39,7 +41,7 @@ export function ActivePatterns_$007CRegex$007C_$007C(pattern, input) {
39
41
  * Matches any column header starting with some text, followed by one whitespace and a term name inside squared brackets.
40
42
  */
41
43
  export function ActivePatterns_$007CReferenceColumnHeader$007C_$007C(input) {
42
- const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("(Term Source REF|Term Accession Number)\\s\\((?<id>.*)\\)", input);
44
+ const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("(Term Source REF|Term Accession Number)\\s*\\((?<id>.*)\\)", input);
43
45
  if (activePatternResult != null) {
44
46
  const r = activePatternResult;
45
47
  return {
@@ -55,7 +57,7 @@ export function ActivePatterns_$007CReferenceColumnHeader$007C_$007C(input) {
55
57
  * Matches any column header starting with some text, followed by one whitespace and a term name inside squared brackets.
56
58
  */
57
59
  export function ActivePatterns_$007CTermColumn$007C_$007C(input) {
58
- const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("(?<termcolumntype>.+?)\\s\\[(?<termname>.+)\\]", input);
60
+ const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("(?<termcolumntype>.+?)\\s*\\[(?<termname>.+)\\]", input);
59
61
  if (activePatternResult != null) {
60
62
  const r = activePatternResult;
61
63
  return {
@@ -213,7 +215,14 @@ export function ActivePatterns_$007CTermAnnotation$007C_$007C(input) {
213
215
  value = activePatternResult_2;
214
216
  }
215
217
  else {
216
- matchResult = 1;
218
+ const activePatternResult_3 = ActivePatterns_$007CRegex$007C_$007C(Pattern_TermAnnotationURIPattern_MS_RO_PO, input);
219
+ if (activePatternResult_3 != null) {
220
+ matchResult = 0;
221
+ value = activePatternResult_3;
222
+ }
223
+ else {
224
+ matchResult = 1;
225
+ }
217
226
  }
218
227
  }
219
228
  }
@@ -234,7 +243,7 @@ export function ActivePatterns_$007CTermAnnotation$007C_$007C(input) {
234
243
  * Example: "Term Source REF (MS:1003022)" --> term source ref: "MS"; annotation number: "1003022"
235
244
  */
236
245
  export function ActivePatterns_$007CTSRColumnHeader$007C_$007C(input) {
237
- const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("Term Source REF\\s\\((?<id>.*)\\)", input);
246
+ const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("Term Source REF\\s*\\((?<id>.*)\\)", input);
238
247
  if (activePatternResult != null) {
239
248
  const r = activePatternResult;
240
249
  const matchValue = (r.groups && r.groups.id) || "";
@@ -261,7 +270,7 @@ export function ActivePatterns_$007CTSRColumnHeader$007C_$007C(input) {
261
270
  * Example: "Term Accession Number (MS:1003022)" --> term source ref: "MS"; annotation number: "1003022"
262
271
  */
263
272
  export function ActivePatterns_$007CTANColumnHeader$007C_$007C(input) {
264
- const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("Term Accession Number\\s\\((?<id>.*)\\)", input);
273
+ const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("Term Accession Number\\s*\\((?<id>.*)\\)", input);
265
274
  if (activePatternResult != null) {
266
275
  const r = activePatternResult;
267
276
  const matchValue = (r.groups && r.groups.id) || "";
@@ -392,7 +401,14 @@ export function tryParseTermAnnotation(str) {
392
401
  value = activePatternResult_2;
393
402
  }
394
403
  else {
395
- matchResult = 1;
404
+ const activePatternResult_3 = ActivePatterns_$007CRegex$007C_$007C(Pattern_TermAnnotationURIPattern_MS_RO_PO, matchValue);
405
+ if (activePatternResult_3 != null) {
406
+ matchResult = 0;
407
+ value = activePatternResult_3;
408
+ }
409
+ else {
410
+ matchResult = 1;
411
+ }
396
412
  }
397
413
  }
398
414
  }
@@ -0,0 +1,38 @@
1
+ import { Dictionary_tryFind, Dictionary_ofSeq } from "./Collections.js";
2
+
3
+ export function OntobeeParser(tsr, localTan) {
4
+ return `${"http://purl.obolibrary.org/obo/"}${tsr}_${localTan}`;
5
+ }
6
+
7
+ export function BioregistryParser(tsr, localTan) {
8
+ return `${"https://bioregistry.io/"}${tsr}:${localTan}`;
9
+ }
10
+
11
+ export function OntobeeDPBOParser(tsr, localTan) {
12
+ return `${"http://purl.org/nfdi4plants/ontology/dpbo/"}${tsr}_${localTan}`;
13
+ }
14
+
15
+ export function MSParser(tsr, localTan) {
16
+ return `${"https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252F"}${tsr}_${localTan}`;
17
+ }
18
+
19
+ export function POParser(tsr, localTan) {
20
+ return `${"https://www.ebi.ac.uk/ols4/ontologies/po/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252F"}${tsr}_${localTan}`;
21
+ }
22
+
23
+ export function ROParser(tsr, localTan) {
24
+ return `${"https://www.ebi.ac.uk/ols4/ontologies/ro/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252F"}${tsr}_${localTan}`;
25
+ }
26
+
27
+ export const uriParserCollection = Dictionary_ofSeq([["DPBO", (tsr) => ((localTan) => OntobeeDPBOParser(tsr, localTan))], ["MS", (tsr_1) => ((localTan_1) => MSParser(tsr_1, localTan_1))], ["PO", (tsr_2) => ((localTan_2) => POParser(tsr_2, localTan_2))], ["RO", (tsr_3) => ((localTan_3) => ROParser(tsr_3, localTan_3))], ["ENVO", (tsr_4) => ((localTan_4) => BioregistryParser(tsr_4, localTan_4))], ["CHEBI", (tsr_5) => ((localTan_5) => BioregistryParser(tsr_5, localTan_5))], ["GO", (tsr_6) => ((localTan_6) => BioregistryParser(tsr_6, localTan_6))], ["OBI", (tsr_7) => ((localTan_7) => BioregistryParser(tsr_7, localTan_7))], ["PATO", (tsr_8) => ((localTan_8) => BioregistryParser(tsr_8, localTan_8))], ["PECO", (tsr_9) => ((localTan_9) => BioregistryParser(tsr_9, localTan_9))], ["TO", (tsr_10) => ((localTan_10) => BioregistryParser(tsr_10, localTan_10))], ["UO", (tsr_11) => ((localTan_11) => BioregistryParser(tsr_11, localTan_11))], ["EFO", (tsr_12) => ((localTan_12) => BioregistryParser(tsr_12, localTan_12))], ["NCIT", (tsr_13) => ((localTan_13) => BioregistryParser(tsr_13, localTan_13))], ["OMP", (tsr_14) => ((localTan_14) => BioregistryParser(tsr_14, localTan_14))]]);
28
+
29
+ export function createOAUri(tsr, localTan) {
30
+ const matchValue = Dictionary_tryFind(tsr, uriParserCollection);
31
+ if (matchValue == null) {
32
+ return OntobeeParser(tsr, localTan);
33
+ }
34
+ else {
35
+ return matchValue(tsr)(localTan);
36
+ }
37
+ }
38
+
@@ -1,5 +1,6 @@
1
1
  import { value as value_4, defaultArg, unwrap } from "../fable_modules/fable-library-js.4.16.0/Option.js";
2
2
  import { Pattern_TermAnnotationShortPattern, ActivePatterns_$007CRegex$007C_$007C, tryParseTermAnnotation } from "./Helper/Regex.js";
3
+ import { createOAUri } from "./Helper/Url.js";
3
4
  import { StringBuilder__Append_Z721C83C5, StringBuilder_$ctor } from "../fable_modules/fable-library-js.4.16.0/System.Text.js";
4
5
  import { printf, toText, join } from "../fable_modules/fable-library-js.4.16.0/String.js";
5
6
  import { toArray, empty, singleton, append, delay, toList } from "../fable_modules/fable-library-js.4.16.0/Seq.js";
@@ -65,7 +66,7 @@ export class OntologyAnnotation {
65
66
  return defaultArg(this$.Name, "");
66
67
  }
67
68
  static createUriAnnotation(termSourceRef, localTAN) {
68
- return `${"http://purl.obolibrary.org/obo/"}${termSourceRef}_${localTAN}`;
69
+ return createOAUri(termSourceRef, localTAN);
69
70
  }
70
71
  static fromTermAnnotation(tan, name) {
71
72
  const matchValue = tryParseTermAnnotation(tan);
@@ -387,7 +387,7 @@ export function Unchecked_fillMissingCells(headers, values) {
387
387
  if (matchValue == null) {
388
388
  const defaultCell_1 = Unchecked_getEmptyCellForHeader(header, void 0);
389
389
  for (let rowIndex_1 = 0; rowIndex_1 <= (rowCount - 1); rowIndex_1++) {
390
- Unchecked_addCellAt(columnIndex, rowIndex_1, defaultCell_1, values);
390
+ Unchecked_addCellAt(columnIndex, rowIndex_1, defaultCell_1.Copy(), values);
391
391
  }
392
392
  }
393
393
  else if ((col = matchValue, col.length === rowCount)) {
@@ -401,7 +401,7 @@ export function Unchecked_fillMissingCells(headers, values) {
401
401
  });
402
402
  for (let rowIndex = 0; rowIndex <= (rowCount - 1); rowIndex++) {
403
403
  if (!FSharpSet__Contains(rowKeys, rowIndex)) {
404
- Unchecked_addCellAt(columnIndex, rowIndex, defaultCell, values);
404
+ Unchecked_addCellAt(columnIndex, rowIndex, defaultCell.Copy(), values);
405
405
  }
406
406
  }
407
407
  }
@@ -172,6 +172,10 @@ export class CompositeCell extends Union {
172
172
  const this$ = this;
173
173
  return (this$.tag === 1) ? this$.fields[0] : ((this$.tag === 2) ? (`${this$.fields[0]} ${this$.fields[1].NameText}`) : ((this$.tag === 3) ? (`${this$.fields[0].NameText}`) : (`${this$.fields[0].NameText}`)));
174
174
  }
175
+ Copy() {
176
+ const this$ = this;
177
+ 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()]))));
178
+ }
175
179
  static term(oa) {
176
180
  return new CompositeCell(0, [oa]);
177
181
  }
@@ -1,14 +1,11 @@
1
1
  import { CompositeHeader, IOType } from "./CompositeHeader.js";
2
2
  import { OntologyAnnotation } from "../OntologyAnnotation.js";
3
- import { exists as exists_1, ofArray } from "../../fable_modules/fable-library-js.4.16.0/List.js";
4
- import { exists } from "../../fable_modules/fable-library-js.4.16.0/Seq.js";
5
- import { arrayHash, equalArrays, safeHash, equals } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
6
- import { printf, toFail } from "../../fable_modules/fable-library-js.4.16.0/String.js";
7
- import { SanityChecks_validate } from "./ArcTableAux.js";
8
- import { ArcTable } from "./ArcTable.js";
3
+ import { ofArray } from "../../fable_modules/fable-library-js.4.16.0/List.js";
4
+ import { iterateIndexed, map } from "../../fable_modules/fable-library-js.4.16.0/Seq.js";
5
+ import { CompositeCell } from "./CompositeCell.js";
6
+ import { boxHashSeq, hash } from "../Helper/HashCodes.js";
9
7
  import { class_type } from "../../fable_modules/fable-library-js.4.16.0/Reflection.js";
10
- import { Dictionary } from "../../fable_modules/fable-library-js.4.16.0/MutableMap.js";
11
- import { unwrap } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
8
+ import { DataContext__Copy, DataContext__set_Description_6DFDD678, DataContext__get_Description, DataContext__set_ObjectType_279AAFF2, DataContext__get_ObjectType, DataContext__set_Unit_279AAFF2, DataContext__get_Unit, DataContext__set_Explication_279AAFF2, DataContext__get_Explication } from "../DataContext.js";
12
9
 
13
10
  export const DataMapAux_dataHeader = new CompositeHeader(11, [new IOType(2, [])]);
14
11
 
@@ -30,35 +27,75 @@ export const DataMapAux_generatedByHeader = new CompositeHeader(13, ["Generated
30
27
 
31
28
  export const DataMapAux_allowedHeaders = ofArray([DataMapAux_dataHeader, DataMapAux_explicationHeader, DataMapAux_unitHeader, DataMapAux_objectTypeHeader, DataMapAux_descriptionHeader, DataMapAux_generatedByHeader]);
32
29
 
33
- export function DataMapAux_validate(headers, values, raiseException) {
34
- if (exists((h) => {
35
- const hasForeignHeader = !exists_1((ah) => equals(ah, h), DataMapAux_allowedHeaders);
36
- if (raiseException && hasForeignHeader) {
37
- toFail(printf("Header %O is not allowed in DataMap"))(h);
30
+ export function DataMapAux_getOntologyColumn(f, dataContexts) {
31
+ const collection = map((dc) => {
32
+ const matchValue = f(dc);
33
+ if (matchValue == null) {
34
+ return CompositeCell.emptyTerm;
38
35
  }
39
- return hasForeignHeader;
40
- }, headers)) {
41
- return SanityChecks_validate(headers, values, raiseException);
36
+ else {
37
+ return new CompositeCell(0, [matchValue]);
38
+ }
39
+ }, dataContexts);
40
+ return Array.from(collection);
41
+ }
42
+
43
+ export function DataMapAux_getStringColumn(f, dataContexts) {
44
+ const collection = map((dc) => {
45
+ const matchValue = f(dc);
46
+ if (matchValue == null) {
47
+ return CompositeCell.emptyFreeText;
48
+ }
49
+ else {
50
+ return new CompositeCell(1, [matchValue]);
51
+ }
52
+ }, dataContexts);
53
+ return Array.from(collection);
54
+ }
55
+
56
+ export function DataMapAux_setOntologyColumn(f, column, dataContexts) {
57
+ iterateIndexed((i, cell) => {
58
+ if (cell.tag === 0) {
59
+ f(dataContexts[i], cell.fields[0]);
60
+ }
61
+ }, column);
62
+ }
63
+
64
+ export function DataMapAux_setStringColumn(f, column, dataContexts) {
65
+ iterateIndexed((i, cell) => {
66
+ if (cell.tag === 1) {
67
+ f(dataContexts[i], cell.fields[0]);
68
+ }
69
+ }, column);
70
+ }
71
+
72
+ export function DataMapAux_SanityChecks_rowIndexInBoundaries(row, dataContexts) {
73
+ if (row < 0) {
74
+ throw new Error("Row index must be greater or equal to 0.");
75
+ }
76
+ if (row >= dataContexts.length) {
77
+ throw new Error("Row index must be less than the number of rows.");
42
78
  }
43
- else {
44
- return false;
79
+ }
80
+
81
+ export function DataMapAux_SanityChecks_lengthOfNewColumn(newColumn, dataContexts) {
82
+ if (newColumn.length !== dataContexts.length) {
83
+ throw new Error("Length of new column does not match length of data contexts.");
45
84
  }
46
85
  }
47
86
 
48
87
  export class DataMap {
49
- constructor(headers, values) {
50
- DataMapAux_validate(headers, values, true);
51
- this.table = (new ArcTable("DataMap", headers, values));
88
+ constructor(dataContexts) {
52
89
  this.staticHash = 0;
90
+ this["dataContexts@103"] = dataContexts;
53
91
  }
54
92
  Equals(obj) {
55
- let dm;
56
93
  const this$ = this;
57
- return (obj instanceof DataMap) && ((dm = obj, equals(DataMap__get_Table(this$), DataMap__get_Table(dm))));
94
+ return hash(this$) === hash(obj);
58
95
  }
59
96
  GetHashCode() {
60
97
  const this$ = this;
61
- return safeHash(DataMap__get_Table(this$)) | 0;
98
+ return boxHashSeq(this$["dataContexts@103"]) | 0;
62
99
  }
63
100
  }
64
101
 
@@ -66,16 +103,8 @@ export function DataMap_$reflection() {
66
103
  return class_type("ARCtrl.DataMap", void 0, DataMap);
67
104
  }
68
105
 
69
- export function DataMap_$ctor_ZD0829CB(headers, values) {
70
- return new DataMap(headers, values);
71
- }
72
-
73
- export function DataMap__get_Headers(this$) {
74
- return this$.table.Headers;
75
- }
76
-
77
- export function DataMap__get_Values(this$) {
78
- return this$.table.Values;
106
+ export function DataMap_$ctor_4E3220A7(dataContexts) {
107
+ return new DataMap(dataContexts);
79
108
  }
80
109
 
81
110
  export function DataMap__get_StaticHash(this$) {
@@ -86,81 +115,65 @@ export function DataMap__set_StaticHash_Z524259A4(this$, value) {
86
115
  this$.staticHash = (value | 0);
87
116
  }
88
117
 
89
- export function DataMap_init() {
90
- return DataMap_$ctor_ZD0829CB([], new Dictionary([], {
91
- Equals: equalArrays,
92
- GetHashCode: arrayHash,
93
- }));
94
- }
95
-
96
- export function DataMap__AddColumns_6369C010(this$, columns, skipFillMissing) {
97
- columns.forEach((c) => {
98
- c.Validate(true);
99
- });
100
- this$.table.AddColumns(columns, void 0, void 0, unwrap(skipFillMissing));
101
- DataMapAux_validate(this$.table.Headers, this$.table.Values, true);
102
- }
103
-
104
- export function DataMap_addColumns_6369C010(columns, skipFillMissing) {
105
- return (dm) => {
106
- const dm_1 = DataMap__Copy(dm);
107
- DataMap__AddColumns_6369C010(dm_1, columns, unwrap(skipFillMissing));
108
- return dm_1;
109
- };
118
+ export function DataMap__get_DataContexts(this$) {
119
+ return this$["dataContexts@103"];
110
120
  }
111
121
 
112
- export function DataMap__get_Table(this$) {
113
- return this$.table;
114
- }
115
-
116
- export function DataMap__TryGetCellAt_Z37302880(this$, row, column) {
117
- return this$.table.TryGetCellAt(row, column);
122
+ export function DataMap_init() {
123
+ return DataMap_$ctor_4E3220A7([]);
118
124
  }
119
125
 
120
126
  export function DataMap__GetExplicationColumn(this$) {
121
- return this$.table.GetColumnByHeader(DataMapAux_explicationHeader);
127
+ return DataMapAux_getOntologyColumn(DataContext__get_Explication, this$["dataContexts@103"]);
122
128
  }
123
129
 
124
- export function DataMap__AddExplicationColumn_C98E589(this$, cells) {
125
- this$.table.AddColumn(DataMapAux_explicationHeader, cells);
130
+ export function DataMap__SetExplicationColumn_C98E589(this$, cells) {
131
+ DataMapAux_setOntologyColumn((dc, oa) => {
132
+ DataContext__set_Explication_279AAFF2(dc, oa);
133
+ }, cells, this$["dataContexts@103"]);
126
134
  }
127
135
 
128
136
  export function DataMap__GetUnitColumn(this$) {
129
- return this$.table.GetColumnByHeader(DataMapAux_unitHeader);
137
+ return DataMapAux_getOntologyColumn(DataContext__get_Unit, this$["dataContexts@103"]);
130
138
  }
131
139
 
132
- export function DataMap__AddUnitColumn_C98E589(this$, cells) {
133
- this$.table.AddColumn(DataMapAux_unitHeader, cells);
140
+ export function DataMap__SetUnitColumn_C98E589(this$, cells) {
141
+ DataMapAux_setOntologyColumn((dc, oa) => {
142
+ DataContext__set_Unit_279AAFF2(dc, oa);
143
+ }, cells, this$["dataContexts@103"]);
134
144
  }
135
145
 
136
- export function DataMap__GetDataTypeColumn(this$) {
137
- return this$.table.GetColumnByHeader(DataMapAux_objectTypeHeader);
146
+ export function DataMap__GetObjectTypeColumn(this$) {
147
+ return DataMapAux_getOntologyColumn(DataContext__get_ObjectType, this$["dataContexts@103"]);
138
148
  }
139
149
 
140
- export function DataMap__AddDataTypeColumn_C98E589(this$, cells) {
141
- this$.table.AddColumn(DataMapAux_objectTypeHeader, cells);
150
+ export function DataMap__SetDataTypeColumn_C98E589(this$, cells) {
151
+ DataMapAux_setOntologyColumn((dc, oa) => {
152
+ DataContext__set_ObjectType_279AAFF2(dc, oa);
153
+ }, cells, this$["dataContexts@103"]);
142
154
  }
143
155
 
144
156
  export function DataMap__GetDescriptionColumn(this$) {
145
- return this$.table.GetColumnByHeader(DataMapAux_descriptionHeader);
157
+ return DataMapAux_getStringColumn(DataContext__get_Description, this$["dataContexts@103"]);
146
158
  }
147
159
 
148
- export function DataMap__AddDescriptionColumn_C98E589(this$, cells) {
149
- this$.table.AddColumn(DataMapAux_descriptionHeader, cells);
160
+ export function DataMap__SetDescriptionColumn_C98E589(this$, cells) {
161
+ DataMapAux_setStringColumn((dc, s) => {
162
+ DataContext__set_Description_6DFDD678(dc, s);
163
+ }, cells, this$["dataContexts@103"]);
150
164
  }
151
165
 
152
- export function DataMap__GetRow_ABCEF95(this$, row, SkipValidation) {
153
- return this$.table.GetRow(row, unwrap(SkipValidation));
166
+ export function DataMap__GetDataContext_Z58338566(this$, row, SkipValidation) {
167
+ DataMapAux_SanityChecks_rowIndexInBoundaries(row, this$["dataContexts@103"]);
168
+ return this$["dataContexts@103"][row];
154
169
  }
155
170
 
156
- export function DataMap_getRow_ABCEF95(row, SkipValidation) {
157
- return (dm) => DataMap__GetRow_ABCEF95(dm, row, unwrap(SkipValidation));
171
+ export function DataMap_getDataContext_Z58338566(row, SkipValidation) {
172
+ return (dm) => DataMap__GetDataContext_Z58338566(dm, row, SkipValidation);
158
173
  }
159
174
 
160
175
  export function DataMap__Copy(this$) {
161
- return DataMap_$ctor_ZD0829CB(Array.from(DataMap__get_Headers(this$)), new Dictionary(DataMap__get_Values(this$), {
162
- Equals: equalArrays,
163
- GetHashCode: arrayHash,
164
- }));
176
+ let collection;
177
+ return DataMap_$ctor_4E3220A7((collection = map(DataContext__Copy, this$["dataContexts@103"]), Array.from(collection)));
165
178
  }
166
179
 
package/Json/Assay.js CHANGED
@@ -143,6 +143,10 @@ export function ARCtrl_ArcAssay__ArcAssay_toJsonString_Static_71136F3F(spaces) {
143
143
  };
144
144
  }
145
145
 
146
+ export function ARCtrl_ArcAssay__ArcAssay_ToJsonString_71136F3F(this$, spaces) {
147
+ return ARCtrl_ArcAssay__ArcAssay_toJsonString_Static_71136F3F(unwrap(spaces))(this$);
148
+ }
149
+
146
150
  export function ARCtrl_ArcAssay__ArcAssay_fromCompressedJsonString_Static_Z721C83C5(s) {
147
151
  try {
148
152
  const matchValue = fromString(decode(Assay_decoderCompressed), s);
@@ -163,6 +167,10 @@ export function ARCtrl_ArcAssay__ArcAssay_toCompressedJsonString_Static_71136F3F
163
167
  return (obj) => toString(defaultArg(spaces, 0), encode(Assay_encoderCompressed, obj));
164
168
  }
165
169
 
170
+ export function ARCtrl_ArcAssay__ArcAssay_ToCompressedJsonString_71136F3F(this$, spaces) {
171
+ return ARCtrl_ArcAssay__ArcAssay_toCompressedJsonString_Static_71136F3F(unwrap(spaces))(this$);
172
+ }
173
+
166
174
  export function ARCtrl_ArcAssay__ArcAssay_fromROCrateJsonString_Static_Z721C83C5(s) {
167
175
  const matchValue = fromString(Assay_ROCrate_decoder, s);
168
176
  if (matchValue.tag === 1) {
@@ -183,6 +191,10 @@ export function ARCtrl_ArcAssay__ArcAssay_toROCrateJsonString_Static_5CABCA47(st
183
191
  };
184
192
  }
185
193
 
194
+ export function ARCtrl_ArcAssay__ArcAssay_ToROCrateJsonString_5CABCA47(this$, studyName, spaces) {
195
+ return ARCtrl_ArcAssay__ArcAssay_toROCrateJsonString_Static_5CABCA47(unwrap(studyName), unwrap(spaces))(this$);
196
+ }
197
+
186
198
  export function ARCtrl_ArcAssay__ArcAssay_toISAJsonString_Static_71136F3F(spaces) {
187
199
  return (obj) => {
188
200
  const value = Assay_ISAJson_encoder(obj);
@@ -200,3 +212,7 @@ export function ARCtrl_ArcAssay__ArcAssay_fromISAJsonString_Static_Z721C83C5(s)
200
212
  }
201
213
  }
202
214
 
215
+ export function ARCtrl_ArcAssay__ArcAssay_ToISAJsonString_71136F3F(this$, spaces) {
216
+ return ARCtrl_ArcAssay__ArcAssay_toISAJsonString_Static_71136F3F(unwrap(spaces))(this$);
217
+ }
218
+