@jbrowse/bandage-core 10.2.7 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) 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-ABUIN5AK.js → chunk-2Q22S52W.js} +29 -24
  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-3XSM4OZU.js → chunk-3GP3KT5L.js} +5 -5
  14. package/dist/chunks/{chunk-PUG7LXDF.js → chunk-3PZSBNLI.js} +4 -1
  15. package/dist/chunks/{chunk-JLSJMCDJ.js → chunk-3UST3ZQE.js} +3 -3
  16. package/dist/chunks/{chunk-KBEP7VYK.js → chunk-3VCKBSML.js} +4 -4
  17. package/dist/chunks/{chunk-BPLIXMH7.js → chunk-4XWZNPQ2.js} +14 -0
  18. package/dist/chunks/{chunk-4DRQTBBE.js → chunk-6EOB6ANX.js} +1 -1
  19. package/dist/chunks/{chunk-L2HDM2R3.js → chunk-A2TJ5UX6.js} +7 -7
  20. package/dist/chunks/{chunk-URZ3CH2R.js → chunk-A4JDEUAI.js} +1 -1
  21. package/dist/chunks/{chunk-CWFNEKST.js → chunk-A7H753BA.js} +3 -3
  22. package/dist/chunks/{chunk-CG35S2S2.js → chunk-AQCOIE5R.js} +1 -1
  23. package/dist/chunks/{chunk-TKIJ5535.js → chunk-AZ4EEF6Q.js} +6 -6
  24. package/dist/chunks/{chunk-M6LK4GII.js → chunk-B5X2RLJG.js} +17 -10
  25. package/dist/chunks/{chunk-A7CFWFQS.js → chunk-BKEZLETL.js} +1 -1
  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-XXT2JCAC.js → chunk-BX4AUMZE.js} +11 -13
  29. package/dist/chunks/{chunk-N73TI3VG.js → chunk-BZFOFC4D.js} +6 -9
  30. package/dist/chunks/{chunk-4ETPXDO6.js → chunk-CGFPFBT2.js} +1 -1
  31. package/dist/chunks/{chunk-24WITXQY.js → chunk-CGMSKIEO.js} +9 -25
  32. package/dist/chunks/{chunk-VV6KGJ7M.js → chunk-CHNESV7L.js} +18 -27
  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-AUFAPUO4.js → chunk-D7WIYPG3.js} +3 -1
  36. package/dist/chunks/{chunk-OIV2GBAJ.js → chunk-DBLV7PGG.js} +27 -17
  37. package/dist/chunks/{chunk-VQC7KELB.js → chunk-DO62DG26.js} +11 -3
  38. package/dist/chunks/{chunk-JA2HJIYS.js → chunk-E4ZM4OOJ.js} +3 -5
  39. package/dist/chunks/{chunk-QLWI2PZ3.js → chunk-EJRJAAN7.js} +24 -21
  40. package/dist/chunks/{chunk-QBHPHLAQ.js → chunk-EWLXU3UG.js} +41 -36
  41. package/dist/chunks/{chunk-XI3ZUTWF.js → chunk-FW2R7UDZ.js} +14 -20
  42. package/dist/chunks/{chunk-Q7LYHGGQ.js → chunk-GIHTHYXY.js} +5 -4
  43. package/dist/chunks/{chunk-L3O7AWLI.js → chunk-GJLZ2MKE.js} +2 -2
  44. package/dist/chunks/{chunk-LOEA5IHZ.js → chunk-GJU6BJJA.js} +8 -8
  45. package/dist/chunks/{chunk-XL472HHD.js → chunk-GQZVR5DW.js} +12 -7
  46. package/dist/chunks/{chunk-UVBGRJQX.js → chunk-HKYXWZQS.js} +1 -1
  47. package/dist/chunks/chunk-HMXCN6PG.js +17 -0
  48. package/dist/chunks/{chunk-WSIFAZU7.js → chunk-HNWJ4B7S.js} +12 -13
  49. package/dist/chunks/chunk-HOAIOEI7.js +18 -0
  50. package/dist/chunks/{chunk-XMW266WS.js → chunk-HSVFCA2J.js} +18 -20
  51. package/dist/chunks/{chunk-QXUEF3AJ.js → chunk-KMBE2Q42.js} +22 -17
  52. package/dist/chunks/{chunk-VQWHMWLF.js → chunk-M5NPD55W.js} +18 -14
  53. package/dist/chunks/chunk-MWOVW4AH.js +327 -0
  54. package/dist/chunks/{chunk-HK5Y2YWV.js → chunk-MYDHU2UV.js} +6 -11
  55. package/dist/chunks/{chunk-TZFWUT2C.js → chunk-MYLAJDKB.js} +2 -2
  56. package/dist/chunks/{chunk-AR4BUBMU.js → chunk-NZTYV3JL.js} +34 -35
  57. package/dist/chunks/{chunk-4HWM3FNK.js → chunk-OMUPUB4J.js} +39 -56
  58. package/dist/chunks/{chunk-LKW2TP4N.js → chunk-OOIOX36I.js} +18 -16
  59. package/dist/chunks/{chunk-EQ2NIFRH.js → chunk-OXRUPNSV.js} +1 -1
  60. package/dist/chunks/{chunk-PTABFYQ7.js → chunk-PFRQBCGC.js} +49 -60
  61. package/dist/chunks/{chunk-T6V4KI2L.js → chunk-PNMJFFNB.js} +1 -1
  62. package/dist/chunks/{chunk-KC7T5RWG.js → chunk-PSCSZSVK.js} +9 -16
  63. package/dist/chunks/{chunk-23YFB5BB.js → chunk-QH2MIXBA.js} +29 -13
  64. package/dist/chunks/{chunk-5GMFEPWR.js → chunk-R2PJKD3Y.js} +16 -28
  65. package/dist/chunks/{chunk-CQHUZHET.js → chunk-RFG42VIO.js} +46 -30
  66. package/dist/chunks/{chunk-FYQWPEEY.js → chunk-RJWPJCIB.js} +5 -11
  67. package/dist/chunks/{chunk-WBSWROE6.js → chunk-SFP3E4RI.js} +14 -18
  68. package/dist/chunks/{chunk-2CMYNW3E.js → chunk-SI3BB4DO.js} +1 -1
  69. package/dist/chunks/{chunk-DY3JCAMX.js → chunk-SOMZGDVS.js} +7 -16
  70. package/dist/chunks/{chunk-A4PFFC4Q.js → chunk-SWCULW6S.js} +60 -102
  71. package/dist/chunks/{chunk-XV4P5KEQ.js → chunk-TGUFT6KK.js} +6 -3
  72. package/dist/chunks/{chunk-CM6LO6OC.js → chunk-UAFATXYA.js} +10 -14
  73. package/dist/chunks/{chunk-7SRWJLSC.js → chunk-UBQSRCWR.js} +11 -8
  74. package/dist/chunks/{chunk-RUCH6ZFL.js → chunk-V4YML3GR.js} +2 -1
  75. package/dist/chunks/{chunk-ES2N6V56.js → chunk-VX656OAZ.js} +6 -11
  76. package/dist/chunks/chunk-WA5WNP6V.js +37 -0
  77. package/dist/chunks/{chunk-B6IW3IRE.js → chunk-WYJQIC75.js} +14 -15
  78. package/dist/chunks/{chunk-T2PCSAFY.js → chunk-XVS52NMZ.js} +2 -2
  79. package/dist/chunks/{chunk-CU6P5RUG.js → chunk-YZQI35UJ.js} +22 -16
  80. package/dist/chunks/{chunk-G45YY72K.js → chunk-Z6XZWPXK.js} +17 -25
  81. package/dist/chunks/{chunk-EFQLEGWM.js → chunk-ZJBOM73S.js} +7 -8
  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-core/gfaParser.d.ts +1 -1
  152. package/dist/types/graphLabels.d.ts +2 -1
  153. package/dist/types/layout/drawnScale.d.ts +0 -2
  154. package/dist/types/layout/referenceSeeds.d.ts +2 -1
  155. package/dist/types/layout/tubeMapLayout.d.ts +0 -7
  156. package/dist/types/layout/walkRowDraw.d.ts +0 -1
  157. package/dist/types/layout/walkRowLayout.d.ts +1 -0
  158. package/dist/types/layout/walkRows.d.ts +1 -0
  159. package/dist/types/nodeWidths.d.ts +0 -1
  160. package/dist/types/pansn.d.ts +9 -0
  161. package/dist/types/pathVisits.d.ts +6 -0
  162. package/dist/types/referenceRampCss.d.ts +4 -0
  163. package/dist/types/renderer/Canvas2DRenderer.d.ts +1 -0
  164. package/dist/types/renderer/GeometryBuilder.d.ts +3 -2
  165. package/dist/types/tubeMap/axis.d.ts +3 -1
  166. package/dist/types/tubeMap/coarsen.d.ts +3 -1
  167. package/dist/types/tubeMap/deviations.d.ts +2 -1
  168. package/dist/types/tubeMap/mismatches.d.ts +0 -1
  169. package/dist/types/tubeMap/warp.d.ts +2 -1
  170. package/dist/types/util/SpatialIndex.d.ts +1 -1
  171. package/dist/types/util/geometry.d.ts +4 -0
  172. package/dist/types/util/groups.d.ts +3 -0
  173. package/dist/types/util/hitDetection.d.ts +2 -2
  174. package/dist/types/util/partitionPoint.d.ts +1 -0
  175. package/dist/types/util/weakMemo.d.ts +1 -0
  176. package/dist/types/version.d.ts +1 -1
  177. package/dist/util/SpatialIndex.js +8 -5
  178. package/dist/util/edgeCurves.js +7 -4
  179. package/dist/util/geometry.js +3 -1
  180. package/dist/util/groups.js +10 -0
  181. package/dist/util/hitDetection.js +9 -6
  182. package/dist/util/partitionPoint.js +6 -0
  183. package/dist/util/weakMemo.js +6 -0
  184. package/dist/version.js +1 -1
  185. package/dist/viewport.js +19 -17
  186. package/dist/walkEncoding.js +18 -14
  187. package/dist/walkHighlight.js +19 -15
  188. package/dist/walkKey.js +9 -6
  189. package/package.json +2 -2
  190. package/dist/chunks/chunk-ZY2AFL4Y.js +0 -43
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  polylineSlice
3
- } from "./chunk-N73TI3VG.js";
3
+ } from "./chunk-BZFOFC4D.js";
4
4
  import {
5
5
  svgPath
6
- } from "./chunk-7SRWJLSC.js";
6
+ } from "./chunk-UBQSRCWR.js";
7
7
  import {
8
8
  firstNodeAtOrAfter,
9
9
  isAnchored
10
- } from "./chunk-FYQWPEEY.js";
10
+ } from "./chunk-RJWPJCIB.js";
11
11
 
12
12
  // src/genes/genePins.ts
13
13
  function genePins(graph, genes, positions) {
@@ -0,0 +1,30 @@
1
+ // src/util/groups.ts
2
+ function pushTo(map, key, value) {
3
+ const list = map.get(key);
4
+ if (list) {
5
+ list.push(value);
6
+ } else {
7
+ map.set(key, [value]);
8
+ }
9
+ }
10
+ function addTo(map, key, value) {
11
+ const set = map.get(key);
12
+ if (set) {
13
+ set.add(value);
14
+ } else {
15
+ map.set(key, /* @__PURE__ */ new Set([value]));
16
+ }
17
+ }
18
+ function groupBy(items, keyOf) {
19
+ const groups = /* @__PURE__ */ new Map();
20
+ for (const item of items) {
21
+ pushTo(groups, keyOf(item), item);
22
+ }
23
+ return groups;
24
+ }
25
+
26
+ export {
27
+ pushTo,
28
+ addTo,
29
+ groupBy
30
+ };
@@ -1,5 +1,9 @@
1
1
  // src/tubeMap/mismatches.ts
2
- import { forward, getXCoordinateOfBaseWithinNode } from "@jbrowse/tubemap-core";
2
+ import {
3
+ forward,
4
+ getXCoordinateOfBaseWithinNode,
5
+ mirroredMismatch
6
+ } from "@jbrowse/tubemap-core";
3
7
  function readMismatches(read, layout) {
4
8
  const marks = [];
5
9
  const entries = read.sequenceNew ?? [];
@@ -7,22 +11,16 @@ function readMismatches(read, layout) {
7
11
  entries.forEach((entry, i) => {
8
12
  const nodeIndex = layout.nodeMap.get(forward(entry.nodeName));
9
13
  const node = nodeIndex === void 0 ? void 0 : layout.nodes[nodeIndex];
10
- const y = visits[i]?.y;
11
- if (node && y !== void 0) {
12
- const base = { readId: read.id, y, height: read.width };
14
+ const visit = visits[i];
15
+ if (node && visit?.y !== void 0) {
16
+ const base = { readId: read.id, y: visit.y, height: read.width };
13
17
  const at = (pos) => getXCoordinateOfBaseWithinNode(node, pos);
14
- for (const mm of entry.mismatches) {
18
+ for (const edit of entry.mismatches) {
19
+ const mm = visit.isForward ? edit : mirroredMismatch(edit, node.sequenceLength);
15
20
  const x0 = at(mm.pos);
16
21
  if (x0 !== null) {
17
22
  if (mm.type === "insertion") {
18
- const softClip = i === 0 && mm.pos === read.firstNodeOffset || i === entries.length - 1 && mm.pos === read.finalNodeCoverLength;
19
- marks.push({
20
- ...base,
21
- kind: "insertion",
22
- x: x0,
23
- seq: mm.seq,
24
- softClip
25
- });
23
+ marks.push({ ...base, kind: "insertion", x: x0, seq: mm.seq });
26
24
  } else if (mm.type === "deletion" && mm.length !== void 0) {
27
25
  const x1 = at(mm.pos + mm.length);
28
26
  if (x1 !== null) {
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  ownStrand,
3
3
  strandSides
4
- } from "./chunk-7SRWJLSC.js";
4
+ } from "./chunk-UBQSRCWR.js";
5
+ import {
6
+ pushTo
7
+ } from "./chunk-BSOZW3FC.js";
5
8
  import {
6
9
  isBackbone
7
- } from "./chunk-FYQWPEEY.js";
10
+ } from "./chunk-RJWPJCIB.js";
8
11
 
9
12
  // src/layout/mergeRuns.ts
10
13
  function flip(strand) {
@@ -14,13 +17,7 @@ function mergeRuns(graph, alone = /* @__PURE__ */ new Set()) {
14
17
  const sides = graph.edges.map(strandSides);
15
18
  const at = /* @__PURE__ */ new Map();
16
19
  const attach = (id, side, ei) => {
17
- const key = `${id}|${side}`;
18
- const list = at.get(key);
19
- if (list) {
20
- list.push(ei);
21
- } else {
22
- at.set(key, [ei]);
23
- }
20
+ pushTo(at, `${id}|${side}`, ei);
24
21
  };
25
22
  graph.edges.forEach((edge, ei) => {
26
23
  attach(edge.from, sides[ei].from, ei);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  formatBp,
3
3
  groupDigits
4
- } from "./chunk-PTABFYQ7.js";
4
+ } from "./chunk-PFRQBCGC.js";
5
5
 
6
6
  // src/walkKey.ts
7
7
  function rangeText(contig, start, end) {
@@ -3,27 +3,20 @@ import {
3
3
  edgeJoinOf,
4
4
  routedEdgeCurves,
5
5
  strandSides
6
- } from "./chunk-7SRWJLSC.js";
6
+ } from "./chunk-UBQSRCWR.js";
7
+ import {
8
+ groupBy
9
+ } from "./chunk-BSOZW3FC.js";
7
10
  import {
8
11
  firstNodeAtOrAfter,
9
12
  isBackbone
10
- } from "./chunk-FYQWPEEY.js";
13
+ } from "./chunk-RJWPJCIB.js";
11
14
 
12
15
  // src/deletionEdges.ts
13
16
  var MIN_DELETION_BP = 1;
14
17
  function bypassedPoints(nodePositions, bypassed) {
15
18
  return bypassed.flatMap((id) => nodePositions[id] ?? []);
16
19
  }
17
- function deletionArcCurves(nodePositions, deletion, axis, route, stranded = false) {
18
- return edgeCurvesOf(
19
- nodePositions,
20
- deletion,
21
- axis,
22
- deletion.bypassed,
23
- route,
24
- stranded
25
- );
26
- }
27
20
  function edgeCurvesOf(nodePositions, edge, axis, bypassed, route, stranded) {
28
21
  const from = nodePositions[edge.from];
29
22
  const to = nodePositions[edge.to];
@@ -44,17 +37,10 @@ function edgeCurvesOf(nodePositions, edge, axis, bypassed, route, stranded) {
44
37
  );
45
38
  }
46
39
  function backboneBySequence(graph) {
47
- const bySequence = /* @__PURE__ */ new Map();
48
- for (const node of graph.nodes) {
49
- if (isBackbone(node)) {
50
- const list = bySequence.get(node.stable.refName);
51
- if (list) {
52
- list.push(node);
53
- } else {
54
- bySequence.set(node.stable.refName, [node]);
55
- }
56
- }
57
- }
40
+ const bySequence = groupBy(
41
+ graph.nodes.filter(isBackbone),
42
+ (node) => node.stable.refName
43
+ );
58
44
  for (const list of bySequence.values()) {
59
45
  list.sort((a, b) => a.stable.start - b.stable.start);
60
46
  }
@@ -167,8 +153,6 @@ function deletionDrawing(graph, deletions, show = true) {
167
153
  }
168
154
 
169
155
  export {
170
- bypassedPoints,
171
- deletionArcCurves,
172
156
  edgeCurvesOf,
173
157
  deletionEdges,
174
158
  closableDeletions,
@@ -3,40 +3,37 @@ import {
3
3
  } from "./chunk-JMABOQWL.js";
4
4
  import {
5
5
  layoutModeByValue
6
- } from "./chunk-TKIJ5535.js";
6
+ } from "./chunk-AZ4EEF6Q.js";
7
7
  import {
8
8
  parseRegion
9
- } from "./chunk-VQWHMWLF.js";
9
+ } from "./chunk-M5NPD55W.js";
10
10
  import {
11
11
  version
12
- } from "./chunk-CG35S2S2.js";
12
+ } from "./chunk-AQCOIE5R.js";
13
13
  import {
14
14
  axisScaleOf
15
- } from "./chunk-A7CFWFQS.js";
16
- import {
17
- walkKey
18
- } from "./chunk-4ETPXDO6.js";
15
+ } from "./chunk-BKEZLETL.js";
19
16
  import {
20
17
  figureScene
21
- } from "./chunk-23YFB5BB.js";
18
+ } from "./chunk-QH2MIXBA.js";
22
19
  import {
23
20
  abgrAlpha,
24
21
  abgrBlue,
25
22
  abgrGreen,
26
23
  abgrRed
27
24
  } from "./chunk-G2FD7S3C.js";
25
+ import {
26
+ FIGURE_DEFAULTS
27
+ } from "./chunk-D7WIYPG3.js";
28
28
  import {
29
29
  engineSettingsOf,
30
30
  fitTransform,
31
31
  forceLayout,
32
32
  loadGraph
33
- } from "./chunk-QXUEF3AJ.js";
33
+ } from "./chunk-KMBE2Q42.js";
34
34
  import {
35
35
  isBackbone
36
- } from "./chunk-FYQWPEEY.js";
37
- import {
38
- facetCells
39
- } from "./chunk-XV4P5KEQ.js";
36
+ } from "./chunk-RJWPJCIB.js";
40
37
 
41
38
  // src/figureData.ts
42
39
  function columns(keys) {
@@ -59,19 +56,18 @@ function figureData(graph, layout, o = {}) {
59
56
  if (layout.tubeMap) {
60
57
  throw new Error("figure data has no tables for a tube map yet");
61
58
  }
62
- const width = o.width ?? 1200;
63
- const height = o.height ?? 800;
59
+ const width = o.width ?? FIGURE_DEFAULTS.width;
60
+ const height = o.height ?? FIGURE_DEFAULTS.height;
64
61
  const pixelRows = layout.pixelRows ?? false;
65
62
  const {
66
63
  bounds,
67
64
  colorScheme,
68
65
  drawnDeletions,
69
66
  lift,
70
- facet,
71
- panels: facetted,
67
+ facets,
72
68
  labelOf,
73
69
  referenceName,
74
- reference,
70
+ keyText,
75
71
  geometry
76
72
  } = figureScene(graph, layout, o);
77
73
  const fit = fitTransform(bounds, width, height, pixelRows);
@@ -80,20 +76,15 @@ function figureData(graph, layout, o = {}) {
80
76
  }
81
77
  const axis = axisScaleOf(fit.scale, pixelRows);
82
78
  const panels = [];
83
- if (facetted) {
84
- const place = facetCells(
85
- facetted.map((p) => p.walks[0].name),
86
- facet.field || "walk",
87
- facet.domain
88
- );
89
- const ordered = facetted.map((panel, i) => ({ panel, cell: place.cells[i] })).sort((a, b) => a.cell - b.cell);
79
+ if (facets) {
80
+ const ordered = facets.panels.map((panel, i) => ({ panel, cell: facets.place.cells[i] })).sort((a, b) => a.cell - b.cell);
90
81
  for (const { panel } of ordered) {
91
82
  const walk = panel.walks[0];
92
- const key = walkKey(walk, reference);
83
+ const key = keyText(walk);
93
84
  panels.push({
94
85
  highlight: panel,
95
86
  name: labelOf(walk.name),
96
- key: key.delta + key.outside + key.reversed,
87
+ key: key.note,
97
88
  range: key.scale ?? ""
98
89
  });
99
90
  }
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  buildNeighbors
3
- } from "./chunk-ES2N6V56.js";
3
+ } from "./chunk-VX656OAZ.js";
4
4
  import {
5
5
  drawnNodeLength
6
- } from "./chunk-6JEWNXCQ.js";
6
+ } from "./chunk-34BOZKIE.js";
7
7
  import {
8
8
  isBackbone
9
- } from "./chunk-FYQWPEEY.js";
9
+ } from "./chunk-RJWPJCIB.js";
10
10
 
11
11
  // src/layout/referenceSeeds.ts
12
12
  var LANE_GAP = 30;
@@ -51,7 +51,6 @@ function nodeInk(graph, nodeById, contigThickness, nodeWidth) {
51
51
  export {
52
52
  NODE_WIDTHS,
53
53
  meanDepth,
54
- depthWidthFactor,
55
54
  nodeWidthPx,
56
55
  maxNodeWidthPx,
57
56
  nodeInk
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  ENGINE_DEFAULTS
3
- } from "./chunk-QXUEF3AJ.js";
3
+ } from "./chunk-KMBE2Q42.js";
4
4
 
5
5
  // src/figureSettings.ts
6
6
  var FIGURE_DEFAULTS = {
7
7
  ...ENGINE_DEFAULTS,
8
+ width: 1200,
9
+ height: 800,
8
10
  colorScheme: "auto",
9
11
  nodeWidth: "depth",
10
12
  contigThickness: 6,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  PathVisits
3
- } from "./chunk-RAEABQNW.js";
3
+ } from "./chunk-ZPZ7GNBT.js";
4
4
  import {
5
+ panSNFields,
5
6
  panSNSample
6
- } from "./chunk-BPLIXMH7.js";
7
+ } from "./chunk-4XWZNPQ2.js";
7
8
 
8
9
  // src/gfa/graphTables.ts
9
- function walkFields(panSN) {
10
- const [sample = "", haplotype = "", ...contig] = panSN.split("#");
11
- return contig.length > 0 ? { sample, haplotype: +haplotype, contig: contig.join("#") } : void 0;
10
+ function pLineName(name, start, end) {
11
+ return start === 0 ? name : `${name}:${start}-${end}`;
12
12
  }
13
13
  function namesByList(lists, names, listCount, pathNames) {
14
14
  const starts = new Int32Array(listCount + 1);
@@ -160,17 +160,27 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
160
160
  const visitOrder = [];
161
161
  const blocks = [0];
162
162
  const pathSamples = [];
163
+ const edgeNameIndex = /* @__PURE__ */ new Map();
164
+ const edgeNames = [];
163
165
  for (const p of drawnWalks) {
164
- const fields = walkFields(w.names[p]);
165
- const pathName = fields ? `${fields.sample}#${fields.haplotype}#${fields.contig}` : w.names[p];
166
- let named = nameIndex.get(pathName);
166
+ const walkName = w.names[p];
167
+ const fields = panSNFields(walkName);
168
+ const start = w.starts[p];
169
+ const visitName = fields ? `${fields.sample}#${fields.haplotype}#${fields.contig}` : walkName;
170
+ const pathName = fields ? visitName : pLineName(walkName, start, w.ends[p]);
171
+ let named = nameIndex.get(visitName);
167
172
  if (named === void 0) {
168
173
  named = pathNames.length;
169
- nameIndex.set(pathName, named);
170
- pathNames.push(pathName);
171
- pathSamples.push(panSNSample(pathName));
174
+ nameIndex.set(visitName, named);
175
+ pathNames.push(visitName);
176
+ pathSamples.push(panSNSample(visitName));
177
+ }
178
+ let edgeNamed = edgeNameIndex.get(pathName);
179
+ if (edgeNamed === void 0) {
180
+ edgeNamed = edgeNames.length;
181
+ edgeNameIndex.set(pathName, edgeNamed);
182
+ edgeNames.push(pathName);
172
183
  }
173
- const start = w.starts[p];
174
184
  const visitSample = pathSamples[named];
175
185
  const first = w.offsets[p];
176
186
  const nodeIds = new Array(w.offsets[p + 1] - first);
@@ -194,14 +204,14 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
194
204
  if (list >= 0 && lastWalk[list] !== p) {
195
205
  lastWalk[list] = p;
196
206
  crossedList[crossings] = list;
197
- crossedName[crossings++] = named;
207
+ crossedName[crossings++] = edgeNamed;
198
208
  }
199
209
  }
200
210
  prev = node;
201
211
  }
202
212
  paths.push({ name: pathName, nodeIds, start, ...fields });
203
213
  anchorPaths.push({
204
- name: pathName,
214
+ name: visitName,
205
215
  sample: visitSample,
206
216
  start,
207
217
  length: pos - start
@@ -211,7 +221,7 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
211
221
  crossedList.subarray(0, crossings),
212
222
  crossedName,
213
223
  lists,
214
- pathNames
224
+ edgeNames
215
225
  );
216
226
  edges.forEach((edge, i) => {
217
227
  const names = listNames[edgeLists[i]];
@@ -254,7 +264,7 @@ function graphTablesGFA({ nodes, links, walks }) {
254
264
  }
255
265
  for (let p = 0; p < walks.names.length; p++) {
256
266
  const name = walks.names[p];
257
- const fields = walkFields(name);
267
+ const fields = panSNFields(name);
258
268
  const start = walks.starts[p];
259
269
  const end = walks.ends[p];
260
270
  const steps = [];
@@ -262,7 +272,7 @@ function graphTablesGFA({ nodes, links, walks }) {
262
272
  steps.push([names[walks.steps[s]], walks.reversed[s]]);
263
273
  }
264
274
  lines.push(
265
- fields ? `W ${fields.sample} ${fields.haplotype} ${fields.contig} ${start} ${end} ${steps.map(([id, rev]) => (rev ? "<" : ">") + id).join("")}` : `P ${start === 0 ? name : `${name}:${start}-${end}`} ${steps.map(([id, rev]) => id + (rev ? "-" : "+")).join(",")} *`
275
+ fields ? `W ${fields.sample} ${fields.haplotype} ${fields.contig} ${start} ${end} ${steps.map(([id, rev]) => (rev ? "<" : ">") + id).join("")}` : `P ${pLineName(name, start, end)} ${steps.map(([id, rev]) => id + (rev ? "-" : "+")).join(",")} *`
266
276
  );
267
277
  }
268
278
  return lines.join("\n");
@@ -1,11 +1,15 @@
1
1
  import {
2
2
  REFERENCE_RAMP_ALT_COLOR,
3
- REFERENCE_RAMP_MAX_HUE,
4
3
  hslToRgb
5
- } from "./chunk-A4PFFC4Q.js";
4
+ } from "./chunk-SWCULW6S.js";
6
5
  import {
7
6
  packAbgr
8
7
  } from "./chunk-G2FD7S3C.js";
8
+ import {
9
+ REFERENCE_RAMP_LIGHTNESS,
10
+ REFERENCE_RAMP_SATURATION,
11
+ rampHueAt
12
+ } from "./chunk-GQZVR5DW.js";
9
13
 
10
14
  // src/walkEncoding.ts
11
15
  var WALK_FIELDS = [
@@ -61,7 +65,11 @@ function schemeRgb(scheme, t) {
61
65
  const x = Math.max(0, Math.min(1, t));
62
66
  const family = WALK_SCHEMES.find((s) => s.value === scheme);
63
67
  if (!family || !("ends" in family)) {
64
- return hslToRgb(x * REFERENCE_RAMP_MAX_HUE, 0.7, 0.5).map((c) => c * 255);
68
+ return hslToRgb(
69
+ rampHueAt(x),
70
+ REFERENCE_RAMP_SATURATION,
71
+ REFERENCE_RAMP_LIGHTNESS
72
+ ).map((c) => c * 255);
65
73
  }
66
74
  const from = oklab(family.ends[0]);
67
75
  const to = oklab(family.ends[1]);
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  bubbleSegmentIds,
3
3
  classifyBubble
4
- } from "./chunk-URZ3CH2R.js";
4
+ } from "./chunk-A4JDEUAI.js";
5
5
  import {
6
6
  svgPath
7
- } from "./chunk-7SRWJLSC.js";
7
+ } from "./chunk-UBQSRCWR.js";
8
8
  import {
9
9
  isBackbone
10
- } from "./chunk-FYQWPEEY.js";
10
+ } from "./chunk-RJWPJCIB.js";
11
11
 
12
12
  // src/bubbles/bubbleHalos.ts
13
13
  var WHOLE_FRACTION = 0.9;
@@ -64,8 +64,6 @@ function bubbleHalos(graph, bubbles, positions, repeats = []) {
64
64
  }
65
65
 
66
66
  export {
67
- WHOLE_FRACTION,
68
67
  coversGraph,
69
- SMALL_VARIANT_BP,
70
68
  bubbleHalos
71
69
  };
@@ -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();