@jbrowse/bandage-core 10.3.0 → 11.0.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 (82) hide show
  1. package/README.md +5 -0
  2. package/dist/bubbles/popBubble.js +2 -2
  3. package/dist/bubbles/superbubbles.js +3 -3
  4. package/dist/chunks/{chunk-EHXBZ5JZ.js → chunk-2Q22S52W.js} +1 -1
  5. package/dist/chunks/{chunk-IYALCKNB.js → chunk-3GP3KT5L.js} +1 -1
  6. package/dist/chunks/{chunk-A54O52XZ.js → chunk-3UST3ZQE.js} +1 -1
  7. package/dist/chunks/{chunk-DBLV7PGG.js → chunk-3XSRT7RQ.js} +16 -2
  8. package/dist/chunks/{chunk-7JGLJK44.js → chunk-5LTZVKZQ.js} +10 -10
  9. package/dist/chunks/{chunk-PTQPTDZH.js → chunk-6OP4HPXG.js} +1 -1
  10. package/dist/chunks/{chunk-WONB6LMC.js → chunk-AI5PTOSV.js} +1 -1
  11. package/dist/chunks/{chunk-LGJBB5BP.js → chunk-B5X2RLJG.js} +9 -1
  12. package/dist/chunks/{chunk-TCOLHD7N.js → chunk-BIOKXS3M.js} +2 -2
  13. package/dist/chunks/{chunk-BVYR7IFN.js → chunk-C3NT37C3.js} +24 -3
  14. package/dist/chunks/{chunk-5YILQTHE.js → chunk-CIDSF47D.js} +29 -9
  15. package/dist/chunks/{chunk-AMX4OQAW.js → chunk-CTZRIDMY.js} +7 -7
  16. package/dist/chunks/{chunk-XUT4HXVE.js → chunk-CZT33FZG.js} +8 -8
  17. package/dist/chunks/{chunk-CGFPFBT2.js → chunk-D4ZFRBB4.js} +11 -2
  18. package/dist/chunks/{chunk-V7J6U4XC.js → chunk-DO62DG26.js} +1 -1
  19. package/dist/chunks/{chunk-Z6XZWPXK.js → chunk-DZR37KXT.js} +51 -2
  20. package/dist/chunks/{chunk-MD5VPXXT.js → chunk-EDWU7OM4.js} +5 -5
  21. package/dist/chunks/chunk-EIY2SKD3.js +164 -0
  22. package/dist/chunks/{chunk-A55OZVYX.js → chunk-EY2ZGSCP.js} +2 -2
  23. package/dist/chunks/{chunk-RWKP7UO4.js → chunk-FFHJGWDK.js} +6 -2
  24. package/dist/chunks/{chunk-KWHWNOTY.js → chunk-KDU4EF66.js} +4 -4
  25. package/dist/chunks/{chunk-65ILXEIN.js → chunk-L5IETLWP.js} +5 -5
  26. package/dist/chunks/{chunk-GIHTHYXY.js → chunk-NMWQUFPF.js} +1 -1
  27. package/dist/chunks/{chunk-QQCOVMMT.js → chunk-OLKXMZ6J.js} +1 -1
  28. package/dist/chunks/{chunk-ZNJ4JAPT.js → chunk-PK5QQOMN.js} +3 -3
  29. package/dist/chunks/{chunk-PPDE4IVT.js → chunk-PNMJFFNB.js} +1 -1
  30. package/dist/chunks/{chunk-WJ4TIAVA.js → chunk-RNYPCQZ3.js} +1 -1
  31. package/dist/chunks/{chunk-2XEQR54X.js → chunk-SWCULW6S.js} +1 -1
  32. package/dist/chunks/{chunk-SHKGYGM4.js → chunk-TEF3NBG3.js} +3 -3
  33. package/dist/chunks/{chunk-M5NPD55W.js → chunk-TUQKGAK3.js} +1 -1
  34. package/dist/chunks/{chunk-ZPBEUOBM.js → chunk-W6EXQDV5.js} +1 -1
  35. package/dist/chunks/{chunk-7XR26JST.js → chunk-XVS52NMZ.js} +1 -1
  36. package/dist/chunks/{chunk-SZHQK6GL.js → chunk-XZ6PQBU6.js} +59 -13
  37. package/dist/cli/figure.js +26 -25
  38. package/dist/cli/fold.js +6 -5
  39. package/dist/figure.js +20 -19
  40. package/dist/figureData.js +23 -22
  41. package/dist/figureScene.js +15 -14
  42. package/dist/figureSettings.js +7 -6
  43. package/dist/gbzCut.js +4 -3
  44. package/dist/gbzWindow.js +3 -2
  45. package/dist/gfa/gfaConverter.js +3 -2
  46. package/dist/gfa/gfaTables.js +2 -1
  47. package/dist/gfa/graphTables.js +2 -1
  48. package/dist/gfa/walkStops.js +28 -0
  49. package/dist/index.js +60 -42
  50. package/dist/layout/forceCache.js +7 -6
  51. package/dist/layout/trimToWindow.js +1 -1
  52. package/dist/layout/tubeMapLayout.js +5 -4
  53. package/dist/layout/walkRowDraw.js +13 -4
  54. package/dist/layout/walkRowLayout.js +4 -3
  55. package/dist/layout/walkRows.js +3 -2
  56. package/dist/layout/walkStrip.js +8 -7
  57. package/dist/layoutModes.js +8 -7
  58. package/dist/pathAnchoring.js +1 -1
  59. package/dist/pathColors.js +2 -2
  60. package/dist/pipeline.js +6 -5
  61. package/dist/referenceStrip.js +4 -4
  62. package/dist/renderer/GeometryBuilder.js +3 -3
  63. package/dist/tubeMap/bundle.js +6 -5
  64. package/dist/tubeMap/coarsen.js +6 -5
  65. package/dist/tubeMap/deviations.js +6 -5
  66. package/dist/tubeMap/draw.js +5 -4
  67. package/dist/tubeMap/nodeColors.js +4 -4
  68. package/dist/types/gfa/graphTables.d.ts +3 -0
  69. package/dist/types/gfa/walkStops.d.ts +59 -0
  70. package/dist/types/index.d.ts +4 -2
  71. package/dist/types/layout/walkRowDraw.d.ts +14 -1
  72. package/dist/types/layout/walkRows.d.ts +4 -1
  73. package/dist/types/types.d.ts +19 -0
  74. package/dist/types/version.d.ts +1 -1
  75. package/dist/types/walkHighlight.d.ts +2 -0
  76. package/dist/types/walkKey.d.ts +1 -1
  77. package/dist/version.js +1 -1
  78. package/dist/viewport.js +7 -6
  79. package/dist/walkEncoding.js +4 -4
  80. package/dist/walkHighlight.js +6 -5
  81. package/dist/walkKey.js +2 -1
  82. package/package.json +1 -1
package/README.md CHANGED
@@ -10,6 +10,11 @@ npm install @jbrowse/bandage-core
10
10
 
11
11
  - GFA and rGFA text in (`loadGraph`), or the same graph as typed arrays a worker
12
12
  can transfer (`GraphTables`)
13
+ - A walk-file cut's W lines tag what lies past each fragment's start and end as
14
+ `ws:Z:`/`we:Z:`, such as `break,bp=19021` or
15
+ `elsewhere,trimmed=400,chunk=GRCh38#0#chr22:20316160`
16
+ (`src/gfa/walkStops.ts`). Walk rows split each gap by those stops into parts
17
+ that name their cause
13
18
  - Layouts: Bandage's FMMM engine as WASM from
14
19
  [@jbrowse/graph-fmmm-layout](https://github.com/GMOD/graph-fmmm-layout)
15
20
  (`loadBandage`, `forceLayout`), ordered, anchored, sample rows, walk rows,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  bubbleSubgraph
3
- } from "../chunks/chunk-PPDE4IVT.js";
4
- import "../chunks/chunk-LGJBB5BP.js";
3
+ } from "../chunks/chunk-PNMJFFNB.js";
4
+ import "../chunks/chunk-B5X2RLJG.js";
5
5
  import "../chunks/chunk-ZPZ7GNBT.js";
6
6
  import "../chunks/chunk-BSOZW3FC.js";
7
7
  import "../chunks/chunk-RJWPJCIB.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  graphBubbles,
3
3
  superbubblesFromGraph
4
- } from "../chunks/chunk-EHXBZ5JZ.js";
4
+ } from "../chunks/chunk-2Q22S52W.js";
5
5
  import "../chunks/chunk-RFG42VIO.js";
6
- import "../chunks/chunk-PPDE4IVT.js";
6
+ import "../chunks/chunk-PNMJFFNB.js";
7
7
  import "../chunks/chunk-E4ZM4OOJ.js";
8
8
  import "../chunks/chunk-A4JDEUAI.js";
9
9
  import "../chunks/chunk-FX4RDMDN.js";
10
10
  import "../chunks/chunk-UAFATXYA.js";
11
- import "../chunks/chunk-LGJBB5BP.js";
11
+ import "../chunks/chunk-B5X2RLJG.js";
12
12
  import "../chunks/chunk-VX656OAZ.js";
13
13
  import "../chunks/chunk-ZPZ7GNBT.js";
14
14
  import "../chunks/chunk-PFRQBCGC.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-RFG42VIO.js";
8
8
  import {
9
9
  bubbleSubgraph
10
- } from "./chunk-PPDE4IVT.js";
10
+ } from "./chunk-PNMJFFNB.js";
11
11
  import {
12
12
  coversGraph
13
13
  } from "./chunk-E4ZM4OOJ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pathOrigin
3
- } from "./chunk-LGJBB5BP.js";
3
+ } from "./chunk-B5X2RLJG.js";
4
4
  import {
5
5
  groupDigits
6
6
  } from "./chunk-PFRQBCGC.js";
@@ -2,7 +2,7 @@ import {
2
2
  LIFT_BACKDROP_CSS,
3
3
  computeColorSchemeRange,
4
4
  getNodeColor
5
- } from "./chunk-2XEQR54X.js";
5
+ } from "./chunk-SWCULW6S.js";
6
6
  import {
7
7
  abgrToCssRgba
8
8
  } from "./chunk-G2FD7S3C.js";
@@ -1,3 +1,8 @@
1
+ import {
2
+ stopAt,
3
+ stopFields,
4
+ walkStopTags
5
+ } from "./chunk-EIY2SKD3.js";
1
6
  import {
2
7
  PathVisits
3
8
  } from "./chunk-ZPZ7GNBT.js";
@@ -209,7 +214,16 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
209
214
  }
210
215
  prev = node;
211
216
  }
212
- paths.push({ name: pathName, nodeIds, start, ...fields });
217
+ paths.push({
218
+ name: pathName,
219
+ nodeIds,
220
+ start,
221
+ ...fields,
222
+ ...fields ? stopFields(
223
+ w.before && stopAt(w.before, p),
224
+ w.after && stopAt(w.after, p)
225
+ ) : {}
226
+ });
213
227
  anchorPaths.push({
214
228
  name: visitName,
215
229
  sample: visitSample,
@@ -272,7 +286,7 @@ function graphTablesGFA({ nodes, links, walks }) {
272
286
  steps.push([names[walks.steps[s]], walks.reversed[s]]);
273
287
  }
274
288
  lines.push(
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(",")} *`
289
+ fields ? `W ${fields.sample} ${fields.haplotype} ${fields.contig} ${start} ${end} ${steps.map(([id, rev]) => (rev ? "<" : ">") + id).join("")}${walkStopTags(walks, p)}` : `P ${pLineName(name, start, end)} ${steps.map(([id, rev]) => id + (rev ? "-" : "+")).join(",")} *`
276
290
  );
277
291
  }
278
292
  return lines.join("\n");
@@ -5,12 +5,12 @@ import {
5
5
  stripGeneGaps,
6
6
  walkStripFrame,
7
7
  walkStripLabelsTree
8
- } from "./chunk-SHKGYGM4.js";
8
+ } from "./chunk-TEF3NBG3.js";
9
9
  import {
10
10
  walkRowsKey,
11
11
  walkRowsKeyTree,
12
12
  walkRowsTree
13
- } from "./chunk-SZHQK6GL.js";
13
+ } from "./chunk-XZ6PQBU6.js";
14
14
  import {
15
15
  Canvas2DRenderer
16
16
  } from "./chunk-EJRJAAN7.js";
@@ -34,32 +34,32 @@ import {
34
34
  } from "./chunk-H2H4Y3TV.js";
35
35
  import {
36
36
  version
37
- } from "./chunk-PTQPTDZH.js";
37
+ } from "./chunk-6OP4HPXG.js";
38
38
  import {
39
39
  axisScaleOf
40
- } from "./chunk-WONB6LMC.js";
40
+ } from "./chunk-AI5PTOSV.js";
41
41
  import {
42
42
  figureScene
43
- } from "./chunk-XUT4HXVE.js";
43
+ } from "./chunk-CZT33FZG.js";
44
44
  import {
45
45
  encodingStops
46
- } from "./chunk-V7J6U4XC.js";
46
+ } from "./chunk-DO62DG26.js";
47
47
  import {
48
48
  rangeText
49
- } from "./chunk-CGFPFBT2.js";
49
+ } from "./chunk-D4ZFRBB4.js";
50
50
  import {
51
51
  walkRowLabels
52
- } from "./chunk-QQCOVMMT.js";
52
+ } from "./chunk-OLKXMZ6J.js";
53
53
  import {
54
54
  nodeInk
55
55
  } from "./chunk-CRCD3ODN.js";
56
56
  import {
57
57
  FIGURE_DEFAULTS
58
- } from "./chunk-ZPBEUOBM.js";
58
+ } from "./chunk-W6EXQDV5.js";
59
59
  import {
60
60
  FIT_PADDING,
61
61
  fitTransform
62
- } from "./chunk-KWHWNOTY.js";
62
+ } from "./chunk-KDU4EF66.js";
63
63
  import {
64
64
  LABEL_CHAR_PX,
65
65
  LABEL_PAD,
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var version = "10.3.0";
2
+ var version = "11.0.0";
3
3
 
4
4
  export {
5
5
  version
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clampZoom
3
- } from "./chunk-KWHWNOTY.js";
3
+ } from "./chunk-KDU4EF66.js";
4
4
 
5
5
  // src/viewport.ts
6
6
  function axisScaleOf(scale, pixelRows) {
@@ -121,7 +121,15 @@ function anchorFromPaths(graph, preferred) {
121
121
  };
122
122
  }
123
123
  function anchorGraph(graph, preferred) {
124
- return graph.anchoredBy === "tags" ? graph : anchorFromPaths(graph, preferred);
124
+ if (graph.anchoredBy !== "tags") {
125
+ return anchorFromPaths(graph, preferred);
126
+ }
127
+ const referencePath = taggedReferencePath(graph);
128
+ return referencePath ? { ...graph, referencePath } : graph;
129
+ }
130
+ function taggedReferencePath(graph) {
131
+ const refName = graph.nodes.find((n) => n.stable?.rank === 0)?.stable?.refName;
132
+ return refName !== void 0 && graph.anchorPaths?.some((p) => p.name === refName) ? refName : void 0;
125
133
  }
126
134
  function trimOrigins(graph, kept) {
127
135
  if (!graph.anchorPaths) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  pathSteps
3
- } from "./chunk-ZNJ4JAPT.js";
3
+ } from "./chunk-PK5QQOMN.js";
4
4
  import {
5
5
  pathOrigin
6
- } from "./chunk-LGJBB5BP.js";
6
+ } from "./chunk-B5X2RLJG.js";
7
7
  import {
8
8
  pushTo
9
9
  } from "./chunk-BSOZW3FC.js";
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  encodedColor,
3
3
  resolveEncoding
4
- } from "./chunk-V7J6U4XC.js";
4
+ } from "./chunk-DO62DG26.js";
5
5
  import {
6
6
  pathOrigin
7
- } from "./chunk-LGJBB5BP.js";
7
+ } from "./chunk-B5X2RLJG.js";
8
+ import {
9
+ gapParts
10
+ } from "./chunk-EIY2SKD3.js";
8
11
  import {
9
12
  panSNContig
10
13
  } from "./chunk-4XWZNPQ2.js";
@@ -68,6 +71,22 @@ function highlightOf(graph, name, { byId, edgeAt }) {
68
71
  before += length;
69
72
  });
70
73
  }
74
+ let missingBp = 0;
75
+ let unknownBp = 0;
76
+ let end;
77
+ pieces.forEach((piece, p) => {
78
+ if (end !== void 0 && piece.start !== void 0 && piece.start > end) {
79
+ for (const part of gapParts(
80
+ piece.start - end,
81
+ pieces[p - 1].after,
82
+ piece.before
83
+ )) {
84
+ missingBp += part.cause === "missing" ? part.bp : 0;
85
+ unknownBp += part.cause === "unknown" ? part.bp : 0;
86
+ }
87
+ }
88
+ end = piece.start === void 0 ? void 0 : piece.start + bpOf(piece);
89
+ });
71
90
  const reference = isReference(graph, name);
72
91
  const referenceSpan = () => {
73
92
  const referencePieces = reference ? [] : (graph.paths ?? []).filter((p) => isReference(graph, p.name));
@@ -86,7 +105,9 @@ function highlightOf(graph, name, { byId, edgeAt }) {
86
105
  progress,
87
106
  steps: pieces.reduce((sum, piece) => sum + piece.nodeIds.length, 0),
88
107
  bp,
89
- referenceBp: referenceSpan()
108
+ referenceBp: referenceSpan(),
109
+ missingBp,
110
+ unknownBp
90
111
  };
91
112
  }
92
113
  function laneColors(byId, walk, encoding, ramp) {
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  pathOrigin
3
- } from "./chunk-LGJBB5BP.js";
3
+ } from "./chunk-B5X2RLJG.js";
4
+ import {
5
+ gapParts
6
+ } from "./chunk-EIY2SKD3.js";
4
7
  import {
5
8
  groupBy
6
9
  } from "./chunk-BSOZW3FC.js";
@@ -50,10 +53,13 @@ var NodeTable = class {
50
53
  };
51
54
  function stepsOf(pieces, table) {
52
55
  const out = [];
56
+ const gaps = [];
53
57
  let end;
58
+ let previous;
54
59
  for (const piece of pieces) {
55
60
  if (end !== void 0 && piece.start !== void 0 && piece.start > end) {
56
- out.push(end - piece.start);
61
+ gaps.push(gapParts(piece.start - end, previous?.after, piece.before));
62
+ out.push(-gaps.length);
57
63
  }
58
64
  let bp = 0;
59
65
  for (const node of piece.nodes) {
@@ -61,8 +67,9 @@ function stepsOf(pieces, table) {
61
67
  bp += table.lengths[node];
62
68
  }
63
69
  end = piece.start === void 0 ? void 0 : piece.start + bp;
70
+ previous = piece;
64
71
  }
65
- return Float64Array.from(out);
72
+ return { steps: Float64Array.from(out), gaps };
66
73
  }
67
74
  function stepSpan(pieces, table, k) {
68
75
  let end;
@@ -203,10 +210,13 @@ function walkRows(graph, region, unit) {
203
210
  const path = paths2[0];
204
211
  const pieces = paths2.map((piece, p) => ({
205
212
  start: piece.start,
206
- nodes: nodes?.[p] ?? table.nodesOf(piece)
213
+ nodes: nodes?.[p] ?? table.nodesOf(piece),
214
+ before: piece.before,
215
+ after: piece.after
207
216
  })).sort((a, b) => (a.start ?? 0) - (b.start ?? 0));
217
+ const { steps, gaps } = stepsOf(pieces, table);
208
218
  const { ids, complete, from, to, stop } = sliceBetween(
209
- stepsOf(pieces, table),
219
+ steps,
210
220
  table,
211
221
  cut,
212
222
  flanked
@@ -221,12 +231,22 @@ function walkRows(graph, region, unit) {
221
231
  let offReferenceBp = 0;
222
232
  let gapBp = 0;
223
233
  let step = 0;
234
+ const backwards = from >= 0 && from > to;
224
235
  for (const node of ids) {
225
236
  if (node < 0) {
226
- last = { start: bp, bp: -node, onReference: false, gap: true };
227
- runs.push(last);
228
- bp -= node;
229
- gapBp -= node;
237
+ const parts = gaps[-node - 1];
238
+ for (const { bp: partBp, ...why } of backwards ? [...parts].reverse() : parts) {
239
+ last = {
240
+ start: bp,
241
+ bp: partBp,
242
+ onReference: false,
243
+ gap: true,
244
+ ...why
245
+ };
246
+ runs.push(last);
247
+ bp += partBp;
248
+ gapBp += partBp;
249
+ }
230
250
  step = 0;
231
251
  continue;
232
252
  }
@@ -3,19 +3,19 @@ import {
3
3
  } from "./chunk-JMABOQWL.js";
4
4
  import {
5
5
  layoutModeByValue
6
- } from "./chunk-MD5VPXXT.js";
6
+ } from "./chunk-EDWU7OM4.js";
7
7
  import {
8
8
  parseRegion
9
- } from "./chunk-M5NPD55W.js";
9
+ } from "./chunk-TUQKGAK3.js";
10
10
  import {
11
11
  version
12
- } from "./chunk-PTQPTDZH.js";
12
+ } from "./chunk-6OP4HPXG.js";
13
13
  import {
14
14
  axisScaleOf
15
- } from "./chunk-WONB6LMC.js";
15
+ } from "./chunk-AI5PTOSV.js";
16
16
  import {
17
17
  figureScene
18
- } from "./chunk-XUT4HXVE.js";
18
+ } from "./chunk-CZT33FZG.js";
19
19
  import {
20
20
  abgrAlpha,
21
21
  abgrBlue,
@@ -24,13 +24,13 @@ import {
24
24
  } from "./chunk-G2FD7S3C.js";
25
25
  import {
26
26
  FIGURE_DEFAULTS
27
- } from "./chunk-ZPBEUOBM.js";
27
+ } from "./chunk-W6EXQDV5.js";
28
28
  import {
29
29
  engineSettingsOf,
30
30
  fitTransform,
31
31
  forceLayout,
32
32
  loadGraph
33
- } from "./chunk-KWHWNOTY.js";
33
+ } from "./chunk-KDU4EF66.js";
34
34
  import {
35
35
  isBackbone
36
36
  } from "./chunk-RJWPJCIB.js";
@@ -4,27 +4,27 @@ import {
4
4
  import {
5
5
  facetLifts,
6
6
  walkLift
7
- } from "./chunk-BVYR7IFN.js";
7
+ } from "./chunk-C3NT37C3.js";
8
8
  import {
9
9
  walkKey
10
- } from "./chunk-CGFPFBT2.js";
10
+ } from "./chunk-D4ZFRBB4.js";
11
11
  import {
12
12
  buildGeometry,
13
13
  computeReferenceRamp
14
- } from "./chunk-2XEQR54X.js";
14
+ } from "./chunk-SWCULW6S.js";
15
15
  import {
16
16
  walkRowsExtent
17
- } from "./chunk-QQCOVMMT.js";
17
+ } from "./chunk-OLKXMZ6J.js";
18
18
  import {
19
19
  pathLegend,
20
20
  walkLabelsOf
21
- } from "./chunk-IYALCKNB.js";
21
+ } from "./chunk-3GP3KT5L.js";
22
22
  import {
23
23
  FIGURE_DEFAULTS
24
- } from "./chunk-ZPBEUOBM.js";
24
+ } from "./chunk-W6EXQDV5.js";
25
25
  import {
26
26
  drawingBounds
27
- } from "./chunk-KWHWNOTY.js";
27
+ } from "./chunk-KDU4EF66.js";
28
28
  import {
29
29
  referenceLabel
30
30
  } from "./chunk-234NFZS4.js";
@@ -97,7 +97,7 @@ function figureScene(graph, layout, o) {
97
97
  referenceName,
98
98
  keyText: (walk) => {
99
99
  const key = walkKey(walk, reference);
100
- return { note: key.delta + key.outside + key.reversed, scale: key.scale };
100
+ return { note: key.delta + key.gaps + key.reversed, scale: key.scale };
101
101
  },
102
102
  contigThickness,
103
103
  nodeWidth,
@@ -1,3 +1,7 @@
1
+ import {
2
+ GAP_CAUSE_TEXT,
3
+ OUTSIDE_TEXT
4
+ } from "./chunk-EIY2SKD3.js";
1
5
  import {
2
6
  formatBp,
3
7
  groupDigits
@@ -14,10 +18,15 @@ function walkKey(walk, reference) {
14
18
  const own = walk.range ? rangeText(walk.range.contig, walk.range.start, walk.range.end) : void 0;
15
19
  const scale = field === "progress" ? own : field === "reference" && reference ? rangeText(reference.name, reference.start, reference.end) : void 0;
16
20
  const spanned = walk.range ? walk.range.end - walk.range.start : walk.bp;
17
- const outside = spanned - walk.bp;
21
+ const outside = spanned - walk.bp - walk.missingBp - walk.unknownBp;
22
+ const gaps = [
23
+ [walk.missingBp, GAP_CAUSE_TEXT.missing],
24
+ [walk.unknownBp, GAP_CAUSE_TEXT.unknown],
25
+ [outside, OUTSIDE_TEXT]
26
+ ];
18
27
  return {
19
28
  delta: walk.referenceBp === void 0 || spanned === walk.referenceBp ? "" : ` ${spanned > walk.referenceBp ? "+" : "\u2212"}${formatBp(Math.abs(spanned - walk.referenceBp))}`,
20
- outside: outside > 0 ? `, ${formatBp(outside)} outside the cut` : "",
29
+ gaps: gaps.filter(([bp]) => bp > 0).map(([bp, text]) => `, ${formatBp(bp)} ${text}`).join(""),
21
30
  reversed: walk.reversedBp > 0 ? `, ${formatBp(walk.reversedBp)} reversed` : "",
22
31
  shades: field !== "walk",
23
32
  scale,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  REFERENCE_RAMP_ALT_COLOR,
3
3
  hslToRgb
4
- } from "./chunk-2XEQR54X.js";
4
+ } from "./chunk-SWCULW6S.js";
5
5
  import {
6
6
  packAbgr
7
7
  } from "./chunk-G2FD7S3C.js";
@@ -1,3 +1,9 @@
1
+ import {
2
+ END_STOP_TAG,
3
+ START_STOP_TAG,
4
+ StopColumns,
5
+ parseStopTag
6
+ } from "./chunk-EIY2SKD3.js";
1
7
  import {
2
8
  Column
3
9
  } from "./chunk-ZPZ7GNBT.js";
@@ -103,6 +109,7 @@ function readWalkBody(line, from, segments, steps) {
103
109
  }
104
110
  }
105
111
  finish(i);
112
+ return i;
106
113
  }
107
114
  function walkFields(line) {
108
115
  const fields = [];
@@ -159,6 +166,8 @@ function gfaTables(text) {
159
166
  const walkEnds = [];
160
167
  const offsets = [0];
161
168
  const steps = stepColumns();
169
+ const before = new StopColumns();
170
+ const after = new StopColumns();
162
171
  for (const raw of lines) {
163
172
  if (raw.startsWith("L ")) {
164
173
  const [, source, strand1, target, strand2] = trimCR(raw).split(" ");
@@ -174,7 +183,17 @@ function gfaTables(text) {
174
183
  names.push(`${w.sample}#${w.haplotype}#${w.contig}`);
175
184
  walkStarts.push(w.start === "*" ? 0 : +w.start);
176
185
  walkEnds.push(w.end === "*" ? -1 : +w.end);
177
- readWalkBody(line, w.body, segments, steps);
186
+ const end = readWalkBody(line, w.body, segments, steps);
187
+ const tags = walkTags(line, end);
188
+ if (tags === void 0) {
189
+ return void 0;
190
+ }
191
+ if (tags.before) {
192
+ before.push(tags.before);
193
+ }
194
+ if (tags.after) {
195
+ after.push(tags.after);
196
+ }
178
197
  if (steps.nodes.length === offsets.at(-1)) {
179
198
  return void 0;
180
199
  }
@@ -182,6 +201,11 @@ function gfaTables(text) {
182
201
  }
183
202
  }
184
203
  }
204
+ if ([before.kinds.length, after.kinds.length].some(
205
+ (n) => n > 0 && n < names.length
206
+ )) {
207
+ return void 0;
208
+ }
185
209
  return {
186
210
  nodes: {
187
211
  names: segments.names,
@@ -202,8 +226,33 @@ function gfaTables(text) {
202
226
  ends: Float64Array.from(walkEnds),
203
227
  offsets: Int32Array.from(offsets),
204
228
  steps: steps.nodes.data.slice(0, steps.nodes.length),
205
- reversed: steps.reversed.data.slice(0, steps.reversed.length)
229
+ reversed: steps.reversed.data.slice(0, steps.reversed.length),
230
+ ...stopColumns(names.length, before, after)
231
+ }
232
+ };
233
+ }
234
+ function walkTags(line, from) {
235
+ const out = {};
236
+ for (const tag of from < line.length ? line.slice(from + 1).split(" ") : []) {
237
+ const value = tag.slice(5);
238
+ if (tag.startsWith(`${START_STOP_TAG}:Z:`)) {
239
+ out.before = parseStopTag(value);
240
+ if (!out.before) {
241
+ return void 0;
242
+ }
243
+ } else if (tag.startsWith(`${END_STOP_TAG}:Z:`)) {
244
+ out.after = parseStopTag(value);
245
+ if (!out.after) {
246
+ return void 0;
247
+ }
206
248
  }
249
+ }
250
+ return out;
251
+ }
252
+ function stopColumns(walks, before, after) {
253
+ return {
254
+ ...before.kinds.length === walks && walks > 0 ? { before: before.table() } : {},
255
+ ...after.kinds.length === walks && walks > 0 ? { after: after.table() } : {}
207
256
  };
208
257
  }
209
258
 
@@ -1,12 +1,12 @@
1
- import {
2
- sampleRowLayout
3
- } from "./chunk-GJU6BJJA.js";
4
1
  import {
5
2
  hasTubeMapBackbone,
6
3
  hasTubeMapPaths,
7
4
  tubeMapLayout,
8
5
  tubeMapReferenceLayout
9
- } from "./chunk-ZNJ4JAPT.js";
6
+ } from "./chunk-PK5QQOMN.js";
7
+ import {
8
+ sampleRowLayout
9
+ } from "./chunk-GJU6BJJA.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-QQCOVMMT.js";
18
+ } from "./chunk-OLKXMZ6J.js";
19
19
  import {
20
20
  isBackbone,
21
21
  isOffReference