@genome-spy/app 1.0.0 → 1.1.1

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 (39) hide show
  1. package/dist/SharedReadCache-Ey5QIiPM.js +207 -0
  2. package/dist/{agentApi-Z65dw-sD.js → agentApi-sPuuT0KS.js} +3573 -3485
  3. package/dist/agentApi.es.js +1550 -1461
  4. package/dist/agentShared.es.js +2 -2
  5. package/dist/{canvas2d-t_N10CeW.js → canvas2d-MXaFeZnP.js} +4 -4
  6. package/dist/{canvas2d-DiPQvNtZ.js → canvas2d-iDK4BC5j.js} +4 -4
  7. package/dist/{debug-CVAlrcZt.js → debug-BlqDxTw3.js} +2 -2
  8. package/dist/{debug-DP4WzTNo.js → debug-DbigmdrK.js} +2 -2
  9. package/dist/esm-C-6g-SkZ.js +791 -0
  10. package/dist/{esm-L53qjcYH.js → esm-CJeszW-t.js} +344 -250
  11. package/dist/esm-CjkeZi__.js +238 -0
  12. package/dist/index.es.js +2896 -2896
  13. package/dist/index.js +303 -304
  14. package/dist/{order-R043xTpC.js → order-B4uR9Q04.js} +1 -1
  15. package/dist/{order-BkYCnwD7.js → order-BSPy5DI8.js} +1 -1
  16. package/dist/{rasterExport-C_FcNBkC.js → rasterExport-B62RmAK1.js} +3 -3
  17. package/dist/{rasterExport-Z7gs5346.js → rasterExport-DQH3hVg_.js} +3 -3
  18. package/dist/{rasterization-_-9JmSas.js → rasterization-B05bDo5e.js} +15 -18
  19. package/dist/rasterization-CFogVB3B.js +50 -0
  20. package/dist/{renderCanvas2D-IM-A9DYG.js → renderCanvas2D-Bdv-B4wj.js} +15 -15
  21. package/dist/{renderCanvas2D-DK1c9TFK.js → renderCanvas2D-ChdoHGrU.js} +15 -15
  22. package/dist/scalePosition-ByvlXaML.js +11 -0
  23. package/dist/schema.json +7 -0
  24. package/dist/{svg-PabUdcDi.js → svg-DHsq1RpV.js} +13 -13
  25. package/dist/{svg-DW3tfUmm.js → svg-N3tj05-e.js} +13 -13
  26. package/dist/{svgRasterizer-B6YtWLJs.js → svgRasterizer-CYVDlt5z.js} +2 -2
  27. package/dist/{svgRasterizer-BEVDyyS3.js → svgRasterizer-CvCBlxLj.js} +2 -2
  28. package/dist/{viewIdentityRegistry-BW415b3o.js → viewIdentityRegistry-BDKkEjXl.js} +1 -1
  29. package/dist/{viewIdentityRegistry-_F0E7nkA.js → viewIdentityRegistry-BIYd4TE0.js} +1 -1
  30. package/dist/{viewSelectors-KtD-QSN0.js → viewSelectors-DDLW-byr.js} +80 -50
  31. package/dist/{viewSelectors-DYz-PhTO.js → viewSelectors-j-F9XwsE.js} +80 -50
  32. package/dist/{viewUtils-BZGPseMx.js → viewUtils-JX6CMEYH.js} +1212 -1211
  33. package/dist/{webgl-BKSGqHaz.js → webgl-DdmOwEH0.js} +107 -86
  34. package/dist/{webgl-tdKf9SlZ.js → webgl-Dw8xqZpX.js} +107 -86
  35. package/package.json +7 -9
  36. package/LICENSE +0 -21
  37. package/dist/AbortablePromiseCache-BTmAcN-t.js +0 -96
  38. package/dist/esm-BiqrFjMh.js +0 -443
  39. package/dist/esm-DtNElqRr.js +0 -462
@@ -0,0 +1,238 @@
1
+ import { i as e, n as t } from "./esm-Dndm-NaA.js";
2
+ import { n } from "./esm-VFJeyk9i.js";
3
+ import { t as r } from "./SharedReadCache-Ey5QIiPM.js";
4
+ //#endregion
5
+ //#region ../../node_modules/@gmod/bgzf-filehandle/esm/long.js
6
+ function i(e, t = 0) {
7
+ let n = e.getUint32(t, !0);
8
+ return e.getUint32(t + 4, !0) * 4294967296 + n;
9
+ }
10
+ //#endregion
11
+ //#region ../../node_modules/@gmod/bgzf-filehandle/esm/gziIndex.js
12
+ var a = 16, o = {
13
+ compressed: /* @__PURE__ */ new Float64Array(),
14
+ uncompressed: /* @__PURE__ */ new Float64Array()
15
+ };
16
+ function s(e, t) {
17
+ let n = new Float64Array(t + 1), r = new Float64Array(t + 1), o = new DataView(e.buffer, e.byteOffset, e.byteLength);
18
+ for (let e = 0; e < t; e += 1) {
19
+ let t = e * a;
20
+ n[e + 1] = i(o, t), r[e + 1] = i(o, t + 8);
21
+ }
22
+ return {
23
+ compressed: n,
24
+ uncompressed: r
25
+ };
26
+ }
27
+ function c(e, t) {
28
+ let n = 0, r = e.length;
29
+ for (; n < r;) {
30
+ let i = n + r >>> 1;
31
+ e[i] <= t ? n = i + 1 : r = i;
32
+ }
33
+ return n;
34
+ }
35
+ var l = class {
36
+ filehandle;
37
+ index;
38
+ constructor({ filehandle: e }) {
39
+ this.filehandle = e;
40
+ }
41
+ _getIndex() {
42
+ return this.index ||= this._readIndex().catch((e) => {
43
+ throw this.index = void 0, e;
44
+ }), this.index;
45
+ }
46
+ async _readIndex() {
47
+ let e = await this.filehandle.read(8, 0), t = i(new DataView(e.buffer, e.byteOffset, e.byteLength));
48
+ if (t === 0) return s(/* @__PURE__ */ new Uint8Array(), 0);
49
+ if (t > (2 ** 53 - 1) / a) throw TypeError("integer overflow");
50
+ return s(await this.filehandle.read(a * t, 8), t);
51
+ }
52
+ async getRelevantBlocksForRead(e, t) {
53
+ if (e === 0) return {
54
+ ...o,
55
+ nextCompressedPosition: void 0
56
+ };
57
+ let { compressed: n, uncompressed: r } = await this._getIndex(), i = c(r, t) - 1, a = c(r, t + e - 1);
58
+ return {
59
+ compressed: n.subarray(i, a),
60
+ uncompressed: r.subarray(i, a),
61
+ nextCompressedPosition: a < n.length ? n[a] : void 0
62
+ };
63
+ }
64
+ }, u = 10, d = 33554432;
65
+ function f(e) {
66
+ let t = 0, n = [], r = () => {
67
+ t--, n.shift()?.();
68
+ };
69
+ return async (i) => {
70
+ t >= e && await new Promise((e) => {
71
+ n.push(e);
72
+ }), t++;
73
+ try {
74
+ return await i();
75
+ } finally {
76
+ r();
77
+ }
78
+ };
79
+ }
80
+ function p(e, t, n) {
81
+ let r = [], i = e.length, a = 0;
82
+ for (; a < i;) {
83
+ let o = a + 1;
84
+ for (; o < i && t[o] - t[a] < d;) o += 1;
85
+ r.push({
86
+ compressedStart: e[a],
87
+ compressedEnd: o < i ? e[o] : n ?? e[i - 1] + 65536,
88
+ uncompressedStart: t[a]
89
+ }), a = o;
90
+ }
91
+ return r;
92
+ }
93
+ function m(e, t, n, r) {
94
+ let i = Math.max(0, n - t), a = Math.min(r, t + e.length) - t;
95
+ return i < e.length ? e.subarray(i, a) : /* @__PURE__ */ new Uint8Array();
96
+ }
97
+ var h = class {
98
+ filehandle;
99
+ gzi;
100
+ limit;
101
+ constructor({ filehandle: e, gziFilehandle: t, blockConcurrency: n = u }) {
102
+ this.filehandle = e, this.gzi = new l({ filehandle: t }), this.limit = f(n);
103
+ }
104
+ async read(n, r) {
105
+ let { compressed: i, uncompressed: a, nextCompressedPosition: o } = await this.gzi.getRelevantBlocksForRead(n, r);
106
+ if (i.length === 0) return /* @__PURE__ */ new Uint8Array();
107
+ let s = r + n, c = p(i, a, o), l = await Promise.all(c.map((e) => this.limit(async () => {
108
+ let n = await this.filehandle.read(e.compressedEnd - e.compressedStart, e.compressedStart);
109
+ return m(await t(n), e.uncompressedStart, r, s);
110
+ })));
111
+ return e(l);
112
+ }
113
+ }, g = new TextDecoder("utf8");
114
+ function _(e) {
115
+ return e.split(">").filter((e) => /\S/.test(e)).map((e) => {
116
+ let [t, ...n] = e.split("\n"), [r, ...i] = t.split(" "), a = n.join("").replace(/\s/g, "");
117
+ return {
118
+ id: r,
119
+ description: i.join(" "),
120
+ sequence: a
121
+ };
122
+ });
123
+ }
124
+ var v = class {
125
+ data;
126
+ indexed;
127
+ constructor({ fasta: e, path: t }) {
128
+ let r;
129
+ if (e) r = e;
130
+ else if (t) r = new n(t);
131
+ else throw Error("Need to pass fasta or path");
132
+ this.data = r.readFile().then((e) => _(g.decode(e)));
133
+ }
134
+ getIndexed() {
135
+ return this.indexed ??= this.data.then((e) => new Map(e.map((e) => [e.id, e]))), this.indexed;
136
+ }
137
+ async fetch(e, t, n) {
138
+ let r = (await this.getIndexed()).get(e);
139
+ if (!r) throw Error(`no sequence with id ${e} exists`);
140
+ return r.sequence.slice(t, n);
141
+ }
142
+ async getSequenceNames() {
143
+ return (await this.data).map((e) => e.id);
144
+ }
145
+ }, y = new TextDecoder("utf8");
146
+ function b(e, t, n, r) {
147
+ return e + t * Math.floor(r / n) + r % n;
148
+ }
149
+ async function x(e, t = {}) {
150
+ let n = y.decode(await e.readFile(t)), r = /* @__PURE__ */ new Map();
151
+ for (let e of n.split("\n")) {
152
+ let t = e.trim();
153
+ if (!t) continue;
154
+ let n = t.split(" ");
155
+ if (n.length < 5) throw Error(`Malformed FAI line (expected 5 tab-separated columns, got ${String(n.length)}): ${t}`);
156
+ let [i, a, o, s, c] = n;
157
+ if (i.startsWith(">")) throw Error("found > in sequence name, might have supplied FASTA file for the FASTA index");
158
+ let l = +a, u = +s;
159
+ if (l > 0 && u === 0) throw Error(`Invalid FAI index for "${i}": LINEBASES is 0, FASTA likely missing trailing newline; regenerate the .fai index`);
160
+ r.set(i, {
161
+ length: l,
162
+ offset: +o,
163
+ lineLength: u,
164
+ lineBytes: +c
165
+ });
166
+ }
167
+ return r;
168
+ }
169
+ async function S(e, t, n = 0, r, i) {
170
+ if (n < 0) throw TypeError("regionStart cannot be less than 0");
171
+ let a = Math.min(r ?? t.length, t.length);
172
+ if (n >= a) return "";
173
+ let o = b(t.offset, t.lineBytes, t.lineLength, n), s = b(t.offset, t.lineBytes, t.lineLength, a) - o, c = y.decode(await e.read(s, o, i)).replace(/\s+/g, "");
174
+ if (/[^\x20-\x7e]/.test(c.slice(0, 1e3))) throw Error("Non-ASCII bytes in sequence; file may be gzip — use BgzipIndexedFasta or decompress");
175
+ return c;
176
+ }
177
+ var C = class {
178
+ fasta;
179
+ fai;
180
+ indexCache = new r({});
181
+ constructor({ fasta: e, fai: t, path: r, faiPath: i }) {
182
+ if (e) this.fasta = e;
183
+ else if (r) this.fasta = new n(r);
184
+ else throw Error("Need to pass filehandle for fasta or path to localfile");
185
+ if (t) this.fai = t;
186
+ else if (i) this.fai = new n(i);
187
+ else if (r) this.fai = new n(`${r}.fai`);
188
+ else throw Error("Need to pass filehandle for fai or path to localfile");
189
+ }
190
+ getIndexes(e) {
191
+ return this.indexCache.get("fai", e?.signal, (t) => x(this.fai, {
192
+ ...e,
193
+ signal: t
194
+ }));
195
+ }
196
+ async getSequenceNames(e) {
197
+ return [...(await this.getIndexes(e)).keys()];
198
+ }
199
+ async getSequenceSizes(e) {
200
+ let t = {};
201
+ for (let [n, r] of await this.getIndexes(e)) t[n] = r.length;
202
+ return t;
203
+ }
204
+ async getSequenceSize(e, t) {
205
+ return (await this.getIndexes(t)).get(e)?.length;
206
+ }
207
+ async hasReferenceSequence(e, t) {
208
+ return (await this.getIndexes(t)).has(e);
209
+ }
210
+ async getResiduesByName(e, t, n, r) {
211
+ let i = (await this.getIndexes(r)).get(e);
212
+ if (i !== void 0) return S(this.fasta, i, t, n, r);
213
+ }
214
+ async getSequence(e, t, n, r) {
215
+ return this.getResiduesByName(e, t, n, r);
216
+ }
217
+ }, w = class extends C {
218
+ constructor({ fasta: e, path: t, fai: r, faiPath: i, gzi: a, gziPath: o }) {
219
+ let s;
220
+ if (e && a) s = new h({
221
+ filehandle: e,
222
+ gziFilehandle: a
223
+ });
224
+ else if (t && o) s = new h({
225
+ filehandle: new n(t),
226
+ gziFilehandle: new n(o)
227
+ });
228
+ else throw Error("BgzipIndexedFasta requires either {fasta, gzi} or {path, gziPath}");
229
+ super({
230
+ fasta: s,
231
+ fai: r,
232
+ faiPath: i,
233
+ path: t
234
+ });
235
+ }
236
+ };
237
+ //#endregion
238
+ export { w as BgzipIndexedFasta, v as FetchableSmallFasta, C as IndexedFasta, _ as parseSmallFasta };