@jbrowse/bandage-core 4.4.1 → 4.6.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.
- package/dist/chunks/{chunk-JJU4D2SE.js → chunk-XANWHEE7.js} +33 -17
- package/dist/cli/figure.js +7 -2
- package/dist/index.js +3 -1
- package/dist/types/cli/figure.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/layout/walkRowDraw.d.ts +2 -1
- package/dist/types/layout/walkRows.d.ts +4 -0
- package/dist/types/layout/walkStrip.d.ts +1 -1
- package/dist/types/referenceRampCss.d.ts +4 -0
- package/dist/types/renderer/types.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -2212,6 +2212,11 @@ function sliceBetween(steps, span, region, flanked = true) {
|
|
|
2212
2212
|
to: i1
|
|
2213
2213
|
};
|
|
2214
2214
|
}
|
|
2215
|
+
function filterSamples(rows, samples) {
|
|
2216
|
+
return samples ? rows.filter((r) => samples.includes(r.sample)).sort(
|
|
2217
|
+
(a, b) => samples.indexOf(a.sample) - samples.indexOf(b.sample) || a.label.localeCompare(b.label)
|
|
2218
|
+
) : rows;
|
|
2219
|
+
}
|
|
2215
2220
|
function walkRows(graph, region, unit) {
|
|
2216
2221
|
const paths = graph.paths ?? [];
|
|
2217
2222
|
const isReference2 = (p) => pathOrigin(p.name).name === graph.referencePath;
|
|
@@ -4986,9 +4991,12 @@ function rampStops({ start, bp, reversed }, domain) {
|
|
|
4986
4991
|
(_, i) => rampHue(start + bp * (reversed ? n2 - i : i) / n2, domain)
|
|
4987
4992
|
);
|
|
4988
4993
|
}
|
|
4989
|
-
var
|
|
4990
|
-
|
|
4991
|
-
|
|
4994
|
+
var RAMP_GRADIENT_STOPS = Array.from({ length: 7 }, (_, i) => ({
|
|
4995
|
+
offset: i / 6,
|
|
4996
|
+
color: rampHueCss(i / 6 * REFERENCE_RAMP_MAX_HUE)
|
|
4997
|
+
}));
|
|
4998
|
+
var RAMP_GRADIENT_CSS = `linear-gradient(to right, ${RAMP_GRADIENT_STOPS.map(
|
|
4999
|
+
(s) => `${s.color} ${s.offset * 100}%`
|
|
4992
5000
|
).join(", ")})`;
|
|
4993
5001
|
|
|
4994
5002
|
// src/layout/walkRowDraw.ts
|
|
@@ -5122,10 +5130,7 @@ var rowsText = (n2) => `${n2} row${n2 === 1 ? "" : "s"}`;
|
|
|
5122
5130
|
function walkRowsKey(bars, o = {}) {
|
|
5123
5131
|
const entries = [
|
|
5124
5132
|
{
|
|
5125
|
-
swatch: {
|
|
5126
|
-
kind: "bar",
|
|
5127
|
-
fill: o.ramp ? o.rampCss ?? ON_REFERENCE : ON_REFERENCE
|
|
5128
|
-
},
|
|
5133
|
+
swatch: o.ramp ? { kind: "bar", fill: o.rampCss ?? RAMP_GRADIENT_CSS, ramp: true } : { kind: "bar", fill: ON_REFERENCE },
|
|
5129
5134
|
label: `on ${bars.reference.label}'s path`
|
|
5130
5135
|
},
|
|
5131
5136
|
{
|
|
@@ -5180,9 +5185,17 @@ function walkRowsKey(bars, o = {}) {
|
|
|
5180
5185
|
var CALL_TICK = "#111";
|
|
5181
5186
|
var UNBACKED_TICK = "#9e9e9e";
|
|
5182
5187
|
var DISAGREES = "#c62828";
|
|
5183
|
-
function walkRowsKeyTree(entries, x, y) {
|
|
5188
|
+
function walkRowsKeyTree(entries, x, y, idPrefix = "walk-key") {
|
|
5184
5189
|
let at = 0;
|
|
5185
|
-
const parts = entries.flatMap((e) => {
|
|
5190
|
+
const parts = entries.flatMap((e, i) => {
|
|
5191
|
+
const rampId = `${idPrefix}-ramp-${i}`;
|
|
5192
|
+
const ramp = !e.note && e.swatch.kind === "bar" && e.swatch.ramp ? el(
|
|
5193
|
+
"linearGradient",
|
|
5194
|
+
{ id: rampId },
|
|
5195
|
+
...RAMP_GRADIENT_STOPS.map(
|
|
5196
|
+
(s) => el("stop", { offset: s.offset, "stop-color": s.color })
|
|
5197
|
+
)
|
|
5198
|
+
) : void 0;
|
|
5186
5199
|
const swatch = e.note ? void 0 : e.swatch.kind === "gene" ? el("rect", {
|
|
5187
5200
|
x: at,
|
|
5188
5201
|
y: 5,
|
|
@@ -5197,7 +5210,7 @@ function walkRowsKeyTree(entries, x, y) {
|
|
|
5197
5210
|
width: 18,
|
|
5198
5211
|
height: e.swatch.kind === "gap" ? GAP_PX : 8,
|
|
5199
5212
|
rx: 2,
|
|
5200
|
-
fill: e.swatch.fill
|
|
5213
|
+
fill: ramp ? `url(#${rampId})` : e.swatch.fill
|
|
5201
5214
|
});
|
|
5202
5215
|
const text = el(
|
|
5203
5216
|
"text",
|
|
@@ -5210,7 +5223,7 @@ function walkRowsKeyTree(entries, x, y) {
|
|
|
5210
5223
|
e.label
|
|
5211
5224
|
);
|
|
5212
5225
|
at += (e.note ? 0 : 23) + e.label.length * LABEL_CHAR_PX + 16;
|
|
5213
|
-
return
|
|
5226
|
+
return [ramp, swatch, text].filter((p) => p !== void 0);
|
|
5214
5227
|
});
|
|
5215
5228
|
return {
|
|
5216
5229
|
width: at,
|
|
@@ -5583,8 +5596,8 @@ function walkStripLabelsTree(bars, frame, bold = /* @__PURE__ */ new Set()) {
|
|
|
5583
5596
|
)
|
|
5584
5597
|
);
|
|
5585
5598
|
}
|
|
5586
|
-
function stripGeneGaps(frame,
|
|
5587
|
-
if (
|
|
5599
|
+
function stripGeneGaps(frame, rowGenes, gaps) {
|
|
5600
|
+
if (!rowGenes?.size) {
|
|
5588
5601
|
return void 0;
|
|
5589
5602
|
}
|
|
5590
5603
|
return frame.boxesGenes ? gaps : { untracked: 0, unread: 0, ...gaps, crowded: true };
|
|
@@ -5703,7 +5716,7 @@ function svgCanvas(width, height) {
|
|
|
5703
5716
|
}
|
|
5704
5717
|
|
|
5705
5718
|
// src/version.ts
|
|
5706
|
-
var version = "4.
|
|
5719
|
+
var version = "4.6.0";
|
|
5707
5720
|
|
|
5708
5721
|
// src/viewport.ts
|
|
5709
5722
|
function axisScaleOf(scale, pixelRows) {
|
|
@@ -6006,7 +6019,8 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
6006
6019
|
genes: o.rowGenes?.size ? o.rowGeneGaps : void 0
|
|
6007
6020
|
}),
|
|
6008
6021
|
x,
|
|
6009
|
-
2
|
|
6022
|
+
2,
|
|
6023
|
+
"rows-key"
|
|
6010
6024
|
);
|
|
6011
6025
|
push({ width: key.width, markup: serializeEl(key.tree) });
|
|
6012
6026
|
} else if (!lift && referenceRamp) {
|
|
@@ -6044,10 +6058,11 @@ function figureSvg(graph, layout, o = {}) {
|
|
|
6044
6058
|
const key = walkRowsKeyTree(
|
|
6045
6059
|
walkRowsKey(strip.rows, {
|
|
6046
6060
|
ramp: rampInterval,
|
|
6047
|
-
genes: stripGeneGaps(frame, strip.
|
|
6061
|
+
genes: stripGeneGaps(frame, strip.rowGenes, strip.rowGeneGaps)
|
|
6048
6062
|
}),
|
|
6049
6063
|
6,
|
|
6050
|
-
height + frame.height
|
|
6064
|
+
height + frame.height,
|
|
6065
|
+
"strip-key"
|
|
6051
6066
|
);
|
|
6052
6067
|
parts.push(
|
|
6053
6068
|
`<line x1="0" x2="${width}" y1="${height + 0.5}" y2="${height + 0.5}" stroke="#ddd"/>`,
|
|
@@ -6695,6 +6710,7 @@ export {
|
|
|
6695
6710
|
formatBp,
|
|
6696
6711
|
pathColorsLegible,
|
|
6697
6712
|
pathLegend,
|
|
6713
|
+
filterSamples,
|
|
6698
6714
|
walkRows,
|
|
6699
6715
|
walkRowsExtent,
|
|
6700
6716
|
FORCE_LAYOUT_LABEL,
|
package/dist/cli/figure.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
cutGbzRegion,
|
|
6
6
|
featuresOnBackbone,
|
|
7
7
|
figureSvg,
|
|
8
|
+
filterSamples,
|
|
8
9
|
forceLayout,
|
|
9
10
|
genesFromBed,
|
|
10
11
|
genesFromGff3Lines,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
parseRegion,
|
|
19
20
|
refNameBinding,
|
|
20
21
|
walkRows
|
|
21
|
-
} from "../chunks/chunk-
|
|
22
|
+
} from "../chunks/chunk-XANWHEE7.js";
|
|
22
23
|
|
|
23
24
|
// src/cli/figure.ts
|
|
24
25
|
import { access, open, readFile, writeFile } from "node:fs/promises";
|
|
@@ -172,7 +173,11 @@ async function renderSpec(spec, base) {
|
|
|
172
173
|
},
|
|
173
174
|
engine
|
|
174
175
|
)).result;
|
|
175
|
-
const
|
|
176
|
+
const bars = spec.walkStrip ? walkRows(graph, source.region) : void 0;
|
|
177
|
+
const stripRows = bars && {
|
|
178
|
+
...bars,
|
|
179
|
+
rows: filterSamples(bars.rows, spec.walkRowSamples)
|
|
180
|
+
};
|
|
176
181
|
return figureSvg(graph, layout, {
|
|
177
182
|
...spec,
|
|
178
183
|
walkStrip: stripRows && { rows: stripRows },
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
facetSettingOf,
|
|
59
59
|
featuresOnBackbone,
|
|
60
60
|
figureSvg,
|
|
61
|
+
filterSamples,
|
|
61
62
|
fitTransform,
|
|
62
63
|
forceLayout,
|
|
63
64
|
formatBp,
|
|
@@ -136,7 +137,7 @@ import {
|
|
|
136
137
|
wellKnownSample,
|
|
137
138
|
yToXOf,
|
|
138
139
|
zoomAbout
|
|
139
|
-
} from "./chunks/chunk-
|
|
140
|
+
} from "./chunks/chunk-XANWHEE7.js";
|
|
140
141
|
|
|
141
142
|
// src/index.ts
|
|
142
143
|
import { getDpr } from "@jbrowse/render-core/canvas2dUtils";
|
|
@@ -1854,6 +1855,7 @@ export {
|
|
|
1854
1855
|
facetSettingOf,
|
|
1855
1856
|
featuresOnBackbone,
|
|
1856
1857
|
figureSvg,
|
|
1858
|
+
filterSamples,
|
|
1857
1859
|
findHoveredEdge,
|
|
1858
1860
|
findHoveredNode,
|
|
1859
1861
|
fitTransform,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export type { BubbleHalo } from './bubbles/bubbleHalos.js';
|
|
|
54
54
|
export { BUBBLE_KIND_COLORS, BUBBLE_KIND_NAMES, bubbleSegmentIds, classifyBubble, } from './bubbles/classifyBubble.js';
|
|
55
55
|
export { bubbleSubgraph } from './bubbles/popBubble.js';
|
|
56
56
|
export type { MinigraphBubble } from './bubbles/bubbleLine.js';
|
|
57
|
-
export { walkRows } from './layout/walkRows.js';
|
|
57
|
+
export { filterSamples, walkRows } from './layout/walkRows.js';
|
|
58
58
|
export type { WalkAxis, WalkRow, WalkRows, WalkRun } from './layout/walkRows.js';
|
|
59
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';
|
|
@@ -74,6 +74,7 @@ export declare function rowGeneBoxes(genes: RowGene[], X: (offset: number) => nu
|
|
|
74
74
|
export type KeySwatch = {
|
|
75
75
|
kind: 'bar';
|
|
76
76
|
fill: string;
|
|
77
|
+
ramp?: true;
|
|
77
78
|
} | {
|
|
78
79
|
kind: 'gap';
|
|
79
80
|
fill: string;
|
|
@@ -108,7 +109,7 @@ export type WalkRowsWithCalls = Omit<WalkRows, 'reference' | 'rows'> & {
|
|
|
108
109
|
})[];
|
|
109
110
|
};
|
|
110
111
|
export declare const DISAGREES = "#c62828";
|
|
111
|
-
export declare function walkRowsKeyTree(entries: KeyEntry[], x: number, y: number): {
|
|
112
|
+
export declare function walkRowsKeyTree(entries: KeyEntry[], x: number, y: number, idPrefix?: string): {
|
|
112
113
|
width: number;
|
|
113
114
|
tree: El;
|
|
114
115
|
};
|
|
@@ -30,6 +30,10 @@ export interface WalkRows {
|
|
|
30
30
|
reference: WalkRow;
|
|
31
31
|
rows: WalkRow[];
|
|
32
32
|
}
|
|
33
|
+
export declare function filterSamples<R extends {
|
|
34
|
+
sample: string;
|
|
35
|
+
label: string;
|
|
36
|
+
}>(rows: R[], samples: string[] | undefined): R[];
|
|
33
37
|
export declare function walkRows(graph: Graph, region?: {
|
|
34
38
|
start: number;
|
|
35
39
|
end: number;
|
|
@@ -29,4 +29,4 @@ export declare function stripRowAt(bars: WalkRows, frame: StripFrame, x: number,
|
|
|
29
29
|
} | undefined;
|
|
30
30
|
export declare function walkMarksTree(bars: WalkRows, frame: StripFrame, marks: StripMark[]): import("../index.js").El;
|
|
31
31
|
export declare function walkStripLabelsTree(bars: WalkRows, frame: StripFrame, bold?: ReadonlySet<string>): import("../index.js").El;
|
|
32
|
-
export declare function stripGeneGaps(frame: StripFrame,
|
|
32
|
+
export declare function stripGeneGaps(frame: StripFrame, rowGenes: Map<string, RowGene[]> | undefined, gaps: GeneGaps | undefined): GeneGaps | undefined;
|
|
@@ -46,5 +46,6 @@ export interface Renderer {
|
|
|
46
46
|
setEdgeHighlight(edgeIndex: number | null, factor: number): void;
|
|
47
47
|
updateTransform(transform: TransformUniform): void;
|
|
48
48
|
render(clearColor: [number, number, number, number]): void;
|
|
49
|
+
releaseOffscreenTargets(): void;
|
|
49
50
|
dispose(): void;
|
|
50
51
|
}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.
|
|
1
|
+
export declare const version = "4.6.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/bandage-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.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": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@gmod/gbz-base": "^6.0.1",
|
|
35
|
-
"@gmod/tabix": "^3.9.
|
|
35
|
+
"@gmod/tabix": "^3.9.1",
|
|
36
36
|
"@gmod/tubemap-core": "^0.1.0",
|
|
37
|
-
"@jbrowse/core": "5.0.0-beta.
|
|
38
|
-
"@jbrowse/render-core": "5.0.0-beta.
|
|
37
|
+
"@jbrowse/core": "5.0.0-beta.11",
|
|
38
|
+
"@jbrowse/render-core": "5.0.0-beta.11"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"esbuild": "^0.28.2",
|