@jbrowse/bandage-core 9.2.0 → 9.4.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.
@@ -1,14 +1,16 @@
1
1
  import {
2
+ SMALL_VARIANT_BP,
2
3
  WHOLE_FRACTION,
3
4
  bubbleHalos,
4
5
  coversGraph
5
- } from "../chunks/chunk-2AWUWGAD.js";
6
+ } from "../chunks/chunk-REM73HCU.js";
6
7
  import "../chunks/chunk-XKWD2RY3.js";
7
8
  import "../chunks/chunk-FX4RDMDN.js";
8
9
  import "../chunks/chunk-2CVHXFK7.js";
9
10
  import "../chunks/chunk-CPMHA4W5.js";
10
11
  import "../chunks/chunk-FYQWPEEY.js";
11
12
  export {
13
+ SMALL_VARIANT_BP,
12
14
  WHOLE_FRACTION,
13
15
  bubbleHalos,
14
16
  coversGraph
@@ -1,10 +1,9 @@
1
1
  import {
2
- MAX_SUPERBUBBLES,
3
2
  graphBubbles,
4
3
  superbubblesFromGraph
5
- } from "../chunks/chunk-ZDJDM77V.js";
4
+ } from "../chunks/chunk-TF7H5LQS.js";
6
5
  import "../chunks/chunk-VHW7FDHU.js";
7
- import "../chunks/chunk-2AWUWGAD.js";
6
+ import "../chunks/chunk-REM73HCU.js";
8
7
  import "../chunks/chunk-XKWD2RY3.js";
9
8
  import "../chunks/chunk-GOZYKNQ2.js";
10
9
  import "../chunks/chunk-FX4RDMDN.js";
@@ -15,7 +14,6 @@ import "../chunks/chunk-2CVHXFK7.js";
15
14
  import "../chunks/chunk-CPMHA4W5.js";
16
15
  import "../chunks/chunk-FYQWPEEY.js";
17
16
  export {
18
- MAX_SUPERBUBBLES,
19
17
  graphBubbles,
20
18
  superbubblesFromGraph
21
19
  };
@@ -45,7 +45,7 @@ import {
45
45
  } from "./chunk-BR25DGIJ.js";
46
46
  import {
47
47
  version
48
- } from "./chunk-FM6XRXPX.js";
48
+ } from "./chunk-BIGORSXS.js";
49
49
  import {
50
50
  walkRowLabels,
51
51
  walkRowsExtent
@@ -62,7 +62,7 @@ import {
62
62
  } from "./chunk-RAKOB6IV.js";
63
63
  import {
64
64
  geneLabelCandidates
65
- } from "./chunk-GJMC3PGM.js";
65
+ } from "./chunk-DRG4236Y.js";
66
66
  import {
67
67
  nodesUnderBox
68
68
  } from "./chunk-FP4H7SFT.js";
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var version = "9.2.0";
2
+ var version = "9.4.0";
3
3
 
4
4
  export {
5
5
  version
@@ -21,6 +21,7 @@ var LEGEND_INSET_PX = 6;
21
21
  var ROUTE_STACK = 8;
22
22
  var GENE_PIN_DROP_PX = 18;
23
23
  var GENE_STACK = 2;
24
+ var BUBBLE_STACK = 3;
24
25
  var TOPMOST_BASELINE = LABEL_PX + LABEL_PAD;
25
26
  function geneCoverageNote(pin) {
26
27
  const length = pin.gene.end - pin.gene.start;
@@ -92,24 +93,31 @@ function layoutLabels(m) {
92
93
  const onRows = m.drawnRowLabels.length > 0;
93
94
  const rowsTop = onRows ? Math.min(...m.drawnRowLabels.map((r) => r.y)) : Infinity;
94
95
  const halo = m.contigThickness * HALO_FACTOR;
95
- const byBubble = byExtent(m.bubbleHalos, (h) => h.members);
96
+ const above = (h, gap) => {
97
+ const { x, y } = screen({
98
+ x: h.labelAt.x,
99
+ y: Math.min(h.labelAt.y, rowsTop)
100
+ });
101
+ const baseline = y - halo / 2 - gap;
102
+ return { x, y: onRows ? Math.max(baseline, TOPMOST_BASELINE) : baseline };
103
+ };
104
+ const byBubble = byExtent(
105
+ m.bubbleHalos.filter((h) => !h.tick),
106
+ (h) => h.whole ? -1 : h.members
107
+ );
96
108
  const bubbles = placeLabels(
97
- byBubble.map((h) => {
98
- const { x, y } = screen({
99
- x: h.labelAt.x,
100
- y: Math.min(h.labelAt.y, rowsTop)
101
- });
102
- const baseline = y - halo / 2 - 6;
103
- return {
104
- item: h,
105
- x,
106
- y: onRows ? Math.max(baseline, TOPMOST_BASELINE) : baseline,
107
- text: h.label
108
- };
109
- }),
109
+ byBubble.map((h) => ({
110
+ item: h,
111
+ ...above(h, 6),
112
+ text: h.label,
113
+ // `0 bp–11 kb superbubble` where `…, 1198 segments, 5 routes` does not fit
114
+ fallback: h.label.includes(",") ? h.label.split(",")[0] : void 0,
115
+ stack: BUBBLE_STACK
116
+ })),
110
117
  frame,
111
118
  take
112
119
  );
120
+ const ticks = m.bubbleHalos.filter((h) => h.tick && !h.whole).map((h) => ({ item: h, ...above(h, 2) })).filter((t) => t.x >= 0 && t.x <= width && t.y >= 0 && t.y <= height);
113
121
  const genes = placeLabels(
114
122
  geneLabelCandidates(
115
123
  m.genePins,
@@ -162,6 +170,7 @@ function layoutLabels(m) {
162
170
  );
163
171
  return {
164
172
  bubbles,
173
+ ticks,
165
174
  genes,
166
175
  routes,
167
176
  sizes: [...deletionLabels, ...nodeLabels]
@@ -15,6 +15,7 @@ var WHOLE_FRACTION = 0.9;
15
15
  function coversGraph(members, nodes) {
16
16
  return members + 2 >= nodes || members >= WHOLE_FRACTION * nodes;
17
17
  }
18
+ var SMALL_VARIANT_BP = 50;
18
19
  var NAMED_WALKS = 2;
19
20
  var MIN_CHIPPED_BP = 1e3;
20
21
  function bubbleHalos(graph, bubbles, positions, walkLabel = (name) => name, repeats = []) {
@@ -87,6 +88,7 @@ function bubbleHalos(graph, bubbles, positions, walkLabel = (name) => name, repe
87
88
  routes.push({ route, at, text: routeText(route, walkLabel) });
88
89
  }
89
90
  }
91
+ const whole = bubble.covering === true || coversGraph(nodeIds.length, graph.nodes.length);
90
92
  halos.push({
91
93
  bubble,
92
94
  ...classifyBubble(bubble, repeats),
@@ -94,7 +96,10 @@ function bubbleHalos(graph, bubbles, positions, walkLabel = (name) => name, repe
94
96
  labelAt,
95
97
  members: nodeIds.length,
96
98
  nodeIds,
97
- whole: coversGraph(nodeIds.length, graph.nodes.length),
99
+ whole,
100
+ // The drawing's own bubble keeps its name however small. A partial
101
+ // bubble's lengths are a floor, so it may be no small variant.
102
+ tick: !whole && !bubble.partial && bubble.longestAlleleLength < SMALL_VARIANT_BP,
98
103
  routes
99
104
  });
100
105
  }
@@ -110,5 +115,6 @@ function routeText(route, walkLabel) {
110
115
  export {
111
116
  WHOLE_FRACTION,
112
117
  coversGraph,
118
+ SMALL_VARIANT_BP,
113
119
  bubbleHalos
114
120
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-VHW7FDHU.js";
4
4
  import {
5
5
  coversGraph
6
- } from "./chunk-2AWUWGAD.js";
6
+ } from "./chunk-REM73HCU.js";
7
7
  import {
8
8
  bubbleSegmentIds
9
9
  } from "./chunk-XKWD2RY3.js";
@@ -23,7 +23,6 @@ import {
23
23
  } from "./chunk-FYQWPEEY.js";
24
24
 
25
25
  // src/bubbles/superbubbles.ts
26
- var MAX_SUPERBUBBLES = 50;
27
26
  function slotGraph(graph, index) {
28
27
  const slots = graph.nodes.length * 2;
29
28
  const seen = /* @__PURE__ */ new Set();
@@ -224,7 +223,9 @@ function superbubblesFromGraph(graph, span) {
224
223
  (j) => j !== i && !covers[j] && members[j].length > members[i].length && members[i].every((v) => holders.get(v).includes(j))
225
224
  );
226
225
  const placed = (f) => span !== void 0 || onReference(nodes[f.source >> 1], nodes[f.sink >> 1]);
227
- const outermost = found.filter((f, i) => !covers[i] && placed(f) && !nested(f, i)).sort((a, b) => b.inside.length - a.inside.length).slice(0, MAX_SUPERBUBBLES);
226
+ const outermost = found.filter(
227
+ (f, i) => !covers[i] && placed(f) && !nested(f, i)
228
+ );
228
229
  const byId = new Map(nodes.map((n) => [n.id, n]));
229
230
  const walkIndex = walkIndexOf(graph);
230
231
  return outermost.map((f) => {
@@ -258,16 +259,22 @@ function superbubblesFromGraph(graph, span) {
258
259
  function graphBubbles(graph, span) {
259
260
  const n = graph.nodes.length;
260
261
  const reach = bubblesFromGraph(graph);
261
- return reach.length === 0 ? superbubblesFromGraph(graph, span) : reach.flatMap(
262
- (b) => coversGraph(b.segmentCount - 2, n) ? superbubblesFromGraph(
263
- b.segmentCount === n ? graph : bubbleSubgraph(graph, bubbleSegmentIds(b)),
264
- b
265
- ) : [b]
262
+ if (reach.length === 0) {
263
+ const inside = superbubblesFromGraph(graph, span);
264
+ return span ? [...inside, { ...span, covering: true }] : inside;
265
+ }
266
+ return reach.flatMap(
267
+ (b) => coversGraph(b.segmentCount - 2, n) ? [
268
+ ...superbubblesFromGraph(
269
+ b.segmentCount === n ? graph : bubbleSubgraph(graph, bubbleSegmentIds(b)),
270
+ b
271
+ ),
272
+ { ...b, covering: true }
273
+ ] : [b]
266
274
  );
267
275
  }
268
276
 
269
277
  export {
270
- MAX_SUPERBUBBLES,
271
278
  superbubblesFromGraph,
272
279
  graphBubbles
273
280
  };
@@ -35,7 +35,7 @@ import "../chunks/chunk-LTUWJKHD.js";
35
35
  import "../chunks/chunk-WSIFAZU7.js";
36
36
  import {
37
37
  figureSvg
38
- } from "../chunks/chunk-HOOVOF2Y.js";
38
+ } from "../chunks/chunk-4DEOECM3.js";
39
39
  import "../chunks/chunk-UD5FOCI2.js";
40
40
  import "../chunks/chunk-WBCOREDZ.js";
41
41
  import "../chunks/chunk-4BYTEJGW.js";
@@ -54,7 +54,7 @@ import "../chunks/chunk-2LQ5BWT7.js";
54
54
  import "../chunks/chunk-OXTR3BVF.js";
55
55
  import "../chunks/chunk-BR25DGIJ.js";
56
56
  import "../chunks/chunk-G2FD7S3C.js";
57
- import "../chunks/chunk-FM6XRXPX.js";
57
+ import "../chunks/chunk-BIGORSXS.js";
58
58
  import "../chunks/chunk-3C5UXR2U.js";
59
59
  import {
60
60
  filterSamples,
@@ -67,7 +67,7 @@ import {
67
67
  graphBackbone,
68
68
  refNameBinding
69
69
  } from "../chunks/chunk-RAKOB6IV.js";
70
- import "../chunks/chunk-GJMC3PGM.js";
70
+ import "../chunks/chunk-DRG4236Y.js";
71
71
  import "../chunks/chunk-FP4H7SFT.js";
72
72
  import "../chunks/chunk-MLSWIMZO.js";
73
73
  import "../chunks/chunk-WFB5TXRA.js";
package/dist/figure.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  figureSvg
3
- } from "./chunks/chunk-HOOVOF2Y.js";
3
+ } from "./chunks/chunk-4DEOECM3.js";
4
4
  import "./chunks/chunk-UD5FOCI2.js";
5
5
  import "./chunks/chunk-WBCOREDZ.js";
6
6
  import "./chunks/chunk-4BYTEJGW.js";
@@ -16,13 +16,13 @@ import "./chunks/chunk-2LQ5BWT7.js";
16
16
  import "./chunks/chunk-OXTR3BVF.js";
17
17
  import "./chunks/chunk-BR25DGIJ.js";
18
18
  import "./chunks/chunk-G2FD7S3C.js";
19
- import "./chunks/chunk-FM6XRXPX.js";
19
+ import "./chunks/chunk-BIGORSXS.js";
20
20
  import "./chunks/chunk-3C5UXR2U.js";
21
21
  import "./chunks/chunk-MAUEPAMG.js";
22
22
  import "./chunks/chunk-7GBL7SJY.js";
23
23
  import "./chunks/chunk-PBENCR5L.js";
24
24
  import "./chunks/chunk-RAKOB6IV.js";
25
- import "./chunks/chunk-GJMC3PGM.js";
25
+ import "./chunks/chunk-DRG4236Y.js";
26
26
  import "./chunks/chunk-FP4H7SFT.js";
27
27
  import "./chunks/chunk-MLSWIMZO.js";
28
28
  import "./chunks/chunk-WFB5TXRA.js";
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ import {
42
42
  import {
43
43
  graphBubbles,
44
44
  superbubblesFromGraph
45
- } from "./chunks/chunk-ZDJDM77V.js";
45
+ } from "./chunks/chunk-TF7H5LQS.js";
46
46
  import {
47
47
  bubbleSubgraph
48
48
  } from "./chunks/chunk-VHW7FDHU.js";
@@ -54,7 +54,7 @@ import {
54
54
  } from "./chunks/chunk-BXEPA4KS.js";
55
55
  import {
56
56
  bubbleHalos
57
- } from "./chunks/chunk-2AWUWGAD.js";
57
+ } from "./chunks/chunk-REM73HCU.js";
58
58
  import {
59
59
  BUBBLE_KIND_COLORS,
60
60
  BUBBLE_KIND_NAMES,
@@ -119,7 +119,7 @@ import {
119
119
  } from "./chunks/chunk-AZFVORTC.js";
120
120
  import {
121
121
  figureSvg
122
- } from "./chunks/chunk-HOOVOF2Y.js";
122
+ } from "./chunks/chunk-4DEOECM3.js";
123
123
  import {
124
124
  WALK_STRIP_CEILING_PX,
125
125
  cutsWholeWalks,
@@ -219,7 +219,7 @@ import {
219
219
  import "./chunks/chunk-G2FD7S3C.js";
220
220
  import {
221
221
  version
222
- } from "./chunks/chunk-FM6XRXPX.js";
222
+ } from "./chunks/chunk-BIGORSXS.js";
223
223
  import {
224
224
  walkRowLabels,
225
225
  walkRowsExtent
@@ -255,7 +255,7 @@ import {
255
255
  LEGEND_INSET_PX,
256
256
  geneCoverageNote,
257
257
  layoutLabels
258
- } from "./chunks/chunk-GJMC3PGM.js";
258
+ } from "./chunks/chunk-DRG4236Y.js";
259
259
  import {
260
260
  findHoveredEdge,
261
261
  findHoveredNode
@@ -4,7 +4,7 @@ import {
4
4
  geneCoverageNote,
5
5
  geneLabelCandidates,
6
6
  layoutLabels
7
- } from "./chunks/chunk-GJMC3PGM.js";
7
+ } from "./chunks/chunk-DRG4236Y.js";
8
8
  import "./chunks/chunk-FP4H7SFT.js";
9
9
  import "./chunks/chunk-MLSWIMZO.js";
10
10
  import "./chunks/chunk-WFB5TXRA.js";
@@ -10,6 +10,7 @@ export interface BubbleHalo {
10
10
  members: number;
11
11
  nodeIds: string[];
12
12
  whole: boolean;
13
+ tick: boolean;
13
14
  routes: RouteLabel[];
14
15
  }
15
16
  export interface RouteLabel {
@@ -19,4 +20,5 @@ export interface RouteLabel {
19
20
  }
20
21
  export declare const WHOLE_FRACTION = 0.9;
21
22
  export declare function coversGraph(members: number, nodes: number): boolean;
23
+ export declare const SMALL_VARIANT_BP = 50;
22
24
  export declare function bubbleHalos(graph: Graph, bubbles: MinigraphBubble[], positions: Record<string, NodeSegment[]>, walkLabel?: (name: string) => string, repeats?: readonly RepeatSpan[]): BubbleHalo[];
@@ -14,6 +14,7 @@ export interface MinigraphBubble {
14
14
  routes?: BubbleRoute[];
15
15
  key?: string;
16
16
  offReference?: true;
17
+ covering?: true;
17
18
  }
18
19
  export interface BubbleRoute {
19
20
  steps: string[];
@@ -1,5 +1,4 @@
1
1
  import type { MinigraphBubble } from './bubbleLine.js';
2
2
  import type { Graph } from '../types.js';
3
- export declare const MAX_SUPERBUBBLES = 50;
4
3
  export declare function superbubblesFromGraph(graph: Graph, span?: MinigraphBubble): MinigraphBubble[];
5
4
  export declare function graphBubbles(graph: Graph, span?: MinigraphBubble): MinigraphBubble[];
@@ -38,8 +38,14 @@ export interface LabelLayoutSource {
38
38
  alleleDeletions: AlleleDeletion[];
39
39
  positionsVersion: number;
40
40
  }
41
+ export interface BubbleTick {
42
+ item: BubbleHalo;
43
+ x: number;
44
+ y: number;
45
+ }
41
46
  export interface LabelLayout {
42
47
  bubbles: PlacedLabel<BubbleHalo>[];
48
+ ticks: BubbleTick[];
43
49
  genes: PlacedLabel<GenePin>[];
44
50
  routes: PlacedLabel<{
45
51
  halo: BubbleHalo;
@@ -1 +1 @@
1
- export declare const version = "9.2.0";
1
+ export declare const version = "9.4.0";
package/dist/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  version
3
- } from "./chunks/chunk-FM6XRXPX.js";
3
+ } from "./chunks/chunk-BIGORSXS.js";
4
4
  export {
5
5
  version
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/bandage-core",
3
- "version": "9.2.0",
3
+ "version": "9.4.0",
4
4
  "description": "Pangenome graph layout and drawing with no host: GFA in, the Bandage force-directed engine and reference-anchored layouts, a Canvas2D renderer, hit testing and labels out",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {