@jbrowse/bandage-core 7.0.0 → 7.2.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.
Files changed (40) hide show
  1. package/dist/chunks/{chunk-EZPBJPK6.js → chunk-3JANT2SW.js} +6 -3
  2. package/dist/chunks/chunk-6EJIU6IA.js +42 -0
  3. package/dist/chunks/{chunk-6UFS3EWI.js → chunk-EPWYRSHH.js} +1 -1
  4. package/dist/chunks/{chunk-WEMKWLDF.js → chunk-JKXE6CIP.js} +1 -1
  5. package/dist/chunks/{chunk-YZ5CCEDH.js → chunk-JVLURPFW.js} +1 -0
  6. package/dist/chunks/{chunk-MZ7QQRUJ.js → chunk-KREASK3Z.js} +7 -13
  7. package/dist/chunks/chunk-LYJ4US66.js +664 -0
  8. package/dist/chunks/{chunk-7PWMTUAK.js → chunk-QMJ4J5PT.js} +14 -13
  9. package/dist/chunks/{chunk-EOSVRILX.js → chunk-S73EYTZA.js} +1 -1
  10. package/dist/chunks/{chunk-JFNPL4UT.js → chunk-UGD6ZMOF.js} +29 -4
  11. package/dist/chunks/{chunk-O4TGF4WS.js → chunk-UNOE2NDN.js} +155 -129
  12. package/dist/chunks/{chunk-AWCMVPVP.js → chunk-Y7UR3MDE.js} +1 -1
  13. package/dist/cli/figure.js +24 -13
  14. package/dist/figure.js +9 -9
  15. package/dist/index.js +28 -19
  16. package/dist/layout/deletionRoutes.js +3 -1
  17. package/dist/layout/stressEngine.js +5 -5
  18. package/dist/layout/stressPlacement.js +7 -0
  19. package/dist/layout/walkRowDraw.js +11 -1
  20. package/dist/layout/walkRowLayout.js +1 -1
  21. package/dist/layout/walkStrip.js +4 -3
  22. package/dist/layoutEngines.js +10 -2
  23. package/dist/layoutModes.js +2 -2
  24. package/dist/pipeline.js +2 -2
  25. package/dist/types/cli/figure.d.ts +1 -1
  26. package/dist/types/figure.d.ts +2 -1
  27. package/dist/types/index.d.ts +5 -5
  28. package/dist/types/layout/deletionRoutes.d.ts +1 -0
  29. package/dist/types/layout/stressEngine.d.ts +19 -11
  30. package/dist/types/layout/stressPlacement.d.ts +5 -0
  31. package/dist/types/layout/walkRowDraw.d.ts +11 -0
  32. package/dist/types/layout/walkRowLayout.d.ts +2 -1
  33. package/dist/types/layout/walkStrip.d.ts +1 -1
  34. package/dist/types/layoutEngines.d.ts +12 -0
  35. package/dist/types/pipeline.d.ts +1 -1
  36. package/dist/types/version.d.ts +1 -1
  37. package/dist/version.js +1 -1
  38. package/dist/viewport.js +3 -3
  39. package/package.json +1 -1
  40. package/dist/chunks/chunk-L53SXJZI.js +0 -22
@@ -12,14 +12,17 @@ import {
12
12
 
13
13
  // src/layout/walkRowLayout.ts
14
14
  var READOUT_ROOM = 1.3;
15
- function walkRowsExtent(walks) {
15
+ function walkRowsExtent(walks, pitch = {
16
+ rowPx: ROW_HEIGHT_PX,
17
+ readouts: true
18
+ }) {
16
19
  let longest = walks.reference.bp;
17
20
  for (const row of walks.rows) {
18
21
  longest = Math.max(longest, row.bp);
19
22
  }
20
23
  return {
21
- maxX: walks.origin + longest * READOUT_ROOM,
22
- maxY: walks.rows.length * ROW_HEIGHT_PX
24
+ maxX: walks.origin + longest * (pitch.readouts ? READOUT_ROOM : 1),
25
+ maxY: walks.rows.length * pitch.rowPx
23
26
  };
24
27
  }
25
28
  function walkRowLayout(graph, region) {
@@ -0,0 +1,42 @@
1
+ import {
2
+ stressLayout
3
+ } from "./chunk-UNOE2NDN.js";
4
+ import {
5
+ loadBandage
6
+ } from "./chunk-7XHHVYG7.js";
7
+
8
+ // src/layoutEngines.ts
9
+ var LAYOUT_ENGINES = [
10
+ {
11
+ value: "fmmm",
12
+ label: "Bandage (FMMM)",
13
+ description: "Bandage's force-directed layout: OGDF's fast multipole multilevel method, compiled to wasm."
14
+ },
15
+ {
16
+ value: "stress",
17
+ label: "Stress (experimental)",
18
+ description: "Stress layout by stochastic gradient descent in plain JS: distances along the graph become distances on the page, so the reference reads straight and a repeat loop reads as a ring."
19
+ }
20
+ ];
21
+ var LAYOUT_ENGINE_VALUES = LAYOUT_ENGINES.map((e) => e.value);
22
+ function isLayoutEngineKind(value) {
23
+ return LAYOUT_ENGINE_VALUES.includes(value);
24
+ }
25
+ var layoutEngine = async (request) => {
26
+ if (request.options.engine === "stress") {
27
+ const start2 = performance.now();
28
+ const result2 = stressLayout(request);
29
+ return { result: result2, duration: performance.now() - start2 };
30
+ }
31
+ const bandage = await loadBandage();
32
+ const start = performance.now();
33
+ const result = bandage.computeLayout(request.graph, request.options);
34
+ return { result, duration: performance.now() - start };
35
+ };
36
+
37
+ export {
38
+ LAYOUT_ENGINES,
39
+ LAYOUT_ENGINE_VALUES,
40
+ isLayoutEngineKind,
41
+ layoutEngine
42
+ };
@@ -14,7 +14,7 @@ import {
14
14
  routeNodes,
15
15
  takeRoutes,
16
16
  withDeletionRoutes
17
- } from "./chunk-YZ5CCEDH.js";
17
+ } from "./chunk-JVLURPFW.js";
18
18
  import {
19
19
  anchorGraph
20
20
  } from "./chunk-ST2IBUAN.js";
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-HNQPEMYE.js";
15
15
  import {
16
16
  walkRowLayout
17
- } from "./chunk-EZPBJPK6.js";
17
+ } from "./chunk-3JANT2SW.js";
18
18
  import {
19
19
  isBackbone,
20
20
  isOffReference
@@ -73,6 +73,7 @@ function takeRoutes(positions, routes) {
73
73
  }
74
74
 
75
75
  export {
76
+ ROUTE_ID,
76
77
  withDeletionRoutes,
77
78
  routeNodes,
78
79
  takeRoutes
@@ -1,16 +1,14 @@
1
1
  import {
2
2
  alongRow,
3
- boxesGenes
4
- } from "./chunk-JFNPL4UT.js";
3
+ boxesGenes,
4
+ rowPitch
5
+ } from "./chunk-UGD6ZMOF.js";
5
6
  import {
6
7
  pathOrigin
7
8
  } from "./chunk-ST2IBUAN.js";
8
9
  import {
9
10
  LABEL_CHAR_PX
10
11
  } from "./chunk-AB35TJST.js";
11
- import {
12
- ROW_HEIGHT_PX
13
- } from "./chunk-CPMHA4W5.js";
14
12
  import {
15
13
  el
16
14
  } from "./chunk-NNODIW4U.js";
@@ -20,7 +18,6 @@ var PAD_PX = 6;
20
18
  var WALK_STRIP_CEILING_PX = 260;
21
19
  var LABEL_FONT_PX = 11;
22
20
  var MIN_ROW_PX = 3;
23
- var LABELLED_ROW_PX = 12;
24
21
  var READOUT_ROOM = 1.3;
25
22
  var MARK_INK = "#111";
26
23
  var TICK_PX = 3;
@@ -113,13 +110,11 @@ function walkStripFrame(bars, o) {
113
110
  const maxHeight = o.maxHeight ?? WALK_STRIP_CEILING_PX;
114
111
  const labelPx = o.labelPx ?? Math.max(...[bars.reference, ...bars.rows].map((r) => r.label.length)) * LABEL_CHAR_PX + 16;
115
112
  const count = bars.rows.length + 1;
116
- const rowPx = Math.max(
117
- MIN_ROW_PX,
118
- Math.min(ROW_HEIGHT_PX, Math.floor((maxHeight - 2 * PAD_PX) / count))
113
+ const { rowPx, barPx, labelled, readouts } = rowPitch(
114
+ count,
115
+ maxHeight - 2 * PAD_PX,
116
+ MIN_ROW_PX
119
117
  );
120
- const labelled = rowPx >= LABELLED_ROW_PX;
121
- const readouts = rowPx >= 14;
122
- const barPx = Math.max(2, Math.round(rowPx * 0.6));
123
118
  const longest = Math.max(bars.reference.bp, ...bars.rows.map((r) => r.bp), 1);
124
119
  const left = labelled ? labelPx : PAD_PX;
125
120
  const usable = Math.max(1, o.width - left - PAD_PX);
@@ -194,7 +189,6 @@ function stripGeneGaps(frame, rowGenes, gaps) {
194
189
 
195
190
  export {
196
191
  WALK_STRIP_CEILING_PX,
197
- LABELLED_ROW_PX,
198
192
  stripMarks,
199
193
  segmentAt,
200
194
  walkStripFrame,