@genome-spy/core 0.63.0 → 0.65.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 (138) hide show
  1. package/dist/bundle/{index-CCJIjehY.js → AbortablePromiseCache-CcuMrnn7.js} +22 -91
  2. package/dist/bundle/browser-txUcLy2H.js +123 -0
  3. package/dist/bundle/index-BQpbYrv4.js +1712 -0
  4. package/dist/bundle/index-BhtHKLUo.js +73 -0
  5. package/dist/bundle/index-C0llXMqm.js +280 -0
  6. package/dist/bundle/index-CCe8rnZz.js +716 -0
  7. package/dist/bundle/index-CD7FLu9x.js +269 -0
  8. package/dist/bundle/{index-C08YCM2T.js → index-D-w7Mmt9.js} +246 -126
  9. package/dist/bundle/index-D74H8TTz.js +508 -0
  10. package/dist/bundle/index-DhcU-Gk-.js +1487 -0
  11. package/dist/bundle/index.es.js +5394 -4989
  12. package/dist/bundle/index.js +420 -362
  13. package/dist/bundle/inflate-DRgHi_KK.js +1050 -0
  14. package/dist/schema.json +93 -13
  15. package/dist/src/data/collector.d.ts +7 -2
  16. package/dist/src/data/collector.d.ts.map +1 -1
  17. package/dist/src/data/collector.js +13 -2
  18. package/dist/src/data/dataFlow.d.ts +20 -42
  19. package/dist/src/data/dataFlow.d.ts.map +1 -1
  20. package/dist/src/data/dataFlow.js +57 -80
  21. package/dist/src/data/dataFlow.test.js +35 -2
  22. package/dist/src/data/flowHandle.d.ts +15 -0
  23. package/dist/src/data/flowHandle.d.ts.map +1 -0
  24. package/dist/src/data/flowHandle.js +13 -0
  25. package/dist/src/data/flowInit.d.ts +85 -0
  26. package/dist/src/data/flowInit.d.ts.map +1 -0
  27. package/dist/src/data/flowInit.js +238 -0
  28. package/dist/src/data/flowInit.test.d.ts +2 -0
  29. package/dist/src/data/flowInit.test.d.ts.map +1 -0
  30. package/dist/src/data/flowInit.test.js +413 -0
  31. package/dist/src/data/flowOptimizer.d.ts +6 -4
  32. package/dist/src/data/flowOptimizer.d.ts.map +1 -1
  33. package/dist/src/data/flowOptimizer.js +29 -14
  34. package/dist/src/data/flowOptimizer.test.js +20 -15
  35. package/dist/src/data/sources/lazy/bamSource.js +1 -1
  36. package/dist/src/data/sources/lazy/bigBedSource.js +1 -1
  37. package/dist/src/data/sources/lazy/bigWigSource.js +1 -1
  38. package/dist/src/data/sources/lazy/gff3Source.d.ts +2 -6
  39. package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
  40. package/dist/src/data/sources/lazy/gff3Source.js +4 -8
  41. package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
  42. package/dist/src/data/sources/lazy/indexedFastaSource.js +17 -17
  43. package/dist/src/data/sources/lazy/tabixSource.js +1 -1
  44. package/dist/src/genomeSpy.d.ts +1 -1
  45. package/dist/src/genomeSpy.d.ts.map +1 -1
  46. package/dist/src/genomeSpy.js +18 -61
  47. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  48. package/dist/src/gl/webGLHelper.js +8 -0
  49. package/dist/src/marks/link.fragment.glsl.js +1 -1
  50. package/dist/src/marks/link.vertex.glsl.js +1 -1
  51. package/dist/src/marks/mark.d.ts +1 -0
  52. package/dist/src/marks/mark.d.ts.map +1 -1
  53. package/dist/src/marks/mark.js +22 -1
  54. package/dist/src/marks/point.fragment.glsl.js +1 -1
  55. package/dist/src/marks/point.vertex.glsl.js +1 -1
  56. package/dist/src/marks/rect.fragment.glsl.js +1 -1
  57. package/dist/src/marks/rect.vertex.glsl.js +1 -1
  58. package/dist/src/marks/rule.fragment.glsl.js +1 -1
  59. package/dist/src/marks/rule.vertex.glsl.js +1 -1
  60. package/dist/src/marks/text.fragment.glsl.js +1 -1
  61. package/dist/src/marks/text.vertex.glsl.js +1 -1
  62. package/dist/src/selection/selection.d.ts +5 -0
  63. package/dist/src/selection/selection.d.ts.map +1 -1
  64. package/dist/src/selection/selection.js +43 -6
  65. package/dist/src/selection/selection.test.d.ts +2 -0
  66. package/dist/src/selection/selection.test.d.ts.map +1 -0
  67. package/dist/src/selection/selection.test.js +14 -0
  68. package/dist/src/spec/parameter.d.ts +28 -2
  69. package/dist/src/spec/sampleView.d.ts +3 -2
  70. package/dist/src/styles/{genome-spy.scss → genome-spy.css} +25 -21
  71. package/dist/src/styles/genome-spy.css.d.ts +1 -1
  72. package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
  73. package/dist/src/styles/genome-spy.css.js +264 -195
  74. package/dist/src/styles/update.sh +14 -4
  75. package/dist/src/types/viewContext.d.ts +1 -1
  76. package/dist/src/utils/expression.d.ts +5 -0
  77. package/dist/src/utils/expression.d.ts.map +1 -1
  78. package/dist/src/utils/expression.js +37 -0
  79. package/dist/src/utils/interactionEvent.d.ts +18 -1
  80. package/dist/src/utils/interactionEvent.d.ts.map +1 -1
  81. package/dist/src/utils/interactionEvent.js +101 -1
  82. package/dist/src/utils/interactionEvent.test.d.ts +2 -0
  83. package/dist/src/utils/interactionEvent.test.d.ts.map +1 -0
  84. package/dist/src/utils/interactionEvent.test.js +35 -0
  85. package/dist/src/view/axisResolution.d.ts +5 -0
  86. package/dist/src/view/axisResolution.d.ts.map +1 -1
  87. package/dist/src/view/axisResolution.js +16 -1
  88. package/dist/src/view/facetView.d.ts +1 -1
  89. package/dist/src/view/facetView.d.ts.map +1 -1
  90. package/dist/src/view/facetView.js +1 -0
  91. package/dist/src/view/flowBuilder.d.ts +2 -2
  92. package/dist/src/view/flowBuilder.d.ts.map +1 -1
  93. package/dist/src/view/flowBuilder.js +21 -4
  94. package/dist/src/view/gridView/gridView.d.ts.map +1 -1
  95. package/dist/src/view/gridView/gridView.js +13 -0
  96. package/dist/src/view/gridView/selectionRect.d.ts +8 -4
  97. package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
  98. package/dist/src/view/gridView/selectionRect.js +28 -3
  99. package/dist/src/view/gridView/selectionRect.test.d.ts +2 -0
  100. package/dist/src/view/gridView/selectionRect.test.d.ts.map +1 -0
  101. package/dist/src/view/gridView/selectionRect.test.js +87 -0
  102. package/dist/src/view/paramMediator.d.ts +2 -1
  103. package/dist/src/view/paramMediator.d.ts.map +1 -1
  104. package/dist/src/view/paramMediator.js +13 -1
  105. package/dist/src/view/paramMediator.test.js +22 -0
  106. package/dist/src/view/scaleResolution.d.ts +5 -0
  107. package/dist/src/view/scaleResolution.d.ts.map +1 -1
  108. package/dist/src/view/scaleResolution.js +10 -0
  109. package/dist/src/view/testUtils.d.ts.map +1 -1
  110. package/dist/src/view/testUtils.js +16 -4
  111. package/dist/src/view/unitView.d.ts.map +1 -1
  112. package/dist/src/view/unitView.js +103 -10
  113. package/dist/src/view/view.d.ts +17 -1
  114. package/dist/src/view/view.d.ts.map +1 -1
  115. package/dist/src/view/view.js +57 -1
  116. package/dist/src/view/viewDispose.test.d.ts +2 -0
  117. package/dist/src/view/viewDispose.test.d.ts.map +1 -0
  118. package/dist/src/view/viewDispose.test.js +110 -0
  119. package/dist/src/view/viewUtils.d.ts +4 -4
  120. package/dist/src/view/viewUtils.d.ts.map +1 -1
  121. package/dist/src/view/viewUtils.js +19 -15
  122. package/dist/src/view/viewUtils.test.d.ts +2 -0
  123. package/dist/src/view/viewUtils.test.d.ts.map +1 -0
  124. package/dist/src/view/viewUtils.test.js +87 -0
  125. package/package.json +16 -16
  126. package/dist/bundle/__vite-browser-external-C--ziKoh.js +0 -8
  127. package/dist/bundle/_commonjsHelpers-DjF3Plf2.js +0 -26
  128. package/dist/bundle/index-5ajWdKly.js +0 -1319
  129. package/dist/bundle/index-B03-Om4z.js +0 -274
  130. package/dist/bundle/index-BftNdA0O.js +0 -27
  131. package/dist/bundle/index-Bg7C4Xat.js +0 -2750
  132. package/dist/bundle/index-C3QR8Lv6.js +0 -2131
  133. package/dist/bundle/index-DTcHjAHp.js +0 -505
  134. package/dist/bundle/index-DnIkxb0L.js +0 -1025
  135. package/dist/bundle/index-Ww3TAo6_.js +0 -71
  136. package/dist/bundle/index-g8iXgW0W.js +0 -651
  137. package/dist/bundle/long-B-FASCSo.js +0 -2387
  138. package/dist/bundle/remoteFile-BuaqFGWk.js +0 -94
@@ -0,0 +1,269 @@
1
+ var _ = Object.defineProperty;
2
+ var I = (r, e, t) => e in r ? _(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var h = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { LocalFile as d } from "./browser-txUcLy2H.js";
5
+ import { I as b, Z as F } from "./inflate-DRgHi_KK.js";
6
+ const w = 65536, S = w * w;
7
+ function g(r, e = 0) {
8
+ const t = r[e] | r[e + 1] << 8 | r[e + 2] << 16 | r[e + 3] << 24;
9
+ return ((r[e + 4] | r[e + 5] << 8 | r[e + 6] << 16 | r[e + 7] << 24) >>> 0) * S + (t >>> 0);
10
+ }
11
+ const u = 1;
12
+ function m(r, e, t) {
13
+ const n = e[u], s = t ? t[u] : 1 / 0;
14
+ return n <= r && s > r ? 0 : n < r ? -1 : 1;
15
+ }
16
+ class B {
17
+ constructor({ filehandle: e }) {
18
+ h(this, "filehandle");
19
+ h(this, "index");
20
+ this.filehandle = e;
21
+ }
22
+ _getIndex() {
23
+ return this.index || (this.index = this._readIndex().catch((e) => {
24
+ throw this.index = void 0, e;
25
+ })), this.index;
26
+ }
27
+ async _readIndex() {
28
+ const e = await this.filehandle.read(8, 0), t = g(e);
29
+ if (!t)
30
+ return [[0, 0]];
31
+ const n = new Array(t + 1);
32
+ n[0] = [0, 0];
33
+ const s = 8 * 2 * t;
34
+ if (s > Number.MAX_SAFE_INTEGER)
35
+ throw new TypeError("integer overflow");
36
+ const i = await this.filehandle.read(s, 8);
37
+ for (let a = 0; a < t; a += 1) {
38
+ const o = g(i, a * 16), c = g(i, a * 16 + 8);
39
+ n[a + 1] = [o, c];
40
+ }
41
+ return n;
42
+ }
43
+ async getLastBlock() {
44
+ return (await this._getIndex()).at(-1);
45
+ }
46
+ async getRelevantBlocksForRead(e, t) {
47
+ const n = t + e;
48
+ if (e === 0)
49
+ return [];
50
+ const s = await this._getIndex(), i = [];
51
+ let a = 0, o = s.length - 1, c = Math.floor(s.length / 2), l = m(t, s[c], s[c + 1]);
52
+ for (; l !== 0; )
53
+ l > 0 ? o = c - 1 : l < 0 && (a = c + 1), c = Math.ceil((o - a) / 2) + a, l = m(t, s[c], s[c + 1]);
54
+ i.push(s[c]);
55
+ let f = c + 1;
56
+ for (; f < s.length && (i.push(s[f]), !(s[f][u] >= n)); f += 1)
57
+ ;
58
+ return i[i.length - 1][u] < n && i.push([]), i;
59
+ }
60
+ }
61
+ function k(r) {
62
+ let e = 0;
63
+ for (const t of r)
64
+ e += t.length;
65
+ return e;
66
+ }
67
+ function x(r, e) {
68
+ const t = new Uint8Array(e ?? k(r));
69
+ let n = 0;
70
+ for (const s of r)
71
+ t.set(s, n), n += s.length;
72
+ return t;
73
+ }
74
+ async function E(r) {
75
+ try {
76
+ let e, t = 0, n;
77
+ const s = [];
78
+ let i = 0;
79
+ do {
80
+ const a = r.subarray(t);
81
+ if (n = new b(void 0), { strm: e } = n, n.push(a, F), n.err)
82
+ throw new Error(n.msg);
83
+ t += e.next_in;
84
+ const o = n.result;
85
+ s.push(o), i += o.length;
86
+ } while (e.avail_in);
87
+ return x(s, i);
88
+ } catch (e) {
89
+ throw /incorrect header check/.exec(`${e}`) ? new Error("problem decompressing block: incorrect gzip header check") : e;
90
+ }
91
+ }
92
+ class p {
93
+ constructor({ filehandle: e, gziFilehandle: t }) {
94
+ h(this, "filehandle");
95
+ h(this, "gzi");
96
+ this.filehandle = e, this.gzi = new B({
97
+ filehandle: t
98
+ });
99
+ }
100
+ async _readAndUncompressBlock(e, t) {
101
+ let n = t;
102
+ n || (n = (await this.filehandle.stat()).size);
103
+ const s = n - e, i = await this.filehandle.read(s, e);
104
+ return E(i);
105
+ }
106
+ async read(e, t) {
107
+ const n = await this.gzi.getRelevantBlocksForRead(e, t), s = [];
108
+ for (let i = 0; i < n.length - 1; i += 1) {
109
+ const a = await this._readAndUncompressBlock(n[i][0], n[i + 1][0]), [, o] = n[i], c = o >= t ? 0 : t - o, l = Math.min(t + e, o + a.length) - o;
110
+ c >= 0 && c < a.length && s.push(a.subarray(c, l));
111
+ }
112
+ return x(s);
113
+ }
114
+ }
115
+ function y(r, e) {
116
+ return r.offset + r.lineBytes * Math.floor(e / r.lineLength) + e % r.lineLength;
117
+ }
118
+ async function N(r, e = {}) {
119
+ const t = new TextDecoder("utf8");
120
+ return Object.fromEntries(t.decode(await r.readFile(e)).split(/\r?\n/).map((n) => n.trim()).filter((n) => !!n).map((n) => n.split(" ")).map((n) => {
121
+ var s;
122
+ if ((s = n[0]) != null && s.startsWith(">"))
123
+ throw new Error("found > in sequence name, might have supplied FASTA file for the FASTA index");
124
+ return [
125
+ n[0],
126
+ {
127
+ name: n[0],
128
+ length: +n[1],
129
+ start: 0,
130
+ end: +n[1],
131
+ offset: +n[2],
132
+ lineLength: +n[3],
133
+ lineBytes: +n[4]
134
+ }
135
+ ];
136
+ }));
137
+ }
138
+ class A {
139
+ constructor({ fasta: e, fai: t, path: n, faiPath: s }) {
140
+ if (e)
141
+ this.fasta = e;
142
+ else if (n)
143
+ this.fasta = new d(n);
144
+ else
145
+ throw new Error("Need to pass filehandle for fasta or path to localfile");
146
+ if (t)
147
+ this.fai = t;
148
+ else if (s)
149
+ this.fai = new d(s);
150
+ else if (n)
151
+ this.fai = new d(`${n}.fai`);
152
+ else
153
+ throw new Error("Need to pass filehandle for or path to localfile");
154
+ }
155
+ async _getIndexes(e) {
156
+ return this.indexes || (this.indexes = N(this.fai, e).catch((t) => {
157
+ throw this.indexes = void 0, t;
158
+ })), this.indexes;
159
+ }
160
+ /**
161
+ * @returns array of string sequence names that are present in the index, in
162
+ * which the array index indicates the sequence ID, and the value is the
163
+ * sequence name
164
+ */
165
+ async getSequenceNames(e) {
166
+ return Object.keys(await this._getIndexes(e));
167
+ }
168
+ /**
169
+ * @returns array of string sequence names that are present in the index, in
170
+ * which the array index indicates the sequence ID, and the value is the
171
+ * sequence name
172
+ */
173
+ async getSequenceSizes(e) {
174
+ const t = {}, n = await this._getIndexes(e);
175
+ for (const s of Object.values(n))
176
+ t[s.name] = s.length;
177
+ return t;
178
+ }
179
+ /**
180
+ * @returns array of string sequence names that are present in the index, in
181
+ * which the array index indicates the sequence ID, and the value is the
182
+ * sequence name
183
+ */
184
+ async getSequenceSize(e, t) {
185
+ var s;
186
+ return (s = (await this._getIndexes(t))[e]) == null ? void 0 : s.length;
187
+ }
188
+ /**
189
+ * @param name
190
+ *
191
+ * @returns true if the file contains the given reference sequence name
192
+ */
193
+ async hasReferenceSequence(e, t) {
194
+ return !!(await this._getIndexes(t))[e];
195
+ }
196
+ /**
197
+ * @param seqName
198
+ * @param min
199
+ * @param max
200
+ */
201
+ async getResiduesByName(e, t, n, s) {
202
+ const i = (await this._getIndexes(s))[e];
203
+ return i ? this._fetchFromIndexEntry(i, t, n, s) : void 0;
204
+ }
205
+ //alias for getResiduesByName
206
+ async getSequence(e, t, n, s) {
207
+ return this.getResiduesByName(e, t, n, s);
208
+ }
209
+ async _fetchFromIndexEntry(e, t = 0, n, s) {
210
+ let i = n;
211
+ if (t < 0)
212
+ throw new TypeError("regionStart cannot be less than 0");
213
+ if ((i === void 0 || i > e.length) && (i = e.length), t >= i)
214
+ return "";
215
+ const a = y(e, t), o = y(e, i) - a;
216
+ return new TextDecoder("utf8").decode(await this.fasta.read(o, a, s)).replace(/\s+/g, "");
217
+ }
218
+ }
219
+ class O extends A {
220
+ constructor({ fasta: e, path: t, fai: n, faiPath: s, gzi: i, gziPath: a }) {
221
+ super({ fasta: e, path: t, fai: n, faiPath: s }), e && i ? this.fasta = new p({
222
+ filehandle: e,
223
+ gziFilehandle: i
224
+ }) : t && a && (this.fasta = new p({
225
+ filehandle: new d(t),
226
+ gziFilehandle: new d(a)
227
+ }));
228
+ }
229
+ }
230
+ function z(r) {
231
+ return r.split(">").filter((e) => /\S/.test(e)).map((e) => {
232
+ const [t, ...n] = e.split(`
233
+ `), [s, ...i] = t.split(" "), a = n.join("").replace(/\s/g, "");
234
+ return {
235
+ id: s,
236
+ description: i.join(" "),
237
+ sequence: a
238
+ };
239
+ });
240
+ }
241
+ class R {
242
+ constructor({ fasta: e, path: t }) {
243
+ if (e)
244
+ this.fasta = e;
245
+ else if (t)
246
+ this.fasta = new d(t);
247
+ else
248
+ throw new Error("Need to pass fasta or path");
249
+ this.data = this.fasta.readFile().then((n) => {
250
+ const i = new TextDecoder("utf8").decode(n);
251
+ return z(i);
252
+ });
253
+ }
254
+ async fetch(e, t, n) {
255
+ const i = (await this.data).find((o) => o.id === e), a = n - t;
256
+ if (!i)
257
+ throw new Error(`no sequence with id ${e} exists`);
258
+ return i.sequence.slice(t, a);
259
+ }
260
+ async getSequenceNames() {
261
+ return (await this.data).map((t) => t.id);
262
+ }
263
+ }
264
+ export {
265
+ O as BgzipIndexedFasta,
266
+ R as FetchableSmallFasta,
267
+ A as IndexedFasta,
268
+ z as parseSmallFasta
269
+ };