@jbrowse/bandage-core 10.2.6 → 10.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/alleleProjection/projectAlleles.js +8 -4
  2. package/dist/anchoredNodes.js +2 -1
  3. package/dist/bubbleSpreads.js +2 -2
  4. package/dist/bubbles/bubbleHalos.js +10 -11
  5. package/dist/bubbles/bubblesFromGraph.js +8 -3
  6. package/dist/bubbles/classifyBubble.js +9 -6
  7. package/dist/bubbles/popBubble.js +7 -5
  8. package/dist/bubbles/superbubbles.js +18 -14
  9. package/dist/chunks/{chunk-RAKOB6IV.js → chunk-234NFZS4.js} +8 -6
  10. package/dist/chunks/{chunk-A4PFFC4Q.js → chunk-2XEQR54X.js} +60 -102
  11. package/dist/chunks/{chunk-6JEWNXCQ.js → chunk-34BOZKIE.js} +0 -2
  12. package/dist/chunks/{chunk-RVS2QCOX.js → chunk-3GLG3ZLE.js} +2 -11
  13. package/dist/chunks/{chunk-PUG7LXDF.js → chunk-3PZSBNLI.js} +4 -1
  14. package/dist/chunks/{chunk-KBEP7VYK.js → chunk-3VCKBSML.js} +4 -4
  15. package/dist/chunks/{chunk-BPLIXMH7.js → chunk-4XWZNPQ2.js} +14 -0
  16. package/dist/chunks/{chunk-LKW2TP4N.js → chunk-5YILQTHE.js} +18 -16
  17. package/dist/chunks/{chunk-B6IW3IRE.js → chunk-65ILXEIN.js} +14 -15
  18. package/dist/chunks/{chunk-4DRQTBBE.js → chunk-6EOB6ANX.js} +1 -1
  19. package/dist/chunks/{chunk-XBHMXTOR.js → chunk-7JGLJK44.js} +41 -36
  20. package/dist/chunks/{chunk-T2PCSAFY.js → chunk-7XR26JST.js} +2 -2
  21. package/dist/chunks/{chunk-URZ3CH2R.js → chunk-A4JDEUAI.js} +1 -1
  22. package/dist/chunks/{chunk-JLSJMCDJ.js → chunk-A54O52XZ.js} +3 -3
  23. package/dist/chunks/chunk-A55OZVYX.js +327 -0
  24. package/dist/chunks/{chunk-CWFNEKST.js → chunk-A7H753BA.js} +3 -3
  25. package/dist/chunks/{chunk-FB5RKZQY.js → chunk-AMX4OQAW.js} +18 -27
  26. package/dist/chunks/{chunk-RPRHR56C.js → chunk-BS6HPYCZ.js} +3 -3
  27. package/dist/chunks/chunk-BSOZW3FC.js +30 -0
  28. package/dist/chunks/{chunk-CU6P5RUG.js → chunk-BVYR7IFN.js} +22 -16
  29. package/dist/chunks/{chunk-XXT2JCAC.js → chunk-BX4AUMZE.js} +11 -13
  30. package/dist/chunks/{chunk-N73TI3VG.js → chunk-BZFOFC4D.js} +6 -9
  31. package/dist/chunks/{chunk-4ETPXDO6.js → chunk-CGFPFBT2.js} +1 -1
  32. package/dist/chunks/{chunk-24WITXQY.js → chunk-CGMSKIEO.js} +9 -25
  33. package/dist/chunks/{chunk-IGVV37VI.js → chunk-CKUVEHSS.js} +3 -3
  34. package/dist/chunks/{chunk-JBCZIBFC.js → chunk-CRCD3ODN.js} +0 -1
  35. package/dist/chunks/{chunk-PSMKPSO4.js → chunk-DBLV7PGG.js} +33 -27
  36. package/dist/chunks/{chunk-JA2HJIYS.js → chunk-E4ZM4OOJ.js} +3 -5
  37. package/dist/chunks/{chunk-ABUIN5AK.js → chunk-EHXBZ5JZ.js} +29 -24
  38. package/dist/chunks/{chunk-QLWI2PZ3.js → chunk-EJRJAAN7.js} +24 -21
  39. package/dist/chunks/{chunk-Q7LYHGGQ.js → chunk-GIHTHYXY.js} +5 -4
  40. package/dist/chunks/{chunk-L3O7AWLI.js → chunk-GJLZ2MKE.js} +2 -2
  41. package/dist/chunks/{chunk-LOEA5IHZ.js → chunk-GJU6BJJA.js} +8 -8
  42. package/dist/chunks/{chunk-XL472HHD.js → chunk-GQZVR5DW.js} +12 -7
  43. package/dist/chunks/{chunk-UVBGRJQX.js → chunk-HKYXWZQS.js} +1 -1
  44. package/dist/chunks/chunk-HMXCN6PG.js +17 -0
  45. package/dist/chunks/{chunk-WSIFAZU7.js → chunk-HNWJ4B7S.js} +12 -13
  46. package/dist/chunks/chunk-HOAIOEI7.js +18 -0
  47. package/dist/chunks/{chunk-XMW266WS.js → chunk-HSVFCA2J.js} +18 -20
  48. package/dist/chunks/{chunk-3XSM4OZU.js → chunk-IYALCKNB.js} +5 -5
  49. package/dist/chunks/{chunk-2QLLQJ72.js → chunk-KWHWNOTY.js} +22 -17
  50. package/dist/chunks/{chunk-M6LK4GII.js → chunk-LGJBB5BP.js} +8 -9
  51. package/dist/chunks/{chunk-VQWHMWLF.js → chunk-M5NPD55W.js} +18 -14
  52. package/dist/chunks/{chunk-TKIJ5535.js → chunk-MD5VPXXT.js} +6 -6
  53. package/dist/chunks/{chunk-HK5Y2YWV.js → chunk-MYDHU2UV.js} +6 -11
  54. package/dist/chunks/{chunk-TZFWUT2C.js → chunk-MYLAJDKB.js} +2 -2
  55. package/dist/chunks/{chunk-4HWM3FNK.js → chunk-OMUPUB4J.js} +39 -56
  56. package/dist/chunks/{chunk-PTABFYQ7.js → chunk-PFRQBCGC.js} +49 -60
  57. package/dist/chunks/{chunk-T6V4KI2L.js → chunk-PPDE4IVT.js} +1 -1
  58. package/dist/chunks/{chunk-KC7T5RWG.js → chunk-PSCSZSVK.js} +9 -16
  59. package/dist/chunks/{chunk-YYMW5XOF.js → chunk-PTQPTDZH.js} +1 -1
  60. package/dist/chunks/{chunk-L2HDM2R3.js → chunk-QQCOVMMT.js} +7 -7
  61. package/dist/chunks/{chunk-CQHUZHET.js → chunk-RFG42VIO.js} +46 -30
  62. package/dist/chunks/{chunk-FYQWPEEY.js → chunk-RJWPJCIB.js} +5 -11
  63. package/dist/chunks/{chunk-AR4BUBMU.js → chunk-RWKP7UO4.js} +34 -35
  64. package/dist/chunks/{chunk-WBSWROE6.js → chunk-SHKGYGM4.js} +14 -18
  65. package/dist/chunks/{chunk-2CMYNW3E.js → chunk-SI3BB4DO.js} +1 -1
  66. package/dist/chunks/{chunk-DY3JCAMX.js → chunk-SOMZGDVS.js} +7 -16
  67. package/dist/chunks/{chunk-EFQLEGWM.js → chunk-SZHQK6GL.js} +7 -8
  68. package/dist/chunks/{chunk-5GMFEPWR.js → chunk-TCOLHD7N.js} +16 -28
  69. package/dist/chunks/{chunk-XV4P5KEQ.js → chunk-TGUFT6KK.js} +6 -3
  70. package/dist/chunks/{chunk-CM6LO6OC.js → chunk-UAFATXYA.js} +10 -14
  71. package/dist/chunks/{chunk-7SRWJLSC.js → chunk-UBQSRCWR.js} +11 -8
  72. package/dist/chunks/{chunk-RUCH6ZFL.js → chunk-V4YML3GR.js} +2 -1
  73. package/dist/chunks/{chunk-VQC7KELB.js → chunk-V7J6U4XC.js} +11 -3
  74. package/dist/chunks/{chunk-ES2N6V56.js → chunk-VX656OAZ.js} +6 -11
  75. package/dist/chunks/chunk-WA5WNP6V.js +37 -0
  76. package/dist/chunks/{chunk-WZNPX7Q6.js → chunk-WJ4TIAVA.js} +1 -1
  77. package/dist/chunks/{chunk-BS4UZ44I.js → chunk-WONB6LMC.js} +1 -1
  78. package/dist/chunks/{chunk-HFVGGB3U.js → chunk-XUT4HXVE.js} +29 -13
  79. package/dist/chunks/{chunk-G45YY72K.js → chunk-Z6XZWPXK.js} +17 -25
  80. package/dist/chunks/{chunk-XI3ZUTWF.js → chunk-ZNJ4JAPT.js} +14 -20
  81. package/dist/chunks/{chunk-HNCXR2VS.js → chunk-ZPBEUOBM.js} +3 -1
  82. package/dist/chunks/{chunk-RAEABQNW.js → chunk-ZPZ7GNBT.js} +1 -0
  83. package/dist/cli/figure.js +59 -56
  84. package/dist/cli/fold.js +19 -17
  85. package/dist/deletionEdges.js +5 -7
  86. package/dist/facetGrid.js +2 -1
  87. package/dist/figure.js +45 -42
  88. package/dist/figureData.js +48 -44
  89. package/dist/figureScene.js +34 -29
  90. package/dist/figureSettings.js +19 -17
  91. package/dist/foldVariants.js +5 -3
  92. package/dist/gbzCut.js +12 -7
  93. package/dist/gbzJoin.js +2 -1
  94. package/dist/gbzWindow.js +11 -6
  95. package/dist/genes/genePins.js +6 -4
  96. package/dist/gfa/gfaConverter.js +7 -5
  97. package/dist/gfa/gfaTables.js +2 -1
  98. package/dist/gfa/graphTables.js +3 -3
  99. package/dist/graphLabels.js +8 -5
  100. package/dist/index.js +88 -85
  101. package/dist/labelLayout.js +12 -9
  102. package/dist/layout/anchoredLayout.js +8 -5
  103. package/dist/layout/drawnScale.js +1 -5
  104. package/dist/layout/forceCache.js +19 -17
  105. package/dist/layout/mergeRuns.js +5 -3
  106. package/dist/layout/orderedLayout.js +5 -2
  107. package/dist/layout/orientToReference.js +3 -2
  108. package/dist/layout/placeOffReference.js +7 -4
  109. package/dist/layout/referenceSeeds.js +6 -4
  110. package/dist/layout/sampleRowLayout.js +8 -5
  111. package/dist/layout/trimToWindow.js +6 -4
  112. package/dist/layout/tubeMapLayout.js +17 -19
  113. package/dist/layout/walkRowDraw.js +18 -17
  114. package/dist/layout/walkRowLayout.js +10 -6
  115. package/dist/layout/walkRows.js +9 -5
  116. package/dist/layout/walkStrip.js +21 -18
  117. package/dist/layoutModes.js +23 -20
  118. package/dist/nodeWidths.js +1 -3
  119. package/dist/pansn.js +5 -1
  120. package/dist/pathAnchoring.js +6 -4
  121. package/dist/pathColors.js +12 -9
  122. package/dist/pathVisits.js +3 -1
  123. package/dist/pipeline.js +18 -16
  124. package/dist/reference.js +5 -3
  125. package/dist/referenceRampCss.js +9 -17
  126. package/dist/referenceSpan.js +4 -2
  127. package/dist/referenceStrip.js +18 -14
  128. package/dist/renderer/Canvas2DRenderer.js +1 -1
  129. package/dist/renderer/GeometryBuilder.js +19 -14
  130. package/dist/renderer/svgCanvas.js +1 -1
  131. package/dist/tubeMap/axis.js +11 -6
  132. package/dist/tubeMap/bundle.js +16 -12
  133. package/dist/tubeMap/coarsen.js +20 -345
  134. package/dist/tubeMap/deviations.js +53 -23
  135. package/dist/tubeMap/draw.js +11 -8
  136. package/dist/tubeMap/frame.js +3 -2
  137. package/dist/tubeMap/genes.js +10 -7
  138. package/dist/tubeMap/mismatches.js +1 -1
  139. package/dist/tubeMap/nodeColors.js +18 -14
  140. package/dist/tubeMap/reads.js +1 -1
  141. package/dist/tubeMap/warp.js +2 -1
  142. package/dist/types/alleleProjection/projectAlleles.d.ts +1 -4
  143. package/dist/types/bubbles/bubbleHalos.d.ts +0 -2
  144. package/dist/types/bubbles/bubblesFromGraph.d.ts +6 -4
  145. package/dist/types/bubbles/classifyBubble.d.ts +2 -1
  146. package/dist/types/deletionEdges.d.ts +0 -8
  147. package/dist/types/figureScene.d.ts +17 -7
  148. package/dist/types/figureSettings.d.ts +2 -0
  149. package/dist/types/gbzCut.d.ts +4 -0
  150. package/dist/types/gbzWindow.d.ts +1 -0
  151. package/dist/types/gfa/graphTables.d.ts +3 -1
  152. package/dist/types/gfa-core/gfaParser.d.ts +1 -1
  153. package/dist/types/graphLabels.d.ts +2 -1
  154. package/dist/types/layout/drawnScale.d.ts +0 -2
  155. package/dist/types/layout/referenceSeeds.d.ts +2 -1
  156. package/dist/types/layout/tubeMapLayout.d.ts +0 -7
  157. package/dist/types/layout/walkRowDraw.d.ts +0 -1
  158. package/dist/types/layout/walkRowLayout.d.ts +1 -0
  159. package/dist/types/layout/walkRows.d.ts +1 -0
  160. package/dist/types/nodeWidths.d.ts +0 -1
  161. package/dist/types/pansn.d.ts +9 -0
  162. package/dist/types/pathVisits.d.ts +6 -0
  163. package/dist/types/referenceRampCss.d.ts +4 -0
  164. package/dist/types/renderer/Canvas2DRenderer.d.ts +1 -0
  165. package/dist/types/renderer/GeometryBuilder.d.ts +3 -2
  166. package/dist/types/tubeMap/axis.d.ts +3 -1
  167. package/dist/types/tubeMap/coarsen.d.ts +3 -1
  168. package/dist/types/tubeMap/deviations.d.ts +2 -1
  169. package/dist/types/tubeMap/mismatches.d.ts +0 -1
  170. package/dist/types/tubeMap/warp.d.ts +2 -1
  171. package/dist/types/util/SpatialIndex.d.ts +1 -1
  172. package/dist/types/util/geometry.d.ts +4 -0
  173. package/dist/types/util/groups.d.ts +3 -0
  174. package/dist/types/util/hitDetection.d.ts +2 -2
  175. package/dist/types/util/partitionPoint.d.ts +1 -0
  176. package/dist/types/util/weakMemo.d.ts +1 -0
  177. package/dist/types/version.d.ts +1 -1
  178. package/dist/util/SpatialIndex.js +8 -5
  179. package/dist/util/edgeCurves.js +7 -4
  180. package/dist/util/geometry.js +3 -1
  181. package/dist/util/groups.js +10 -0
  182. package/dist/util/hitDetection.js +9 -6
  183. package/dist/util/partitionPoint.js +6 -0
  184. package/dist/util/weakMemo.js +6 -0
  185. package/dist/version.js +1 -1
  186. package/dist/viewport.js +19 -17
  187. package/dist/walkEncoding.js +18 -14
  188. package/dist/walkHighlight.js +19 -15
  189. package/dist/walkKey.js +9 -6
  190. package/package.json +2 -2
  191. package/dist/chunks/chunk-ZY2AFL4Y.js +0 -43
@@ -1,24 +1,28 @@
1
1
  import {
2
2
  bubblesFromGraph,
3
+ derivedBubble,
3
4
  relax,
4
5
  walkIndexOf,
5
6
  walkRoutes
6
- } from "./chunk-CQHUZHET.js";
7
+ } from "./chunk-RFG42VIO.js";
7
8
  import {
8
9
  bubbleSubgraph
9
- } from "./chunk-T6V4KI2L.js";
10
+ } from "./chunk-PPDE4IVT.js";
10
11
  import {
11
12
  coversGraph
12
- } from "./chunk-JA2HJIYS.js";
13
+ } from "./chunk-E4ZM4OOJ.js";
13
14
  import {
14
15
  bubbleSegmentIds
15
- } from "./chunk-URZ3CH2R.js";
16
+ } from "./chunk-A4JDEUAI.js";
16
17
  import {
17
18
  strandSides
18
- } from "./chunk-7SRWJLSC.js";
19
+ } from "./chunk-UBQSRCWR.js";
20
+ import {
21
+ pushTo
22
+ } from "./chunk-BSOZW3FC.js";
19
23
  import {
20
24
  isBackbone
21
- } from "./chunk-FYQWPEEY.js";
25
+ } from "./chunk-RJWPJCIB.js";
22
26
 
23
27
  // src/bubbles/superbubbles.ts
24
28
  function slotGraph(graph, index) {
@@ -207,8 +211,7 @@ function superbubblesFromGraph(graph, span) {
207
211
  const holders = /* @__PURE__ */ new Map();
208
212
  members.forEach((vs, i) => {
209
213
  for (const v of vs) {
210
- ;
211
- (holders.get(v) ?? holders.set(v, []).get(v)).push(i);
214
+ pushTo(holders, v, i);
212
215
  }
213
216
  });
214
217
  const nested = (f, i) => holders.get(f.inside[0] >> 1).some(
@@ -226,24 +229,26 @@ function superbubblesFromGraph(graph, span) {
226
229
  return outermost.map((f) => {
227
230
  const source = nodes[f.source >> 1];
228
231
  const sink = nodes[f.sink >> 1];
229
- const walked = walkIndex && walkRoutes(graph, byId, walkIndex, source.id, sink.id);
230
- const crossed = walked?.n ? walked : void 0;
231
- const routes = crossed ?? routesThrough(nodes, offset, next, f);
232
+ const walked = walkRoutes(
233
+ graph,
234
+ byId,
235
+ walkIndex,
236
+ source.id,
237
+ sink.id,
238
+ () => routesThrough(nodes, offset, next, f)
239
+ );
232
240
  const placedOn = onReference(source, sink);
233
241
  return {
234
- refName: placedOn ? source.stable.refName : span.refName,
235
- start: placedOn ? source.stable.start + source.length : span.start,
236
- end: placedOn ? sink.stable.start : span.end,
237
- segmentCount: f.inside.length + 2,
238
- pathCount: routes.n,
239
- inversion: false,
240
- shortestAlleleLength: routes.min,
241
- longestAlleleLength: routes.max,
242
- segments: nodesOf(f).map((v) => nodes[v].name).join(","),
243
- shortestAllele: void 0,
244
- longestAllele: void 0,
245
- partial: walked !== void 0 && walked.left > 0,
246
- routes: crossed?.routes,
242
+ ...derivedBubble(
243
+ {
244
+ refName: placedOn ? source.stable.refName : span.refName,
245
+ start: placedOn ? source.stable.start + source.length : span.start,
246
+ end: placedOn ? sink.stable.start : span.end
247
+ },
248
+ nodesOf(f).map((v) => nodes[v]),
249
+ walked,
250
+ walked.walksLeave
251
+ ),
247
252
  key: `${source.name}>${sink.name}`,
248
253
  ...placedOn ? {} : { offReference: true }
249
254
  };
@@ -46,18 +46,22 @@ var Canvas2DRenderer = class {
46
46
  this.highlightFactor = factor;
47
47
  }
48
48
  updateTransform(transform) {
49
+ this.transform = transform;
50
+ }
51
+ fitted() {
52
+ const t = this.transform;
49
53
  const k = this.fit;
50
- this.transform = k === 1 ? transform : {
51
- ...transform,
52
- scaleX: transform.scaleX * k,
53
- scaleY: transform.scaleY * k,
54
- translateX: transform.translateX * k,
55
- translateY: transform.translateY * k,
56
- dpr: transform.dpr * k
54
+ return !t || k === 1 ? t : {
55
+ ...t,
56
+ scaleX: t.scaleX * k,
57
+ scaleY: t.scaleY * k,
58
+ translateX: t.translateX * k,
59
+ translateY: t.translateY * k,
60
+ dpr: t.dpr * k
57
61
  };
58
62
  }
59
63
  render(clearColor) {
60
- const t = this.transform;
64
+ const t = this.fitted();
61
65
  if (!t) {
62
66
  return;
63
67
  }
@@ -84,7 +88,7 @@ var Canvas2DRenderer = class {
84
88
  weight: e.thickness,
85
89
  last: inRun(edgeRun, i)
86
90
  }))) {
87
- this.strokeCurves(items, color);
91
+ this.strokeCurves(items, color, t);
88
92
  }
89
93
  const lifted = this.liftedStrokes(batch);
90
94
  for (const { color, items } of groupByPaint(batch.nodeStrokes, (s, i) => {
@@ -95,7 +99,7 @@ var Canvas2DRenderer = class {
95
99
  last: f !== void 0
96
100
  };
97
101
  })) {
98
- this.strokeNodes(items, color);
102
+ this.strokeNodes(items, color, t);
99
103
  }
100
104
  const arrowRun = this.edgeRun(batch.arrowRuns);
101
105
  for (const { color, items } of groupByPaint(batch.arrows, (a, i) => ({
@@ -103,7 +107,7 @@ var Canvas2DRenderer = class {
103
107
  weight: 0,
104
108
  last: inRun(arrowRun, i)
105
109
  }))) {
106
- this.fillArrows(items, color);
110
+ this.fillArrows(items, color, t);
107
111
  }
108
112
  }
109
113
  // Only what the highlights lift, over a transparent clear, for a hover layer
@@ -113,7 +117,8 @@ var Canvas2DRenderer = class {
113
117
  const ctx = this.ctx;
114
118
  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
115
119
  const batch = this.batch;
116
- if (!this.transform || !batch) {
120
+ const t = this.fitted();
121
+ if (!t || !batch) {
117
122
  return;
118
123
  }
119
124
  ctx.lineCap = "round";
@@ -125,7 +130,7 @@ var Canvas2DRenderer = class {
125
130
  weight: e.thickness,
126
131
  last: false
127
132
  }))) {
128
- this.strokeCurves(items, color);
133
+ this.strokeCurves(items, color, t);
129
134
  }
130
135
  const lifted = [...this.liftedStrokes(batch)];
131
136
  for (const { color, items } of groupByPaint(lifted, ([i, f]) => ({
@@ -135,7 +140,8 @@ var Canvas2DRenderer = class {
135
140
  }))) {
136
141
  this.strokeNodes(
137
142
  items.map(([i]) => batch.nodeStrokes[i]),
138
- color
143
+ color,
144
+ t
139
145
  );
140
146
  }
141
147
  const arrows = runItems(batch.arrows, this.edgeRun(batch.arrowRuns));
@@ -144,7 +150,7 @@ var Canvas2DRenderer = class {
144
150
  weight: 0,
145
151
  last: false
146
152
  }))) {
147
- this.fillArrows(items, color);
153
+ this.fillArrows(items, color, t);
148
154
  }
149
155
  }
150
156
  edgeRun(runs) {
@@ -163,8 +169,7 @@ var Canvas2DRenderer = class {
163
169
  }
164
170
  return lifted;
165
171
  }
166
- strokeCurves(items, color) {
167
- const t = this.transform;
172
+ strokeCurves(items, color, t) {
168
173
  const ctx = this.ctx;
169
174
  ctx.strokeStyle = abgrToCssRgba(color);
170
175
  ctx.lineWidth = items[0].thickness * 2 * t.dpr;
@@ -188,8 +193,7 @@ var Canvas2DRenderer = class {
188
193
  }
189
194
  ctx.stroke();
190
195
  }
191
- strokeNodes(items, color) {
192
- const t = this.transform;
196
+ strokeNodes(items, color, t) {
193
197
  const ctx = this.ctx;
194
198
  ctx.strokeStyle = abgrToCssRgba(color);
195
199
  ctx.lineWidth = items[0].thickness * 2 * t.dpr;
@@ -204,8 +208,7 @@ var Canvas2DRenderer = class {
204
208
  }
205
209
  ctx.stroke();
206
210
  }
207
- fillArrows(items, color) {
208
- const t = this.transform;
211
+ fillArrows(items, color, t) {
209
212
  const ctx = this.ctx;
210
213
  ctx.fillStyle = abgrToCssRgba(color);
211
214
  ctx.beginPath();
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  joinCuts
3
- } from "./chunk-WSIFAZU7.js";
3
+ } from "./chunk-HNWJ4B7S.js";
4
4
  import {
5
5
  wellKnownSample
6
- } from "./chunk-RAKOB6IV.js";
6
+ } from "./chunk-234NFZS4.js";
7
7
  import {
8
8
  gfaTables
9
- } from "./chunk-G45YY72K.js";
9
+ } from "./chunk-Z6XZWPXK.js";
10
10
  import {
11
11
  panSNMatchesPrefix,
12
12
  panSNSample
13
- } from "./chunk-BPLIXMH7.js";
13
+ } from "./chunk-4XWZNPQ2.js";
14
14
 
15
15
  // src/gbzWindow.ts
16
16
  import { isReverse, nodeId } from "@gmod/gbz-base";
@@ -210,6 +210,7 @@ export {
210
210
  haplotypePrefix,
211
211
  haplotypeWanted,
212
212
  referenceSamplesOf,
213
+ aliasedSample,
213
214
  resolveReferenceSample,
214
215
  referencePathQuery,
215
216
  nodeLimitError,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  placeOffReference
3
- } from "./chunk-TZFWUT2C.js";
3
+ } from "./chunk-MYLAJDKB.js";
4
4
  import {
5
5
  ROW_HEIGHT_PX
6
6
  } from "./chunk-CPMHA4W5.js";
@@ -8,7 +8,7 @@ import {
8
8
  backboneNodes,
9
9
  backbonePositions,
10
10
  referenceSpan
11
- } from "./chunk-FYQWPEEY.js";
11
+ } from "./chunk-RJWPJCIB.js";
12
12
 
13
13
  // src/layout/anchoredLayout.ts
14
14
  function rankRows(graph) {
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  placeOffReference
3
- } from "./chunk-TZFWUT2C.js";
4
- import {
5
- parsePanSN
6
- } from "./chunk-RVS2QCOX.js";
3
+ } from "./chunk-MYLAJDKB.js";
7
4
  import {
8
5
  ROW_HEIGHT_PX
9
6
  } from "./chunk-CPMHA4W5.js";
@@ -12,14 +9,17 @@ import {
12
9
  backbonePositions,
13
10
  isOffReference,
14
11
  referenceSpan
15
- } from "./chunk-FYQWPEEY.js";
12
+ } from "./chunk-RJWPJCIB.js";
13
+ import {
14
+ panSNSample
15
+ } from "./chunk-4XWZNPQ2.js";
16
16
 
17
17
  // src/layout/sampleRowLayout.ts
18
18
  function contributingSamples(graph, keep) {
19
19
  const carried = /* @__PURE__ */ new Map();
20
20
  for (const node of graph.nodes) {
21
21
  if (isOffReference(node)) {
22
- const { sample } = parsePanSN(node.stable.refName);
22
+ const sample = panSNSample(node.stable.refName);
23
23
  carried.set(sample, (carried.get(sample) ?? 0) + node.length);
24
24
  }
25
25
  }
@@ -43,12 +43,12 @@ function sampleRowLayout(graph, region, keep = []) {
43
43
  span,
44
44
  rowY: (node) => {
45
45
  const stable = node.stable;
46
- const row = stable ? rowOf.get(parsePanSN(stable.refName).sample) : void 0;
46
+ const row = stable ? rowOf.get(panSNSample(stable.refName)) : void 0;
47
47
  return (row ?? spareRow) * ROW_HEIGHT_PX;
48
48
  },
49
49
  positions: nodePositions
50
50
  });
51
- const referenceSample = parsePanSN(backbone[0].stable.refName).sample;
51
+ const referenceSample = panSNSample(backbone[0].stable.refName);
52
52
  const rowLabels = [
53
53
  { label: referenceSample, y: 0 },
54
54
  ...samples.map((sample) => ({
@@ -1,15 +1,16 @@
1
- import {
2
- REFERENCE_RAMP_MAX_HUE
3
- } from "./chunk-A4PFFC4Q.js";
4
-
5
1
  // src/referenceRampCss.ts
2
+ var REFERENCE_RAMP_MAX_HUE = 300;
3
+ var REFERENCE_RAMP_SATURATION = 0.7;
4
+ var REFERENCE_RAMP_LIGHTNESS = 0.5;
6
5
  function rampHueCss(hue) {
7
- return `hsl(${hue}, 70%, 50%)`;
6
+ return `hsl(${hue}, ${REFERENCE_RAMP_SATURATION * 100}%, ${REFERENCE_RAMP_LIGHTNESS * 100}%)`;
8
7
  }
9
- function rampHue(bp, domain) {
10
- const frac = (bp - domain.start) / (domain.end - domain.start);
8
+ function rampHueAt(frac) {
11
9
  return Math.max(0, Math.min(1, frac)) * REFERENCE_RAMP_MAX_HUE;
12
10
  }
11
+ function rampHue(bp, domain) {
12
+ return rampHueAt((bp - domain.start) / (domain.end - domain.start));
13
+ }
13
14
  var HUE_STOP_DEG = 30;
14
15
  function rampStops({ start, bp, reversed }, domain) {
15
16
  const low = rampHue(start, domain);
@@ -32,7 +33,11 @@ var RAMP_GRADIENT_CSS = `linear-gradient(to right, ${RAMP_GRADIENT_STOPS.map(
32
33
  ).join(", ")})`;
33
34
 
34
35
  export {
36
+ REFERENCE_RAMP_MAX_HUE,
37
+ REFERENCE_RAMP_SATURATION,
38
+ REFERENCE_RAMP_LIGHTNESS,
35
39
  rampHueCss,
40
+ rampHueAt,
36
41
  rampHue,
37
42
  rampStops,
38
43
  RAMP_GRADIENT_STOPS,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MEAN_NODE_LENGTH,
3
3
  PROPORTIONAL_LENGTH
4
- } from "./chunk-6JEWNXCQ.js";
4
+ } from "./chunk-34BOZKIE.js";
5
5
 
6
6
  // src/bubbleSpreads.ts
7
7
  var BUBBLE_SPREADS = [
@@ -0,0 +1,17 @@
1
+ // src/util/weakMemo.ts
2
+ function weakMemo() {
3
+ const cache = /* @__PURE__ */ new WeakMap();
4
+ return (key, deps, compute) => {
5
+ const hit = cache.get(key);
6
+ if (hit?.deps.length === deps.length && hit.deps.every((d, i) => Object.is(d, deps[i]))) {
7
+ return hit.value;
8
+ }
9
+ const value = compute();
10
+ cache.set(key, { deps, value });
11
+ return value;
12
+ };
13
+ }
14
+
15
+ export {
16
+ weakMemo
17
+ };
@@ -1,3 +1,7 @@
1
+ import {
2
+ groupBy
3
+ } from "./chunk-BSOZW3FC.js";
4
+
1
5
  // src/gbzJoin.ts
2
6
  var UNKNOWN_SAMPLE = "unknown";
3
7
  function parseWalk(line) {
@@ -18,7 +22,7 @@ function segmentLengths(lines) {
18
22
  const ln = tags.find((tag) => tag.startsWith("LN:i:"));
19
23
  lengths.set(
20
24
  id,
21
- sequence === "*" && ln ? +ln.slice("LN:i:".length) : sequence.length
25
+ sequence !== "*" ? sequence.length : ln ? +ln.slice("LN:i:".length) : 0
22
26
  );
23
27
  }
24
28
  }
@@ -94,18 +98,13 @@ function joinCuts(gfas, startsPath) {
94
98
  }
95
99
  return walks2;
96
100
  });
97
- const byName = /* @__PURE__ */ new Map();
98
- for (const walk of [
99
- ...walksByCut.flatMap((walks2) => walks2.slice(0, 1)),
100
- ...walksByCut.flatMap((walks2) => walks2.slice(1))
101
- ]) {
102
- const pieces = byName.get(walk.name);
103
- if (pieces) {
104
- pieces.push(walk);
105
- } else {
106
- byName.set(walk.name, [walk]);
107
- }
108
- }
101
+ const byName = groupBy(
102
+ [
103
+ ...walksByCut.flatMap((walks2) => walks2.slice(0, 1)),
104
+ ...walksByCut.flatMap((walks2) => walks2.slice(1))
105
+ ],
106
+ (walk) => walk.name
107
+ );
109
108
  const walks = [...byName.values()].flatMap(
110
109
  (pieces) => joinPieces(pieces, lengths, startsPath)
111
110
  );
@@ -0,0 +1,18 @@
1
+ // src/util/partitionPoint.ts
2
+ function partitionPoint(n, pred) {
3
+ let lo = 0;
4
+ let hi = n;
5
+ while (lo < hi) {
6
+ const mid = lo + hi >> 1;
7
+ if (pred(mid)) {
8
+ lo = mid + 1;
9
+ } else {
10
+ hi = mid;
11
+ }
12
+ }
13
+ return lo;
14
+ }
15
+
16
+ export {
17
+ partitionPoint
18
+ };
@@ -1,9 +1,15 @@
1
1
  import {
2
2
  formatBp
3
- } from "./chunk-PTABFYQ7.js";
3
+ } from "./chunk-PFRQBCGC.js";
4
+ import {
5
+ pushTo
6
+ } from "./chunk-BSOZW3FC.js";
4
7
  import {
5
8
  isBackbone
6
- } from "./chunk-FYQWPEEY.js";
9
+ } from "./chunk-RJWPJCIB.js";
10
+ import {
11
+ partitionPoint
12
+ } from "./chunk-HOAIOEI7.js";
7
13
 
8
14
  // src/tubeMap/axis.ts
9
15
  function referenceBoxes({
@@ -16,8 +22,7 @@ function referenceBoxes({
16
22
  const graphNode = nodeById.get(node.name);
17
23
  if (node.order >= 0 && graphNode && isBackbone(graphNode)) {
18
24
  const { refName, start } = graphNode.stable;
19
- const boxes = byRefName.get(refName) ?? byRefName.set(refName, []).get(refName);
20
- boxes.push({
25
+ pushTo(byRefName, refName, {
21
26
  name: node.name,
22
27
  index,
23
28
  bp0: start,
@@ -33,23 +38,15 @@ function referenceBoxes({
33
38
  return byRefName;
34
39
  }
35
40
  function tubeX(boxes, bp, isEnd = false) {
36
- let lo = 0;
37
- let hi = boxes.length - 1;
38
- while (lo < hi) {
39
- const mid = lo + hi >> 1;
40
- const bp1 = boxes[mid].bp1;
41
- if (isEnd ? bp1 < bp : bp1 <= bp) {
42
- lo = mid + 1;
43
- } else {
44
- hi = mid;
45
- }
46
- }
47
- const box = boxes[lo];
48
- if (bp <= box.bp0) {
49
- return box.x0;
50
- }
41
+ const i = partitionPoint(
42
+ boxes.length - 1,
43
+ (j) => isEnd ? boxes[j].bp1 < bp : boxes[j].bp1 <= bp
44
+ );
45
+ return boxX(boxes[i], bp);
46
+ }
47
+ function boxX(box, bp) {
51
48
  const span = box.bp1 - box.bp0;
52
- return span > 0 ? box.x0 + (Math.min(bp, box.bp1) - box.bp0) / span * (box.x1 - box.x0) : box.x0;
49
+ return bp <= box.bp0 || span <= 0 ? box.x0 : box.x0 + (Math.min(bp, box.bp1) - box.bp0) / span * (box.x1 - box.x0);
53
50
  }
54
51
  function tubeSpan(boxes, start, end) {
55
52
  const a = tubeX(boxes, start);
@@ -199,6 +196,7 @@ function drawTubeMapRuler(ctx, boxes, frame, top, referenceAxis = false) {
199
196
  export {
200
197
  referenceBoxes,
201
198
  tubeX,
199
+ boxX,
202
200
  tubeSpan,
203
201
  rulerBoxes,
204
202
  rulerInk,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  pathOrigin
3
- } from "./chunk-M6LK4GII.js";
4
- import {
5
- isGenericSample
6
- } from "./chunk-BPLIXMH7.js";
3
+ } from "./chunk-LGJBB5BP.js";
7
4
  import {
8
5
  groupDigits
9
- } from "./chunk-PTABFYQ7.js";
6
+ } from "./chunk-PFRQBCGC.js";
7
+ import {
8
+ isGenericSample
9
+ } from "./chunk-4XWZNPQ2.js";
10
10
 
11
11
  // src/pathColors.ts
12
12
  function nameHue(name) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  orientToReference
3
- } from "./chunk-PUG7LXDF.js";
3
+ } from "./chunk-3PZSBNLI.js";
4
4
  import {
5
5
  seededNodes
6
- } from "./chunk-IGVV37VI.js";
6
+ } from "./chunk-CKUVEHSS.js";
7
7
  import {
8
8
  smoothChain
9
9
  } from "./chunk-OPPVSPEF.js";
@@ -14,38 +14,38 @@ import {
14
14
  } from "./chunk-VPE4AYP7.js";
15
15
  import {
16
16
  convertGFAToGraph
17
- } from "./chunk-AR4BUBMU.js";
17
+ } from "./chunk-RWKP7UO4.js";
18
18
  import {
19
19
  parseGFA
20
20
  } from "./chunk-5I3K4R2G.js";
21
21
  import {
22
22
  graphFromTables
23
- } from "./chunk-PSMKPSO4.js";
23
+ } from "./chunk-DBLV7PGG.js";
24
24
  import {
25
25
  anchorGraph
26
- } from "./chunk-M6LK4GII.js";
26
+ } from "./chunk-LGJBB5BP.js";
27
27
  import {
28
28
  gfaTables
29
- } from "./chunk-G45YY72K.js";
29
+ } from "./chunk-Z6XZWPXK.js";
30
30
  import {
31
31
  mergeRuns,
32
32
  splitRuns
33
- } from "./chunk-N73TI3VG.js";
33
+ } from "./chunk-BZFOFC4D.js";
34
34
  import {
35
35
  spreadFor
36
- } from "./chunk-UVBGRJQX.js";
36
+ } from "./chunk-HKYXWZQS.js";
37
37
  import {
38
38
  drawnLengthOf,
39
39
  drawnNodeLength,
40
40
  layoutScaling
41
- } from "./chunk-6JEWNXCQ.js";
41
+ } from "./chunk-34BOZKIE.js";
42
42
  import {
43
43
  deletionDrawing,
44
44
  deletionEdges
45
- } from "./chunk-24WITXQY.js";
45
+ } from "./chunk-CGMSKIEO.js";
46
46
  import {
47
47
  isBackbone
48
- } from "./chunk-FYQWPEEY.js";
48
+ } from "./chunk-RJWPJCIB.js";
49
49
 
50
50
  // src/pipeline.ts
51
51
  function graphOf(source, name) {
@@ -90,11 +90,12 @@ function engineSettingsOf(s = {}) {
90
90
  var COMPONENT_SEPARATION = 15;
91
91
  function engineRequest(graph, scaling, settings) {
92
92
  const anchored = graph.nodes.some(isBackbone);
93
+ const s = engineSettingsOf(settings);
93
94
  const spaced = {
94
95
  ...scaling,
95
96
  opts: {
96
97
  ...scaling.opts,
97
- edgeLength: scaling.opts.edgeLength * (settings.spacing ?? 1)
98
+ edgeLength: scaling.opts.edgeLength * s.spacing
98
99
  }
99
100
  };
100
101
  return {
@@ -103,18 +104,22 @@ function engineRequest(graph, scaling, settings) {
103
104
  edges: graph.edges
104
105
  },
105
106
  options: {
106
- quality: settings.quality,
107
- linearLayout: settings.linearLayout,
107
+ quality: s.quality,
108
+ linearLayout: s.linearLayout,
108
109
  ...spaced.opts,
109
- componentSeparation: COMPONENT_SEPARATION * (settings.componentSeparation ?? 1),
110
+ componentSeparation: COMPONENT_SEPARATION * s.componentSeparation,
110
111
  ...anchored ? { rotateComponents: false } : {},
111
- engine: settings.engine ?? "fmmm"
112
+ engine: s.engine
112
113
  }
113
114
  };
114
115
  }
115
116
  function engineKey(graph, settings) {
116
117
  const anchored = graph.nodes.some(isBackbone);
117
- return `${settings.engine ?? "fmmm"}|${settings.quality}|${settings.linearLayout}|${settings.bubbleSpread}|${settings.spacing ?? 1}|${settings.componentSeparation ?? 1}|${settings.showDeletionEdges !== false}|${anchored}|${graph.referencePath ?? ""}`;
118
+ return [
119
+ ...Object.values(engineSettingsOf(settings)),
120
+ anchored,
121
+ graph.referencePath ?? ""
122
+ ].join("|");
118
123
  }
119
124
  async function forceLayout(graph, settings, engine) {
120
125
  const spread = spreadFor(settings.bubbleSpread);
@@ -1,12 +1,15 @@
1
1
  import {
2
2
  PathVisitsBuilder
3
- } from "./chunk-RAEABQNW.js";
3
+ } from "./chunk-ZPZ7GNBT.js";
4
4
  import {
5
- panSNSample
6
- } from "./chunk-BPLIXMH7.js";
5
+ groupBy
6
+ } from "./chunk-BSOZW3FC.js";
7
7
  import {
8
8
  REFERENCE_RANK
9
- } from "./chunk-FYQWPEEY.js";
9
+ } from "./chunk-RJWPJCIB.js";
10
+ import {
11
+ panSNSample
12
+ } from "./chunk-4XWZNPQ2.js";
10
13
 
11
14
  // src/pathAnchoring.ts
12
15
  var RANGE_SUFFIX = /:(\d+)-\d+$/;
@@ -132,11 +135,7 @@ function trimOrigins(graph, kept) {
132
135
  }
133
136
  return sum;
134
137
  };
135
- const byOrigin = /* @__PURE__ */ new Map();
136
- for (const path of graph.paths ?? []) {
137
- const origin = pathOrigin(path.name).name;
138
- byOrigin.set(origin, [...byOrigin.get(origin) ?? [], path]);
139
- }
138
+ const byOrigin = groupBy(graph.paths ?? [], (p) => pathOrigin(p.name).name);
140
139
  return graph.anchorPaths.map((o) => {
141
140
  const pieces = byOrigin.get(o.name);
142
141
  const path = pieces?.length === 1 ? pieces[0] : void 0;