@jbrowse/bandage-core 10.2.2 → 10.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +6 -7
  2. package/dist/bubbles/bubbleHalos.js +7 -3
  3. package/dist/bubbles/bubblesFromGraph.js +4 -2
  4. package/dist/bubbles/classifyBubble.js +10 -5
  5. package/dist/bubbles/superbubbles.js +10 -6
  6. package/dist/chunks/{chunk-N6FECAXP.js → chunk-24WITXQY.js} +17 -8
  7. package/dist/chunks/{chunk-XTCNEKO5.js → chunk-2QLLQJ72.js} +15 -13
  8. package/dist/chunks/{chunk-ASSNZXCF.js → chunk-3AOGOCCQ.js} +44 -103
  9. package/dist/chunks/{chunk-TWRLC3KK.js → chunk-3XSM4OZU.js} +1 -1
  10. package/dist/chunks/{chunk-WEDZ76AK.js → chunk-4DRQTBBE.js} +1 -1
  11. package/dist/chunks/{chunk-2LQ5BWT7.js → chunk-4ETPXDO6.js} +1 -1
  12. package/dist/chunks/{chunk-FP4H7SFT.js → chunk-4HWM3FNK.js} +2 -2
  13. package/dist/chunks/{chunk-C7MZJSPT.js → chunk-54POIBVC.js} +2 -8
  14. package/dist/chunks/{chunk-PKFMP65V.js → chunk-5GMFEPWR.js} +1 -1
  15. package/dist/chunks/{chunk-CDLPYR5O.js → chunk-5I3K4R2G.js} +7 -6
  16. package/dist/chunks/{chunk-TICYLD5F.js → chunk-7CC7N3XC.js} +35 -78
  17. package/dist/chunks/{chunk-2CVHXFK7.js → chunk-7SRWJLSC.js} +19 -22
  18. package/dist/chunks/{chunk-SBMJNRTV.js → chunk-A4PFFC4Q.js} +37 -27
  19. package/dist/chunks/{chunk-IW6CYVX2.js → chunk-AR4BUBMU.js} +6 -1
  20. package/dist/chunks/{chunk-IUDJKOLB.js → chunk-B6IW3IRE.js} +15 -33
  21. package/dist/chunks/{chunk-JUIJI7RC.js → chunk-BAETMD3J.js} +9 -4
  22. package/dist/chunks/{chunk-L5WF4ZPS.js → chunk-BS4UZ44I.js} +1 -1
  23. package/dist/chunks/{chunk-HNQPEMYE.js → chunk-CM6LO6OC.js} +0 -1
  24. package/dist/chunks/{chunk-CLOP7UVD.js → chunk-CQHUZHET.js} +11 -8
  25. package/dist/chunks/{chunk-R456ME6J.js → chunk-CU6P5RUG.js} +17 -6
  26. package/dist/chunks/chunk-D5D36ZF6.js +107 -0
  27. package/dist/chunks/{chunk-AFP3NWSL.js → chunk-DY3JCAMX.js} +1 -1
  28. package/dist/chunks/{chunk-NRV7R36Q.js → chunk-EFQLEGWM.js} +3 -3
  29. package/dist/chunks/{chunk-BXEPA4KS.js → chunk-G6UIYQZR.js} +5 -2
  30. package/dist/chunks/{chunk-NNODIW4U.js → chunk-H2H4Y3TV.js} +1 -0
  31. package/dist/chunks/{chunk-MVFDSFV2.js → chunk-HNCXR2VS.js} +1 -1
  32. package/dist/chunks/{chunk-EYK7DJZV.js → chunk-J5FWKGOY.js} +1 -1
  33. package/dist/chunks/{chunk-PBENCR5L.js → chunk-JBCZIBFC.js} +0 -2
  34. package/dist/chunks/{chunk-EHUBJDDB.js → chunk-JFY5PWQC.js} +5 -3
  35. package/dist/chunks/{chunk-5BGP5Z64.js → chunk-JLSJMCDJ.js} +1 -1
  36. package/dist/chunks/{chunk-DT2GGH4D.js → chunk-JMABOQWL.js} +2 -6
  37. package/dist/chunks/{chunk-3S3YVOJ7.js → chunk-JSUCGZ6K.js} +1 -1
  38. package/dist/chunks/{chunk-MLSWIMZO.js → chunk-KBEP7VYK.js} +2 -2
  39. package/dist/chunks/{chunk-TAMCZHLW.js → chunk-N73TI3VG.js} +2 -2
  40. package/dist/chunks/chunk-O4EGE27I.js +10 -0
  41. package/dist/chunks/{chunk-3ZZSX5HN.js → chunk-PTABFYQ7.js} +10 -6
  42. package/dist/chunks/{chunk-WBCOREDZ.js → chunk-QLWI2PZ3.js} +16 -7
  43. package/dist/chunks/chunk-RBCE2OQH.js +32 -0
  44. package/dist/chunks/{chunk-BUBZ32IC.js → chunk-RPRHR56C.js} +4 -8
  45. package/dist/chunks/{chunk-47DYCZOK.js → chunk-RUCH6ZFL.js} +4 -0
  46. package/dist/chunks/{chunk-GNTTI6LA.js → chunk-T2PCSAFY.js} +1 -1
  47. package/dist/chunks/{chunk-XKWD2RY3.js → chunk-URZ3CH2R.js} +3 -10
  48. package/dist/chunks/{chunk-ALDGONEI.js → chunk-VQC7KELB.js} +1 -1
  49. package/dist/chunks/{chunk-FLFBYSJO.js → chunk-VQWHMWLF.js} +5 -1
  50. package/dist/chunks/{chunk-4R6QNG23.js → chunk-WL6ZKUVC.js} +3 -3
  51. package/dist/chunks/{chunk-CRTD2SBP.js → chunk-WZNPX7Q6.js} +6 -2
  52. package/dist/chunks/{chunk-FNGIQF43.js → chunk-XA5A27CS.js} +6 -14
  53. package/dist/chunks/{chunk-DK5P2YOL.js → chunk-XI3ZUTWF.js} +2 -2
  54. package/dist/chunks/{chunk-ZIUKZUPJ.js → chunk-XL472HHD.js} +1 -1
  55. package/dist/chunks/{chunk-BPRXQ2SS.js → chunk-XMW266WS.js} +1 -1
  56. package/dist/chunks/{chunk-DRG4236Y.js → chunk-YN6FDIBT.js} +2 -2
  57. package/dist/chunks/{chunk-WFB5TXRA.js → chunk-ZY2AFL4Y.js} +13 -31
  58. package/dist/cli/decodeText.js +6 -0
  59. package/dist/cli/figure.js +59 -60
  60. package/dist/cli/fold.js +13 -13
  61. package/dist/deletionEdges.js +6 -4
  62. package/dist/el.js +3 -1
  63. package/dist/figure.js +33 -31
  64. package/dist/figureData.js +32 -27
  65. package/dist/figureScene.js +43 -0
  66. package/dist/figureSettings.js +8 -8
  67. package/dist/foldVariants.js +2 -2
  68. package/dist/gbzCut.js +1 -1
  69. package/dist/genes/exonOutline.js +2 -2
  70. package/dist/genes/geneFiles.js +1 -1
  71. package/dist/genes/genePins.js +3 -3
  72. package/dist/gfa/gfaConverter.js +2 -2
  73. package/dist/gfa-core/gfaParser.js +1 -1
  74. package/dist/gfa-core/index.js +1 -1
  75. package/dist/graphLabels.js +4 -4
  76. package/dist/index.js +72 -73
  77. package/dist/labelLayout.js +8 -8
  78. package/dist/layout/forceCache.js +8 -8
  79. package/dist/layout/mergeRuns.js +2 -2
  80. package/dist/layout/orderedLayout.js +1 -3
  81. package/dist/layout/tubeMapLayout.js +6 -6
  82. package/dist/layout/walkRowDraw.js +11 -11
  83. package/dist/layout/walkRowLayout.js +3 -1
  84. package/dist/layout/walkStrip.js +14 -12
  85. package/dist/layoutEngines.js +1 -2
  86. package/dist/layoutModes.js +9 -9
  87. package/dist/nodeWidths.js +1 -3
  88. package/dist/pathColors.js +5 -5
  89. package/dist/pipeline.js +7 -7
  90. package/dist/referenceRampCss.js +9 -9
  91. package/dist/referenceStrip.js +9 -9
  92. package/dist/renderer/Canvas2DRenderer.js +2 -2
  93. package/dist/renderer/GeometryBuilder.js +8 -8
  94. package/dist/renderer/canvas.js +1 -1
  95. package/dist/renderer/svgCanvas.js +1 -1
  96. package/dist/tubeMap/axis.js +5 -5
  97. package/dist/tubeMap/bundle.js +7 -7
  98. package/dist/tubeMap/coarsen.js +6 -6
  99. package/dist/tubeMap/deviations.js +5 -5
  100. package/dist/tubeMap/draw.js +1 -1
  101. package/dist/tubeMap/genes.js +6 -6
  102. package/dist/tubeMap/nodeColors.js +9 -9
  103. package/dist/types/bubbles/bubblesFromGraph.d.ts +1 -0
  104. package/dist/types/bubbles/classifyBubble.d.ts +0 -1
  105. package/dist/types/cli/decodeText.d.ts +1 -0
  106. package/dist/types/cli/figure.d.ts +4 -15
  107. package/dist/types/deletionEdges.d.ts +3 -5
  108. package/dist/types/el.d.ts +1 -0
  109. package/dist/types/figureData.d.ts +7 -26
  110. package/dist/types/figureScene.d.ts +31 -0
  111. package/dist/types/genes/geneFiles.d.ts +2 -1
  112. package/dist/types/index.d.ts +1 -1
  113. package/dist/types/layout/deletionRoutes.d.ts +1 -1
  114. package/dist/types/layout/orderedLayout.d.ts +0 -6
  115. package/dist/types/layout/walkRowLayout.d.ts +1 -0
  116. package/dist/types/nodeWidths.d.ts +0 -1
  117. package/dist/types/renderer/Canvas2DRenderer.d.ts +1 -0
  118. package/dist/types/renderer/canvas.d.ts +2 -2
  119. package/dist/types/tubeMap/draw.d.ts +1 -0
  120. package/dist/types/util/geometry.d.ts +3 -3
  121. package/dist/types/version.d.ts +1 -1
  122. package/dist/util/SpatialIndex.js +4 -4
  123. package/dist/util/edgeCurves.js +3 -3
  124. package/dist/util/geometry.js +3 -3
  125. package/dist/util/hitDetection.js +5 -5
  126. package/dist/version.js +1 -1
  127. package/dist/viewport.js +8 -8
  128. package/dist/walkEncoding.js +9 -9
  129. package/dist/walkHighlight.js +10 -10
  130. package/dist/walkKey.js +5 -5
  131. package/package.json +3 -6
  132. package/dist/chunks/bandage-layout-3AR6BCUD.js +0 -4694
  133. package/dist/chunks/chunk-4BYTEJGW.js +0 -44
  134. package/dist/chunks/chunk-7XHHVYG7.js +0 -13
  135. package/dist/loadBandage.js +0 -6
  136. package/dist/types/bandage/bandage-layout.d.ts +0 -14
  137. package/dist/types/loadBandage.d.ts +0 -3
package/README.md CHANGED
@@ -10,8 +10,10 @@ npm install @jbrowse/bandage-core
10
10
 
11
11
  - GFA and rGFA text in (`loadGraph`), or the same graph as typed arrays a worker
12
12
  can transfer (`GraphTables`)
13
- - Layouts: Bandage's FMMM engine as WASM (`loadBandage`, `forceLayout`),
14
- ordered, anchored, sample rows, walk rows, tube map
13
+ - Layouts: Bandage's FMMM engine as WASM from
14
+ [@jbrowse/graph-fmmm-layout](https://github.com/GMOD/graph-fmmm-layout)
15
+ (`loadBandage`, `forceLayout`), ordered, anchored, sample rows, walk rows,
16
+ tube map
15
17
  - A Canvas2D renderer (`buildGeometry`, `Canvas2DRenderer`), hit testing and
16
18
  label placement
17
19
  - Bubbles, deletion edges, path colors, gbz-base windows cut to GFA
@@ -42,13 +44,10 @@ the worked example.
42
44
  pnpm install
43
45
  pnpm test # unit tests
44
46
  pnpm build # dist/ with declarations
45
- pnpm test:wasm # the committed layout engine still loads
46
47
  ```
47
48
 
48
- The Bandage layout engine is OGDF's FMMM compiled to WASM and committed at
49
- `src/bandage/bandage-layout.js`; [src/bandage/README.md](src/bandage/README.md)
50
- says how to rebuild it from `src/bandage/native` and the vendored `vendor/ogdf`.
51
- A weekly workflow proves the committed artifact still reproduces.
49
+ The FMMM engine and its wasm build live in
50
+ [graph-fmmm-layout](https://github.com/GMOD/graph-fmmm-layout).
52
51
 
53
52
  CI also packs the core and runs
54
53
  [BandageJS](https://github.com/cmdcolin/BandageJS) and
@@ -3,10 +3,14 @@ import {
3
3
  WHOLE_FRACTION,
4
4
  bubbleHalos,
5
5
  coversGraph
6
- } from "../chunks/chunk-EHUBJDDB.js";
7
- import "../chunks/chunk-XKWD2RY3.js";
6
+ } from "../chunks/chunk-JFY5PWQC.js";
7
+ import "../chunks/chunk-URZ3CH2R.js";
8
8
  import "../chunks/chunk-FX4RDMDN.js";
9
- import "../chunks/chunk-2CVHXFK7.js";
9
+ import "../chunks/chunk-PTABFYQ7.js";
10
+ import "../chunks/chunk-AB35TJST.js";
11
+ import "../chunks/chunk-N73TI3VG.js";
12
+ import "../chunks/chunk-24WITXQY.js";
13
+ import "../chunks/chunk-7SRWJLSC.js";
10
14
  import "../chunks/chunk-CPMHA4W5.js";
11
15
  import "../chunks/chunk-FYQWPEEY.js";
12
16
  export {
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  bubblesFromGraph,
3
+ relax,
3
4
  walkIndexOf,
4
5
  walkRoutes
5
- } from "../chunks/chunk-CLOP7UVD.js";
6
+ } from "../chunks/chunk-CQHUZHET.js";
6
7
  import "../chunks/chunk-FX4RDMDN.js";
7
- import "../chunks/chunk-HNQPEMYE.js";
8
+ import "../chunks/chunk-CM6LO6OC.js";
8
9
  import "../chunks/chunk-CPMHA4W5.js";
9
10
  import "../chunks/chunk-FYQWPEEY.js";
10
11
  export {
11
12
  bubblesFromGraph,
13
+ relax,
12
14
  walkIndexOf,
13
15
  walkRoutes
14
16
  };
@@ -2,14 +2,19 @@ import {
2
2
  BUBBLE_KIND_COLORS,
3
3
  BUBBLE_KIND_NAMES,
4
4
  bubbleSegmentIds,
5
- classifyBubble,
6
- formatBp
7
- } from "../chunks/chunk-XKWD2RY3.js";
5
+ classifyBubble
6
+ } from "../chunks/chunk-URZ3CH2R.js";
8
7
  import "../chunks/chunk-FX4RDMDN.js";
8
+ import "../chunks/chunk-PTABFYQ7.js";
9
+ import "../chunks/chunk-AB35TJST.js";
10
+ import "../chunks/chunk-N73TI3VG.js";
11
+ import "../chunks/chunk-24WITXQY.js";
12
+ import "../chunks/chunk-7SRWJLSC.js";
13
+ import "../chunks/chunk-CPMHA4W5.js";
14
+ import "../chunks/chunk-FYQWPEEY.js";
9
15
  export {
10
16
  BUBBLE_KIND_COLORS,
11
17
  BUBBLE_KIND_NAMES,
12
18
  bubbleSegmentIds,
13
- classifyBubble,
14
- formatBp
19
+ classifyBubble
15
20
  };
@@ -1,17 +1,21 @@
1
1
  import {
2
2
  graphBubbles,
3
3
  superbubblesFromGraph
4
- } from "../chunks/chunk-FNGIQF43.js";
5
- import "../chunks/chunk-CLOP7UVD.js";
4
+ } from "../chunks/chunk-XA5A27CS.js";
5
+ import "../chunks/chunk-CQHUZHET.js";
6
6
  import "../chunks/chunk-T6V4KI2L.js";
7
- import "../chunks/chunk-EHUBJDDB.js";
8
- import "../chunks/chunk-XKWD2RY3.js";
7
+ import "../chunks/chunk-JFY5PWQC.js";
8
+ import "../chunks/chunk-URZ3CH2R.js";
9
9
  import "../chunks/chunk-FX4RDMDN.js";
10
- import "../chunks/chunk-HNQPEMYE.js";
10
+ import "../chunks/chunk-CM6LO6OC.js";
11
11
  import "../chunks/chunk-M6LK4GII.js";
12
12
  import "../chunks/chunk-RAEABQNW.js";
13
13
  import "../chunks/chunk-BPLIXMH7.js";
14
- import "../chunks/chunk-2CVHXFK7.js";
14
+ import "../chunks/chunk-PTABFYQ7.js";
15
+ import "../chunks/chunk-AB35TJST.js";
16
+ import "../chunks/chunk-N73TI3VG.js";
17
+ import "../chunks/chunk-24WITXQY.js";
18
+ import "../chunks/chunk-7SRWJLSC.js";
15
19
  import "../chunks/chunk-CPMHA4W5.js";
16
20
  import "../chunks/chunk-FYQWPEEY.js";
17
21
  export {
@@ -3,7 +3,7 @@ import {
3
3
  edgeJoinOf,
4
4
  routedEdgeCurves,
5
5
  strandSides
6
- } from "./chunk-2CVHXFK7.js";
6
+ } from "./chunk-7SRWJLSC.js";
7
7
  import {
8
8
  firstNodeAtOrAfter,
9
9
  isBackbone
@@ -15,8 +15,18 @@ function bypassedPoints(nodePositions, bypassed) {
15
15
  return bypassed.flatMap((id) => nodePositions[id] ?? []);
16
16
  }
17
17
  function deletionArcCurves(nodePositions, deletion, axis, route, stranded = false) {
18
- const from = nodePositions[deletion.from];
19
- const to = nodePositions[deletion.to];
18
+ return edgeCurvesOf(
19
+ nodePositions,
20
+ deletion,
21
+ axis,
22
+ deletion.bypassed,
23
+ route,
24
+ stranded
25
+ );
26
+ }
27
+ function edgeCurvesOf(nodePositions, edge, axis, bypassed, route, stranded) {
28
+ const from = nodePositions[edge.from];
29
+ const to = nodePositions[edge.to];
20
30
  if (!from?.length || !to?.length) {
21
31
  return void 0;
22
32
  }
@@ -24,15 +34,13 @@ function deletionArcCurves(nodePositions, deletion, axis, route, stranded = fals
24
34
  from,
25
35
  to,
26
36
  route,
27
- stranded ? strandSides(deletion) : void 0
37
+ stranded ? strandSides(edge) : void 0
28
38
  ) : computeEdgeCurves(
29
39
  from,
30
40
  to,
31
- edgeJoinOf(deletion, stranded),
32
- 0,
33
- 0,
41
+ edgeJoinOf(edge, stranded),
34
42
  axis,
35
- bypassedPoints(nodePositions, deletion.bypassed)
43
+ bypassed ? bypassedPoints(nodePositions, bypassed) : []
36
44
  );
37
45
  }
38
46
  function backboneBySequence(graph) {
@@ -161,6 +169,7 @@ function deletionDrawing(graph, deletions, show = true) {
161
169
  export {
162
170
  bypassedPoints,
163
171
  deletionArcCurves,
172
+ edgeCurvesOf,
164
173
  deletionEdges,
165
174
  closableDeletions,
166
175
  deletionDrawing
@@ -1,3 +1,6 @@
1
+ import {
2
+ orientToReference
3
+ } from "./chunk-PUG7LXDF.js";
1
4
  import {
2
5
  seededNodes
3
6
  } from "./chunk-IGVV37VI.js";
@@ -9,18 +12,15 @@ import {
9
12
  takeRoutes,
10
13
  withDeletionRoutes
11
14
  } from "./chunk-VPE4AYP7.js";
12
- import {
13
- orientToReference
14
- } from "./chunk-PUG7LXDF.js";
15
15
  import {
16
16
  convertGFAToGraph
17
- } from "./chunk-IW6CYVX2.js";
17
+ } from "./chunk-AR4BUBMU.js";
18
+ import {
19
+ parseGFA
20
+ } from "./chunk-5I3K4R2G.js";
18
21
  import {
19
22
  graphFromTables
20
23
  } from "./chunk-PSMKPSO4.js";
21
- import {
22
- parseGFA
23
- } from "./chunk-CDLPYR5O.js";
24
24
  import {
25
25
  anchorGraph
26
26
  } from "./chunk-M6LK4GII.js";
@@ -30,7 +30,7 @@ import {
30
30
  import {
31
31
  mergeRuns,
32
32
  splitRuns
33
- } from "./chunk-TAMCZHLW.js";
33
+ } from "./chunk-N73TI3VG.js";
34
34
  import {
35
35
  spreadFor
36
36
  } from "./chunk-UVBGRJQX.js";
@@ -40,9 +40,9 @@ import {
40
40
  layoutScaling
41
41
  } from "./chunk-6JEWNXCQ.js";
42
42
  import {
43
- closableDeletions,
43
+ deletionDrawing,
44
44
  deletionEdges
45
- } from "./chunk-N6FECAXP.js";
45
+ } from "./chunk-24WITXQY.js";
46
46
  import {
47
47
  isBackbone
48
48
  } from "./chunk-FYQWPEEY.js";
@@ -118,9 +118,11 @@ function engineKey(graph, settings) {
118
118
  }
119
119
  async function forceLayout(graph, settings, engine) {
120
120
  const spread = spreadFor(settings.bubbleSpread);
121
- const found = deletionEdges(graph);
122
- const dropped = settings.showDeletionEdges === false ? closableDeletions(graph, found) : /* @__PURE__ */ new Set();
123
- const deletions = found.filter((d) => !dropped.has(d.edgeIndex));
121
+ const { shown: deletions, hidden: dropped } = deletionDrawing(
122
+ graph,
123
+ deletionEdges(graph),
124
+ settings.showDeletionEdges !== false
125
+ );
124
126
  const routed = withDeletionRoutes(graph, deletions, dropped);
125
127
  const merged = mergeRuns(routed.graph, routed.ids);
126
128
  const runs = {
@@ -1,79 +1,63 @@
1
1
  import {
2
2
  svgCanvas
3
- } from "./chunk-47DYCZOK.js";
3
+ } from "./chunk-RUCH6ZFL.js";
4
4
  import {
5
5
  stripGeneGaps,
6
6
  walkStripFrame,
7
7
  walkStripLabelsTree
8
- } from "./chunk-JUIJI7RC.js";
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-NRV7R36Q.js";
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-3S3YVOJ7.js";
21
+ } from "./chunk-JSUCGZ6K.js";
22
22
  import {
23
23
  genePins
24
- } from "./chunk-BUBZ32IC.js";
24
+ } from "./chunk-RPRHR56C.js";
25
25
  import {
26
26
  geneLabelCandidates
27
- } from "./chunk-DRG4236Y.js";
27
+ } from "./chunk-YN6FDIBT.js";
28
28
  import {
29
29
  nodesUnderBox
30
- } from "./chunk-FP4H7SFT.js";
30
+ } from "./chunk-4HWM3FNK.js";
31
31
  import {
32
+ escapeAttr,
32
33
  serializeEl
33
- } from "./chunk-NNODIW4U.js";
34
- import {
35
- layoutGeometryInputs
36
- } from "./chunk-LOCJN3BZ.js";
34
+ } from "./chunk-H2H4Y3TV.js";
37
35
  import {
38
36
  version
39
- } from "./chunk-EYK7DJZV.js";
37
+ } from "./chunk-J5FWKGOY.js";
40
38
  import {
41
39
  axisScaleOf
42
- } from "./chunk-L5WF4ZPS.js";
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-2LQ5BWT7.js";
44
+ } from "./chunk-4ETPXDO6.js";
54
45
  import {
55
- buildGeometry,
56
- computeReferenceRamp
57
- } from "./chunk-SBMJNRTV.js";
46
+ figureScene
47
+ } from "./chunk-D5D36ZF6.js";
58
48
  import {
59
- walkRowLabels,
60
- walkRowsExtent
61
- } from "./chunk-C7MZJSPT.js";
49
+ encodingStops
50
+ } from "./chunk-VQC7KELB.js";
62
51
  import {
63
- pathLegend,
64
- walkLabelsOf
65
- } from "./chunk-TWRLC3KK.js";
52
+ walkRowLabels
53
+ } from "./chunk-54POIBVC.js";
66
54
  import {
67
55
  nodeInk
68
- } from "./chunk-PBENCR5L.js";
56
+ } from "./chunk-JBCZIBFC.js";
69
57
  import {
70
58
  FIT_PADDING,
71
- drawingBounds,
72
59
  fitTransform
73
- } from "./chunk-XTCNEKO5.js";
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("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
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">${esc(label)}</tspan>${esc(after)}</text>${under ? `<text y="28">${esc(under)}</text>` : ""}</g>`
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">${esc(name)}</tspan>${note ? esc(note) : ""}</text>`;
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 bounds = drawingBounds(layout, {
158
- region: o.fitToDrawing ? void 0 : region,
159
- extent: rows && layout.extent ? walkRowsExtent(rows, o.walkRowPitch) : void 0
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">${esc(label)}</text>`
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>${esc(metadata)}</metadata><rect width="${width}" height="${height}" fill="#fff"/>${parts.join("")}</svg>
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
 
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-BPLIXMH7.js";
7
7
  import {
8
8
  groupDigits
9
- } from "./chunk-3ZZSX5HN.js";
9
+ } from "./chunk-PTABFYQ7.js";
10
10
 
11
11
  // src/pathColors.ts
12
12
  function nameHue(name) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tubeSpan
3
- } from "./chunk-BPRXQ2SS.js";
3
+ } from "./chunk-XMW266WS.js";
4
4
 
5
5
  // src/tubeMap/genes.ts
6
6
  function tubeMapGenes(byRefName, genes) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  formatBp,
3
3
  groupDigits
4
- } from "./chunk-3ZZSX5HN.js";
4
+ } from "./chunk-PTABFYQ7.js";
5
5
 
6
6
  // src/walkKey.ts
7
7
  function rangeText(contig, start, end) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  EdgeSpatialIndex,
3
3
  SpatialIndex
4
- } from "./chunk-MLSWIMZO.js";
4
+ } from "./chunk-KBEP7VYK.js";
5
5
  import {
6
6
  pathRibbonOffsets,
7
7
  translateCurves,
8
8
  yToXOf
9
- } from "./chunk-2CVHXFK7.js";
9
+ } from "./chunk-7SRWJLSC.js";
10
10
 
11
11
  // src/util/hitDetection.ts
12
12
  function distanceToSegment(px, py, x1, y1, x2, y2) {
@@ -47,16 +47,9 @@ function walkRowLayout(graph, region) {
47
47
  const nodePositions = backbonePositions(
48
48
  overWindow.length > 0 ? overWindow : backbone
49
49
  );
50
- const rowLabels = [
51
- { label: walks.reference.label, y: 0 },
52
- ...walks.rows.map((row, i) => ({
53
- label: row.label,
54
- y: (i + 1) * ROW_HEIGHT_PX
55
- }))
56
- ];
57
50
  return {
58
51
  nodePositions,
59
- rowLabels,
52
+ rowLabels: walkRowLabels(walks),
60
53
  referenceAxis: true,
61
54
  pixelRows: true,
62
55
  extent: walkRowsExtent(walks)
@@ -64,6 +57,7 @@ function walkRowLayout(graph, region) {
64
57
  }
65
58
 
66
59
  export {
60
+ READOUT_ROOM,
67
61
  walkRowsExtent,
68
62
  walkRowLabels,
69
63
  walkRowLayout
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pathSteps
3
- } from "./chunk-DK5P2YOL.js";
3
+ } from "./chunk-XI3ZUTWF.js";
4
4
  import {
5
5
  pathOrigin
6
6
  } from "./chunk-M6LK4GII.js";
@@ -57,10 +57,11 @@ function parseGFA(file) {
57
57
  };
58
58
  for (const rawLine of file.split("\n")) {
59
59
  const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
60
- if (line.startsWith("H")) {
60
+ const type = line.split(" ", 1)[0];
61
+ if (type === "H") {
61
62
  const [, ...rest] = line.split(" ");
62
63
  graph.header.push(parseTags(rest));
63
- } else if (line.startsWith("S")) {
64
+ } else if (type === "S") {
64
65
  const [, name, ...rest] = line.split(" ");
65
66
  let len;
66
67
  let seq;
@@ -82,7 +83,7 @@ function parseGFA(file) {
82
83
  len = +tags.LN;
83
84
  }
84
85
  graph.nodes.push({ id: name, length: len, sequence: seq, tags });
85
- } else if (line.startsWith("E")) {
86
+ } else if (type === "E") {
86
87
  const [, , source, target, , , , , cigar, ...rest] = line.split(" ");
87
88
  if (source && target) {
88
89
  graph.links.push({
@@ -94,7 +95,7 @@ function parseGFA(file) {
94
95
  tags: parseTags(rest)
95
96
  });
96
97
  }
97
- } else if (line.startsWith("L")) {
98
+ } else if (type === "L") {
98
99
  const [, source, strand1, target, strand2, cigar, ...rest] = line.split(" ");
99
100
  if (source && target && strand2) {
100
101
  graph.links.push({
@@ -106,7 +107,7 @@ function parseGFA(file) {
106
107
  tags: parseTags(rest)
107
108
  });
108
109
  }
109
- } else if (line.startsWith("W")) {
110
+ } else if (type === "W") {
110
111
  const [, sample, hap, contig, start, end, body, ...rest] = line.split(" ");
111
112
  if (sample && hap && contig && start && end && body) {
112
113
  graph.walks.push({
@@ -119,7 +120,7 @@ function parseGFA(file) {
119
120
  tags: parseTags(rest)
120
121
  });
121
122
  }
122
- } else if (line.startsWith("P")) {
123
+ } else if (type === "P") {
123
124
  const [, name, path, ...rest] = line.split(" ");
124
125
  if (name && path) {
125
126
  graph.paths.push({ name, path, rest });