@genome-spy/app 1.0.0 → 1.1.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.
@@ -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 };
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as e, t } from "./rolldown-runtime-DF993M8W.js";
2
2
  import { $t as n, B as r, Bt as i, C as a, G as o, H as s, I as c, It as l, Jt as u, K as d, Kt as f, L as p, M as m, P as h, Qt as g, R as _, S as v, Sn as y, Wt as b, et as x, fn as S, i as C, j as w, k as T, o as E, pn as D, pt as O, tn as k, tt as A, y as ee, yt as j, z as M } from "./clipOptions-B5PibDq3.js";
3
- import { $ as te, $t as N, A as P, An as ne, At as re, B as ie, Bt as ae, C as oe, Cn as F, Ct as se, D as ce, Dn as le, Dt as ue, E as de, En as I, Et as fe, F as pe, Ft as me, G as he, Gt as ge, H as _e, Ht as ve, I as ye, It as be, J as xe, Jt as Se, K as Ce, Kt as we, L as Te, Lt as Ee, M as De, Mn as Oe, Mt as ke, N as Ae, Nn as je, Nt as Me, O as Ne, On as L, Ot as Pe, P as Fe, Pn as Ie, Pt as Le, Q as Re, Qt as ze, R as Be, Rt as Ve, S as He, Sn as R, St as Ue, T as We, Tn as Ge, Tt as Ke, U as qe, Ut as Je, V as Ye, Vt as Xe, W as Ze, Wt as Qe, X as $e, Xt as et, Y as tt, Yt as nt, Z as rt, Zt as it, _ as at, _n as ot, _t as st, a as ct, an as lt, at as ut, b as dt, bn as ft, bt as pt, c as mt, cn as ht, ct as gt, d as _t, dn as vt, dt as yt, en as bt, et as xt, f as St, fn as Ct, ft as wt, g as Tt, gn as Et, gt as Dt, h as Ot, hn as kt, ht as At, i as jt, in as Mt, it as Nt, j as Pt, jn as Ft, jt as It, k as Lt, kn as Rt, kt as zt, l as Bt, ln as Vt, lt as Ht, m as Ut, mn as Wt, mt as Gt, n as Kt, nn as qt, nt as Jt, o as Yt, on as Xt, ot as Zt, p as Qt, pn as $t, pt as en, q as tn, qt as nn, r as rn, rn as an, rt as on, s as sn, sn as cn, st as ln, tn as un, tt as dn, u as fn, un as pn, ut as mn, v as hn, vn as gn, vt as _n, w as vn, wn as yn, wt as bn, x as xn, xn as Sn, xt as Cn, y as wn, yn as Tn, yt as En, z as Dn, zt as On } from "./agentApi-Z65dw-sD.js";
3
+ import { $ as te, $t as N, A as P, An as ne, At as re, B as ie, Bt as ae, C as oe, Cn as F, Ct as se, D as ce, Dn as le, Dt as ue, E as de, En as I, Et as fe, F as pe, Ft as me, G as he, Gt as ge, H as _e, Ht as ve, I as ye, It as be, J as xe, Jt as Se, K as Ce, Kt as we, L as Te, Lt as Ee, M as De, Mn as Oe, Mt as ke, N as Ae, Nn as je, Nt as Me, O as Ne, On as L, Ot as Pe, P as Fe, Pn as Ie, Pt as Le, Q as Re, Qt as ze, R as Be, Rt as Ve, S as He, Sn as R, St as Ue, T as We, Tn as Ge, Tt as Ke, U as qe, Ut as Je, V as Ye, Vt as Xe, W as Ze, Wt as Qe, X as $e, Xt as et, Y as tt, Yt as nt, Z as rt, Zt as it, _ as at, _n as ot, _t as st, a as ct, an as lt, at as ut, b as dt, bn as ft, bt as pt, c as mt, cn as ht, ct as gt, d as _t, dn as vt, dt as yt, en as bt, et as xt, f as St, fn as Ct, ft as wt, g as Tt, gn as Et, gt as Dt, h as Ot, hn as kt, ht as At, i as jt, in as Mt, it as Nt, j as Pt, jn as Ft, jt as It, k as Lt, kn as Rt, kt as zt, l as Bt, ln as Vt, lt as Ht, m as Ut, mn as Wt, mt as Gt, n as Kt, nn as qt, nt as Jt, o as Yt, on as Xt, ot as Zt, p as Qt, pn as $t, pt as en, q as tn, qt as nn, r as rn, rn as an, rt as on, s as sn, sn as cn, st as ln, tn as un, tt as dn, u as fn, un as pn, ut as mn, v as hn, vn as gn, vt as _n, w as vn, wn as yn, wt as bn, x as xn, xn as Sn, xt as Cn, y as wn, yn as Tn, yt as En, z as Dn, zt as On } from "./agentApi-BgZUOeB-.js";
4
4
  import { D as kn, T as An, b as jn, nt as Mn, v as Nn, y as Pn } from "./vega-scale-Ctz_wa3z.js";
5
5
  import { h as Fn } from "./indexer-En7gpvLN.js";
6
6
  import { A as In, E as Ln, G as Rn, I as zn, O as Bn, T as Vn, W as Hn, a as Un, c as Wn, f as Gn, h as Kn, i as qn, m as Jn, n as Yn, p as Xn, r as Zn, s as Qn, t as $n, v as er, w as tr } from "./viewSelectors-KtD-QSN0.js";
@@ -13253,7 +13253,7 @@ var Q_ = {
13253
13253
  contributors: [],
13254
13254
  license: "MIT",
13255
13255
  homepage: "https://genomespy.app/",
13256
- version: "1.0.0",
13256
+ version: "1.1.0",
13257
13257
  main: "dist/index.js",
13258
13258
  module: "dist/index.es.js",
13259
13259
  type: "module",
@@ -13293,7 +13293,7 @@ var Q_ = {
13293
13293
  files: ["dist/", "src/**/*.d.ts"],
13294
13294
  repository: {
13295
13295
  type: "git",
13296
- url: "github:genome-spy/genome-spy",
13296
+ url: "git+https://github.com/genome-spy/genome-spy.git",
13297
13297
  directory: "packages/app"
13298
13298
  },
13299
13299
  scripts: {
@@ -13305,15 +13305,14 @@ var Q_ = {
13305
13305
  "test:tsc:tests": "tsc -p tsconfig.tests.json --noEmit",
13306
13306
  "smoke:examples:webgpu": "node ../core/scripts/runWebGpuExamples.mjs --scope app --all --compare-webgl",
13307
13307
  storybook: "storybook dev -p 6006",
13308
- "build-storybook": "storybook build",
13309
- prepublishOnly: "npm run build"
13308
+ "build-storybook": "storybook build"
13310
13309
  },
13311
13310
  dependencies: {
13312
13311
  "@floating-ui/dom": "^1.6.1",
13313
13312
  "@fortawesome/fontawesome-free": "^6.4.2",
13314
13313
  "@fortawesome/fontawesome-svg-core": "^6.4.2",
13315
13314
  "@fortawesome/free-solid-svg-icons": "^6.4.2",
13316
- "@genome-spy/core": "^1.0.0",
13315
+ "@genome-spy/core": "^1.1.0",
13317
13316
  "@reduxjs/toolkit": "^2.11.0",
13318
13317
  "d3-color": "^3.1.0",
13319
13318
  idb: "^7.1.1",
@@ -13326,10 +13325,9 @@ var Q_ = {
13326
13325
  zarrita: "^0.6.1"
13327
13326
  },
13328
13327
  devDependencies: {
13329
- "@genome-spy/app-agent": "^1.0.0",
13330
- "@genome-spy/inspector": "^1.0.0"
13331
- },
13332
- gitHead: "adb70d2246e3407282e3704e0e5cef214aa73a54"
13328
+ "@genome-spy/app-agent": "^1.1.0",
13329
+ "@genome-spy/inspector": "^1.1.0"
13330
+ }
13333
13331
  };
13334
13332
  //#endregion
13335
13333
  //#region src/utils/version.js
@@ -22555,7 +22553,7 @@ var wC = class {
22555
22553
  }, this.genomeSpy.viewFactory.addViewType(Km, ((e, t, n, r, i) => new t_(e, t, n, r, i, this.provenance, this.intentExecutor, Lx(this)))), this.#o();
22556
22554
  }
22557
22555
  getAgentApi() {
22558
- return this.#e ||= import("./agentApi-Z65dw-sD.js").then((e) => e.t).then((e) => e.createAgentApi(this)), this.#e;
22556
+ return this.#e ||= import("./agentApi-BgZUOeB-.js").then((e) => e.t).then((e) => e.createAgentApi(this)), this.#e;
22559
22557
  }
22560
22558
  async getDebugModules() {
22561
22559
  return import("./debug-DP4WzTNo.js");