@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,78 +1,78 @@
|
|
|
1
|
-
function
|
|
2
|
-
const r = /* @__PURE__ */ Object.create(null),
|
|
1
|
+
function S(m, t, e) {
|
|
2
|
+
const r = /* @__PURE__ */ Object.create(null), o = e.length, s = t.length, c = 9, i = 58;
|
|
3
3
|
let n = 0;
|
|
4
|
-
if (
|
|
5
|
-
for (let
|
|
6
|
-
const
|
|
7
|
-
for (; n <
|
|
4
|
+
if (m === "GT") {
|
|
5
|
+
for (let l = 0; l < o; l++) {
|
|
6
|
+
const d = n;
|
|
7
|
+
for (; n < s && t.charCodeAt(n) !== c; )
|
|
8
8
|
n++;
|
|
9
|
-
r[e[
|
|
9
|
+
r[e[l]] = t.slice(d, n), n++;
|
|
10
10
|
}
|
|
11
11
|
return r;
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
13
|
+
const a = m.indexOf("GT");
|
|
14
|
+
if (a === -1)
|
|
15
15
|
return r;
|
|
16
|
-
if (
|
|
17
|
-
for (let
|
|
18
|
-
const
|
|
19
|
-
for (; n <
|
|
16
|
+
if (a === 0) {
|
|
17
|
+
for (let l = 0; l < o; l++) {
|
|
18
|
+
const d = n;
|
|
19
|
+
for (; n < s && t.charCodeAt(n) !== i && t.charCodeAt(n) !== c; )
|
|
20
20
|
n++;
|
|
21
|
-
for (r[e[
|
|
21
|
+
for (r[e[l]] = t.slice(d, n); n < s && t.charCodeAt(n) !== c; )
|
|
22
22
|
n++;
|
|
23
23
|
n++;
|
|
24
24
|
}
|
|
25
25
|
return r;
|
|
26
26
|
}
|
|
27
|
-
let
|
|
28
|
-
for (let
|
|
29
|
-
|
|
30
|
-
for (let
|
|
31
|
-
const
|
|
32
|
-
let
|
|
33
|
-
for (;
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
for (let
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
39
|
-
r[e[
|
|
27
|
+
let u = 0;
|
|
28
|
+
for (let l = 0; l < a; l++)
|
|
29
|
+
m.charCodeAt(l) === i && u++;
|
|
30
|
+
for (let l = 0; l < o; l++) {
|
|
31
|
+
const d = n;
|
|
32
|
+
let f = n;
|
|
33
|
+
for (; f < s && t.charCodeAt(f) !== c; )
|
|
34
|
+
f++;
|
|
35
|
+
let y = 0, b = d;
|
|
36
|
+
for (let p = d; p <= f; p++)
|
|
37
|
+
if (p === f || t.charCodeAt(p) === i) {
|
|
38
|
+
if (y === u) {
|
|
39
|
+
r[e[l]] = t.slice(b, p);
|
|
40
40
|
break;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
y++, b = p + 1;
|
|
43
43
|
}
|
|
44
|
-
n =
|
|
44
|
+
n = f + 1;
|
|
45
45
|
}
|
|
46
46
|
return r;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function R(m) {
|
|
49
49
|
const t = [], e = [];
|
|
50
|
-
let r = !1,
|
|
51
|
-
const
|
|
52
|
-
for (let
|
|
53
|
-
const
|
|
54
|
-
|
|
50
|
+
let r = !1, o = !1;
|
|
51
|
+
const s = m.length;
|
|
52
|
+
for (let c = 0; c < s; c++) {
|
|
53
|
+
const i = m[c];
|
|
54
|
+
i === '"' ? (r = !r, e.push(i)) : i === "[" ? (o = !0, e.push(i)) : i === "]" ? (o = !1, e.push(i)) : i === "," && !r && !o ? (t.push(e.join("").trim()), e.length = 0) : e.push(i);
|
|
55
55
|
}
|
|
56
56
|
return e.length > 0 && t.push(e.join("").trim()), t;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
const e =
|
|
60
|
-
return [
|
|
58
|
+
function E(m, t) {
|
|
59
|
+
const e = m.indexOf(t);
|
|
60
|
+
return [m.slice(0, e), m.slice(e + 1)];
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const t =
|
|
64
|
-
for (let
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
const n =
|
|
68
|
-
for (let
|
|
69
|
-
n[
|
|
70
|
-
r.push([
|
|
71
|
-
} else
|
|
62
|
+
function F(m) {
|
|
63
|
+
const t = m.slice(1, -1), e = R(t), r = [];
|
|
64
|
+
for (let o = 0; o < e.length; o++) {
|
|
65
|
+
const s = e[o], [c, i] = E(s, "=");
|
|
66
|
+
if (i && i.startsWith("[") && i.endsWith("]")) {
|
|
67
|
+
const n = i.slice(1, -1).split(",");
|
|
68
|
+
for (let a = 0; a < n.length; a++)
|
|
69
|
+
n[a] = n[a].trim();
|
|
70
|
+
r.push([c, n]);
|
|
71
|
+
} else i && i.startsWith('"') && i.endsWith('"') ? r.push([c, i.slice(1, -1)]) : r.push([c, i]);
|
|
72
72
|
}
|
|
73
73
|
return Object.fromEntries(r);
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const A = {
|
|
76
76
|
// INFO fields
|
|
77
77
|
InfoFields: {
|
|
78
78
|
// from the VCF4.3 spec, https://samtools.github.io/hts-specs/VCFv4.3.pdf
|
|
@@ -417,14 +417,14 @@ const S = {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
};
|
|
420
|
-
function
|
|
420
|
+
function C(m) {
|
|
421
421
|
try {
|
|
422
|
-
return decodeURIComponent(
|
|
422
|
+
return decodeURIComponent(m);
|
|
423
423
|
} catch {
|
|
424
|
-
return
|
|
424
|
+
return m;
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
class
|
|
427
|
+
class L {
|
|
428
428
|
constructor({ header: t = "", strict: e = !0 }) {
|
|
429
429
|
if (!t.length)
|
|
430
430
|
throw new Error("empty header received");
|
|
@@ -432,22 +432,22 @@ class M {
|
|
|
432
432
|
if (!r.length)
|
|
433
433
|
throw new Error("no non-empty header lines specified");
|
|
434
434
|
this.strict = e, this.metadata = {
|
|
435
|
-
INFO: { ...
|
|
436
|
-
FORMAT: { ...
|
|
437
|
-
ALT: { ...
|
|
438
|
-
FILTER: { ...
|
|
435
|
+
INFO: { ...A.InfoFields },
|
|
436
|
+
FORMAT: { ...A.GenotypeFields },
|
|
437
|
+
ALT: { ...A.AltTypes },
|
|
438
|
+
FILTER: { ...A.FilterTypes }
|
|
439
439
|
};
|
|
440
|
-
let
|
|
440
|
+
let o;
|
|
441
441
|
for (let n = 0; n < r.length; n++) {
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
444
|
-
|
|
442
|
+
const a = r[n];
|
|
443
|
+
if (a.startsWith("#"))
|
|
444
|
+
a.startsWith("##") ? this.parseMetadata(a) : o = a;
|
|
445
445
|
else throw new Error(`Bad line in header:
|
|
446
|
-
${
|
|
446
|
+
${a}`);
|
|
447
447
|
}
|
|
448
|
-
if (!
|
|
448
|
+
if (!o)
|
|
449
449
|
throw new Error("No format line found in header");
|
|
450
|
-
const
|
|
450
|
+
const s = o.trim().split(" "), c = s.slice(0, 8), i = [
|
|
451
451
|
"#CHROM",
|
|
452
452
|
"POS",
|
|
453
453
|
"ID",
|
|
@@ -457,85 +457,83 @@ ${c}`);
|
|
|
457
457
|
"FILTER",
|
|
458
458
|
"INFO"
|
|
459
459
|
];
|
|
460
|
-
if (
|
|
460
|
+
if (s.length < 8)
|
|
461
461
|
throw new Error(`VCF header missing columns:
|
|
462
|
-
${
|
|
463
|
-
if (
|
|
462
|
+
${o}`);
|
|
463
|
+
if (c.length !== i.length || !c.every((n, a) => n === i[a]))
|
|
464
464
|
throw new Error(`VCF column headers not correct:
|
|
465
|
-
${
|
|
466
|
-
this.samples =
|
|
465
|
+
${o}`);
|
|
466
|
+
this.samples = s.slice(9);
|
|
467
467
|
}
|
|
468
468
|
parseInfo(t) {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
e[o] = !0;
|
|
469
|
+
const e = {}, r = t.includes("%"), o = t.split(";"), s = this.metadata.INFO, c = o.length;
|
|
470
|
+
for (let i = 0; i < c; i++) {
|
|
471
|
+
const n = o[i], a = n.indexOf("="), u = a === -1 ? n : n.slice(0, a), l = a === -1 ? void 0 : n.slice(a + 1), d = s[u]?.Type;
|
|
472
|
+
if (d === "Flag")
|
|
473
|
+
e[u] = !0;
|
|
474
|
+
else if (!l)
|
|
475
|
+
e[u] = !0;
|
|
477
476
|
else {
|
|
478
|
-
const
|
|
477
|
+
const f = d === "Integer" || d === "Float", y = l.split(","), b = y.length;
|
|
479
478
|
if (r) {
|
|
480
|
-
const
|
|
481
|
-
for (let
|
|
482
|
-
const
|
|
483
|
-
if (
|
|
484
|
-
|
|
479
|
+
const p = [];
|
|
480
|
+
for (let h = 0; h < b; h++) {
|
|
481
|
+
const D = y[h];
|
|
482
|
+
if (D === ".")
|
|
483
|
+
p.push(void 0);
|
|
485
484
|
else {
|
|
486
|
-
const
|
|
487
|
-
|
|
485
|
+
const g = C(D);
|
|
486
|
+
p.push(f ? Number(g) : g);
|
|
488
487
|
}
|
|
489
488
|
}
|
|
490
|
-
e[
|
|
489
|
+
e[u] = p;
|
|
491
490
|
} else {
|
|
492
|
-
const
|
|
493
|
-
for (let
|
|
494
|
-
const
|
|
495
|
-
|
|
491
|
+
const p = [];
|
|
492
|
+
for (let h = 0; h < b; h++) {
|
|
493
|
+
const D = y[h];
|
|
494
|
+
D === "." ? p.push(void 0) : p.push(f ? Number(D) : D);
|
|
496
495
|
}
|
|
497
|
-
e[
|
|
496
|
+
e[u] = p;
|
|
498
497
|
}
|
|
499
498
|
}
|
|
500
499
|
}
|
|
501
500
|
return e;
|
|
502
501
|
}
|
|
503
502
|
parseSamples(t, e) {
|
|
504
|
-
var i;
|
|
505
503
|
const r = {};
|
|
506
504
|
if (t) {
|
|
507
|
-
const
|
|
508
|
-
for (let
|
|
509
|
-
const
|
|
510
|
-
|
|
505
|
+
const o = e.split(" "), s = t.split(":"), c = this.metadata.FORMAT, i = [];
|
|
506
|
+
for (let u = 0; u < s.length; u++) {
|
|
507
|
+
const l = c[s[u]]?.Type;
|
|
508
|
+
i.push(l === "Integer" || l === "Float");
|
|
511
509
|
}
|
|
512
|
-
const
|
|
513
|
-
for (let
|
|
514
|
-
const
|
|
515
|
-
let
|
|
516
|
-
for (let
|
|
517
|
-
if (
|
|
518
|
-
const
|
|
519
|
-
if (
|
|
520
|
-
|
|
510
|
+
const n = s.length, a = this.samples.length;
|
|
511
|
+
for (let u = 0; u < a; u++) {
|
|
512
|
+
const l = this.samples[u], d = {}, f = o[u], y = f.length;
|
|
513
|
+
let b = 0, p = 0;
|
|
514
|
+
for (let h = 0; h <= y; h++)
|
|
515
|
+
if (h === y || f[h] === ":") {
|
|
516
|
+
const D = f.slice(b, h);
|
|
517
|
+
if (D === "" || D === ".")
|
|
518
|
+
d[s[p]] = void 0;
|
|
521
519
|
else {
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
524
|
-
for (let
|
|
525
|
-
const
|
|
526
|
-
|
|
520
|
+
const g = D.split(","), T = [];
|
|
521
|
+
if (i[p])
|
|
522
|
+
for (let N = 0; N < g.length; N++) {
|
|
523
|
+
const I = g[N];
|
|
524
|
+
T.push(I === "." ? void 0 : +I);
|
|
527
525
|
}
|
|
528
526
|
else
|
|
529
|
-
for (let
|
|
530
|
-
const
|
|
531
|
-
|
|
527
|
+
for (let N = 0; N < g.length; N++) {
|
|
528
|
+
const I = g[N];
|
|
529
|
+
T.push(I === "." ? void 0 : I);
|
|
532
530
|
}
|
|
533
|
-
|
|
531
|
+
d[s[p]] = T;
|
|
534
532
|
}
|
|
535
|
-
if (
|
|
533
|
+
if (b = h + 1, p += 1, p >= n)
|
|
536
534
|
break;
|
|
537
535
|
}
|
|
538
|
-
r[
|
|
536
|
+
r[l] = d;
|
|
539
537
|
}
|
|
540
538
|
}
|
|
541
539
|
return r;
|
|
@@ -551,13 +549,13 @@ ${i}`);
|
|
|
551
549
|
const e = /^##(.+?)=(.*)/.exec(t.trim());
|
|
552
550
|
if (!e)
|
|
553
551
|
throw new Error(`Line is not a valid metadata line: ${t}`);
|
|
554
|
-
const [r,
|
|
555
|
-
if (
|
|
556
|
-
|
|
557
|
-
const [
|
|
558
|
-
|
|
552
|
+
const [r, o] = e.slice(1, 3), s = r;
|
|
553
|
+
if (o?.startsWith("<")) {
|
|
554
|
+
s in this.metadata || (this.metadata[s] = {});
|
|
555
|
+
const [c, i] = this.parseStructuredMetaVal(o);
|
|
556
|
+
c ? this.metadata[s][c] = i : this.metadata[s] = i;
|
|
559
557
|
} else
|
|
560
|
-
this.metadata[
|
|
558
|
+
this.metadata[s] = o;
|
|
561
559
|
}
|
|
562
560
|
/**
|
|
563
561
|
* Parse a VCF header structured meta string (i.e. a meta value that starts
|
|
@@ -569,7 +567,7 @@ ${i}`);
|
|
|
569
567
|
* and 2) an object with the other key-value pairs in the metadata
|
|
570
568
|
*/
|
|
571
569
|
parseStructuredMetaVal(t) {
|
|
572
|
-
const e =
|
|
570
|
+
const e = F(t), r = e.ID;
|
|
573
571
|
return delete e.ID, "Number" in e && (Number.isNaN(Number(e.Number)) || (e.Number = Number(e.Number))), [r, e];
|
|
574
572
|
}
|
|
575
573
|
/**
|
|
@@ -584,8 +582,8 @@ ${i}`);
|
|
|
584
582
|
getMetadata(...t) {
|
|
585
583
|
let e = this.metadata;
|
|
586
584
|
const r = t.length;
|
|
587
|
-
for (let
|
|
588
|
-
if (e = e[t[
|
|
585
|
+
for (let o = 0; o < r; o++)
|
|
586
|
+
if (e = e[t[o]], !e)
|
|
589
587
|
return e;
|
|
590
588
|
return e;
|
|
591
589
|
}
|
|
@@ -635,25 +633,25 @@ ${i}`);
|
|
|
635
633
|
let e = 0, r = 0;
|
|
636
634
|
for (; e < t.length && r < 9; )
|
|
637
635
|
t[e] === " " && (r += 1), e += 1;
|
|
638
|
-
const
|
|
639
|
-
if (this.strict && !
|
|
636
|
+
const o = r === 9 ? e - 1 : e, s = t.slice(0, o).split(" "), c = t.slice(o + 1), [i, n, a, u, l, d, f] = s, y = i, b = +n, p = a === "." ? void 0 : a.split(";"), h = u, D = l === "." ? void 0 : l.split(","), g = d === "." ? void 0 : +d, T = f === "." ? void 0 : f.split(";"), N = s[8];
|
|
637
|
+
if (this.strict && !s[7])
|
|
640
638
|
throw new Error("no INFO field specified, must contain at least a '.' (turn off strict mode to allow)");
|
|
641
|
-
const
|
|
639
|
+
const I = s[7] === void 0 || s[7] === "." ? {} : this.parseInfo(s[7]);
|
|
642
640
|
return {
|
|
643
|
-
CHROM:
|
|
644
|
-
POS:
|
|
645
|
-
ALT:
|
|
646
|
-
INFO:
|
|
647
|
-
REF:
|
|
648
|
-
FILTER:
|
|
649
|
-
ID:
|
|
650
|
-
QUAL:
|
|
651
|
-
FORMAT:
|
|
652
|
-
SAMPLES: () => this.parseSamples(
|
|
653
|
-
GENOTYPES: () =>
|
|
641
|
+
CHROM: y,
|
|
642
|
+
POS: b,
|
|
643
|
+
ALT: D,
|
|
644
|
+
INFO: I,
|
|
645
|
+
REF: h,
|
|
646
|
+
FILTER: T?.length === 1 && T[0] === "PASS" ? "PASS" : T,
|
|
647
|
+
ID: p,
|
|
648
|
+
QUAL: g,
|
|
649
|
+
FORMAT: N,
|
|
650
|
+
SAMPLES: () => this.parseSamples(s[8] ?? "", c),
|
|
651
|
+
GENOTYPES: () => S(s[8] ?? "", c, this.samples)
|
|
654
652
|
};
|
|
655
653
|
}
|
|
656
654
|
}
|
|
657
655
|
export {
|
|
658
|
-
|
|
656
|
+
L as default
|
|
659
657
|
};
|