@jbrowse/bandage-core 11.5.0 → 11.7.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 (147) hide show
  1. package/dist/alleleProjection/projectAlleles.js +1 -1
  2. package/dist/bubbles/bubbleHalos.js +9 -6
  3. package/dist/bubbles/classifyBubble.js +8 -5
  4. package/dist/bubbles/popBubble.js +3 -3
  5. package/dist/bubbles/superbubbles.js +11 -11
  6. package/dist/chunks/{chunk-4XWZNPQ2.js → chunk-2JL2JVZ2.js} +1 -1
  7. package/dist/chunks/{chunk-BZFOFC4D.js → chunk-2VMKQKVO.js} +17 -7
  8. package/dist/chunks/{chunk-HN3WHMPJ.js → chunk-2XEAITWM.js} +15 -5
  9. package/dist/chunks/{chunk-7BTO7MZS.js → chunk-376YFQOY.js} +2 -2
  10. package/dist/chunks/{chunk-B5X2RLJG.js → chunk-3YBP46PB.js} +27 -2
  11. package/dist/chunks/{chunk-EJRJAAN7.js → chunk-4DMSPNYV.js} +47 -27
  12. package/dist/chunks/{chunk-OMUPUB4J.js → chunk-56L6R6D2.js} +2 -2
  13. package/dist/chunks/{chunk-C44YRP5F.js → chunk-5OJZV6YT.js} +3 -2
  14. package/dist/chunks/{chunk-234NFZS4.js → chunk-5ORP7EFJ.js} +1 -1
  15. package/dist/chunks/{chunk-XKZ56L5A.js → chunk-5ZQKQ24Z.js} +1 -1
  16. package/dist/chunks/{chunk-VD4MLYEK.js → chunk-65YCFVS4.js} +2 -2
  17. package/dist/chunks/{chunk-3VCKBSML.js → chunk-6YRSOL4K.js} +2 -2
  18. package/dist/chunks/{chunk-NJGYLYU7.js → chunk-7L7MN2OM.js} +6 -3
  19. package/dist/chunks/{chunk-TRGKMLXT.js → chunk-A7Q7RTWX.js} +26 -19
  20. package/dist/chunks/{chunk-77EGQQJU.js → chunk-BFUS3ENH.js} +2 -2
  21. package/dist/chunks/{chunk-TGUFT6KK.js → chunk-BLUEFYIR.js} +4 -1
  22. package/dist/chunks/{chunk-3GP3KT5L.js → chunk-BW2NMXRV.js} +5 -5
  23. package/dist/chunks/{chunk-IOWLTUEB.js → chunk-BXE3SBBN.js} +1 -1
  24. package/dist/chunks/{chunk-2E25TX4G.js → chunk-C6E6HXP5.js} +4 -4
  25. package/dist/chunks/{chunk-5I3K4R2G.js → chunk-CFXXFHRK.js} +2 -1
  26. package/dist/chunks/{chunk-JMABOQWL.js → chunk-CO6RGQAD.js} +1 -6
  27. package/dist/chunks/{chunk-5F4D35U5.js → chunk-DD5EZG3T.js} +3 -3
  28. package/dist/chunks/{chunk-AKLSY4GD.js → chunk-DTEXQ65J.js} +1 -1
  29. package/dist/chunks/{chunk-VQ7474EH.js → chunk-DUREQSOJ.js} +9 -8
  30. package/dist/chunks/{chunk-CGMSKIEO.js → chunk-DV5B5UU7.js} +55 -8
  31. package/dist/chunks/{chunk-KOJKFNCW.js → chunk-EH5JZETS.js} +26 -12
  32. package/dist/chunks/{chunk-G6UIYQZR.js → chunk-EQDQ7P4Y.js} +3 -2
  33. package/dist/chunks/{chunk-J3JODFDF.js → chunk-FNDNSDKW.js} +3 -3
  34. package/dist/chunks/{chunk-64FCX424.js → chunk-G7SG4XMK.js} +62 -14
  35. package/dist/chunks/{chunk-6EOB6ANX.js → chunk-GZ36HNPJ.js} +1 -1
  36. package/dist/chunks/{chunk-A32ZKSHN.js → chunk-HELOUO6K.js} +5 -5
  37. package/dist/chunks/{chunk-PQBALYSO.js → chunk-HERVZPWA.js} +16 -16
  38. package/dist/chunks/{chunk-3U3C4PRK.js → chunk-HMEAGAGC.js} +3 -3
  39. package/dist/chunks/{chunk-WC6HX6GJ.js → chunk-IJCSW6MV.js} +2 -2
  40. package/dist/chunks/{chunk-JOWKKQAL.js → chunk-JGHZ3N34.js} +14 -9
  41. package/dist/chunks/{chunk-PSCSZSVK.js → chunk-KA4F3N55.js} +4 -4
  42. package/dist/chunks/{chunk-SOMZGDVS.js → chunk-KJDERUQF.js} +1 -1
  43. package/dist/chunks/{chunk-E4ZM4OOJ.js → chunk-KZMSSPS6.js} +2 -2
  44. package/dist/chunks/{chunk-EIY2SKD3.js → chunk-LG2UK4MB.js} +2 -1
  45. package/dist/chunks/{chunk-PNMJFFNB.js → chunk-MHZTTLBU.js} +1 -1
  46. package/dist/chunks/{chunk-K5LDBMLX.js → chunk-NTKWT6XL.js} +1 -1
  47. package/dist/chunks/{chunk-WA5WNP6V.js → chunk-OYCQVJYY.js} +1 -1
  48. package/dist/chunks/{chunk-JOLLU34X.js → chunk-PQIFYQVI.js} +1 -1
  49. package/dist/chunks/{chunk-EGBBIXTG.js → chunk-QCOVHLJO.js} +1 -1
  50. package/dist/chunks/{chunk-A7H753BA.js → chunk-SDI6BVG7.js} +5 -6
  51. package/dist/chunks/{chunk-FWSERUJV.js → chunk-SENPGW4O.js} +1 -1
  52. package/dist/chunks/{chunk-RK3HRRCW.js → chunk-SIA75TEG.js} +6 -7
  53. package/dist/chunks/{chunk-A4JDEUAI.js → chunk-SNF2MIEF.js} +1 -1
  54. package/dist/chunks/{chunk-D4ZFRBB4.js → chunk-SVPR7IZO.js} +4 -4
  55. package/dist/chunks/{chunk-PFRQBCGC.js → chunk-T3H5ELLA.js} +4 -4
  56. package/dist/chunks/{chunk-FFHJGWDK.js → chunk-TUMJNAOL.js} +5 -5
  57. package/dist/chunks/{chunk-UBQSRCWR.js → chunk-VACK24HF.js} +43 -3
  58. package/dist/chunks/{chunk-HSVFCA2J.js → chunk-VO6FKNZE.js} +1 -1
  59. package/dist/chunks/{chunk-DZR37KXT.js → chunk-VSSIYQYF.js} +1 -1
  60. package/dist/chunks/{chunk-3BCVMZUT.js → chunk-WWIUC4N4.js} +10 -10
  61. package/dist/chunks/{chunk-GJU6BJJA.js → chunk-XR2HMGAS.js} +1 -1
  62. package/dist/chunks/{chunk-WG5D2H7X.js → chunk-YER6TUXV.js} +11 -11
  63. package/dist/chunks/{chunk-7EDGWT67.js → chunk-YEYQFNFQ.js} +1 -1
  64. package/dist/chunks/{chunk-UFUSPK2A.js → chunk-YYIU7P73.js} +4 -1
  65. package/dist/chunks/{chunk-CRCD3ODN.js → chunk-ZANALBSX.js} +11 -3
  66. package/dist/chunks/{chunk-WLR4KJVI.js → chunk-ZHZRAYEM.js} +1 -1
  67. package/dist/chunks/{chunk-NMWQUFPF.js → chunk-ZKSC7QVE.js} +3 -3
  68. package/dist/cli/figure.js +53 -48
  69. package/dist/cli/fold.js +13 -13
  70. package/dist/deletionEdges.js +5 -2
  71. package/dist/facetGrid.js +2 -2
  72. package/dist/figure.js +37 -37
  73. package/dist/figureData.js +39 -39
  74. package/dist/figureScene.js +27 -27
  75. package/dist/figureSettings.js +13 -13
  76. package/dist/foldVariants.js +2 -2
  77. package/dist/gaf/parseGaf.js +1 -1
  78. package/dist/gbzCut.js +6 -6
  79. package/dist/gbzWindow.js +5 -5
  80. package/dist/genes/backboneGenes.js +4 -4
  81. package/dist/genes/geneFiles.js +1 -1
  82. package/dist/genes/genePins.js +3 -3
  83. package/dist/gfa/gfaConverter.js +5 -5
  84. package/dist/gfa/gfaTables.js +2 -2
  85. package/dist/gfa/graphTables.js +3 -3
  86. package/dist/gfa/walkStops.js +1 -1
  87. package/dist/gfa-core/gfaParser.js +1 -1
  88. package/dist/gfa-core/index.js +1 -1
  89. package/dist/graphLabels.js +7 -4
  90. package/dist/index.js +64 -64
  91. package/dist/labelLayout.js +11 -8
  92. package/dist/layout/anchoredLayout.js +1 -1
  93. package/dist/layout/forceCache.js +13 -13
  94. package/dist/layout/mergeRuns.js +2 -2
  95. package/dist/layout/placeOffReference.js +1 -1
  96. package/dist/layout/sampleRowLayout.js +2 -2
  97. package/dist/layout/trimToWindow.js +2 -2
  98. package/dist/layout/tubeMapLayout.js +15 -15
  99. package/dist/layout/walkRowDraw.js +15 -13
  100. package/dist/layout/walkRowLayout.js +8 -8
  101. package/dist/layout/walkRowLinks.js +1 -1
  102. package/dist/layout/walkRowRuns.js +5 -5
  103. package/dist/layout/walkRows.js +6 -6
  104. package/dist/layout/walkStrip.js +18 -18
  105. package/dist/layoutEngines.js +1 -1
  106. package/dist/layoutModes.js +18 -18
  107. package/dist/locus.js +1 -1
  108. package/dist/nodeWidths.js +5 -3
  109. package/dist/pansn.js +1 -1
  110. package/dist/pathAnchoring.js +4 -2
  111. package/dist/pathColors.js +8 -8
  112. package/dist/pipeline.js +12 -12
  113. package/dist/reference.js +2 -2
  114. package/dist/referenceStrip.js +12 -12
  115. package/dist/renderer/Canvas2DRenderer.js +1 -1
  116. package/dist/renderer/GeometryBuilder.js +11 -11
  117. package/dist/tubeMap/axis.js +8 -5
  118. package/dist/tubeMap/bundle.js +16 -16
  119. package/dist/tubeMap/coarsen.js +16 -16
  120. package/dist/tubeMap/deviations.js +19 -19
  121. package/dist/tubeMap/draw.js +11 -9
  122. package/dist/tubeMap/genes.js +9 -6
  123. package/dist/tubeMap/nodeColors.js +12 -12
  124. package/dist/tubeMap/reads.js +4 -4
  125. package/dist/types/figureData.d.ts +12 -0
  126. package/dist/types/gaf/parseGaf.d.ts +1 -1
  127. package/dist/types/gfa/graphTables.d.ts +2 -0
  128. package/dist/types/gfa/walkStops.d.ts +1 -1
  129. package/dist/types/layout/walkRowDraw.d.ts +2 -1
  130. package/dist/types/layout/walkRows.d.ts +1 -0
  131. package/dist/types/nodeWidths.d.ts +2 -1
  132. package/dist/types/pathAnchoring.d.ts +2 -0
  133. package/dist/types/renderer/Canvas2DRenderer.d.ts +2 -0
  134. package/dist/types/tubeMap/reads.d.ts +0 -1
  135. package/dist/types/types.d.ts +4 -0
  136. package/dist/types/util/geometry.d.ts +7 -1
  137. package/dist/types/version.d.ts +1 -1
  138. package/dist/util/SpatialIndex.js +7 -4
  139. package/dist/util/edgeCurves.js +6 -3
  140. package/dist/util/geometry.js +1 -1
  141. package/dist/util/hitDetection.js +8 -5
  142. package/dist/version.js +1 -1
  143. package/dist/viewport.js +13 -13
  144. package/dist/walkEncoding.js +12 -12
  145. package/dist/walkHighlight.js +14 -14
  146. package/dist/walkKey.js +9 -6
  147. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  polylineSlice
3
- } from "./chunk-BZFOFC4D.js";
3
+ } from "./chunk-2VMKQKVO.js";
4
4
  import {
5
5
  svgPath
6
- } from "./chunk-UBQSRCWR.js";
6
+ } from "./chunk-VACK24HF.js";
7
7
  import {
8
8
  firstNodeAtOrAfter,
9
9
  isAnchored
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  panSNFields
3
- } from "./chunk-4XWZNPQ2.js";
3
+ } from "./chunk-2JL2JVZ2.js";
4
4
 
5
5
  // src/facetGrid.ts
6
6
  var FACET_GAP_PX = 8;
@@ -43,6 +43,9 @@ function facetGrid({
43
43
  return tile(Math.max(1, Math.min(count, Math.round(columns))));
44
44
  }
45
45
  let best = tile(1);
46
+ if (pixelRows) {
47
+ return best;
48
+ }
46
49
  for (let across = 2; across <= count; across++) {
47
50
  const grid = tile(across);
48
51
  if (grid.scale > best.scale) {
@@ -1,12 +1,12 @@
1
- import {
2
- pathOrigin
3
- } from "./chunk-B5X2RLJG.js";
4
1
  import {
5
2
  groupDigits
6
- } from "./chunk-PFRQBCGC.js";
3
+ } from "./chunk-T3H5ELLA.js";
4
+ import {
5
+ pathOrigin
6
+ } from "./chunk-3YBP46PB.js";
7
7
  import {
8
8
  isGenericSample
9
- } from "./chunk-4XWZNPQ2.js";
9
+ } from "./chunk-2JL2JVZ2.js";
10
10
 
11
11
  // src/pathColors.ts
12
12
  function nameHue(name) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  walkRowRuns,
3
3
  walkRowsOf
4
- } from "./chunk-64FCX424.js";
4
+ } from "./chunk-G7SG4XMK.js";
5
5
 
6
6
  // src/layout/walkRows.ts
7
7
  function filterSamples(rows, samples) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  coversGraph
3
- } from "./chunk-E4ZM4OOJ.js";
3
+ } from "./chunk-KZMSSPS6.js";
4
4
  import {
5
5
  bubblesFromGraph,
6
6
  derivedBubble,
@@ -10,13 +10,13 @@ import {
10
10
  } from "./chunk-RFG42VIO.js";
11
11
  import {
12
12
  bubbleSegmentIds
13
- } from "./chunk-A4JDEUAI.js";
13
+ } from "./chunk-SNF2MIEF.js";
14
14
  import {
15
15
  bubbleSubgraph
16
- } from "./chunk-PNMJFFNB.js";
16
+ } from "./chunk-MHZTTLBU.js";
17
17
  import {
18
18
  strandSides
19
- } from "./chunk-UBQSRCWR.js";
19
+ } from "./chunk-VACK24HF.js";
20
20
  import {
21
21
  pushTo
22
22
  } from "./chunk-BSOZW3FC.js";
@@ -57,7 +57,8 @@ function parseGFA(file) {
57
57
  };
58
58
  for (const rawLine of file.split("\n")) {
59
59
  const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
60
- const type = line.split(" ", 1)[0];
60
+ const tab = line.indexOf(" ");
61
+ const type = tab === -1 ? line : line.slice(0, tab);
61
62
  if (type === "H") {
62
63
  const [, ...rest] = line.split(" ");
63
64
  graph.header.push(parseTags(rest));
@@ -18,13 +18,8 @@ function isLayoutEngineKind(value) {
18
18
  return LAYOUT_ENGINE_VALUES.includes(value);
19
19
  }
20
20
  var layoutEngine = async (request) => {
21
- if (request.options.engine === "stress") {
22
- const start2 = performance.now();
23
- const result2 = stressLayout(request);
24
- return { result: result2, duration: performance.now() - start2 };
25
- }
26
21
  const start = performance.now();
27
- const result = await fmmmLayout(request);
22
+ const result = request.options.engine === "stress" ? stressLayout(request) : await fmmmLayout(request);
28
23
  return { result, duration: performance.now() - start };
29
24
  };
30
25
 
@@ -3,10 +3,10 @@ import {
3
3
  hasTubeMapPaths,
4
4
  tubeMapLayout,
5
5
  tubeMapReferenceLayout
6
- } from "./chunk-RK3HRRCW.js";
6
+ } from "./chunk-SIA75TEG.js";
7
7
  import {
8
8
  sampleRowLayout
9
- } from "./chunk-GJU6BJJA.js";
9
+ } from "./chunk-XR2HMGAS.js";
10
10
  import {
11
11
  anchoredLayout
12
12
  } from "./chunk-GJLZ2MKE.js";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-UAFATXYA.js";
16
16
  import {
17
17
  walkRowLayout
18
- } from "./chunk-FWSERUJV.js";
18
+ } from "./chunk-SENPGW4O.js";
19
19
  import {
20
20
  isBackbone,
21
21
  isOffReference
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  engineKey,
3
3
  forceLayout
4
- } from "./chunk-WG5D2H7X.js";
4
+ } from "./chunk-YER6TUXV.js";
5
5
 
6
6
  // src/layout/forceCache.ts
7
7
  var DEFAULT_SIZE = 4;
@@ -1,24 +1,25 @@
1
1
  import {
2
2
  encodedColor,
3
3
  resolveEncoding
4
- } from "./chunk-HN3WHMPJ.js";
4
+ } from "./chunk-2XEAITWM.js";
5
5
  import {
6
6
  rampFraction
7
- } from "./chunk-JOWKKQAL.js";
8
- import {
9
- pathOrigin
10
- } from "./chunk-B5X2RLJG.js";
7
+ } from "./chunk-JGHZ3N34.js";
11
8
  import {
12
9
  gapParts
13
- } from "./chunk-EIY2SKD3.js";
10
+ } from "./chunk-LG2UK4MB.js";
11
+ import {
12
+ pathOrigin
13
+ } from "./chunk-3YBP46PB.js";
14
14
  import {
15
15
  panSNContig
16
- } from "./chunk-4XWZNPQ2.js";
16
+ } from "./chunk-2JL2JVZ2.js";
17
17
 
18
18
  // src/walkHighlight.ts
19
19
  var isReference = (graph, name) => !!graph.referencePath && pathOrigin(name).name === graph.referencePath;
20
20
  function piecesOf(graph, name) {
21
- return (graph.paths ?? []).filter((p) => p.name === name).sort((a, b) => (a.start ?? 0) - (b.start ?? 0));
21
+ const origin = pathOrigin(name).name;
22
+ return (graph.paths ?? []).filter((p) => pathOrigin(p.name).name === origin).sort((a, b) => (a.start ?? 0) - (b.start ?? 0));
22
23
  }
23
24
  var nodesById = (graph) => new Map(graph.nodes.map((n) => [n.id, n]));
24
25
  function graphIndex(graph) {
@@ -1,9 +1,12 @@
1
+ import {
2
+ referenceVisitStarts
3
+ } from "./chunk-3YBP46PB.js";
1
4
  import {
2
5
  computeEdgeCurves,
3
6
  edgeJoinOf,
4
7
  routedEdgeCurves,
5
8
  strandSides
6
- } from "./chunk-UBQSRCWR.js";
9
+ } from "./chunk-VACK24HF.js";
7
10
  import {
8
11
  groupBy
9
12
  } from "./chunk-BSOZW3FC.js";
@@ -11,6 +14,9 @@ import {
11
14
  firstNodeAtOrAfter,
12
15
  isBackbone
13
16
  } from "./chunk-RJWPJCIB.js";
17
+ import {
18
+ partitionPoint
19
+ } from "./chunk-HOAIOEI7.js";
14
20
 
15
21
  // src/deletionEdges.ts
16
22
  var MIN_DELETION_BP = 1;
@@ -70,22 +76,63 @@ function skipsBetween(edge, from, to, forwards) {
70
76
  const arrivesLeft = toStrand === (to.stable.strand ?? "+");
71
77
  return forwards ? leavesRight && arrivesLeft : !leavesRight && !arrivesLeft;
72
78
  }
79
+ function skippedSpan(edge, from, to, startsOf) {
80
+ let best;
81
+ for (const a of startsOf(from)) {
82
+ for (const b of startsOf(to)) {
83
+ const forwards = a <= b;
84
+ const span = forwards ? { start: a + from.length, end: b } : { start: b + to.length, end: a };
85
+ if (skipsBetween(edge, from, to, forwards) && (!best || Math.abs(span.end - span.start) < Math.abs(best.end - best.start))) {
86
+ best = span;
87
+ }
88
+ }
89
+ }
90
+ return best;
91
+ }
92
+ var COPY_SWITCH_SHARE = 0.01;
93
+ function repeatCopies(backbone, startsOf) {
94
+ const bySequence = /* @__PURE__ */ new Map();
95
+ for (const [refName, nodes] of backbone) {
96
+ const copies = nodes.flatMap((node) => {
97
+ const starts = startsOf(node);
98
+ return starts.slice(1).map((next, i) => ({
99
+ at: starts[i],
100
+ copy: next - starts[i]
101
+ }));
102
+ });
103
+ if (copies.length) {
104
+ bySequence.set(
105
+ refName,
106
+ copies.sort((a, b) => a.at - b.at)
107
+ );
108
+ }
109
+ }
110
+ return bySequence;
111
+ }
112
+ function switchesCopy(copies, start, bp) {
113
+ if (!copies) {
114
+ return false;
115
+ }
116
+ const i = partitionPoint(copies.length, (k) => copies[k].at < start);
117
+ const near = [copies[i - 1], copies[i]].filter((c) => c !== void 0).sort((a, b) => Math.abs(a.at - start) - Math.abs(b.at - start))[0];
118
+ return near !== void 0 && Math.abs(near.at - start) <= near.copy && Math.abs(bp - near.copy) <= near.copy * COPY_SWITCH_SHARE;
119
+ }
73
120
  function deletionEdges(graph) {
74
121
  const byId = new Map(graph.nodes.map((n) => [n.id, n]));
75
122
  const backbone = backboneBySequence(graph);
123
+ const startsOf = referenceVisitStarts(graph);
124
+ const copies = repeatCopies(backbone, startsOf);
76
125
  const found = [];
77
126
  for (let edgeIndex = 0; edgeIndex < graph.edges.length; edgeIndex++) {
78
127
  const edge = graph.edges[edgeIndex];
79
128
  const from = byId.get(edge.from);
80
129
  const to = byId.get(edge.to);
81
130
  if (from !== void 0 && to !== void 0 && isBackbone(from) && isBackbone(to) && from.stable.refName === to.stable.refName) {
82
- const forwards = from.stable.start <= to.stable.start;
83
- const [left, right] = forwards ? [from, to] : [to, from];
84
- const start = left.stable.start + left.length;
85
- const end = right.stable.start;
86
- const bp = end - start;
87
- if (bp >= MIN_DELETION_BP && skipsBetween(edge, from, to, forwards)) {
88
- const refName = left.stable.refName;
131
+ const span = skippedSpan(edge, from, to, startsOf);
132
+ const refName = from.stable.refName;
133
+ const bp = span ? span.end - span.start : 0;
134
+ if (span && bp >= MIN_DELETION_BP && !switchesCopy(copies.get(refName), span.start, bp)) {
135
+ const { start, end } = span;
89
136
  found.push({
90
137
  edgeIndex,
91
138
  from: edge.from,
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  layoutEngine
3
- } from "./chunk-JMABOQWL.js";
3
+ } from "./chunk-CO6RGQAD.js";
4
4
  import {
5
5
  layoutModeByValue
6
- } from "./chunk-5F4D35U5.js";
6
+ } from "./chunk-DD5EZG3T.js";
7
7
  import {
8
8
  parseRegion
9
- } from "./chunk-J3JODFDF.js";
9
+ } from "./chunk-FNDNSDKW.js";
10
10
  import {
11
11
  genePins
12
- } from "./chunk-77EGQQJU.js";
12
+ } from "./chunk-BFUS3ENH.js";
13
13
  import {
14
14
  version
15
- } from "./chunk-WLR4KJVI.js";
15
+ } from "./chunk-ZHZRAYEM.js";
16
16
  import {
17
17
  axisScaleOf
18
- } from "./chunk-XKZ56L5A.js";
18
+ } from "./chunk-5ZQKQ24Z.js";
19
19
  import {
20
20
  figureScene
21
- } from "./chunk-3BCVMZUT.js";
21
+ } from "./chunk-WWIUC4N4.js";
22
22
  import {
23
23
  encodingStops
24
- } from "./chunk-HN3WHMPJ.js";
24
+ } from "./chunk-2XEAITWM.js";
25
25
  import {
26
26
  abgrAlpha,
27
27
  abgrBlue,
@@ -30,13 +30,16 @@ import {
30
30
  } from "./chunk-G2FD7S3C.js";
31
31
  import {
32
32
  FIGURE_DEFAULTS
33
- } from "./chunk-K5LDBMLX.js";
33
+ } from "./chunk-NTKWT6XL.js";
34
34
  import {
35
35
  engineSettingsOf,
36
36
  fitTransform,
37
37
  forceLayout,
38
38
  loadGraph
39
- } from "./chunk-WG5D2H7X.js";
39
+ } from "./chunk-YER6TUXV.js";
40
+ import {
41
+ referenceVisitStarts
42
+ } from "./chunk-3YBP46PB.js";
40
43
  import {
41
44
  isBackbone
42
45
  } from "./chunk-RJWPJCIB.js";
@@ -68,6 +71,7 @@ function figureData(graph, layout, o = {}) {
68
71
  const {
69
72
  bounds,
70
73
  colorScheme,
74
+ referenceRamp,
71
75
  drawnDeletions,
72
76
  lift,
73
77
  facets,
@@ -225,6 +229,7 @@ function figureData(graph, layout, o = {}) {
225
229
  }
226
230
  }
227
231
  }
232
+ const startsOf = referenceVisitStarts(graph);
228
233
  return {
229
234
  meta: {
230
235
  generator: `@jbrowse/bandage-core@${version}`,
@@ -234,7 +239,13 @@ function figureData(graph, layout, o = {}) {
234
239
  pixelRows,
235
240
  referenceAxis: layout.referenceAxis ?? false,
236
241
  colorScheme,
237
- referenceName: referenceName ?? null
242
+ referenceName: referenceName ?? null,
243
+ // the reference bp the position hues run between, hue 0 to 300
244
+ referenceRamp: referenceRamp ? {
245
+ start: referenceRamp.start,
246
+ end: referenceRamp.start + referenceRamp.span
247
+ } : null,
248
+ deletions: drawnDeletions.shown.length
238
249
  },
239
250
  panels: {
240
251
  panel: panels.map((p) => p.name),
@@ -253,7 +264,10 @@ function figureData(graph, layout, o = {}) {
253
264
  name: graph.nodes.map((n) => n.name),
254
265
  length: graph.nodes.map((n) => n.length),
255
266
  depth: graph.nodes.map((n) => n.depth),
256
- backbone: graph.nodes.map((n) => isBackbone(n))
267
+ backbone: graph.nodes.map((n) => isBackbone(n)),
268
+ referenceVisits: graph.nodes.map(
269
+ (n) => isBackbone(n) ? startsOf(n).length : 0
270
+ )
257
271
  },
258
272
  rowLabels: {
259
273
  label: (layout.rowLabels ?? []).map((r) => r.label),
@@ -136,13 +136,14 @@ function mergeOverlappingByName(genes) {
136
136
  }
137
137
  return out;
138
138
  }
139
+ var BED_HEADER = /^(#|track\s|browser\s)/;
139
140
  function genesFromBed(text) {
140
141
  const rows = [];
141
142
  for (const line of text.split("\n")) {
142
143
  const cols = line.replace(/\r$/, "").split(" ");
143
144
  const start = Number(cols[1]);
144
145
  const end = Number(cols[2]);
145
- if (/^(#|track|browser)/.test(line) || cols.length < 3 || !Number.isInteger(start) || !(end > start)) {
146
+ if (BED_HEADER.test(line) || cols.length < 3 || !Number.isInteger(start) || !(end > start)) {
146
147
  continue;
147
148
  }
148
149
  const refName = cols[0];
@@ -165,7 +166,7 @@ function genesFromBed(text) {
165
166
  return mergeOverlappingByName(rows);
166
167
  }
167
168
  function sniffedFormat(text) {
168
- const first = text.split("\n", 1e3).find((l) => l.trim() !== "" && !/^(#|track|browser)/.test(l));
169
+ const first = text.split("\n", 1e3).find((l) => l.trim() !== "" && !BED_HEADER.test(l));
169
170
  const cols = first?.split(" ") ?? [];
170
171
  return /^\d+$/.test(cols[1] ?? "") && /^\d+$/.test(cols[2] ?? "") ? "bed" : "gff3";
171
172
  }
@@ -6,10 +6,10 @@ import {
6
6
  haplotypeWanted,
7
7
  referencePathQuery,
8
8
  referenceSamplesOf
9
- } from "./chunk-NMWQUFPF.js";
9
+ } from "./chunk-ZKSC7QVE.js";
10
10
  import {
11
11
  panSNSample
12
- } from "./chunk-4XWZNPQ2.js";
12
+ } from "./chunk-2JL2JVZ2.js";
13
13
 
14
14
  // src/gbzCut.ts
15
15
  import { GBZBase } from "@gmod/gbz-base";
@@ -25,7 +25,7 @@ function haplotypeIndexBeside(db) {
25
25
  return GBZ_DB.test(db) ? db.replace(GBZ_DB, ".haplotype-index.db") : void 0;
26
26
  }
27
27
  function parseRegion(text) {
28
- const m = /^\s*([^:\s]+):([\d,]+)-([\d,]+)\s*$/.exec(text);
28
+ const m = /^\s*(\S+?):([\d,]+)-([\d,]+)\s*$/.exec(text);
29
29
  if (!m) {
30
30
  throw new Error(
31
31
  `"${text}" is not a 0-based region like chr6:160,614,797-160,647,758`
@@ -1,26 +1,32 @@
1
1
  import {
2
2
  tableNodeIds,
3
3
  tablePath
4
- } from "./chunk-NJGYLYU7.js";
5
- import {
6
- pathOrigin
7
- } from "./chunk-B5X2RLJG.js";
4
+ } from "./chunk-7L7MN2OM.js";
8
5
  import {
9
6
  gapParts
10
- } from "./chunk-EIY2SKD3.js";
7
+ } from "./chunk-LG2UK4MB.js";
8
+ import {
9
+ pathOrigin
10
+ } from "./chunk-3YBP46PB.js";
11
11
  import {
12
12
  groupBy
13
13
  } from "./chunk-BSOZW3FC.js";
14
14
  import {
15
15
  panSNContig,
16
16
  panSNSample
17
- } from "./chunk-4XWZNPQ2.js";
17
+ } from "./chunk-2JL2JVZ2.js";
18
18
 
19
19
  // src/layout/walkRowRuns.ts
20
20
  var RUN_ON_REFERENCE = 1;
21
21
  var RUN_REVERSED = 2;
22
22
  var RUN_GAP = 4;
23
- var GAP_CAUSES = [void 0, "missing", "elsewhere", "unknown"];
23
+ var GAP_CAUSES = [
24
+ void 0,
25
+ "missing",
26
+ "elsewhere",
27
+ "unknown",
28
+ "abridged"
29
+ ];
24
30
  var CAUSE_SHIFT = 3;
25
31
  var causeFlags = (cause) => GAP_CAUSES.indexOf(cause) << CAUSE_SHIFT;
26
32
  function referenceOf(names, referencePath, rankZero) {
@@ -179,6 +185,7 @@ function walkRowRuns(source, region, o = {}) {
179
185
  const walks = groupBy(others, nameOf);
180
186
  const spanStart = new Float64Array(names.length).fill(Number.NaN);
181
187
  const spanEnd = new Float64Array(names.length);
188
+ const revisits = /* @__PURE__ */ new Map();
182
189
  let reachesBefore = false;
183
190
  let reachesAfter = false;
184
191
  const cut = region && region.end > region.start ? region : void 0;
@@ -187,7 +194,14 @@ function walkRowRuns(source, region, o = {}) {
187
194
  for (let s = from[piece], stop = to[piece]; s < stop; s++) {
188
195
  const node = all[s];
189
196
  const len = lengthOf(node);
190
- if (Number.isNaN(spanStart[node])) {
197
+ if (!Number.isNaN(spanStart[node])) {
198
+ const starts = revisits.get(node);
199
+ if (starts) {
200
+ starts.push(pos);
201
+ } else {
202
+ revisits.set(node, [spanStart[node], pos]);
203
+ }
204
+ } else {
191
205
  spanStart[node] = pos;
192
206
  spanEnd[node] = pos + len;
193
207
  if (cut) {
@@ -222,8 +236,10 @@ function walkRowRuns(source, region, o = {}) {
222
236
  const head = heads[pieces[0]];
223
237
  const ordered = [...pieces].sort(byStart);
224
238
  let count = ordered.length - 1;
239
+ let abridgedSteps = 0;
225
240
  for (const piece of ordered) {
226
- count += to[piece] - from[piece];
241
+ count += to[piece] - from[piece] + (heads[piece].abridged ? 1 : 0);
242
+ abridgedSteps += heads[piece].abridged?.steps ?? 0;
227
243
  }
228
244
  if (count > steps.length) {
229
245
  steps = new Int32Array(count * 2);
@@ -252,8 +268,16 @@ function walkRowRuns(source, region, o = {}) {
252
268
  stepStart[length++] = end;
253
269
  }
254
270
  let pos = start2 ?? 0;
271
+ const abridged = heads[piece].abridged;
255
272
  for (let s = from[piece], stop2 = to[piece]; s < stop2; s++) {
256
273
  const node = all[s];
274
+ const bp3 = abridged ? abridged.bp - (pos - (start2 ?? 0)) - lengthOf(node) : 0;
275
+ if (bp3 > 0 && s === stop2 - 1 && s > from[piece]) {
276
+ partsAt.set(length, [{ bp: bp3, cause: "abridged" }]);
277
+ steps[length] = -bp3;
278
+ stepStart[length++] = pos;
279
+ pos += bp3;
280
+ }
257
281
  steps[length] = node;
258
282
  stepStart[length++] = pos;
259
283
  pos += lengthOf(node);
@@ -345,6 +369,27 @@ function walkRowRuns(source, region, o = {}) {
345
369
  let last = -1;
346
370
  let lastFlags = 0;
347
371
  let lastRef = Number.NaN;
372
+ let cursor = Number.NaN;
373
+ const placeOf = (id) => {
374
+ const starts = revisits.get(id);
375
+ if (!starts || Number.isNaN(cursor)) {
376
+ return spanStart[id];
377
+ }
378
+ const len = lengthOf(id);
379
+ let best = starts[0];
380
+ let bestGap = Infinity;
381
+ for (const start2 of starts) {
382
+ const gap = Math.min(
383
+ Math.abs(start2 - cursor),
384
+ Math.abs(start2 + len - cursor)
385
+ );
386
+ if (gap < bestGap) {
387
+ best = start2;
388
+ bestGap = gap;
389
+ }
390
+ }
391
+ return best;
392
+ };
348
393
  const [, runBp, runRef, runFlags] = runs.values;
349
394
  for (let k = lo; k < hi; k++) {
350
395
  const index = backward ? hi - 1 - (k - lo) : k;
@@ -369,12 +414,12 @@ function walkRowRuns(source, region, o = {}) {
369
414
  continue;
370
415
  }
371
416
  const len = lengthOf(id);
372
- const at = spanStart[id];
417
+ const at = placeOf(id);
373
418
  const on = !Number.isNaN(at);
374
419
  visits?.push(id, bp2, len, on ? 1 : 0);
375
420
  const placed = last >= 0 && !Number.isNaN(lastRef);
376
421
  const forward = on && placed && step >= 0 && lastRef + (runBp[last] ?? 0) === at;
377
- const back = on && placed && step <= 0 && spanEnd[id] === lastRef;
422
+ const back = on && placed && step <= 0 && at + len === lastRef;
378
423
  if (!on && last >= 0 && !(lastFlags & (RUN_ON_REFERENCE | RUN_GAP))) {
379
424
  runBp[last] += len;
380
425
  } else if (forward || back) {
@@ -394,7 +439,9 @@ function walkRowRuns(source, region, o = {}) {
394
439
  step = 0;
395
440
  }
396
441
  bp2 += len;
397
- if (!on) {
442
+ if (on) {
443
+ cursor = step < 0 ? at : at + len;
444
+ } else {
398
445
  offReferenceBp += len;
399
446
  }
400
447
  }
@@ -410,7 +457,8 @@ function walkRowRuns(source, region, o = {}) {
410
457
  gapBp,
411
458
  complete,
412
459
  stop,
413
- axis
460
+ axis,
461
+ ...abridgedSteps > 0 ? { abridgedSteps } : {}
414
462
  };
415
463
  };
416
464
  const referenceRow = rowOf(referencePieces);
@@ -462,7 +510,7 @@ function runAt(t, k) {
462
510
  };
463
511
  if (f & RUN_GAP) {
464
512
  run.gap = true;
465
- const cause = GAP_CAUSES[f >> CAUSE_SHIFT & 3];
513
+ const cause = GAP_CAUSES[f >> CAUSE_SHIFT & 7];
466
514
  if (cause) {
467
515
  run.cause = cause;
468
516
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tubeSpan
3
- } from "./chunk-HSVFCA2J.js";
3
+ } from "./chunk-VO6FKNZE.js";
4
4
 
5
5
  // src/tubeMap/genes.ts
6
6
  function tubeMapGenes(byRefName, genes) {
@@ -3,20 +3,20 @@ import {
3
3
  boxesGenes,
4
4
  rowPitch,
5
5
  rowSpan
6
- } from "./chunk-TRGKMLXT.js";
6
+ } from "./chunk-A7Q7RTWX.js";
7
7
  import {
8
8
  el
9
9
  } from "./chunk-H2H4Y3TV.js";
10
10
  import {
11
11
  READOUT_ROOM,
12
12
  longestBar
13
- } from "./chunk-FWSERUJV.js";
14
- import {
15
- pathOrigin
16
- } from "./chunk-B5X2RLJG.js";
13
+ } from "./chunk-SENPGW4O.js";
17
14
  import {
18
15
  LABEL_CHAR_PX
19
16
  } from "./chunk-AB35TJST.js";
17
+ import {
18
+ pathOrigin
19
+ } from "./chunk-3YBP46PB.js";
20
20
  import {
21
21
  partitionPoint
22
22
  } from "./chunk-HOAIOEI7.js";