@jbrowse/bandage-core 13.1.1 → 13.3.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/chunks/{chunk-7GOA4APV.js → chunk-2WMLHOJ6.js} +1 -1
- package/dist/chunks/{chunk-FQVSDKBM.js → chunk-4WZDEWAI.js} +1 -1
- package/dist/chunks/{chunk-WWQI7LPU.js → chunk-6C7KB7GY.js} +160 -22
- package/dist/chunks/{chunk-TSB4R2M6.js → chunk-7CGET6BU.js} +2 -2
- package/dist/chunks/{chunk-APOFTO4L.js → chunk-7NPCAPU3.js} +1 -1
- package/dist/chunks/{chunk-DBLRFSET.js → chunk-A65QHIGX.js} +15 -2
- package/dist/chunks/{chunk-O5IW7QYY.js → chunk-B5PQ6BMI.js} +1 -1
- package/dist/chunks/{chunk-OWAWSW6J.js → chunk-EV4DEMRT.js} +33 -14
- package/dist/chunks/{chunk-M2URPEV3.js → chunk-G7UNOR76.js} +1 -1
- package/dist/chunks/{chunk-5NFFH263.js → chunk-IBQAXKS4.js} +1 -1
- package/dist/chunks/{chunk-NPDW3JAD.js → chunk-IPNRPZBI.js} +40 -0
- package/dist/chunks/{chunk-O2CUKQVB.js → chunk-KZBRIRU2.js} +1 -1
- package/dist/chunks/{chunk-FSOP446U.js → chunk-LFDONCSJ.js} +1 -1
- package/dist/chunks/{chunk-L32O25BG.js → chunk-OKB7GGDV.js} +8 -8
- package/dist/chunks/{chunk-G4SUX2JZ.js → chunk-QW33FFVC.js} +10 -10
- package/dist/chunks/{chunk-IDYGRSNF.js → chunk-TTSA2ML4.js} +1 -1
- package/dist/chunks/{chunk-2BK2O4Z4.js → chunk-TWWHKS3M.js} +2 -2
- package/dist/chunks/{chunk-QXXKNRS2.js → chunk-UEERU47W.js} +2 -2
- package/dist/chunks/{chunk-76A7C3MC.js → chunk-UV6FRSVJ.js} +2 -2
- package/dist/chunks/{chunk-NCQ3D4MU.js → chunk-V52OO6JT.js} +1 -1
- package/dist/chunks/{chunk-7FE5KY4T.js → chunk-WKOUVIVO.js} +1 -1
- package/dist/chunks/{chunk-4SM3YYY4.js → chunk-WZWJJR5A.js} +2 -2
- package/dist/chunks/{chunk-EUDDBKTE.js → chunk-XRQ5OIJV.js} +5 -5
- package/dist/chunks/{chunk-7TK2XVAS.js → chunk-YA2KQ76R.js} +7 -2
- package/dist/chunks/{chunk-53YZQ6F5.js → chunk-ZC4CWI3C.js} +86 -14
- package/dist/cli/figure.js +21 -21
- package/dist/cli/fold.js +4 -4
- package/dist/figure.js +16 -16
- package/dist/figureData.js +19 -19
- package/dist/figureScene.js +12 -12
- package/dist/figureSettings.js +5 -5
- package/dist/gbzCut.js +4 -4
- package/dist/gbzWindow.js +3 -3
- package/dist/gfa/departures.js +9 -3
- package/dist/gfa/gfaTables.js +2 -2
- package/dist/gfa/graphTables.js +2 -1
- package/dist/index.js +24 -24
- package/dist/layout/forceCache.js +5 -5
- package/dist/layout/tubeMapLayout.js +5 -5
- package/dist/layout/walkRowDraw.js +2 -2
- package/dist/layout/walkRowLayout.js +6 -6
- package/dist/layout/walkRowRuns.js +3 -3
- package/dist/layout/walkRows.js +4 -4
- package/dist/layout/walkStrip.js +7 -7
- package/dist/layoutModes.js +8 -8
- package/dist/pipeline.js +4 -4
- package/dist/tubeMap/bundle.js +6 -6
- package/dist/tubeMap/coarsen.js +6 -6
- package/dist/tubeMap/deviations.js +6 -6
- package/dist/tubeMap/draw.js +5 -5
- package/dist/types/gfa/departures.d.ts +41 -2
- package/dist/types/gfa/graphTables.d.ts +21 -1
- package/dist/types/layout/deletionRoutes.d.ts +1 -0
- package/dist/types/layout/walkRowDraw.d.ts +1 -1
- package/dist/types/layout/walkRowRuns.d.ts +1 -0
- package/dist/types/layout/walkRows.d.ts +6 -0
- package/dist/types/types.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/walkHighlight.d.ts +2 -0
- package/dist/version.js +1 -1
- package/dist/viewport.js +5 -5
- package/dist/walkHighlight.js +2 -2
- package/dist/walkKey.js +2 -2
- package/package.json +2 -2
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
tableNodeIds,
|
|
3
3
|
tablePath
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-A65QHIGX.js";
|
|
5
5
|
import {
|
|
6
6
|
departureAt,
|
|
7
7
|
departureSpan,
|
|
8
8
|
gapParts,
|
|
9
|
-
placementChoice
|
|
10
|
-
|
|
9
|
+
placementChoice,
|
|
10
|
+
segmentPart,
|
|
11
|
+
stretchSegments
|
|
12
|
+
} from "./chunk-IPNRPZBI.js";
|
|
11
13
|
import {
|
|
12
14
|
pathOrigin
|
|
13
15
|
} from "./chunk-QBI6SC74.js";
|
|
@@ -31,10 +33,39 @@ var GAP_CAUSES = [
|
|
|
31
33
|
"elsewhere",
|
|
32
34
|
"own",
|
|
33
35
|
"abridged",
|
|
34
|
-
"departure"
|
|
36
|
+
"departure",
|
|
37
|
+
"mixed",
|
|
38
|
+
"unread"
|
|
35
39
|
];
|
|
36
40
|
var CAUSE_SHIFT = 3;
|
|
37
41
|
var causeFlags = (cause) => GAP_CAUSES.indexOf(cause) << CAUSE_SHIFT;
|
|
42
|
+
var stretchKey = (name, start, end) => `${pathOrigin(name).name} ${start} ${end}`;
|
|
43
|
+
function stretchIndex(all) {
|
|
44
|
+
const between = /* @__PURE__ */ new Map();
|
|
45
|
+
const ends = /* @__PURE__ */ new Map();
|
|
46
|
+
const outside = /* @__PURE__ */ new Map();
|
|
47
|
+
for (const x of all) {
|
|
48
|
+
const name = pathOrigin(x.name).name;
|
|
49
|
+
if (x.edge === 0) {
|
|
50
|
+
between.set(stretchKey(name, x.start, x.end), x.segments);
|
|
51
|
+
} else if (x.edge === 3) {
|
|
52
|
+
const o = outside.get(name) ?? { count: 0, stepsBp: 0 };
|
|
53
|
+
o.count++;
|
|
54
|
+
o.stepsBp += x.segments.reduce(
|
|
55
|
+
(sum, y) => sum + (y.kind === "steps" ? y.bp : 0),
|
|
56
|
+
0
|
|
57
|
+
);
|
|
58
|
+
outside.set(name, o);
|
|
59
|
+
} else {
|
|
60
|
+
ends.set(`${name} ${x.edge}`, x);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
between: (name, start, end) => between.get(stretchKey(name, start, end)),
|
|
65
|
+
rowEnd: (name, edge) => ends.get(`${pathOrigin(name).name} ${edge}`),
|
|
66
|
+
outside: (name) => outside.get(pathOrigin(name).name)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
38
69
|
function referenceOf(names, referencePath, rankZero) {
|
|
39
70
|
return referencePath !== void 0 && names.includes(referencePath) ? referencePath : names.find((n) => rankZero.has(n)) ?? names[0];
|
|
40
71
|
}
|
|
@@ -97,11 +128,20 @@ function graphPieces(graph) {
|
|
|
97
128
|
names,
|
|
98
129
|
reference,
|
|
99
130
|
stableStart: (node) => stable.get(node) ?? Number.NaN,
|
|
100
|
-
departures: graph.departures
|
|
131
|
+
departures: graph.departures,
|
|
132
|
+
stretches: stretchIndex(
|
|
133
|
+
(graph.gaps ?? []).map((gap) => ({
|
|
134
|
+
...gap,
|
|
135
|
+
segments: gap.segments.map((segment) => ({
|
|
136
|
+
...segment,
|
|
137
|
+
nodes: segment.nodes.map(indexOf)
|
|
138
|
+
}))
|
|
139
|
+
}))
|
|
140
|
+
)
|
|
101
141
|
};
|
|
102
142
|
}
|
|
103
143
|
function tablePieces(tables, referencePath, visits) {
|
|
104
|
-
const { nodes: n, walks: w } = tables;
|
|
144
|
+
const { nodes: n, walks: w, gaps } = tables;
|
|
105
145
|
const kept = [];
|
|
106
146
|
for (let p = 0; p < w.names.length; p++) {
|
|
107
147
|
if (w.offsets[p + 1] > w.offsets[p]) {
|
|
@@ -132,7 +172,16 @@ function tablePieces(tables, referencePath, visits) {
|
|
|
132
172
|
names: visits ? tableNodeIds(tables) : n.names,
|
|
133
173
|
reference,
|
|
134
174
|
stableStart: (node) => node < n.lengths.length && n.ranks[node] === 0 && onReferenceContig(n.refNames[n.refs[node]]) ? n.starts[node] : Number.NaN,
|
|
135
|
-
departures: tables.departures
|
|
175
|
+
departures: tables.departures,
|
|
176
|
+
stretches: stretchIndex(
|
|
177
|
+
gaps ? gaps.names.map((name, g) => ({
|
|
178
|
+
name,
|
|
179
|
+
edge: gaps.edges[g],
|
|
180
|
+
start: gaps.starts[g],
|
|
181
|
+
end: gaps.ends[g],
|
|
182
|
+
segments: stretchSegments(gaps, g, (i) => i)
|
|
183
|
+
})) : []
|
|
184
|
+
)
|
|
136
185
|
};
|
|
137
186
|
}
|
|
138
187
|
function sampleOf(path) {
|
|
@@ -149,7 +198,7 @@ var Columns = class {
|
|
|
149
198
|
get length() {
|
|
150
199
|
return this.values[0].length;
|
|
151
200
|
}
|
|
152
|
-
push(a, b, c, d, e) {
|
|
201
|
+
push(a, b, c, d, e, f) {
|
|
153
202
|
const v = this.values;
|
|
154
203
|
v[0].push(a);
|
|
155
204
|
v[1].push(b);
|
|
@@ -158,6 +207,9 @@ var Columns = class {
|
|
|
158
207
|
if (e !== void 0) {
|
|
159
208
|
v[4].push(e);
|
|
160
209
|
}
|
|
210
|
+
if (f !== void 0) {
|
|
211
|
+
v[5].push(f);
|
|
212
|
+
}
|
|
161
213
|
}
|
|
162
214
|
endRow() {
|
|
163
215
|
this.offsets.push(this.length);
|
|
@@ -193,7 +245,8 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
193
245
|
names,
|
|
194
246
|
reference,
|
|
195
247
|
stableStart,
|
|
196
|
-
departures
|
|
248
|
+
departures,
|
|
249
|
+
stretches
|
|
197
250
|
} = "walks" in source ? tablePieces(source, o.referencePath, o.visits) : graphPieces(source);
|
|
198
251
|
const declared = lengths.length;
|
|
199
252
|
const lengthOf = (node) => node < declared ? lengths[node] : 0;
|
|
@@ -247,7 +300,7 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
247
300
|
}
|
|
248
301
|
}
|
|
249
302
|
const flanked = cut === void 0 || flankEnd > -Infinity && flankStart < Infinity;
|
|
250
|
-
const runs = new Columns(
|
|
303
|
+
const runs = new Columns(6);
|
|
251
304
|
const visits = o.visits ? new Columns(4) : void 0;
|
|
252
305
|
let steps = new Int32Array(0);
|
|
253
306
|
let stepStart = new Float64Array(0);
|
|
@@ -274,6 +327,7 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
274
327
|
end - start2,
|
|
275
328
|
Number.NaN,
|
|
276
329
|
RUN_GAP | causeFlags("departure"),
|
|
330
|
+
Number.NaN,
|
|
277
331
|
Number.NaN
|
|
278
332
|
);
|
|
279
333
|
gapBp += end - start2;
|
|
@@ -316,6 +370,62 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
316
370
|
let previous;
|
|
317
371
|
const partsAt = /* @__PURE__ */ new Map();
|
|
318
372
|
let owed = 0;
|
|
373
|
+
const drawnBp = (segments) => segments.reduce(
|
|
374
|
+
(sum, x) => sum + (x.kind === "steps" ? x.nodes.reduce((bp3, node) => bp3 + lengthOf(node), 0) : x.bp),
|
|
375
|
+
0
|
|
376
|
+
);
|
|
377
|
+
const emit = (segments, from2) => {
|
|
378
|
+
const need = segments.reduce((n, x) => n + x.nodes.length + 1, count);
|
|
379
|
+
if (length + need > steps.length) {
|
|
380
|
+
const grownSteps = new Int32Array((length + need) * 2);
|
|
381
|
+
const grownStarts = new Float64Array((length + need) * 2);
|
|
382
|
+
grownSteps.set(steps.subarray(0, length));
|
|
383
|
+
grownStarts.set(stepStart.subarray(0, length));
|
|
384
|
+
steps = grownSteps;
|
|
385
|
+
stepStart = grownStarts;
|
|
386
|
+
}
|
|
387
|
+
let at = from2;
|
|
388
|
+
let parts = [];
|
|
389
|
+
let partsBp = 0;
|
|
390
|
+
const flush = () => {
|
|
391
|
+
if (partsBp > 0) {
|
|
392
|
+
partsAt.set(length, parts);
|
|
393
|
+
steps[length] = -partsBp;
|
|
394
|
+
stepStart[length++] = at - partsBp;
|
|
395
|
+
}
|
|
396
|
+
parts = [];
|
|
397
|
+
partsBp = 0;
|
|
398
|
+
};
|
|
399
|
+
for (const x of segments) {
|
|
400
|
+
if (x.kind === "steps") {
|
|
401
|
+
flush();
|
|
402
|
+
for (const node of x.nodes) {
|
|
403
|
+
steps[length] = node;
|
|
404
|
+
stepStart[length++] = at;
|
|
405
|
+
at += lengthOf(node);
|
|
406
|
+
}
|
|
407
|
+
} else if (x.bp > 0) {
|
|
408
|
+
if (x.kind === "abridged") {
|
|
409
|
+
flush();
|
|
410
|
+
}
|
|
411
|
+
parts.push(segmentPart(x));
|
|
412
|
+
partsBp += x.bp;
|
|
413
|
+
at += x.bp;
|
|
414
|
+
if (x.kind === "abridged") {
|
|
415
|
+
flush();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
flush();
|
|
420
|
+
};
|
|
421
|
+
const walkName = nameOf(ordered[0]);
|
|
422
|
+
const lead = stretches.rowEnd(walkName, 1);
|
|
423
|
+
const leads = lead !== void 0 && lead.end === startOf(ordered[0]) && drawnBp(lead.segments) === lead.end - lead.start;
|
|
424
|
+
if (leads) {
|
|
425
|
+
emit(lead.segments, lead.start);
|
|
426
|
+
end = lead.end;
|
|
427
|
+
}
|
|
428
|
+
const fragLo = length;
|
|
319
429
|
for (const piece of ordered) {
|
|
320
430
|
const start2 = startOf(piece);
|
|
321
431
|
const jump = start2 === void 0 || end === void 0 ? 0 : start2 - end;
|
|
@@ -328,7 +438,10 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
328
438
|
const covered = Math.min(owed, Math.max(jump, 0));
|
|
329
439
|
owed -= covered;
|
|
330
440
|
const gap = jump - covered;
|
|
331
|
-
|
|
441
|
+
const segments = gap >= 0 && covered === 0 && previous !== void 0 && start2 !== void 0 && end !== void 0 ? stretches.between(nameOf(previous), end, start2) : void 0;
|
|
442
|
+
if (segments && drawnBp(segments) === gap) {
|
|
443
|
+
emit(segments, end);
|
|
444
|
+
} else if (gap > 0) {
|
|
332
445
|
partsAt.set(
|
|
333
446
|
length,
|
|
334
447
|
gapParts(
|
|
@@ -365,13 +478,19 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
365
478
|
}
|
|
366
479
|
previous = piece;
|
|
367
480
|
}
|
|
481
|
+
const fragHi = length - 1;
|
|
482
|
+
const tail = stretches.rowEnd(walkName, 2);
|
|
483
|
+
const tails = tail !== void 0 && tail.start === end && drawnBp(tail.segments) === tail.end - tail.start;
|
|
484
|
+
if (tails) {
|
|
485
|
+
emit(tail.segments, tail.start);
|
|
486
|
+
}
|
|
368
487
|
const onReference = (i) => i >= 0 && i < length && steps[i] >= 0 && !Number.isNaN(spanStart[steps[i]]);
|
|
369
488
|
const stepEnd = (i) => {
|
|
370
489
|
const id = steps[i];
|
|
371
490
|
return stepStart[i] + (id < 0 ? -id : lengthOf(id));
|
|
372
491
|
};
|
|
373
492
|
const endOf = (after) => {
|
|
374
|
-
const last2 = after ?
|
|
493
|
+
const last2 = after ? fragHi : fragLo;
|
|
375
494
|
const edge = after ? stepEnd(last2) : stepStart[last2];
|
|
376
495
|
return {
|
|
377
496
|
last: last2,
|
|
@@ -386,9 +505,9 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
386
505
|
for (let d = 1; near2 < 0 && d < length; d++) {
|
|
387
506
|
near2 = [flank - d, flank + d].find(onReference) ?? -1;
|
|
388
507
|
}
|
|
389
|
-
const
|
|
390
|
-
const
|
|
391
|
-
return near2 >= 0 ? near2 > flank === spanStart[steps[near2]] > spanStart[steps[flank]] :
|
|
508
|
+
const tail2 = endOf(true);
|
|
509
|
+
const lead2 = endOf(false);
|
|
510
|
+
return near2 >= 0 ? near2 > flank === spanStart[steps[near2]] > spanStart[steps[flank]] : fragHi > fragLo ? void 0 : tail2.departure ? !tail2.departure.leaveReversed : lead2.departure ? !lead2.departure.rejoinReversed : (!tail2.trimmed || !!lead2.trimmed) === rightward;
|
|
392
511
|
};
|
|
393
512
|
const partialSide = (i0, i1, inside) => {
|
|
394
513
|
const flank = i0 >= 0 ? i0 : i1;
|
|
@@ -407,7 +526,8 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
407
526
|
...departure ? {
|
|
408
527
|
goesOn: {
|
|
409
528
|
departure,
|
|
410
|
-
near: after ? departure.rejoinPos : departure.leavePos
|
|
529
|
+
near: after ? departure.rejoinPos : departure.leavePos,
|
|
530
|
+
...(after ? tails : leads) ? { drawn: true } : {}
|
|
411
531
|
}
|
|
412
532
|
} : {}
|
|
413
533
|
};
|
|
@@ -421,8 +541,8 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
421
541
|
axisStart: forward ? after ? from2 : stepStart[0] : after ? stepEnd(length - 1) : from2
|
|
422
542
|
};
|
|
423
543
|
};
|
|
424
|
-
let lo =
|
|
425
|
-
let hi =
|
|
544
|
+
let lo = fragLo;
|
|
545
|
+
let hi = fragHi + 1;
|
|
426
546
|
let backward = false;
|
|
427
547
|
let complete = true;
|
|
428
548
|
let flankFrom = -1;
|
|
@@ -510,12 +630,18 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
510
630
|
stopsInside(i0, i1, true);
|
|
511
631
|
}
|
|
512
632
|
}
|
|
633
|
+
if (lead && leads && lo < fragLo) {
|
|
634
|
+
extents.push([lead.start, lead.end]);
|
|
635
|
+
}
|
|
636
|
+
if (tail && tails && hi > fragHi + 1) {
|
|
637
|
+
extents.push([tail.start, tail.end]);
|
|
638
|
+
}
|
|
513
639
|
const stepless = bar2 !== void 0 && lo >= hi && own.some((d) => {
|
|
514
640
|
const span = departureSpan(d);
|
|
515
641
|
return span.start < bar2.end && span.end > bar2.start;
|
|
516
642
|
});
|
|
517
643
|
const contig = head.contig ?? panSNContig(pathOrigin(head.name).name);
|
|
518
|
-
const axis2 = unplaced || length === 0 ? void 0 : axisStart !== void 0 ? { contig, start: axisStart, reversed: backward } : flankFrom < 0 ? { contig, start: stepStart[
|
|
644
|
+
const axis2 = unplaced || length === 0 ? void 0 : axisStart !== void 0 ? { contig, start: axisStart, reversed: backward } : flankFrom < 0 ? { contig, start: stepStart[lo], reversed: false } : flankFrom < flankTo ? {
|
|
519
645
|
contig,
|
|
520
646
|
start: stepEnd(flankFrom) + leftTrim,
|
|
521
647
|
reversed: false
|
|
@@ -564,7 +690,8 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
564
690
|
part.bp,
|
|
565
691
|
Number.NaN,
|
|
566
692
|
RUN_GAP | causeFlags(part.cause),
|
|
567
|
-
part.near ?? Number.NaN
|
|
693
|
+
part.near ?? Number.NaN,
|
|
694
|
+
part.missingBp ?? Number.NaN
|
|
568
695
|
);
|
|
569
696
|
bp2 += part.bp;
|
|
570
697
|
}
|
|
@@ -596,7 +723,7 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
596
723
|
} else {
|
|
597
724
|
lastFlags = on ? RUN_ON_REFERENCE : 0;
|
|
598
725
|
lastRef = on ? at : Number.NaN;
|
|
599
|
-
runs.push(bp2, len, lastRef, lastFlags, Number.NaN);
|
|
726
|
+
runs.push(bp2, len, lastRef, lastFlags, Number.NaN, Number.NaN);
|
|
600
727
|
last = runs.length - 1;
|
|
601
728
|
step = 0;
|
|
602
729
|
}
|
|
@@ -627,9 +754,14 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
627
754
|
...abridgedSteps > 0 ? { abridgedSteps } : {},
|
|
628
755
|
...leftTrim + rightTrim > 0 ? { estimated: true } : {},
|
|
629
756
|
...undrawn.length > 0 ? { departures: undrawn } : {},
|
|
757
|
+
...outsideOf(walkName),
|
|
630
758
|
...own.some(placementChoice) ? { placementChoice: true } : {}
|
|
631
759
|
};
|
|
632
760
|
};
|
|
761
|
+
const outsideOf = (name) => {
|
|
762
|
+
const outsideRow = stretches.outside(name);
|
|
763
|
+
return outsideRow ? { outsideRow } : {};
|
|
764
|
+
};
|
|
633
765
|
const steplessRowOf = (name, own, bar2) => {
|
|
634
766
|
const gapBp = departureRuns(own, bar2);
|
|
635
767
|
runs.endRow();
|
|
@@ -670,9 +802,10 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
670
802
|
float64,
|
|
671
803
|
float64,
|
|
672
804
|
(n) => new Uint8Array(n),
|
|
805
|
+
float64,
|
|
673
806
|
float64
|
|
674
807
|
]);
|
|
675
|
-
const [start, bp, referenceStart, flags, near] = columns;
|
|
808
|
+
const [start, bp, referenceStart, flags, near, missing] = columns;
|
|
676
809
|
return {
|
|
677
810
|
origin: cut ? cut.start : startOf(first) ?? 0,
|
|
678
811
|
rows: [referenceRow, ...rows.map((r) => r.meta)],
|
|
@@ -682,6 +815,7 @@ function walkRowRuns(source, region, o = {}) {
|
|
|
682
815
|
referenceStart,
|
|
683
816
|
flags,
|
|
684
817
|
near,
|
|
818
|
+
missing,
|
|
685
819
|
visits: visits && visitColumns(visits, order, names)
|
|
686
820
|
};
|
|
687
821
|
}
|
|
@@ -733,6 +867,10 @@ function runAt(t, k) {
|
|
|
733
867
|
if (!Number.isNaN(near)) {
|
|
734
868
|
run.near = near;
|
|
735
869
|
}
|
|
870
|
+
const missing = t.missing[k];
|
|
871
|
+
if (!Number.isNaN(missing)) {
|
|
872
|
+
run.missingBp = missing;
|
|
873
|
+
}
|
|
736
874
|
} else {
|
|
737
875
|
run.referenceStart = Number.isNaN(t.referenceStart[k]) ? void 0 : t.referenceStart[k];
|
|
738
876
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
hasTubeMapPaths,
|
|
7
7
|
tubeMapLayout,
|
|
8
8
|
tubeMapReferenceLayout
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IBQAXKS4.js";
|
|
10
10
|
import {
|
|
11
11
|
anchoredLayout
|
|
12
12
|
} from "./chunk-CNWAVRLF.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-Q7OFBTBW.js";
|
|
16
16
|
import {
|
|
17
17
|
walkRowLayout
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TWWHKS3M.js";
|
|
19
19
|
import {
|
|
20
20
|
withoutStrayHandles
|
|
21
21
|
} from "./chunk-FGH4D6WT.js";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stretchSegments
|
|
3
|
+
} from "./chunk-IPNRPZBI.js";
|
|
1
4
|
import {
|
|
2
5
|
PathVisits
|
|
3
6
|
} from "./chunk-BEUTROKU.js";
|
|
@@ -76,7 +79,7 @@ function tableNodeIds({ nodes: n, links: l, walks: w }, traversals) {
|
|
|
76
79
|
(segment, i) => `${segment}${canonical[i] === 2 ? "-" : "+"}`
|
|
77
80
|
);
|
|
78
81
|
}
|
|
79
|
-
function graphFromTables({ nodes: n, links: l, walks: w, departures }, name = "Imported GFA") {
|
|
82
|
+
function graphFromTables({ nodes: n, links: l, walks: w, departures, gaps }, name = "Imported GFA") {
|
|
80
83
|
const count = n.names.length;
|
|
81
84
|
const declared = n.lengths.length;
|
|
82
85
|
const drawnWalks = [];
|
|
@@ -263,9 +266,19 @@ function graphFromTables({ nodes: n, links: l, walks: w, departures }, name = "I
|
|
|
263
266
|
samples: pathSamples
|
|
264
267
|
}) : void 0,
|
|
265
268
|
anchoredBy: nodes.some((node) => node.stable) ? "tags" : void 0,
|
|
266
|
-
...departures.names.length > 0 ? { departures } : {}
|
|
269
|
+
...departures.names.length > 0 ? { departures } : {},
|
|
270
|
+
...gaps && gaps.names.length > 0 ? { gaps: graphGaps(gaps, ids) } : {}
|
|
267
271
|
};
|
|
268
272
|
}
|
|
273
|
+
function graphGaps(t, ids) {
|
|
274
|
+
return t.names.map((name, g) => ({
|
|
275
|
+
name,
|
|
276
|
+
edge: t.edges[g],
|
|
277
|
+
start: t.starts[g],
|
|
278
|
+
end: t.ends[g],
|
|
279
|
+
segments: stretchSegments(t, g, (i) => ids[i])
|
|
280
|
+
}));
|
|
281
|
+
}
|
|
269
282
|
function graphTablesGFA({
|
|
270
283
|
nodes,
|
|
271
284
|
links,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
departureText,
|
|
16
16
|
placementChoice,
|
|
17
17
|
roughBp
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-IPNRPZBI.js";
|
|
19
19
|
import {
|
|
20
20
|
LABEL_CHAR_PX
|
|
21
21
|
} from "./chunk-S43IBA5Y.js";
|
|
@@ -66,18 +66,26 @@ function gapsText(gapBp, runs, abridgedSteps, refName) {
|
|
|
66
66
|
return ` \xB7 ${kb(gapBp)} ${OUTSIDE_TEXT}`;
|
|
67
67
|
}
|
|
68
68
|
const bpOf = (cause) => gaps.filter((g) => g.cause === cause).reduce((sum, g) => sum + g.bp, 0);
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
const mixedMissing = gaps.filter((g) => g.cause === "mixed").reduce((sum, g) => sum + (g.missingBp ?? 0), 0);
|
|
70
|
+
const placesOf = (cause) => {
|
|
71
|
+
const places = [
|
|
72
|
+
...new Set(
|
|
73
|
+
gaps.flatMap(
|
|
74
|
+
(g) => g.cause === cause && g.near !== void 0 ? [near(refName, g.near)] : []
|
|
75
|
+
)
|
|
76
|
+
)
|
|
77
|
+
];
|
|
78
|
+
return places.length === 0 ? "" : `${places[0]}${places.length > 1 ? ` and ${places.length - 1} more place${places.length > 2 ? "s" : ""}` : ""}`;
|
|
79
|
+
};
|
|
80
|
+
const lastSeen = placesOf("unread");
|
|
74
81
|
const parts = [
|
|
75
|
-
[bpOf("missing"), GAP_CAUSE_TEXT.missing],
|
|
82
|
+
[bpOf("missing") + mixedMissing, GAP_CAUSE_TEXT.missing],
|
|
83
|
+
[bpOf("elsewhere"), `on nodes filed near ${placesOf("elsewhere")}`],
|
|
84
|
+
[bpOf("own") + bpOf("mixed") - mixedMissing, GAP_CAUSE_TEXT.own],
|
|
76
85
|
[
|
|
77
|
-
bpOf("
|
|
78
|
-
|
|
86
|
+
bpOf("unread"),
|
|
87
|
+
`${GAP_CAUSE_TEXT.unread}${lastSeen ? `, last seen near ${lastSeen}` : ""}`
|
|
79
88
|
],
|
|
80
|
-
[bpOf("own"), GAP_CAUSE_TEXT.own],
|
|
81
89
|
[bpOf(void 0), OUTSIDE_TEXT]
|
|
82
90
|
];
|
|
83
91
|
const abridged = bpOf("abridged");
|
|
@@ -101,10 +109,11 @@ function walkRowReadout(row, reference, unit, call) {
|
|
|
101
109
|
if (!reference) {
|
|
102
110
|
return `${kb(bp)}${units(bp, unit)}`;
|
|
103
111
|
}
|
|
112
|
+
const beyond = row.outsideRow ? ` \xB7 ${row.outsideRow.count} departure${row.outsideRow.count > 1 ? "s" : ""} outside the row${row.outsideRow.stepsBp > 0 ? `, ${kb(row.outsideRow.stepsBp)} of its own in the graph` : ""}` : "";
|
|
104
113
|
if (row.stepless) {
|
|
105
|
-
return steplessText(row.departures ?? [], reference.sample)
|
|
114
|
+
return `${steplessText(row.departures ?? [], reference.sample)}${beyond}`;
|
|
106
115
|
}
|
|
107
|
-
const outside = `${gapsText(gapBp, row.runs, row.abridgedSteps ?? 0, reference.name)}${row.placementChoice ? ` \xB7 ${PLACEMENT_CHOICE_TEXT}` : ""}`;
|
|
116
|
+
const outside = `${gapsText(gapBp, row.runs, row.abridgedSteps ?? 0, reference.name)}${row.placementChoice ? ` \xB7 ${PLACEMENT_CHOICE_TEXT}` : ""}${beyond}`;
|
|
108
117
|
const called = call ? ` \xB7 called ${kb(call.bp)}${call.spanningReads === 0 ? " \xB7 no spanning read" : ""}` : "";
|
|
109
118
|
if (complete) {
|
|
110
119
|
const delta = bp - reference.bp;
|
|
@@ -117,7 +126,7 @@ function walkRowReadout(row, reference, unit, call) {
|
|
|
117
126
|
const where = stop.shortBp > 0 ? `${kb(stop.shortBp)} before` : "at";
|
|
118
127
|
return `contig ends ${where} the ${region}${called}`;
|
|
119
128
|
}
|
|
120
|
-
const why = !stop ? "partial walk" : stop.contigEnds ? `contig ends inside the ${region}` : stop.goesOn ? `goes on near ${near(reference.name, stop.goesOn.near)} \xB7 ${roughBp(stop.goesOn.departure.ownBp)} of its own` : "does not rejoin the reference within the extracted subgraph";
|
|
129
|
+
const why = !stop ? "partial walk" : stop.contigEnds ? `contig ends inside the ${region}` : stop.goesOn ? `goes on near ${near(reference.name, stop.goesOn.near)}${stop.goesOn.drawn ? "" : ` \xB7 ${roughBp(stop.goesOn.departure.ownBp)} of its own`}` : "does not rejoin the reference within the extracted subgraph";
|
|
121
130
|
const bound = bp === 0 ? "" : `\u2265 ${kb(bp)}${units(bp, unit)} \xB7 `;
|
|
122
131
|
return `${bound}${why}${outside}${called}`;
|
|
123
132
|
}
|
|
@@ -143,7 +152,15 @@ function unitTicks(bp, unit, pxPerBp) {
|
|
|
143
152
|
return ticks;
|
|
144
153
|
}
|
|
145
154
|
function gapStyle(cause) {
|
|
146
|
-
return cause === "missing" ? { fill: MISSING_INK, px: MISSING_PX, label: GAP_CAUSE_TEXT.missing } : cause === "departure" ? { fill: MISSING_INK, px: MISSING_PX, label: GAP_CAUSE_TEXT.departure } : cause === "own" ? { fill: OWN_GAP, px: GAP_PX, label: GAP_CAUSE_TEXT.own } : cause === "
|
|
155
|
+
return cause === "missing" ? { fill: MISSING_INK, px: MISSING_PX, label: GAP_CAUSE_TEXT.missing } : cause === "departure" ? { fill: MISSING_INK, px: MISSING_PX, label: GAP_CAUSE_TEXT.departure } : cause === "own" ? { fill: OWN_GAP, px: GAP_PX, label: GAP_CAUSE_TEXT.own } : cause === "mixed" ? { fill: OWN_GAP, px: MISSING_PX, label: GAP_CAUSE_TEXT.mixed } : cause === "unread" ? {
|
|
156
|
+
fill: OUTSIDE_CUT,
|
|
157
|
+
px: MISSING_PX,
|
|
158
|
+
label: GAP_CAUSE_TEXT.unread
|
|
159
|
+
} : cause === "abridged" ? {
|
|
160
|
+
fill: ABRIDGED_GAP,
|
|
161
|
+
px: GAP_PX,
|
|
162
|
+
label: GAP_CAUSE_TEXT.abridged
|
|
163
|
+
} : { fill: OUTSIDE_CUT, px: GAP_PX, label: OUTSIDE_TEXT };
|
|
147
164
|
}
|
|
148
165
|
function runPaint(run, ramp) {
|
|
149
166
|
if (run.gap) {
|
|
@@ -264,6 +281,8 @@ function walkRowsKey(bars, o = {}) {
|
|
|
264
281
|
"missing",
|
|
265
282
|
"departure",
|
|
266
283
|
"own",
|
|
284
|
+
"mixed",
|
|
285
|
+
"unread",
|
|
267
286
|
"abridged"
|
|
268
287
|
]) {
|
|
269
288
|
const { fill, px, label } = gapStyle(cause);
|
|
@@ -67,12 +67,49 @@ var GAP_CAUSE_TEXT = {
|
|
|
67
67
|
missing: "not in the graph",
|
|
68
68
|
elsewhere: "on nodes filed elsewhere",
|
|
69
69
|
own: "of its own, not read",
|
|
70
|
+
mixed: "of its own, part not read and part not in the graph",
|
|
71
|
+
unread: "not read",
|
|
70
72
|
abridged: "abridged: steps not loaded",
|
|
71
73
|
// a row of departures alone: the haplotype has no step on the reference
|
|
72
74
|
// across the window, which says nothing of what it carries instead
|
|
73
75
|
departure: "no step on the reference"
|
|
74
76
|
};
|
|
75
77
|
var OUTSIDE_TEXT = "outside the extracted subgraph";
|
|
78
|
+
var GAP_KINDS = [
|
|
79
|
+
"steps",
|
|
80
|
+
"read",
|
|
81
|
+
"abridged",
|
|
82
|
+
"own",
|
|
83
|
+
"unread"
|
|
84
|
+
];
|
|
85
|
+
function segmentPart(segment) {
|
|
86
|
+
const { kind, bp, missingBp, before } = segment;
|
|
87
|
+
return kind === "abridged" ? { bp, cause: "abridged" } : kind === "own" ? missingBp >= bp ? { bp, cause: "missing" } : missingBp > 0 ? { bp, cause: "mixed", missingBp } : { bp, cause: "own" } : kind === "unread" ? {
|
|
88
|
+
bp,
|
|
89
|
+
cause: "unread",
|
|
90
|
+
...Number.isNaN(before) ? {} : { near: before }
|
|
91
|
+
} : { bp };
|
|
92
|
+
}
|
|
93
|
+
function stretchSegments(t, g, node) {
|
|
94
|
+
const s = t.segments;
|
|
95
|
+
const out = [];
|
|
96
|
+
for (let k = t.segmentOffsets[g]; k < t.segmentOffsets[g + 1]; k++) {
|
|
97
|
+
const nodes = [];
|
|
98
|
+
for (let j = s.stepOffsets[k]; j < s.stepOffsets[k + 1]; j++) {
|
|
99
|
+
nodes.push(node(s.steps[j]));
|
|
100
|
+
}
|
|
101
|
+
out.push({
|
|
102
|
+
kind: GAP_KINDS[s.kinds[k]],
|
|
103
|
+
bp: s.bp[k],
|
|
104
|
+
missingBp: s.missingBp[k],
|
|
105
|
+
abridged: s.abridged[k] === 1,
|
|
106
|
+
before: s.before[k],
|
|
107
|
+
after: s.after[k],
|
|
108
|
+
nodes
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
76
113
|
function gapParts(from, to, trimmed, departures) {
|
|
77
114
|
const bp = to - from;
|
|
78
115
|
const inside = departures.filter((d) => d.hapStart >= from && d.hapStart + d.ownBp <= to).sort((a, b) => a.hapStart - b.hapStart);
|
|
@@ -114,5 +151,8 @@ export {
|
|
|
114
151
|
PLACEMENT_CHOICE_TEXT,
|
|
115
152
|
GAP_CAUSE_TEXT,
|
|
116
153
|
OUTSIDE_TEXT,
|
|
154
|
+
GAP_KINDS,
|
|
155
|
+
segmentPart,
|
|
156
|
+
stretchSegments,
|
|
117
157
|
gapParts
|
|
118
158
|
};
|