@jbrowse/bandage-core 0.1.10 → 0.1.12

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/dist/index.js CHANGED
@@ -1982,19 +1982,6 @@ function tubeMapReferenceLayout(graph) {
1982
1982
  };
1983
1983
  }
1984
1984
 
1985
- // src/layout/variantMapLayout.ts
1986
- function variantMapLayout(graph) {
1987
- const backbone = backboneNodes(graph);
1988
- if (backbone.length === 0) {
1989
- return void 0;
1990
- }
1991
- return {
1992
- nodePositions: backbonePositions(backbone),
1993
- referenceAxis: true,
1994
- pixelRows: true
1995
- };
1996
- }
1997
-
1998
1985
  // src/layout/walkRows.ts
1999
1986
  function sampleOf(path) {
2000
1987
  return path.sample ?? panSNSample(path.name);
@@ -2095,12 +2082,18 @@ function walkRows(graph, region, unit) {
2095
2082
  runs
2096
2083
  };
2097
2084
  };
2085
+ const meetsReference = (p) => p.nodeIds.some((id) => span2.has(id));
2086
+ const placedWalks = new Set(
2087
+ paths.filter((p) => p !== reference && meetsReference(p)).map((p) => p.name)
2088
+ );
2098
2089
  const origin = cut ? cut.start : referenceStart;
2099
2090
  return {
2100
2091
  origin,
2101
2092
  unit,
2102
2093
  reference: rowOf(reference),
2103
- rows: paths.filter((p) => p !== reference).map(rowOf).sort(
2094
+ rows: paths.filter(
2095
+ (p) => p !== reference && (meetsReference(p) || !placedWalks.has(p.name))
2096
+ ).map(rowOf).sort(
2104
2097
  (a, b) => Number(b.complete) - Number(a.complete) || b.bp - a.bp || a.label.localeCompare(b.label)
2105
2098
  )
2106
2099
  };
@@ -2184,15 +2177,6 @@ var LAYOUT_MODES = [
2184
2177
  available: hasBackbone,
2185
2178
  drawsLocally: hasBackbone
2186
2179
  },
2187
- {
2188
- value: "variants",
2189
- label: "Variant map",
2190
- description: "The reference as a line with one typed glyph per bubble, from the bubble index or from the graph itself: SNP, indel, deletion, inversion, repeat array. Click a glyph to open the graph inside it.",
2191
- run: variantMapLayout,
2192
- cutMargins: true,
2193
- available: hasBackbone,
2194
- drawsLocally: hasBackbone
2195
- },
2196
2180
  {
2197
2181
  value: "tubemap",
2198
2182
  label: "Tube map",
@@ -5606,8 +5590,6 @@ var LEGEND_INSET_PX = 6;
5606
5590
  var ROUTE_STACK = 8;
5607
5591
  var GENE_PIN_DROP_PX = 18;
5608
5592
  var GENE_STACK = 2;
5609
- var GLYPH_ROOM_PX = 60;
5610
- var MAX_GLYPH_LABEL_ROWS = 8;
5611
5593
  var TOPMOST_BASELINE = LABEL_PX + LABEL_PAD;
5612
5594
  function byExtent(items, extent) {
5613
5595
  return [...items].sort((a, b) => extent(b) - extent(a));
@@ -5665,32 +5647,6 @@ function layoutLabels(m) {
5665
5647
  frame,
5666
5648
  take
5667
5649
  );
5668
- const glyphRows = Math.max(
5669
- 2,
5670
- Math.min(
5671
- MAX_GLYPH_LABEL_ROWS,
5672
- Math.floor((translateY - GLYPH_ROOM_PX) / (LABEL_PX + LABEL_PAD * 2))
5673
- )
5674
- );
5675
- const glyphs = placeLabels(
5676
- byExtent(m.bubbleGlyphs, (g) => g.bubble.end - g.bubble.start).flatMap(
5677
- (glyph) => {
5678
- const glyphX = (glyph.bubble.start + glyph.bubble.end) / 2 * scaleX + translateX;
5679
- const half = labelWidth(glyph.label) / 2;
5680
- return glyphX < 0 || glyphX > width ? [] : [
5681
- {
5682
- item: { glyph, glyphX },
5683
- x: Math.min(Math.max(glyphX, half), width - half),
5684
- y: TOPMOST_BASELINE,
5685
- text: glyph.label,
5686
- stack: glyphRows - 1
5687
- }
5688
- ];
5689
- }
5690
- ),
5691
- frame,
5692
- take
5693
- );
5694
5650
  const genes = placeLabels(
5695
5651
  byExtent(m.genePins, (pin) => pin.gene.end - pin.gene.start).map((pin) => {
5696
5652
  const { x, y } = screen(pin.at);
@@ -5741,7 +5697,6 @@ function layoutLabels(m) {
5741
5697
  );
5742
5698
  return {
5743
5699
  bubbles,
5744
- glyphs,
5745
5700
  genes,
5746
5701
  routes: routes2,
5747
5702
  sizes: [...deletionLabels, ...nodeLabels]
@@ -45,7 +45,7 @@ export type { WalkRows } from './layout/walkRows.js';
45
45
  export { walkRowsExtent } from './layout/walkRowLayout.js';
46
46
  export { ROW_HEIGHT_PX } from './layout/rowSpacing.js';
47
47
  export { HALO_FACTOR, LEGEND_INSET_PX, layoutLabels } from './labelLayout.js';
48
- export type { BubbleGlyph, LabelLayout, LabelLayoutSource } from './labelLayout.js';
48
+ export type { LabelLayout, LabelLayoutSource } from './labelLayout.js';
49
49
  export { formatBp } from './graphLabels.js';
50
50
  export { genePins } from './genes/genePins.js';
51
51
  export type { GeneModel, GenePin } from './genes/genePins.js';
@@ -1,6 +1,4 @@
1
1
  import type { BubbleHalo, RouteLabel } from './bubbles/bubbleHalos.js';
2
- import type { MinigraphBubble } from './bubbles/bubbleLine.js';
3
- import type { BubbleKind } from './bubbles/classifyBubble.js';
4
2
  import type { DeletionEdge } from './deletionEdges.js';
5
3
  import type { GenePin } from './genes/genePins.js';
6
4
  import type { GraphLabel } from './graphLabels.js';
@@ -9,11 +7,6 @@ import type { AlleleDeletion, NodeSegment } from './types.js';
9
7
  import type { AxisScale } from './util/geometry.js';
10
8
  export declare const HALO_FACTOR = 3.4;
11
9
  export declare const LEGEND_INSET_PX = 6;
12
- export interface BubbleGlyph {
13
- bubble: MinigraphBubble;
14
- kind: BubbleKind;
15
- label: string;
16
- }
17
10
  export interface LabelLayoutSource {
18
11
  paneWidth: number;
19
12
  canvasHeight: number;
@@ -31,7 +24,6 @@ export interface LabelLayoutSource {
31
24
  y: number;
32
25
  }[];
33
26
  bubbleHalos: BubbleHalo[];
34
- bubbleGlyphs: BubbleGlyph[];
35
27
  genePins: GenePin[];
36
28
  poppedFrom?: {
37
29
  label: string;
@@ -46,10 +38,6 @@ export interface LabelLayoutSource {
46
38
  }
47
39
  export interface LabelLayout {
48
40
  bubbles: PlacedLabel<BubbleHalo>[];
49
- glyphs: PlacedLabel<{
50
- glyph: BubbleGlyph;
51
- glyphX: number;
52
- }>[];
53
41
  genes: PlacedLabel<GenePin>[];
54
42
  routes: PlacedLabel<{
55
43
  halo: BubbleHalo;
@@ -2,7 +2,6 @@ import { anchoredLayout } from './layout/anchoredLayout.js';
2
2
  import { orderedLayout } from './layout/orderedLayout.js';
3
3
  import { sampleRowLayout } from './layout/sampleRowLayout.js';
4
4
  import { hasTubeMapPaths, tubeMapLayout, tubeMapReferenceLayout } from './layout/tubeMapLayout.js';
5
- import { variantMapLayout } from './layout/variantMapLayout.js';
6
5
  import { walkRowLayout } from './layout/walkRowLayout.js';
7
6
  import type { Graph, LayoutResult } from './types.js';
8
7
  export declare const FORCE_LAYOUT_LABEL = "Force-directed layout";
@@ -50,14 +49,6 @@ export declare const LAYOUT_MODES: readonly [{
50
49
  readonly cutMargins: false;
51
50
  readonly available: (graph: Graph) => boolean;
52
51
  readonly drawsLocally: (graph: Graph) => boolean;
53
- }, {
54
- readonly value: "variants";
55
- readonly label: "Variant map";
56
- readonly description: "The reference as a line with one typed glyph per bubble, from the bubble index or from the graph itself: SNP, indel, deletion, inversion, repeat array. Click a glyph to open the graph inside it.";
57
- readonly run: typeof variantMapLayout;
58
- readonly cutMargins: true;
59
- readonly available: (graph: Graph) => boolean;
60
- readonly drawsLocally: (graph: Graph) => boolean;
61
52
  }, {
62
53
  readonly value: "tubemap";
63
54
  readonly label: "Tube map";
@@ -84,7 +75,7 @@ export declare const LAYOUT_MODES: readonly [{
84
75
  readonly drawsLocally: () => false;
85
76
  }];
86
77
  export type LayoutModeValue = (typeof LAYOUT_MODES)[number]['value'];
87
- export declare const LAYOUT_MODE_VALUES: ("auto" | "ordered" | "samplerows" | "walkrows" | "variants" | "tubemap" | "tubemapref" | "force")[];
78
+ export declare const LAYOUT_MODE_VALUES: ("auto" | "ordered" | "samplerows" | "walkrows" | "tubemap" | "tubemapref" | "force")[];
88
79
  export declare function modeUsesLayoutEngine(value: string, graph: Graph): boolean;
89
80
  export declare function layoutModeByValue(value: string): {
90
81
  readonly value: "auto";
@@ -118,14 +109,6 @@ export declare function layoutModeByValue(value: string): {
118
109
  readonly cutMargins: false;
119
110
  readonly available: (graph: Graph) => boolean;
120
111
  readonly drawsLocally: (graph: Graph) => boolean;
121
- } | {
122
- readonly value: "variants";
123
- readonly label: "Variant map";
124
- readonly description: "The reference as a line with one typed glyph per bubble, from the bubble index or from the graph itself: SNP, indel, deletion, inversion, repeat array. Click a glyph to open the graph inside it.";
125
- readonly run: typeof variantMapLayout;
126
- readonly cutMargins: true;
127
- readonly available: (graph: Graph) => boolean;
128
- readonly drawsLocally: (graph: Graph) => boolean;
129
112
  } | {
130
113
  readonly value: "tubemap";
131
114
  readonly label: "Tube map";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/bandage-core",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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,2 +0,0 @@
1
- import type { Graph, LayoutResult } from '../types.js';
2
- export declare function variantMapLayout(graph: Graph): LayoutResult | undefined;