@jbrowse/bandage-core 10.2.3 → 10.2.4
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.
- package/README.md +2 -0
- package/dist/bubbles/bubbleHalos.js +1 -1
- package/dist/bubbles/superbubbles.js +2 -2
- package/dist/chunks/{chunk-J5FWKGOY.js → chunk-2CHS5LMM.js} +1 -1
- package/dist/chunks/{chunk-XA5A27CS.js → chunk-ABUIN5AK.js} +1 -1
- package/dist/chunks/{chunk-3AOGOCCQ.js → chunk-GINYTQ43.js} +2 -2
- package/dist/chunks/chunk-JA2HJIYS.js +71 -0
- package/dist/chunks/{chunk-YN6FDIBT.js → chunk-KC7T5RWG.js} +0 -18
- package/dist/chunks/{chunk-7CC7N3XC.js → chunk-XAWLIU54.js} +1 -1
- package/dist/cli/figure.js +4 -4
- package/dist/figure.js +3 -3
- package/dist/figureData.js +2 -2
- package/dist/index.js +6 -6
- package/dist/labelLayout.js +1 -1
- package/dist/types/bubbles/bubbleHalos.d.ts +2 -8
- package/dist/types/labelLayout.d.ts +1 -5
- package/dist/types/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-JFY5PWQC.js +0 -137
package/README.md
CHANGED
|
@@ -65,6 +65,8 @@ publishes to npm with trusted publishing.
|
|
|
65
65
|
JBrowse 2 plugin that browses these graphs by locus
|
|
66
66
|
- [BandageJS](https://github.com/cmdcolin/BandageJS) - standalone page for GFA
|
|
67
67
|
and gbz-base graphs
|
|
68
|
+
- [@jbrowse/graph-fmmm-layout](https://github.com/GMOD/graph-fmmm-layout) -
|
|
69
|
+
Bandage's FMMM layout as wasm
|
|
68
70
|
- [@jbrowse/graph-stress-layout](https://github.com/GMOD/graph-stress-layout) -
|
|
69
71
|
stress layout that keeps the reference straight
|
|
70
72
|
- [@gmod/gbz-base](https://github.com/GMOD/gbz-base-js) - range-request reader
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
graphBubbles,
|
|
3
3
|
superbubblesFromGraph
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-ABUIN5AK.js";
|
|
5
5
|
import "../chunks/chunk-CQHUZHET.js";
|
|
6
6
|
import "../chunks/chunk-T6V4KI2L.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-JA2HJIYS.js";
|
|
8
8
|
import "../chunks/chunk-URZ3CH2R.js";
|
|
9
9
|
import "../chunks/chunk-FX4RDMDN.js";
|
|
10
10
|
import "../chunks/chunk-CM6LO6OC.js";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./chunk-RPRHR56C.js";
|
|
25
25
|
import {
|
|
26
26
|
geneLabelCandidates
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-KC7T5RWG.js";
|
|
28
28
|
import {
|
|
29
29
|
nodesUnderBox
|
|
30
30
|
} from "./chunk-4HWM3FNK.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
} from "./chunk-H2H4Y3TV.js";
|
|
35
35
|
import {
|
|
36
36
|
version
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-2CHS5LMM.js";
|
|
38
38
|
import {
|
|
39
39
|
axisScaleOf
|
|
40
40
|
} from "./chunk-BS4UZ44I.js";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bubbleSegmentIds,
|
|
3
|
+
classifyBubble
|
|
4
|
+
} from "./chunk-URZ3CH2R.js";
|
|
5
|
+
import {
|
|
6
|
+
svgPath
|
|
7
|
+
} from "./chunk-7SRWJLSC.js";
|
|
8
|
+
import {
|
|
9
|
+
isBackbone
|
|
10
|
+
} from "./chunk-FYQWPEEY.js";
|
|
11
|
+
|
|
12
|
+
// src/bubbles/bubbleHalos.ts
|
|
13
|
+
var WHOLE_FRACTION = 0.9;
|
|
14
|
+
function coversGraph(members, nodes) {
|
|
15
|
+
return members + 2 >= nodes || members >= WHOLE_FRACTION * nodes;
|
|
16
|
+
}
|
|
17
|
+
var SMALL_VARIANT_BP = 50;
|
|
18
|
+
function bubbleHalos(graph, bubbles, positions, repeats = []) {
|
|
19
|
+
const byName = new Map(graph.nodes.map((n) => [n.name, n]));
|
|
20
|
+
const halos = [];
|
|
21
|
+
for (const bubble of bubbles) {
|
|
22
|
+
const parts = [];
|
|
23
|
+
let minX = Infinity;
|
|
24
|
+
let maxX = -Infinity;
|
|
25
|
+
let minY = Infinity;
|
|
26
|
+
const nodeIds = [];
|
|
27
|
+
const names = bubbleSegmentIds(bubble);
|
|
28
|
+
for (const [i, name] of names.entries()) {
|
|
29
|
+
const node = byName.get(name);
|
|
30
|
+
const line = node && positions[node.id];
|
|
31
|
+
if (!node || !line?.length) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (bubble.key ? i === 0 || i === names.length - 1 : isBackbone(node) && (node.stable.start < bubble.start || node.stable.start >= bubble.end)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
nodeIds.push(node.id);
|
|
38
|
+
parts.push(svgPath(line.length === 1 ? [line[0], line[0]] : line));
|
|
39
|
+
for (const p of line) {
|
|
40
|
+
minX = Math.min(minX, p.x);
|
|
41
|
+
maxX = Math.max(maxX, p.x);
|
|
42
|
+
minY = Math.min(minY, p.y);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (nodeIds.length === 0) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const labelAt = { x: (minX + maxX) / 2, y: minY };
|
|
49
|
+
const whole = bubble.covering === true || coversGraph(nodeIds.length, graph.nodes.length);
|
|
50
|
+
halos.push({
|
|
51
|
+
bubble,
|
|
52
|
+
...classifyBubble(bubble, repeats),
|
|
53
|
+
path: parts.join(""),
|
|
54
|
+
labelAt,
|
|
55
|
+
members: nodeIds.length,
|
|
56
|
+
nodeIds,
|
|
57
|
+
whole,
|
|
58
|
+
// The drawing's own bubble keeps its name however small. A partial
|
|
59
|
+
// bubble's lengths are a floor, so it may be no small variant.
|
|
60
|
+
tick: !whole && !bubble.partial && bubble.longestAlleleLength < SMALL_VARIANT_BP
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return halos;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
WHOLE_FRACTION,
|
|
68
|
+
coversGraph,
|
|
69
|
+
SMALL_VARIANT_BP,
|
|
70
|
+
bubbleHalos
|
|
71
|
+
};
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
// src/labelLayout.ts
|
|
19
19
|
var HALO_FACTOR = 3.4;
|
|
20
20
|
var LEGEND_INSET_PX = 6;
|
|
21
|
-
var ROUTE_STACK = 8;
|
|
22
21
|
var GENE_PIN_DROP_PX = 18;
|
|
23
22
|
var GENE_STACK = 2;
|
|
24
23
|
var BUBBLE_STACK = 3;
|
|
@@ -147,22 +146,6 @@ function layoutLabels(m) {
|
|
|
147
146
|
version: m.positionsVersion
|
|
148
147
|
}) : { deletions: [], nodes: [] };
|
|
149
148
|
const deletionLabels = placeSizeLabels(sizeCandidates.deletions, take);
|
|
150
|
-
const routes = placeLabels(
|
|
151
|
-
byBubble.flatMap(
|
|
152
|
-
(h) => h.routes.map((route) => {
|
|
153
|
-
const { x, y } = screen(route.at);
|
|
154
|
-
return {
|
|
155
|
-
item: { halo: h, route },
|
|
156
|
-
x,
|
|
157
|
-
y: y + 4,
|
|
158
|
-
text: route.text,
|
|
159
|
-
stack: ROUTE_STACK
|
|
160
|
-
};
|
|
161
|
-
})
|
|
162
|
-
),
|
|
163
|
-
frame,
|
|
164
|
-
take
|
|
165
|
-
);
|
|
166
149
|
const nodeLabels = placeSizeLabels(
|
|
167
150
|
sizeCandidates.nodes,
|
|
168
151
|
take,
|
|
@@ -172,7 +155,6 @@ function layoutLabels(m) {
|
|
|
172
155
|
bubbles,
|
|
173
156
|
ticks,
|
|
174
157
|
genes,
|
|
175
|
-
routes,
|
|
176
158
|
sizes: [...deletionLabels, ...nodeLabels]
|
|
177
159
|
};
|
|
178
160
|
}
|
package/dist/cli/figure.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "../chunks/chunk-G6UIYQZR.js";
|
|
8
8
|
import {
|
|
9
9
|
figureSvg
|
|
10
|
-
} from "../chunks/chunk-
|
|
10
|
+
} from "../chunks/chunk-GINYTQ43.js";
|
|
11
11
|
import "../chunks/chunk-RUCH6ZFL.js";
|
|
12
12
|
import "../chunks/chunk-BAETMD3J.js";
|
|
13
13
|
import {
|
|
@@ -19,14 +19,14 @@ import "../chunks/chunk-RBCE2OQH.js";
|
|
|
19
19
|
import "../chunks/chunk-JSUCGZ6K.js";
|
|
20
20
|
import "../chunks/chunk-RPRHR56C.js";
|
|
21
21
|
import "../chunks/chunk-XL472HHD.js";
|
|
22
|
-
import "../chunks/chunk-
|
|
22
|
+
import "../chunks/chunk-KC7T5RWG.js";
|
|
23
23
|
import "../chunks/chunk-4HWM3FNK.js";
|
|
24
24
|
import "../chunks/chunk-KBEP7VYK.js";
|
|
25
25
|
import "../chunks/chunk-H2H4Y3TV.js";
|
|
26
26
|
import {
|
|
27
27
|
laidOutGraph,
|
|
28
28
|
walkLayers
|
|
29
|
-
} from "../chunks/chunk-
|
|
29
|
+
} from "../chunks/chunk-XAWLIU54.js";
|
|
30
30
|
import {
|
|
31
31
|
LAYOUT_ENGINE_VALUES,
|
|
32
32
|
isLayoutEngineKind
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from "../chunks/chunk-VQWHMWLF.js";
|
|
52
52
|
import "../chunks/chunk-Q7LYHGGQ.js";
|
|
53
53
|
import "../chunks/chunk-WSIFAZU7.js";
|
|
54
|
-
import "../chunks/chunk-
|
|
54
|
+
import "../chunks/chunk-2CHS5LMM.js";
|
|
55
55
|
import "../chunks/chunk-BS4UZ44I.js";
|
|
56
56
|
import "../chunks/chunk-4ETPXDO6.js";
|
|
57
57
|
import "../chunks/chunk-D5D36ZF6.js";
|
package/dist/figure.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
figureSvg
|
|
3
|
-
} from "./chunks/chunk-
|
|
3
|
+
} from "./chunks/chunk-GINYTQ43.js";
|
|
4
4
|
import "./chunks/chunk-RUCH6ZFL.js";
|
|
5
5
|
import "./chunks/chunk-BAETMD3J.js";
|
|
6
6
|
import "./chunks/chunk-EFQLEGWM.js";
|
|
@@ -9,11 +9,11 @@ import "./chunks/chunk-RBCE2OQH.js";
|
|
|
9
9
|
import "./chunks/chunk-JSUCGZ6K.js";
|
|
10
10
|
import "./chunks/chunk-RPRHR56C.js";
|
|
11
11
|
import "./chunks/chunk-XL472HHD.js";
|
|
12
|
-
import "./chunks/chunk-
|
|
12
|
+
import "./chunks/chunk-KC7T5RWG.js";
|
|
13
13
|
import "./chunks/chunk-4HWM3FNK.js";
|
|
14
14
|
import "./chunks/chunk-KBEP7VYK.js";
|
|
15
15
|
import "./chunks/chunk-H2H4Y3TV.js";
|
|
16
|
-
import "./chunks/chunk-
|
|
16
|
+
import "./chunks/chunk-2CHS5LMM.js";
|
|
17
17
|
import "./chunks/chunk-BS4UZ44I.js";
|
|
18
18
|
import "./chunks/chunk-4ETPXDO6.js";
|
|
19
19
|
import "./chunks/chunk-D5D36ZF6.js";
|
package/dist/figureData.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
gfaFigureData,
|
|
4
4
|
laidOutGraph,
|
|
5
5
|
walkLayers
|
|
6
|
-
} from "./chunks/chunk-
|
|
6
|
+
} from "./chunks/chunk-XAWLIU54.js";
|
|
7
7
|
import "./chunks/chunk-JMABOQWL.js";
|
|
8
8
|
import "./chunks/chunk-WL6ZKUVC.js";
|
|
9
9
|
import "./chunks/chunk-LOEA5IHZ.js";
|
|
@@ -17,7 +17,7 @@ import "./chunks/chunk-RVS2QCOX.js";
|
|
|
17
17
|
import "./chunks/chunk-VQWHMWLF.js";
|
|
18
18
|
import "./chunks/chunk-Q7LYHGGQ.js";
|
|
19
19
|
import "./chunks/chunk-WSIFAZU7.js";
|
|
20
|
-
import "./chunks/chunk-
|
|
20
|
+
import "./chunks/chunk-2CHS5LMM.js";
|
|
21
21
|
import "./chunks/chunk-BS4UZ44I.js";
|
|
22
22
|
import "./chunks/chunk-4ETPXDO6.js";
|
|
23
23
|
import "./chunks/chunk-D5D36ZF6.js";
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
import {
|
|
46
46
|
graphBubbles,
|
|
47
47
|
superbubblesFromGraph
|
|
48
|
-
} from "./chunks/chunk-
|
|
48
|
+
} from "./chunks/chunk-ABUIN5AK.js";
|
|
49
49
|
import {
|
|
50
50
|
bubblesFromGraph
|
|
51
51
|
} from "./chunks/chunk-CQHUZHET.js";
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
} from "./chunks/chunk-G6UIYQZR.js";
|
|
61
61
|
import {
|
|
62
62
|
bubbleHalos
|
|
63
|
-
} from "./chunks/chunk-
|
|
63
|
+
} from "./chunks/chunk-JA2HJIYS.js";
|
|
64
64
|
import {
|
|
65
65
|
BUBBLE_KIND_COLORS,
|
|
66
66
|
BUBBLE_KIND_NAMES,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
} from "./chunks/chunk-AZFVORTC.js";
|
|
84
84
|
import {
|
|
85
85
|
figureSvg
|
|
86
|
-
} from "./chunks/chunk-
|
|
86
|
+
} from "./chunks/chunk-GINYTQ43.js";
|
|
87
87
|
import {
|
|
88
88
|
svgCanvas
|
|
89
89
|
} from "./chunks/chunk-RUCH6ZFL.js";
|
|
@@ -151,7 +151,7 @@ import {
|
|
|
151
151
|
LEGEND_INSET_PX,
|
|
152
152
|
geneCoverageNote,
|
|
153
153
|
layoutLabels
|
|
154
|
-
} from "./chunks/chunk-
|
|
154
|
+
} from "./chunks/chunk-KC7T5RWG.js";
|
|
155
155
|
import {
|
|
156
156
|
findHoveredEdge,
|
|
157
157
|
findHoveredNode
|
|
@@ -164,7 +164,7 @@ import {
|
|
|
164
164
|
import {
|
|
165
165
|
figureData,
|
|
166
166
|
gfaFigureData
|
|
167
|
-
} from "./chunks/chunk-
|
|
167
|
+
} from "./chunks/chunk-XAWLIU54.js";
|
|
168
168
|
import {
|
|
169
169
|
LAYOUT_ENGINES,
|
|
170
170
|
layoutEngine
|
|
@@ -201,7 +201,7 @@ import {
|
|
|
201
201
|
import "./chunks/chunk-WSIFAZU7.js";
|
|
202
202
|
import {
|
|
203
203
|
version
|
|
204
|
-
} from "./chunks/chunk-
|
|
204
|
+
} from "./chunks/chunk-2CHS5LMM.js";
|
|
205
205
|
import {
|
|
206
206
|
axisScaleOf,
|
|
207
207
|
contains,
|
package/dist/labelLayout.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MinigraphBubble } from './bubbleLine.js';
|
|
2
2
|
import type { BubbleKind, RepeatSpan } from './classifyBubble.js';
|
|
3
3
|
import type { Graph, NodeSegment } from '../types.js';
|
|
4
4
|
export interface BubbleHalo {
|
|
@@ -11,14 +11,8 @@ export interface BubbleHalo {
|
|
|
11
11
|
nodeIds: string[];
|
|
12
12
|
whole: boolean;
|
|
13
13
|
tick: boolean;
|
|
14
|
-
routes: RouteLabel[];
|
|
15
|
-
}
|
|
16
|
-
export interface RouteLabel {
|
|
17
|
-
route: BubbleRoute;
|
|
18
|
-
at: NodeSegment;
|
|
19
|
-
text: string;
|
|
20
14
|
}
|
|
21
15
|
export declare const WHOLE_FRACTION = 0.9;
|
|
22
16
|
export declare function coversGraph(members: number, nodes: number): boolean;
|
|
23
17
|
export declare const SMALL_VARIANT_BP = 50;
|
|
24
|
-
export declare function bubbleHalos(graph: Graph, bubbles: MinigraphBubble[], positions: Record<string, NodeSegment[]>,
|
|
18
|
+
export declare function bubbleHalos(graph: Graph, bubbles: MinigraphBubble[], positions: Record<string, NodeSegment[]>, repeats?: readonly RepeatSpan[]): BubbleHalo[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BubbleHalo
|
|
1
|
+
import type { BubbleHalo } from './bubbles/bubbleHalos.js';
|
|
2
2
|
import type { DeletionEdge } from './deletionEdges.js';
|
|
3
3
|
import type { GenePin } from './genes/genePins.js';
|
|
4
4
|
import type { GraphLabel } from './graphLabels.js';
|
|
@@ -47,10 +47,6 @@ export interface LabelLayout {
|
|
|
47
47
|
bubbles: PlacedLabel<BubbleHalo>[];
|
|
48
48
|
ticks: BubbleTick[];
|
|
49
49
|
genes: PlacedLabel<GenePin>[];
|
|
50
|
-
routes: PlacedLabel<{
|
|
51
|
-
halo: BubbleHalo;
|
|
52
|
-
route: RouteLabel;
|
|
53
|
-
}>[];
|
|
54
50
|
sizes: GraphLabel[];
|
|
55
51
|
}
|
|
56
52
|
export declare function geneCoverageNote(pin: GenePin): string | undefined;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "10.2.
|
|
1
|
+
export declare const version = "10.2.4";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/bandage-core",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.4",
|
|
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": {
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
bubbleSegmentIds,
|
|
3
|
-
classifyBubble
|
|
4
|
-
} from "./chunk-URZ3CH2R.js";
|
|
5
|
-
import {
|
|
6
|
-
formatBp
|
|
7
|
-
} from "./chunk-PTABFYQ7.js";
|
|
8
|
-
import {
|
|
9
|
-
svgPath
|
|
10
|
-
} from "./chunk-7SRWJLSC.js";
|
|
11
|
-
import {
|
|
12
|
-
isBackbone
|
|
13
|
-
} from "./chunk-FYQWPEEY.js";
|
|
14
|
-
|
|
15
|
-
// src/bubbles/bubbleHalos.ts
|
|
16
|
-
var WHOLE_FRACTION = 0.9;
|
|
17
|
-
function coversGraph(members, nodes) {
|
|
18
|
-
return members + 2 >= nodes || members >= WHOLE_FRACTION * nodes;
|
|
19
|
-
}
|
|
20
|
-
var SMALL_VARIANT_BP = 50;
|
|
21
|
-
var NAMED_WALKS = 2;
|
|
22
|
-
var MIN_CHIPPED_BP = 1e3;
|
|
23
|
-
function bubbleHalos(graph, bubbles, positions, walkLabel = (name) => name, repeats = []) {
|
|
24
|
-
const byName = new Map(graph.nodes.map((n) => [n.name, n]));
|
|
25
|
-
const halos = [];
|
|
26
|
-
for (const bubble of bubbles) {
|
|
27
|
-
const parts = [];
|
|
28
|
-
let minX = Infinity;
|
|
29
|
-
let maxX = -Infinity;
|
|
30
|
-
let minY = Infinity;
|
|
31
|
-
const nodeIds = [];
|
|
32
|
-
const ends = [];
|
|
33
|
-
const names = bubbleSegmentIds(bubble);
|
|
34
|
-
for (const [i, name] of names.entries()) {
|
|
35
|
-
const node = byName.get(name);
|
|
36
|
-
const line = node && positions[node.id];
|
|
37
|
-
if (!node || !line?.length) {
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (bubble.key ? i === 0 || i === names.length - 1 : isBackbone(node) && (node.stable.start < bubble.start || node.stable.start >= bubble.end)) {
|
|
41
|
-
ends.push(line[Math.floor(line.length / 2)]);
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
nodeIds.push(node.id);
|
|
45
|
-
parts.push(svgPath(line.length === 1 ? [line[0], line[0]] : line));
|
|
46
|
-
for (const p of line) {
|
|
47
|
-
minX = Math.min(minX, p.x);
|
|
48
|
-
maxX = Math.max(maxX, p.x);
|
|
49
|
-
minY = Math.min(minY, p.y);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (nodeIds.length === 0) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
const labelAt = { x: (minX + maxX) / 2, y: minY };
|
|
56
|
-
const anchor = ends.length ? {
|
|
57
|
-
x: ends.reduce((s, p) => s + p.x, 0) / ends.length,
|
|
58
|
-
y: ends.reduce((s, p) => s + p.y, 0) / ends.length
|
|
59
|
-
} : labelAt;
|
|
60
|
-
const routes = [];
|
|
61
|
-
for (const [route, own] of ownStretches(bubble)) {
|
|
62
|
-
let at;
|
|
63
|
-
let far = -1;
|
|
64
|
-
for (const id of own) {
|
|
65
|
-
for (const p of positions[id] ?? []) {
|
|
66
|
-
const d = Math.hypot(p.x - anchor.x, p.y - anchor.y);
|
|
67
|
-
if (d > far) {
|
|
68
|
-
far = d;
|
|
69
|
-
at = p;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (at) {
|
|
74
|
-
routes.push({ route, at, text: routeText(route, walkLabel) });
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const whole = bubble.covering === true || coversGraph(nodeIds.length, graph.nodes.length);
|
|
78
|
-
halos.push({
|
|
79
|
-
bubble,
|
|
80
|
-
...classifyBubble(bubble, repeats),
|
|
81
|
-
path: parts.join(""),
|
|
82
|
-
labelAt,
|
|
83
|
-
members: nodeIds.length,
|
|
84
|
-
nodeIds,
|
|
85
|
-
whole,
|
|
86
|
-
// The drawing's own bubble keeps its name however small. A partial
|
|
87
|
-
// bubble's lengths are a floor, so it may be no small variant.
|
|
88
|
-
tick: !whole && !bubble.partial && bubble.longestAlleleLength < SMALL_VARIANT_BP,
|
|
89
|
-
routes
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
return halos;
|
|
93
|
-
}
|
|
94
|
-
var stretches = /* @__PURE__ */ new WeakMap();
|
|
95
|
-
function ownStretches(bubble) {
|
|
96
|
-
const cached = stretches.get(bubble);
|
|
97
|
-
if (cached) {
|
|
98
|
-
return cached;
|
|
99
|
-
}
|
|
100
|
-
const chipped = bubble.longestAlleleLength < MIN_CHIPPED_BP ? [] : bubble.routes ?? [];
|
|
101
|
-
const sharing = /* @__PURE__ */ new Map();
|
|
102
|
-
chipped.forEach((route, r) => {
|
|
103
|
-
const counted = /* @__PURE__ */ new Map();
|
|
104
|
-
for (const id of route.steps) {
|
|
105
|
-
if (counted.get(id) !== r) {
|
|
106
|
-
counted.set(id, r);
|
|
107
|
-
sharing.set(id, (sharing.get(id) ?? 0) + 1);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const own = /* @__PURE__ */ new Map();
|
|
112
|
-
for (const route of chipped) {
|
|
113
|
-
let rarest = Infinity;
|
|
114
|
-
for (const id of route.steps) {
|
|
115
|
-
rarest = Math.min(rarest, sharing.get(id));
|
|
116
|
-
}
|
|
117
|
-
const steps = new Set(route.steps.filter((id) => sharing.get(id) === rarest));
|
|
118
|
-
if (steps.size > 0) {
|
|
119
|
-
own.set(route, [...steps]);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
stretches.set(bubble, own);
|
|
123
|
-
return own;
|
|
124
|
-
}
|
|
125
|
-
function routeText(route, walkLabel) {
|
|
126
|
-
const names = [...new Set(route.walks.map(walkLabel))].sort();
|
|
127
|
-
const shown = names.slice(0, NAMED_WALKS).join(", ");
|
|
128
|
-
const more = names.length > NAMED_WALKS ? ` +${names.length - NAMED_WALKS}` : "";
|
|
129
|
-
return `${shown}${more} \xB7 ${formatBp(route.bp)}`;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export {
|
|
133
|
-
WHOLE_FRACTION,
|
|
134
|
-
coversGraph,
|
|
135
|
-
SMALL_VARIANT_BP,
|
|
136
|
-
bubbleHalos
|
|
137
|
-
};
|