@genome-spy/core 0.64.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 (104) 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 +4878 -4680
  12. package/dist/bundle/index.js +151 -167
  13. package/dist/bundle/inflate-DRgHi_KK.js +1050 -0
  14. package/dist/schema.json +9 -1
  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/marks/mark.d.ts +1 -0
  48. package/dist/src/marks/mark.d.ts.map +1 -1
  49. package/dist/src/marks/mark.js +22 -1
  50. package/dist/src/spec/sampleView.d.ts +3 -2
  51. package/dist/src/types/viewContext.d.ts +1 -1
  52. package/dist/src/view/axisResolution.d.ts +5 -0
  53. package/dist/src/view/axisResolution.d.ts.map +1 -1
  54. package/dist/src/view/axisResolution.js +16 -1
  55. package/dist/src/view/facetView.d.ts.map +1 -1
  56. package/dist/src/view/facetView.js +1 -0
  57. package/dist/src/view/flowBuilder.d.ts +2 -2
  58. package/dist/src/view/flowBuilder.d.ts.map +1 -1
  59. package/dist/src/view/flowBuilder.js +21 -4
  60. package/dist/src/view/gridView/gridView.d.ts.map +1 -1
  61. package/dist/src/view/gridView/gridView.js +13 -0
  62. package/dist/src/view/gridView/selectionRect.d.ts +8 -4
  63. package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
  64. package/dist/src/view/gridView/selectionRect.js +28 -3
  65. package/dist/src/view/gridView/selectionRect.test.d.ts +2 -0
  66. package/dist/src/view/gridView/selectionRect.test.d.ts.map +1 -0
  67. package/dist/src/view/gridView/selectionRect.test.js +87 -0
  68. package/dist/src/view/paramMediator.d.ts +2 -1
  69. package/dist/src/view/paramMediator.d.ts.map +1 -1
  70. package/dist/src/view/paramMediator.js +13 -1
  71. package/dist/src/view/paramMediator.test.js +22 -0
  72. package/dist/src/view/scaleResolution.d.ts +5 -0
  73. package/dist/src/view/scaleResolution.d.ts.map +1 -1
  74. package/dist/src/view/scaleResolution.js +10 -0
  75. package/dist/src/view/testUtils.d.ts.map +1 -1
  76. package/dist/src/view/testUtils.js +16 -4
  77. package/dist/src/view/unitView.d.ts.map +1 -1
  78. package/dist/src/view/unitView.js +58 -8
  79. package/dist/src/view/view.d.ts +17 -1
  80. package/dist/src/view/view.d.ts.map +1 -1
  81. package/dist/src/view/view.js +57 -1
  82. package/dist/src/view/viewDispose.test.d.ts +2 -0
  83. package/dist/src/view/viewDispose.test.d.ts.map +1 -0
  84. package/dist/src/view/viewDispose.test.js +110 -0
  85. package/dist/src/view/viewUtils.d.ts +4 -4
  86. package/dist/src/view/viewUtils.d.ts.map +1 -1
  87. package/dist/src/view/viewUtils.js +19 -15
  88. package/dist/src/view/viewUtils.test.d.ts +2 -0
  89. package/dist/src/view/viewUtils.test.d.ts.map +1 -0
  90. package/dist/src/view/viewUtils.test.js +87 -0
  91. package/package.json +10 -10
  92. package/dist/bundle/__vite-browser-external-C--ziKoh.js +0 -8
  93. package/dist/bundle/_commonjsHelpers-DjF3Plf2.js +0 -26
  94. package/dist/bundle/index-5ajWdKly.js +0 -1319
  95. package/dist/bundle/index-B03-Om4z.js +0 -274
  96. package/dist/bundle/index-BftNdA0O.js +0 -27
  97. package/dist/bundle/index-Bg7C4Xat.js +0 -2750
  98. package/dist/bundle/index-C3QR8Lv6.js +0 -2131
  99. package/dist/bundle/index-DTcHjAHp.js +0 -505
  100. package/dist/bundle/index-DnIkxb0L.js +0 -1025
  101. package/dist/bundle/index-Ww3TAo6_.js +0 -71
  102. package/dist/bundle/index-g8iXgW0W.js +0 -651
  103. package/dist/bundle/long-B-FASCSo.js +0 -2387
  104. package/dist/bundle/remoteFile-BuaqFGWk.js +0 -94
@@ -1,274 +0,0 @@
1
- import { L as g } from "./__vite-browser-external-C--ziKoh.js";
2
- import { b as w } from "./index-BftNdA0O.js";
3
- import { L as _, u as b } from "./long-B-FASCSo.js";
4
- const m = 1;
5
- class I {
6
- constructor({ filehandle: e, path: t }) {
7
- if (e)
8
- this.filehandle = e;
9
- else if (t)
10
- this.filehandle = new g(t);
11
- else
12
- throw new TypeError("either filehandle or path must be defined");
13
- }
14
- _readLongWithOverflow(e, t = 0, s = !0) {
15
- const n = _.fromBytesLE(e.slice(t, t + 8), s);
16
- if (n.greaterThan(Number.MAX_SAFE_INTEGER) || n.lessThan(Number.MIN_SAFE_INTEGER))
17
- throw new TypeError("integer overflow");
18
- return n.toNumber();
19
- }
20
- _getIndex() {
21
- return this.index || (this.index = this._readIndex()), this.index;
22
- }
23
- async _readIndex() {
24
- let e = w.Buffer.allocUnsafe(8);
25
- await this.filehandle.read(e, 0, 8, 0);
26
- const t = this._readLongWithOverflow(e, 0, !0);
27
- if (!t)
28
- return [[0, 0]];
29
- const s = new Array(t + 1);
30
- s[0] = [0, 0];
31
- const n = 8 * 2 * t;
32
- if (n > Number.MAX_SAFE_INTEGER)
33
- throw new TypeError("integer overflow");
34
- e = w.Buffer.allocUnsafe(n), await this.filehandle.read(e, 0, n, 8);
35
- for (let r = 0; r < t; r += 1) {
36
- const i = this._readLongWithOverflow(e, r * 16), l = this._readLongWithOverflow(e, r * 16 + 8);
37
- s[r + 1] = [i, l];
38
- }
39
- return s;
40
- }
41
- async getLastBlock() {
42
- const e = await this._getIndex();
43
- if (e.length)
44
- return e[e.length - 1];
45
- }
46
- async getRelevantBlocksForRead(e, t) {
47
- const s = t + e;
48
- if (e === 0)
49
- return [];
50
- const n = await this._getIndex(), r = [], i = (h, u) => {
51
- const p = h[m], E = u ? u[m] : 1 / 0;
52
- return p <= t && E > t ? 0 : p < t ? -1 : 1;
53
- };
54
- let l = 0, f = n.length - 1, a = Math.floor(n.length / 2), d = i(n[a], n[a + 1]);
55
- for (; d !== 0; )
56
- d > 0 ? f = a - 1 : d < 0 && (l = a + 1), a = Math.ceil((f - l) / 2) + l, d = i(n[a], n[a + 1]);
57
- r.push(n[a]);
58
- let c = a + 1;
59
- for (; c < n.length && (r.push(n[c]), !(n[c][m] >= s)); c += 1)
60
- ;
61
- return r[r.length - 1][m] < s && r.push([]), r;
62
- }
63
- }
64
- class y {
65
- constructor({ filehandle: e, path: t, gziFilehandle: s, gziPath: n }) {
66
- if (e)
67
- this.filehandle = e;
68
- else if (t)
69
- this.filehandle = new g(t);
70
- else
71
- throw new TypeError("either filehandle or path must be defined");
72
- if (!s && !n && !t)
73
- throw new TypeError("either gziFilehandle or gziPath must be defined");
74
- this.gzi = new I({
75
- filehandle: s,
76
- path: !s && !n && t ? n : `${t}.gzi`
77
- });
78
- }
79
- async stat() {
80
- const e = await this.filehandle.stat();
81
- return Object.assign(e, {
82
- size: await this.getUncompressedFileSize(),
83
- blocks: void 0,
84
- blksize: void 0
85
- });
86
- }
87
- async getUncompressedFileSize() {
88
- const [, e] = await this.gzi.getLastBlock(), { size: t } = await this.filehandle.stat(), s = w.Buffer.allocUnsafe(4), { bytesRead: n } = await this.filehandle.read(s, 0, 4, t - 28 - 4);
89
- if (n !== 4)
90
- throw new Error("read error");
91
- const r = s.readUInt32LE(0);
92
- return e + r;
93
- }
94
- async _readAndUncompressBlock(e, [t], [s]) {
95
- let n = s;
96
- n || (n = (await this.filehandle.stat()).size);
97
- const r = n - t;
98
- return await this.filehandle.read(e, 0, r, t), await b(e.slice(0, r));
99
- }
100
- async read(e, t, s, n) {
101
- const r = await this.gzi.getRelevantBlocksForRead(s, n), i = w.Buffer.allocUnsafe(32768 * 2);
102
- let l = t, f = 0;
103
- for (let a = 0; a < r.length - 1; a += 1) {
104
- const d = await this._readAndUncompressBlock(i, r[a], r[a + 1]), [, c] = r[a], h = c >= n ? 0 : n - c, u = Math.min(n + s, c + d.length) - c;
105
- h >= 0 && h < d.length && (d.copy(e, l, h, u), l += u - h, f += u - h);
106
- }
107
- return { bytesRead: f, buffer: e };
108
- }
109
- }
110
- function x(o, e) {
111
- return o.offset + o.lineBytes * Math.floor(e / o.lineLength) + e % o.lineLength;
112
- }
113
- async function S(o, e) {
114
- const t = await o.readFile(e);
115
- if (!(t != null && t.length))
116
- throw new Error("No data read from FASTA index (FAI) file");
117
- let s = 0, n;
118
- const r = t.toString("utf8").split(/\r?\n/).filter((i) => /\S/.test(i)).map((i) => i.split(" ")).filter((i) => i[0] !== "").map((i) => ((!n || n.name !== i[0]) && (n = { name: i[0], id: s }, s += 1), {
119
- id: n.id,
120
- name: i[0],
121
- length: +i[1],
122
- start: 0,
123
- end: +i[1],
124
- offset: +i[2],
125
- lineLength: +i[3],
126
- lineBytes: +i[4]
127
- }));
128
- return {
129
- name: Object.fromEntries(r.map((i) => [i.name, i])),
130
- id: Object.fromEntries(r.map((i) => [i.id, i]))
131
- };
132
- }
133
- class B {
134
- constructor({ fasta: e, fai: t, path: s, faiPath: n }) {
135
- if (e)
136
- this.fasta = e;
137
- else if (s)
138
- this.fasta = new g(s);
139
- else
140
- throw new Error("Need to pass filehandle for fasta or path to localfile");
141
- if (t)
142
- this.fai = t;
143
- else if (n)
144
- this.fai = new g(n);
145
- else if (s)
146
- this.fai = new g(`${s}.fai`);
147
- else
148
- throw new Error("Need to pass filehandle for or path to localfile");
149
- }
150
- async _getIndexes(e) {
151
- return this.indexes || (this.indexes = S(this.fai, e)), this.indexes;
152
- }
153
- /**
154
- * @returns {array[string]} array of string sequence
155
- * names that are present in the index, in which the
156
- * array index indicates the sequence ID, and the value
157
- * is the sequence name
158
- */
159
- async getSequenceNames(e) {
160
- return Object.keys((await this._getIndexes(e)).name);
161
- }
162
- /**
163
- * @returns {array[string]} array of string sequence
164
- * names that are present in the index, in which the
165
- * array index indicates the sequence ID, and the value
166
- * is the sequence name
167
- */
168
- async getSequenceSizes(e) {
169
- const t = {}, s = await this._getIndexes(e);
170
- for (const n of Object.values(s.id))
171
- t[n.name] = n.length;
172
- return t;
173
- }
174
- /**
175
- * @returns {array[string]} array of string sequence
176
- * names that are present in the index, in which the
177
- * array index indicates the sequence ID, and the value
178
- * is the sequence name
179
- */
180
- async getSequenceSize(e, t) {
181
- var s;
182
- return (s = (await this._getIndexes(t)).name[e]) === null || s === void 0 ? void 0 : s.length;
183
- }
184
- /**
185
- *
186
- * @param {string} name
187
- * @returns {Promise[boolean]} true if the file contains the given reference sequence name
188
- */
189
- async hasReferenceSequence(e, t) {
190
- return !!(await this._getIndexes(t)).name[e];
191
- }
192
- /**
193
- *
194
- * @param {number} seqId
195
- * @param {number} min
196
- * @param {number} max
197
- */
198
- async getResiduesById(e, t, s, n) {
199
- const r = (await this._getIndexes(n)).id[e];
200
- if (r)
201
- return this._fetchFromIndexEntry(r, t, s, n);
202
- }
203
- /**
204
- * @param {string} seqName
205
- * @param {number} min
206
- * @param {number} max
207
- */
208
- async getResiduesByName(e, t, s, n) {
209
- const r = (await this._getIndexes(n)).name[e];
210
- if (r)
211
- return this._fetchFromIndexEntry(r, t, s, n);
212
- }
213
- //alias for getResiduesByName
214
- async getSequence(e, t, s, n) {
215
- return this.getResiduesByName(e, t, s, n);
216
- }
217
- async _fetchFromIndexEntry(e, t = 0, s, n) {
218
- let r = s;
219
- if (t < 0)
220
- throw new TypeError("regionStart cannot be less than 0");
221
- if ((r === void 0 || r > e.length) && (r = e.length), t >= r)
222
- return "";
223
- const i = x(e, t), l = x(e, r) - i, f = w.Buffer.allocUnsafe(l);
224
- return await this.fasta.read(f, 0, l, i, n), f.toString("utf8").replace(/\s+/g, "");
225
- }
226
- }
227
- class v extends B {
228
- constructor({ fasta: e, path: t, fai: s, faiPath: n, gzi: r, gziPath: i }) {
229
- super({ fasta: e, path: t, fai: s, faiPath: n }), e && r ? this.fasta = new y({
230
- filehandle: e,
231
- gziFilehandle: r
232
- }) : t && i && (this.fasta = new y({ path: t, gziPath: i }));
233
- }
234
- }
235
- function F(o) {
236
- return o.split(">").filter((e) => /\S/.test(e)).map((e) => {
237
- const [t, ...s] = e.split(`
238
- `), [n, ...r] = t.split(" "), i = s.join("").replace(/\s/g, "");
239
- return {
240
- id: n,
241
- description: r.join(" "),
242
- sequence: i
243
- };
244
- });
245
- }
246
- class O {
247
- constructor({ fasta: e, path: t }) {
248
- if (e)
249
- this.fasta = e;
250
- else if (t)
251
- this.fasta = new g(t);
252
- else
253
- throw new Error("Need to pass fasta or path");
254
- this.data = this.fasta.readFile().then((s) => {
255
- const n = s.toString("utf8");
256
- return F(n);
257
- });
258
- }
259
- async fetch(e, t, s) {
260
- const r = (await this.data).find((l) => l.id === e), i = s - t;
261
- if (!r)
262
- throw new Error(`no sequence with id ${e} exists`);
263
- return r.sequence.slice(t, i);
264
- }
265
- async getSequenceNames() {
266
- return (await this.data).map((t) => t.id);
267
- }
268
- }
269
- export {
270
- v as BgzipIndexedFasta,
271
- O as FetchableSmallFasta,
272
- B as IndexedFasta,
273
- F as parseSmallFasta
274
- };
@@ -1,27 +0,0 @@
1
- import { g as i } from "./_commonjsHelpers-DjF3Plf2.js";
2
- import { r as s } from "./index-DnIkxb0L.js";
3
- function u(t, n) {
4
- for (var o = 0; o < n.length; o++) {
5
- const e = n[o];
6
- if (typeof e != "string" && !Array.isArray(e)) {
7
- for (const r in e)
8
- if (r !== "default" && !(r in t)) {
9
- const f = Object.getOwnPropertyDescriptor(e, r);
10
- f && Object.defineProperty(t, r, f.get ? f : {
11
- enumerable: !0,
12
- get: () => e[r]
13
- });
14
- }
15
- }
16
- }
17
- return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }));
18
- }
19
- var a = s();
20
- const c = /* @__PURE__ */ i(a), l = /* @__PURE__ */ u({
21
- __proto__: null,
22
- default: c
23
- }, [a]);
24
- export {
25
- a as b,
26
- l as i
27
- };