@jbrowse/bandage-core 9.2.0 → 9.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.
@@ -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-ABOZYAN5.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-ROYHPOYF.js";
6
5
  import "../chunks/chunk-VHW7FDHU.js";
7
- import "../chunks/chunk-2AWUWGAD.js";
6
+ import "../chunks/chunk-ABOZYAN5.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
  };
@@ -92,24 +92,24 @@ function layoutLabels(m) {
92
92
  const onRows = m.drawnRowLabels.length > 0;
93
93
  const rowsTop = onRows ? Math.min(...m.drawnRowLabels.map((r) => r.y)) : Infinity;
94
94
  const halo = m.contigThickness * HALO_FACTOR;
95
- const byBubble = byExtent(m.bubbleHalos, (h) => h.members);
95
+ const above = (h, gap) => {
96
+ const { x, y } = screen({
97
+ x: h.labelAt.x,
98
+ y: Math.min(h.labelAt.y, rowsTop)
99
+ });
100
+ const baseline = y - halo / 2 - gap;
101
+ return { x, y: onRows ? Math.max(baseline, TOPMOST_BASELINE) : baseline };
102
+ };
103
+ const byBubble = byExtent(
104
+ m.bubbleHalos.filter((h) => !h.tick),
105
+ (h) => h.members
106
+ );
96
107
  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
- }),
108
+ byBubble.map((h) => ({ item: h, ...above(h, 6), text: h.label })),
110
109
  frame,
111
110
  take
112
111
  );
112
+ 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
113
  const genes = placeLabels(
114
114
  geneLabelCandidates(
115
115
  m.genePins,
@@ -162,6 +162,7 @@ function layoutLabels(m) {
162
162
  );
163
163
  return {
164
164
  bubbles,
165
+ ticks,
165
166
  genes,
166
167
  routes,
167
168
  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 = []) {
@@ -95,6 +96,8 @@ function bubbleHalos(graph, bubbles, positions, walkLabel = (name) => name, repe
95
96
  members: nodeIds.length,
96
97
  nodeIds,
97
98
  whole: coversGraph(nodeIds.length, graph.nodes.length),
99
+ // a partial bubble's lengths are a floor, so it may be no small variant
100
+ tick: !bubble.partial && bubble.longestAlleleLength < SMALL_VARIANT_BP,
98
101
  routes
99
102
  });
100
103
  }
@@ -110,5 +113,6 @@ function routeText(route, walkLabel) {
110
113
  export {
111
114
  WHOLE_FRACTION,
112
115
  coversGraph,
116
+ SMALL_VARIANT_BP,
113
117
  bubbleHalos
114
118
  };
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var version = "9.2.0";
2
+ var version = "9.3.0";
3
3
 
4
4
  export {
5
5
  version
@@ -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-ABOZYAN5.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) => {
@@ -267,7 +268,6 @@ function graphBubbles(graph, span) {
267
268
  }
268
269
 
269
270
  export {
270
- MAX_SUPERBUBBLES,
271
271
  superbubblesFromGraph,
272
272
  graphBubbles
273
273
  };
@@ -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-BTMPPLDF.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-3FOOZ5VL.js";
66
66
  import {
67
67
  nodesUnderBox
68
68
  } from "./chunk-FP4H7SFT.js";
@@ -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-TL3TYSCP.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-BTMPPLDF.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-3FOOZ5VL.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-TL3TYSCP.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-BTMPPLDF.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-3FOOZ5VL.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-ROYHPOYF.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-ABOZYAN5.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-TL3TYSCP.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-BTMPPLDF.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-3FOOZ5VL.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-3FOOZ5VL.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[];
@@ -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.3.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-BTMPPLDF.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.3.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": {