@jbrowse/bandage-core 4.1.1 → 4.3.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.
@@ -17,7 +17,7 @@ import {
17
17
  openGbz,
18
18
  parseRegion,
19
19
  refNameBinding
20
- } from "../chunks/chunk-QWZLIWOJ.js";
20
+ } from "../chunks/chunk-IFVLNU7X.js";
21
21
 
22
22
  // src/cli/figure.ts
23
23
  import { access, open, readFile, writeFile } from "node:fs/promises";
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  baseEdgeCurves,
37
37
  buildGeometry,
38
38
  clampZoom,
39
+ coalesceRuns,
39
40
  computeColorSchemeRange,
40
41
  computeReferenceRamp,
41
42
  contains,
@@ -86,6 +87,7 @@ import {
86
87
  parseRegion,
87
88
  pathColorsLegible,
88
89
  pathLegend,
90
+ pathOrigin,
89
91
  pathRibbonOffsets,
90
92
  placeRowGenes,
91
93
  rampHue,
@@ -126,7 +128,7 @@ import {
126
128
  wellKnownSample,
127
129
  yToXOf,
128
130
  zoomAbout
129
- } from "./chunks/chunk-QWZLIWOJ.js";
131
+ } from "./chunks/chunk-IFVLNU7X.js";
130
132
 
131
133
  // src/index.ts
132
134
  import { getDpr } from "@jbrowse/render-core/canvas2dUtils";
@@ -243,14 +245,15 @@ var SpatialIndex = class {
243
245
  }
244
246
  };
245
247
  var EdgeSpatialIndex = class {
246
- constructor(nodePositions, graph, drawPaths, axis, cellSize, deletions, version2 = 0) {
248
+ constructor(nodePositions, graph, drawPaths, axis, cellSize, deletions, version2 = 0, routes2) {
247
249
  this.cells = /* @__PURE__ */ new Map();
248
250
  this.edgeCurves = baseEdgeCurves(
249
251
  nodePositions,
250
252
  graph,
251
253
  axis,
252
254
  deletions,
253
- version2
255
+ version2,
256
+ routes2
254
257
  );
255
258
  const boxes = [];
256
259
  let extentX = 0;
@@ -373,9 +376,9 @@ function getSpatialIndex(nodePositions, version2) {
373
376
  return index;
374
377
  }
375
378
  var edgeCache = /* @__PURE__ */ new WeakMap();
376
- function getEdgeSpatialIndex(nodePositions, graph, drawPaths, axis, version2, deletions) {
379
+ function getEdgeSpatialIndex(nodePositions, graph, drawPaths, axis, version2, deletions, routes2) {
377
380
  const cached = edgeCache.get(nodePositions);
378
- if (cached?.graph === graph && cached.drawPaths === drawPaths && cached.scaleX === axis.scaleX && cached.scaleY === axis.scaleY && cached.version === version2 && cached.deletions === deletions) {
381
+ if (cached?.graph === graph && cached.drawPaths === drawPaths && cached.scaleX === axis.scaleX && cached.scaleY === axis.scaleY && cached.version === version2 && cached.deletions === deletions && cached.routes === routes2) {
379
382
  return cached.index;
380
383
  }
381
384
  const index = new EdgeSpatialIndex(
@@ -385,7 +388,8 @@ function getEdgeSpatialIndex(nodePositions, graph, drawPaths, axis, version2, de
385
388
  axis,
386
389
  void 0,
387
390
  deletions,
388
- version2
391
+ version2,
392
+ routes2
389
393
  );
390
394
  edgeCache.set(nodePositions, {
391
395
  graph,
@@ -394,7 +398,8 @@ function getEdgeSpatialIndex(nodePositions, graph, drawPaths, axis, version2, de
394
398
  scaleY: axis.scaleY,
395
399
  version: version2,
396
400
  index,
397
- deletions
401
+ deletions,
402
+ routes: routes2
398
403
  });
399
404
  return index;
400
405
  }
@@ -424,7 +429,7 @@ function findHoveredNode(nodePositions, graphX, graphY, axis, version2 = 0, ink)
424
429
  }
425
430
  return hovered;
426
431
  }
427
- function findHoveredEdge(nodePositions, graph, graphX, graphY, axis, drawPaths, version2 = 0, deletions, hiddenEdges) {
432
+ function findHoveredEdge(nodePositions, graph, graphX, graphY, axis, drawPaths, version2 = 0, deletions, hiddenEdges, deletionRoutes) {
428
433
  const yToX = yToXOf(axis);
429
434
  const edgeThreshold = 10 / axis.scaleX;
430
435
  const edgeIndex = getEdgeSpatialIndex(
@@ -433,7 +438,8 @@ function findHoveredEdge(nodePositions, graph, graphX, graphY, axis, drawPaths,
433
438
  drawPaths,
434
439
  axis,
435
440
  version2,
436
- deletions
441
+ deletions,
442
+ deletionRoutes
437
443
  );
438
444
  const candidates = edgeIndex.query(
439
445
  graphX,
@@ -1770,6 +1776,155 @@ function bubbleSubgraph(graph, segmentIds) {
1770
1776
  referencePath: graph.referencePath
1771
1777
  };
1772
1778
  }
1779
+
1780
+ // src/layout/walkStrip.ts
1781
+ var PAD_PX = 6;
1782
+ var MIN_ROW_PX = 3;
1783
+ var LABELLED_ROW_PX = 12;
1784
+ var READOUT_ROOM = 1.3;
1785
+ var MARK_INK = "#111";
1786
+ var TICK_PX2 = 3;
1787
+ function stripMarks(graph, rows, node) {
1788
+ const visits = graph.pathVisits?.get(node.name) ?? [];
1789
+ const marks = [];
1790
+ for (const row of rows) {
1791
+ const axis = row.axis;
1792
+ if (!axis) {
1793
+ continue;
1794
+ }
1795
+ const path = pathOrigin(row.name).name;
1796
+ for (const v of visits) {
1797
+ if (v.path !== path) {
1798
+ continue;
1799
+ }
1800
+ const { start, end } = alongRow(axis, v.start, v.start + node.length);
1801
+ if (end > 0 && start < row.bp) {
1802
+ marks.push({ row: row.name, start, bp: end - start });
1803
+ }
1804
+ }
1805
+ }
1806
+ return marks;
1807
+ }
1808
+ var spanCache = /* @__PURE__ */ new WeakMap();
1809
+ function spansOf(graph, name) {
1810
+ let byName = spanCache.get(graph);
1811
+ if (!byName) {
1812
+ byName = /* @__PURE__ */ new Map();
1813
+ spanCache.set(graph, byName);
1814
+ }
1815
+ if (byName.has(name)) {
1816
+ return byName.get(name);
1817
+ }
1818
+ const lengthOf = new Map(graph.nodes.map((n) => [n.id, n.length]));
1819
+ const pieces = (graph.paths ?? []).filter((p) => p.name === name);
1820
+ let spans;
1821
+ if (pieces.every((p) => p.start !== void 0)) {
1822
+ spans = { ids: [], starts: [], ends: [] };
1823
+ for (const piece of [...pieces].sort((a, b) => a.start - b.start)) {
1824
+ let pos = piece.start;
1825
+ for (const id of piece.nodeIds) {
1826
+ const len = lengthOf.get(id) ?? 0;
1827
+ spans.ids.push(id);
1828
+ spans.starts.push(pos);
1829
+ spans.ends.push(pos + len);
1830
+ pos += len;
1831
+ }
1832
+ }
1833
+ }
1834
+ byName.set(name, spans);
1835
+ return spans;
1836
+ }
1837
+ function segmentAt(graph, row, offset, pxPerBp) {
1838
+ const axis = row.axis;
1839
+ const spans = axis && spansOf(graph, row.name);
1840
+ if (!axis || !spans || offset < 0 || offset > row.bp) {
1841
+ return void 0;
1842
+ }
1843
+ const at = axis.reversed ? axis.start - offset : axis.start + offset;
1844
+ const tol = 0.5 / pxPerBp;
1845
+ const bar = axis.reversed ? { start: axis.start - row.bp, end: axis.start } : { start: axis.start, end: axis.start + row.bp };
1846
+ const from = Math.max(at - tol, bar.start);
1847
+ const to = Math.min(at + tol, bar.end);
1848
+ let lo = 0;
1849
+ let hi = spans.starts.length;
1850
+ while (lo < hi) {
1851
+ const mid = lo + hi >> 1;
1852
+ if (spans.ends[mid] <= from) {
1853
+ lo = mid + 1;
1854
+ } else {
1855
+ hi = mid;
1856
+ }
1857
+ }
1858
+ let best;
1859
+ let bestLen = -1;
1860
+ let bestHolds = false;
1861
+ for (let i = lo; i < spans.starts.length && spans.starts[i] < to; i++) {
1862
+ const len = spans.ends[i] - spans.starts[i];
1863
+ const holds = spans.starts[i] <= at && at < spans.ends[i];
1864
+ if (len > bestLen || len === bestLen && holds && !bestHolds) {
1865
+ bestLen = len;
1866
+ best = spans.ids[i];
1867
+ bestHolds = holds;
1868
+ }
1869
+ }
1870
+ return best;
1871
+ }
1872
+ function walkStripFrame(bars, o) {
1873
+ const count = bars.rows.length + 1;
1874
+ const rowPx = Math.max(
1875
+ MIN_ROW_PX,
1876
+ Math.min(ROW_HEIGHT_PX, Math.floor((o.maxHeight - 2 * PAD_PX) / count))
1877
+ );
1878
+ const labelled = rowPx >= LABELLED_ROW_PX;
1879
+ const readouts = rowPx >= 14;
1880
+ const barPx = Math.max(2, Math.round(rowPx * 0.6));
1881
+ const longest = Math.max(bars.reference.bp, ...bars.rows.map((r) => r.bp), 1);
1882
+ const left = labelled ? o.labelPx : PAD_PX;
1883
+ const usable = Math.max(1, o.width - left - PAD_PX);
1884
+ const scaleX = usable / (longest * (readouts ? READOUT_ROOM : 1));
1885
+ return {
1886
+ scaleX,
1887
+ scaleY: 1,
1888
+ translateX: left - bars.origin * scaleX,
1889
+ translateY: PAD_PX + rowPx / 2,
1890
+ width: o.width,
1891
+ height: count * rowPx + 2 * PAD_PX,
1892
+ rowPx,
1893
+ barPx,
1894
+ readouts,
1895
+ labelled
1896
+ };
1897
+ }
1898
+ function stripRowAt(bars, frame, x, y) {
1899
+ const i = Math.round((y - frame.translateY) / frame.rowPx);
1900
+ const row = [bars.reference, ...bars.rows][i];
1901
+ const offset = (x - frame.translateX) / frame.scaleX - bars.origin;
1902
+ return row && i >= 0 && offset >= 0 && offset <= row.bp ? { index: i, row, offset } : void 0;
1903
+ }
1904
+ function walkMarksTree(bars, frame, marks) {
1905
+ const index = new Map(
1906
+ [bars.reference, ...bars.rows].map((row, i) => [row.name, i])
1907
+ );
1908
+ const X = (offset) => (bars.origin + offset) * frame.scaleX + frame.translateX;
1909
+ return el(
1910
+ "g",
1911
+ { "data-testid": "graph-walk-marks" },
1912
+ ...marks.flatMap((m) => {
1913
+ const i = index.get(m.row);
1914
+ if (i === void 0) {
1915
+ return [];
1916
+ }
1917
+ const y = i * frame.rowPx + frame.translateY;
1918
+ const x = X(m.start);
1919
+ const w = Math.max(2, m.bp * frame.scaleX);
1920
+ const tick = (top) => el("rect", { x, y: top, width: w, height: TICK_PX2, fill: MARK_INK });
1921
+ return [
1922
+ tick(y - frame.barPx / 2 - TICK_PX2 - 1),
1923
+ tick(y + frame.barPx / 2 + 1)
1924
+ ];
1925
+ })
1926
+ );
1927
+ }
1773
1928
  export {
1774
1929
  BUBBLE_KIND_COLORS,
1775
1930
  BUBBLE_KIND_NAMES,
@@ -1783,6 +1938,7 @@ export {
1783
1938
  FORCE_LAYOUT_LABEL,
1784
1939
  HALO_FACTOR,
1785
1940
  HPRC_GBZ,
1941
+ LABELLED_ROW_PX,
1786
1942
  LABEL_CHAR_PX,
1787
1943
  LABEL_PAD,
1788
1944
  LABEL_PX,
@@ -1814,6 +1970,7 @@ export {
1814
1970
  buildGeometry,
1815
1971
  clampZoom,
1816
1972
  classifyBubble,
1973
+ coalesceRuns,
1817
1974
  computeReferenceRamp,
1818
1975
  connectorAt,
1819
1976
  contains,
@@ -1891,8 +2048,11 @@ export {
1891
2048
  runPaint,
1892
2049
  schemeCss,
1893
2050
  screenToLayout,
2051
+ segmentAt,
1894
2052
  serializeEl,
1895
2053
  stripBlockAt,
2054
+ stripMarks,
2055
+ stripRowAt,
1896
2056
  svgCanvas,
1897
2057
  tubeMapConnectors,
1898
2058
  tubeMapFrame,
@@ -1907,6 +2067,7 @@ export {
1907
2067
  walkHighlight,
1908
2068
  walkKey,
1909
2069
  walkLift,
2070
+ walkMarksTree,
1910
2071
  walkPosition,
1911
2072
  walkRowReadout,
1912
2073
  walkRows,
@@ -1914,6 +2075,7 @@ export {
1914
2075
  walkRowsKey,
1915
2076
  walkRowsKeyTree,
1916
2077
  walkRowsTree,
2078
+ walkStripFrame,
1917
2079
  warpX,
1918
2080
  wellKnownSample,
1919
2081
  wheelZoomFactor,
@@ -1,4 +1,4 @@
1
- import type { Graph } from './types.js';
1
+ import type { Graph, NodeSegment } from './types.js';
2
2
  import type { AxisScale } from './util/geometry.js';
3
3
  export interface DeletionEdge {
4
4
  edgeIndex: number;
@@ -20,5 +20,5 @@ export declare function bypassedPoints(nodePositions: Record<string, {
20
20
  export declare function deletionArcCurves(nodePositions: Record<string, {
21
21
  x: number;
22
22
  y: number;
23
- }[]>, deletion: DeletionEdge, axis: AxisScale): import("./util/geometry.js").BezierCurve[] | undefined;
23
+ }[]>, deletion: DeletionEdge, axis: AxisScale, route?: NodeSegment[]): import("./util/geometry.js").BezierCurve[] | undefined;
24
24
  export declare function deletionEdges(graph: Graph): DeletionEdge[];
@@ -1,4 +1,5 @@
1
1
  import type { DeletionEdge } from './deletionEdges.js';
2
+ import type { DeletionRoutes } from './layout/deletionRoutes.js';
2
3
  import type { Box, TakeBox } from './overlayLabels.js';
3
4
  import type { AlleleDeletion, NodeSegment } from './types.js';
4
5
  import type { AxisScale } from './util/geometry.js';
@@ -23,6 +24,7 @@ interface SizeLabelArgs {
23
24
  nodePositions: Record<string, NodeSegment[]>;
24
25
  nodeLengths: Map<string, number>;
25
26
  deletions: DeletionEdge[];
27
+ deletionRoutes?: DeletionRoutes;
26
28
  alleleDeletions?: AlleleDeletion[];
27
29
  axis: AxisScale;
28
30
  translateX: number;
@@ -35,7 +37,7 @@ export interface SizeLabelCandidate {
35
37
  label: GraphLabel;
36
38
  box: Box;
37
39
  }
38
- export declare function sizeLabelCandidates({ nodePositions, nodeLengths, deletions, alleleDeletions, axis, translateX, translateY, width, height, version, }: SizeLabelArgs): {
40
+ export declare function sizeLabelCandidates({ nodePositions, nodeLengths, deletions, deletionRoutes, alleleDeletions, axis, translateX, translateY, width, height, version, }: SizeLabelArgs): {
39
41
  deletions: SizeLabelCandidate[];
40
42
  nodes: SizeLabelCandidate[];
41
43
  };
@@ -56,8 +56,10 @@ export { bubbleSubgraph } from './bubbles/popBubble.js';
56
56
  export type { MinigraphBubble } from './bubbles/bubbleLine.js';
57
57
  export { walkRows } from './layout/walkRows.js';
58
58
  export type { WalkAxis, WalkRow, WalkRows, WalkRun } from './layout/walkRows.js';
59
- export { BAR_PX as WALK_BAR_PX, DISAGREES as WALK_DISAGREES, GAP_PX as WALK_GAP_PX, GENE_INK as WALK_GENE_INK, OFF_REFERENCE as WALK_OFF_REFERENCE, ON_REFERENCE as WALK_ON_REFERENCE, OUTSIDE_CUT as WALK_OUTSIDE_CUT, alongRow, placeRowGenes, readoutPlacement, rowGeneBoxes, rowSpan, runPaint, unitTicks, walkRowReadout, walkRowsKey, walkRowsKeyTree, walkRowsTree, } from './layout/walkRowDraw.js';
59
+ export { BAR_PX as WALK_BAR_PX, DISAGREES as WALK_DISAGREES, GAP_PX as WALK_GAP_PX, GENE_INK as WALK_GENE_INK, OFF_REFERENCE as WALK_OFF_REFERENCE, ON_REFERENCE as WALK_ON_REFERENCE, OUTSIDE_CUT as WALK_OUTSIDE_CUT, alongRow, coalesceRuns, placeRowGenes, readoutPlacement, rowGeneBoxes, rowSpan, runPaint, unitTicks, walkRowReadout, walkRowsKey, walkRowsKeyTree, walkRowsTree, } from './layout/walkRowDraw.js';
60
60
  export type { GeneBox, GeneGaps, KeyEntry, KeySwatch, ReadoutCall, RowGene, WalkRowsFrame, WalkRowsWithCalls, } from './layout/walkRowDraw.js';
61
+ export { LABELLED_ROW_PX, segmentAt, stripMarks, stripRowAt, walkMarksTree, walkStripFrame, } from './layout/walkStrip.js';
62
+ export type { StripFrame, StripMark } from './layout/walkStrip.js';
61
63
  export { el, serializeEl } from './el.js';
62
64
  export type { El, ElAttrs } from './el.js';
63
65
  export { RAMP_GRADIENT_CSS, rampHue, rampHueCss, rampStops, } from './referenceRampCss.js';
@@ -2,6 +2,7 @@ import type { BubbleHalo, RouteLabel } 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';
5
+ import type { DeletionRoutes } from './layout/deletionRoutes.js';
5
6
  import type { PlacedLabel } from './overlayLabels.js';
6
7
  import type { AlleleDeletion, NodeSegment } from './types.js';
7
8
  import type { AxisScale } from './util/geometry.js';
@@ -33,6 +34,7 @@ export interface LabelLayoutSource {
33
34
  nodeLengths: Map<string, number>;
34
35
  showDeletionEdges: boolean;
35
36
  deletions: DeletionEdge[];
37
+ deletionRoutes?: DeletionRoutes;
36
38
  alleleDeletions: AlleleDeletion[];
37
39
  positionsVersion: number;
38
40
  }
@@ -0,0 +1,31 @@
1
+ import type { BandageScaleOpts } from './drawnScale.js';
2
+ import type { DeletionEdge } from '../deletionEdges.js';
3
+ import type { Graph, GraphEdge, GraphNode, NodeSegment } from '../types.js';
4
+ export type DeletionRoutes = Record<number, NodeSegment[]>;
5
+ export declare function withDeletionRoutes(graph: Graph, deletions: DeletionEdge[]): {
6
+ graph: {
7
+ nodes: {
8
+ id: string;
9
+ name: string;
10
+ length: number;
11
+ depth: number;
12
+ }[];
13
+ edges: GraphEdge[];
14
+ name: string;
15
+ paths?: import("../types.js").GraphPath[];
16
+ anchorPaths?: import("../types.js").PathOrigin[];
17
+ pathVisits?: Map<string, import("../types.js").PathVisit[]>;
18
+ anchoredBy?: "tags" | "paths";
19
+ referencePath?: string;
20
+ reads?: import("../gaf/parseGaf.js").GafRecord[];
21
+ };
22
+ routes: Map<number, string>;
23
+ ids: Set<string>;
24
+ };
25
+ export declare function routeNodes(graph: Graph, deletions: DeletionEdge[], routes: Map<number, string>, drawnOf: (bp: number) => number, opts: BandageScaleOpts): GraphNode[];
26
+ export declare function takeRoutes(positions: Record<string, NodeSegment[]>, routes: Map<number, string>): {
27
+ nodePositions: {
28
+ [x: string]: NodeSegment[];
29
+ };
30
+ deletionRoutes: DeletionRoutes;
31
+ };
@@ -25,4 +25,5 @@ export interface LayoutScaling {
25
25
  opts: BandageScaleOpts;
26
26
  }
27
27
  export declare function layoutScaling(graph: Graph, spread?: NodeLengthSpread): LayoutScaling;
28
+ export declare function drawnLengthOf(graph: Graph, spread?: NodeLengthSpread): (bp: number) => number;
28
29
  export { MEAN_NODE_LENGTH };
@@ -3,7 +3,7 @@ export interface MergedRuns {
3
3
  graph: Graph;
4
4
  runs: Map<string, string[]>;
5
5
  }
6
- export declare function mergeRuns(graph: Graph): MergedRuns;
6
+ export declare function mergeRuns(graph: Graph, alone?: ReadonlySet<string>): MergedRuns;
7
7
  export declare function splitRuns(positions: Record<string, NodeSegment[]>, runs: Map<string, string[]>, weightOf: (id: string) => number): Record<string, NodeSegment[]>;
8
8
  export declare function polylineSlice(line: NodeSegment[], from: number, to: number): NodeSegment[];
9
9
  export declare function polylineMidpoint(line: NodeSegment[]): NodeSegment;
@@ -114,7 +114,11 @@ export interface WalkRowsFrame {
114
114
  translateY: number;
115
115
  width: number;
116
116
  height: number;
117
+ rowPx?: number;
118
+ barPx?: number;
119
+ readouts?: boolean;
117
120
  }
121
+ export declare function coalesceRuns(runs: WalkRun[], pxPerBp: number): WalkRun[];
118
122
  export declare function walkRowsTree(bars: WalkRowsWithCalls, frame: WalkRowsFrame, o?: {
119
123
  ramp?: {
120
124
  start: number;
@@ -0,0 +1,28 @@
1
+ import type { WalkRowsFrame } from './walkRowDraw.js';
2
+ import type { WalkRow, WalkRows } from './walkRows.js';
3
+ import type { Graph, GraphNode } from '../types.js';
4
+ export declare const LABELLED_ROW_PX = 12;
5
+ export interface StripMark {
6
+ row: string;
7
+ start: number;
8
+ bp: number;
9
+ }
10
+ export declare function stripMarks(graph: Graph, rows: WalkRow[], node: GraphNode): StripMark[];
11
+ export declare function segmentAt(graph: Graph, row: WalkRow, offset: number, pxPerBp: number): string | undefined;
12
+ export interface StripFrame extends WalkRowsFrame {
13
+ rowPx: number;
14
+ barPx: number;
15
+ readouts: boolean;
16
+ labelled: boolean;
17
+ }
18
+ export declare function walkStripFrame(bars: WalkRows, o: {
19
+ width: number;
20
+ maxHeight: number;
21
+ labelPx: number;
22
+ }): StripFrame;
23
+ export declare function stripRowAt(bars: WalkRows, frame: StripFrame, x: number, y: number): {
24
+ index: number;
25
+ row: WalkRow;
26
+ offset: number;
27
+ } | undefined;
28
+ export declare function walkMarksTree(bars: WalkRows, frame: StripFrame, marks: StripMark[]): import("../index.js").El;
@@ -32,23 +32,26 @@ export declare function engineRequest(graph: Graph, scaling: LayoutScaling, sett
32
32
  export declare function engineKey(graph: Graph, settings: EngineSettings): string;
33
33
  export declare function forceLayout(graph: Graph, settings: EngineSettings, engine: LayoutEngine): Promise<{
34
34
  result: {
35
- nodePositions: Record<string, NodeSegment[]>;
36
- rowLabels?: import("./types.js").RowLabel[];
37
- sampleRows?: string[];
38
- alleleDeletions?: import("./types.js").AlleleDeletion[];
39
- referenceAxis?: boolean;
40
- pixelRows?: boolean;
35
+ deletionRoutes?: import("./layout/deletionRoutes.js").DeletionRoutes | undefined;
41
36
  extent?: {
42
37
  minX?: number;
43
38
  minY?: number;
44
39
  maxX?: number;
45
40
  maxY?: number;
46
41
  };
42
+ nodePositions: {
43
+ [x: string]: NodeSegment[];
44
+ };
45
+ rowLabels?: import("./types.js").RowLabel[];
46
+ sampleRows?: string[];
47
+ alleleDeletions?: import("./types.js").AlleleDeletion[];
48
+ referenceAxis?: boolean;
49
+ pixelRows?: boolean;
47
50
  tubeMap?: import("./index.js").TubeMapDrawing;
48
51
  };
49
52
  duration: number;
50
53
  }>;
51
- export declare function layoutExtent(nodePositions: Record<string, NodeSegment[]>): Bounds;
54
+ export declare function layoutExtent(nodePositions: Record<string | number, NodeSegment[]>): Bounds;
52
55
  export declare const FIT_PADDING = 40;
53
56
  export declare function clampZoom(zoom: number): number;
54
57
  export declare function fittedTranslateY(bounds: {
@@ -1,4 +1,5 @@
1
1
  import type { ResolvedColorScheme } from '../colorSchemes.js';
2
+ import type { DeletionRoutes } from '../layout/deletionRoutes.js';
2
3
  import type { NodeWidth } from '../nodeWidths.js';
3
4
  import type { Graph, GraphNode, NodeSegment } from '../types.js';
4
5
  import type { WalkLift } from '../walkHighlight.js';
@@ -27,6 +28,7 @@ export interface BuildOptions {
27
28
  };
28
29
  referenceRamp?: ReferenceRamp;
29
30
  deletions?: Map<number, string[]>;
31
+ deletionRoutes?: DeletionRoutes;
30
32
  hiddenEdges?: ReadonlySet<number>;
31
33
  version?: number;
32
34
  }
@@ -73,4 +73,5 @@ export interface LayoutResult {
73
73
  maxY?: number;
74
74
  };
75
75
  tubeMap?: TubeMapDrawing;
76
+ deletionRoutes?: Record<number, NodeSegment[]>;
76
77
  }
@@ -1,3 +1,4 @@
1
+ import type { DeletionRoutes } from '../layout/deletionRoutes.js';
1
2
  import type { Graph, NodeSegment } from '../types.js';
2
3
  import type { AxisScale } from './geometry.js';
3
4
  interface CellEntry {
@@ -18,7 +19,7 @@ export declare class EdgeSpatialIndex {
18
19
  private cellSize;
19
20
  private cells;
20
21
  private edgeCurves;
21
- constructor(nodePositions: Record<string, NodeSegment[]>, graph: Graph, drawPaths: boolean, axis: AxisScale, cellSize?: number | CellSize, deletions?: Map<number, string[]>, version?: number);
22
+ constructor(nodePositions: Record<string, NodeSegment[]>, graph: Graph, drawPaths: boolean, axis: AxisScale, cellSize?: number | CellSize, deletions?: Map<number, string[]>, version?: number, routes?: DeletionRoutes);
22
23
  getCurves(ei: number): import("./geometry.js").BezierCurve[] | undefined;
23
24
  query(x: number, y: number, radiusX: number, radiusY?: number): number[];
24
25
  }
@@ -1,4 +1,5 @@
1
+ import type { DeletionRoutes } from '../layout/deletionRoutes.js';
1
2
  import type { Graph, NodeSegment } from '../types.js';
2
3
  import type { AxisScale, BezierCurve } from './geometry.js';
3
4
  export type EdgeCurves = Map<number, BezierCurve[]>;
4
- export declare function baseEdgeCurves(nodePositions: Record<string, NodeSegment[]>, graph: Graph, axis: AxisScale, deletions: Map<number, string[]> | undefined, version: number): EdgeCurves;
5
+ export declare function baseEdgeCurves(nodePositions: Record<string, NodeSegment[]>, graph: Graph, axis: AxisScale, deletions: Map<number, string[]> | undefined, version: number, routes?: DeletionRoutes): EdgeCurves;
@@ -43,4 +43,5 @@ export declare function pathRibbonOffsets(fromSegments: NodeSegment[], toSegment
43
43
  export type SelfLink = boolean | Side;
44
44
  export declare function selfLinkOf(edge: GraphEdge): SelfLink;
45
45
  export declare function computeEdgeCurves(fromSegments: NodeSegment[], toSegments: NodeSegment[], selfLink: SelfLink, offsetX: number, offsetY: number, axis: AxisScale, bypassed?: NodeSegment[], maxBowIn?: number): BezierCurve[];
46
+ export declare function routedEdgeCurves(fromSegments: NodeSegment[], toSegments: NodeSegment[], route: NodeSegment[]): BezierCurve[];
46
47
  export {};
@@ -1,3 +1,4 @@
1
+ import type { DeletionRoutes } from '../layout/deletionRoutes.js';
1
2
  import type { Graph, NodeSegment } from '../types.js';
2
3
  import type { AxisScale } from './geometry.js';
3
4
  export declare function distanceToSegment(px: number, py: number, x1: number, y1: number, x2: number, y2: number): number;
@@ -7,4 +8,4 @@ export interface NodeInk {
7
8
  maxHalfWidthPx: number;
8
9
  }
9
10
  export declare function findHoveredNode(nodePositions: Record<string, NodeSegment[]>, graphX: number, graphY: number, axis: AxisScale, version?: number, ink?: NodeInk): string | null;
10
- export declare function findHoveredEdge(nodePositions: Record<string, NodeSegment[]>, graph: Graph, graphX: number, graphY: number, axis: AxisScale, drawPaths: boolean, version?: number, deletions?: Map<number, string[]>, hiddenEdges?: ReadonlySet<number>): number | null;
11
+ export declare function findHoveredEdge(nodePositions: Record<string, NodeSegment[]>, graph: Graph, graphX: number, graphY: number, axis: AxisScale, drawPaths: boolean, version?: number, deletions?: Map<number, string[]>, hiddenEdges?: ReadonlySet<number>, deletionRoutes?: DeletionRoutes): number | null;
@@ -1 +1 @@
1
- export declare const version = "4.1.1";
1
+ export declare const version = "4.3.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/bandage-core",
3
- "version": "4.1.1",
3
+ "version": "4.3.0",
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": {