@genome-spy/app 0.69.0 → 0.70.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.
- package/dist/{AbortablePromiseCache-CcuMrnn7.js → AbortablePromiseCache-Dj0vzLnp.js} +4 -4
- package/dist/blosc-D1xNXZJs.js +719 -0
- package/dist/{browser-BRemItdO.js → browser-0iNU5Wit.js} +33 -33
- package/dist/chunk-INHXZS53-DiyuLb3Z.js +14 -0
- package/dist/{index-DHay3ip-.js → index-BUsSzlHg.js} +583 -593
- package/dist/index-BYsZN7b0.js +1597 -0
- package/dist/{index-D-w7Mmt9.js → index-C7wOh6y1.js} +138 -140
- package/dist/index-CRaQAuki.js +326 -0
- package/dist/{index-D74H8TTz.js → index-D9v1PCj9.js} +1 -2
- package/dist/{index-BatuyGAI.js → index-GDOuv_D5.js} +75 -80
- package/dist/{index-DbJ0oeYM.js → index-Gt44EOIH.js} +160 -163
- package/dist/index.es.js +29149 -26002
- package/dist/index.js +1507 -1285
- package/dist/lz4-1Ws5oVWR.js +640 -0
- package/dist/schema.json +301 -0
- package/dist/style.css +1 -1
- package/dist/{unzip-NywezaRR.js → unzip-Bac01w6X.js} +1 -1
- package/dist/zstd-C4EcZnjq.js +603 -0
- package/package.json +5 -4
- package/dist/index-ByuE8dvu.js +0 -332
- package/dist/index-D28m8tSW.js +0 -1607
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as J } from "./AbortablePromiseCache-
|
|
2
|
-
import { u as
|
|
3
|
-
import { LocalFile as
|
|
1
|
+
import { A as J } from "./AbortablePromiseCache-Dj0vzLnp.js";
|
|
2
|
+
import { u as q, Q as U, a as K } from "./unzip-Bac01w6X.js";
|
|
3
|
+
import { LocalFile as R, RemoteFile as F } from "./browser-0iNU5Wit.js";
|
|
4
4
|
class L {
|
|
5
5
|
constructor(e, t, n, i) {
|
|
6
6
|
this.minv = e, this.maxv = t, this.bin = n, this._fetchedSize = i;
|
|
@@ -35,8 +35,7 @@ class j {
|
|
|
35
35
|
})), this.parseP;
|
|
36
36
|
}
|
|
37
37
|
async hasRefSeq(e, t = {}) {
|
|
38
|
-
|
|
39
|
-
return !!((i = (await this.parse(t)).indices[e]) != null && i.binIndex);
|
|
38
|
+
return !!(await this.parse(t)).indices[e]?.binIndex;
|
|
40
39
|
}
|
|
41
40
|
_parseNameBytes(e) {
|
|
42
41
|
let t = 0, n = 0;
|
|
@@ -76,7 +75,7 @@ function X(a, e) {
|
|
|
76
75
|
(!e || i.maxv.compareTo(e) > 0) && (n === void 0 ? (t.push(i), n = i) : ee(n, i) ? i.maxv.compareTo(n.maxv) > 0 && (n.maxv = i.maxv) : (t.push(i), n = i));
|
|
77
76
|
return t;
|
|
78
77
|
}
|
|
79
|
-
class
|
|
78
|
+
class E {
|
|
80
79
|
constructor(e, t) {
|
|
81
80
|
this.blockPosition = e, this.dataPosition = t;
|
|
82
81
|
}
|
|
@@ -88,7 +87,7 @@ class O {
|
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
function A(a, e = 0) {
|
|
91
|
-
return new
|
|
90
|
+
return new E(a[e + 7] * 1099511627776 + a[e + 6] * 4294967296 + a[e + 5] * 16777216 + a[e + 4] * 65536 + a[e + 3] * 256 + a[e + 2], a[e + 1] << 8 | a[e]);
|
|
92
91
|
}
|
|
93
92
|
const te = 21582659, ne = 38359875, ie = {
|
|
94
93
|
0: "generic",
|
|
@@ -101,7 +100,7 @@ function se(a, e) {
|
|
|
101
100
|
function W(a, e) {
|
|
102
101
|
return Math.floor(a / 2 ** e);
|
|
103
102
|
}
|
|
104
|
-
class
|
|
103
|
+
class V extends j {
|
|
105
104
|
constructor(e) {
|
|
106
105
|
super(e), this.maxBinNumber = 0, this.depth = 0, this.minShift = 0;
|
|
107
106
|
}
|
|
@@ -123,19 +122,19 @@ class q extends j {
|
|
|
123
122
|
ref: n.getInt32(t + 4, !0),
|
|
124
123
|
start: n.getInt32(t + 8, !0),
|
|
125
124
|
end: n.getInt32(t + 12, !0)
|
|
126
|
-
}, c = n.getInt32(t + 16, !0),
|
|
125
|
+
}, c = n.getInt32(t + 16, !0), u = c ? String.fromCharCode(c) : void 0, f = n.getInt32(t + 20, !0), m = n.getInt32(t + 24, !0), { refIdToName: d, refNameToId: l } = this._parseNameBytes(e.subarray(t + 28, t + 28 + m));
|
|
127
126
|
return {
|
|
128
127
|
refIdToName: d,
|
|
129
128
|
refNameToId: l,
|
|
130
129
|
skipLines: f,
|
|
131
|
-
metaChar:
|
|
130
|
+
metaChar: u,
|
|
132
131
|
columnNumbers: s,
|
|
133
132
|
format: r,
|
|
134
133
|
coordinateType: o
|
|
135
134
|
};
|
|
136
135
|
}
|
|
137
136
|
async _parse(e = {}) {
|
|
138
|
-
const t = await
|
|
137
|
+
const t = await q(await this.filehandle.readFile(e)), n = new DataView(t.buffer);
|
|
139
138
|
let i;
|
|
140
139
|
if (n.getUint32(0, !0) === te)
|
|
141
140
|
i = 1;
|
|
@@ -152,27 +151,27 @@ class q extends j {
|
|
|
152
151
|
coordinateType: "zero-based-half-open",
|
|
153
152
|
format: "generic"
|
|
154
153
|
}, c = n.getInt32(16 + r, !0);
|
|
155
|
-
let
|
|
156
|
-
const
|
|
154
|
+
let u, f = 16 + r + 4;
|
|
155
|
+
const m = new Array(c).fill(0).map(() => {
|
|
157
156
|
const d = n.getInt32(f, !0);
|
|
158
157
|
f += 4;
|
|
159
158
|
const l = {};
|
|
160
159
|
let h;
|
|
161
|
-
for (let
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
160
|
+
for (let S = 0; S < d; S += 1) {
|
|
161
|
+
const C = n.getUint32(f, !0);
|
|
162
|
+
if (C > this.maxBinNumber)
|
|
164
163
|
h = this.parsePseudoBin(t, f + 4), f += 48;
|
|
165
164
|
else {
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
const
|
|
165
|
+
const I = A(t, f + 4);
|
|
166
|
+
u = this._findFirstData(u, I);
|
|
167
|
+
const k = n.getInt32(f + 12, !0);
|
|
169
168
|
f += 16;
|
|
170
|
-
const
|
|
171
|
-
for (let
|
|
172
|
-
const
|
|
173
|
-
f += 16,
|
|
169
|
+
const w = new Array(k);
|
|
170
|
+
for (let b = 0; b < k; b += 1) {
|
|
171
|
+
const x = A(t, f), g = A(t, f + 8);
|
|
172
|
+
f += 16, w[b] = new L(x, g, C);
|
|
174
173
|
}
|
|
175
|
-
l[
|
|
174
|
+
l[C] = w;
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
177
|
return { binIndex: l, stats: h };
|
|
@@ -182,9 +181,9 @@ class q extends j {
|
|
|
182
181
|
csi: !0,
|
|
183
182
|
refCount: c,
|
|
184
183
|
maxBlockSize: 65536,
|
|
185
|
-
firstDataLine:
|
|
184
|
+
firstDataLine: u,
|
|
186
185
|
csiVersion: i,
|
|
187
|
-
indices:
|
|
186
|
+
indices: m,
|
|
188
187
|
depth: this.depth,
|
|
189
188
|
maxBinNumber: this.maxBinNumber,
|
|
190
189
|
maxRefLength: o
|
|
@@ -203,13 +202,13 @@ class q extends j {
|
|
|
203
202
|
const s = o.indices[r];
|
|
204
203
|
if (!s)
|
|
205
204
|
return [];
|
|
206
|
-
const c = this.reg2bins(t, n),
|
|
207
|
-
for (const [f,
|
|
208
|
-
for (let d = f; d <=
|
|
205
|
+
const c = this.reg2bins(t, n), u = [];
|
|
206
|
+
for (const [f, m] of c)
|
|
207
|
+
for (let d = f; d <= m; d++)
|
|
209
208
|
if (s.binIndex[d])
|
|
210
209
|
for (const l of s.binIndex[d])
|
|
211
|
-
|
|
212
|
-
return X(
|
|
210
|
+
u.push(new L(l.minv, l.maxv, d));
|
|
211
|
+
return X(u, new E(0, 0));
|
|
213
212
|
}
|
|
214
213
|
/**
|
|
215
214
|
* calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)
|
|
@@ -238,15 +237,14 @@ function ae(a, e) {
|
|
|
238
237
|
[4681 + (a >> 14), 4681 + (e >> 14)]
|
|
239
238
|
];
|
|
240
239
|
}
|
|
241
|
-
class
|
|
240
|
+
class D extends j {
|
|
242
241
|
async lineCount(e, t = {}) {
|
|
243
|
-
var r;
|
|
244
242
|
const n = await this.parse(t), i = n.refNameToId[e];
|
|
245
|
-
return i === void 0 || !n.indices[i] ? -1 :
|
|
243
|
+
return i === void 0 || !n.indices[i] ? -1 : n.indices[i].stats?.lineCount ?? -1;
|
|
246
244
|
}
|
|
247
245
|
// fetch and parse the index
|
|
248
246
|
async _parse(e = {}) {
|
|
249
|
-
const t = await this.filehandle.readFile(e), n = await
|
|
247
|
+
const t = await this.filehandle.readFile(e), n = await q(t), i = new DataView(n.buffer);
|
|
250
248
|
if (i.getUint32(0, !0) !== re)
|
|
251
249
|
throw new Error("Not a TBI file");
|
|
252
250
|
const r = i.getUint32(4, !0), s = i.getUint32(8, !0), c = s & 65536 ? "zero-based-half-open" : "1-based-closed", f = {
|
|
@@ -256,57 +254,57 @@ class R extends j {
|
|
|
256
254
|
}[s & 15];
|
|
257
255
|
if (!f)
|
|
258
256
|
throw new Error(`invalid Tabix preset format flags ${s}`);
|
|
259
|
-
const
|
|
257
|
+
const m = {
|
|
260
258
|
ref: i.getInt32(12, !0),
|
|
261
259
|
start: i.getInt32(16, !0),
|
|
262
260
|
end: i.getInt32(20, !0)
|
|
263
|
-
}, d = i.getInt32(24, !0), l = 5, h = ((1 << (l + 1) * 3) - 1) / 7,
|
|
264
|
-
let
|
|
261
|
+
}, d = i.getInt32(24, !0), l = 5, h = ((1 << (l + 1) * 3) - 1) / 7, S = 2 ** (14 + l * 3), C = d ? String.fromCharCode(d) : void 0, I = i.getInt32(28, !0), k = i.getInt32(32, !0), { refNameToId: w, refIdToName: b } = this._parseNameBytes(n.slice(36, 36 + k));
|
|
262
|
+
let x = 36 + k, g;
|
|
265
263
|
return {
|
|
266
264
|
indices: new Array(r).fill(0).map(() => {
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
let
|
|
271
|
-
for (let
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
265
|
+
const y = i.getInt32(x, !0);
|
|
266
|
+
x += 4;
|
|
267
|
+
const B = {};
|
|
268
|
+
let M;
|
|
269
|
+
for (let T = 0; T < y; T += 1) {
|
|
270
|
+
const v = i.getUint32(x, !0);
|
|
271
|
+
if (x += 4, v > h + 1)
|
|
274
272
|
throw new Error("tabix index contains too many bins, please use a CSI index");
|
|
275
|
-
if (
|
|
276
|
-
const
|
|
277
|
-
|
|
273
|
+
if (v === h + 1) {
|
|
274
|
+
const _ = i.getInt32(x, !0);
|
|
275
|
+
x += 4, _ === 2 && (M = this.parsePseudoBin(n, x)), x += 16 * _;
|
|
278
276
|
} else {
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
for (let
|
|
283
|
-
const $ = A(n,
|
|
284
|
-
|
|
277
|
+
const _ = i.getInt32(x, !0);
|
|
278
|
+
x += 4;
|
|
279
|
+
const O = new Array(_);
|
|
280
|
+
for (let z = 0; z < _; z += 1) {
|
|
281
|
+
const $ = A(n, x), Y = A(n, x + 8);
|
|
282
|
+
x += 16, g = this._findFirstData(g, $), O[z] = new L($, Y, v);
|
|
285
283
|
}
|
|
286
|
-
|
|
284
|
+
B[v] = O;
|
|
287
285
|
}
|
|
288
286
|
}
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
for (let
|
|
293
|
-
|
|
287
|
+
const P = i.getInt32(x, !0);
|
|
288
|
+
x += 4;
|
|
289
|
+
const N = new Array(P);
|
|
290
|
+
for (let T = 0; T < P; T += 1)
|
|
291
|
+
N[T] = A(n, x), x += 8, g = this._findFirstData(g, N[T]);
|
|
294
292
|
return {
|
|
295
|
-
binIndex:
|
|
296
|
-
linearIndex:
|
|
297
|
-
stats:
|
|
293
|
+
binIndex: B,
|
|
294
|
+
linearIndex: N,
|
|
295
|
+
stats: M
|
|
298
296
|
};
|
|
299
297
|
}),
|
|
300
|
-
metaChar:
|
|
298
|
+
metaChar: C,
|
|
301
299
|
maxBinNumber: h,
|
|
302
|
-
maxRefLength:
|
|
303
|
-
skipLines:
|
|
304
|
-
firstDataLine:
|
|
305
|
-
columnNumbers:
|
|
300
|
+
maxRefLength: S,
|
|
301
|
+
skipLines: I,
|
|
302
|
+
firstDataLine: g,
|
|
303
|
+
columnNumbers: m,
|
|
306
304
|
coordinateType: c,
|
|
307
305
|
format: f,
|
|
308
|
-
refIdToName:
|
|
309
|
-
refNameToId:
|
|
306
|
+
refIdToName: b,
|
|
307
|
+
refNameToId: w,
|
|
310
308
|
maxBlockSize: 65536
|
|
311
309
|
};
|
|
312
310
|
}
|
|
@@ -323,19 +321,19 @@ class R extends j {
|
|
|
323
321
|
const s = o.indices[r];
|
|
324
322
|
if (!s)
|
|
325
323
|
return [];
|
|
326
|
-
(s.linearIndex.length > 0 ? s.linearIndex[t >> G >= s.linearIndex.length ? s.linearIndex.length - 1 : t >> G] : new
|
|
327
|
-
const
|
|
328
|
-
for (const [
|
|
329
|
-
for (let
|
|
330
|
-
if (s.binIndex[
|
|
331
|
-
for (const
|
|
332
|
-
f.push(new L(
|
|
333
|
-
const
|
|
324
|
+
(s.linearIndex.length > 0 ? s.linearIndex[t >> G >= s.linearIndex.length ? s.linearIndex.length - 1 : t >> G] : new E(0, 0)) || console.warn("querying outside of possible tabix range");
|
|
325
|
+
const u = ae(t, n), f = [];
|
|
326
|
+
for (const [S, C] of u)
|
|
327
|
+
for (let I = S; I <= C; I++)
|
|
328
|
+
if (s.binIndex[I])
|
|
329
|
+
for (const k of s.binIndex[I])
|
|
330
|
+
f.push(new L(k.minv, k.maxv, I));
|
|
331
|
+
const m = s.linearIndex.length;
|
|
334
332
|
let d;
|
|
335
|
-
const l = Math.min(t >> 14,
|
|
336
|
-
for (let
|
|
337
|
-
const
|
|
338
|
-
|
|
333
|
+
const l = Math.min(t >> 14, m - 1), h = Math.min(n >> 14, m - 1);
|
|
334
|
+
for (let S = l; S <= h; ++S) {
|
|
335
|
+
const C = s.linearIndex[S];
|
|
336
|
+
C && (!d || C.compareTo(d) < 0) && (d = C);
|
|
339
337
|
}
|
|
340
338
|
return X(f, d);
|
|
341
339
|
}
|
|
@@ -367,7 +365,7 @@ class he {
|
|
|
367
365
|
* indexing and querying. note that the data that is returned is not altered,
|
|
368
366
|
* just the names of the reference sequences that are used for querying.
|
|
369
367
|
*/
|
|
370
|
-
constructor({ path: e, filehandle: t, url: n, tbiPath: i, tbiUrl: o, tbiFilehandle: r, csiPath: s, csiUrl: c, csiFilehandle:
|
|
368
|
+
constructor({ path: e, filehandle: t, url: n, tbiPath: i, tbiUrl: o, tbiFilehandle: r, csiPath: s, csiUrl: c, csiFilehandle: u, renameRefSeqs: f, chunkCacheSize: m = 5 * 2 ** 20 }) {
|
|
371
369
|
this.cache = new U({
|
|
372
370
|
maxSize: 1e3
|
|
373
371
|
});
|
|
@@ -375,52 +373,52 @@ class he {
|
|
|
375
373
|
if (t)
|
|
376
374
|
this.filehandle = t;
|
|
377
375
|
else if (e)
|
|
378
|
-
this.filehandle = new
|
|
376
|
+
this.filehandle = new R(e);
|
|
379
377
|
else if (n)
|
|
380
|
-
this.filehandle = new
|
|
378
|
+
this.filehandle = new F(n);
|
|
381
379
|
else
|
|
382
380
|
throw new TypeError("must provide either filehandle or path");
|
|
383
381
|
if (r)
|
|
384
|
-
this.index = new
|
|
382
|
+
this.index = new D({
|
|
385
383
|
filehandle: r,
|
|
386
384
|
renameRefSeqs: d
|
|
387
385
|
});
|
|
388
|
-
else if (
|
|
389
|
-
this.index = new
|
|
390
|
-
filehandle:
|
|
386
|
+
else if (u)
|
|
387
|
+
this.index = new V({
|
|
388
|
+
filehandle: u,
|
|
391
389
|
renameRefSeqs: d
|
|
392
390
|
});
|
|
393
391
|
else if (i)
|
|
394
|
-
this.index = new
|
|
395
|
-
filehandle: new
|
|
392
|
+
this.index = new D({
|
|
393
|
+
filehandle: new R(i),
|
|
396
394
|
renameRefSeqs: d
|
|
397
395
|
});
|
|
398
396
|
else if (s)
|
|
399
|
-
this.index = new
|
|
400
|
-
filehandle: new
|
|
397
|
+
this.index = new V({
|
|
398
|
+
filehandle: new R(s),
|
|
401
399
|
renameRefSeqs: d
|
|
402
400
|
});
|
|
403
401
|
else if (e)
|
|
404
|
-
this.index = new
|
|
405
|
-
filehandle: new
|
|
402
|
+
this.index = new D({
|
|
403
|
+
filehandle: new R(`${e}.tbi`),
|
|
406
404
|
renameRefSeqs: d
|
|
407
405
|
});
|
|
408
406
|
else if (c)
|
|
409
|
-
this.index = new
|
|
410
|
-
filehandle: new
|
|
407
|
+
this.index = new V({
|
|
408
|
+
filehandle: new F(c)
|
|
411
409
|
});
|
|
412
410
|
else if (o)
|
|
413
|
-
this.index = new
|
|
414
|
-
filehandle: new
|
|
411
|
+
this.index = new D({
|
|
412
|
+
filehandle: new F(o)
|
|
415
413
|
});
|
|
416
414
|
else if (n)
|
|
417
|
-
this.index = new
|
|
418
|
-
filehandle: new
|
|
415
|
+
this.index = new D({
|
|
416
|
+
filehandle: new F(`${n}.tbi`)
|
|
419
417
|
});
|
|
420
418
|
else
|
|
421
419
|
throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl");
|
|
422
420
|
this.renameRefSeq = d, this.hasCustomRenameRefSeq = f !== void 0, this.chunkCache = new J({
|
|
423
|
-
cache: new U({ maxSize: Math.floor(
|
|
421
|
+
cache: new U({ maxSize: Math.floor(m / 65536) }),
|
|
424
422
|
fill: (l, h) => this.readChunk(l, { signal: h })
|
|
425
423
|
});
|
|
426
424
|
}
|
|
@@ -441,55 +439,54 @@ class he {
|
|
|
441
439
|
return e[n] * 256 + (i - t[n]) + o + 1;
|
|
442
440
|
}
|
|
443
441
|
async getLines(e, t, n, i) {
|
|
444
|
-
var I;
|
|
445
442
|
let o, r = {}, s;
|
|
446
443
|
typeof i == "function" ? s = i : (r = i, s = i.lineCallback, o = i.signal);
|
|
447
|
-
const c = await this.index.getMetadata(r),
|
|
448
|
-
if (!(
|
|
444
|
+
const c = await this.index.getMetadata(r), u = t ?? 0, f = n ?? c.maxRefLength;
|
|
445
|
+
if (!(u <= f))
|
|
449
446
|
throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");
|
|
450
|
-
if (
|
|
447
|
+
if (u === f)
|
|
451
448
|
return;
|
|
452
|
-
const
|
|
449
|
+
const m = await this.index.blocksForRange(e, u, f, r), d = new TextDecoder("utf8"), l = c.format === "VCF", h = {
|
|
453
450
|
ref: c.columnNumbers.ref || 0,
|
|
454
451
|
start: c.columnNumbers.start || 0,
|
|
455
452
|
end: l ? 8 : c.columnNumbers.end || 0
|
|
456
|
-
},
|
|
457
|
-
for (const
|
|
458
|
-
const { buffer:
|
|
459
|
-
let
|
|
460
|
-
const
|
|
461
|
-
if (
|
|
462
|
-
for (;
|
|
463
|
-
const
|
|
464
|
-
`,
|
|
465
|
-
if (
|
|
453
|
+
}, S = Math.max(h.ref, h.start, h.end), C = c.metaChar?.charCodeAt(0), I = c.coordinateType === "1-based-closed" ? -1 : 0, k = !this.hasCustomRenameRefSeq;
|
|
454
|
+
for (const w of m) {
|
|
455
|
+
const { buffer: b, cpositions: x, dpositions: g } = await this.chunkCache.get(w.toString(), w, o);
|
|
456
|
+
let p = 0, y = 0;
|
|
457
|
+
const B = d.decode(b);
|
|
458
|
+
if (b.length == B.length)
|
|
459
|
+
for (; p < B.length; ) {
|
|
460
|
+
const P = B.indexOf(`
|
|
461
|
+
`, p);
|
|
462
|
+
if (P === -1)
|
|
466
463
|
break;
|
|
467
|
-
const
|
|
468
|
-
if (
|
|
469
|
-
const
|
|
470
|
-
for (;
|
|
471
|
-
|
|
464
|
+
const N = B.slice(p, P);
|
|
465
|
+
if (g) {
|
|
466
|
+
const v = p + w.minv.dataPosition;
|
|
467
|
+
for (; y < g.length && v >= g[y]; )
|
|
468
|
+
y++;
|
|
472
469
|
}
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
470
|
+
const T = this.checkLine(e, u, f, N, h.ref, h.start, h.end, S, C, I, l, k);
|
|
471
|
+
if (T === null)
|
|
475
472
|
return;
|
|
476
|
-
|
|
473
|
+
T !== void 0 && s(N, this.calculateFileOffset(x, g, y, p, w.minv.dataPosition), T.start, T.end), p = P + 1;
|
|
477
474
|
}
|
|
478
475
|
else
|
|
479
|
-
for (;
|
|
480
|
-
const
|
|
481
|
-
if (
|
|
476
|
+
for (; p < b.length; ) {
|
|
477
|
+
const P = b.indexOf(10, p);
|
|
478
|
+
if (P === -1)
|
|
482
479
|
break;
|
|
483
|
-
const
|
|
484
|
-
if (
|
|
485
|
-
const
|
|
486
|
-
for (;
|
|
487
|
-
|
|
480
|
+
const N = b.slice(p, P), T = d.decode(N);
|
|
481
|
+
if (g) {
|
|
482
|
+
const _ = p + w.minv.dataPosition;
|
|
483
|
+
for (; y < g.length && _ >= g[y]; )
|
|
484
|
+
y++;
|
|
488
485
|
}
|
|
489
|
-
const
|
|
490
|
-
if (
|
|
486
|
+
const v = this.checkLine(e, u, f, T, h.ref, h.start, h.end, S, C, I, l, k);
|
|
487
|
+
if (v === null)
|
|
491
488
|
return;
|
|
492
|
-
|
|
489
|
+
v !== void 0 && s(T, this.calculateFileOffset(x, g, y, p, w.minv.dataPosition), v.start, v.end), p = P + 1;
|
|
493
490
|
}
|
|
494
491
|
}
|
|
495
492
|
}
|
|
@@ -501,15 +498,15 @@ class he {
|
|
|
501
498
|
* bytes up to the first non-meta line
|
|
502
499
|
*/
|
|
503
500
|
async getHeaderBuffer(e = {}) {
|
|
504
|
-
const { firstDataLine: t, metaChar: n, maxBlockSize: i } = await this.getMetadata(e), o = (
|
|
501
|
+
const { firstDataLine: t, metaChar: n, maxBlockSize: i } = await this.getMetadata(e), o = (t?.blockPosition || 0) + i, r = await this.filehandle.read(o, 0, e), s = await q(r);
|
|
505
502
|
if (n) {
|
|
506
503
|
let c = -1;
|
|
507
|
-
const
|
|
508
|
-
for (let
|
|
509
|
-
const l = s[
|
|
510
|
-
if (
|
|
504
|
+
const u = 10, f = n.charCodeAt(0);
|
|
505
|
+
for (let m = 0, d = s.length; m < d; m++) {
|
|
506
|
+
const l = s[m];
|
|
507
|
+
if (m === c + 1 && l !== f)
|
|
511
508
|
break;
|
|
512
|
-
l ===
|
|
509
|
+
l === u && (c = m);
|
|
513
510
|
}
|
|
514
511
|
return s.subarray(0, c + 1);
|
|
515
512
|
}
|
|
@@ -557,38 +554,38 @@ class he {
|
|
|
557
554
|
*
|
|
558
555
|
* @returns {{ start: number, end: number } | null | undefined} coordinates if overlapping, null if should stop processing, undefined otherwise
|
|
559
556
|
*/
|
|
560
|
-
checkLine(e, t, n, i, o, r, s, c,
|
|
561
|
-
if (
|
|
557
|
+
checkLine(e, t, n, i, o, r, s, c, u, f, m, d) {
|
|
558
|
+
if (u !== void 0 && i.charCodeAt(0) === u)
|
|
562
559
|
return;
|
|
563
560
|
if (i.length < 500) {
|
|
564
|
-
const
|
|
565
|
-
if (!(d ?
|
|
561
|
+
const w = i.split(" "), b = w[o - 1];
|
|
562
|
+
if (!(d ? b === e : this.renameRefSeq(b) === e))
|
|
566
563
|
return;
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
564
|
+
const g = +w[r - 1] + f;
|
|
565
|
+
if (g >= n)
|
|
569
566
|
return null;
|
|
570
|
-
let
|
|
571
|
-
return s === 0 || s === r ?
|
|
567
|
+
let p;
|
|
568
|
+
return s === 0 || s === r ? p = g + 1 : m ? p = this._getVcfEnd(g, w[3], w[s - 1]) : p = +w[s - 1], p <= t ? void 0 : { start: g, end: p };
|
|
572
569
|
}
|
|
573
570
|
let l = -1;
|
|
574
571
|
const h = [-1];
|
|
575
|
-
for (let
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
572
|
+
for (let w = 0; w < c; w++) {
|
|
573
|
+
const b = i.indexOf(" ", l + 1);
|
|
574
|
+
if (b === -1) {
|
|
578
575
|
h.push(i.length);
|
|
579
576
|
break;
|
|
580
577
|
}
|
|
581
|
-
h.push(
|
|
578
|
+
h.push(b), l = b;
|
|
582
579
|
}
|
|
583
|
-
const
|
|
584
|
-
if (!(d ?
|
|
580
|
+
const S = i.slice(h[o - 1] + 1, h[o]);
|
|
581
|
+
if (!(d ? S === e : this.renameRefSeq(S) === e))
|
|
585
582
|
return;
|
|
586
|
-
const
|
|
587
|
-
if (
|
|
583
|
+
const I = +i.slice(h[r - 1] + 1, h[r]) + f;
|
|
584
|
+
if (I >= n)
|
|
588
585
|
return null;
|
|
589
|
-
let
|
|
590
|
-
if (s === 0 || s === r ?
|
|
591
|
-
return { start:
|
|
586
|
+
let k;
|
|
587
|
+
if (s === 0 || s === r ? k = I + 1 : m ? k = this._getVcfEnd(I, i.slice(h[3] + 1, h[4]), i.slice(h[s - 1] + 1, h[s])) : k = +i.slice(h[s - 1] + 1, h[s]), !(k <= t))
|
|
588
|
+
return { start: I, end: k };
|
|
592
589
|
}
|
|
593
590
|
_getVcfEnd(e, t, n) {
|
|
594
591
|
let i = e + t.length;
|
|
@@ -625,7 +622,7 @@ class he {
|
|
|
625
622
|
}
|
|
626
623
|
}
|
|
627
624
|
export {
|
|
628
|
-
|
|
629
|
-
|
|
625
|
+
V as CSI,
|
|
626
|
+
D as TBI,
|
|
630
627
|
he as TabixIndexedFile
|
|
631
628
|
};
|