@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
@@ -34,13 +34,13 @@ function mismatchesByStep(record, lengths) {
34
34
  const startOf = (k) => starts[known[k]];
35
35
  const endOf = (k) => startOf(k) + lengths[known[k]];
36
36
  let first = 0;
37
- const stepAt = (pos2, atEnd = false) => {
37
+ const stepAt = (pos2) => {
38
38
  while (first < known.length && endOf(first) < pos2) {
39
39
  first++;
40
40
  }
41
41
  for (let k = first; k < known.length && startOf(k) <= pos2; k++) {
42
42
  const end = endOf(k);
43
- if (pos2 < end || atEnd && pos2 === end) {
43
+ if (pos2 < end) {
44
44
  return { s: known[k], local: pos2 - startOf(k), room: end - pos2 };
45
45
  }
46
46
  }
@@ -74,7 +74,7 @@ function mismatchesByStep(record, lengths) {
74
74
  }
75
75
  pos += 1;
76
76
  } else if (op.op === "insertion") {
77
- const at = stepAt(pos, pos === record.pathEnd);
77
+ const at = pos > record.pathStart && pos < record.pathEnd ? stepAt(pos) : void 0;
78
78
  if (at) {
79
79
  add(at.s, { type: "insertion", pos: at.local, seq: op.seq });
80
80
  }
@@ -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-MD5VPXXT.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-YYMW5XOF.js";
12
+ } from "./chunk-PTQPTDZH.js";
13
13
  import {
14
14
  axisScaleOf
15
- } from "./chunk-BS4UZ44I.js";
16
- import {
17
- walkKey
18
- } from "./chunk-4ETPXDO6.js";
15
+ } from "./chunk-WONB6LMC.js";
19
16
  import {
20
17
  figureScene
21
- } from "./chunk-HFVGGB3U.js";
18
+ } from "./chunk-XUT4HXVE.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-ZPBEUOBM.js";
28
28
  import {
29
29
  engineSettingsOf,
30
30
  fitTransform,
31
31
  forceLayout,
32
32
  loadGraph
33
- } from "./chunk-2QLLQJ72.js";
33
+ } from "./chunk-KWHWNOTY.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,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,30 +1,36 @@
1
1
  import {
2
2
  encodedColor,
3
3
  resolveEncoding
4
- } from "./chunk-VQC7KELB.js";
4
+ } from "./chunk-V7J6U4XC.js";
5
5
  import {
6
6
  pathOrigin
7
- } from "./chunk-M6LK4GII.js";
7
+ } from "./chunk-LGJBB5BP.js";
8
8
  import {
9
9
  panSNContig
10
- } from "./chunk-BPLIXMH7.js";
10
+ } from "./chunk-4XWZNPQ2.js";
11
11
 
12
12
  // src/walkHighlight.ts
13
13
  var isReference = (graph, name) => !!graph.referencePath && pathOrigin(name).name === graph.referencePath;
14
14
  function piecesOf(graph, name) {
15
15
  return (graph.paths ?? []).filter((p) => p.name === name).sort((a, b) => (a.start ?? 0) - (b.start ?? 0));
16
16
  }
17
+ var nodesById = (graph) => new Map(graph.nodes.map((n) => [n.id, n]));
18
+ function graphIndex(graph) {
19
+ const edgeAt = /* @__PURE__ */ new Map();
20
+ graph.edges.forEach((e, i) => {
21
+ edgeAt.set(`${e.from}>${e.to}`, i);
22
+ });
23
+ return { byId: nodesById(graph), edgeAt };
24
+ }
17
25
  function walkHighlight(graph, name) {
26
+ return highlightOf(graph, name, graphIndex(graph));
27
+ }
28
+ function highlightOf(graph, name, { byId, edgeAt }) {
18
29
  const pieces = piecesOf(graph, name);
19
30
  const first = pieces[0];
20
31
  if (!first) {
21
32
  return void 0;
22
33
  }
23
- const byId = new Map(graph.nodes.map((n) => [n.id, n]));
24
- const edgeAt = /* @__PURE__ */ new Map();
25
- graph.edges.forEach((e, i) => {
26
- edgeAt.set(`${e.from}>${e.to}`, i);
27
- });
28
34
  const lengthOf = (id) => byId.get(id)?.length ?? 0;
29
35
  const bpOf = (path) => path.nodeIds.reduce((sum, id) => sum + lengthOf(id), 0);
30
36
  const bp = pieces.reduce((sum, piece) => sum + bpOf(piece), 0);
@@ -83,8 +89,7 @@ function walkHighlight(graph, name) {
83
89
  referenceBp: referenceSpan()
84
90
  };
85
91
  }
86
- function laneColors(graph, walk, encoding, ramp) {
87
- const byId = new Map(graph.nodes.map((n) => [n.id, n]));
92
+ function laneColors(byId, walk, encoding, ramp) {
88
93
  const colors = /* @__PURE__ */ new Map();
89
94
  for (const [id, progress] of walk.progress) {
90
95
  const node = byId.get(id);
@@ -94,7 +99,7 @@ function laneColors(graph, walk, encoding, ramp) {
94
99
  }
95
100
  return colors;
96
101
  }
97
- function reversedNodes(graph, walk) {
102
+ function reversedNodes(graph, byId, walk) {
98
103
  const reversed = /* @__PURE__ */ new Set();
99
104
  let bp = 0;
100
105
  const referencePath = graph.referencePath;
@@ -107,7 +112,6 @@ function reversedNodes(graph, walk) {
107
112
  }
108
113
  const own = visits.pathIndex(pathOrigin(walk.name).name);
109
114
  const theirs = visits.pathIndex(referencePath);
110
- const byId = new Map(graph.nodes.map((n) => [n.id, n]));
111
115
  for (const id of walk.progress.keys()) {
112
116
  const node = byId.get(id);
113
117
  const slot = node ? visits.slot(node.name) : -1;
@@ -121,9 +125,10 @@ function reversedNodes(graph, walk) {
121
125
  return { reversed, bp };
122
126
  }
123
127
  function walkLift(graph, layers, ramp) {
128
+ const index = graphIndex(graph);
124
129
  const seen = /* @__PURE__ */ new Set();
125
130
  const lifted = layers.filter((layer) => !seen.has(layer.walk) && seen.add(layer.walk)).flatMap((layer) => {
126
- const walk = walkHighlight(graph, layer.walk);
131
+ const walk = highlightOf(graph, layer.walk, index);
127
132
  return walk ? [{ walk, layer }] : [];
128
133
  }).sort((a, b) => Number(b.walk.reference) - Number(a.walk.reference));
129
134
  if (lifted.length === 0) {
@@ -137,11 +142,11 @@ function walkLift(graph, layers, ramp) {
137
142
  walk.reference ? 0 : picked++,
138
143
  lifted.length === 1
139
144
  );
140
- const { reversed, bp } = reversedNodes(graph, walk);
145
+ const { reversed, bp } = reversedNodes(graph, index.byId, walk);
141
146
  return {
142
147
  ...walk,
143
148
  encoding,
144
- colors: laneColors(graph, walk, encoding, ramp),
149
+ colors: laneColors(index.byId, walk, encoding, ramp),
145
150
  reversed,
146
151
  reversedBp: bp
147
152
  };
@@ -150,6 +155,7 @@ function walkLift(graph, layers, ramp) {
150
155
  }
151
156
  var FACET_COLOR = { field: "progress", scheme: "red" };
152
157
  function facetLifts(graph, lift, layers, ramp) {
158
+ const byId = nodesById(graph);
153
159
  return lift.walks.map((walk) => {
154
160
  const stated = layers.find((l) => l.walk === walk.name)?.color;
155
161
  const encoding = resolveEncoding(
@@ -162,7 +168,7 @@ function facetLifts(graph, lift, layers, ramp) {
162
168
  {
163
169
  ...walk,
164
170
  encoding,
165
- colors: laneColors(graph, walk, encoding, ramp)
171
+ colors: laneColors(byId, walk, encoding, ramp)
166
172
  }
167
173
  ],
168
174
  ramp
@@ -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,
@@ -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,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 { sample, haplotype, contig: contig.join("#") };
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 { sample, haplotype, contig } = walkFields(w.names[p]);
165
- const pathName = `${sample}#${+haplotype}#${contig}`;
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,21 +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
- paths.push({
203
- name: pathName,
204
- nodeIds,
205
- start,
206
- sample,
207
- haplotype: +haplotype,
208
- contig
209
- });
212
+ paths.push({ name: pathName, nodeIds, start, ...fields });
210
213
  anchorPaths.push({
211
- name: pathName,
214
+ name: visitName,
212
215
  sample: visitSample,
213
216
  start,
214
217
  length: pos - start
@@ -218,7 +221,7 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
218
221
  crossedList.subarray(0, crossings),
219
222
  crossedName,
220
223
  lists,
221
- pathNames
224
+ edgeNames
222
225
  );
223
226
  edges.forEach((edge, i) => {
224
227
  const names = listNames[edgeLists[i]];
@@ -260,13 +263,16 @@ function graphTablesGFA({ nodes, links, walks }) {
260
263
  );
261
264
  }
262
265
  for (let p = 0; p < walks.names.length; p++) {
263
- const { sample, haplotype, contig } = walkFields(walks.names[p]);
264
- let body = "";
266
+ const name = walks.names[p];
267
+ const fields = panSNFields(name);
268
+ const start = walks.starts[p];
269
+ const end = walks.ends[p];
270
+ const steps = [];
265
271
  for (let s = walks.offsets[p]; s < walks.offsets[p + 1]; s++) {
266
- body += (walks.reversed[s] ? "<" : ">") + names[walks.steps[s]];
272
+ steps.push([names[walks.steps[s]], walks.reversed[s]]);
267
273
  }
268
274
  lines.push(
269
- `W ${sample} ${haplotype} ${contig} ${walks.starts[p]} ${walks.ends[p]} ${body}`
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(",")} *`
270
276
  );
271
277
  }
272
278
  return lines.join("\n");
@@ -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
  };