@sjcrh/proteinpaint-shared 2.186.0 → 2.188.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 (117) hide show
  1. package/README.md +10 -2
  2. package/constants/AiHisto.ts +27 -0
  3. package/constants/README.md +11 -0
  4. package/devTs.ts +3 -0
  5. package/dist/constants/AiHisto.d.ts +23 -0
  6. package/dist/constants/AiHisto.js +31 -0
  7. package/dist/constants/AiHisto.js.map +7 -0
  8. package/dist/src/aiHisto.d.ts +5 -0
  9. package/dist/src/aiHisto.js +15 -0
  10. package/dist/src/aiHisto.js.map +7 -0
  11. package/dist/src/bulk.cnv.js +83 -0
  12. package/dist/src/bulk.cnv.js.map +7 -0
  13. package/dist/src/bulk.del.js +119 -0
  14. package/dist/src/bulk.del.js.map +7 -0
  15. package/dist/src/bulk.itd.js +119 -0
  16. package/dist/src/bulk.itd.js.map +7 -0
  17. package/dist/src/bulk.js +183 -0
  18. package/dist/src/bulk.js.map +7 -0
  19. package/dist/src/bulk.snv.js +175 -0
  20. package/dist/src/bulk.snv.js.map +7 -0
  21. package/dist/src/bulk.sv.js +266 -0
  22. package/dist/src/bulk.sv.js.map +7 -0
  23. package/dist/src/bulk.svjson.js +151 -0
  24. package/dist/src/bulk.svjson.js.map +7 -0
  25. package/dist/src/bulk.trunc.js +122 -0
  26. package/dist/src/bulk.trunc.js.map +7 -0
  27. package/dist/src/clustering.js +71 -0
  28. package/dist/src/clustering.js.map +7 -0
  29. package/dist/src/common.js +1302 -0
  30. package/dist/src/common.js.map +7 -0
  31. package/dist/src/compute.percentile.js +10 -0
  32. package/dist/src/compute.percentile.js.map +7 -0
  33. package/dist/src/doc.d.ts +7 -0
  34. package/dist/src/doc.js +10 -0
  35. package/dist/src/doc.js.map +7 -0
  36. package/dist/src/fetch-helpers.js +177 -0
  37. package/dist/src/fetch-helpers.js.map +7 -0
  38. package/dist/src/fileSize.js +10 -0
  39. package/dist/src/fileSize.js.map +7 -0
  40. package/dist/src/filter.d.ts +62 -0
  41. package/dist/src/filter.js +194 -0
  42. package/dist/src/filter.js.map +7 -0
  43. package/dist/src/hash.js +20 -0
  44. package/dist/src/hash.js.map +7 -0
  45. package/dist/src/helpers.js +66 -0
  46. package/dist/src/helpers.js.map +7 -0
  47. package/dist/src/index.d.ts +26 -0
  48. package/dist/src/index.js +27 -0
  49. package/dist/src/index.js.map +7 -0
  50. package/dist/src/joinUrl.d.ts +1 -0
  51. package/dist/src/joinUrl.js +17 -0
  52. package/dist/src/joinUrl.js.map +7 -0
  53. package/dist/src/mds3tk.js +64 -0
  54. package/dist/src/mds3tk.js.map +7 -0
  55. package/dist/src/roundValue.js +57 -0
  56. package/dist/src/roundValue.js.map +7 -0
  57. package/dist/src/termdb.bins.js +272 -0
  58. package/dist/src/termdb.bins.js.map +7 -0
  59. package/dist/src/termdb.initbinconfig.js +79 -0
  60. package/dist/src/termdb.initbinconfig.js.map +7 -0
  61. package/dist/src/termdb.usecase.js +239 -0
  62. package/dist/src/termdb.usecase.js.map +7 -0
  63. package/dist/src/terms.d.ts +83 -0
  64. package/dist/src/terms.js +327 -0
  65. package/dist/src/terms.js.map +7 -0
  66. package/dist/src/time.d.ts +9 -0
  67. package/dist/src/time.js +23 -0
  68. package/dist/src/time.js.map +7 -0
  69. package/dist/src/tree.js +82 -0
  70. package/dist/src/tree.js.map +7 -0
  71. package/dist/src/urljson.d.ts +8 -0
  72. package/dist/src/urljson.js +31 -0
  73. package/dist/src/urljson.js.map +7 -0
  74. package/dist/src/vcf.ann.js +56 -0
  75. package/dist/src/vcf.ann.js.map +7 -0
  76. package/dist/src/vcf.csq.js +82 -0
  77. package/dist/src/vcf.csq.js.map +7 -0
  78. package/dist/src/vcf.info.js +40 -0
  79. package/dist/src/vcf.info.js.map +7 -0
  80. package/dist/src/vcf.js +439 -0
  81. package/dist/src/vcf.js.map +7 -0
  82. package/dist/src/vcf.type.js +17 -0
  83. package/dist/src/vcf.type.js.map +7 -0
  84. package/package.json +20 -11
  85. package/src/bulk.cnv.js +0 -86
  86. package/src/bulk.del.js +0 -124
  87. package/src/bulk.itd.js +0 -123
  88. package/src/bulk.js +0 -197
  89. package/src/bulk.snv.js +0 -271
  90. package/src/bulk.sv.js +0 -276
  91. package/src/bulk.svjson.js +0 -164
  92. package/src/bulk.trunc.js +0 -132
  93. package/src/clustering.js +0 -66
  94. package/src/common.js +0 -1608
  95. package/src/compute.percentile.js +0 -11
  96. package/src/doc.js +0 -6
  97. package/src/fetch-helpers.js +0 -323
  98. package/src/fileSize.js +0 -6
  99. package/src/filter.js +0 -221
  100. package/src/hash.js +0 -21
  101. package/src/helpers.js +0 -88
  102. package/src/index.js +0 -26
  103. package/src/joinUrl.js +0 -14
  104. package/src/mds3tk.js +0 -100
  105. package/src/roundValue.js +0 -94
  106. package/src/termdb.bins.js +0 -456
  107. package/src/termdb.initbinconfig.js +0 -130
  108. package/src/termdb.usecase.js +0 -317
  109. package/src/terms.js +0 -341
  110. package/src/time.js +0 -22
  111. package/src/tree.js +0 -138
  112. package/src/urljson.js +0 -41
  113. package/src/vcf.ann.js +0 -62
  114. package/src/vcf.csq.js +0 -153
  115. package/src/vcf.info.js +0 -50
  116. package/src/vcf.js +0 -654
  117. package/src/vcf.type.js +0 -24
@@ -0,0 +1,272 @@
1
+ import { format } from "d3-format";
2
+ import { getColors } from "./common.js";
3
+ import { isNumeric, isStrictNumeric, convertUnits } from "./helpers.js";
4
+ function validate_bins(binconfig) {
5
+ const bc = binconfig;
6
+ if (!bc || typeof bc !== "object") throw "bin schema must be an object";
7
+ if (!("type" in bc)) bc.type = "regular-bin";
8
+ if (bc.type == "custom-bin") {
9
+ if (!Array.isArray(bc.lst)) throw "binconfig.lst must be an array";
10
+ if (!bc.lst.length) throw "binconfig.lst must have entries";
11
+ const first_bin = bc.lst[0];
12
+ const last_bin = bc.lst[bc.lst.length - 1];
13
+ for (const bin of bc.lst) {
14
+ if (!("startinclusive" in bin) && !("stopinclusive" in bin)) {
15
+ throw "custom bin.startinclusive and/or bin.stopinclusive must be defined";
16
+ }
17
+ if (bin == first_bin) {
18
+ if ("startunbounded" in bin && !bin.startunbounded) {
19
+ throw `a custom first bin must not set bin.startunbounded to false`;
20
+ }
21
+ bin.startunbounded = true;
22
+ if ("start" in bin) {
23
+ throw "a custom first bin must not set a bin.start value";
24
+ }
25
+ if ("start_percentile" in bin) {
26
+ throw "the first bin must not set a bin.start_percentile value";
27
+ }
28
+ if (!("stop" in bin)) {
29
+ throw `a custom first bin must define a bin.stop value`;
30
+ }
31
+ if (!isStrictNumeric(bin.stop)) {
32
+ throw `a custom first bin.stop value should be numeric`;
33
+ }
34
+ } else if (bin == last_bin) {
35
+ if (!("start" in bin)) {
36
+ throw `a custom last bin must define a bin.start value`;
37
+ }
38
+ if (!isStrictNumeric(bin.start)) {
39
+ throw `a custom last bin.start must be numeric`;
40
+ }
41
+ if ("stopunbounded" in bin && !bin.stopunbounded) {
42
+ throw "a custom last bin must not set bin.stopunbounded to false";
43
+ }
44
+ bin.stopunbounded = true;
45
+ if ("stop" in bin) {
46
+ throw "a custom last bin must not set a bin.stop value";
47
+ }
48
+ } else {
49
+ if (bin.startunbounded || bin.stopunbounded) {
50
+ throw "bin.startunbounded and bin.stopunbounded must not be set for non-first/non-last bins";
51
+ }
52
+ if (!isStrictNumeric(bin.start)) throw "bin.start must be numeric for a non-first bin";
53
+ if (!isStrictNumeric(bin.stop)) throw "bin.stop must be numeric for a non-last bin";
54
+ }
55
+ }
56
+ } else if (bc.type == "regular-bin") {
57
+ if (!Number.isFinite(bc.bin_size)) throw "non-numeric bin_size";
58
+ if (bc.bin_size <= 0) throw "bin_size must be greater than 0";
59
+ if (!bc.startinclusive && !bc.stopinclusive) {
60
+ bc.startinclusive = 1;
61
+ bc.stopinclusive = 0;
62
+ }
63
+ if (!bc.first_bin) throw "first_bin{} missing";
64
+ if (typeof bc.first_bin != "object") throw "first_bin{} is not an object";
65
+ if (!Object.keys(bc.first_bin).length) throw "first_bin is an empty object";
66
+ {
67
+ const b = bc.first_bin;
68
+ b.startunbounded = true;
69
+ if (b.stop_percentile) {
70
+ if (!Number.isInteger(b.stop_percentile)) throw "first_bin.stop_percentile should be integer";
71
+ if (b.stop_percentile <= 0 || b.stop_percentile >= 100) throw "first_bin.stop_percentile out of bound (0-100)";
72
+ } else if (!Number.isFinite(b.stop)) {
73
+ throw "first_bin.stop not a number when stop_percentile is not set";
74
+ }
75
+ }
76
+ if (bc.last_bin) {
77
+ const b = bc.last_bin;
78
+ if (b.start_percentile) {
79
+ if (!Number.isInteger(b.start_percentile)) throw "last_bin.start_percentile should be integer";
80
+ if (b.start_percentile <= 0 || b.start_percentile >= 100) throw "last_bin.start_percentile out of bound (0-100)";
81
+ } else if (!Number.isFinite(b.start)) {
82
+ throw "last_bin.start not a number when start_percentile is not set";
83
+ }
84
+ b.stopunbounded = true;
85
+ if ("stop" in b) {
86
+ throw "a regular last bin must not set a bin.stop value";
87
+ }
88
+ }
89
+ } else {
90
+ throw `invalid binconfig.type="${bc.type}"`;
91
+ }
92
+ }
93
+ function compute_bins(binconfig, summaryfxn, valueConversion) {
94
+ const bc = binconfig;
95
+ validate_bins(bc);
96
+ if (bc.lst) {
97
+ const k2c2 = getColors(bc.lst.length);
98
+ for (const bin of bc.lst) bin.color = k2c2(bin.label);
99
+ }
100
+ if (bc.type == "custom-bin") return JSON.parse(JSON.stringify(bc.lst));
101
+ if (typeof summaryfxn != "function") throw "summaryfxn required for modules/termdb.bins.js compute_bins()";
102
+ const percentiles = target_percentiles(bc);
103
+ const summary = summaryfxn(percentiles);
104
+ if (!summary || typeof summary !== "object") throw "invalid returned value by summaryfxn";
105
+ bc.results = { summary };
106
+ if (!bc.binLabelFormatter) bc.binLabelFormatter = getNumDecimalsFormatter(bc);
107
+ const minFloor = Math.floor(summary.min * 100) / 100;
108
+ const maxCeil = Math.ceil(summary.max * 100) / 100;
109
+ const min = bc.first_bin.startunbounded ? minFloor : bc.first_bin.start_percentile ? summary["p" + bc.first_bin.start_percentile] : bc.first_bin.start;
110
+ let max = maxCeil, last_start, last_stop;
111
+ if (bc.last_bin) {
112
+ max = bc.last_bin.stopunbounded ? maxCeil : bc.last_bin.stop_percentile ? summary["p" + bc.last_bin.stop_percentile] : isNumeric(bc.last_bin.stop) && bc.last_bin.stop <= summary.max ? bc.last_bin.stop : maxCeil;
113
+ last_start = isStrictNumeric(bc.last_bin.start_percentile) ? summary["p" + bc.last_bin.start_percentile] : isStrictNumeric(bc.last_bin.start) ? bc.last_bin.start : void 0;
114
+ last_stop = bc.last_bin.stopunbounded ? null : bc.last_bin.stop_percentile ? summary["p" + bc.last_bin.stop_percentile] : isStrictNumeric(bc.last_bin.stop) ? bc.last_bin.stop : null;
115
+ } else if (bc.lst) {
116
+ const last_bin = bc.lst[bc.lst.length - 1];
117
+ last_start = last_bin.start;
118
+ last_stop = "stop" in last_bin && !last_bin.stopunbounded ? last_bin.stop : maxCeil;
119
+ max = last_stop;
120
+ } else {
121
+ last_start = maxCeil;
122
+ last_stop = maxCeil;
123
+ }
124
+ const numericMax = isStrictNumeric(max);
125
+ const numericLastStart = isStrictNumeric(last_start);
126
+ const numericLastStop = isStrictNumeric(last_stop);
127
+ if (!numericMax && !numericLastStart) return [];
128
+ const bins = [];
129
+ let currBin = {
130
+ startunbounded: bc.first_bin.startunbounded,
131
+ start: bc.first_bin.startunbounded ? void 0 : min,
132
+ stop: isStrictNumeric(bc.first_bin.stop_percentile) ? +summary["p" + bc.first_bin.stop_percentile] : isStrictNumeric(bc.first_bin.stop) ? +bc.first_bin.stop : min + bc.bin_size,
133
+ startinclusive: bc.startinclusive,
134
+ stopinclusive: bc.stopinclusive
135
+ };
136
+ if (!isStrictNumeric(currBin.stop)) throw "the computed first_bin.stop is non-numeric" + currBin.stop;
137
+ const maxNumBins = 100;
138
+ while (numericMax && currBin.stop <= max || currBin.startunbounded && !bins.length || currBin.stopunbounded) {
139
+ bins.push(currBin);
140
+ if (currBin.stop >= max) {
141
+ currBin.stopunbounded = true;
142
+ if (bins.length > 1) {
143
+ delete currBin.stop;
144
+ }
145
+ }
146
+ currBin.label = get_bin_label(currBin, bc, valueConversion);
147
+ if (currBin.stopunbounded) break;
148
+ const upper = currBin.stop + bc.bin_size;
149
+ const previousStop = currBin.stop;
150
+ currBin = {
151
+ startinclusive: bc.startinclusive,
152
+ stopinclusive: bc.stopinclusive,
153
+ start: previousStop,
154
+ stop: numericLastStop && (previousStop == last_start || upper > last_stop) ? last_stop : numericLastStart && upper > last_start && previousStop != last_start ? last_start : upper
155
+ };
156
+ if (currBin.stop >= max) {
157
+ currBin.stop = max;
158
+ if (bc.last_bin && bc.last_bin.stopunbounded) currBin.stopunbounded = 1;
159
+ if (bc.last_bin && bc.last_bin.stopinclusive) currBin.stopinclusive = 1;
160
+ }
161
+ if (numericLastStart && currBin.start == last_start) {
162
+ if (bc.last_bin && bc.last_bin.stopunbounded) currBin.stopunbounded = 1;
163
+ }
164
+ if (currBin.start > currBin.stop) {
165
+ if (numericLastStart && currBin.stop == last_start && bc.last_bin && bc.last_bin.stopunbounded)
166
+ currBin.stopunbounded = true;
167
+ else break;
168
+ }
169
+ if (bins.length + 1 >= maxNumBins) {
170
+ bc.error = "max_num_bins_reached";
171
+ break;
172
+ }
173
+ }
174
+ delete bc.binLabelFormatter;
175
+ if (bins.length > 1) {
176
+ delete bins[bins.length - 1].stop;
177
+ }
178
+ const k2c = getColors(bins.length);
179
+ for (const bin of bins) bin.color = k2c(bin.label);
180
+ return bins;
181
+ }
182
+ function getNumDecimalsFormatter(bc) {
183
+ return "rounding" in bc ? format(bc.rounding) : (d) => d;
184
+ }
185
+ function get_bin_label(bin, binconfig, valueConversion) {
186
+ if (!bin) return "missing bin.label";
187
+ if (bin.label) return bin.label;
188
+ const bc = binconfig;
189
+ if (!bc.binLabelFormatter) bc.binLabelFormatter = getNumDecimalsFormatter(bc);
190
+ if (!bin.startunbounded && !bin.stopunbounded && !("startinclusive" in bin) && !("stopinclusive" in bin)) {
191
+ if (bc.startinclusive) bin.startinclusive = true;
192
+ else if (bc.stopinclusive) bin.stopinclusive = true;
193
+ }
194
+ const start = bc.use_as == "bins" || bin.start;
195
+ const stop = bc.use_as == "bins" || bin.stop;
196
+ let label_offset = 0;
197
+ if ("label_offset" in bc) {
198
+ bc.label_offset_ignored = "bin_size" in bc && bc.bin_size < bc.label_offset;
199
+ if (!bc.label_offset_ignored) label_offset = bc.label_offset;
200
+ } else if (bc.bin_size === 1 && bc.termtype == "integer") {
201
+ label_offset = 1;
202
+ }
203
+ if (bin.startunbounded) {
204
+ const oper = bin.stopinclusive ? "\u2264" : "<";
205
+ const v1 = valueConversion ? convertUnits(stop, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true) : bc.binLabelFormatter(stop);
206
+ return oper + v1;
207
+ }
208
+ if (bin.stopunbounded || start === stop) {
209
+ const oper = bin.startinclusive ? "\u2265" : ">";
210
+ const v0 = valueConversion ? convertUnits(start, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true) : bc.binLabelFormatter(start);
211
+ return oper + v0;
212
+ }
213
+ if (label_offset && bin.startinclusive && !bin.stopinclusive) {
214
+ if (Number.isInteger(bc.bin_size) && Math.abs(start - stop) === label_offset) {
215
+ return "" + (valueConversion ? convertUnits(start, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true) : bc.binLabelFormatter(start));
216
+ } else {
217
+ const v0 = valueConversion ? convertUnits(start, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true) : bc.binLabelFormatter(start);
218
+ const v1 = valueConversion ? convertUnits(
219
+ stop - label_offset,
220
+ valueConversion.fromUnit,
221
+ valueConversion.toUnit,
222
+ valueConversion.scaleFactor,
223
+ true
224
+ ) : bc.binLabelFormatter(stop - label_offset);
225
+ return +v0 >= +v1 ? v0.toString() : v0 + " to " + v1;
226
+ }
227
+ } else {
228
+ const oper0 = bin.startinclusive ? "" : ">";
229
+ const oper1 = bin.stopinclusive ? "" : "<";
230
+ const v0 = valueConversion ? convertUnits(start, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true) : Number.isInteger(start) ? start : bc.binLabelFormatter(start);
231
+ const v1 = valueConversion ? convertUnits(stop, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true) : Number.isInteger(stop) ? stop : bc.binLabelFormatter(stop);
232
+ if (+v0 >= +v1) {
233
+ const oper = bin.startinclusive ? "\u2265" : ">";
234
+ return oper + v0;
235
+ } else {
236
+ return oper0 + v0 + " to " + oper1 + v1;
237
+ }
238
+ }
239
+ }
240
+ function get_bin_range_equation(bin, binconfig) {
241
+ const x = '<span style="font-family:Times;font-style:italic;">x</span>';
242
+ let range_eq;
243
+ const copy = structuredClone(bin);
244
+ copy.label = "";
245
+ const bin_label = get_bin_label(copy, binconfig);
246
+ if (bin.startunbounded || bin.stopunbounded) {
247
+ range_eq = x + " " + bin_label;
248
+ } else if (bin.startinclusive) {
249
+ range_eq = bin_label.replace("to <", "\u2264 " + x + " <");
250
+ } else if (bin.stopinclusive) {
251
+ range_eq = bin_label.replace(">", "").replace("to", "< " + x + " \u2264");
252
+ }
253
+ return range_eq;
254
+ }
255
+ function target_percentiles(binconfig) {
256
+ const percentiles = [];
257
+ const f = binconfig.first_bin;
258
+ if (f && isStrictNumeric(f.start_percentile)) percentiles.push(f.start_percentile);
259
+ if (f && isStrictNumeric(f.stop_percentile)) percentiles.push(f.stop_percentile);
260
+ const l = binconfig.last_bin;
261
+ if (l && isStrictNumeric(l.start_percentile)) percentiles.push(l.start_percentile);
262
+ if (l && isStrictNumeric(l.stop_percentile)) percentiles.push(l.stop_percentile);
263
+ return percentiles;
264
+ }
265
+ export {
266
+ compute_bins,
267
+ validate_bins as default,
268
+ get_bin_label,
269
+ get_bin_range_equation,
270
+ target_percentiles
271
+ };
272
+ //# sourceMappingURL=termdb.bins.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/termdb.bins.js"],
4
+ "sourcesContent": ["import { format } from 'd3-format'\nimport { getColors } from './common.js'\nimport { isNumeric, isStrictNumeric, convertUnits } from './helpers.js'\n\nexport default function validate_bins(binconfig) {\n\t// Number.isFinite('1') returns false, which is desired\n\n\tconst bc = binconfig\n\tif (!bc || typeof bc !== 'object') throw 'bin schema must be an object'\n\t// assign default type\n\tif (!('type' in bc)) bc.type = 'regular-bin'\n\n\tif (bc.type == 'custom-bin') {\n\t\tif (!Array.isArray(bc.lst)) throw 'binconfig.lst must be an array'\n\t\tif (!bc.lst.length) throw 'binconfig.lst must have entries'\n\t\tconst first_bin = bc.lst[0]\n\t\tconst last_bin = bc.lst[bc.lst.length - 1]\n\n\t\tfor (const bin of bc.lst) {\n\t\t\tif (!('startinclusive' in bin) && !('stopinclusive' in bin)) {\n\t\t\t\tthrow 'custom bin.startinclusive and/or bin.stopinclusive must be defined'\n\t\t\t}\n\n\t\t\tif (bin == first_bin) {\n\t\t\t\tif ('startunbounded' in bin && !bin.startunbounded) {\n\t\t\t\t\tthrow `a custom first bin must not set bin.startunbounded to false`\n\t\t\t\t}\n\t\t\t\tbin.startunbounded = true\n\t\t\t\tif ('start' in bin) {\n\t\t\t\t\tthrow 'a custom first bin must not set a bin.start value'\n\t\t\t\t}\n\t\t\t\tif ('start_percentile' in bin) {\n\t\t\t\t\tthrow 'the first bin must not set a bin.start_percentile value'\n\t\t\t\t}\n\t\t\t\tif (!('stop' in bin)) {\n\t\t\t\t\tthrow `a custom first bin must define a bin.stop value`\n\t\t\t\t}\n\t\t\t\tif (!isStrictNumeric(bin.stop)) {\n\t\t\t\t\tthrow `a custom first bin.stop value should be numeric`\n\t\t\t\t}\n\t\t\t} else if (bin == last_bin) {\n\t\t\t\tif (!('start' in bin)) {\n\t\t\t\t\tthrow `a custom last bin must define a bin.start value`\n\t\t\t\t}\n\t\t\t\tif (!isStrictNumeric(bin.start)) {\n\t\t\t\t\tthrow `a custom last bin.start must be numeric`\n\t\t\t\t}\n\t\t\t\tif ('stopunbounded' in bin && !bin.stopunbounded) {\n\t\t\t\t\tthrow 'a custom last bin must not set bin.stopunbounded to false'\n\t\t\t\t}\n\t\t\t\tbin.stopunbounded = true\n\t\t\t\tif ('stop' in bin) {\n\t\t\t\t\tthrow 'a custom last bin must not set a bin.stop value'\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (bin.startunbounded || bin.stopunbounded) {\n\t\t\t\t\tthrow 'bin.startunbounded and bin.stopunbounded must not be set for non-first/non-last bins'\n\t\t\t\t}\n\t\t\t\tif (!isStrictNumeric(bin.start)) throw 'bin.start must be numeric for a non-first bin'\n\t\t\t\tif (!isStrictNumeric(bin.stop)) throw 'bin.stop must be numeric for a non-last bin'\n\t\t\t}\n\t\t}\n\t} else if (bc.type == 'regular-bin') {\n\t\t// required custom_bin parameter\n\t\tif (!Number.isFinite(bc.bin_size)) throw 'non-numeric bin_size'\n\t\tif (bc.bin_size <= 0) throw 'bin_size must be greater than 0'\n\n\t\tif (!bc.startinclusive && !bc.stopinclusive) {\n\t\t\tbc.startinclusive = 1\n\t\t\tbc.stopinclusive = 0\n\t\t}\n\n\t\tif (!bc.first_bin) throw 'first_bin{} missing'\n\t\tif (typeof bc.first_bin != 'object') throw 'first_bin{} is not an object'\n\t\tif (!Object.keys(bc.first_bin).length) throw 'first_bin is an empty object'\n\n\t\t{\n\t\t\tconst b = bc.first_bin\n\t\t\tb.startunbounded = true\n\t\t\t// requires stop_percentile, or stop\n\t\t\tif (b.stop_percentile) {\n\t\t\t\tif (!Number.isInteger(b.stop_percentile)) throw 'first_bin.stop_percentile should be integer'\n\t\t\t\tif (b.stop_percentile <= 0 || b.stop_percentile >= 100) throw 'first_bin.stop_percentile out of bound (0-100)'\n\t\t\t} else if (!Number.isFinite(b.stop)) {\n\t\t\t\tthrow 'first_bin.stop not a number when stop_percentile is not set'\n\t\t\t}\n\t\t}\n\n\t\tif (bc.last_bin) {\n\t\t\tconst b = bc.last_bin\n\t\t\t// requires start_percentile or start\n\t\t\tif (b.start_percentile) {\n\t\t\t\tif (!Number.isInteger(b.start_percentile)) throw 'last_bin.start_percentile should be integer'\n\t\t\t\tif (b.start_percentile <= 0 || b.start_percentile >= 100) throw 'last_bin.start_percentile out of bound (0-100)'\n\t\t\t} else if (!Number.isFinite(b.start)) {\n\t\t\t\tthrow 'last_bin.start not a number when start_percentile is not set'\n\t\t\t}\n\n\t\t\tb.stopunbounded = true\n\t\t\tif ('stop' in b) {\n\t\t\t\tthrow 'a regular last bin must not set a bin.stop value'\n\t\t\t}\n\t\t}\n\t} else {\n\t\tthrow `invalid binconfig.type=\"${bc.type}\"`\n\t}\n}\n\nexport function compute_bins(binconfig, summaryfxn, valueConversion) {\n\t/*\n Bins generator\n \nbinconfig \n configuration of bins per the Numerical Binning Scheme\n\nsummaryfxn (percentiles)=> return {min, max, pX, pY, ...}\n - required function\n\n - must accept an array of desired percentile values\n and returns an object of computed properties\n {\n min: minimum value\n max: maximum value\n pX: percentile at X value, so p10 will be 10th percentile value\n pY: .. corresponding to the desired percentile values \n }\n*/\n\tconst bc = binconfig\n\n\tvalidate_bins(bc)\n\tif (bc.lst) {\n\t\tconst k2c = getColors(bc.lst.length) //to color bins\n\t\tfor (const bin of bc.lst) bin.color = k2c(bin.label)\n\t}\n\tif (bc.type == 'custom-bin') return JSON.parse(JSON.stringify(bc.lst))\n\tif (typeof summaryfxn != 'function') throw 'summaryfxn required for modules/termdb.bins.js compute_bins()'\n\tconst percentiles = target_percentiles(bc)\n\tconst summary = summaryfxn(percentiles)\n\tif (!summary || typeof summary !== 'object') throw 'invalid returned value by summaryfxn'\n\tbc.results = { summary }\n\tif (!bc.binLabelFormatter) bc.binLabelFormatter = getNumDecimalsFormatter(bc)\n\n\t// round the min and max values for use as bin start and stop\n\t// in the first and last bins, respectively\n\tconst minFloor = Math.floor(summary.min * 100) / 100\n\tconst maxCeil = Math.ceil(summary.max * 100) / 100\n\tconst min = bc.first_bin.startunbounded\n\t\t? minFloor\n\t\t: bc.first_bin.start_percentile\n\t\t? summary['p' + bc.first_bin.start_percentile]\n\t\t: bc.first_bin.start\n\tlet max = maxCeil, // in order to include the max value in the last bin\n\t\tlast_start,\n\t\tlast_stop\n\n\tif (bc.last_bin) {\n\t\tmax = bc.last_bin.stopunbounded\n\t\t\t? maxCeil // in order to include the max value in the last bin\n\t\t\t: bc.last_bin.stop_percentile\n\t\t\t? summary['p' + bc.last_bin.stop_percentile]\n\t\t\t: isNumeric(bc.last_bin.stop) && bc.last_bin.stop <= summary.max // '0.0088' < 0.0088\n\t\t\t? bc.last_bin.stop\n\t\t\t: maxCeil // in order to include the max value in the last bin\n\t\tlast_start = isStrictNumeric(bc.last_bin.start_percentile)\n\t\t\t? summary['p' + bc.last_bin.start_percentile]\n\t\t\t: isStrictNumeric(bc.last_bin.start)\n\t\t\t? bc.last_bin.start\n\t\t\t: undefined\n\t\tlast_stop = bc.last_bin.stopunbounded\n\t\t\t? null\n\t\t\t: bc.last_bin.stop_percentile\n\t\t\t? summary['p' + bc.last_bin.stop_percentile]\n\t\t\t: isStrictNumeric(bc.last_bin.stop)\n\t\t\t? bc.last_bin.stop\n\t\t\t: null\n\t} else if (bc.lst) {\n\t\tconst last_bin = bc.lst[bc.lst.length - 1]\n\t\tlast_start = last_bin.start\n\t\tlast_stop = 'stop' in last_bin && !last_bin.stopunbounded ? last_bin.stop : maxCeil\n\t\tmax = last_stop\n\t} else {\n\t\tlast_start = maxCeil\n\t\tlast_stop = maxCeil\n\t}\n\n\tconst numericMax = isStrictNumeric(max)\n\tconst numericLastStart = isStrictNumeric(last_start)\n\tconst numericLastStop = isStrictNumeric(last_stop)\n\n\tif (!numericMax && !numericLastStart) return [] //throw 'unable to compute the last bin start or stop'\n\n\tconst bins = []\n\tlet currBin = {\n\t\tstartunbounded: bc.first_bin.startunbounded,\n\t\tstart: bc.first_bin.startunbounded ? undefined : min,\n\t\tstop: isStrictNumeric(bc.first_bin.stop_percentile)\n\t\t\t? +summary['p' + bc.first_bin.stop_percentile]\n\t\t\t: isStrictNumeric(bc.first_bin.stop)\n\t\t\t? +bc.first_bin.stop\n\t\t\t: min + bc.bin_size,\n\t\tstartinclusive: bc.startinclusive,\n\t\tstopinclusive: bc.stopinclusive\n\t}\n\n\tif (!isStrictNumeric(currBin.stop)) throw 'the computed first_bin.stop is non-numeric' + currBin.stop\n\tconst maxNumBins = 100 // harcoded limit for now to not stress sqlite\n\n\twhile ((numericMax && currBin.stop <= max) || (currBin.startunbounded && !bins.length) || currBin.stopunbounded) {\n\t\tbins.push(currBin)\n\t\t// force a computed last bin to have stopunbounded true\n\t\tif (currBin.stop >= max) {\n\t\t\tcurrBin.stopunbounded = true\n\t\t\tif (bins.length > 1) {\n\t\t\t\tdelete currBin.stop\n\t\t\t}\n\t\t}\n\t\tcurrBin.label = get_bin_label(currBin, bc, valueConversion)\n\t\tif (currBin.stopunbounded) break\n\n\t\tconst upper = currBin.stop + bc.bin_size\n\t\tconst previousStop = currBin.stop\n\t\tcurrBin = {\n\t\t\tstartinclusive: bc.startinclusive,\n\t\t\tstopinclusive: bc.stopinclusive,\n\t\t\tstart: previousStop,\n\t\t\tstop:\n\t\t\t\tnumericLastStop && (previousStop == last_start || upper > last_stop)\n\t\t\t\t\t? last_stop\n\t\t\t\t\t: numericLastStart && upper > last_start && previousStop != last_start\n\t\t\t\t\t? last_start\n\t\t\t\t\t: upper\n\t\t}\n\n\t\tif (currBin.stop >= max) {\n\t\t\tcurrBin.stop = max\n\t\t\tif (bc.last_bin && bc.last_bin.stopunbounded) currBin.stopunbounded = 1\n\t\t\tif (bc.last_bin && bc.last_bin.stopinclusive) currBin.stopinclusive = 1\n\t\t}\n\t\tif (numericLastStart && currBin.start == last_start) {\n\t\t\tif (bc.last_bin && bc.last_bin.stopunbounded) currBin.stopunbounded = 1\n\t\t}\n\t\tif (currBin.start > currBin.stop) {\n\t\t\tif (numericLastStart && currBin.stop == last_start && bc.last_bin && bc.last_bin.stopunbounded)\n\t\t\t\tcurrBin.stopunbounded = true\n\t\t\telse break\n\t\t}\n\t\tif (bins.length + 1 >= maxNumBins) {\n\t\t\tbc.error = 'max_num_bins_reached'\n\t\t\tbreak\n\t\t}\n\t}\n\tdelete bc.binLabelFormatter\n\tif (bins.length > 1) {\n\t\tdelete bins[bins.length - 1].stop\n\t}\n\tconst k2c = getColors(bins.length) //to color bins\n\tfor (const bin of bins) bin.color = k2c(bin.label)\n\treturn bins\n}\n\nfunction getNumDecimalsFormatter(bc) {\n\t//return format('rounding' in bc ? bc.rounding : '')\n\treturn 'rounding' in bc ? format(bc.rounding) : d => d // default to labeling using the start/stop value as-is\n}\n\nexport function get_bin_label(bin, binconfig, valueConversion) {\n\t/*\n Generate a numeric bin label given a bin configuration and an optional term valueConversion object\n*/\n\tif (!bin) return 'missing bin.label'\n\tif (bin.label) return bin.label\n\n\tconst bc = binconfig\n\tif (!bc.binLabelFormatter) bc.binLabelFormatter = getNumDecimalsFormatter(bc)\n\tif (!bin.startunbounded && !bin.stopunbounded && !('startinclusive' in bin) && !('stopinclusive' in bin)) {\n\t\tif (bc.startinclusive) bin.startinclusive = true\n\t\telse if (bc.stopinclusive) bin.stopinclusive = true\n\t}\n\n\tconst start = bc.use_as == 'bins' || bin.start\n\tconst stop = bc.use_as == 'bins' || bin.stop\n\n\tlet label_offset = 0\n\tif ('label_offset' in bc) {\n\t\tbc.label_offset_ignored = 'bin_size' in bc && bc.bin_size < bc.label_offset\n\t\tif (!bc.label_offset_ignored) label_offset = bc.label_offset\n\t} else if (bc.bin_size === 1 && bc.termtype == 'integer') {\n\t\tlabel_offset = 1\n\t}\n\n\t// one side-unbounded bins\n\t// label will be \">v\" or \"<v\"\n\tif (bin.startunbounded) {\n\t\tconst oper = bin.stopinclusive ? '\u2264' : '<' // \\u2264\n\t\tconst v1 = valueConversion\n\t\t\t? convertUnits(stop, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true)\n\t\t\t: bc.binLabelFormatter(stop) //bin.startinclusive && label_offset ? stop - label_offset : stop)\n\t\treturn oper + v1\n\t}\n\t// a data value may coincide with the last bin's start\n\tif (bin.stopunbounded || start === stop) {\n\t\tconst oper = bin.startinclusive /*|| label_offset*/ ? '\u2265' : '>' // \\u2265\n\t\tconst v0 = valueConversion\n\t\t\t? convertUnits(start, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true)\n\t\t\t: bc.binLabelFormatter(start) //bin.startinclusive || start == min ? start : start + label_offset)\n\t\treturn oper + v0\n\t}\n\n\t// two-sided bins\n\tif (label_offset && bin.startinclusive && !bin.stopinclusive) {\n\t\tif (Number.isInteger(bc.bin_size) && Math.abs(start - stop) === label_offset) {\n\t\t\t// make a simpler label when the range simply spans the bin_size\n\t\t\treturn (\n\t\t\t\t'' +\n\t\t\t\t(valueConversion\n\t\t\t\t\t? convertUnits(start, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true)\n\t\t\t\t\t: bc.binLabelFormatter(start))\n\t\t\t)\n\t\t} else {\n\t\t\tconst v0 = valueConversion\n\t\t\t\t? convertUnits(start, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true)\n\t\t\t\t: bc.binLabelFormatter(start)\n\t\t\tconst v1 = valueConversion\n\t\t\t\t? convertUnits(\n\t\t\t\t\t\tstop - label_offset,\n\t\t\t\t\t\tvalueConversion.fromUnit,\n\t\t\t\t\t\tvalueConversion.toUnit,\n\t\t\t\t\t\tvalueConversion.scaleFactor,\n\t\t\t\t\t\ttrue\n\t\t\t\t )\n\t\t\t\t: bc.binLabelFormatter(stop - label_offset)\n\t\t\t// ensure that last two bin labels make sense (the last is stopunbounded)\n\t\t\treturn +v0 >= +v1 ? v0.toString() : v0 + ' to ' + v1\n\t\t}\n\t} else {\n\t\t// stop_inclusive || label_offset == 0\n\t\tconst oper0 = bin.startinclusive ? '' : '>'\n\t\tconst oper1 = bin.stopinclusive ? '' : '<'\n\t\tconst v0 = valueConversion\n\t\t\t? convertUnits(start, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true)\n\t\t\t: Number.isInteger(start)\n\t\t\t? start\n\t\t\t: bc.binLabelFormatter(start)\n\t\tconst v1 = valueConversion\n\t\t\t? convertUnits(stop, valueConversion.fromUnit, valueConversion.toUnit, valueConversion.scaleFactor, true)\n\t\t\t: Number.isInteger(stop)\n\t\t\t? stop\n\t\t\t: bc.binLabelFormatter(stop)\n\t\t// after rounding the bin labels, the bin start may equal the last bin stop as derived from actual data\n\t\tif (+v0 >= +v1) {\n\t\t\tconst oper = bin.startinclusive ? '\u2265' : '>' // \\u2265\n\t\t\treturn oper + v0\n\t\t} else {\n\t\t\treturn oper0 + v0 + ' to ' + oper1 + v1\n\t\t}\n\t}\n}\n\n// get bin range equation from bin label and bin properties\nexport function get_bin_range_equation(bin, binconfig) {\n\tconst x = '<span style=\"font-family:Times;font-style:italic;\">x</span>'\n\tlet range_eq\n\t// should always use computed (not user-customized) bin label to determine bin range text\n\tconst copy = structuredClone(bin)\n\tcopy.label = '' // mutate only the copy, and not the original bin argument\n\tconst bin_label = get_bin_label(copy, binconfig)\n\tif (bin.startunbounded || bin.stopunbounded) {\n\t\t// first or last bins, e.g. x \u2264 14 and x > 16\n\t\trange_eq = x + ' ' + bin_label\n\t} else if (bin.startinclusive) {\n\t\t// bins with startinclusive, e.g. 14 \u2264 x < 16\n\t\trange_eq = bin_label.replace('to <', '\u2264 ' + x + ' <')\n\t} else if (bin.stopinclusive) {\n\t\t// bins with stopinclusive, e.g. 14 < x \u2264 16\n\t\trange_eq = bin_label.replace('>', '').replace('to', '< ' + x + ' \u2264')\n\t}\n\treturn range_eq\n}\n\nexport function target_percentiles(binconfig) {\n\tconst percentiles = []\n\tconst f = binconfig.first_bin\n\tif (f && isStrictNumeric(f.start_percentile)) percentiles.push(f.start_percentile)\n\tif (f && isStrictNumeric(f.stop_percentile)) percentiles.push(f.stop_percentile)\n\tconst l = binconfig.last_bin\n\tif (l && isStrictNumeric(l.start_percentile)) percentiles.push(l.start_percentile)\n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AAQ,MAAM,OAAO,IAAI,SAAI;AAAA,EACpE;AACA,SAAO;AACR;AAEO,SAAS,mBAAmB,WAAW;AAC7C,QAAM,cAAc,CAAC;AACrB,QAAM,IAAI,UAAU;AACpB,MAAI,KAAK,gBAAgB,EAAE,gBAAgB,EAAG,aAAY,KAAK,EAAE,gBAAgB;AACjF,MAAI,KAAK,gBAAgB,EAAE,eAAe,EAAG,aAAY,KAAK,EAAE,eAAe;AAC/E,QAAM,IAAI,UAAU;AACpB,MAAI,KAAK,gBAAgB,EAAE,gBAAgB,EAAG,aAAY,KAAK,EAAE,gBAAgB;AACjF,MAAI,KAAK,gBAAgB,EAAE,eAAe,EAAG,aAAY,KAAK,EAAE,eAAe;AAC/E,SAAO;AACR;",
6
+ "names": ["k2c"]
7
+ }
@@ -0,0 +1,79 @@
1
+ function initBinConfig(data, opts = {}) {
2
+ if (!data.length)
3
+ return { mode: "discrete", type: "regular-bin", startinclusive: true, bin_size: null, first_bin: { stop: null } };
4
+ if (data.find((d) => !Number.isFinite(d))) throw new Error("non-numeric values found");
5
+ let binConfig;
6
+ const s = new Set(data);
7
+ if (s.size === 1) {
8
+ const value = [...s][0];
9
+ binConfig = {
10
+ type: "custom-bin",
11
+ lst: [
12
+ { stop: value, stopinclusive: false, startunbounded: true, label: "<" + value },
13
+ { start: value, stop: value, startinclusive: true, stopinclusive: true, label: "=" + value },
14
+ { start: value, startinclusive: false, stopunbounded: true, label: ">" + value }
15
+ ]
16
+ };
17
+ } else {
18
+ data.sort((a, b) => a - b);
19
+ const l = data.length;
20
+ const min = data[0];
21
+ const max = data[l - 1];
22
+ const p5idx = Math.ceil(l * 0.05) - 1;
23
+ const p98idx = Math.ceil(l * 0.98) - 1;
24
+ const p5 = data[p5idx];
25
+ const p98 = data[p98idx];
26
+ const binSize = p98 != p5 ? (p98 - p5) / 8 : (max - min) / 8;
27
+ const firstBinStop = Math.max(min + binSize, p5);
28
+ let [binSize_rnd, firstBinStop_rnd, lastBinStart_rnd, rounding] = roundBinVals(binSize, firstBinStop, max, min);
29
+ binConfig = {
30
+ type: "regular-bin",
31
+ startinclusive: true,
32
+ bin_size: binSize_rnd,
33
+ first_bin: { stop: firstBinStop_rnd }
34
+ };
35
+ if (lastBinStart_rnd) binConfig.last_bin = { start: lastBinStart_rnd };
36
+ if (rounding) binConfig.rounding = rounding;
37
+ }
38
+ if ("format" in opts) {
39
+ if (opts.format === "string") {
40
+ return JSON.stringify(binConfig);
41
+ } else {
42
+ throw "options are not in the correct format";
43
+ }
44
+ } else {
45
+ return binConfig;
46
+ }
47
+ }
48
+ function roundBinVals(binSize, firstBinStop, max, min) {
49
+ let binSize_rnd, firstBinStop_rnd, lastBinStart_rnd, rounding;
50
+ const log = Math.floor(Math.log10(binSize));
51
+ if (binSize >= 0.1 && binSize <= 2) {
52
+ binSize_rnd = Math.round(binSize / (1 * 10 ** log)) * (1 * 10 ** log);
53
+ firstBinStop_rnd = Math.round(firstBinStop / (1 * 10 ** log)) * (1 * 10 ** log);
54
+ } else {
55
+ binSize_rnd = Math.round(binSize / (5 * 10 ** log)) * (5 * 10 ** log);
56
+ firstBinStop_rnd = Math.round(firstBinStop / (5 * 10 ** log)) * (5 * 10 ** log);
57
+ if (binSize_rnd === 0) binSize_rnd = 1 * 10 ** log;
58
+ if (firstBinStop_rnd === 0) firstBinStop_rnd = 1 * 10 ** log;
59
+ if (binSize_rnd === 5 * 10 ** log && firstBinStop_rnd === 1 * 10 ** log) firstBinStop_rnd = 5 * 10 ** log;
60
+ }
61
+ if (firstBinStop_rnd < min) firstBinStop_rnd = firstBinStop_rnd * 2;
62
+ const eighthBinStop_rnd = firstBinStop_rnd + binSize_rnd * 7;
63
+ if (max > eighthBinStop_rnd) {
64
+ lastBinStart_rnd = firstBinStop_rnd + binSize_rnd * 6;
65
+ }
66
+ if (binSize < 1) {
67
+ const digits = Math.abs(log);
68
+ binSize_rnd = Number(binSize_rnd.toFixed(digits));
69
+ firstBinStop_rnd = Number(firstBinStop_rnd.toFixed(digits));
70
+ if (lastBinStart_rnd) lastBinStart_rnd = Number(lastBinStart_rnd.toFixed(digits));
71
+ rounding = "." + digits + "f";
72
+ }
73
+ if (Object.is(firstBinStop_rnd, -0)) firstBinStop_rnd = 0;
74
+ return [binSize_rnd, firstBinStop_rnd, lastBinStart_rnd, rounding];
75
+ }
76
+ export {
77
+ initBinConfig as default
78
+ };
79
+ //# sourceMappingURL=termdb.initbinconfig.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/termdb.initbinconfig.js"],
4
+ "sourcesContent": ["/*\nInitialize a bin configuration for a numeric dataset\n<data>: array of numeric data values\n<opts> (optional): object of options\n {}: output bin config as JavaScript object (default)\n {format: 'string'}: output bin config as JSON string\n*/\nexport default function initBinConfig(data, opts = {}) {\n\tif (!data.length)\n\t\treturn { mode: 'discrete', type: 'regular-bin', startinclusive: true, bin_size: null, first_bin: { stop: null } }\n\tif (data.find(d => !Number.isFinite(d))) throw new Error('non-numeric values found')\n\n\tlet binConfig\n\tconst s = new Set(data)\n\tif (s.size === 1) {\n\t\t// single unique value in data array\n\t\t// prepare custom bin config for 3 bins: first bin\n\t\t// for values less than the value, second bin for values\n\t\t// equal to the value, and third bin one for values\n\t\t// greater than the value\n\t\t// all data values will fall into the second bin\n\t\tconst value = [...s][0]\n\t\tbinConfig = {\n\t\t\ttype: 'custom-bin',\n\t\t\tlst: [\n\t\t\t\t{ stop: value, stopinclusive: false, startunbounded: true, label: '<' + value },\n\t\t\t\t{ start: value, stop: value, startinclusive: true, stopinclusive: true, label: '=' + value },\n\t\t\t\t{ start: value, startinclusive: false, stopunbounded: true, label: '>' + value }\n\t\t\t]\n\t\t}\n\t} else {\n\t\t// multiple unique values in data array\n\t\t// prepare regular bin config\n\n\t\t// compute the bin size for a maximum bin number of 8\n\t\tdata.sort((a, b) => a - b)\n\t\tconst l = data.length\n\t\tconst min = data[0]\n\t\tconst max = data[l - 1]\n\t\tconst p5idx = Math.ceil(l * 0.05) - 1\n\t\tconst p98idx = Math.ceil(l * 0.98) - 1\n\t\tconst p5 = data[p5idx]\n\t\tconst p98 = data[p98idx]\n\t\t// use 98th and 5th percentiles to compute bin size to reduce outlier influence\n\t\t// if 98th = 5th, use max and min instead\n\t\tconst binSize = p98 != p5 ? (p98 - p5) / 8 : (max - min) / 8\n\t\t// first bin stop will equal either (minimum + bin size) or (5th percentile), whichever is larger.\n\t\tconst firstBinStop = Math.max(min + binSize, p5)\n\t\t// round the bin values\n\t\tlet [binSize_rnd, firstBinStop_rnd, lastBinStart_rnd, rounding] = roundBinVals(binSize, firstBinStop, max, min)\n\t\t// generate the bin configuration\n\t\tbinConfig = {\n\t\t\ttype: 'regular-bin',\n\t\t\tstartinclusive: true,\n\t\t\tbin_size: binSize_rnd,\n\t\t\tfirst_bin: { stop: firstBinStop_rnd }\n\t\t}\n\t\tif (lastBinStart_rnd) binConfig.last_bin = { start: lastBinStart_rnd }\n\t\tif (rounding) binConfig.rounding = rounding\n\t}\n\tif ('format' in opts) {\n\t\tif (opts.format === 'string') {\n\t\t\treturn JSON.stringify(binConfig)\n\t\t} else {\n\t\t\tthrow 'options are not in the correct format'\n\t\t}\n\t} else {\n\t\treturn binConfig\n\t}\n}\n\nfunction roundBinVals(binSize, firstBinStop, max, min) {\n\tlet binSize_rnd, firstBinStop_rnd, lastBinStart_rnd, rounding\n\tconst log = Math.floor(Math.log10(binSize))\n\tif (binSize >= 0.1 && binSize <= 2) {\n\t\t// Round to the nearest one for small bin sizes\n\t\tbinSize_rnd = Math.round(binSize / (1 * 10 ** log)) * (1 * 10 ** log)\n\t\tfirstBinStop_rnd = Math.round(firstBinStop / (1 * 10 ** log)) * (1 * 10 ** log)\n\t} else {\n\t\t// Round to the nearest five for large bin sizes\n\t\tbinSize_rnd = Math.round(binSize / (5 * 10 ** log)) * (5 * 10 ** log)\n\t\tfirstBinStop_rnd = Math.round(firstBinStop / (5 * 10 ** log)) * (5 * 10 ** log)\n\t\tif (binSize_rnd === 0) binSize_rnd = 1 * 10 ** log\n\t\tif (firstBinStop_rnd === 0) firstBinStop_rnd = 1 * 10 ** log\n\t\tif (binSize_rnd === 5 * 10 ** log && firstBinStop_rnd === 1 * 10 ** log) firstBinStop_rnd = 5 * 10 ** log\n\t}\n\tif (firstBinStop_rnd < min) firstBinStop_rnd = firstBinStop_rnd * 2\n\t// if the number of bins is above 8 after rounding, then set the last bin start to restrict the number of bins to 8\n\tconst eighthBinStop_rnd = firstBinStop_rnd + binSize_rnd * 7\n\tif (max > eighthBinStop_rnd) {\n\t\tlastBinStart_rnd = firstBinStop_rnd + binSize_rnd * 6\n\t}\n\tif (binSize < 1) {\n\t\tconst digits = Math.abs(log)\n\t\tbinSize_rnd = Number(binSize_rnd.toFixed(digits))\n\t\tfirstBinStop_rnd = Number(firstBinStop_rnd.toFixed(digits))\n\t\tif (lastBinStart_rnd) lastBinStart_rnd = Number(lastBinStart_rnd.toFixed(digits))\n\t\trounding = '.' + digits + 'f'\n\t}\n\tif (Object.is(firstBinStop_rnd, -0)) firstBinStop_rnd = 0\n\treturn [binSize_rnd, firstBinStop_rnd, lastBinStart_rnd, rounding]\n}\n"],
5
+ "mappings": "AAOe,SAAR,cAA+B,MAAM,OAAO,CAAC,GAAG;AACtD,MAAI,CAAC,KAAK;AACT,WAAO,EAAE,MAAM,YAAY,MAAM,eAAe,gBAAgB,MAAM,UAAU,MAAM,WAAW,EAAE,MAAM,KAAK,EAAE;AACjH,MAAI,KAAK,KAAK,OAAK,CAAC,OAAO,SAAS,CAAC,CAAC,EAAG,OAAM,IAAI,MAAM,0BAA0B;AAEnF,MAAI;AACJ,QAAM,IAAI,IAAI,IAAI,IAAI;AACtB,MAAI,EAAE,SAAS,GAAG;AAOjB,UAAM,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;AACtB,gBAAY;AAAA,MACX,MAAM;AAAA,MACN,KAAK;AAAA,QACJ,EAAE,MAAM,OAAO,eAAe,OAAO,gBAAgB,MAAM,OAAO,MAAM,M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