@genome-spy/app 0.56.1 → 0.58.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.
@@ -1,6 +1,6 @@
1
1
  import { L as d } from "./__vite-browser-external-C--ziKoh.js";
2
- import { R as b } from "./remoteFile-DuIsnepi.js";
3
- import { b as i } from "./index-B6haPltu.js";
2
+ import { R as b } from "./remoteFile-BuaqFGWk.js";
3
+ import { b as i } from "./index-BftNdA0O.js";
4
4
  function a(o) {
5
5
  const r = new FileReader();
6
6
  return new Promise((n, e) => {
@@ -25,14 +25,14 @@ function c(o) {
25
25
  }, r.readAsText(o);
26
26
  });
27
27
  }
28
- class B {
28
+ class E {
29
29
  constructor(r) {
30
30
  this.blob = r, this.size = r.size;
31
31
  }
32
32
  async read(r, n = 0, e, u = 0) {
33
33
  if (!e)
34
34
  return { bytesRead: 0, buffer: r };
35
- const t = u, f = t + e, l = await a(this.blob.slice(t, f)), s = i.Buffer.from(l);
35
+ const t = u, l = t + e, f = await a(this.blob.slice(t, l)), s = i.Buffer.from(f);
36
36
  return { bytesRead: s.copy(r, n), buffer: s };
37
37
  }
38
38
  async readFile(r) {
@@ -53,7 +53,7 @@ class B {
53
53
  function w(o, r = {}) {
54
54
  return new b(o, r);
55
55
  }
56
- function E(o, r, n, e = {}) {
56
+ function B(o, r, n, e = {}) {
57
57
  if (n !== void 0)
58
58
  return n;
59
59
  if (o !== void 0)
@@ -63,9 +63,9 @@ function E(o, r, n, e = {}) {
63
63
  throw new Error("no url, path, or filehandle provided, cannot open");
64
64
  }
65
65
  export {
66
- B as BlobFile,
66
+ E as BlobFile,
67
67
  d as LocalFile,
68
68
  b as RemoteFile,
69
69
  w as fromUrl,
70
- E as open
70
+ B as open
71
71
  };
@@ -1,7 +1,7 @@
1
1
  import { L as g } from "./__vite-browser-external-C--ziKoh.js";
2
- import { b as m } from "./index-B6haPltu.js";
3
- import { L as E, u as _ } from "./long-BXK3UEks.js";
4
- const w = 1;
2
+ import { b as w } from "./index-BftNdA0O.js";
3
+ import { L as _, u as b } from "./long-BviWyoZx.js";
4
+ const m = 1;
5
5
  class I {
6
6
  constructor({ filehandle: e, path: t }) {
7
7
  if (e)
@@ -12,7 +12,7 @@ class I {
12
12
  throw new TypeError("either filehandle or path must be defined");
13
13
  }
14
14
  _readLongWithOverflow(e, t = 0, s = !0) {
15
- const n = E.fromBytesLE(e.slice(t, t + 8), s);
15
+ const n = _.fromBytesLE(e.slice(t, t + 8), s);
16
16
  if (n.greaterThan(Number.MAX_SAFE_INTEGER) || n.lessThan(Number.MIN_SAFE_INTEGER))
17
17
  throw new TypeError("integer overflow");
18
18
  return n.toNumber();
@@ -21,7 +21,7 @@ class I {
21
21
  return this.index || (this.index = this._readIndex()), this.index;
22
22
  }
23
23
  async _readIndex() {
24
- let e = m.Buffer.allocUnsafe(8);
24
+ let e = w.Buffer.allocUnsafe(8);
25
25
  await this.filehandle.read(e, 0, 8, 0);
26
26
  const t = this._readLongWithOverflow(e, 0, !0);
27
27
  if (!t)
@@ -31,7 +31,7 @@ class I {
31
31
  const n = 8 * 2 * t;
32
32
  if (n > Number.MAX_SAFE_INTEGER)
33
33
  throw new TypeError("integer overflow");
34
- e = m.Buffer.allocUnsafe(n), await this.filehandle.read(e, 0, n, 8);
34
+ e = w.Buffer.allocUnsafe(n), await this.filehandle.read(e, 0, n, 8);
35
35
  for (let r = 0; r < t; r += 1) {
36
36
  const i = this._readLongWithOverflow(e, r * 16), l = this._readLongWithOverflow(e, r * 16 + 8);
37
37
  s[r + 1] = [i, l];
@@ -48,17 +48,17 @@ class I {
48
48
  if (e === 0)
49
49
  return [];
50
50
  const n = await this._getIndex(), r = [], i = (h, u) => {
51
- const p = h[w], x = u ? u[w] : 1 / 0;
52
- return p <= t && x > t ? 0 : p < t ? -1 : 1;
51
+ const p = h[m], E = u ? u[m] : 1 / 0;
52
+ return p <= t && E > t ? 0 : p < t ? -1 : 1;
53
53
  };
54
54
  let l = 0, f = n.length - 1, a = Math.floor(n.length / 2), d = i(n[a], n[a + 1]);
55
55
  for (; d !== 0; )
56
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
57
  r.push(n[a]);
58
58
  let c = a + 1;
59
- for (; c < n.length && (r.push(n[c]), !(n[c][w] >= s)); c += 1)
59
+ for (; c < n.length && (r.push(n[c]), !(n[c][m] >= s)); c += 1)
60
60
  ;
61
- return r[r.length - 1][w] < s && r.push([]), r;
61
+ return r[r.length - 1][m] < s && r.push([]), r;
62
62
  }
63
63
  }
64
64
  class y {
@@ -85,7 +85,7 @@ class y {
85
85
  });
86
86
  }
87
87
  async getUncompressedFileSize() {
88
- const [, e] = await this.gzi.getLastBlock(), { size: t } = await this.filehandle.stat(), s = m.Buffer.allocUnsafe(4), { bytesRead: n } = await this.filehandle.read(s, 0, 4, t - 28 - 4);
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
89
  if (n !== 4)
90
90
  throw new Error("read error");
91
91
  const r = s.readUInt32LE(0);
@@ -95,10 +95,10 @@ class y {
95
95
  let n = s;
96
96
  n || (n = (await this.filehandle.stat()).size);
97
97
  const r = n - t;
98
- return await this.filehandle.read(e, 0, r, t), await _(e.slice(0, r));
98
+ return await this.filehandle.read(e, 0, r, t), await b(e.slice(0, r));
99
99
  }
100
100
  async read(e, t, s, n) {
101
- const r = await this.gzi.getRelevantBlocksForRead(s, n), i = m.Buffer.allocUnsafe(32768 * 2);
101
+ const r = await this.gzi.getRelevantBlocksForRead(s, n), i = w.Buffer.allocUnsafe(32768 * 2);
102
102
  let l = t, f = 0;
103
103
  for (let a = 0; a < r.length - 1; a += 1) {
104
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;
@@ -107,12 +107,12 @@ class y {
107
107
  return { bytesRead: f, buffer: e };
108
108
  }
109
109
  }
110
- function b(o, e) {
110
+ function x(o, e) {
111
111
  return o.offset + o.lineBytes * Math.floor(e / o.lineLength) + e % o.lineLength;
112
112
  }
113
113
  async function S(o, e) {
114
114
  const t = await o.readFile(e);
115
- if (!(t && t.length))
115
+ if (!(t != null && t.length))
116
116
  throw new Error("No data read from FASTA index (FAI) file");
117
117
  let s = 0, n;
118
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), {
@@ -166,9 +166,9 @@ class B {
166
166
  * is the sequence name
167
167
  */
168
168
  async getSequenceSizes(e) {
169
- const t = {}, s = await this._getIndexes(e), n = Object.values(s.id);
170
- for (let r = 0; r < n.length; r += 1)
171
- t[n[r].name] = n[r].length;
169
+ const t = {}, s = await this._getIndexes(e);
170
+ for (const n of Object.values(s.id))
171
+ t[n.name] = n.length;
172
172
  return t;
173
173
  }
174
174
  /**
@@ -220,11 +220,11 @@ class B {
220
220
  throw new TypeError("regionStart cannot be less than 0");
221
221
  if ((r === void 0 || r > e.length) && (r = e.length), t >= r)
222
222
  return "";
223
- const i = b(e, t), l = b(e, r) - i, f = Buffer.allocUnsafe(l);
223
+ const i = x(e, t), l = x(e, r) - i, f = w.Buffer.allocUnsafe(l);
224
224
  return await this.fasta.read(f, 0, l, i, n), f.toString("utf8").replace(/\s+/g, "");
225
225
  }
226
226
  }
227
- class O extends B {
227
+ class v extends B {
228
228
  constructor({ fasta: e, path: t, fai: s, faiPath: n, gzi: r, gziPath: i }) {
229
229
  super({ fasta: e, path: t, fai: s, faiPath: n }), e && r ? this.fasta = new y({
230
230
  filehandle: e,
@@ -243,7 +243,7 @@ function F(o) {
243
243
  };
244
244
  });
245
245
  }
246
- class k {
246
+ class O {
247
247
  constructor({ fasta: e, path: t }) {
248
248
  if (e)
249
249
  this.fasta = e;
@@ -260,15 +260,15 @@ class k {
260
260
  const r = (await this.data).find((l) => l.id === e), i = s - t;
261
261
  if (!r)
262
262
  throw new Error(`no sequence with id ${e} exists`);
263
- return r.sequence.substr(t, i);
263
+ return r.sequence.slice(t, i);
264
264
  }
265
265
  async getSequenceNames() {
266
266
  return (await this.data).map((t) => t.id);
267
267
  }
268
268
  }
269
269
  export {
270
- O as BgzipIndexedFasta,
271
- k as FetchableSmallFasta,
270
+ v as BgzipIndexedFasta,
271
+ O as FetchableSmallFasta,
272
272
  B as IndexedFasta,
273
273
  F as parseSmallFasta
274
274
  };