@jbrowse/bandage-core 4.6.0 → 4.7.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.
@@ -5058,6 +5058,12 @@ function alongRow(axis, start, end) {
5058
5058
  function rowSpan(axis, bp) {
5059
5059
  return axis.reversed ? { start: axis.start - bp, end: axis.start } : { start: axis.start, end: axis.start + bp };
5060
5060
  }
5061
+ function genesOnRow(row, genes) {
5062
+ const contig = row.axis?.contig;
5063
+ return genes.filter(
5064
+ (g) => g.refName === contig || g.refName.endsWith(`#${contig}`)
5065
+ );
5066
+ }
5061
5067
  function placeRowGenes(rows, byRow) {
5062
5068
  const placed = /* @__PURE__ */ new Map();
5063
5069
  for (const row of rows) {
@@ -5716,7 +5722,7 @@ function svgCanvas(width, height) {
5716
5722
  }
5717
5723
 
5718
5724
  // src/version.ts
5719
- var version = "4.6.0";
5725
+ var version = "4.7.0";
5720
5726
 
5721
5727
  // src/viewport.ts
5722
5728
  function axisScaleOf(scale, pixelRows) {
@@ -6773,6 +6779,7 @@ export {
6773
6779
  runPaint,
6774
6780
  alongRow,
6775
6781
  rowSpan,
6782
+ genesOnRow,
6776
6783
  placeRowGenes,
6777
6784
  rowGeneBoxes,
6778
6785
  walkRowsKey,
@@ -10,6 +10,7 @@ import {
10
10
  genesFromBed,
11
11
  genesFromGff3Lines,
12
12
  genesFromText,
13
+ genesOnRow,
13
14
  graphBackbone,
14
15
  haplotypeIndexBeside,
15
16
  layoutModeByValue,
@@ -17,9 +18,10 @@ import {
17
18
  loadGraph,
18
19
  openGbz,
19
20
  parseRegion,
21
+ placeRowGenes,
20
22
  refNameBinding,
21
23
  walkRows
22
- } from "../chunks/chunk-XANWHEE7.js";
24
+ } from "../chunks/chunk-NUCLM4VR.js";
23
25
 
24
26
  // src/cli/figure.ts
25
27
  import { access, open, readFile, writeFile } from "node:fs/promises";
@@ -178,12 +180,25 @@ async function renderSpec(spec, base) {
178
180
  ...bars,
179
181
  rows: filterSamples(bars.rows, spec.walkRowSamples)
180
182
  };
183
+ const genes = spec.genes ? await readGenes(spec.genes, graph, resolve) : void 0;
184
+ const reference = stripRows?.reference;
185
+ const rowGenes = reference && genes?.length ? placeRowGenes(
186
+ [reference],
187
+ /* @__PURE__ */ new Map([[reference.name, genesOnRow(reference, genes)]])
188
+ ) : void 0;
181
189
  return figureSvg(graph, layout, {
182
190
  ...spec,
183
- walkStrip: stripRows && { rows: stripRows },
191
+ walkStrip: stripRows && {
192
+ rows: stripRows,
193
+ rowGenes,
194
+ rowGeneGaps: rowGenes && {
195
+ untracked: stripRows.rows.length,
196
+ unread: 0
197
+ }
198
+ },
184
199
  walks: spec.walks?.map((w) => typeof w === "string" ? { walk: w } : w),
185
200
  region: source.region,
186
- genes: spec.genes ? await readGenes(spec.genes, graph, resolve) : void 0,
201
+ genes,
187
202
  spec
188
203
  });
189
204
  }
package/dist/index.js CHANGED
@@ -67,6 +67,7 @@ import {
67
67
  genesFromBed,
68
68
  genesFromGff3Lines,
69
69
  genesFromText,
70
+ genesOnRow,
70
71
  getNodeColor,
71
72
  graphBackbone,
72
73
  haplotypeWanted,
@@ -137,7 +138,7 @@ import {
137
138
  wellKnownSample,
138
139
  yToXOf,
139
140
  zoomAbout
140
- } from "./chunks/chunk-XANWHEE7.js";
141
+ } from "./chunks/chunk-NUCLM4VR.js";
141
142
 
142
143
  // src/index.ts
143
144
  import { getDpr } from "@jbrowse/render-core/canvas2dUtils";
@@ -1866,6 +1867,7 @@ export {
1866
1867
  genesFromBed,
1867
1868
  genesFromGff3Lines,
1868
1869
  genesFromText,
1870
+ genesOnRow,
1869
1871
  getDpr,
1870
1872
  graphBackbone,
1871
1873
  haplotypeWanted,
@@ -56,7 +56,7 @@ export { bubbleSubgraph } from './bubbles/popBubble.js';
56
56
  export type { MinigraphBubble } from './bubbles/bubbleLine.js';
57
57
  export { filterSamples, 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, coalesceRuns, 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, genesOnRow, 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
61
  export { LABELLED_ROW_PX, WALK_STRIP_CEILING_PX, segmentAt, stripGeneGaps, stripMarks, stripRowAt, walkMarksTree, walkStripFrame, walkStripLabelsTree, } from './layout/walkStrip.js';
62
62
  export type { StripFrame, StripMark } from './layout/walkStrip.js';
@@ -49,6 +49,7 @@ export interface RowGene {
49
49
  end: number;
50
50
  }[];
51
51
  }
52
+ export declare function genesOnRow(row: WalkRow, genes: GeneModel[]): GeneModel[];
52
53
  export declare function placeRowGenes(rows: WalkRow[], byRow: Map<string, GeneModel[]>): Map<string, RowGene[]>;
53
54
  export declare function boxesGenes(rowPx: number, barPx: number): boolean;
54
55
  export interface GeneBox {
@@ -1 +1 @@
1
- export declare const version = "4.6.0";
1
+ export declare const version = "4.7.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/bandage-core",
3
- "version": "4.6.0",
3
+ "version": "4.7.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": {