@jbrowse/bandage-core 6.0.4 → 6.1.1

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.
@@ -11,10 +11,11 @@ import {
11
11
  parseGFA
12
12
  } from "./chunk-CDLPYR5O.js";
13
13
  import {
14
+ closableDeletions,
14
15
  routeNodes,
15
16
  takeRoutes,
16
17
  withDeletionRoutes
17
- } from "./chunk-MI35EUIE.js";
18
+ } from "./chunk-STNG3Y5X.js";
18
19
  import {
19
20
  anchorGraph
20
21
  } from "./chunk-ST2IBUAN.js";
@@ -79,12 +80,14 @@ function engineRequest(graph, scaling, settings) {
79
80
  }
80
81
  function engineKey(graph, settings) {
81
82
  const anchored = graph.nodes.some(isBackbone);
82
- return `${settings.quality}|${settings.linearLayout}|${settings.bubbleSpread}|${settings.spacing ?? 1}|${settings.componentSeparation ?? 1}|${anchored}|${graph.referencePath ?? ""}`;
83
+ return `${settings.quality}|${settings.linearLayout}|${settings.bubbleSpread}|${settings.spacing ?? 1}|${settings.componentSeparation ?? 1}|${settings.showDeletionEdges !== false}|${anchored}|${graph.referencePath ?? ""}`;
83
84
  }
84
85
  async function forceLayout(graph, settings, engine) {
85
86
  const spread = spreadFor(settings.bubbleSpread);
86
- const deletions = deletionEdges(graph);
87
- const routed = withDeletionRoutes(graph, deletions);
87
+ const found = deletionEdges(graph);
88
+ const dropped = settings.showDeletionEdges === false ? closableDeletions(graph, found) : /* @__PURE__ */ new Set();
89
+ const deletions = found.filter((d) => !dropped.has(d.edgeIndex));
90
+ const routed = withDeletionRoutes(graph, deletions, dropped);
88
91
  const merged = mergeRuns(routed.graph, routed.ids);
89
92
  const runs = {
90
93
  ...merged.graph,
@@ -24,10 +24,10 @@ import {
24
24
  } from "./chunk-3S3YVOJ7.js";
25
25
  import {
26
26
  version
27
- } from "./chunk-QFBZQJFK.js";
27
+ } from "./chunk-XH43CLO2.js";
28
28
  import {
29
29
  axisScaleOf
30
- } from "./chunk-MQJUG2D2.js";
30
+ } from "./chunk-XJWN753L.js";
31
31
  import {
32
32
  facetLifts,
33
33
  walkLift
@@ -43,7 +43,7 @@ import {
43
43
  FIT_PADDING,
44
44
  drawingBounds,
45
45
  fitTransform
46
- } from "./chunk-IO2PCPZI.js";
46
+ } from "./chunk-7UIMNBJT.js";
47
47
  import {
48
48
  buildGeometry,
49
49
  computeReferenceRamp
@@ -1,13 +1,16 @@
1
1
  // src/layout/deletionRoutes.ts
2
2
  var ROUTE_ID = "\0deletion:";
3
3
  var ROUTE_FRACTION = 0.5;
4
- function withDeletionRoutes(graph, deletions) {
4
+ function withDeletionRoutes(graph, deletions, dropped = /* @__PURE__ */ new Set()) {
5
5
  const routes = new Map(
6
6
  deletions.map((d) => [d.edgeIndex, `${ROUTE_ID}${d.edgeIndex}`])
7
7
  );
8
8
  const edges = [];
9
9
  graph.edges.forEach((edge, ei) => {
10
10
  const id = routes.get(ei);
11
+ if (dropped.has(ei)) {
12
+ return;
13
+ }
11
14
  if (id === void 0) {
12
15
  edges.push(edge);
13
16
  } else {
@@ -36,6 +39,35 @@ function withDeletionRoutes(graph, deletions) {
36
39
  ids: new Set(routes.values())
37
40
  };
38
41
  }
42
+ function closableDeletions(graph, deletions) {
43
+ const parent = /* @__PURE__ */ new Map();
44
+ const root = (id) => {
45
+ let r = id;
46
+ while (parent.has(r)) {
47
+ r = parent.get(r);
48
+ }
49
+ if (r !== id) {
50
+ parent.set(id, r);
51
+ }
52
+ return r;
53
+ };
54
+ const join = (a, b) => {
55
+ const [ra, rb] = [root(a), root(b)];
56
+ if (ra !== rb) {
57
+ parent.set(ra, rb);
58
+ }
59
+ return ra !== rb;
60
+ };
61
+ const candidates = new Set(deletions.map((d) => d.edgeIndex));
62
+ graph.edges.forEach((e, ei) => {
63
+ if (!candidates.has(ei)) {
64
+ join(e.from, e.to);
65
+ }
66
+ });
67
+ return new Set(
68
+ deletions.filter((d) => !join(d.from, d.to)).map((d) => d.edgeIndex)
69
+ );
70
+ }
39
71
  function routeNodes(graph, deletions, routes, drawnOf, opts) {
40
72
  const lengths = new Map(graph.nodes.map((n) => [n.id, n.length]));
41
73
  return deletions.map((d) => {
@@ -71,6 +103,7 @@ function takeRoutes(positions, routes) {
71
103
 
72
104
  export {
73
105
  withDeletionRoutes,
106
+ closableDeletions,
74
107
  routeNodes,
75
108
  takeRoutes
76
109
  };
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var version = "6.0.4";
2
+ var version = "6.1.1";
3
3
 
4
4
  export {
5
5
  version
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clampZoom
3
- } from "./chunk-IO2PCPZI.js";
3
+ } from "./chunk-7UIMNBJT.js";
4
4
 
5
5
  // src/viewport.ts
6
6
  function axisScaleOf(scale, pixelRows) {
@@ -21,7 +21,7 @@ import {
21
21
  } from "../chunks/chunk-7XHHVYG7.js";
22
22
  import {
23
23
  figureSvg
24
- } from "../chunks/chunk-FZCOVJAL.js";
24
+ } from "../chunks/chunk-OSDI57GY.js";
25
25
  import "../chunks/chunk-47DYCZOK.js";
26
26
  import "../chunks/chunk-V5BPIOLS.js";
27
27
  import {
@@ -32,21 +32,21 @@ import "../chunks/chunk-CH3DLBUT.js";
32
32
  import "../chunks/chunk-4BYTEJGW.js";
33
33
  import "../chunks/chunk-BUBZ32IC.js";
34
34
  import "../chunks/chunk-3S3YVOJ7.js";
35
- import "../chunks/chunk-QFBZQJFK.js";
36
- import "../chunks/chunk-MQJUG2D2.js";
35
+ import "../chunks/chunk-XH43CLO2.js";
36
+ import "../chunks/chunk-XJWN753L.js";
37
37
  import "../chunks/chunk-ZKGM7VLA.js";
38
38
  import "../chunks/chunk-X4VVPLI5.js";
39
39
  import "../chunks/chunk-GOY6REMT.js";
40
40
  import {
41
41
  forceLayout,
42
42
  loadGraph
43
- } from "../chunks/chunk-IO2PCPZI.js";
43
+ } from "../chunks/chunk-7UIMNBJT.js";
44
44
  import "../chunks/chunk-PUG7LXDF.js";
45
45
  import "../chunks/chunk-IGVV37VI.js";
46
46
  import "../chunks/chunk-72N5DJHZ.js";
47
47
  import "../chunks/chunk-QYBZZI5H.js";
48
48
  import "../chunks/chunk-CDLPYR5O.js";
49
- import "../chunks/chunk-MI35EUIE.js";
49
+ import "../chunks/chunk-STNG3Y5X.js";
50
50
  import "../chunks/chunk-ZHCDYSA5.js";
51
51
  import "../chunks/chunk-RX5CSWJW.js";
52
52
  import "../chunks/chunk-UMNCCYBN.js";
@@ -241,7 +241,8 @@ async function renderSpec(spec, base) {
241
241
  linearLayout: false,
242
242
  bubbleSpread: spec.bubbleSpread ?? "auto",
243
243
  spacing: spec.spacing,
244
- componentSeparation: spec.componentSeparation
244
+ componentSeparation: spec.componentSeparation,
245
+ showDeletionEdges: !!spec.showDeletionEdges
245
246
  },
246
247
  engine
247
248
  )).result;
package/dist/figure.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  figureSvg
3
- } from "./chunks/chunk-FZCOVJAL.js";
3
+ } from "./chunks/chunk-OSDI57GY.js";
4
4
  import "./chunks/chunk-47DYCZOK.js";
5
5
  import "./chunks/chunk-V5BPIOLS.js";
6
6
  import "./chunks/chunk-PJESIRDU.js";
@@ -8,18 +8,18 @@ import "./chunks/chunk-CH3DLBUT.js";
8
8
  import "./chunks/chunk-4BYTEJGW.js";
9
9
  import "./chunks/chunk-BUBZ32IC.js";
10
10
  import "./chunks/chunk-3S3YVOJ7.js";
11
- import "./chunks/chunk-QFBZQJFK.js";
12
- import "./chunks/chunk-MQJUG2D2.js";
11
+ import "./chunks/chunk-XH43CLO2.js";
12
+ import "./chunks/chunk-XJWN753L.js";
13
13
  import "./chunks/chunk-ZKGM7VLA.js";
14
14
  import "./chunks/chunk-X4VVPLI5.js";
15
15
  import "./chunks/chunk-GOY6REMT.js";
16
- import "./chunks/chunk-IO2PCPZI.js";
16
+ import "./chunks/chunk-7UIMNBJT.js";
17
17
  import "./chunks/chunk-PUG7LXDF.js";
18
18
  import "./chunks/chunk-IGVV37VI.js";
19
19
  import "./chunks/chunk-72N5DJHZ.js";
20
20
  import "./chunks/chunk-QYBZZI5H.js";
21
21
  import "./chunks/chunk-CDLPYR5O.js";
22
- import "./chunks/chunk-MI35EUIE.js";
22
+ import "./chunks/chunk-STNG3Y5X.js";
23
23
  import "./chunks/chunk-ZHCDYSA5.js";
24
24
  import "./chunks/chunk-RX5CSWJW.js";
25
25
  import "./chunks/chunk-UMNCCYBN.js";
package/dist/index.js CHANGED
@@ -80,7 +80,7 @@ import {
80
80
  } from "./chunks/chunk-7XHHVYG7.js";
81
81
  import {
82
82
  figureSvg
83
- } from "./chunks/chunk-FZCOVJAL.js";
83
+ } from "./chunks/chunk-OSDI57GY.js";
84
84
  import {
85
85
  svgCanvas
86
86
  } from "./chunks/chunk-47DYCZOK.js";
@@ -133,7 +133,7 @@ import {
133
133
  } from "./chunks/chunk-3S3YVOJ7.js";
134
134
  import {
135
135
  version
136
- } from "./chunks/chunk-QFBZQJFK.js";
136
+ } from "./chunks/chunk-XH43CLO2.js";
137
137
  import {
138
138
  axisScaleOf,
139
139
  contains,
@@ -141,7 +141,7 @@ import {
141
141
  screenToLayout,
142
142
  viewportOf,
143
143
  zoomAbout
144
- } from "./chunks/chunk-MQJUG2D2.js";
144
+ } from "./chunks/chunk-XJWN753L.js";
145
145
  import {
146
146
  facetLifts,
147
147
  walkHighlight,
@@ -170,13 +170,13 @@ import {
170
170
  forceLayout,
171
171
  layoutExtent,
172
172
  loadGraph
173
- } from "./chunks/chunk-IO2PCPZI.js";
173
+ } from "./chunks/chunk-7UIMNBJT.js";
174
174
  import "./chunks/chunk-PUG7LXDF.js";
175
175
  import "./chunks/chunk-IGVV37VI.js";
176
176
  import "./chunks/chunk-72N5DJHZ.js";
177
177
  import "./chunks/chunk-QYBZZI5H.js";
178
178
  import "./chunks/chunk-CDLPYR5O.js";
179
- import "./chunks/chunk-MI35EUIE.js";
179
+ import "./chunks/chunk-STNG3Y5X.js";
180
180
  import {
181
181
  RAMP_GRADIENT_CSS,
182
182
  rampHue,
@@ -1,9 +1,11 @@
1
1
  import {
2
+ closableDeletions,
2
3
  routeNodes,
3
4
  takeRoutes,
4
5
  withDeletionRoutes
5
- } from "../chunks/chunk-MI35EUIE.js";
6
+ } from "../chunks/chunk-STNG3Y5X.js";
6
7
  export {
8
+ closableDeletions,
7
9
  routeNodes,
8
10
  takeRoutes,
9
11
  withDeletionRoutes
package/dist/pipeline.js CHANGED
@@ -9,13 +9,13 @@ import {
9
9
  forceLayout,
10
10
  layoutExtent,
11
11
  loadGraph
12
- } from "./chunks/chunk-IO2PCPZI.js";
12
+ } from "./chunks/chunk-7UIMNBJT.js";
13
13
  import "./chunks/chunk-PUG7LXDF.js";
14
14
  import "./chunks/chunk-IGVV37VI.js";
15
15
  import "./chunks/chunk-72N5DJHZ.js";
16
16
  import "./chunks/chunk-QYBZZI5H.js";
17
17
  import "./chunks/chunk-CDLPYR5O.js";
18
- import "./chunks/chunk-MI35EUIE.js";
18
+ import "./chunks/chunk-STNG3Y5X.js";
19
19
  import "./chunks/chunk-ST2IBUAN.js";
20
20
  import "./chunks/chunk-ES2N6V56.js";
21
21
  import "./chunks/chunk-TAMCZHLW.js";
@@ -2,7 +2,7 @@ import type { BandageScaleOpts } from './drawnScale.js';
2
2
  import type { DeletionEdge } from '../deletionEdges.js';
3
3
  import type { Graph, GraphEdge, GraphNode, NodeSegment } from '../types.js';
4
4
  export type DeletionRoutes = Record<number, NodeSegment[]>;
5
- export declare function withDeletionRoutes(graph: Graph, deletions: DeletionEdge[]): {
5
+ export declare function withDeletionRoutes(graph: Graph, deletions: DeletionEdge[], dropped?: Set<number>): {
6
6
  graph: {
7
7
  nodes: {
8
8
  id: string;
@@ -22,6 +22,7 @@ export declare function withDeletionRoutes(graph: Graph, deletions: DeletionEdge
22
22
  routes: Map<number, string>;
23
23
  ids: Set<string>;
24
24
  };
25
+ export declare function closableDeletions(graph: Graph, deletions: DeletionEdge[]): Set<number>;
25
26
  export declare function routeNodes(graph: Graph, deletions: DeletionEdge[], routes: Map<number, string>, drawnOf: (bp: number) => number, opts: BandageScaleOpts): GraphNode[];
26
27
  export declare function takeRoutes(positions: Record<string, NodeSegment[]>, routes: Map<number, string>): {
27
28
  nodePositions: {
@@ -29,6 +29,7 @@ export interface EngineSettings {
29
29
  bubbleSpread: BubbleSpread;
30
30
  spacing?: number;
31
31
  componentSeparation?: number;
32
+ showDeletionEdges?: boolean;
32
33
  }
33
34
  export declare function engineRequest(graph: Graph, scaling: LayoutScaling, settings: EngineSettings): EngineRequest;
34
35
  export declare function engineKey(graph: Graph, settings: EngineSettings): string;
@@ -1 +1 @@
1
- export declare const version = "6.0.4";
1
+ export declare const version = "6.1.1";
package/dist/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  version
3
- } from "./chunks/chunk-QFBZQJFK.js";
3
+ } from "./chunks/chunk-XH43CLO2.js";
4
4
  export {
5
5
  version
6
6
  };
package/dist/viewport.js CHANGED
@@ -5,14 +5,14 @@ import {
5
5
  screenToLayout,
6
6
  viewportOf,
7
7
  zoomAbout
8
- } from "./chunks/chunk-MQJUG2D2.js";
9
- import "./chunks/chunk-IO2PCPZI.js";
8
+ } from "./chunks/chunk-XJWN753L.js";
9
+ import "./chunks/chunk-7UIMNBJT.js";
10
10
  import "./chunks/chunk-PUG7LXDF.js";
11
11
  import "./chunks/chunk-IGVV37VI.js";
12
12
  import "./chunks/chunk-72N5DJHZ.js";
13
13
  import "./chunks/chunk-QYBZZI5H.js";
14
14
  import "./chunks/chunk-CDLPYR5O.js";
15
- import "./chunks/chunk-MI35EUIE.js";
15
+ import "./chunks/chunk-STNG3Y5X.js";
16
16
  import "./chunks/chunk-ST2IBUAN.js";
17
17
  import "./chunks/chunk-ES2N6V56.js";
18
18
  import "./chunks/chunk-TAMCZHLW.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/bandage-core",
3
- "version": "6.0.4",
3
+ "version": "6.1.1",
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": {