@jbrowse/bandage-core 12.7.1 → 13.0.1
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/README.md +41 -9
- package/dist/chunks/{chunk-3HNQW3HM.js → chunk-252FIXUH.js} +1 -1
- package/dist/chunks/{chunk-F5CP5KSV.js → chunk-2HR33HEK.js} +43 -19
- package/dist/chunks/{chunk-QHCAFMHM.js → chunk-2T462OOE.js} +1 -1
- package/dist/chunks/{chunk-XNLXC6GB.js → chunk-2TNFP3GC.js} +1 -1
- package/dist/chunks/{chunk-FAWHP2CG.js → chunk-4D2OQVTR.js} +8 -8
- package/dist/chunks/{chunk-RQHIDUZR.js → chunk-4SM3YYY4.js} +6 -2
- package/dist/chunks/{chunk-3BLYOLTX.js → chunk-5PQQ4IXZ.js} +1 -1
- package/dist/chunks/{chunk-Q4B4O2M4.js → chunk-7ZS7UNYY.js} +1 -5
- package/dist/chunks/{chunk-O6SLIY74.js → chunk-BQ2GXFH6.js} +168 -80
- package/dist/chunks/{chunk-IDPBN2BP.js → chunk-DBLRFSET.js} +12 -13
- package/dist/chunks/{chunk-KA6B7WCZ.js → chunk-DZWYTA5R.js} +1 -1
- package/dist/chunks/{chunk-KCVW4VPK.js → chunk-EPCC5T5Y.js} +10 -10
- package/dist/chunks/{chunk-BPIELHWX.js → chunk-FLCRH3JY.js} +2 -2
- package/dist/chunks/{chunk-4J4IKYSL.js → chunk-FSOP446U.js} +6 -51
- package/dist/chunks/{chunk-EHEKIJ56.js → chunk-IDDGO6EW.js} +2 -2
- package/dist/chunks/{chunk-QPKSULKV.js → chunk-IDYGRSNF.js} +1 -1
- package/dist/chunks/{chunk-ETYIYH7I.js → chunk-K5QGQNPO.js} +5 -5
- package/dist/chunks/{chunk-H5NMBQZG.js → chunk-LHPUMKX4.js} +1 -1
- package/dist/chunks/chunk-NPDW3JAD.js +118 -0
- package/dist/chunks/{chunk-LT66KA3W.js → chunk-QDP2NTAV.js} +3 -3
- package/dist/chunks/{chunk-TTFQTTBZ.js → chunk-RNROMUAS.js} +3 -3
- package/dist/chunks/{chunk-WXUEAMJJ.js → chunk-RWCZLHXX.js} +1 -1
- package/dist/chunks/{chunk-7O7427XK.js → chunk-S3A345Q4.js} +1 -1
- package/dist/chunks/{chunk-Q4X6O7BL.js → chunk-STHPR76Q.js} +22 -7
- package/dist/chunks/{chunk-6YVWF5TR.js → chunk-VX57QTQD.js} +2 -2
- package/dist/chunks/{chunk-YAJT4IDN.js → chunk-Z2OUCH2J.js} +1 -1
- package/dist/cli/figure.js +22 -22
- package/dist/cli/fold.js +5 -5
- package/dist/figure.js +17 -17
- package/dist/figureData.js +20 -20
- package/dist/figureScene.js +13 -13
- package/dist/figureSettings.js +6 -6
- package/dist/gbzCut.js +4 -4
- package/dist/gbzWindow.js +3 -3
- package/dist/gfa/departures.js +26 -0
- package/dist/gfa/gfaConverter.js +1 -2
- package/dist/gfa/gfaTables.js +2 -2
- package/dist/gfa/graphTables.js +1 -2
- package/dist/index.js +39 -33
- package/dist/layout/forceCache.js +6 -6
- package/dist/layout/tubeMapLayout.js +5 -5
- package/dist/layout/walkRowDraw.js +4 -4
- 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 +5 -5
- 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 +72 -0
- package/dist/types/gfa/graphTables.d.ts +35 -12
- package/dist/types/index.d.ts +4 -4
- package/dist/types/layout/deletionRoutes.d.ts +1 -1
- package/dist/types/layout/walkRowDraw.d.ts +4 -4
- package/dist/types/layout/walkRowRuns.d.ts +26 -6
- package/dist/types/layout/walkRows.d.ts +10 -4
- package/dist/types/types.d.ts +4 -25
- package/dist/types/version.d.ts +1 -1
- package/dist/types/walkHighlight.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/viewport.js +6 -6
- package/dist/walkHighlight.js +2 -2
- package/dist/walkKey.js +2 -2
- package/package.json +2 -1
- package/dist/chunks/chunk-D7ZTAGDM.js +0 -168
- package/dist/gfa/walkStops.js +0 -28
- package/dist/types/gfa/walkStops.d.ts +0 -59
package/README.md
CHANGED
|
@@ -15,18 +15,50 @@ npm install @jbrowse/bandage-core
|
|
|
15
15
|
|
|
16
16
|
- `loadGraph` reads GFA or rGFA text. The caller decompresses a `.gfa.gz` first
|
|
17
17
|
- `loadGraph` also takes `GraphTables`, the typed arrays that
|
|
18
|
-
[@jbrowse/graph-walks](https://github.com/GMOD/graph-walks) cuts from a
|
|
19
|
-
[gfa-to-tabix](https://github.com/GMOD/gfa-to-tabix) walk file
|
|
20
|
-
(`.walks.bed.gz` beside its `.tbi`) for a region on the reference. A worker
|
|
21
|
-
can transfer them without copying, and `graphTablesGFA` writes
|
|
18
|
+
[@jbrowse/graph-walks](https://github.com/GMOD/graph-walks) 5 cuts from a
|
|
19
|
+
[gfa-to-tabix](https://github.com/GMOD/gfa-to-tabix) 3 walk file, format 6
|
|
20
|
+
(`.walks.bed.gz` beside its `.tbi`), for a region on the reference. A worker
|
|
21
|
+
can transfer them without copying, and `graphTablesGFA` writes their nodes,
|
|
22
|
+
links and walks as GFA
|
|
22
23
|
- `openGbz` and `cutGbzRegion` cut a window from a
|
|
23
24
|
[gbz-base](https://github.com/jltsiren/gbz-base) database (`.gbz.db`) to GFA
|
|
24
25
|
text
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
|
|
27
|
+
### Departures
|
|
28
|
+
|
|
29
|
+
A walk-file cut's tables carry `departures`: every place over the window where a
|
|
30
|
+
haplotype's consecutive steps on the reference are not adjacent there, with the
|
|
31
|
+
breakpoint and strand of each end, the haplotype's own bp between them (`ownBp`,
|
|
32
|
+
from `hapStart` on its contig), the part of that the graph lacks (`missingBp`)
|
|
33
|
+
and how many times the reference passes each end's node. `src/gfa/departures.ts`
|
|
34
|
+
reads them.
|
|
35
|
+
|
|
36
|
+
- Walk rows draw the facts and make no call on what a departure is. A haplotype
|
|
37
|
+
with no step in the window is a `stepless` row, a hairline under the reference
|
|
38
|
+
between its departure's ends:
|
|
39
|
+
`no step on GRCh38 across 54 kb · 120 kb of its own`
|
|
40
|
+
- A gap between two pieces of a walk splits into the bp the cut trimmed
|
|
41
|
+
(`outside the extracted subgraph`), the bp the departures inside it say the
|
|
42
|
+
graph lacks (`not in the graph`), and the rest: the walk's own sequence the
|
|
43
|
+
cut did not read (`of its own, not read`), or, where the walk goes back to the
|
|
44
|
+
reference, `on nodes filed near chr22:20.3 Mb`, where it rejoins
|
|
45
|
+
- A walk reaching one flank reads as a lower bound. Its contig ends inside the
|
|
46
|
+
window only where its last step there is on the reference, with no departure
|
|
47
|
+
at that step and nothing the cut trimmed past it. A departure there says where
|
|
48
|
+
the walk goes on: `≥ 0.5 kb · goes on near chr1:4 kb · 4 kb of its own`. A
|
|
49
|
+
walk whose only step is a flank has no bp in the window and says just how it
|
|
50
|
+
goes on or that its contig ends at the window. A cut with no context stands
|
|
51
|
+
the reference's outermost nodes in for the flanks, so a walk that stops inside
|
|
52
|
+
reads the same way there rather than as a whole walk shorter than the
|
|
53
|
+
reference
|
|
54
|
+
- A row whose departure has an end on a node the reference passes more than once
|
|
55
|
+
says `placement choice`: the file's writer chose that pass
|
|
56
|
+
- Each row's `departures` lists those its runs do not draw as steps, for a
|
|
57
|
+
host's hover
|
|
58
|
+
- `GraphTables` mirrors graph-walks 5's, and `typecheck/graphWalks.ts` holds the
|
|
59
|
+
two equal. `departures` is required, so tables from a reader that states none
|
|
60
|
+
fail to compile; a source with none, such as GFA text or a gbz-base cut,
|
|
61
|
+
passes `departureTable()`
|
|
30
62
|
|
|
31
63
|
## Laying out and drawing
|
|
32
64
|
|
|
@@ -9,8 +9,13 @@ import {
|
|
|
9
9
|
} from "./chunk-GQZVR5DW.js";
|
|
10
10
|
import {
|
|
11
11
|
GAP_CAUSE_TEXT,
|
|
12
|
-
OUTSIDE_TEXT
|
|
13
|
-
|
|
12
|
+
OUTSIDE_TEXT,
|
|
13
|
+
PLACEMENT_CHOICE_TEXT,
|
|
14
|
+
departureSpan,
|
|
15
|
+
departureText,
|
|
16
|
+
placementChoice,
|
|
17
|
+
roughBp
|
|
18
|
+
} from "./chunk-NPDW3JAD.js";
|
|
14
19
|
import {
|
|
15
20
|
LABEL_CHAR_PX
|
|
16
21
|
} from "./chunk-S43IBA5Y.js";
|
|
@@ -29,7 +34,7 @@ var ON_REFERENCE = "#2f8fd6";
|
|
|
29
34
|
var OFF_REFERENCE = "#8e3fbf";
|
|
30
35
|
var OUTSIDE_CUT = "#bdbdbd";
|
|
31
36
|
var MISSING_INK = "#8a8a8a";
|
|
32
|
-
var
|
|
37
|
+
var OWN_GAP = "#e2e2e2";
|
|
33
38
|
var ABRIDGED_GAP = "#d9a441";
|
|
34
39
|
var GENE_INK = "#1c1c22";
|
|
35
40
|
var BAR_PX = 12;
|
|
@@ -48,11 +53,11 @@ function signedLength(delta) {
|
|
|
48
53
|
function units(bp, unit) {
|
|
49
54
|
return unit ? ` \u2248 ${Math.round(bp / unit)} units` : "";
|
|
50
55
|
}
|
|
51
|
-
var near = (
|
|
56
|
+
var near = (refName, pos) => `${refName === void 0 ? "" : `${panSNContig(refName)}:`}${pos < 1e6 ? `${Math.round(pos / 1e3)} kb` : `${(pos / 1e6).toFixed(1)} Mb`}`;
|
|
52
57
|
function stepsText(steps) {
|
|
53
58
|
return steps < 1e3 ? `${steps}` : `${Math.round(steps / 1e3)} k`;
|
|
54
59
|
}
|
|
55
|
-
function gapsText(gapBp, runs, abridgedSteps
|
|
60
|
+
function gapsText(gapBp, runs, abridgedSteps, refName) {
|
|
56
61
|
if (gapBp <= 0) {
|
|
57
62
|
return "";
|
|
58
63
|
}
|
|
@@ -62,7 +67,9 @@ function gapsText(gapBp, runs, abridgedSteps = 0) {
|
|
|
62
67
|
}
|
|
63
68
|
const bpOf = (cause) => gaps.filter((g) => g.cause === cause).reduce((sum, g) => sum + g.bp, 0);
|
|
64
69
|
const places = [
|
|
65
|
-
...new Set(
|
|
70
|
+
...new Set(
|
|
71
|
+
gaps.flatMap((g) => g.near === void 0 ? [] : [near(refName, g.near)])
|
|
72
|
+
)
|
|
66
73
|
];
|
|
67
74
|
const parts = [
|
|
68
75
|
[bpOf("missing"), GAP_CAUSE_TEXT.missing],
|
|
@@ -70,25 +77,34 @@ function gapsText(gapBp, runs, abridgedSteps = 0) {
|
|
|
70
77
|
bpOf("elsewhere"),
|
|
71
78
|
`on nodes filed near ${places[0]}${places.length > 1 ? ` and ${places.length - 1} more place${places.length > 2 ? "s" : ""}` : ""}`
|
|
72
79
|
],
|
|
73
|
-
[bpOf("
|
|
74
|
-
[bpOf("deleted"), GAP_CAUSE_TEXT.deleted],
|
|
80
|
+
[bpOf("own"), GAP_CAUSE_TEXT.own],
|
|
75
81
|
[bpOf(void 0), OUTSIDE_TEXT]
|
|
76
82
|
];
|
|
77
83
|
const abridged = bpOf("abridged");
|
|
78
84
|
return (abridged > 0 ? ` \xB7 ${stepsText(abridgedSteps)} steps, ${kb(abridged)} not loaded` : "") + parts.filter(([bp]) => bp > 0).map(([bp, text]) => ` \xB7 ${kb(bp)} ${text}`).join("");
|
|
79
85
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
86
|
+
function steplessText(departures, reference) {
|
|
87
|
+
const widest = [...departures].sort((a, b) => {
|
|
88
|
+
const x = departureSpan(a);
|
|
89
|
+
const y = departureSpan(b);
|
|
90
|
+
return y.end - y.start - (x.end - x.start);
|
|
91
|
+
})[0];
|
|
92
|
+
const more = departures.length - 1;
|
|
93
|
+
return widest ? [
|
|
94
|
+
departureText(widest, reference),
|
|
95
|
+
...more > 0 ? [`${more} more departure${more > 1 ? "s" : ""}`] : [],
|
|
96
|
+
...!placementChoice(widest) && departures.some(placementChoice) ? [PLACEMENT_CHOICE_TEXT] : []
|
|
97
|
+
].join(" \xB7 ") : "";
|
|
82
98
|
}
|
|
83
99
|
function walkRowReadout(row, reference, unit, call) {
|
|
84
100
|
const { bp, gapBp, complete, stop } = row;
|
|
85
101
|
if (!reference) {
|
|
86
102
|
return `${kb(bp)}${units(bp, unit)}`;
|
|
87
103
|
}
|
|
88
|
-
if (row.
|
|
89
|
-
return
|
|
104
|
+
if (row.stepless) {
|
|
105
|
+
return steplessText(row.departures ?? [], reference.sample);
|
|
90
106
|
}
|
|
91
|
-
const outside = gapsText(gapBp, row.runs, row.abridgedSteps)
|
|
107
|
+
const outside = `${gapsText(gapBp, row.runs, row.abridgedSteps ?? 0, reference.name)}${row.placementChoice ? ` \xB7 ${PLACEMENT_CHOICE_TEXT}` : ""}`;
|
|
92
108
|
const called = call ? ` \xB7 called ${kb(call.bp)}${call.spanningReads === 0 ? " \xB7 no spanning read" : ""}` : "";
|
|
93
109
|
if (complete) {
|
|
94
110
|
const delta = bp - reference.bp;
|
|
@@ -101,8 +117,9 @@ function walkRowReadout(row, reference, unit, call) {
|
|
|
101
117
|
const where = stop.shortBp > 0 ? `${kb(stop.shortBp)} before` : "at";
|
|
102
118
|
return `contig ends ${where} the ${region}${called}`;
|
|
103
119
|
}
|
|
104
|
-
const why = !stop ? "partial walk" : stop.contigEnds ? `contig ends inside the ${region}` : "does not rejoin the reference within the extracted subgraph";
|
|
105
|
-
|
|
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";
|
|
121
|
+
const bound = bp === 0 ? "" : `\u2265 ${kb(bp)}${units(bp, unit)} \xB7 `;
|
|
122
|
+
return `${bound}${why}${outside}${called}`;
|
|
106
123
|
}
|
|
107
124
|
function readoutPlacement(text, endX, width) {
|
|
108
125
|
const x = endX + 6;
|
|
@@ -126,7 +143,7 @@ function unitTicks(bp, unit, pxPerBp) {
|
|
|
126
143
|
return ticks;
|
|
127
144
|
}
|
|
128
145
|
function gapStyle(cause) {
|
|
129
|
-
return cause === "missing" ? { fill: MISSING_INK, px: MISSING_PX, label: GAP_CAUSE_TEXT.missing } : 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 === "abridged" ? { fill: ABRIDGED_GAP, px: GAP_PX, label: GAP_CAUSE_TEXT.abridged } : { fill: OUTSIDE_CUT, px: GAP_PX, label: OUTSIDE_TEXT };
|
|
130
147
|
}
|
|
131
148
|
function runPaint(run, ramp) {
|
|
132
149
|
if (run.gap) {
|
|
@@ -245,8 +262,8 @@ function walkRowsKey(bars, o = {}) {
|
|
|
245
262
|
for (const cause of [
|
|
246
263
|
void 0,
|
|
247
264
|
"missing",
|
|
248
|
-
"
|
|
249
|
-
"
|
|
265
|
+
"departure",
|
|
266
|
+
"own",
|
|
250
267
|
"abridged"
|
|
251
268
|
]) {
|
|
252
269
|
const { fill, px, label } = gapStyle(cause);
|
|
@@ -257,6 +274,13 @@ function walkRowsKey(bars, o = {}) {
|
|
|
257
274
|
});
|
|
258
275
|
}
|
|
259
276
|
}
|
|
277
|
+
if ([bars.reference, ...bars.rows].some((row) => row.placementChoice)) {
|
|
278
|
+
entries.push({
|
|
279
|
+
swatch: { kind: "gene" },
|
|
280
|
+
label: `${PLACEMENT_CHOICE_TEXT}: the writer chose which pass of a node the reference passes more than once a step takes`,
|
|
281
|
+
note: true
|
|
282
|
+
});
|
|
283
|
+
}
|
|
260
284
|
if (o.genes?.crowded) {
|
|
261
285
|
entries.push({
|
|
262
286
|
swatch: { kind: "gene" },
|
|
@@ -560,7 +584,7 @@ export {
|
|
|
560
584
|
OFF_REFERENCE,
|
|
561
585
|
OUTSIDE_CUT,
|
|
562
586
|
MISSING_INK,
|
|
563
|
-
|
|
587
|
+
OWN_GAP,
|
|
564
588
|
ABRIDGED_GAP,
|
|
565
589
|
GENE_INK,
|
|
566
590
|
BAR_PX,
|
|
@@ -3,25 +3,25 @@ import {
|
|
|
3
3
|
} from "./chunk-CO6RGQAD.js";
|
|
4
4
|
import {
|
|
5
5
|
layoutModeByValue
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FLCRH3JY.js";
|
|
7
7
|
import {
|
|
8
8
|
parseRegion
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IDYGRSNF.js";
|
|
10
10
|
import {
|
|
11
11
|
genePins
|
|
12
12
|
} from "./chunk-HEYIAMTC.js";
|
|
13
13
|
import {
|
|
14
14
|
version
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RWCZLHXX.js";
|
|
16
16
|
import {
|
|
17
17
|
axisScaleOf
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2TNFP3GC.js";
|
|
19
19
|
import {
|
|
20
20
|
figureScene
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-K5QGQNPO.js";
|
|
22
22
|
import {
|
|
23
23
|
fadedKey
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-STHPR76Q.js";
|
|
25
25
|
import {
|
|
26
26
|
encodingStops
|
|
27
27
|
} from "./chunk-OC5HU7M3.js";
|
|
@@ -44,13 +44,13 @@ import {
|
|
|
44
44
|
} from "./chunk-XWH4LB56.js";
|
|
45
45
|
import {
|
|
46
46
|
FIGURE_DEFAULTS
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-5PQQ4IXZ.js";
|
|
48
48
|
import {
|
|
49
49
|
engineSettingsOf,
|
|
50
50
|
fitTransform,
|
|
51
51
|
forceLayout,
|
|
52
52
|
loadGraph
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-RNROMUAS.js";
|
|
54
54
|
import {
|
|
55
55
|
referencePositions
|
|
56
56
|
} from "./chunk-L4DBSRA2.js";
|
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-5ORP7EFJ.js";
|
|
7
7
|
import {
|
|
8
8
|
gfaTables
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FSOP446U.js";
|
|
10
|
+
import {
|
|
11
|
+
departureTable
|
|
12
|
+
} from "./chunk-NPDW3JAD.js";
|
|
10
13
|
import {
|
|
11
14
|
panSNMatchesPrefix,
|
|
12
15
|
panSNSample
|
|
@@ -200,7 +203,8 @@ function compactTables(cut) {
|
|
|
200
203
|
offsets,
|
|
201
204
|
steps,
|
|
202
205
|
reversed
|
|
203
|
-
}
|
|
206
|
+
},
|
|
207
|
+
departures: departureTable()
|
|
204
208
|
};
|
|
205
209
|
}
|
|
206
210
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
stableCoordinate
|
|
3
3
|
} from "./chunk-CFXXFHRK.js";
|
|
4
|
-
import {
|
|
5
|
-
walkStopFields
|
|
6
|
-
} from "./chunk-D7ZTAGDM.js";
|
|
7
4
|
import {
|
|
8
5
|
pathOrigin,
|
|
9
6
|
surveyPaths
|
|
@@ -158,8 +155,7 @@ function convertGFAToGraph(gfaGraph, name = "Imported GFA") {
|
|
|
158
155
|
start: walkStart(walk),
|
|
159
156
|
sample: walk.sample,
|
|
160
157
|
haplotype: walk.haplotype,
|
|
161
|
-
contig: walk.contig
|
|
162
|
-
...walkStopFields(walk.tags)
|
|
158
|
+
contig: walk.contig
|
|
163
159
|
});
|
|
164
160
|
recordPathEdges(nodeIds2, name2);
|
|
165
161
|
}
|