@jbrowse/bandage-core 6.0.1 → 6.0.2
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 +23 -7
- package/dist/alleleProjection/projectAlleles.js +10 -0
- package/dist/anchoredNodes.js +24 -0
- package/dist/bubbleSpreads.js +11 -0
- package/dist/bubbles/bubbleHalos.js +11 -0
- package/dist/bubbles/bubbleLine.js +14 -0
- package/dist/bubbles/bubblesFromGraph.js +10 -0
- package/dist/bubbles/classifyBubble.js +15 -0
- package/dist/bubbles/popBubble.js +9 -0
- package/dist/chunks/chunk-3C2LGJKY.js +108 -0
- package/dist/chunks/chunk-3PLYZLYV.js +513 -0
- package/dist/chunks/chunk-3S3YVOJ7.js +69 -0
- package/dist/chunks/chunk-3WHKR5TY.js +726 -0
- package/dist/chunks/chunk-47DYCZOK.js +115 -0
- package/dist/chunks/chunk-4S47XRYA.js +149 -0
- package/dist/chunks/chunk-527AI7CP.js +122 -0
- package/dist/chunks/chunk-57ZIXHZA.js +90 -0
- package/dist/chunks/chunk-5QT6NPSO.js +40 -0
- package/dist/chunks/chunk-6JEWNXCQ.js +90 -0
- package/dist/chunks/chunk-6Q6HFBJT.js +170 -0
- package/dist/chunks/chunk-6SBUFFTB.js +97 -0
- package/dist/chunks/chunk-6YRRNX2P.js +61 -0
- package/dist/chunks/chunk-72N5DJHZ.js +155 -0
- package/dist/chunks/chunk-73RSLGZT.js +73 -0
- package/dist/chunks/chunk-7CHJKABZ.js +82 -0
- package/dist/chunks/chunk-7XHHVYG7.js +13 -0
- package/dist/chunks/chunk-AB35TJST.js +67 -0
- package/dist/chunks/chunk-AE3UQZY3.js +43 -0
- package/dist/chunks/chunk-BJV2W4KZ.js +257 -0
- package/dist/chunks/chunk-BPLIXMH7.js +52 -0
- package/dist/chunks/chunk-BXEPA4KS.js +179 -0
- package/dist/chunks/chunk-C44YRP5F.js +85 -0
- package/dist/chunks/chunk-CDLPYR5O.js +135 -0
- package/dist/chunks/chunk-CPMHA4W5.js +6 -0
- package/dist/chunks/chunk-CR7EGAFE.js +241 -0
- package/dist/chunks/chunk-CZ54VG2H.js +431 -0
- package/dist/chunks/chunk-D3M7SBKL.js +210 -0
- package/dist/chunks/chunk-EJ5OZTCK.js +52 -0
- package/dist/chunks/chunk-ES2N6V56.js +83 -0
- package/dist/chunks/chunk-EZPBJPK6.js +54 -0
- package/dist/chunks/chunk-FYQWPEEY.js +65 -0
- package/dist/chunks/chunk-GQ2AOHU4.js +112 -0
- package/dist/chunks/chunk-HB6PDCOU.js +177 -0
- package/dist/chunks/chunk-HCANBJDD.js +326 -0
- package/dist/chunks/chunk-HIJVRRYE.js +174 -0
- package/dist/chunks/chunk-HNQPEMYE.js +297 -0
- package/dist/chunks/chunk-IGVV37VI.js +60 -0
- package/dist/chunks/chunk-IMW3AK27.js +102 -0
- package/dist/chunks/chunk-JKJWSY4V.js +32 -0
- package/dist/chunks/chunk-KCW7L3NV.js +6 -0
- package/dist/chunks/chunk-KQFOCDFY.js +73 -0
- package/dist/chunks/chunk-L3O7AWLI.js +52 -0
- package/dist/chunks/chunk-L5RYUPZI.js +53 -0
- package/dist/chunks/chunk-LOEA5IHZ.js +71 -0
- package/dist/chunks/chunk-LTUWJKHD.js +112 -0
- package/dist/chunks/chunk-LVZZH2NI.js +181 -0
- package/dist/chunks/chunk-MFKORG3F.js +44 -0
- package/dist/chunks/chunk-MHGHYHTL.js +205 -0
- package/dist/chunks/chunk-MI35EUIE.js +76 -0
- package/dist/chunks/chunk-MNUSQCLG.js +29 -0
- package/dist/chunks/chunk-NNODIW4U.js +26 -0
- package/dist/chunks/chunk-P7B3GDAY.js +232 -0
- package/dist/chunks/chunk-PBENCR5L.js +60 -0
- package/dist/chunks/chunk-PUG7LXDF.js +70 -0
- package/dist/chunks/chunk-Q3KCTA4N.js +202 -0
- package/dist/chunks/chunk-QCYM44UL.js +476 -0
- package/dist/chunks/chunk-QYBZZI5H.js +0 -0
- package/dist/chunks/chunk-RAKOB6IV.js +169 -0
- package/dist/chunks/chunk-RVS2QCOX.js +135 -0
- package/dist/chunks/chunk-SDGM243E.js +190 -0
- package/dist/chunks/chunk-ST2IBUAN.js +119 -0
- package/dist/chunks/chunk-SV27AJCC.js +101 -0
- package/dist/chunks/chunk-SZNZ2T6D.js +198 -0
- package/dist/chunks/chunk-TDQLINVI.js +16 -0
- package/dist/chunks/chunk-TEDQJPMI.js +131 -0
- package/dist/chunks/chunk-TZFWUT2C.js +66 -0
- package/dist/chunks/chunk-UVBGRJQX.js +50 -0
- package/dist/chunks/chunk-VHW7FDHU.js +42 -0
- package/dist/chunks/chunk-VKB57ZYE.js +218 -0
- package/dist/chunks/chunk-VZQ4FKLR.js +38 -0
- package/dist/chunks/chunk-WOO7QYKB.js +121 -0
- package/dist/chunks/chunk-WSIFAZU7.js +132 -0
- package/dist/chunks/chunk-X32PABB7.js +117 -0
- package/dist/chunks/chunk-YJQ7CT7F.js +23 -0
- package/dist/cli/figure.js +84 -17
- package/dist/colorSchemes.js +10 -0
- package/dist/deletionEdges.js +13 -0
- package/dist/el.js +8 -0
- package/dist/facetGrid.js +16 -0
- package/dist/figure.js +51 -0
- package/dist/gaf/parseGaf.js +12 -0
- package/dist/gbzCut.js +19 -0
- package/dist/gbzJoin.js +6 -0
- package/dist/gbzWindow.js +28 -0
- package/dist/genes/exonOutline.js +11 -0
- package/dist/genes/geneFiles.js +14 -0
- package/dist/genes/genePins.js +10 -0
- package/dist/gfa/gfaConverter.js +11 -0
- package/dist/gfa-core/gfaParser.js +8 -0
- package/dist/gfa-core/index.js +9 -0
- package/dist/graphLabels.js +24 -0
- package/dist/index.js +262 -1407
- package/dist/labelLayout.js +24 -0
- package/dist/layout/anchoredLayout.js +11 -0
- package/dist/layout/deletionRoutes.js +10 -0
- package/dist/layout/drawnScale.js +22 -0
- package/dist/layout/mergeRuns.js +15 -0
- package/dist/layout/orderedLayout.js +12 -0
- package/dist/layout/orientToReference.js +7 -0
- package/dist/layout/placeOffReference.js +9 -0
- package/dist/layout/referenceSeeds.js +11 -0
- package/dist/layout/rowSpacing.js +6 -0
- package/dist/layout/sampleRowLayout.js +11 -0
- package/dist/layout/trimToWindow.js +99 -0
- package/dist/layout/tubeMapLayout.js +28 -0
- package/dist/layout/walkRowDraw.js +65 -0
- package/dist/layout/walkRowLayout.js +13 -0
- package/dist/layout/walkRows.js +11 -0
- package/dist/layout/walkStrip.js +40 -0
- package/dist/layoutModes.js +35 -0
- package/dist/loadBandage.js +6 -0
- package/dist/nodeWidths.js +18 -0
- package/dist/overlayLabels.js +18 -0
- package/dist/pansn.js +18 -0
- package/dist/pathAnchoring.js +18 -0
- package/dist/pathColors.js +31 -0
- package/dist/pipeline.js +40 -0
- package/dist/reference.js +24 -0
- package/dist/referenceRampCss.js +29 -0
- package/dist/referenceSpan.js +11 -0
- package/dist/referenceStrip.js +35 -0
- package/dist/renderer/Canvas2DRenderer.js +9 -0
- package/dist/renderer/GeometryBuilder.js +42 -0
- package/dist/renderer/colorBits.js +8 -0
- package/dist/renderer/recordingCanvas.js +44 -0
- package/dist/renderer/svgCanvas.js +6 -0
- package/dist/renderer/types.js +0 -0
- package/dist/tubeMap/axis.js +25 -0
- package/dist/tubeMap/coarsen.js +361 -0
- package/dist/tubeMap/connectors.js +13 -0
- package/dist/tubeMap/deviations.js +85 -0
- package/dist/tubeMap/draw.js +15 -0
- package/dist/tubeMap/frame.js +9 -0
- package/dist/tubeMap/genes.js +20 -0
- package/dist/tubeMap/mismatches.js +6 -0
- package/dist/tubeMap/nodeColors.js +21 -0
- package/dist/tubeMap/reads.js +17 -0
- package/dist/tubeMap/warp.js +8 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types.js +0 -0
- package/dist/util/SpatialIndex.js +13 -0
- package/dist/util/edgeCurves.js +10 -0
- package/dist/util/geometry.js +39 -0
- package/dist/util/hitDetection.js +20 -0
- package/dist/util/wheelZoom.js +6 -0
- package/dist/version.js +6 -0
- package/dist/viewport.js +33 -0
- package/dist/walkEncoding.js +39 -0
- package/dist/walkHighlight.js +26 -0
- package/dist/walkKey.js +17 -0
- package/package.json +38 -5
- package/dist/chunks/chunk-EXSFRX2F.js +0 -7400
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ npm install @jbrowse/bandage-core
|
|
|
23
23
|
- Figures: `figureSvg` draws a graph and its lifted walks to a standalone SVG,
|
|
24
24
|
and the `bandage-figure` CLI makes one from a JSON spec with no browser:
|
|
25
25
|
`npx -p @jbrowse/bandage-core bandage-figure spec.json -o figure.svg`. See
|
|
26
|
-
[docs/figures.md](
|
|
26
|
+
[docs/figures.md](docs/figures.md)
|
|
27
27
|
|
|
28
28
|
Nothing here imports React, MobX or a JBrowse host. BandageJS's
|
|
29
29
|
[`src/main.ts`](https://github.com/cmdcolin/BandageJS/blob/main/src/main.ts) is
|
|
@@ -31,10 +31,26 @@ the worked example.
|
|
|
31
31
|
|
|
32
32
|
## Developing
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
```
|
|
35
|
+
pnpm install
|
|
36
|
+
pnpm test # unit tests
|
|
37
|
+
pnpm build # dist/ with declarations
|
|
38
|
+
pnpm test:wasm # the committed layout engine still loads
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The Bandage layout engine is OGDF's FMMM compiled to WASM and committed at
|
|
42
|
+
`src/bandage/bandage-layout.js`; [src/bandage/README.md](src/bandage/README.md)
|
|
43
|
+
says how to rebuild it from `src/bandage/native` and the vendored `vendor/ogdf`.
|
|
44
|
+
A weekly workflow proves the committed artifact still reproduces.
|
|
45
|
+
|
|
46
|
+
CI also packs the core and runs
|
|
47
|
+
[BandageJS](https://github.com/cmdcolin/BandageJS) and
|
|
48
|
+
[jbrowse-plugin-graphgenomeviewer](https://github.com/GMOD/jbrowse-plugin-graphgenomeviewer)
|
|
49
|
+
against it. An API change lands with the consumer's side on a `core-next` branch
|
|
50
|
+
in that repo, which CI tests in place of `main` until the release.
|
|
51
|
+
|
|
52
|
+
Release with `pnpm version patch`: it lints, tests, stamps `src/version.ts`,
|
|
53
|
+
writes the changelog with git-cliff and pushes the `v*` tag, and `publish.yml`
|
|
54
|
+
publishes to npm with trusted publishing.
|
|
36
55
|
|
|
37
|
-
|
|
38
|
-
at the repo root sets both, and `publish.yml` and `publish-core.yml` each
|
|
39
|
-
publish one from the `v*` tag. `publish-core.yml` also runs by hand to publish a
|
|
40
|
-
version a failed run left behind.
|
|
56
|
+
Both Bandage and OGDF are GPL, which is why this package is GPL-3.0-or-later.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
REFERENCE_RANK,
|
|
3
|
+
backboneNodes,
|
|
4
|
+
backbonePositions,
|
|
5
|
+
backboneSpan,
|
|
6
|
+
firstNodeAtOrAfter,
|
|
7
|
+
isAnchored,
|
|
8
|
+
isBackbone,
|
|
9
|
+
isOffReference,
|
|
10
|
+
overlapsWindow,
|
|
11
|
+
referenceSpan
|
|
12
|
+
} from "./chunks/chunk-FYQWPEEY.js";
|
|
13
|
+
export {
|
|
14
|
+
REFERENCE_RANK,
|
|
15
|
+
backboneNodes,
|
|
16
|
+
backbonePositions,
|
|
17
|
+
backboneSpan,
|
|
18
|
+
firstNodeAtOrAfter,
|
|
19
|
+
isAnchored,
|
|
20
|
+
isBackbone,
|
|
21
|
+
isOffReference,
|
|
22
|
+
overlapsWindow,
|
|
23
|
+
referenceSpan
|
|
24
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bubbleHalos
|
|
3
|
+
} from "../chunks/chunk-3C2LGJKY.js";
|
|
4
|
+
import "../chunks/chunk-WOO7QYKB.js";
|
|
5
|
+
import "../chunks/chunk-MFKORG3F.js";
|
|
6
|
+
import "../chunks/chunk-3PLYZLYV.js";
|
|
7
|
+
import "../chunks/chunk-CPMHA4W5.js";
|
|
8
|
+
import "../chunks/chunk-FYQWPEEY.js";
|
|
9
|
+
export {
|
|
10
|
+
bubbleHalos
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SATURATED_PATH_COUNT,
|
|
3
|
+
bubbleDescription,
|
|
4
|
+
bubbleLabel,
|
|
5
|
+
parseBubbleLine,
|
|
6
|
+
sameBubble
|
|
7
|
+
} from "../chunks/chunk-MFKORG3F.js";
|
|
8
|
+
export {
|
|
9
|
+
SATURATED_PATH_COUNT,
|
|
10
|
+
bubbleDescription,
|
|
11
|
+
bubbleLabel,
|
|
12
|
+
parseBubbleLine,
|
|
13
|
+
sameBubble
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bubblesFromGraph
|
|
3
|
+
} from "../chunks/chunk-4S47XRYA.js";
|
|
4
|
+
import "../chunks/chunk-MFKORG3F.js";
|
|
5
|
+
import "../chunks/chunk-HNQPEMYE.js";
|
|
6
|
+
import "../chunks/chunk-CPMHA4W5.js";
|
|
7
|
+
import "../chunks/chunk-FYQWPEEY.js";
|
|
8
|
+
export {
|
|
9
|
+
bubblesFromGraph
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BUBBLE_KIND_COLORS,
|
|
3
|
+
BUBBLE_KIND_NAMES,
|
|
4
|
+
bubbleSegmentIds,
|
|
5
|
+
classifyBubble,
|
|
6
|
+
formatBp
|
|
7
|
+
} from "../chunks/chunk-WOO7QYKB.js";
|
|
8
|
+
import "../chunks/chunk-MFKORG3F.js";
|
|
9
|
+
export {
|
|
10
|
+
BUBBLE_KIND_COLORS,
|
|
11
|
+
BUBBLE_KIND_NAMES,
|
|
12
|
+
bubbleSegmentIds,
|
|
13
|
+
classifyBubble,
|
|
14
|
+
formatBp
|
|
15
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bubbleSegmentIds,
|
|
3
|
+
classifyBubble,
|
|
4
|
+
formatBp
|
|
5
|
+
} from "./chunk-WOO7QYKB.js";
|
|
6
|
+
import {
|
|
7
|
+
svgPath
|
|
8
|
+
} from "./chunk-3PLYZLYV.js";
|
|
9
|
+
import {
|
|
10
|
+
isBackbone
|
|
11
|
+
} from "./chunk-FYQWPEEY.js";
|
|
12
|
+
|
|
13
|
+
// src/bubbles/bubbleHalos.ts
|
|
14
|
+
var WHOLE_FRACTION = 0.9;
|
|
15
|
+
var NAMED_WALKS = 2;
|
|
16
|
+
var MIN_CHIPPED_BP = 1e3;
|
|
17
|
+
function bubbleHalos(graph, bubbles, positions, walkLabel = (name) => name, repeats = []) {
|
|
18
|
+
const byName = new Map(graph.nodes.map((n) => [n.name, n]));
|
|
19
|
+
const halos = [];
|
|
20
|
+
for (const bubble of bubbles) {
|
|
21
|
+
const parts = [];
|
|
22
|
+
let minX = Infinity;
|
|
23
|
+
let maxX = -Infinity;
|
|
24
|
+
let minY = Infinity;
|
|
25
|
+
const nodeIds = [];
|
|
26
|
+
const ends = [];
|
|
27
|
+
for (const name of bubbleSegmentIds(bubble)) {
|
|
28
|
+
const node = byName.get(name);
|
|
29
|
+
const line = node && positions[node.id];
|
|
30
|
+
if (!node || !line?.length) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (isBackbone(node) && (node.stable.start < bubble.start || node.stable.start >= bubble.end)) {
|
|
34
|
+
ends.push(line[Math.floor(line.length / 2)]);
|
|
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 anchor = ends.length ? {
|
|
50
|
+
x: ends.reduce((s, p) => s + p.x, 0) / ends.length,
|
|
51
|
+
y: ends.reduce((s, p) => s + p.y, 0) / ends.length
|
|
52
|
+
} : labelAt;
|
|
53
|
+
const sharing = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const route of bubble.routes ?? []) {
|
|
55
|
+
for (const id of new Set(route.steps)) {
|
|
56
|
+
sharing.set(id, (sharing.get(id) ?? 0) + 1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const routes = [];
|
|
60
|
+
for (const route of bubble.routes ?? []) {
|
|
61
|
+
if (bubble.longestAlleleLength < MIN_CHIPPED_BP) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
if (route.steps.length === 0) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const rarest = Math.min(...route.steps.map((id) => sharing.get(id)));
|
|
68
|
+
let at;
|
|
69
|
+
let far = -1;
|
|
70
|
+
for (const id of route.steps) {
|
|
71
|
+
if (sharing.get(id) !== rarest) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
for (const p of positions[id] ?? []) {
|
|
75
|
+
const d = Math.hypot(p.x - anchor.x, p.y - anchor.y);
|
|
76
|
+
if (d > far) {
|
|
77
|
+
far = d;
|
|
78
|
+
at = p;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (at) {
|
|
83
|
+
routes.push({ route, at, text: routeText(route, walkLabel) });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
halos.push({
|
|
87
|
+
bubble,
|
|
88
|
+
...classifyBubble(bubble, repeats),
|
|
89
|
+
path: parts.join(""),
|
|
90
|
+
labelAt,
|
|
91
|
+
members: nodeIds.length,
|
|
92
|
+
nodeIds,
|
|
93
|
+
whole: nodeIds.length >= WHOLE_FRACTION * graph.nodes.length,
|
|
94
|
+
routes
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return halos;
|
|
98
|
+
}
|
|
99
|
+
function routeText(route, walkLabel) {
|
|
100
|
+
const names = [...new Set(route.walks.map(walkLabel))].sort();
|
|
101
|
+
const shown = names.slice(0, NAMED_WALKS).join(", ");
|
|
102
|
+
const more = names.length > NAMED_WALKS ? ` +${names.length - NAMED_WALKS}` : "";
|
|
103
|
+
return `${shown}${more} \xB7 ${formatBp(route.bp)}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
bubbleHalos
|
|
108
|
+
};
|