@jbrowse/bandage-core 10.2.2 → 10.2.4
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 +8 -7
- package/dist/bubbles/bubbleHalos.js +7 -3
- package/dist/bubbles/bubblesFromGraph.js +4 -2
- package/dist/bubbles/classifyBubble.js +10 -5
- package/dist/bubbles/superbubbles.js +10 -6
- package/dist/chunks/{chunk-N6FECAXP.js → chunk-24WITXQY.js} +17 -8
- package/dist/chunks/{chunk-EYK7DJZV.js → chunk-2CHS5LMM.js} +1 -1
- package/dist/chunks/{chunk-XTCNEKO5.js → chunk-2QLLQJ72.js} +15 -13
- package/dist/chunks/{chunk-TWRLC3KK.js → chunk-3XSM4OZU.js} +1 -1
- package/dist/chunks/{chunk-WEDZ76AK.js → chunk-4DRQTBBE.js} +1 -1
- package/dist/chunks/{chunk-2LQ5BWT7.js → chunk-4ETPXDO6.js} +1 -1
- package/dist/chunks/{chunk-FP4H7SFT.js → chunk-4HWM3FNK.js} +2 -2
- package/dist/chunks/{chunk-C7MZJSPT.js → chunk-54POIBVC.js} +2 -8
- package/dist/chunks/{chunk-PKFMP65V.js → chunk-5GMFEPWR.js} +1 -1
- package/dist/chunks/{chunk-CDLPYR5O.js → chunk-5I3K4R2G.js} +7 -6
- package/dist/chunks/{chunk-2CVHXFK7.js → chunk-7SRWJLSC.js} +19 -22
- package/dist/chunks/{chunk-SBMJNRTV.js → chunk-A4PFFC4Q.js} +37 -27
- package/dist/chunks/{chunk-FNGIQF43.js → chunk-ABUIN5AK.js} +6 -14
- package/dist/chunks/{chunk-IW6CYVX2.js → chunk-AR4BUBMU.js} +6 -1
- package/dist/chunks/{chunk-IUDJKOLB.js → chunk-B6IW3IRE.js} +15 -33
- package/dist/chunks/{chunk-JUIJI7RC.js → chunk-BAETMD3J.js} +9 -4
- package/dist/chunks/{chunk-L5WF4ZPS.js → chunk-BS4UZ44I.js} +1 -1
- package/dist/chunks/{chunk-HNQPEMYE.js → chunk-CM6LO6OC.js} +0 -1
- package/dist/chunks/{chunk-CLOP7UVD.js → chunk-CQHUZHET.js} +11 -8
- package/dist/chunks/{chunk-R456ME6J.js → chunk-CU6P5RUG.js} +17 -6
- package/dist/chunks/chunk-D5D36ZF6.js +107 -0
- package/dist/chunks/{chunk-AFP3NWSL.js → chunk-DY3JCAMX.js} +1 -1
- package/dist/chunks/{chunk-NRV7R36Q.js → chunk-EFQLEGWM.js} +3 -3
- package/dist/chunks/{chunk-BXEPA4KS.js → chunk-G6UIYQZR.js} +5 -2
- package/dist/chunks/{chunk-ASSNZXCF.js → chunk-GINYTQ43.js} +44 -103
- package/dist/chunks/{chunk-NNODIW4U.js → chunk-H2H4Y3TV.js} +1 -0
- package/dist/chunks/{chunk-MVFDSFV2.js → chunk-HNCXR2VS.js} +1 -1
- package/dist/chunks/chunk-JA2HJIYS.js +71 -0
- package/dist/chunks/{chunk-PBENCR5L.js → chunk-JBCZIBFC.js} +0 -2
- package/dist/chunks/{chunk-5BGP5Z64.js → chunk-JLSJMCDJ.js} +1 -1
- package/dist/chunks/{chunk-DT2GGH4D.js → chunk-JMABOQWL.js} +2 -6
- package/dist/chunks/{chunk-3S3YVOJ7.js → chunk-JSUCGZ6K.js} +1 -1
- package/dist/chunks/{chunk-MLSWIMZO.js → chunk-KBEP7VYK.js} +2 -2
- package/dist/chunks/{chunk-DRG4236Y.js → chunk-KC7T5RWG.js} +2 -20
- package/dist/chunks/{chunk-TAMCZHLW.js → chunk-N73TI3VG.js} +2 -2
- package/dist/chunks/chunk-O4EGE27I.js +10 -0
- package/dist/chunks/{chunk-3ZZSX5HN.js → chunk-PTABFYQ7.js} +10 -6
- package/dist/chunks/{chunk-WBCOREDZ.js → chunk-QLWI2PZ3.js} +16 -7
- package/dist/chunks/chunk-RBCE2OQH.js +32 -0
- package/dist/chunks/{chunk-BUBZ32IC.js → chunk-RPRHR56C.js} +4 -8
- package/dist/chunks/{chunk-47DYCZOK.js → chunk-RUCH6ZFL.js} +4 -0
- package/dist/chunks/{chunk-GNTTI6LA.js → chunk-T2PCSAFY.js} +1 -1
- package/dist/chunks/{chunk-XKWD2RY3.js → chunk-URZ3CH2R.js} +3 -10
- package/dist/chunks/{chunk-ALDGONEI.js → chunk-VQC7KELB.js} +1 -1
- package/dist/chunks/{chunk-FLFBYSJO.js → chunk-VQWHMWLF.js} +5 -1
- package/dist/chunks/{chunk-4R6QNG23.js → chunk-WL6ZKUVC.js} +3 -3
- package/dist/chunks/{chunk-CRTD2SBP.js → chunk-WZNPX7Q6.js} +6 -2
- package/dist/chunks/{chunk-TICYLD5F.js → chunk-XAWLIU54.js} +35 -78
- package/dist/chunks/{chunk-DK5P2YOL.js → chunk-XI3ZUTWF.js} +2 -2
- package/dist/chunks/{chunk-ZIUKZUPJ.js → chunk-XL472HHD.js} +1 -1
- package/dist/chunks/{chunk-BPRXQ2SS.js → chunk-XMW266WS.js} +1 -1
- package/dist/chunks/{chunk-WFB5TXRA.js → chunk-ZY2AFL4Y.js} +13 -31
- package/dist/cli/decodeText.js +6 -0
- package/dist/cli/figure.js +59 -60
- package/dist/cli/fold.js +13 -13
- package/dist/deletionEdges.js +6 -4
- package/dist/el.js +3 -1
- package/dist/figure.js +33 -31
- package/dist/figureData.js +32 -27
- package/dist/figureScene.js +43 -0
- package/dist/figureSettings.js +8 -8
- package/dist/foldVariants.js +2 -2
- package/dist/gbzCut.js +1 -1
- package/dist/genes/exonOutline.js +2 -2
- package/dist/genes/geneFiles.js +1 -1
- package/dist/genes/genePins.js +3 -3
- package/dist/gfa/gfaConverter.js +2 -2
- package/dist/gfa-core/gfaParser.js +1 -1
- package/dist/gfa-core/index.js +1 -1
- package/dist/graphLabels.js +4 -4
- package/dist/index.js +72 -73
- package/dist/labelLayout.js +8 -8
- package/dist/layout/forceCache.js +8 -8
- package/dist/layout/mergeRuns.js +2 -2
- package/dist/layout/orderedLayout.js +1 -3
- package/dist/layout/tubeMapLayout.js +6 -6
- package/dist/layout/walkRowDraw.js +11 -11
- package/dist/layout/walkRowLayout.js +3 -1
- package/dist/layout/walkStrip.js +14 -12
- package/dist/layoutEngines.js +1 -2
- package/dist/layoutModes.js +9 -9
- package/dist/nodeWidths.js +1 -3
- package/dist/pathColors.js +5 -5
- package/dist/pipeline.js +7 -7
- package/dist/referenceRampCss.js +9 -9
- package/dist/referenceStrip.js +9 -9
- package/dist/renderer/Canvas2DRenderer.js +2 -2
- package/dist/renderer/GeometryBuilder.js +8 -8
- package/dist/renderer/canvas.js +1 -1
- package/dist/renderer/svgCanvas.js +1 -1
- package/dist/tubeMap/axis.js +5 -5
- package/dist/tubeMap/bundle.js +7 -7
- package/dist/tubeMap/coarsen.js +6 -6
- package/dist/tubeMap/deviations.js +5 -5
- package/dist/tubeMap/draw.js +1 -1
- package/dist/tubeMap/genes.js +6 -6
- package/dist/tubeMap/nodeColors.js +9 -9
- package/dist/types/bubbles/bubbleHalos.d.ts +2 -8
- package/dist/types/bubbles/bubblesFromGraph.d.ts +1 -0
- package/dist/types/bubbles/classifyBubble.d.ts +0 -1
- package/dist/types/cli/decodeText.d.ts +1 -0
- package/dist/types/cli/figure.d.ts +4 -15
- package/dist/types/deletionEdges.d.ts +3 -5
- package/dist/types/el.d.ts +1 -0
- package/dist/types/figureData.d.ts +7 -26
- package/dist/types/figureScene.d.ts +31 -0
- package/dist/types/genes/geneFiles.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/labelLayout.d.ts +1 -5
- package/dist/types/layout/deletionRoutes.d.ts +1 -1
- package/dist/types/layout/orderedLayout.d.ts +0 -6
- package/dist/types/layout/walkRowLayout.d.ts +1 -0
- package/dist/types/nodeWidths.d.ts +0 -1
- package/dist/types/renderer/Canvas2DRenderer.d.ts +1 -0
- package/dist/types/renderer/canvas.d.ts +2 -2
- package/dist/types/tubeMap/draw.d.ts +1 -0
- package/dist/types/util/geometry.d.ts +3 -3
- package/dist/types/version.d.ts +1 -1
- package/dist/util/SpatialIndex.js +4 -4
- package/dist/util/edgeCurves.js +3 -3
- package/dist/util/geometry.js +3 -3
- package/dist/util/hitDetection.js +5 -5
- package/dist/version.js +1 -1
- package/dist/viewport.js +8 -8
- package/dist/walkEncoding.js +9 -9
- package/dist/walkHighlight.js +10 -10
- package/dist/walkKey.js +5 -5
- package/package.json +3 -6
- package/dist/chunks/bandage-layout-3AR6BCUD.js +0 -4694
- package/dist/chunks/chunk-4BYTEJGW.js +0 -44
- package/dist/chunks/chunk-7XHHVYG7.js +0 -13
- package/dist/chunks/chunk-EHUBJDDB.js +0 -135
- package/dist/loadBandage.js +0 -6
- package/dist/types/bandage/bandage-layout.d.ts +0 -14
- package/dist/types/loadBandage.d.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
stableCoordinate
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5I3K4R2G.js";
|
|
4
4
|
import {
|
|
5
5
|
pathOrigin,
|
|
6
6
|
surveyPaths
|
|
@@ -95,7 +95,12 @@ function convertGFAToGraph(gfaGraph, name = "Imported GFA") {
|
|
|
95
95
|
}
|
|
96
96
|
return id;
|
|
97
97
|
};
|
|
98
|
+
const declared = /* @__PURE__ */ new Set();
|
|
98
99
|
for (const gfaNode of gfaGraph.nodes) {
|
|
100
|
+
if (declared.has(gfaNode.id)) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
declared.add(gfaNode.id);
|
|
99
104
|
const depth = statedDepth(gfaNode) ?? Math.max(traversals.get(gfaNode.id) ?? 1, 1);
|
|
100
105
|
nodes.push(makeNode(gfaNode, canonical.get(gfaNode.id) ?? "+", depth));
|
|
101
106
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-M6LK4GII.js";
|
|
13
13
|
|
|
14
14
|
// src/tubeMap/draw.ts
|
|
15
|
-
import { curvePaths, nodeOutlinePath } from "@jbrowse/tubemap-core";
|
|
15
|
+
import { curvePaths, flattenPath, nodeOutlinePath } from "@jbrowse/tubemap-core";
|
|
16
16
|
function parsePath(d) {
|
|
17
17
|
const tokens = d.trim().split(/[\s,]+/);
|
|
18
18
|
const commands = [];
|
|
@@ -61,7 +61,15 @@ function extentOf(commands) {
|
|
|
61
61
|
}
|
|
62
62
|
function shapeOf(d, color, id, haplotype, reference) {
|
|
63
63
|
const commands = parsePath(d);
|
|
64
|
-
return {
|
|
64
|
+
return {
|
|
65
|
+
commands,
|
|
66
|
+
outline: flattenPath(d, 12),
|
|
67
|
+
color,
|
|
68
|
+
id,
|
|
69
|
+
haplotype,
|
|
70
|
+
reference,
|
|
71
|
+
...extentOf(commands)
|
|
72
|
+
};
|
|
65
73
|
}
|
|
66
74
|
function trackColors(layout, pathColors) {
|
|
67
75
|
return new Map(
|
|
@@ -302,36 +310,6 @@ function drawMismatches(ctx, marks, frame) {
|
|
|
302
310
|
}
|
|
303
311
|
}
|
|
304
312
|
}
|
|
305
|
-
function outline(commands, x, y) {
|
|
306
|
-
const points = [];
|
|
307
|
-
let cx = 0;
|
|
308
|
-
let cy = 0;
|
|
309
|
-
const STEPS = 12;
|
|
310
|
-
for (const c of commands) {
|
|
311
|
-
if (c.op === "C" || c.op === "Q") {
|
|
312
|
-
for (let i = 1; i <= STEPS; i++) {
|
|
313
|
-
const t = i / STEPS;
|
|
314
|
-
const u = 1 - t;
|
|
315
|
-
const [px, py] = c.op === "C" ? [
|
|
316
|
-
u * u * u * cx + 3 * u * u * t * c.x1 + 3 * u * t * t * c.x2 + t * t * t * c.x,
|
|
317
|
-
u * u * u * cy + 3 * u * u * t * c.y1 + 3 * u * t * t * c.y2 + t * t * t * c.y
|
|
318
|
-
] : [
|
|
319
|
-
u * u * cx + 2 * u * t * c.x1 + t * t * c.x,
|
|
320
|
-
u * u * cy + 2 * u * t * c.y1 + t * t * c.y
|
|
321
|
-
];
|
|
322
|
-
points.push([x(px), y(py)]);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
if (c.op !== "Z") {
|
|
326
|
-
cx = "x" in c ? c.x : cx;
|
|
327
|
-
cy = "y" in c ? c.y : cy;
|
|
328
|
-
if (c.op !== "C" && c.op !== "Q") {
|
|
329
|
-
points.push([x(cx), y(cy)]);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return points;
|
|
334
|
-
}
|
|
335
313
|
function inside(points, sx, sy) {
|
|
336
314
|
let hit = false;
|
|
337
315
|
for (let i = 0, j = points.length - 1; i < points.length; j = i++) {
|
|
@@ -353,7 +331,11 @@ function tubeMapTrackAt(picture, { x, y }, sx, sy) {
|
|
|
353
331
|
}
|
|
354
332
|
}
|
|
355
333
|
for (const s of shapes) {
|
|
356
|
-
if (s.reference === reference && x(s.x0) <= sx && sx <= x(s.x1) && inside(
|
|
334
|
+
if (s.reference === reference && x(s.x0) <= sx && sx <= x(s.x1) && inside(
|
|
335
|
+
s.outline.map(([px, py]) => [x(px), y(py)]),
|
|
336
|
+
sx,
|
|
337
|
+
sy
|
|
338
|
+
)) {
|
|
357
339
|
return s.id;
|
|
358
340
|
}
|
|
359
341
|
}
|
|
@@ -2,10 +2,13 @@ import {
|
|
|
2
2
|
alongRow,
|
|
3
3
|
boxesGenes,
|
|
4
4
|
rowPitch
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EFQLEGWM.js";
|
|
6
6
|
import {
|
|
7
7
|
el
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-H2H4Y3TV.js";
|
|
9
|
+
import {
|
|
10
|
+
READOUT_ROOM
|
|
11
|
+
} from "./chunk-54POIBVC.js";
|
|
9
12
|
import {
|
|
10
13
|
pathOrigin
|
|
11
14
|
} from "./chunk-M6LK4GII.js";
|
|
@@ -24,7 +27,6 @@ var PAD_PX = 6;
|
|
|
24
27
|
var WALK_STRIP_CEILING_PX = 260;
|
|
25
28
|
var LABEL_FONT_PX = 11;
|
|
26
29
|
var MIN_ROW_PX = 3;
|
|
27
|
-
var READOUT_ROOM = 1.3;
|
|
28
30
|
var MARK_INK = "#111";
|
|
29
31
|
var TICK_PX = 3;
|
|
30
32
|
function stripMarks(graph, rows, node) {
|
|
@@ -59,7 +61,10 @@ function spansOf(graph, name) {
|
|
|
59
61
|
return byName.get(name);
|
|
60
62
|
}
|
|
61
63
|
const lengthOf = new Map(graph.nodes.map((n) => [n.id, n.length]));
|
|
62
|
-
const
|
|
64
|
+
const origin = pathOrigin(name).name;
|
|
65
|
+
const pieces = (graph.paths ?? []).filter(
|
|
66
|
+
(p) => origin === graph.referencePath ? pathOrigin(p.name).name === origin : p.name === name
|
|
67
|
+
);
|
|
63
68
|
let spans;
|
|
64
69
|
if (pieces.every((p) => p.start !== void 0)) {
|
|
65
70
|
spans = { ids: [], starts: [], ends: [] };
|
|
@@ -3,12 +3,20 @@ import {
|
|
|
3
3
|
} from "./chunk-FX4RDMDN.js";
|
|
4
4
|
import {
|
|
5
5
|
referenceOrder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CM6LO6OC.js";
|
|
7
7
|
import {
|
|
8
8
|
isBackbone
|
|
9
9
|
} from "./chunk-FYQWPEEY.js";
|
|
10
10
|
|
|
11
11
|
// src/bubbles/bubblesFromGraph.ts
|
|
12
|
+
function relax(best, to, cur, add) {
|
|
13
|
+
const prev = best.get(to);
|
|
14
|
+
best.set(to, {
|
|
15
|
+
min: Math.min(prev?.min ?? Infinity, cur.min + add),
|
|
16
|
+
max: Math.max(prev?.max ?? -Infinity, cur.max + add),
|
|
17
|
+
n: Math.min(SATURATED_PATH_COUNT, cur.n + (prev?.n ?? 0))
|
|
18
|
+
});
|
|
19
|
+
}
|
|
12
20
|
function bubblesFromGraph(graph) {
|
|
13
21
|
if (!graph.nodes.some(isBackbone)) {
|
|
14
22
|
return [];
|
|
@@ -61,13 +69,7 @@ function bubblesFromGraph(graph) {
|
|
|
61
69
|
if (ti > i1) {
|
|
62
70
|
continue;
|
|
63
71
|
}
|
|
64
|
-
|
|
65
|
-
const prev = best.get(t);
|
|
66
|
-
best.set(t, {
|
|
67
|
-
min: Math.min(prev?.min ?? Infinity, cur.min + add),
|
|
68
|
-
max: Math.max(prev?.max ?? -Infinity, cur.max + add),
|
|
69
|
-
n: Math.min(SATURATED_PATH_COUNT, cur.n + (prev?.n ?? 0))
|
|
70
|
-
});
|
|
72
|
+
relax(best, t, cur, t === end.id ? 0 : byId.get(t).length);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
const walked = walkIndex && walkRoutes(graph, byId, walkIndex, start.id, end.id);
|
|
@@ -167,6 +169,7 @@ function walkRoutes(graph, byId, walkIndex, startId, endId) {
|
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
export {
|
|
172
|
+
relax,
|
|
170
173
|
bubblesFromGraph,
|
|
171
174
|
walkIndexOf,
|
|
172
175
|
walkRoutes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodedColor,
|
|
3
3
|
resolveEncoding
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VQC7KELB.js";
|
|
5
5
|
import {
|
|
6
6
|
pathOrigin
|
|
7
7
|
} from "./chunk-M6LK4GII.js";
|
|
@@ -28,10 +28,14 @@ function walkHighlight(graph, name) {
|
|
|
28
28
|
const lengthOf = (id) => byId.get(id)?.length ?? 0;
|
|
29
29
|
const bpOf = (path) => path.nodeIds.reduce((sum, id) => sum + lengthOf(id), 0);
|
|
30
30
|
const bp = pieces.reduce((sum, piece) => sum + bpOf(piece), 0);
|
|
31
|
-
const
|
|
31
|
+
const extentOf = (ps) => {
|
|
32
|
+
const start = Math.min(...ps.map((p) => p.start ?? Infinity));
|
|
33
|
+
return Number.isFinite(start) ? { start, end: Math.max(...ps.map((p) => (p.start ?? 0) + bpOf(p))) } : void 0;
|
|
34
|
+
};
|
|
35
|
+
const extent = extentOf(pieces);
|
|
36
|
+
const range = extent && {
|
|
32
37
|
contig: first.contig ?? panSNContig(pathOrigin(name).name),
|
|
33
|
-
|
|
34
|
-
end: Math.max(...pieces.map((p) => (p.start ?? 0) + bpOf(p)))
|
|
38
|
+
...extent
|
|
35
39
|
};
|
|
36
40
|
const span = range ? range.end - range.start : bp;
|
|
37
41
|
const nodeIds = /* @__PURE__ */ new Set();
|
|
@@ -59,7 +63,14 @@ function walkHighlight(graph, name) {
|
|
|
59
63
|
});
|
|
60
64
|
}
|
|
61
65
|
const reference = isReference(graph, name);
|
|
62
|
-
const
|
|
66
|
+
const referenceSpan = () => {
|
|
67
|
+
const referencePieces = reference ? [] : (graph.paths ?? []).filter((p) => isReference(graph, p.name));
|
|
68
|
+
if (referencePieces.length === 0) {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
const e = extentOf(referencePieces);
|
|
72
|
+
return e ? e.end - e.start : referencePieces.reduce((sum, piece) => sum + bpOf(piece), 0);
|
|
73
|
+
};
|
|
63
74
|
return {
|
|
64
75
|
name,
|
|
65
76
|
reference,
|
|
@@ -69,7 +80,7 @@ function walkHighlight(graph, name) {
|
|
|
69
80
|
progress,
|
|
70
81
|
steps: pieces.reduce((sum, piece) => sum + piece.nodeIds.length, 0),
|
|
71
82
|
bp,
|
|
72
|
-
referenceBp:
|
|
83
|
+
referenceBp: referenceSpan()
|
|
73
84
|
};
|
|
74
85
|
}
|
|
75
86
|
function laneColors(graph, walk, encoding, ramp) {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
layoutGeometryInputs
|
|
3
|
+
} from "./chunk-LOCJN3BZ.js";
|
|
4
|
+
import {
|
|
5
|
+
facetLifts,
|
|
6
|
+
walkLift
|
|
7
|
+
} from "./chunk-CU6P5RUG.js";
|
|
8
|
+
import {
|
|
9
|
+
buildGeometry,
|
|
10
|
+
computeReferenceRamp
|
|
11
|
+
} from "./chunk-A4PFFC4Q.js";
|
|
12
|
+
import {
|
|
13
|
+
walkRowsExtent
|
|
14
|
+
} from "./chunk-54POIBVC.js";
|
|
15
|
+
import {
|
|
16
|
+
pathLegend,
|
|
17
|
+
walkLabelsOf
|
|
18
|
+
} from "./chunk-3XSM4OZU.js";
|
|
19
|
+
import {
|
|
20
|
+
FIGURE_DEFAULTS
|
|
21
|
+
} from "./chunk-HNCXR2VS.js";
|
|
22
|
+
import {
|
|
23
|
+
drawingBounds
|
|
24
|
+
} from "./chunk-2QLLQJ72.js";
|
|
25
|
+
import {
|
|
26
|
+
referenceLabel
|
|
27
|
+
} from "./chunk-RAKOB6IV.js";
|
|
28
|
+
import {
|
|
29
|
+
resolveColorScheme
|
|
30
|
+
} from "./chunk-JKJWSY4V.js";
|
|
31
|
+
import {
|
|
32
|
+
deletionDrawing,
|
|
33
|
+
deletionEdges
|
|
34
|
+
} from "./chunk-24WITXQY.js";
|
|
35
|
+
import {
|
|
36
|
+
facetSettingOf
|
|
37
|
+
} from "./chunk-XV4P5KEQ.js";
|
|
38
|
+
|
|
39
|
+
// src/figureScene.ts
|
|
40
|
+
function figureScene(graph, layout, o) {
|
|
41
|
+
const region = o.region;
|
|
42
|
+
const rampDomain = o.colorDomain ?? region;
|
|
43
|
+
const rows = o.walkRows;
|
|
44
|
+
const bounds = drawingBounds(layout, {
|
|
45
|
+
region: o.fitToDrawing ? void 0 : region,
|
|
46
|
+
extent: rows && layout.extent ? walkRowsExtent(rows, o.walkRowPitch) : void 0
|
|
47
|
+
});
|
|
48
|
+
const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
49
|
+
const colorScheme = resolveColorScheme(
|
|
50
|
+
o.colorScheme ?? FIGURE_DEFAULTS.colorScheme,
|
|
51
|
+
graph
|
|
52
|
+
);
|
|
53
|
+
const referenceRamp = colorScheme === "reference-position" && !layout.tubeMap ? computeReferenceRamp(graph, rampDomain) : void 0;
|
|
54
|
+
const drawnDeletions = deletionDrawing(
|
|
55
|
+
graph,
|
|
56
|
+
layout.tubeMap ? [] : deletionEdges(graph),
|
|
57
|
+
o.showDeletionEdges
|
|
58
|
+
);
|
|
59
|
+
const layers = o.walks ?? [];
|
|
60
|
+
const walkRamp = layers.some((l) => l.color?.field === "reference") ? referenceRamp ?? computeReferenceRamp(graph, rampDomain) : void 0;
|
|
61
|
+
const lift = layers.length > 0 && !layout.tubeMap ? walkLift(graph, layers, walkRamp) : void 0;
|
|
62
|
+
const facet = facetSettingOf(o.facet);
|
|
63
|
+
const panels = facet.field && lift && lift.walks.length > 1 ? facetLifts(graph, lift, layers, walkRamp) : void 0;
|
|
64
|
+
const labels = walkLabelsOf(
|
|
65
|
+
graph.paths?.length ? pathLegend(graph.paths) : []
|
|
66
|
+
);
|
|
67
|
+
const referenceName = o.referenceName ?? referenceLabel(graph, region);
|
|
68
|
+
const contigThickness = o.contigThickness ?? FIGURE_DEFAULTS.contigThickness;
|
|
69
|
+
const nodeWidth = o.nodeWidth ?? FIGURE_DEFAULTS.nodeWidth;
|
|
70
|
+
return {
|
|
71
|
+
bounds,
|
|
72
|
+
nodeById,
|
|
73
|
+
colorScheme,
|
|
74
|
+
referenceRamp,
|
|
75
|
+
drawnDeletions,
|
|
76
|
+
layers,
|
|
77
|
+
lift,
|
|
78
|
+
facet,
|
|
79
|
+
panels,
|
|
80
|
+
labelOf: (name) => labels.get(name) ?? name,
|
|
81
|
+
referenceName,
|
|
82
|
+
reference: lift?.referenceDomain && {
|
|
83
|
+
...lift.referenceDomain,
|
|
84
|
+
name: referenceName
|
|
85
|
+
},
|
|
86
|
+
contigThickness,
|
|
87
|
+
nodeWidth,
|
|
88
|
+
geometry: (highlight, axis) => buildGeometry({
|
|
89
|
+
...layoutGeometryInputs(layout, drawnDeletions, { drawsRows: !!rows }),
|
|
90
|
+
graph,
|
|
91
|
+
nodeById,
|
|
92
|
+
colorScheme,
|
|
93
|
+
contigThickness,
|
|
94
|
+
connectorThickness: o.connectorThickness ?? FIGURE_DEFAULTS.connectorThickness,
|
|
95
|
+
drawPaths: false,
|
|
96
|
+
nodeWidth,
|
|
97
|
+
linearLayout: o.linearLayout,
|
|
98
|
+
highlight,
|
|
99
|
+
axis,
|
|
100
|
+
referenceRamp
|
|
101
|
+
})
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
figureScene
|
|
107
|
+
};
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
RAMP_GRADIENT_STOPS,
|
|
4
4
|
rampHueCss,
|
|
5
5
|
rampStops
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XL472HHD.js";
|
|
7
7
|
import {
|
|
8
8
|
el
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-H2H4Y3TV.js";
|
|
10
10
|
import {
|
|
11
11
|
REFERENCE_RAMP_ALT_CSS
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-A4PFFC4Q.js";
|
|
13
13
|
import {
|
|
14
14
|
LABEL_CHAR_PX
|
|
15
15
|
} from "./chunk-AB35TJST.js";
|
|
@@ -164,10 +164,13 @@ function genesFromBed(text) {
|
|
|
164
164
|
}
|
|
165
165
|
return mergeOverlappingByName(rows);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function sniffedFormat(text) {
|
|
168
168
|
const first = text.split("\n", 1e3).find((l) => l.trim() !== "" && !/^(#|track|browser)/.test(l));
|
|
169
169
|
const cols = first?.split(" ") ?? [];
|
|
170
|
-
return /^\d+$/.test(cols[1] ?? "") && /^\d+$/.test(cols[2] ?? "") ?
|
|
170
|
+
return /^\d+$/.test(cols[1] ?? "") && /^\d+$/.test(cols[2] ?? "") ? "bed" : "gff3";
|
|
171
|
+
}
|
|
172
|
+
function genesFromText(text, format = sniffedFormat(text)) {
|
|
173
|
+
return format === "bed" ? genesFromBed(text) : genesFromGff3Lines(text.split(/\r?\n/));
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
export {
|
|
@@ -1,79 +1,63 @@
|
|
|
1
1
|
import {
|
|
2
2
|
svgCanvas
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RUCH6ZFL.js";
|
|
4
4
|
import {
|
|
5
5
|
stripGeneGaps,
|
|
6
6
|
walkStripFrame,
|
|
7
7
|
walkStripLabelsTree
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
Canvas2DRenderer
|
|
11
|
-
} from "./chunk-WBCOREDZ.js";
|
|
8
|
+
} from "./chunk-BAETMD3J.js";
|
|
12
9
|
import {
|
|
13
10
|
walkRowsKey,
|
|
14
11
|
walkRowsKeyTree,
|
|
15
12
|
walkRowsTree
|
|
16
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EFQLEGWM.js";
|
|
14
|
+
import {
|
|
15
|
+
Canvas2DRenderer
|
|
16
|
+
} from "./chunk-QLWI2PZ3.js";
|
|
17
17
|
import {
|
|
18
18
|
EXON_COLOR,
|
|
19
19
|
exonOutlineTree,
|
|
20
20
|
exonStretches
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JSUCGZ6K.js";
|
|
22
22
|
import {
|
|
23
23
|
genePins
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RPRHR56C.js";
|
|
25
25
|
import {
|
|
26
26
|
geneLabelCandidates
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-KC7T5RWG.js";
|
|
28
28
|
import {
|
|
29
29
|
nodesUnderBox
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4HWM3FNK.js";
|
|
31
31
|
import {
|
|
32
|
+
escapeAttr,
|
|
32
33
|
serializeEl
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import {
|
|
35
|
-
layoutGeometryInputs
|
|
36
|
-
} from "./chunk-LOCJN3BZ.js";
|
|
34
|
+
} from "./chunk-H2H4Y3TV.js";
|
|
37
35
|
import {
|
|
38
36
|
version
|
|
39
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-2CHS5LMM.js";
|
|
40
38
|
import {
|
|
41
39
|
axisScaleOf
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import {
|
|
44
|
-
facetLifts,
|
|
45
|
-
walkLift
|
|
46
|
-
} from "./chunk-R456ME6J.js";
|
|
47
|
-
import {
|
|
48
|
-
encodingStops
|
|
49
|
-
} from "./chunk-ALDGONEI.js";
|
|
40
|
+
} from "./chunk-BS4UZ44I.js";
|
|
50
41
|
import {
|
|
51
42
|
rangeText,
|
|
52
43
|
walkKey
|
|
53
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-4ETPXDO6.js";
|
|
54
45
|
import {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} from "./chunk-SBMJNRTV.js";
|
|
46
|
+
figureScene
|
|
47
|
+
} from "./chunk-D5D36ZF6.js";
|
|
58
48
|
import {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} from "./chunk-C7MZJSPT.js";
|
|
49
|
+
encodingStops
|
|
50
|
+
} from "./chunk-VQC7KELB.js";
|
|
62
51
|
import {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} from "./chunk-TWRLC3KK.js";
|
|
52
|
+
walkRowLabels
|
|
53
|
+
} from "./chunk-54POIBVC.js";
|
|
66
54
|
import {
|
|
67
55
|
nodeInk
|
|
68
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-JBCZIBFC.js";
|
|
69
57
|
import {
|
|
70
58
|
FIT_PADDING,
|
|
71
|
-
drawingBounds,
|
|
72
59
|
fitTransform
|
|
73
|
-
} from "./chunk-
|
|
74
|
-
import {
|
|
75
|
-
referenceLabel
|
|
76
|
-
} from "./chunk-RAKOB6IV.js";
|
|
60
|
+
} from "./chunk-2QLLQJ72.js";
|
|
77
61
|
import {
|
|
78
62
|
LABEL_CHAR_PX,
|
|
79
63
|
LABEL_PAD,
|
|
@@ -81,20 +65,12 @@ import {
|
|
|
81
65
|
occupancy,
|
|
82
66
|
placeLabels
|
|
83
67
|
} from "./chunk-AB35TJST.js";
|
|
84
|
-
import {
|
|
85
|
-
resolveColorScheme
|
|
86
|
-
} from "./chunk-JKJWSY4V.js";
|
|
87
|
-
import {
|
|
88
|
-
deletionDrawing,
|
|
89
|
-
deletionEdges
|
|
90
|
-
} from "./chunk-N6FECAXP.js";
|
|
91
68
|
import {
|
|
92
69
|
FACET_GAP_PX,
|
|
93
70
|
FACET_PAD_PX,
|
|
94
71
|
FACET_TITLE_PX,
|
|
95
72
|
facetCells,
|
|
96
|
-
facetGrid
|
|
97
|
-
facetSettingOf
|
|
73
|
+
facetGrid
|
|
98
74
|
} from "./chunk-XV4P5KEQ.js";
|
|
99
75
|
|
|
100
76
|
// src/figure.ts
|
|
@@ -105,9 +81,6 @@ var KEY_GAP_PX = 16;
|
|
|
105
81
|
var STRIP_KEY_PX = 22;
|
|
106
82
|
var FADED = "rgb(160,160,160)";
|
|
107
83
|
var GENE_INK = "#1c1c22";
|
|
108
|
-
function esc(s) {
|
|
109
|
-
return s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
110
|
-
}
|
|
111
84
|
function keySvg(id, x, y, stops, label, after, under, opacity = 1) {
|
|
112
85
|
const bar = stops.length > 1 ? BAR_PX : SWATCH_PX;
|
|
113
86
|
const fill = stops.length > 1 ? `fill="url(#${id})"` : `fill="${stops[0].color}"${opacity < 1 ? ` fill-opacity="${opacity}"` : ""}`;
|
|
@@ -118,7 +91,7 @@ function keySvg(id, x, y, stops, label, after, under, opacity = 1) {
|
|
|
118
91
|
);
|
|
119
92
|
return {
|
|
120
93
|
width,
|
|
121
|
-
markup: `${defs}<g transform="translate(${x} ${y})" ${FONT}><rect y="5" width="${bar}" height="8" rx="2" ${fill}/><text x="${bar + 5}" y="13"><tspan font-weight="bold">${
|
|
94
|
+
markup: `${defs}<g transform="translate(${x} ${y})" ${FONT}><rect y="5" width="${bar}" height="8" rx="2" ${fill}/><text x="${bar + 5}" y="13"><tspan font-weight="bold">${escapeAttr(label)}</tspan>${escapeAttr(after)}</text>${under ? `<text y="28">${escapeAttr(under)}</text>` : ""}</g>`
|
|
122
95
|
};
|
|
123
96
|
}
|
|
124
97
|
function exonKeySvg(x, y) {
|
|
@@ -146,47 +119,32 @@ function screenPath(d, t) {
|
|
|
146
119
|
);
|
|
147
120
|
}
|
|
148
121
|
function chip(x, y, w, name, note) {
|
|
149
|
-
return `<rect x="${x - w / 2}" y="${y - LABEL_PX - LABEL_PAD + 2}" width="${w}" height="${LABEL_PX + LABEL_PAD * 2 - 2}" rx="3" fill="#fff" fill-opacity="0.85" stroke="${EXON_COLOR}"/><text x="${x}" y="${y}" font-family="Helvetica, Arial, sans-serif" font-size="${LABEL_PX}" fill="${GENE_INK}" text-anchor="middle"><tspan font-style="italic" font-weight="600">${
|
|
122
|
+
return `<rect x="${x - w / 2}" y="${y - LABEL_PX - LABEL_PAD + 2}" width="${w}" height="${LABEL_PX + LABEL_PAD * 2 - 2}" rx="3" fill="#fff" fill-opacity="0.85" stroke="${EXON_COLOR}"/><text x="${x}" y="${y}" font-family="Helvetica, Arial, sans-serif" font-size="${LABEL_PX}" fill="${GENE_INK}" text-anchor="middle"><tspan font-style="italic" font-weight="600">${escapeAttr(name)}</tspan>${note ? escapeAttr(note) : ""}</text>`;
|
|
150
123
|
}
|
|
151
124
|
function figureSvg(graph, layout, o = {}) {
|
|
152
125
|
const width = o.width ?? 1200;
|
|
153
126
|
const room = o.height ?? 800;
|
|
154
|
-
const region = o.region;
|
|
155
|
-
const rampDomain = o.colorDomain ?? region;
|
|
156
127
|
const rows = o.walkRows;
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
128
|
+
const {
|
|
129
|
+
bounds,
|
|
130
|
+
nodeById,
|
|
131
|
+
referenceRamp,
|
|
132
|
+
layers,
|
|
133
|
+
lift,
|
|
134
|
+
facet,
|
|
135
|
+
panels,
|
|
136
|
+
labelOf,
|
|
137
|
+
referenceName,
|
|
138
|
+
reference,
|
|
139
|
+
contigThickness,
|
|
140
|
+
nodeWidth,
|
|
141
|
+
geometry
|
|
142
|
+
} = figureScene(graph, layout, o);
|
|
161
143
|
const pixelRows = layout.pixelRows ?? false;
|
|
162
|
-
const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
163
|
-
const colorScheme = resolveColorScheme(o.colorScheme ?? "auto", graph);
|
|
164
|
-
const referenceRamp = colorScheme === "reference-position" && !layout.tubeMap ? computeReferenceRamp(graph, rampDomain) : void 0;
|
|
165
144
|
const rampInterval = referenceRamp && {
|
|
166
145
|
start: referenceRamp.start,
|
|
167
146
|
end: referenceRamp.start + referenceRamp.span
|
|
168
147
|
};
|
|
169
|
-
const drawnDeletions = deletionDrawing(
|
|
170
|
-
graph,
|
|
171
|
-
layout.tubeMap ? [] : deletionEdges(graph),
|
|
172
|
-
o.showDeletionEdges
|
|
173
|
-
);
|
|
174
|
-
const layers = o.walks ?? [];
|
|
175
|
-
const walkRamp = layers.some((l) => l.color?.field === "reference") ? referenceRamp ?? computeReferenceRamp(graph, rampDomain) : void 0;
|
|
176
|
-
const lift = layers.length > 0 && !layout.tubeMap ? walkLift(graph, layers, walkRamp) : void 0;
|
|
177
|
-
const facet = facetSettingOf(o.facet);
|
|
178
|
-
const panels = facet.field && lift && lift.walks.length > 1 ? facetLifts(graph, lift, layers, walkRamp) : void 0;
|
|
179
|
-
const labels = walkLabelsOf(
|
|
180
|
-
graph.paths?.length ? pathLegend(graph.paths) : []
|
|
181
|
-
);
|
|
182
|
-
const labelOf = (name) => labels.get(name) ?? name;
|
|
183
|
-
const referenceName = o.referenceName ?? referenceLabel(graph, region);
|
|
184
|
-
const reference = lift?.referenceDomain && {
|
|
185
|
-
...lift.referenceDomain,
|
|
186
|
-
name: referenceName
|
|
187
|
-
};
|
|
188
|
-
const contigThickness = o.contigThickness ?? 6;
|
|
189
|
-
const nodeWidth = o.nodeWidth ?? "depth";
|
|
190
148
|
const pins = o.genes?.length && !layout.tubeMap && !rows ? genePins(graph, o.genes, layout.nodePositions) : [];
|
|
191
149
|
const ink = nodeInk(graph, nodeById, contigThickness, nodeWidth);
|
|
192
150
|
let masks = 0;
|
|
@@ -239,7 +197,7 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
239
197
|
const sy = y * t.scaleY + t.translateY;
|
|
240
198
|
if (sy >= 0 && sy <= h) {
|
|
241
199
|
out.push(
|
|
242
|
-
`<text x="6" y="${sy + 4}" ${FONT} stroke="#fff" stroke-width="3" paint-order="stroke">${
|
|
200
|
+
`<text x="6" y="${sy + 4}" ${FONT} stroke="#fff" stroke-width="3" paint-order="stroke">${escapeAttr(label)}</text>`
|
|
243
201
|
);
|
|
244
202
|
}
|
|
245
203
|
}
|
|
@@ -264,24 +222,7 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
264
222
|
const axis = axisScaleOf(fit.scale, pixelRows);
|
|
265
223
|
const { canvas, markup } = svgCanvas(w, h);
|
|
266
224
|
const renderer = new Canvas2DRenderer(canvas);
|
|
267
|
-
renderer.uploadGeometry(
|
|
268
|
-
buildGeometry({
|
|
269
|
-
...layoutGeometryInputs(layout, drawnDeletions, {
|
|
270
|
-
drawsRows: !!rows
|
|
271
|
-
}),
|
|
272
|
-
graph,
|
|
273
|
-
nodeById,
|
|
274
|
-
colorScheme,
|
|
275
|
-
contigThickness,
|
|
276
|
-
connectorThickness: o.connectorThickness ?? 2,
|
|
277
|
-
drawPaths: false,
|
|
278
|
-
nodeWidth,
|
|
279
|
-
linearLayout: o.linearLayout,
|
|
280
|
-
highlight,
|
|
281
|
-
axis,
|
|
282
|
-
referenceRamp
|
|
283
|
-
})
|
|
284
|
-
);
|
|
225
|
+
renderer.uploadGeometry(geometry(highlight, axis));
|
|
285
226
|
const t = {
|
|
286
227
|
scaleX: axis.scaleX,
|
|
287
228
|
scaleY: axis.scaleY,
|
|
@@ -420,7 +361,7 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
420
361
|
generator: `@jbrowse/bandage-core@${version}`,
|
|
421
362
|
...o.spec === void 0 ? {} : { spec: o.spec }
|
|
422
363
|
});
|
|
423
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}"><metadata>${
|
|
364
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}"><metadata>${escapeAttr(metadata)}</metadata><rect width="${width}" height="${height}" fill="#fff"/>${parts.join("")}</svg>
|
|
424
365
|
`;
|
|
425
366
|
}
|
|
426
367
|
|