@jbrowse/bandage-core 6.0.0 → 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.
Files changed (162) hide show
  1. package/README.md +23 -7
  2. package/dist/alleleProjection/projectAlleles.js +10 -0
  3. package/dist/anchoredNodes.js +24 -0
  4. package/dist/bubbleSpreads.js +11 -0
  5. package/dist/bubbles/bubbleHalos.js +11 -0
  6. package/dist/bubbles/bubbleLine.js +14 -0
  7. package/dist/bubbles/bubblesFromGraph.js +10 -0
  8. package/dist/bubbles/classifyBubble.js +15 -0
  9. package/dist/bubbles/popBubble.js +9 -0
  10. package/dist/chunks/chunk-3C2LGJKY.js +108 -0
  11. package/dist/chunks/chunk-3PLYZLYV.js +513 -0
  12. package/dist/chunks/chunk-3S3YVOJ7.js +69 -0
  13. package/dist/chunks/chunk-3WHKR5TY.js +726 -0
  14. package/dist/chunks/chunk-47DYCZOK.js +115 -0
  15. package/dist/chunks/chunk-4S47XRYA.js +149 -0
  16. package/dist/chunks/chunk-527AI7CP.js +122 -0
  17. package/dist/chunks/chunk-57ZIXHZA.js +90 -0
  18. package/dist/chunks/chunk-5QT6NPSO.js +40 -0
  19. package/dist/chunks/chunk-6JEWNXCQ.js +90 -0
  20. package/dist/chunks/chunk-6Q6HFBJT.js +170 -0
  21. package/dist/chunks/chunk-6SBUFFTB.js +97 -0
  22. package/dist/chunks/chunk-6YRRNX2P.js +61 -0
  23. package/dist/chunks/chunk-72N5DJHZ.js +155 -0
  24. package/dist/chunks/chunk-73RSLGZT.js +73 -0
  25. package/dist/chunks/chunk-7CHJKABZ.js +82 -0
  26. package/dist/chunks/chunk-7XHHVYG7.js +13 -0
  27. package/dist/chunks/chunk-AB35TJST.js +67 -0
  28. package/dist/chunks/chunk-AE3UQZY3.js +43 -0
  29. package/dist/chunks/chunk-BJV2W4KZ.js +257 -0
  30. package/dist/chunks/chunk-BPLIXMH7.js +52 -0
  31. package/dist/chunks/chunk-BXEPA4KS.js +179 -0
  32. package/dist/chunks/chunk-C44YRP5F.js +85 -0
  33. package/dist/chunks/chunk-CDLPYR5O.js +135 -0
  34. package/dist/chunks/chunk-CPMHA4W5.js +6 -0
  35. package/dist/chunks/chunk-CR7EGAFE.js +241 -0
  36. package/dist/chunks/chunk-CZ54VG2H.js +431 -0
  37. package/dist/chunks/chunk-D3M7SBKL.js +210 -0
  38. package/dist/chunks/chunk-EJ5OZTCK.js +52 -0
  39. package/dist/chunks/chunk-ES2N6V56.js +83 -0
  40. package/dist/chunks/chunk-EZPBJPK6.js +54 -0
  41. package/dist/chunks/chunk-FYQWPEEY.js +65 -0
  42. package/dist/chunks/chunk-GQ2AOHU4.js +112 -0
  43. package/dist/chunks/chunk-HB6PDCOU.js +177 -0
  44. package/dist/chunks/chunk-HCANBJDD.js +326 -0
  45. package/dist/chunks/chunk-HIJVRRYE.js +174 -0
  46. package/dist/chunks/chunk-HNQPEMYE.js +297 -0
  47. package/dist/chunks/chunk-IGVV37VI.js +60 -0
  48. package/dist/chunks/chunk-IMW3AK27.js +102 -0
  49. package/dist/chunks/chunk-JKJWSY4V.js +32 -0
  50. package/dist/chunks/chunk-KCW7L3NV.js +6 -0
  51. package/dist/chunks/chunk-KQFOCDFY.js +73 -0
  52. package/dist/chunks/chunk-L3O7AWLI.js +52 -0
  53. package/dist/chunks/chunk-L5RYUPZI.js +53 -0
  54. package/dist/chunks/chunk-LOEA5IHZ.js +71 -0
  55. package/dist/chunks/chunk-LTUWJKHD.js +112 -0
  56. package/dist/chunks/chunk-LVZZH2NI.js +181 -0
  57. package/dist/chunks/chunk-MFKORG3F.js +44 -0
  58. package/dist/chunks/chunk-MHGHYHTL.js +205 -0
  59. package/dist/chunks/chunk-MI35EUIE.js +76 -0
  60. package/dist/chunks/chunk-MNUSQCLG.js +29 -0
  61. package/dist/chunks/chunk-NNODIW4U.js +26 -0
  62. package/dist/chunks/chunk-P7B3GDAY.js +232 -0
  63. package/dist/chunks/chunk-PBENCR5L.js +60 -0
  64. package/dist/chunks/chunk-PUG7LXDF.js +70 -0
  65. package/dist/chunks/chunk-Q3KCTA4N.js +202 -0
  66. package/dist/chunks/chunk-QCYM44UL.js +476 -0
  67. package/dist/chunks/chunk-QYBZZI5H.js +0 -0
  68. package/dist/chunks/chunk-RAKOB6IV.js +169 -0
  69. package/dist/chunks/chunk-RVS2QCOX.js +135 -0
  70. package/dist/chunks/chunk-SDGM243E.js +190 -0
  71. package/dist/chunks/chunk-ST2IBUAN.js +119 -0
  72. package/dist/chunks/chunk-SV27AJCC.js +101 -0
  73. package/dist/chunks/chunk-SZNZ2T6D.js +198 -0
  74. package/dist/chunks/chunk-TDQLINVI.js +16 -0
  75. package/dist/chunks/chunk-TEDQJPMI.js +131 -0
  76. package/dist/chunks/chunk-TZFWUT2C.js +66 -0
  77. package/dist/chunks/chunk-UVBGRJQX.js +50 -0
  78. package/dist/chunks/chunk-VHW7FDHU.js +42 -0
  79. package/dist/chunks/chunk-VKB57ZYE.js +218 -0
  80. package/dist/chunks/chunk-VZQ4FKLR.js +38 -0
  81. package/dist/chunks/chunk-WOO7QYKB.js +121 -0
  82. package/dist/chunks/chunk-WSIFAZU7.js +132 -0
  83. package/dist/chunks/chunk-X32PABB7.js +117 -0
  84. package/dist/chunks/chunk-YJQ7CT7F.js +23 -0
  85. package/dist/cli/figure.js +84 -17
  86. package/dist/colorSchemes.js +10 -0
  87. package/dist/deletionEdges.js +13 -0
  88. package/dist/el.js +8 -0
  89. package/dist/facetGrid.js +16 -0
  90. package/dist/figure.js +51 -0
  91. package/dist/gaf/parseGaf.js +12 -0
  92. package/dist/gbzCut.js +19 -0
  93. package/dist/gbzJoin.js +6 -0
  94. package/dist/gbzWindow.js +28 -0
  95. package/dist/genes/exonOutline.js +11 -0
  96. package/dist/genes/geneFiles.js +14 -0
  97. package/dist/genes/genePins.js +10 -0
  98. package/dist/gfa/gfaConverter.js +11 -0
  99. package/dist/gfa-core/gfaParser.js +8 -0
  100. package/dist/gfa-core/index.js +9 -0
  101. package/dist/graphLabels.js +24 -0
  102. package/dist/index.js +262 -1407
  103. package/dist/labelLayout.js +24 -0
  104. package/dist/layout/anchoredLayout.js +11 -0
  105. package/dist/layout/deletionRoutes.js +10 -0
  106. package/dist/layout/drawnScale.js +22 -0
  107. package/dist/layout/mergeRuns.js +15 -0
  108. package/dist/layout/orderedLayout.js +12 -0
  109. package/dist/layout/orientToReference.js +7 -0
  110. package/dist/layout/placeOffReference.js +9 -0
  111. package/dist/layout/referenceSeeds.js +11 -0
  112. package/dist/layout/rowSpacing.js +6 -0
  113. package/dist/layout/sampleRowLayout.js +11 -0
  114. package/dist/layout/trimToWindow.js +99 -0
  115. package/dist/layout/tubeMapLayout.js +28 -0
  116. package/dist/layout/walkRowDraw.js +65 -0
  117. package/dist/layout/walkRowLayout.js +13 -0
  118. package/dist/layout/walkRows.js +11 -0
  119. package/dist/layout/walkStrip.js +40 -0
  120. package/dist/layoutModes.js +35 -0
  121. package/dist/loadBandage.js +6 -0
  122. package/dist/nodeWidths.js +18 -0
  123. package/dist/overlayLabels.js +18 -0
  124. package/dist/pansn.js +18 -0
  125. package/dist/pathAnchoring.js +18 -0
  126. package/dist/pathColors.js +31 -0
  127. package/dist/pipeline.js +40 -0
  128. package/dist/reference.js +24 -0
  129. package/dist/referenceRampCss.js +29 -0
  130. package/dist/referenceSpan.js +11 -0
  131. package/dist/referenceStrip.js +35 -0
  132. package/dist/renderer/Canvas2DRenderer.js +9 -0
  133. package/dist/renderer/GeometryBuilder.js +42 -0
  134. package/dist/renderer/colorBits.js +8 -0
  135. package/dist/renderer/recordingCanvas.js +44 -0
  136. package/dist/renderer/svgCanvas.js +6 -0
  137. package/dist/renderer/types.js +0 -0
  138. package/dist/tubeMap/axis.js +25 -0
  139. package/dist/tubeMap/coarsen.js +361 -0
  140. package/dist/tubeMap/connectors.js +13 -0
  141. package/dist/tubeMap/deviations.js +85 -0
  142. package/dist/tubeMap/draw.js +15 -0
  143. package/dist/tubeMap/frame.js +9 -0
  144. package/dist/tubeMap/genes.js +20 -0
  145. package/dist/tubeMap/mismatches.js +6 -0
  146. package/dist/tubeMap/nodeColors.js +21 -0
  147. package/dist/tubeMap/reads.js +17 -0
  148. package/dist/tubeMap/warp.js +8 -0
  149. package/dist/types/version.d.ts +1 -1
  150. package/dist/types.js +0 -0
  151. package/dist/util/SpatialIndex.js +13 -0
  152. package/dist/util/edgeCurves.js +10 -0
  153. package/dist/util/geometry.js +39 -0
  154. package/dist/util/hitDetection.js +20 -0
  155. package/dist/util/wheelZoom.js +6 -0
  156. package/dist/version.js +6 -0
  157. package/dist/viewport.js +33 -0
  158. package/dist/walkEncoding.js +39 -0
  159. package/dist/walkHighlight.js +26 -0
  160. package/dist/walkKey.js +17 -0
  161. package/package.json +38 -5
  162. package/dist/chunks/chunk-OHMWSW6U.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](https://github.com/GMOD/jbrowse-plugin-graphgenomeviewer/blob/main/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
- Lives in the plugin repo as a pnpm workspace package. The plugin imports its
35
- source directly, so a change here needs no publish to reach the plugin.
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
- The core releases with the plugin, at the plugin's version: `pnpm version patch`
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,10 @@
1
+ import {
2
+ parsePanSN,
3
+ projectAlleles
4
+ } from "../chunks/chunk-RVS2QCOX.js";
5
+ import "../chunks/chunk-ES2N6V56.js";
6
+ import "../chunks/chunk-FYQWPEEY.js";
7
+ export {
8
+ parsePanSN,
9
+ projectAlleles
10
+ };
@@ -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
+ BUBBLE_SPREADS,
3
+ BUBBLE_SPREAD_VALUES,
4
+ spreadFor
5
+ } from "./chunks/chunk-UVBGRJQX.js";
6
+ import "./chunks/chunk-6JEWNXCQ.js";
7
+ export {
8
+ BUBBLE_SPREADS,
9
+ BUBBLE_SPREAD_VALUES,
10
+ spreadFor
11
+ };
@@ -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,9 @@
1
+ import {
2
+ bubbleSubgraph
3
+ } from "../chunks/chunk-VHW7FDHU.js";
4
+ import "../chunks/chunk-ST2IBUAN.js";
5
+ import "../chunks/chunk-BPLIXMH7.js";
6
+ import "../chunks/chunk-FYQWPEEY.js";
7
+ export {
8
+ bubbleSubgraph
9
+ };
@@ -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
+ };