@jbrowse/bandage-core 13.1.0 → 13.2.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 (94) hide show
  1. package/dist/bubbles/bubbleHalos.js +4 -4
  2. package/dist/bubbles/classifyBubble.js +3 -3
  3. package/dist/bubbles/superbubbles.js +5 -5
  4. package/dist/chunks/{chunk-OROLXHDA.js → chunk-2DA4DX5W.js} +2 -2
  5. package/dist/chunks/{chunk-Z2OUCH2J.js → chunk-2WMLHOJ6.js} +1 -1
  6. package/dist/chunks/{chunk-OB6OUWHG.js → chunk-5IGFO2GE.js} +10 -10
  7. package/dist/chunks/{chunk-STHPR76Q.js → chunk-7HG3B4LW.js} +54 -9
  8. package/dist/chunks/{chunk-74A3MFUM.js → chunk-A5AMM5PI.js} +1 -1
  9. package/dist/chunks/{chunk-DBLRFSET.js → chunk-A65QHIGX.js} +15 -2
  10. package/dist/chunks/{chunk-5PQQ4IXZ.js → chunk-B5PQ6BMI.js} +1 -1
  11. package/dist/chunks/{chunk-WWQI7LPU.js → chunk-BAUB7NLR.js} +104 -13
  12. package/dist/chunks/{chunk-UY7CLJNZ.js → chunk-BHJWSWJK.js} +2 -2
  13. package/dist/chunks/{chunk-CDLHGGJH.js → chunk-EDYOWLXK.js} +2 -2
  14. package/dist/chunks/{chunk-66Y7PRQN.js → chunk-EPUM2BZW.js} +1 -1
  15. package/dist/chunks/{chunk-U7V64JZY.js → chunk-FXTEQYHT.js} +1 -1
  16. package/dist/chunks/{chunk-Z2RG6IYI.js → chunk-HCUURE7Z.js} +14 -14
  17. package/dist/chunks/{chunk-MUUMKRJM.js → chunk-HZGHRBFH.js} +2 -2
  18. package/dist/chunks/{chunk-YI5HHKTR.js → chunk-IDNMSP3V.js} +2 -2
  19. package/dist/chunks/{chunk-NPDW3JAD.js → chunk-IPNRPZBI.js} +40 -0
  20. package/dist/chunks/{chunk-HGVMMYEQ.js → chunk-JFRWYOIV.js} +1 -1
  21. package/dist/chunks/{chunk-H57ETH4Y.js → chunk-KA44XBBV.js} +1 -1
  22. package/dist/chunks/{chunk-OC5HU7M3.js → chunk-KAHJSU3Q.js} +1 -1
  23. package/dist/chunks/{chunk-FSOP446U.js → chunk-LFDONCSJ.js} +1 -1
  24. package/dist/chunks/{chunk-C6SQT52T.js → chunk-LRP32C6V.js} +1 -1
  25. package/dist/chunks/{chunk-7SVWKNIZ.js → chunk-M7SC7UJO.js} +1 -1
  26. package/dist/chunks/{chunk-QDP2NTAV.js → chunk-MZ2M4GCQ.js} +2 -2
  27. package/dist/chunks/{chunk-IGQVO5L3.js → chunk-QUH2EULL.js} +1 -1
  28. package/dist/chunks/{chunk-M2URPEV3.js → chunk-QXI4EEIM.js} +1 -1
  29. package/dist/chunks/{chunk-2HR33HEK.js → chunk-TDA7YJ7Q.js} +30 -12
  30. package/dist/chunks/{chunk-7UMGBTJJ.js → chunk-TLKWIPDZ.js} +1 -1
  31. package/dist/chunks/{chunk-LJSZRCTZ.js → chunk-TMUBRBAZ.js} +2 -2
  32. package/dist/chunks/{chunk-IDYGRSNF.js → chunk-TTSA2ML4.js} +1 -1
  33. package/dist/chunks/{chunk-RJG2PDS4.js → chunk-UDUJWSPF.js} +2 -2
  34. package/dist/chunks/{chunk-RNROMUAS.js → chunk-UEERU47W.js} +3 -3
  35. package/dist/chunks/{chunk-2TNFP3GC.js → chunk-V52OO6JT.js} +1 -1
  36. package/dist/chunks/{chunk-JT2FJHD6.js → chunk-VJZXGDQF.js} +1 -1
  37. package/dist/chunks/{chunk-Q25JVERA.js → chunk-VPEZMMB2.js} +8 -8
  38. package/dist/chunks/{chunk-APOFTO4L.js → chunk-WN7JUMOK.js} +1 -1
  39. package/dist/chunks/{chunk-ZXOELYF3.js → chunk-WSCW4SPX.js} +1 -1
  40. package/dist/chunks/{chunk-4SM3YYY4.js → chunk-WZWJJR5A.js} +2 -2
  41. package/dist/chunks/{chunk-VPWTRMEY.js → chunk-XUSPMTX6.js} +1 -1
  42. package/dist/chunks/{chunk-KKYPJITI.js → chunk-YYV5IWAA.js} +1 -1
  43. package/dist/chunks/{chunk-IYKNBBWO.js → chunk-Z4F5TV2P.js} +1 -1
  44. package/dist/chunks/{chunk-TJLERGAI.js → chunk-Z7DILPDM.js} +1 -1
  45. package/dist/cli/figure.js +30 -30
  46. package/dist/cli/fold.js +5 -5
  47. package/dist/deletionEdges.js +1 -1
  48. package/dist/figure.js +25 -25
  49. package/dist/figureData.js +25 -25
  50. package/dist/figureScene.js +18 -18
  51. package/dist/figureSettings.js +6 -6
  52. package/dist/gbzCut.js +4 -4
  53. package/dist/gbzWindow.js +3 -3
  54. package/dist/gfa/departures.js +9 -3
  55. package/dist/gfa/gfaTables.js +2 -2
  56. package/dist/gfa/graphTables.js +2 -1
  57. package/dist/graphLabels.js +2 -2
  58. package/dist/index.js +40 -40
  59. package/dist/labelLayout.js +6 -6
  60. package/dist/layout/forceCache.js +6 -6
  61. package/dist/layout/tubeMapLayout.js +8 -8
  62. package/dist/layout/walkRowDraw.js +7 -7
  63. package/dist/layout/walkRowLayout.js +11 -11
  64. package/dist/layout/walkRowRuns.js +3 -3
  65. package/dist/layout/walkRows.js +4 -4
  66. package/dist/layout/walkStrip.js +12 -12
  67. package/dist/layoutModes.js +13 -13
  68. package/dist/pathColors.js +3 -3
  69. package/dist/pipeline.js +5 -5
  70. package/dist/referenceStrip.js +6 -6
  71. package/dist/renderer/GeometryBuilder.js +5 -5
  72. package/dist/tubeMap/axis.js +3 -3
  73. package/dist/tubeMap/bundle.js +9 -9
  74. package/dist/tubeMap/coarsen.js +9 -9
  75. package/dist/tubeMap/deviations.js +10 -10
  76. package/dist/tubeMap/draw.js +5 -5
  77. package/dist/tubeMap/genes.js +4 -4
  78. package/dist/tubeMap/nodeColors.js +6 -6
  79. package/dist/types/gfa/departures.d.ts +41 -2
  80. package/dist/types/gfa/graphTables.d.ts +21 -1
  81. package/dist/types/layout/deletionRoutes.d.ts +1 -0
  82. package/dist/types/layout/walkRowRuns.d.ts +1 -0
  83. package/dist/types/layout/walkRows.d.ts +1 -0
  84. package/dist/types/types.d.ts +2 -0
  85. package/dist/types/version.d.ts +1 -1
  86. package/dist/util/SpatialIndex.js +3 -3
  87. package/dist/util/edgeCurves.js +2 -2
  88. package/dist/util/hitDetection.js +4 -4
  89. package/dist/version.js +1 -1
  90. package/dist/viewport.js +6 -6
  91. package/dist/walkEncoding.js +6 -6
  92. package/dist/walkHighlight.js +8 -8
  93. package/dist/walkKey.js +4 -4
  94. package/package.json +2 -2
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  bubbleHalos,
3
3
  coversGraph
4
- } from "../chunks/chunk-IYKNBBWO.js";
5
- import "../chunks/chunk-H57ETH4Y.js";
4
+ } from "../chunks/chunk-Z4F5TV2P.js";
5
+ import "../chunks/chunk-KA44XBBV.js";
6
6
  import "../chunks/chunk-FX4RDMDN.js";
7
- import "../chunks/chunk-74A3MFUM.js";
7
+ import "../chunks/chunk-A5AMM5PI.js";
8
8
  import "../chunks/chunk-HMXCN6PG.js";
9
9
  import "../chunks/chunk-S43IBA5Y.js";
10
10
  import "../chunks/chunk-HNNP5QUN.js";
11
- import "../chunks/chunk-TJLERGAI.js";
11
+ import "../chunks/chunk-Z7DILPDM.js";
12
12
  import "../chunks/chunk-L2FHURWV.js";
13
13
  import "../chunks/chunk-QBI6SC74.js";
14
14
  import "../chunks/chunk-JJV2GT2Z.js";
@@ -3,13 +3,13 @@ import {
3
3
  BUBBLE_KIND_NAMES,
4
4
  bubbleSegmentIds,
5
5
  classifyBubble
6
- } from "../chunks/chunk-H57ETH4Y.js";
6
+ } from "../chunks/chunk-KA44XBBV.js";
7
7
  import "../chunks/chunk-FX4RDMDN.js";
8
- import "../chunks/chunk-74A3MFUM.js";
8
+ import "../chunks/chunk-A5AMM5PI.js";
9
9
  import "../chunks/chunk-HMXCN6PG.js";
10
10
  import "../chunks/chunk-S43IBA5Y.js";
11
11
  import "../chunks/chunk-HNNP5QUN.js";
12
- import "../chunks/chunk-TJLERGAI.js";
12
+ import "../chunks/chunk-Z7DILPDM.js";
13
13
  import "../chunks/chunk-L2FHURWV.js";
14
14
  import "../chunks/chunk-QBI6SC74.js";
15
15
  import "../chunks/chunk-JJV2GT2Z.js";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  graphBubbles,
3
3
  superbubblesFromGraph
4
- } from "../chunks/chunk-RJG2PDS4.js";
5
- import "../chunks/chunk-IYKNBBWO.js";
4
+ } from "../chunks/chunk-UDUJWSPF.js";
5
+ import "../chunks/chunk-Z4F5TV2P.js";
6
6
  import "../chunks/chunk-V6WSDZPL.js";
7
- import "../chunks/chunk-H57ETH4Y.js";
7
+ import "../chunks/chunk-KA44XBBV.js";
8
8
  import "../chunks/chunk-FX4RDMDN.js";
9
9
  import "../chunks/chunk-3LAOZB2I.js";
10
10
  import "../chunks/chunk-Q7OFBTBW.js";
11
11
  import "../chunks/chunk-L4DBSRA2.js";
12
- import "../chunks/chunk-74A3MFUM.js";
12
+ import "../chunks/chunk-A5AMM5PI.js";
13
13
  import "../chunks/chunk-HMXCN6PG.js";
14
14
  import "../chunks/chunk-S43IBA5Y.js";
15
15
  import "../chunks/chunk-HNNP5QUN.js";
16
- import "../chunks/chunk-TJLERGAI.js";
16
+ import "../chunks/chunk-Z7DILPDM.js";
17
17
  import "../chunks/chunk-L2FHURWV.js";
18
18
  import "../chunks/chunk-QBI6SC74.js";
19
19
  import "../chunks/chunk-JJV2GT2Z.js";
@@ -6,7 +6,7 @@ import {
6
6
  hasTubeMapPaths,
7
7
  tubeMapLayout,
8
8
  tubeMapReferenceLayout
9
- } from "./chunk-YI5HHKTR.js";
9
+ } from "./chunk-IDNMSP3V.js";
10
10
  import {
11
11
  anchoredLayout
12
12
  } from "./chunk-CNWAVRLF.js";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-Q7OFBTBW.js";
16
16
  import {
17
17
  walkRowLayout
18
- } from "./chunk-LJSZRCTZ.js";
18
+ } from "./chunk-TMUBRBAZ.js";
19
19
  import {
20
20
  withoutStrayHandles
21
21
  } from "./chunk-FGH4D6WT.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  engineKey,
3
3
  forceLayout
4
- } from "./chunk-RNROMUAS.js";
4
+ } from "./chunk-UEERU47W.js";
5
5
 
6
6
  // src/layout/forceCache.ts
7
7
  var DEFAULT_SIZE = 4;
@@ -3,28 +3,28 @@ import {
3
3
  } from "./chunk-CO6RGQAD.js";
4
4
  import {
5
5
  layoutModeByValue
6
- } from "./chunk-OROLXHDA.js";
6
+ } from "./chunk-2DA4DX5W.js";
7
7
  import {
8
8
  parseRegion
9
- } from "./chunk-IDYGRSNF.js";
9
+ } from "./chunk-TTSA2ML4.js";
10
10
  import {
11
11
  genePins
12
12
  } from "./chunk-HEYIAMTC.js";
13
13
  import {
14
14
  version
15
- } from "./chunk-IGQVO5L3.js";
15
+ } from "./chunk-QUH2EULL.js";
16
16
  import {
17
17
  axisScaleOf
18
- } from "./chunk-2TNFP3GC.js";
18
+ } from "./chunk-V52OO6JT.js";
19
19
  import {
20
20
  figureScene
21
- } from "./chunk-Q25JVERA.js";
21
+ } from "./chunk-VPEZMMB2.js";
22
22
  import {
23
23
  fadedKey
24
- } from "./chunk-STHPR76Q.js";
24
+ } from "./chunk-7HG3B4LW.js";
25
25
  import {
26
26
  encodingStops
27
- } from "./chunk-OC5HU7M3.js";
27
+ } from "./chunk-KAHJSU3Q.js";
28
28
  import {
29
29
  laneSlideAt,
30
30
  passesKey,
@@ -44,20 +44,20 @@ import {
44
44
  } from "./chunk-XWH4LB56.js";
45
45
  import {
46
46
  FIGURE_DEFAULTS
47
- } from "./chunk-5PQQ4IXZ.js";
47
+ } from "./chunk-B5PQ6BMI.js";
48
48
  import {
49
49
  engineSettingsOf,
50
50
  fitTransform,
51
51
  forceLayout,
52
52
  loadGraph
53
- } from "./chunk-RNROMUAS.js";
53
+ } from "./chunk-UEERU47W.js";
54
54
  import {
55
55
  referencePositions
56
56
  } from "./chunk-L4DBSRA2.js";
57
57
  import {
58
58
  dashedDeletions,
59
59
  deletionKey
60
- } from "./chunk-TJLERGAI.js";
60
+ } from "./chunk-Z7DILPDM.js";
61
61
  import {
62
62
  referenceVisitStarts
63
63
  } from "./chunk-QBI6SC74.js";
@@ -2,14 +2,14 @@ import {
2
2
  encodedColor,
3
3
  resolveEncoding,
4
4
  splitFamilies
5
- } from "./chunk-OC5HU7M3.js";
5
+ } from "./chunk-KAHJSU3Q.js";
6
6
  import {
7
7
  rampFraction
8
- } from "./chunk-UY7CLJNZ.js";
8
+ } from "./chunk-BHJWSWJK.js";
9
9
  import {
10
10
  departureAt,
11
11
  gapParts
12
- } from "./chunk-NPDW3JAD.js";
12
+ } from "./chunk-IPNRPZBI.js";
13
13
  import {
14
14
  pathOrigin,
15
15
  referenceVisitStarts
@@ -55,12 +55,44 @@ function highlightOf(graph, name, { byId, edgeAt }) {
55
55
  }
56
56
  const lengthOf = (id) => byId.get(id)?.length ?? 0;
57
57
  const bpOf = (path) => path.nodeIds.reduce((sum, id) => sum + lengthOf(id), 0);
58
- const bp = pieces.reduce((sum, piece) => sum + bpOf(piece), 0);
58
+ const origin = pathOrigin(name).name;
59
+ const stated = (graph.gaps ?? []).filter(
60
+ (g) => g.edge <= 2 && pathOrigin(g.name).name === origin
61
+ );
62
+ const stretches = new Map(stated.map((g) => [`${g.start} ${g.end}`, g]));
63
+ const endOf = (piece) => (piece.start ?? 0) + (piece.abridged?.bp ?? bpOf(piece));
64
+ const drawnBp = (gap) => gap.segments.reduce(
65
+ (sum, x) => sum + (x.kind === "steps" ? x.nodes.reduce((total, id) => total + lengthOf(id), 0) : x.bp),
66
+ 0
67
+ );
68
+ const between = (p) => {
69
+ const a = pieces[p - 1];
70
+ const b = pieces[p];
71
+ const gap = a?.start !== void 0 && b?.start !== void 0 ? stretches.get(`${endOf(a)} ${b.start}`) : void 0;
72
+ return gap && drawnBp(gap) === gap.end - gap.start ? gap : void 0;
73
+ };
74
+ const rowEnds = stated.filter(
75
+ (g) => g.edge !== 0 && drawnBp(g) === g.end - g.start
76
+ );
77
+ const attached = [...pieces.map((_, p) => between(p)), ...rowEnds].flatMap(
78
+ (gap) => {
79
+ let at = gap?.start ?? 0;
80
+ return (gap?.segments ?? []).flatMap((x) => {
81
+ const start = at;
82
+ at += x.bp;
83
+ return x.kind === "steps" && x.nodes.length > 0 ? [{ name: first.name, nodeIds: x.nodes, start }] : [];
84
+ });
85
+ }
86
+ );
87
+ const walked = [...pieces, ...attached].sort(
88
+ (a, b) => (a.start ?? 0) - (b.start ?? 0)
89
+ );
90
+ const bp = walked.reduce((sum, piece) => sum + bpOf(piece), 0);
59
91
  const extentOf = (ps) => {
60
92
  const start = Math.min(...ps.map((p) => p.start ?? Infinity));
61
93
  return Number.isFinite(start) ? { start, end: Math.max(...ps.map((p) => (p.start ?? 0) + bpOf(p))) } : void 0;
62
94
  };
63
- const extent = extentOf(pieces);
95
+ const extent = extentOf(walked);
64
96
  const range = extent && {
65
97
  contig: first.contig ?? panSNContig(pathOrigin(name).name),
66
98
  ...extent
@@ -73,7 +105,7 @@ function highlightOf(graph, name, { byId, edgeAt }) {
73
105
  const passes = /* @__PURE__ */ new Map();
74
106
  let mostPasses = 1;
75
107
  let before = 0;
76
- for (const piece of pieces) {
108
+ for (const piece of walked) {
77
109
  if (range) {
78
110
  before = Math.max(before, (piece.start ?? 0) - range.start);
79
111
  }
@@ -106,9 +138,21 @@ function highlightOf(graph, name, { byId, edgeAt }) {
106
138
  const departures = departuresOf(graph, name);
107
139
  let missingBp = 0;
108
140
  let ownBp = 0;
141
+ const countOwn = (gap) => {
142
+ for (const x of gap.segments) {
143
+ if (x.kind === "own") {
144
+ const missing = Math.min(x.missingBp, x.bp);
145
+ missingBp += missing;
146
+ ownBp += x.bp - missing;
147
+ }
148
+ }
149
+ };
109
150
  let end;
110
151
  pieces.forEach((piece, p) => {
111
- if (end !== void 0 && piece.start !== void 0 && piece.start > end) {
152
+ const gap = between(p);
153
+ if (gap) {
154
+ countOwn(gap);
155
+ } else if (end !== void 0 && piece.start !== void 0 && piece.start > end) {
112
156
  for (const part of gapParts(
113
157
  end,
114
158
  piece.start,
@@ -121,6 +165,7 @@ function highlightOf(graph, name, { byId, edgeAt }) {
121
165
  }
122
166
  end = piece.start === void 0 ? void 0 : piece.start + bpOf(piece);
123
167
  });
168
+ rowEnds.forEach(countOwn);
124
169
  const reference = isReference(graph, name);
125
170
  const referenceSpan = () => {
126
171
  const referencePieces = reference ? [] : (graph.paths ?? []).filter((p) => isReference(graph, p.name));
@@ -140,8 +185,8 @@ function highlightOf(graph, name, { byId, edgeAt }) {
140
185
  passProgress,
141
186
  passes,
142
187
  mostPasses,
143
- route: pieces.map((piece) => piece.nodeIds),
144
- steps: pieces.reduce((sum, piece) => sum + piece.nodeIds.length, 0),
188
+ route: walked.map((piece) => piece.nodeIds),
189
+ steps: walked.reduce((sum, piece) => sum + piece.nodeIds.length, 0),
145
190
  bp,
146
191
  referenceBp: referenceSpan(),
147
192
  missingBp,
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-HNNP5QUN.js";
11
11
  import {
12
12
  edgeCurvesOf
13
- } from "./chunk-TJLERGAI.js";
13
+ } from "./chunk-Z7DILPDM.js";
14
14
  import {
15
15
  curveBounds,
16
16
  curveMidpoint,
@@ -1,3 +1,6 @@
1
+ import {
2
+ stretchSegments
3
+ } from "./chunk-IPNRPZBI.js";
1
4
  import {
2
5
  PathVisits
3
6
  } from "./chunk-BEUTROKU.js";
@@ -76,7 +79,7 @@ function tableNodeIds({ nodes: n, links: l, walks: w }, traversals) {
76
79
  (segment, i) => `${segment}${canonical[i] === 2 ? "-" : "+"}`
77
80
  );
78
81
  }
79
- function graphFromTables({ nodes: n, links: l, walks: w, departures }, name = "Imported GFA") {
82
+ function graphFromTables({ nodes: n, links: l, walks: w, departures, gaps }, name = "Imported GFA") {
80
83
  const count = n.names.length;
81
84
  const declared = n.lengths.length;
82
85
  const drawnWalks = [];
@@ -263,9 +266,19 @@ function graphFromTables({ nodes: n, links: l, walks: w, departures }, name = "I
263
266
  samples: pathSamples
264
267
  }) : void 0,
265
268
  anchoredBy: nodes.some((node) => node.stable) ? "tags" : void 0,
266
- ...departures.names.length > 0 ? { departures } : {}
269
+ ...departures.names.length > 0 ? { departures } : {},
270
+ ...gaps && gaps.names.length > 0 ? { gaps: graphGaps(gaps, ids) } : {}
267
271
  };
268
272
  }
273
+ function graphGaps(t, ids) {
274
+ return t.names.map((name, g) => ({
275
+ name,
276
+ edge: t.edges[g],
277
+ start: t.starts[g],
278
+ end: t.ends[g],
279
+ segments: stretchSegments(t, g, (i) => ids[i])
280
+ }));
281
+ }
269
282
  function graphTablesGFA({
270
283
  nodes,
271
284
  links,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ENGINE_DEFAULTS
3
- } from "./chunk-RNROMUAS.js";
3
+ } from "./chunk-UEERU47W.js";
4
4
 
5
5
  // src/figureSettings.ts
6
6
  var FIGURE_DEFAULTS = {
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  tableNodeIds,
3
3
  tablePath
4
- } from "./chunk-DBLRFSET.js";
4
+ } from "./chunk-A65QHIGX.js";
5
5
  import {
6
6
  departureAt,
7
7
  departureSpan,
8
8
  gapParts,
9
- placementChoice
10
- } from "./chunk-NPDW3JAD.js";
9
+ placementChoice,
10
+ segmentPart,
11
+ stretchSegments
12
+ } from "./chunk-IPNRPZBI.js";
11
13
  import {
12
14
  pathOrigin
13
15
  } from "./chunk-QBI6SC74.js";
@@ -31,10 +33,13 @@ var GAP_CAUSES = [
31
33
  "elsewhere",
32
34
  "own",
33
35
  "abridged",
34
- "departure"
36
+ "departure",
37
+ "mixed",
38
+ "unread"
35
39
  ];
36
40
  var CAUSE_SHIFT = 3;
37
41
  var causeFlags = (cause) => GAP_CAUSES.indexOf(cause) << CAUSE_SHIFT;
42
+ var stretchKey = (name, start, end) => `${pathOrigin(name).name} ${start} ${end}`;
38
43
  function referenceOf(names, referencePath, rankZero) {
39
44
  return referencePath !== void 0 && names.includes(referencePath) ? referencePath : names.find((n) => rankZero.has(n)) ?? names[0];
40
45
  }
@@ -88,6 +93,18 @@ function graphPieces(graph) {
88
93
  }
89
94
  to[p] = steps.length;
90
95
  });
96
+ const between = /* @__PURE__ */ new Map();
97
+ for (const gap of graph.gaps ?? []) {
98
+ if (gap.edge === 0) {
99
+ between.set(
100
+ stretchKey(gap.name, gap.start, gap.end),
101
+ gap.segments.map((segment) => ({
102
+ ...segment,
103
+ nodes: segment.nodes.map(indexOf)
104
+ }))
105
+ );
106
+ }
107
+ }
91
108
  return {
92
109
  heads,
93
110
  from,
@@ -97,7 +114,8 @@ function graphPieces(graph) {
97
114
  names,
98
115
  reference,
99
116
  stableStart: (node) => stable.get(node) ?? Number.NaN,
100
- departures: graph.departures
117
+ departures: graph.departures,
118
+ gapsBetween: (name, start, end) => between.get(stretchKey(name, start, end))
101
119
  };
102
120
  }
103
121
  function tablePieces(tables, referencePath, visits) {
@@ -132,9 +150,22 @@ function tablePieces(tables, referencePath, visits) {
132
150
  names: visits ? tableNodeIds(tables) : n.names,
133
151
  reference,
134
152
  stableStart: (node) => node < n.lengths.length && n.ranks[node] === 0 && onReferenceContig(n.refNames[n.refs[node]]) ? n.starts[node] : Number.NaN,
135
- departures: tables.departures
153
+ departures: tables.departures,
154
+ gapsBetween: tableGaps(tables.gaps)
136
155
  };
137
156
  }
157
+ function tableGaps(t) {
158
+ const between = /* @__PURE__ */ new Map();
159
+ t?.names.forEach((name, g) => {
160
+ if (t.edges[g] === 0) {
161
+ between.set(
162
+ stretchKey(name, t.starts[g], t.ends[g]),
163
+ stretchSegments(t, g, (i) => i)
164
+ );
165
+ }
166
+ });
167
+ return (name, start, end) => between.get(stretchKey(name, start, end));
168
+ }
138
169
  function sampleOf(path) {
139
170
  return path.sample ?? panSNSample(path.name);
140
171
  }
@@ -149,7 +180,7 @@ var Columns = class {
149
180
  get length() {
150
181
  return this.values[0].length;
151
182
  }
152
- push(a, b, c, d, e) {
183
+ push(a, b, c, d, e, f) {
153
184
  const v = this.values;
154
185
  v[0].push(a);
155
186
  v[1].push(b);
@@ -158,6 +189,9 @@ var Columns = class {
158
189
  if (e !== void 0) {
159
190
  v[4].push(e);
160
191
  }
192
+ if (f !== void 0) {
193
+ v[5].push(f);
194
+ }
161
195
  }
162
196
  endRow() {
163
197
  this.offsets.push(this.length);
@@ -193,7 +227,8 @@ function walkRowRuns(source, region, o = {}) {
193
227
  names,
194
228
  reference,
195
229
  stableStart,
196
- departures
230
+ departures,
231
+ gapsBetween
197
232
  } = "walks" in source ? tablePieces(source, o.referencePath, o.visits) : graphPieces(source);
198
233
  const declared = lengths.length;
199
234
  const lengthOf = (node) => node < declared ? lengths[node] : 0;
@@ -247,7 +282,7 @@ function walkRowRuns(source, region, o = {}) {
247
282
  }
248
283
  }
249
284
  const flanked = cut === void 0 || flankEnd > -Infinity && flankStart < Infinity;
250
- const runs = new Columns(5);
285
+ const runs = new Columns(6);
251
286
  const visits = o.visits ? new Columns(4) : void 0;
252
287
  let steps = new Int32Array(0);
253
288
  let stepStart = new Float64Array(0);
@@ -274,6 +309,7 @@ function walkRowRuns(source, region, o = {}) {
274
309
  end - start2,
275
310
  Number.NaN,
276
311
  RUN_GAP | causeFlags("departure"),
312
+ Number.NaN,
277
313
  Number.NaN
278
314
  );
279
315
  gapBp += end - start2;
@@ -328,7 +364,55 @@ function walkRowRuns(source, region, o = {}) {
328
364
  const covered = Math.min(owed, Math.max(jump, 0));
329
365
  owed -= covered;
330
366
  const gap = jump - covered;
331
- if (gap > 0) {
367
+ const segments = gap > 0 && covered === 0 ? gapsBetween(nameOf(previous), end, start2) : void 0;
368
+ const segmentsBp = segments?.reduce(
369
+ (sum, x) => sum + (x.kind === "steps" ? x.nodes.reduce((bp3, node) => bp3 + lengthOf(node), 0) : x.bp),
370
+ 0
371
+ );
372
+ if (segments && segmentsBp === gap) {
373
+ const need = segments.reduce((n, x) => n + x.nodes.length + 1, count);
374
+ if (length + need > steps.length) {
375
+ const grownSteps = new Int32Array((length + need) * 2);
376
+ const grownStarts = new Float64Array((length + need) * 2);
377
+ grownSteps.set(steps.subarray(0, length));
378
+ grownStarts.set(stepStart.subarray(0, length));
379
+ steps = grownSteps;
380
+ stepStart = grownStarts;
381
+ }
382
+ let at = end;
383
+ let parts = [];
384
+ let partsBp = 0;
385
+ const flush = () => {
386
+ if (partsBp > 0) {
387
+ partsAt.set(length, parts);
388
+ steps[length] = -partsBp;
389
+ stepStart[length++] = at - partsBp;
390
+ }
391
+ parts = [];
392
+ partsBp = 0;
393
+ };
394
+ for (const x of segments) {
395
+ if (x.kind === "steps") {
396
+ flush();
397
+ for (const node of x.nodes) {
398
+ steps[length] = node;
399
+ stepStart[length++] = at;
400
+ at += lengthOf(node);
401
+ }
402
+ } else if (x.bp > 0) {
403
+ if (x.kind === "abridged") {
404
+ flush();
405
+ }
406
+ parts.push(segmentPart(x));
407
+ partsBp += x.bp;
408
+ at += x.bp;
409
+ if (x.kind === "abridged") {
410
+ flush();
411
+ }
412
+ }
413
+ }
414
+ flush();
415
+ } else if (gap > 0) {
332
416
  partsAt.set(
333
417
  length,
334
418
  gapParts(
@@ -564,7 +648,8 @@ function walkRowRuns(source, region, o = {}) {
564
648
  part.bp,
565
649
  Number.NaN,
566
650
  RUN_GAP | causeFlags(part.cause),
567
- part.near ?? Number.NaN
651
+ part.near ?? Number.NaN,
652
+ part.missingBp ?? Number.NaN
568
653
  );
569
654
  bp2 += part.bp;
570
655
  }
@@ -596,7 +681,7 @@ function walkRowRuns(source, region, o = {}) {
596
681
  } else {
597
682
  lastFlags = on ? RUN_ON_REFERENCE : 0;
598
683
  lastRef = on ? at : Number.NaN;
599
- runs.push(bp2, len, lastRef, lastFlags, Number.NaN);
684
+ runs.push(bp2, len, lastRef, lastFlags, Number.NaN, Number.NaN);
600
685
  last = runs.length - 1;
601
686
  step = 0;
602
687
  }
@@ -670,9 +755,10 @@ function walkRowRuns(source, region, o = {}) {
670
755
  float64,
671
756
  float64,
672
757
  (n) => new Uint8Array(n),
758
+ float64,
673
759
  float64
674
760
  ]);
675
- const [start, bp, referenceStart, flags, near] = columns;
761
+ const [start, bp, referenceStart, flags, near, missing] = columns;
676
762
  return {
677
763
  origin: cut ? cut.start : startOf(first) ?? 0,
678
764
  rows: [referenceRow, ...rows.map((r) => r.meta)],
@@ -682,6 +768,7 @@ function walkRowRuns(source, region, o = {}) {
682
768
  referenceStart,
683
769
  flags,
684
770
  near,
771
+ missing,
685
772
  visits: visits && visitColumns(visits, order, names)
686
773
  };
687
774
  }
@@ -733,6 +820,10 @@ function runAt(t, k) {
733
820
  if (!Number.isNaN(near)) {
734
821
  run.near = near;
735
822
  }
823
+ const missing = t.missing[k];
824
+ if (!Number.isNaN(missing)) {
825
+ run.missingBp = missing;
826
+ }
736
827
  } else {
737
828
  run.referenceStart = Number.isNaN(t.referenceStart[k]) ? void 0 : t.referenceStart[k];
738
829
  }
@@ -28,10 +28,10 @@ import {
28
28
  PATH_SATURATION,
29
29
  nameHue,
30
30
  pathHueAt
31
- } from "./chunk-KKYPJITI.js";
31
+ } from "./chunk-YYV5IWAA.js";
32
32
  import {
33
33
  baseEdgeCurves
34
- } from "./chunk-ZXOELYF3.js";
34
+ } from "./chunk-WSCW4SPX.js";
35
35
  import {
36
36
  referenceMidpoints
37
37
  } from "./chunk-L4DBSRA2.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  READOUT_ROOM,
3
3
  longestBar
4
- } from "./chunk-LJSZRCTZ.js";
4
+ } from "./chunk-TMUBRBAZ.js";
5
5
  import {
6
6
  alongRow,
7
7
  barEnd,
8
8
  boxesGenes,
9
9
  rowPitch,
10
10
  rowSpan
11
- } from "./chunk-2HR33HEK.js";
11
+ } from "./chunk-TDA7YJ7Q.js";
12
12
  import {
13
13
  LABEL_CHAR_PX
14
14
  } from "./chunk-S43IBA5Y.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EdgeSpatialIndex,
3
3
  SpatialIndex
4
- } from "./chunk-7UMGBTJJ.js";
4
+ } from "./chunk-TLKWIPDZ.js";
5
5
  import {
6
6
  weakMemo
7
7
  } from "./chunk-HMXCN6PG.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pathSteps
3
- } from "./chunk-YI5HHKTR.js";
3
+ } from "./chunk-IDNMSP3V.js";
4
4
  import {
5
5
  pathOrigin
6
6
  } from "./chunk-QBI6SC74.js";