@jbrowse/bandage-core 6.2.0 → 7.1.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-GOY6REMT.js → chunk-2LQ5BWT7.js} +1 -1
- package/dist/chunks/{chunk-5HF753RL.js → chunk-2WA4EY25.js} +27 -23
- package/dist/chunks/{chunk-EZPBJPK6.js → chunk-3JANT2SW.js} +6 -3
- package/dist/chunks/{chunk-N62KBLFC.js → chunk-3ZZSX5HN.js} +1 -1
- package/dist/chunks/{chunk-R6ZUK4Y3.js → chunk-4FQTTG5F.js} +1 -1
- package/dist/chunks/{chunk-YFRTTBCZ.js → chunk-6UFS3EWI.js} +3 -3
- package/dist/chunks/{chunk-M6SAUIYR.js → chunk-AWCMVPVP.js} +1 -1
- package/dist/chunks/{chunk-P2KU2TXS.js → chunk-CNQSHEBS.js} +1 -1
- package/dist/chunks/{chunk-CS3E4ETM.js → chunk-DRA7733Q.js} +1 -1
- package/dist/chunks/{chunk-X5L37W4J.js → chunk-E7FWQQHP.js} +1 -1
- package/dist/chunks/{chunk-3GMVZMKD.js → chunk-EXSXBIMH.js} +1 -1
- package/dist/chunks/{chunk-YMSSF2RK.js → chunk-FP4H7SFT.js} +1 -1
- package/dist/chunks/{chunk-DKOB2OPC.js → chunk-GJMC3PGM.js} +3 -3
- package/dist/chunks/{chunk-T43W7NKK.js → chunk-JKXE6CIP.js} +2 -2
- package/dist/chunks/{chunk-7R2UGY4I.js → chunk-KREASK3Z.js} +7 -13
- package/dist/chunks/{chunk-HE3NRWH7.js → chunk-MAPRJ2H2.js} +1 -1
- package/dist/chunks/{chunk-A7VOULBP.js → chunk-MH5IA57M.js} +1 -1
- package/dist/chunks/{chunk-MREQ7GIA.js → chunk-MLSWIMZO.js} +1 -1
- package/dist/chunks/{chunk-4EMPBO7S.js → chunk-N6FECAXP.js} +51 -1
- package/dist/chunks/{chunk-CTSBC2O6.js → chunk-OWFPAIJI.js} +1 -1
- package/dist/chunks/{chunk-6CO564AN.js → chunk-TQ7VCGJR.js} +1 -1
- package/dist/chunks/{chunk-YQZWW2V6.js → chunk-UGD6ZMOF.js} +31 -6
- package/dist/chunks/{chunk-GD7FYNGS.js → chunk-VECR253P.js} +1 -1
- package/dist/chunks/{chunk-VUBLSA6P.js → chunk-VST5SR4C.js} +2 -2
- package/dist/chunks/{chunk-Y3IOTZJA.js → chunk-WFB5TXRA.js} +1 -1
- package/dist/chunks/{chunk-STNG3Y5X.js → chunk-YZ5CCEDH.js} +0 -30
- package/dist/cli/figure.js +23 -23
- package/dist/deletionEdges.js +5 -1
- package/dist/figure.js +20 -20
- package/dist/graphLabels.js +2 -2
- package/dist/index.js +37 -27
- package/dist/labelLayout.js +6 -6
- package/dist/layout/deletionRoutes.js +1 -3
- package/dist/layout/tubeMapLayout.js +4 -4
- package/dist/layout/walkRowDraw.js +17 -7
- package/dist/layout/walkRowLayout.js +1 -1
- package/dist/layout/walkStrip.js +10 -9
- package/dist/layoutModes.js +6 -6
- package/dist/pathColors.js +3 -3
- package/dist/pipeline.js +3 -3
- package/dist/referenceRampCss.js +6 -6
- package/dist/referenceStrip.js +6 -6
- package/dist/renderer/GeometryBuilder.js +5 -5
- package/dist/tubeMap/axis.js +3 -3
- package/dist/tubeMap/coarsen.js +4 -4
- package/dist/tubeMap/genes.js +4 -4
- package/dist/tubeMap/nodeColors.js +6 -6
- package/dist/types/deletionEdges.d.ts +7 -0
- package/dist/types/figure.d.ts +2 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/labelLayout.d.ts +0 -1
- package/dist/types/layout/deletionRoutes.d.ts +0 -1
- package/dist/types/layout/walkRowDraw.d.ts +11 -0
- package/dist/types/layout/walkRowLayout.d.ts +2 -1
- package/dist/types/layout/walkStrip.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/util/SpatialIndex.js +3 -3
- package/dist/util/edgeCurves.js +2 -2
- package/dist/util/hitDetection.js +4 -4
- package/dist/version.js +1 -1
- package/dist/viewport.js +4 -4
- package/dist/walkEncoding.js +6 -6
- package/dist/walkHighlight.js +7 -7
- package/dist/walkKey.js +3 -3
- package/package.json +1 -1
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
stripGeneGaps,
|
|
6
6
|
walkStripFrame,
|
|
7
7
|
walkStripLabelsTree
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KREASK3Z.js";
|
|
9
9
|
import {
|
|
10
10
|
walkRowsKey,
|
|
11
11
|
walkRowsKeyTree,
|
|
12
12
|
walkRowsTree
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UGD6ZMOF.js";
|
|
14
14
|
import {
|
|
15
15
|
Canvas2DRenderer
|
|
16
16
|
} from "./chunk-CH3DLBUT.js";
|
|
@@ -24,45 +24,45 @@ import {
|
|
|
24
24
|
} from "./chunk-BUBZ32IC.js";
|
|
25
25
|
import {
|
|
26
26
|
version
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-MAPRJ2H2.js";
|
|
28
28
|
import {
|
|
29
29
|
axisScaleOf
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-AWCMVPVP.js";
|
|
31
31
|
import {
|
|
32
32
|
facetLifts,
|
|
33
33
|
walkLift
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-MH5IA57M.js";
|
|
35
35
|
import {
|
|
36
36
|
encodingStops
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-TQ7VCGJR.js";
|
|
38
38
|
import {
|
|
39
39
|
rangeText,
|
|
40
40
|
walkKey
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-2LQ5BWT7.js";
|
|
42
42
|
import {
|
|
43
43
|
FIT_PADDING,
|
|
44
44
|
drawingBounds,
|
|
45
45
|
fitTransform
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-6UFS3EWI.js";
|
|
47
47
|
import {
|
|
48
48
|
buildGeometry,
|
|
49
49
|
computeReferenceRamp
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-VST5SR4C.js";
|
|
51
51
|
import {
|
|
52
52
|
nodeInk
|
|
53
53
|
} from "./chunk-PBENCR5L.js";
|
|
54
54
|
import {
|
|
55
55
|
geneLabelCandidates
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-GJMC3PGM.js";
|
|
57
57
|
import {
|
|
58
58
|
nodesUnderBox
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-FP4H7SFT.js";
|
|
60
60
|
import {
|
|
61
61
|
walkRowsExtent
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-3JANT2SW.js";
|
|
63
63
|
import {
|
|
64
64
|
pathLegend
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-E7FWQQHP.js";
|
|
66
66
|
import {
|
|
67
67
|
LABEL_CHAR_PX,
|
|
68
68
|
LABEL_PAD,
|
|
@@ -74,8 +74,9 @@ import {
|
|
|
74
74
|
resolveColorScheme
|
|
75
75
|
} from "./chunk-JKJWSY4V.js";
|
|
76
76
|
import {
|
|
77
|
+
deletionDrawing,
|
|
77
78
|
deletionEdges
|
|
78
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-N6FECAXP.js";
|
|
79
80
|
import {
|
|
80
81
|
ROW_HEIGHT_PX
|
|
81
82
|
} from "./chunk-CPMHA4W5.js";
|
|
@@ -153,7 +154,7 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
153
154
|
const rows = o.walkRows;
|
|
154
155
|
const bounds = drawingBounds(layout, {
|
|
155
156
|
region: o.fitToDrawing ? void 0 : region,
|
|
156
|
-
extent: rows && layout.extent ? walkRowsExtent(rows) : void 0
|
|
157
|
+
extent: rows && layout.extent ? walkRowsExtent(rows, o.walkRowPitch) : void 0
|
|
157
158
|
});
|
|
158
159
|
const pixelRows = layout.pixelRows ?? false;
|
|
159
160
|
const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
@@ -163,7 +164,11 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
163
164
|
start: referenceRamp.start,
|
|
164
165
|
end: referenceRamp.start + referenceRamp.span
|
|
165
166
|
};
|
|
166
|
-
const
|
|
167
|
+
const drawnDeletions = deletionDrawing(
|
|
168
|
+
graph,
|
|
169
|
+
layout.tubeMap ? [] : deletionEdges(graph),
|
|
170
|
+
o.showDeletionEdges
|
|
171
|
+
);
|
|
167
172
|
const layers = o.walks ?? [];
|
|
168
173
|
const walkRamp = layers.some((l) => l.color?.field === "reference") ? referenceRamp ?? computeReferenceRamp(graph, rampDomain) : void 0;
|
|
169
174
|
const lift = layers.length > 0 && !layout.tubeMap ? walkLift(graph, layers, walkRamp) : void 0;
|
|
@@ -221,7 +226,7 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
221
226
|
serializeEl(
|
|
222
227
|
walkRowsTree(
|
|
223
228
|
rows,
|
|
224
|
-
{ ...t, width: w, height: h },
|
|
229
|
+
{ ...t, width: w, height: h, ...o.walkRowPitch },
|
|
225
230
|
{
|
|
226
231
|
ramp: rampInterval,
|
|
227
232
|
rowGenes: o.rowGenes
|
|
@@ -230,9 +235,10 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
230
235
|
)
|
|
231
236
|
);
|
|
232
237
|
}
|
|
233
|
-
const
|
|
238
|
+
const pitch = o.walkRowPitch;
|
|
239
|
+
const rowLabels = rows ? pitch && !pitch.labelled ? [] : [rows.reference, ...rows.rows].map((r, i) => ({
|
|
234
240
|
label: r.label,
|
|
235
|
-
y: i * ROW_HEIGHT_PX
|
|
241
|
+
y: i * (pitch?.rowPx ?? ROW_HEIGHT_PX)
|
|
236
242
|
})) : layout.rowLabels ?? [];
|
|
237
243
|
for (const { label, y } of rowLabels) {
|
|
238
244
|
const sy = y * t.scaleY + t.translateY;
|
|
@@ -276,12 +282,10 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
276
282
|
highlight,
|
|
277
283
|
axis,
|
|
278
284
|
referenceRamp,
|
|
279
|
-
deletions:
|
|
285
|
+
deletions: drawnDeletions.bypassed,
|
|
280
286
|
deletionRoutes: layout.deletionRoutes,
|
|
281
287
|
stranded: layout.stranded,
|
|
282
|
-
hiddenEdges:
|
|
283
|
-
o.showDeletionEdges ? [] : deletions.map((d) => d.edgeIndex)
|
|
284
|
-
)
|
|
288
|
+
hiddenEdges: drawnDeletions.hidden
|
|
285
289
|
})
|
|
286
290
|
);
|
|
287
291
|
const t = {
|
|
@@ -12,14 +12,17 @@ import {
|
|
|
12
12
|
|
|
13
13
|
// src/layout/walkRowLayout.ts
|
|
14
14
|
var READOUT_ROOM = 1.3;
|
|
15
|
-
function walkRowsExtent(walks
|
|
15
|
+
function walkRowsExtent(walks, pitch = {
|
|
16
|
+
rowPx: ROW_HEIGHT_PX,
|
|
17
|
+
readouts: true
|
|
18
|
+
}) {
|
|
16
19
|
let longest = walks.reference.bp;
|
|
17
20
|
for (const row of walks.rows) {
|
|
18
21
|
longest = Math.max(longest, row.bp);
|
|
19
22
|
}
|
|
20
23
|
return {
|
|
21
|
-
maxX: walks.origin + longest * READOUT_ROOM,
|
|
22
|
-
maxY: walks.rows.length *
|
|
24
|
+
maxX: walks.origin + longest * (pitch.readouts ? READOUT_ROOM : 1),
|
|
25
|
+
maxY: walks.rows.length * pitch.rowPx
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
function walkRowLayout(graph, region) {
|
|
@@ -11,11 +11,10 @@ import {
|
|
|
11
11
|
parseGFA
|
|
12
12
|
} from "./chunk-CDLPYR5O.js";
|
|
13
13
|
import {
|
|
14
|
-
closableDeletions,
|
|
15
14
|
routeNodes,
|
|
16
15
|
takeRoutes,
|
|
17
16
|
withDeletionRoutes
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YZ5CCEDH.js";
|
|
19
18
|
import {
|
|
20
19
|
anchorGraph
|
|
21
20
|
} from "./chunk-ST2IBUAN.js";
|
|
@@ -32,8 +31,9 @@ import {
|
|
|
32
31
|
layoutScaling
|
|
33
32
|
} from "./chunk-6JEWNXCQ.js";
|
|
34
33
|
import {
|
|
34
|
+
closableDeletions,
|
|
35
35
|
deletionEdges
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-N6FECAXP.js";
|
|
37
37
|
import {
|
|
38
38
|
isBackbone
|
|
39
39
|
} from "./chunk-FYQWPEEY.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
nodesUnderBox
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FP4H7SFT.js";
|
|
4
4
|
import {
|
|
5
5
|
nodeLabelBudget,
|
|
6
6
|
placeSizeLabels,
|
|
7
7
|
rowLabelBox,
|
|
8
8
|
sizeLabelCandidates
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3ZZSX5HN.js";
|
|
10
10
|
import {
|
|
11
11
|
LABEL_CHAR_PX,
|
|
12
12
|
LABEL_PAD,
|
|
@@ -127,7 +127,7 @@ function layoutLabels(m) {
|
|
|
127
127
|
const sizeCandidates = m.nodePositions && m.labelsNodeSizes ? sizeLabelCandidates({
|
|
128
128
|
nodePositions: m.nodePositions,
|
|
129
129
|
nodeLengths: m.nodeLengths,
|
|
130
|
-
deletions: m.
|
|
130
|
+
deletions: m.deletions,
|
|
131
131
|
deletionRoutes: m.deletionRoutes,
|
|
132
132
|
stranded: m.stranded,
|
|
133
133
|
alleleDeletions: m.alleleDeletions,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
hasTubeMapPaths,
|
|
3
3
|
tubeMapLayout,
|
|
4
4
|
tubeMapReferenceLayout
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4FQTTG5F.js";
|
|
6
6
|
import {
|
|
7
7
|
sampleRowLayout
|
|
8
8
|
} from "./chunk-LOEA5IHZ.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-HNQPEMYE.js";
|
|
15
15
|
import {
|
|
16
16
|
walkRowLayout
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3JANT2SW.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackbone,
|
|
20
20
|
isOffReference
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
alongRow,
|
|
3
|
-
boxesGenes
|
|
4
|
-
|
|
3
|
+
boxesGenes,
|
|
4
|
+
rowPitch
|
|
5
|
+
} from "./chunk-UGD6ZMOF.js";
|
|
5
6
|
import {
|
|
6
7
|
pathOrigin
|
|
7
8
|
} from "./chunk-ST2IBUAN.js";
|
|
8
9
|
import {
|
|
9
10
|
LABEL_CHAR_PX
|
|
10
11
|
} from "./chunk-AB35TJST.js";
|
|
11
|
-
import {
|
|
12
|
-
ROW_HEIGHT_PX
|
|
13
|
-
} from "./chunk-CPMHA4W5.js";
|
|
14
12
|
import {
|
|
15
13
|
el
|
|
16
14
|
} from "./chunk-NNODIW4U.js";
|
|
@@ -20,7 +18,6 @@ var PAD_PX = 6;
|
|
|
20
18
|
var WALK_STRIP_CEILING_PX = 260;
|
|
21
19
|
var LABEL_FONT_PX = 11;
|
|
22
20
|
var MIN_ROW_PX = 3;
|
|
23
|
-
var LABELLED_ROW_PX = 12;
|
|
24
21
|
var READOUT_ROOM = 1.3;
|
|
25
22
|
var MARK_INK = "#111";
|
|
26
23
|
var TICK_PX = 3;
|
|
@@ -113,13 +110,11 @@ function walkStripFrame(bars, o) {
|
|
|
113
110
|
const maxHeight = o.maxHeight ?? WALK_STRIP_CEILING_PX;
|
|
114
111
|
const labelPx = o.labelPx ?? Math.max(...[bars.reference, ...bars.rows].map((r) => r.label.length)) * LABEL_CHAR_PX + 16;
|
|
115
112
|
const count = bars.rows.length + 1;
|
|
116
|
-
const rowPx =
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
const { rowPx, barPx, labelled, readouts } = rowPitch(
|
|
114
|
+
count,
|
|
115
|
+
maxHeight - 2 * PAD_PX,
|
|
116
|
+
MIN_ROW_PX
|
|
119
117
|
);
|
|
120
|
-
const labelled = rowPx >= LABELLED_ROW_PX;
|
|
121
|
-
const readouts = rowPx >= 14;
|
|
122
|
-
const barPx = Math.max(2, Math.round(rowPx * 0.6));
|
|
123
118
|
const longest = Math.max(bars.reference.bp, ...bars.rows.map((r) => r.bp), 1);
|
|
124
119
|
const left = labelled ? labelPx : PAD_PX;
|
|
125
120
|
const usable = Math.max(1, o.width - left - PAD_PX);
|
|
@@ -194,7 +189,6 @@ function stripGeneGaps(frame, rowGenes, gaps) {
|
|
|
194
189
|
|
|
195
190
|
export {
|
|
196
191
|
WALK_STRIP_CEILING_PX,
|
|
197
|
-
LABELLED_ROW_PX,
|
|
198
192
|
stripMarks,
|
|
199
193
|
segmentAt,
|
|
200
194
|
walkStripFrame,
|
|
@@ -109,9 +109,59 @@ function deletionEdges(graph) {
|
|
|
109
109
|
}
|
|
110
110
|
return found;
|
|
111
111
|
}
|
|
112
|
+
function closableDeletions(graph, deletions) {
|
|
113
|
+
const parent = /* @__PURE__ */ new Map();
|
|
114
|
+
const root = (id) => {
|
|
115
|
+
let r = id;
|
|
116
|
+
while (parent.has(r)) {
|
|
117
|
+
r = parent.get(r);
|
|
118
|
+
}
|
|
119
|
+
if (r !== id) {
|
|
120
|
+
parent.set(id, r);
|
|
121
|
+
}
|
|
122
|
+
return r;
|
|
123
|
+
};
|
|
124
|
+
const join = (a, b) => {
|
|
125
|
+
const [ra, rb] = [root(a), root(b)];
|
|
126
|
+
if (ra !== rb) {
|
|
127
|
+
parent.set(ra, rb);
|
|
128
|
+
}
|
|
129
|
+
return ra !== rb;
|
|
130
|
+
};
|
|
131
|
+
const candidates = new Set(deletions.map((d) => d.edgeIndex));
|
|
132
|
+
graph.edges.forEach((e, ei) => {
|
|
133
|
+
if (!candidates.has(ei)) {
|
|
134
|
+
join(e.from, e.to);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return new Set(
|
|
138
|
+
deletions.filter((d) => !join(d.from, d.to)).map((d) => d.edgeIndex)
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
var drawings = /* @__PURE__ */ new WeakMap();
|
|
142
|
+
function deletionDrawing(graph, deletions, show = true) {
|
|
143
|
+
let byShow = drawings.get(deletions);
|
|
144
|
+
if (!byShow) {
|
|
145
|
+
byShow = /* @__PURE__ */ new Map();
|
|
146
|
+
drawings.set(deletions, byShow);
|
|
147
|
+
}
|
|
148
|
+
let drawing = byShow.get(show);
|
|
149
|
+
if (!drawing) {
|
|
150
|
+
const hidden = show ? /* @__PURE__ */ new Set() : closableDeletions(graph, deletions);
|
|
151
|
+
drawing = {
|
|
152
|
+
shown: deletions.filter((d) => !hidden.has(d.edgeIndex)),
|
|
153
|
+
bypassed: new Map(deletions.map((d) => [d.edgeIndex, d.bypassed])),
|
|
154
|
+
hidden
|
|
155
|
+
};
|
|
156
|
+
byShow.set(show, drawing);
|
|
157
|
+
}
|
|
158
|
+
return drawing;
|
|
159
|
+
}
|
|
112
160
|
|
|
113
161
|
export {
|
|
114
162
|
bypassedPoints,
|
|
115
163
|
deletionArcCurves,
|
|
116
|
-
deletionEdges
|
|
164
|
+
deletionEdges,
|
|
165
|
+
closableDeletions,
|
|
166
|
+
deletionDrawing
|
|
117
167
|
};
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
RAMP_GRADIENT_STOPS,
|
|
4
4
|
rampHueCss,
|
|
5
5
|
rampStops
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VECR253P.js";
|
|
7
7
|
import {
|
|
8
8
|
REFERENCE_RAMP_ALT_CSS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VST5SR4C.js";
|
|
10
10
|
import {
|
|
11
11
|
LABEL_CHAR_PX
|
|
12
12
|
} from "./chunk-AB35TJST.js";
|
|
@@ -24,6 +24,9 @@ var OUTSIDE_CUT = "#bdbdbd";
|
|
|
24
24
|
var GENE_INK = "#1c1c22";
|
|
25
25
|
var BAR_PX = 12;
|
|
26
26
|
var GAP_PX = 4;
|
|
27
|
+
var LABELLED_ROW_PX = 12;
|
|
28
|
+
var READOUT_ROW_PX = 14;
|
|
29
|
+
var MIN_TILED_BAR_PX = 6;
|
|
27
30
|
var MIN_TILE_PX = 3;
|
|
28
31
|
function kb(bp) {
|
|
29
32
|
return `${(bp / 1e3).toFixed(bp < 1e4 ? 1 : 0)} kb`;
|
|
@@ -209,6 +212,9 @@ function walkRowsKey(bars, o = {}) {
|
|
|
209
212
|
var CALL_TICK = "#111";
|
|
210
213
|
var UNBACKED_TICK = "#9e9e9e";
|
|
211
214
|
var DISAGREES = "#c62828";
|
|
215
|
+
function callTickInk(call) {
|
|
216
|
+
return call.agrees === false ? DISAGREES : call.spanningReads === 0 ? UNBACKED_TICK : CALL_TICK;
|
|
217
|
+
}
|
|
212
218
|
function walkRowsKeyTree(entries, x, y, idPrefix = "walk-key") {
|
|
213
219
|
let at = 0;
|
|
214
220
|
const parts = entries.flatMap((e, i) => {
|
|
@@ -262,6 +268,19 @@ function walkRowsKeyTree(entries, x, y, idPrefix = "walk-key") {
|
|
|
262
268
|
)
|
|
263
269
|
};
|
|
264
270
|
}
|
|
271
|
+
function rowPitch(count, room, minRowPx = 0) {
|
|
272
|
+
const fit = room / Math.max(1, count);
|
|
273
|
+
const rowPx = Math.max(
|
|
274
|
+
minRowPx,
|
|
275
|
+
Math.min(ROW_HEIGHT_PX, fit >= 1 ? Math.floor(fit) : fit)
|
|
276
|
+
);
|
|
277
|
+
return {
|
|
278
|
+
rowPx,
|
|
279
|
+
barPx: rowPx <= 3 ? rowPx : Math.max(3, Math.round(rowPx * 0.6)),
|
|
280
|
+
labelled: rowPx >= LABELLED_ROW_PX,
|
|
281
|
+
readouts: rowPx >= READOUT_ROW_PX
|
|
282
|
+
};
|
|
283
|
+
}
|
|
265
284
|
function coalesceRuns(runs, pxPerBp) {
|
|
266
285
|
const minBp = 1 / pxPerBp;
|
|
267
286
|
const out = [];
|
|
@@ -358,6 +377,7 @@ function walkRowsTree(bars, frame, o = {}) {
|
|
|
358
377
|
const X = (bp) => bp * frame.scaleX + frame.translateX;
|
|
359
378
|
const rowPx = frame.rowPx ?? ROW_HEIGHT_PX;
|
|
360
379
|
const barPx = frame.barPx ?? BAR_PX;
|
|
380
|
+
const overhang = Math.min(3, Math.max(0, (rowPx - barPx) / 2));
|
|
361
381
|
const Y = (row) => row * rowPx * frame.scaleY + frame.translateY;
|
|
362
382
|
const { origin, unit, reference, rows } = bars;
|
|
363
383
|
const along = (offset) => X(origin + offset);
|
|
@@ -392,7 +412,7 @@ function walkRowsTree(bars, frame, o = {}) {
|
|
|
392
412
|
rect
|
|
393
413
|
] : [rect];
|
|
394
414
|
});
|
|
395
|
-
const ticks = unit ? unitTicks(row.bp, unit, frame.scaleX).map(
|
|
415
|
+
const ticks = unit && barPx >= MIN_TILED_BAR_PX ? unitTicks(row.bp, unit, frame.scaleX).map(
|
|
396
416
|
(k) => el("line", {
|
|
397
417
|
x1: along(k),
|
|
398
418
|
x2: along(k),
|
|
@@ -425,10 +445,10 @@ function walkRowsTree(bars, frame, o = {}) {
|
|
|
425
445
|
call && el("rect", {
|
|
426
446
|
"data-testid": "graph-walk-call",
|
|
427
447
|
x: along(call.bp) - 1,
|
|
428
|
-
y: y - barPx / 2 -
|
|
448
|
+
y: y - barPx / 2 - overhang,
|
|
429
449
|
width: 2,
|
|
430
|
-
height: barPx +
|
|
431
|
-
fill: call
|
|
450
|
+
height: barPx + 2 * overhang,
|
|
451
|
+
fill: callTickInk(call)
|
|
432
452
|
}),
|
|
433
453
|
readouts && el(
|
|
434
454
|
"text",
|
|
@@ -457,6 +477,7 @@ export {
|
|
|
457
477
|
GENE_INK,
|
|
458
478
|
BAR_PX,
|
|
459
479
|
GAP_PX,
|
|
480
|
+
LABELLED_ROW_PX,
|
|
460
481
|
kb,
|
|
461
482
|
walkRowReadout,
|
|
462
483
|
readoutPlacement,
|
|
@@ -469,8 +490,12 @@ export {
|
|
|
469
490
|
boxesGenes,
|
|
470
491
|
rowGeneBoxes,
|
|
471
492
|
walkRowsKey,
|
|
493
|
+
CALL_TICK,
|
|
494
|
+
UNBACKED_TICK,
|
|
472
495
|
DISAGREES,
|
|
496
|
+
callTickInk,
|
|
473
497
|
walkRowsKeyTree,
|
|
498
|
+
rowPitch,
|
|
474
499
|
coalesceRuns,
|
|
475
500
|
walkRowsTree
|
|
476
501
|
};
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
} from "./chunk-PBENCR5L.js";
|
|
10
10
|
import {
|
|
11
11
|
baseEdgeCurves
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WFB5TXRA.js";
|
|
13
13
|
import {
|
|
14
14
|
PATH_LIGHTNESS,
|
|
15
15
|
PATH_SATURATION,
|
|
16
16
|
nameHue,
|
|
17
17
|
pathHueAt
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-E7FWQQHP.js";
|
|
19
19
|
import {
|
|
20
20
|
referenceMidpoints
|
|
21
21
|
} from "./chunk-ES2N6V56.js";
|
|
@@ -39,35 +39,6 @@ function withDeletionRoutes(graph, deletions, dropped = /* @__PURE__ */ new Set(
|
|
|
39
39
|
ids: new Set(routes.values())
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function closableDeletions(graph, deletions) {
|
|
43
|
-
const parent = /* @__PURE__ */ new Map();
|
|
44
|
-
const root = (id) => {
|
|
45
|
-
let r = id;
|
|
46
|
-
while (parent.has(r)) {
|
|
47
|
-
r = parent.get(r);
|
|
48
|
-
}
|
|
49
|
-
if (r !== id) {
|
|
50
|
-
parent.set(id, r);
|
|
51
|
-
}
|
|
52
|
-
return r;
|
|
53
|
-
};
|
|
54
|
-
const join = (a, b) => {
|
|
55
|
-
const [ra, rb] = [root(a), root(b)];
|
|
56
|
-
if (ra !== rb) {
|
|
57
|
-
parent.set(ra, rb);
|
|
58
|
-
}
|
|
59
|
-
return ra !== rb;
|
|
60
|
-
};
|
|
61
|
-
const candidates = new Set(deletions.map((d) => d.edgeIndex));
|
|
62
|
-
graph.edges.forEach((e, ei) => {
|
|
63
|
-
if (!candidates.has(ei)) {
|
|
64
|
-
join(e.from, e.to);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return new Set(
|
|
68
|
-
deletions.filter((d) => !join(d.from, d.to)).map((d) => d.edgeIndex)
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
42
|
function routeNodes(graph, deletions, routes, drawnOf, opts) {
|
|
72
43
|
const lengths = new Map(graph.nodes.map((n) => [n.id, n.length]));
|
|
73
44
|
return deletions.map((d) => {
|
|
@@ -103,7 +74,6 @@ function takeRoutes(positions, routes) {
|
|
|
103
74
|
|
|
104
75
|
export {
|
|
105
76
|
withDeletionRoutes,
|
|
106
|
-
closableDeletions,
|
|
107
77
|
routeNodes,
|
|
108
78
|
takeRoutes
|
|
109
79
|
};
|