@genome-spy/app 0.72.0 → 0.74.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 (39) hide show
  1. package/LICENSE +1 -1
  2. package/dist/AbortablePromiseCache-3gHJdF3E.js +96 -0
  3. package/dist/blosc-oa0DlI6G.js +692 -0
  4. package/dist/browser-Dvlo92rx.js +126 -0
  5. package/dist/chunk-CPXzm0be.js +11 -0
  6. package/dist/chunk-INHXZS53-fPMmEwMt.js +13 -0
  7. package/dist/esm-B8-vSu-c.js +369 -0
  8. package/dist/esm-BDFRLEuD.js +1248 -0
  9. package/dist/esm-BygJiwh0.js +573 -0
  10. package/dist/esm-CGX-qz1d.js +155 -0
  11. package/dist/esm-Cmo4qEPr.js +1015 -0
  12. package/dist/esm-CuMSzCHy.js +298 -0
  13. package/dist/esm-D-WfYOx7.js +461 -0
  14. package/dist/esm-DCCYNvaz.js +1426 -0
  15. package/dist/esm-n0auOe11.js +121 -0
  16. package/dist/index.es.js +41053 -51422
  17. package/dist/index.js +1100 -1095
  18. package/dist/lz4-jZ0zyLBa.js +626 -0
  19. package/dist/parquetRead-CJe1UPsz.js +1609 -0
  20. package/dist/schema.json +11254 -4920
  21. package/dist/style.css +2 -1
  22. package/dist/zstd-C6ksIG9r.js +583 -0
  23. package/package.json +14 -5
  24. package/dist/AbortablePromiseCache-Dj0vzLnp.js +0 -149
  25. package/dist/blosc-D1xNXZJs.js +0 -719
  26. package/dist/browser-0iNU5Wit.js +0 -138
  27. package/dist/chunk-INHXZS53-DiyuLb3Z.js +0 -14
  28. package/dist/index-BUsSzlHg.js +0 -1771
  29. package/dist/index-BYsZN7b0.js +0 -1597
  30. package/dist/index-C7wOh6y1.js +0 -657
  31. package/dist/index-CRaQAuki.js +0 -326
  32. package/dist/index-D9v1PCj9.js +0 -507
  33. package/dist/index-GDOuv_D5.js +0 -266
  34. package/dist/index-Gt44EOIH.js +0 -628
  35. package/dist/inflate-GtwLkvSP.js +0 -1048
  36. package/dist/lz4-1Ws5oVWR.js +0 -640
  37. package/dist/parquetRead-BnAGCa4_.js +0 -1663
  38. package/dist/unzip-Bac01w6X.js +0 -1492
  39. package/dist/zstd-C4EcZnjq.js +0 -603
@@ -1,266 +0,0 @@
1
- import { LocalFile as d } from "./browser-0iNU5Wit.js";
2
- import { I as y, Z as _ } from "./inflate-GtwLkvSP.js";
3
- const g = 65536, I = g * g;
4
- function u(i, e = 0) {
5
- const t = i[e] | i[e + 1] << 8 | i[e + 2] << 16 | i[e + 3] << 24;
6
- return ((i[e + 4] | i[e + 5] << 8 | i[e + 6] << 16 | i[e + 7] << 24) >>> 0) * I + (t >>> 0);
7
- }
8
- const f = 1;
9
- function w(i, e, t) {
10
- const n = e[f], s = t ? t[f] : 1 / 0;
11
- return n <= i && s > i ? 0 : n < i ? -1 : 1;
12
- }
13
- class b {
14
- filehandle;
15
- index;
16
- constructor({ filehandle: e }) {
17
- this.filehandle = e;
18
- }
19
- _getIndex() {
20
- return this.index || (this.index = this._readIndex().catch((e) => {
21
- throw this.index = void 0, e;
22
- })), this.index;
23
- }
24
- async _readIndex() {
25
- const e = await this.filehandle.read(8, 0), t = u(e);
26
- if (!t)
27
- return [[0, 0]];
28
- const n = new Array(t + 1);
29
- n[0] = [0, 0];
30
- const s = 16 * t;
31
- if (s > Number.MAX_SAFE_INTEGER)
32
- throw new TypeError("integer overflow");
33
- const r = await this.filehandle.read(s, 8);
34
- for (let a = 0; a < t; a += 1) {
35
- const o = u(r, a * 16), c = u(r, a * 16 + 8);
36
- n[a + 1] = [o, c];
37
- }
38
- return n;
39
- }
40
- async getLastBlock() {
41
- return (await this._getIndex()).at(-1);
42
- }
43
- async getRelevantBlocksForRead(e, t) {
44
- const n = t + e;
45
- if (e === 0)
46
- return [];
47
- const s = await this._getIndex(), r = [];
48
- let a = 0, o = s.length - 1, c = Math.floor(s.length / 2), l = w(t, s[c], s[c + 1]);
49
- for (; l !== 0; )
50
- l > 0 ? o = c - 1 : l < 0 && (a = c + 1), c = Math.ceil((o - a) / 2) + a, l = w(t, s[c], s[c + 1]);
51
- r.push(s[c]);
52
- let h = c + 1;
53
- for (; h < s.length && (r.push(s[h]), !(s[h][f] >= n)); h += 1)
54
- ;
55
- return r[r.length - 1][f] < n && r.push([]), r;
56
- }
57
- }
58
- function F(i) {
59
- let e = 0;
60
- for (const t of i)
61
- e += t.length;
62
- return e;
63
- }
64
- function x(i, e) {
65
- const t = new Uint8Array(e ?? F(i));
66
- let n = 0;
67
- for (const s of i)
68
- t.set(s, n), n += s.length;
69
- return t;
70
- }
71
- async function S(i) {
72
- try {
73
- let e, t = 0, n;
74
- const s = [];
75
- let r = 0;
76
- do {
77
- const a = i.subarray(t);
78
- if (n = new y(void 0), { strm: e } = n, n.push(a, _), n.err)
79
- throw new Error(n.msg);
80
- t += e.next_in;
81
- const o = n.result;
82
- s.push(o), r += o.length;
83
- } while (e.avail_in);
84
- return x(s, r);
85
- } catch (e) {
86
- throw /incorrect header check/.exec(`${e}`) ? new Error("problem decompressing block: incorrect gzip header check") : e;
87
- }
88
- }
89
- class m {
90
- filehandle;
91
- gzi;
92
- constructor({ filehandle: e, gziFilehandle: t }) {
93
- this.filehandle = e, this.gzi = new b({
94
- filehandle: t
95
- });
96
- }
97
- async _readAndUncompressBlock(e, t) {
98
- let n = t;
99
- n || (n = (await this.filehandle.stat()).size);
100
- const s = n - e, r = await this.filehandle.read(s, e);
101
- return S(r);
102
- }
103
- async read(e, t) {
104
- const n = await this.gzi.getRelevantBlocksForRead(e, t), s = [];
105
- for (let r = 0; r < n.length - 1; r += 1) {
106
- const a = await this._readAndUncompressBlock(n[r][0], n[r + 1][0]), [, o] = n[r], c = o >= t ? 0 : t - o, l = Math.min(t + e, o + a.length) - o;
107
- c >= 0 && c < a.length && s.push(a.subarray(c, l));
108
- }
109
- return x(s);
110
- }
111
- }
112
- function p(i, e) {
113
- return i.offset + i.lineBytes * Math.floor(e / i.lineLength) + e % i.lineLength;
114
- }
115
- async function B(i, e = {}) {
116
- const t = new TextDecoder("utf8");
117
- return Object.fromEntries(t.decode(await i.readFile(e)).split(/\r?\n/).map((n) => n.trim()).filter((n) => !!n).map((n) => n.split(" ")).map((n) => {
118
- if (n[0]?.startsWith(">"))
119
- throw new Error("found > in sequence name, might have supplied FASTA file for the FASTA index");
120
- return [
121
- n[0],
122
- {
123
- name: n[0],
124
- length: +n[1],
125
- start: 0,
126
- end: +n[1],
127
- offset: +n[2],
128
- lineLength: +n[3],
129
- lineBytes: +n[4]
130
- }
131
- ];
132
- }));
133
- }
134
- class E {
135
- constructor({ fasta: e, fai: t, path: n, faiPath: s }) {
136
- if (e)
137
- this.fasta = e;
138
- else if (n)
139
- this.fasta = new d(n);
140
- else
141
- throw new Error("Need to pass filehandle for fasta or path to localfile");
142
- if (t)
143
- this.fai = t;
144
- else if (s)
145
- this.fai = new d(s);
146
- else if (n)
147
- this.fai = new d(`${n}.fai`);
148
- else
149
- throw new Error("Need to pass filehandle for or path to localfile");
150
- }
151
- async _getIndexes(e) {
152
- return this.indexes || (this.indexes = B(this.fai, e).catch((t) => {
153
- throw this.indexes = void 0, t;
154
- })), this.indexes;
155
- }
156
- /**
157
- * @returns array of string sequence names that are present in the index, in
158
- * which the array index indicates the sequence ID, and the value is the
159
- * sequence name
160
- */
161
- async getSequenceNames(e) {
162
- return Object.keys(await this._getIndexes(e));
163
- }
164
- /**
165
- * @returns array of string sequence names that are present in the index, in
166
- * which the array index indicates the sequence ID, and the value is the
167
- * sequence name
168
- */
169
- async getSequenceSizes(e) {
170
- const t = {}, n = await this._getIndexes(e);
171
- for (const s of Object.values(n))
172
- t[s.name] = s.length;
173
- return t;
174
- }
175
- /**
176
- * @returns array of string sequence names that are present in the index, in
177
- * which the array index indicates the sequence ID, and the value is the
178
- * sequence name
179
- */
180
- async getSequenceSize(e, t) {
181
- return (await this._getIndexes(t))[e]?.length;
182
- }
183
- /**
184
- * @param name
185
- *
186
- * @returns true if the file contains the given reference sequence name
187
- */
188
- async hasReferenceSequence(e, t) {
189
- return !!(await this._getIndexes(t))[e];
190
- }
191
- /**
192
- * @param seqName
193
- * @param min
194
- * @param max
195
- */
196
- async getResiduesByName(e, t, n, s) {
197
- const r = (await this._getIndexes(s))[e];
198
- return r ? this._fetchFromIndexEntry(r, t, n, s) : void 0;
199
- }
200
- //alias for getResiduesByName
201
- async getSequence(e, t, n, s) {
202
- return this.getResiduesByName(e, t, n, s);
203
- }
204
- async _fetchFromIndexEntry(e, t = 0, n, s) {
205
- let r = n;
206
- if (t < 0)
207
- throw new TypeError("regionStart cannot be less than 0");
208
- if ((r === void 0 || r > e.length) && (r = e.length), t >= r)
209
- return "";
210
- const a = p(e, t), o = p(e, r) - a, l = new TextDecoder("utf8").decode(await this.fasta.read(o, a, s)).replace(/\s+/g, "");
211
- if (/[^\x20-\x7e]/.test(l.slice(0, 1e3)))
212
- throw new Error("Non-ASCII characters detected in sequence. The file may be gzip compressed. Use BgzipIndexedFasta for bgzip files, or decompress the file.");
213
- return l;
214
- }
215
- }
216
- class A extends E {
217
- constructor({ fasta: e, path: t, fai: n, faiPath: s, gzi: r, gziPath: a }) {
218
- super({ fasta: e, path: t, fai: n, faiPath: s }), e && r ? this.fasta = new m({
219
- filehandle: e,
220
- gziFilehandle: r
221
- }) : t && a && (this.fasta = new m({
222
- filehandle: new d(t),
223
- gziFilehandle: new d(a)
224
- }));
225
- }
226
- }
227
- function k(i) {
228
- return i.split(">").filter((e) => /\S/.test(e)).map((e) => {
229
- const [t, ...n] = e.split(`
230
- `), [s, ...r] = t.split(" "), a = n.join("").replace(/\s/g, "");
231
- return {
232
- id: s,
233
- description: r.join(" "),
234
- sequence: a
235
- };
236
- });
237
- }
238
- class q {
239
- constructor({ fasta: e, path: t }) {
240
- if (e)
241
- this.fasta = e;
242
- else if (t)
243
- this.fasta = new d(t);
244
- else
245
- throw new Error("Need to pass fasta or path");
246
- this.data = this.fasta.readFile().then((n) => {
247
- const r = new TextDecoder("utf8").decode(n);
248
- return k(r);
249
- });
250
- }
251
- async fetch(e, t, n) {
252
- const r = (await this.data).find((o) => o.id === e), a = n - t;
253
- if (!r)
254
- throw new Error(`no sequence with id ${e} exists`);
255
- return r.sequence.slice(t, a);
256
- }
257
- async getSequenceNames() {
258
- return (await this.data).map((t) => t.id);
259
- }
260
- }
261
- export {
262
- A as BgzipIndexedFasta,
263
- q as FetchableSmallFasta,
264
- E as IndexedFasta,
265
- k as parseSmallFasta
266
- };