@genome-spy/app 0.73.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 (38) hide show
  1. package/dist/AbortablePromiseCache-3gHJdF3E.js +96 -0
  2. package/dist/blosc-oa0DlI6G.js +692 -0
  3. package/dist/browser-Dvlo92rx.js +126 -0
  4. package/dist/chunk-CPXzm0be.js +11 -0
  5. package/dist/chunk-INHXZS53-fPMmEwMt.js +13 -0
  6. package/dist/esm-B8-vSu-c.js +369 -0
  7. package/dist/esm-BDFRLEuD.js +1248 -0
  8. package/dist/esm-BygJiwh0.js +573 -0
  9. package/dist/esm-CGX-qz1d.js +155 -0
  10. package/dist/esm-Cmo4qEPr.js +1015 -0
  11. package/dist/esm-CuMSzCHy.js +298 -0
  12. package/dist/esm-D-WfYOx7.js +461 -0
  13. package/dist/esm-DCCYNvaz.js +1426 -0
  14. package/dist/esm-n0auOe11.js +121 -0
  15. package/dist/index.es.js +41039 -52718
  16. package/dist/index.js +1088 -1095
  17. package/dist/lz4-jZ0zyLBa.js +626 -0
  18. package/dist/parquetRead-CJe1UPsz.js +1609 -0
  19. package/dist/schema.json +8821 -2763
  20. package/dist/style.css +2 -1
  21. package/dist/zstd-C6ksIG9r.js +583 -0
  22. package/package.json +14 -5
  23. package/dist/AbortablePromiseCache-Dj0vzLnp.js +0 -149
  24. package/dist/blosc-D1xNXZJs.js +0 -719
  25. package/dist/browser-0iNU5Wit.js +0 -138
  26. package/dist/chunk-INHXZS53-DiyuLb3Z.js +0 -14
  27. package/dist/index-BUsSzlHg.js +0 -1771
  28. package/dist/index-BYsZN7b0.js +0 -1597
  29. package/dist/index-C7wOh6y1.js +0 -657
  30. package/dist/index-CRaQAuki.js +0 -326
  31. package/dist/index-D9v1PCj9.js +0 -507
  32. package/dist/index-GDOuv_D5.js +0 -266
  33. package/dist/index-Gt44EOIH.js +0 -628
  34. package/dist/inflate-GtwLkvSP.js +0 -1048
  35. package/dist/lz4-1Ws5oVWR.js +0 -640
  36. package/dist/parquetRead-BnAGCa4_.js +0 -1663
  37. package/dist/unzip-Bac01w6X.js +0 -1492
  38. package/dist/zstd-C4EcZnjq.js +0 -603
@@ -1,657 +0,0 @@
1
- function S(m, t, e) {
2
- const r = /* @__PURE__ */ Object.create(null), o = e.length, s = t.length, c = 9, i = 58;
3
- let n = 0;
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
- n++;
9
- r[e[l]] = t.slice(d, n), n++;
10
- }
11
- return r;
12
- }
13
- const a = m.indexOf("GT");
14
- if (a === -1)
15
- return r;
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
- n++;
21
- for (r[e[l]] = t.slice(d, n); n < s && t.charCodeAt(n) !== c; )
22
- n++;
23
- n++;
24
- }
25
- return r;
26
- }
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
- break;
41
- }
42
- y++, b = p + 1;
43
- }
44
- n = f + 1;
45
- }
46
- return r;
47
- }
48
- function R(m) {
49
- const t = [], e = [];
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
- }
56
- return e.length > 0 && t.push(e.join("").trim()), t;
57
- }
58
- function E(m, t) {
59
- const e = m.indexOf(t);
60
- return [m.slice(0, e), m.slice(e + 1)];
61
- }
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
- }
73
- return Object.fromEntries(r);
74
- }
75
- const A = {
76
- // INFO fields
77
- InfoFields: {
78
- // from the VCF4.3 spec, https://samtools.github.io/hts-specs/VCFv4.3.pdf
79
- AA: { Number: 1, Type: "String", Description: "Ancestral allele" },
80
- AC: {
81
- Number: "A",
82
- Type: "Integer",
83
- Description: "Allele count in genotypes, for each ALT allele, in the same order as listed"
84
- },
85
- AD: {
86
- Number: "R",
87
- Type: "Integer",
88
- Description: "Total read depth for each allele"
89
- },
90
- ADF: {
91
- Number: "R",
92
- Type: "Integer",
93
- Description: "Read depth for each allele on the forward strand"
94
- },
95
- ADR: {
96
- Number: "R",
97
- Type: "Integer",
98
- Description: "Read depth for each allele on the reverse strand"
99
- },
100
- AF: {
101
- Number: "A",
102
- Type: "Float",
103
- Description: "Allele frequency for each ALT allele in the same order as listed (estimated from primary data, not called genotypes)"
104
- },
105
- AN: {
106
- Number: 1,
107
- Type: "Integer",
108
- Description: "Total number of alleles in called genotypes"
109
- },
110
- BQ: {
111
- Number: 1,
112
- Type: "Float",
113
- Description: "RMS base quality"
114
- },
115
- CIGAR: {
116
- Number: 1,
117
- Type: "Float",
118
- Description: "Cigar string describing how to align an alternate allele to the reference allele"
119
- },
120
- DB: {
121
- Number: 0,
122
- Type: "Flag",
123
- Description: "dbSNP membership"
124
- },
125
- DP: {
126
- Number: 1,
127
- Type: "Integer",
128
- Description: "combined depth across samples"
129
- },
130
- END: {
131
- Number: 1,
132
- Type: "Integer",
133
- Description: "End position (for use with symbolic alleles)"
134
- },
135
- H2: {
136
- Number: 0,
137
- Type: "Flag",
138
- Description: "HapMap2 membership"
139
- },
140
- H3: {
141
- Number: 0,
142
- Type: "Flag",
143
- Description: "HapMap3 membership"
144
- },
145
- MQ: {
146
- Number: 1,
147
- Type: null,
148
- Description: "RMS mapping quality"
149
- },
150
- MQ0: {
151
- Number: 1,
152
- Type: "Integer",
153
- Description: "Number of MAPQ == 0 reads"
154
- },
155
- NS: {
156
- Number: 1,
157
- Type: "Integer",
158
- Description: "Number of samples with data"
159
- },
160
- SB: {
161
- Number: 4,
162
- Type: "Integer",
163
- Description: "Strand bias"
164
- },
165
- SOMATIC: {
166
- Number: 0,
167
- Type: "Flag",
168
- Description: "Somatic mutation (for cancer genomics)"
169
- },
170
- VALIDATED: {
171
- Number: 0,
172
- Type: "Flag",
173
- Description: "Validated by follow-up experiment"
174
- },
175
- "1000G": {
176
- Number: 0,
177
- Type: "Flag",
178
- Description: "1000 Genomes membership"
179
- },
180
- // specifically for structural variants
181
- IMPRECISE: {
182
- Number: 0,
183
- Type: "Flag",
184
- Description: "Imprecise structural variation"
185
- },
186
- NOVEL: {
187
- Number: 0,
188
- Type: "Flag",
189
- Description: "Indicates a novel structural variation"
190
- },
191
- // For precise variants, END is POS + length of REF allele - 1,
192
- // and the for imprecise variants the corresponding best estimate.
193
- SVTYPE: {
194
- Number: 1,
195
- Type: "String",
196
- Description: "Type of structural variant"
197
- },
198
- // Value should be one of DEL, INS, DUP, INV, CNV, BND. This key can
199
- // be derived from the REF/ALT fields but is useful for filtering.
200
- SVLEN: {
201
- Number: null,
202
- Type: "Integer",
203
- Description: "Difference in length between REF and ALT alleles"
204
- },
205
- // One value for each ALT allele. Longer ALT alleles (e.g. insertions)
206
- // have positive values, shorter ALT alleles (e.g. deletions)
207
- // have negative values.
208
- CIPOS: {
209
- Number: 2,
210
- Type: "Integer",
211
- Description: "Confidence interval around POS for imprecise variants"
212
- },
213
- CIEND: {
214
- Number: 2,
215
- Type: "Integer",
216
- Description: "Confidence interval around END for imprecise variants"
217
- },
218
- HOMLEN: {
219
- Type: "Integer",
220
- Description: "Length of base pair identical micro-homology at event breakpoints"
221
- },
222
- HOMSEQ: {
223
- Type: "String",
224
- Description: "Sequence of base pair identical micro-homology at event breakpoints"
225
- },
226
- BKPTID: {
227
- Type: "String",
228
- Description: "ID of the assembled alternate allele in the assembly file"
229
- },
230
- // For precise variants, the consensus sequence the alternate allele assembly
231
- // is derivable from the REF and ALT fields. However, the alternate allele
232
- // assembly file may contain additional information about the characteristics
233
- // of the alt allele contigs.
234
- MEINFO: {
235
- Number: 4,
236
- Type: "String",
237
- Description: "Mobile element info of the form NAME,START,END,POLARITY"
238
- },
239
- METRANS: {
240
- Number: 4,
241
- Type: "String",
242
- Description: "Mobile element transduction info of the form CHR,START,END,POLARITY"
243
- },
244
- DGVID: {
245
- Number: 1,
246
- Type: "String",
247
- Description: "ID of this element in Database of Genomic Variation"
248
- },
249
- DBVARID: {
250
- Number: 1,
251
- Type: "String",
252
- Description: "ID of this element in DBVAR"
253
- },
254
- DBRIPID: {
255
- Number: 1,
256
- Type: "String",
257
- Description: "ID of this element in DBRIP"
258
- },
259
- MATEID: {
260
- Number: null,
261
- Type: "String",
262
- Description: "ID of mate breakends"
263
- },
264
- PARID: {
265
- Number: 1,
266
- Type: "String",
267
- Description: "ID of partner breakend"
268
- },
269
- EVENT: {
270
- Number: 1,
271
- Type: "String",
272
- Description: "ID of event associated to breakend"
273
- },
274
- CILEN: {
275
- Number: 2,
276
- Type: "Integer",
277
- Description: "Confidence interval around the inserted material between breakend"
278
- },
279
- DPADJ: { Type: "Integer", Description: "Read Depth of adjacency" },
280
- CN: {
281
- Number: 1,
282
- Type: "Integer",
283
- Description: "Copy number of segment containing breakend"
284
- },
285
- CNADJ: {
286
- Number: null,
287
- Type: "Integer",
288
- Description: "Copy number of adjacency"
289
- },
290
- CICN: {
291
- Number: 2,
292
- Type: "Integer",
293
- Description: "Confidence interval around copy number for the segment"
294
- },
295
- CICNADJ: {
296
- Number: null,
297
- Type: "Integer",
298
- Description: "Confidence interval around copy number for the adjacency"
299
- }
300
- },
301
- // FORMAT fields
302
- GenotypeFields: {
303
- // from the VCF4.3 spec, https://samtools.github.io/hts-specs/VCFv4.3.pdf
304
- AD: {
305
- Number: "R",
306
- Type: "Integer",
307
- Description: "Read depth for each allele"
308
- },
309
- ADF: {
310
- Number: "R",
311
- Type: "Integer",
312
- Description: "Read depth for each allele on the forward strand"
313
- },
314
- ADR: {
315
- Number: "R",
316
- Type: "Integer",
317
- Description: "Read depth for each allele on the reverse strand"
318
- },
319
- DP: {
320
- Number: 1,
321
- Type: "Integer",
322
- Description: "Read depth"
323
- },
324
- EC: {
325
- Number: "A",
326
- Type: "Integer",
327
- Description: "Expected alternate allele counts"
328
- },
329
- FT: {
330
- Number: 1,
331
- Type: "String",
332
- Description: 'Filter indicating if this genotype was "called"'
333
- },
334
- GL: {
335
- Number: "G",
336
- Type: "Float",
337
- Description: "Genotype likelihoods"
338
- },
339
- GP: {
340
- Number: "G",
341
- Type: "Float",
342
- Description: "Genotype posterior probabilities"
343
- },
344
- GQ: {
345
- Number: 1,
346
- Type: "Integer",
347
- Description: "Conditional genotype quality"
348
- },
349
- GT: {
350
- Number: 1,
351
- Type: "String",
352
- Description: "Genotype"
353
- },
354
- HQ: {
355
- Number: 2,
356
- Type: "Integer",
357
- Description: "Haplotype quality"
358
- },
359
- MQ: {
360
- Number: 1,
361
- Type: "Integer",
362
- Description: "RMS mapping quality"
363
- },
364
- PL: {
365
- Number: "G",
366
- Type: "Integer",
367
- Description: "Phred-scaled genotype likelihoods rounded to the closest integer"
368
- },
369
- PQ: {
370
- Number: 1,
371
- Type: "Integer",
372
- Description: "Phasing quality"
373
- },
374
- PS: {
375
- Number: 1,
376
- Type: "Integer",
377
- Description: "Phase set"
378
- }
379
- },
380
- // ALT fields
381
- AltTypes: {
382
- DEL: {
383
- Description: "Deletion relative to the reference"
384
- },
385
- INS: {
386
- Description: "Insertion of novel sequence relative to the reference"
387
- },
388
- DUP: {
389
- Description: "Region of elevated copy number relative to the reference"
390
- },
391
- INV: {
392
- Description: "Inversion of reference sequence"
393
- },
394
- CNV: {
395
- Description: "Copy number variable region (may be both deletion and duplication)"
396
- },
397
- "DUP:TANDEM": {
398
- Description: "Tandem duplication"
399
- },
400
- "DEL:ME": {
401
- Description: "Deletion of mobile element relative to the reference"
402
- },
403
- "INS:ME": {
404
- Description: "Insertion of a mobile element relative to the reference"
405
- },
406
- NON_REF: {
407
- Description: "Represents any possible alternative allele at this location"
408
- },
409
- "*": {
410
- Description: "Represents any possible alternative allele at this location"
411
- }
412
- },
413
- // FILTER fields
414
- FilterTypes: {
415
- PASS: {
416
- Description: "Passed all filters"
417
- }
418
- }
419
- };
420
- function C(m) {
421
- try {
422
- return decodeURIComponent(m);
423
- } catch {
424
- return m;
425
- }
426
- }
427
- class L {
428
- constructor({ header: t = "", strict: e = !0 }) {
429
- if (!t.length)
430
- throw new Error("empty header received");
431
- const r = t.split(/[\r\n]+/).filter(Boolean);
432
- if (!r.length)
433
- throw new Error("no non-empty header lines specified");
434
- this.strict = e, this.metadata = {
435
- INFO: { ...A.InfoFields },
436
- FORMAT: { ...A.GenotypeFields },
437
- ALT: { ...A.AltTypes },
438
- FILTER: { ...A.FilterTypes }
439
- };
440
- let o;
441
- for (let n = 0; n < r.length; n++) {
442
- const a = r[n];
443
- if (a.startsWith("#"))
444
- a.startsWith("##") ? this.parseMetadata(a) : o = a;
445
- else throw new Error(`Bad line in header:
446
- ${a}`);
447
- }
448
- if (!o)
449
- throw new Error("No format line found in header");
450
- const s = o.trim().split(" "), c = s.slice(0, 8), i = [
451
- "#CHROM",
452
- "POS",
453
- "ID",
454
- "REF",
455
- "ALT",
456
- "QUAL",
457
- "FILTER",
458
- "INFO"
459
- ];
460
- if (s.length < 8)
461
- throw new Error(`VCF header missing columns:
462
- ${o}`);
463
- if (c.length !== i.length || !c.every((n, a) => n === i[a]))
464
- throw new Error(`VCF column headers not correct:
465
- ${o}`);
466
- this.samples = s.slice(9);
467
- }
468
- parseInfo(t) {
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;
476
- else {
477
- const f = d === "Integer" || d === "Float", y = l.split(","), b = y.length;
478
- if (r) {
479
- const p = [];
480
- for (let h = 0; h < b; h++) {
481
- const D = y[h];
482
- if (D === ".")
483
- p.push(void 0);
484
- else {
485
- const g = C(D);
486
- p.push(f ? Number(g) : g);
487
- }
488
- }
489
- e[u] = p;
490
- } else {
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);
495
- }
496
- e[u] = p;
497
- }
498
- }
499
- }
500
- return e;
501
- }
502
- parseSamples(t, e) {
503
- const r = {};
504
- if (t) {
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");
509
- }
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;
519
- else {
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);
525
- }
526
- else
527
- for (let N = 0; N < g.length; N++) {
528
- const I = g[N];
529
- T.push(I === "." ? void 0 : I);
530
- }
531
- d[s[p]] = T;
532
- }
533
- if (b = h + 1, p += 1, p >= n)
534
- break;
535
- }
536
- r[l] = d;
537
- }
538
- }
539
- return r;
540
- }
541
- /**
542
- * Parse a VCF metadata line (i.e. a line that starts with "##") and add its
543
- * properties to the object.
544
- *
545
- * @param {string} line - A line from the VCF. Supports both LF and CRLF
546
- * newlines.
547
- */
548
- parseMetadata(t) {
549
- const e = /^##(.+?)=(.*)/.exec(t.trim());
550
- if (!e)
551
- throw new Error(`Line is not a valid metadata line: ${t}`);
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;
557
- } else
558
- this.metadata[s] = o;
559
- }
560
- /**
561
- * Parse a VCF header structured meta string (i.e. a meta value that starts
562
- * with "<ID=...")
563
- *
564
- * @param {string} metaVal - The VCF metadata value
565
- *
566
- * @returns {Array} - Array with two entries, 1) a string of the metadata ID
567
- * and 2) an object with the other key-value pairs in the metadata
568
- */
569
- parseStructuredMetaVal(t) {
570
- const e = F(t), r = e.ID;
571
- return delete e.ID, "Number" in e && (Number.isNaN(Number(e.Number)) || (e.Number = Number(e.Number))), [r, e];
572
- }
573
- /**
574
- * Get metadata filtered by the elements in args. For example, can pass
575
- * ('INFO', 'DP') to only get info on an metadata tag that was like
576
- * "##INFO=<ID=DP,...>"
577
- *
578
- * @param {...string} args - List of metadata filter strings.
579
- *
580
- * @returns {any} An object, string, or number, depending on the filtering
581
- */
582
- getMetadata(...t) {
583
- let e = this.metadata;
584
- const r = t.length;
585
- for (let o = 0; o < r; o++)
586
- if (e = e[t[o]], !e)
587
- return e;
588
- return e;
589
- }
590
- /**
591
- * Parse a VCF line into an object like
592
- *
593
- * ```typescript
594
- * {
595
- * CHROM: 'contigA',
596
- * POS: 3000,
597
- * ID: ['rs17883296'],
598
- * REF: 'G',
599
- * ALT: ['T', 'A'],
600
- * QUAL: 100,
601
- * FILTER: 'PASS',
602
- * INFO: {
603
- * NS: [3],
604
- * DP: [14],
605
- * AF: [0.5],
606
- * DB: true,
607
- * XYZ: ['5'],
608
- * },
609
- * SAMPLES: () => ({
610
- * HG00096: {
611
- * GT: ['0|0'],
612
- * AP: ['0.000', '0.000'],
613
- * }
614
- * }),
615
- * GENOTYPES: () => ({
616
- * HG00096: '0|0'
617
- * })
618
- * }
619
- * ```
620
- *
621
- * SAMPLES and GENOTYPES methods are functions instead of static data fields
622
- * because it avoids parsing the potentially long list of samples from e.g.
623
- * 1000 genotypes data unless requested.
624
- *
625
- * The SAMPLES function gives all info about the samples
626
- *
627
- * The GENOTYPES function only extracts the raw GT string if it exists, for
628
- * potentially optimized parsing by programs that need it
629
- *
630
- * @param {string} line - A string of a line from a VCF
631
- */
632
- parseLine(t) {
633
- let e = 0, r = 0;
634
- for (; e < t.length && r < 9; )
635
- t[e] === " " && (r += 1), e += 1;
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])
638
- throw new Error("no INFO field specified, must contain at least a '.' (turn off strict mode to allow)");
639
- const I = s[7] === void 0 || s[7] === "." ? {} : this.parseInfo(s[7]);
640
- return {
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)
652
- };
653
- }
654
- }
655
- export {
656
- L as default
657
- };