@jbrowse/bandage-core 0.1.16 → 0.1.17
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
|
@@ -979,9 +979,15 @@ function fittedTranslateY(bounds, usableHeight, yScale, padTop = FIT_PADDING) {
|
|
|
979
979
|
const leftoverY = usableHeight - bounds.h * yScale;
|
|
980
980
|
return padTop - bounds.minY * yScale + Math.max(0, leftoverY) / 2;
|
|
981
981
|
}
|
|
982
|
-
function fitTransform(bounds, paneWidth, paneHeight, pixelRows, {
|
|
983
|
-
|
|
984
|
-
|
|
982
|
+
function fitTransform(bounds, paneWidth, paneHeight, pixelRows, {
|
|
983
|
+
minScale = 0,
|
|
984
|
+
padLeft = FIT_PADDING,
|
|
985
|
+
padTop = FIT_PADDING,
|
|
986
|
+
padRight = FIT_PADDING,
|
|
987
|
+
padBottom = FIT_PADDING
|
|
988
|
+
} = {}) {
|
|
989
|
+
const usableWidth = paneWidth - padLeft - padRight;
|
|
990
|
+
const usableHeight = paneHeight - padTop - padBottom;
|
|
985
991
|
if (usableWidth <= 0 || usableHeight <= 0 || !(bounds.w > 0 || !pixelRows && bounds.h > 0)) {
|
|
986
992
|
return void 0;
|
|
987
993
|
}
|
|
@@ -2855,10 +2861,11 @@ var EDGE_DEFAULT_COLOR = packAbgr2(119, 119, 119, 217);
|
|
|
2855
2861
|
var EDGE_PATH_FALLBACK_COLOR = packAbgr2(136, 136, 136, 217);
|
|
2856
2862
|
var EDGE_DELETION_COLOR = packAbgr2(24, 24, 28, 240);
|
|
2857
2863
|
var DELETION_THICKNESS_FACTOR = 2.2;
|
|
2864
|
+
var LIFT_BACKDROP_COLOR = packAbgr2(160, 160, 160, 255);
|
|
2858
2865
|
var FADED_ALPHA = 0.18;
|
|
2859
2866
|
var DELETION_DASH_PX = 11;
|
|
2860
2867
|
var MIN_PATH_STRIPE_PX = 1.2;
|
|
2861
|
-
var MIN_WALK_LANE_PX =
|
|
2868
|
+
var MIN_WALK_LANE_PX = 4;
|
|
2862
2869
|
var MIN_SCALE_FOR_OFFSET = 1e-6;
|
|
2863
2870
|
var ARROW_LENGTH_BASE_PX = 7;
|
|
2864
2871
|
var ARROW_LENGTH_PER_EDGE_PX = 3;
|
|
@@ -3445,13 +3452,13 @@ function buildGeometry(options) {
|
|
|
3445
3452
|
if (viewportBounds && !isPolylineInBounds(segments, viewportBounds)) {
|
|
3446
3453
|
continue;
|
|
3447
3454
|
}
|
|
3448
|
-
const
|
|
3455
|
+
const faded = highlight !== void 0 && !highlight.nodeIds.has(nodeId);
|
|
3456
|
+
const own = faded ? LIFT_BACKDROP_COLOR : getNodeColor(
|
|
3449
3457
|
node,
|
|
3450
3458
|
nodeIndexMap.get(nodeId) ?? 0,
|
|
3451
3459
|
colorScheme,
|
|
3452
3460
|
colorRange
|
|
3453
3461
|
);
|
|
3454
|
-
const faded = highlight !== void 0 && !highlight.nodeIds.has(nodeId);
|
|
3455
3462
|
const color = faded ? fadeAbgr(own, FADED_ALPHA) : own;
|
|
3456
3463
|
const width = nodeWidthPx(node, contigThickness, nodeWidth2, depthNorm);
|
|
3457
3464
|
const nodeThickness = width / 2;
|
|
@@ -4081,13 +4088,14 @@ var OVERHANG_PX = 5;
|
|
|
4081
4088
|
function referenceStripBlocks(graph, {
|
|
4082
4089
|
colorScheme,
|
|
4083
4090
|
referenceRamp,
|
|
4084
|
-
walkNodes
|
|
4091
|
+
walkNodes,
|
|
4092
|
+
walkColors
|
|
4085
4093
|
}) {
|
|
4086
4094
|
const range = { ...computeColorSchemeRange(graph), referenceRamp };
|
|
4087
4095
|
const out = [];
|
|
4088
4096
|
graph.nodes.forEach((node, index) => {
|
|
4089
4097
|
if (isBackbone(node)) {
|
|
4090
|
-
const own = getNodeColor(node, index, colorScheme, range);
|
|
4098
|
+
const own = walkNodes ? walkColors?.get(node.id) ?? LIFT_BACKDROP_COLOR : getNodeColor(node, index, colorScheme, range);
|
|
4091
4099
|
out.push({
|
|
4092
4100
|
node: node.id,
|
|
4093
4101
|
bp0: node.stable.start,
|
|
@@ -5246,78 +5254,84 @@ var WALK_FIELDS = [
|
|
|
5246
5254
|
{
|
|
5247
5255
|
value: "progress",
|
|
5248
5256
|
label: "Progress along the walk",
|
|
5249
|
-
legend: "
|
|
5257
|
+
legend: "light where each walk starts, dark where it ends"
|
|
5250
5258
|
},
|
|
5259
|
+
{ value: "walk", label: "One colour for the walk", legend: "" },
|
|
5251
5260
|
{
|
|
5252
5261
|
value: "reference",
|
|
5253
5262
|
label: "Reference position",
|
|
5254
5263
|
legend: "along the reference left to right, charcoal off it"
|
|
5255
|
-
},
|
|
5256
|
-
{
|
|
5257
|
-
value: "strand",
|
|
5258
|
-
label: "Strand against the reference",
|
|
5259
|
-
legend: "pale where the walk runs as the reference does, deep where reversed"
|
|
5260
|
-
},
|
|
5261
|
-
{
|
|
5262
|
-
value: "visits",
|
|
5263
|
-
label: "Visits",
|
|
5264
|
-
legend: "pale where the walk passes once, deep four times or more"
|
|
5265
5264
|
}
|
|
5266
5265
|
];
|
|
5267
5266
|
var WALK_SCHEMES = [
|
|
5268
|
-
{ value: "
|
|
5269
|
-
{ value: "
|
|
5270
|
-
{ value: "
|
|
5271
|
-
{ value: "
|
|
5272
|
-
{ value: "
|
|
5273
|
-
{ value: "
|
|
5274
|
-
{ value: "greys", label: "Greys" }
|
|
5275
|
-
];
|
|
5276
|
-
var DEFAULT_FAMILIES = [
|
|
5277
|
-
"blues",
|
|
5278
|
-
"reds",
|
|
5279
|
-
"greens",
|
|
5280
|
-
"oranges",
|
|
5281
|
-
"purples"
|
|
5267
|
+
{ value: "grey", label: "Grey to black", ends: ["#a3a3a3", "#151515"] },
|
|
5268
|
+
{ value: "blue", label: "Cyan to navy", ends: ["#6ee0f0", "#0b2c7a"] },
|
|
5269
|
+
{ value: "red", label: "Yellow to red", ends: ["#ffd24a", "#b3121b"] },
|
|
5270
|
+
{ value: "purple", label: "Pink to plum", ends: ["#f5a3d8", "#5e1a6e"] },
|
|
5271
|
+
{ value: "green", label: "Lime to forest", ends: ["#b6e36c", "#0b5d3b"] },
|
|
5272
|
+
{ value: "rainbow", label: "Rainbow" }
|
|
5282
5273
|
];
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
};
|
|
5274
|
+
var FAMILIES = ["blue", "red", "purple", "green"];
|
|
5275
|
+
var isField = (v) => WALK_FIELDS.some((f) => f.value === v);
|
|
5276
|
+
var isScheme = (v) => WALK_SCHEMES.some((s) => s.value === v);
|
|
5277
|
+
function resolveEncoding(layer, reference, picked, alone = true) {
|
|
5278
|
+
const { field: askedField, scheme: askedScheme } = layer.color ?? {};
|
|
5279
|
+
const field = isField(askedField) ? askedField : alone ? "progress" : "walk";
|
|
5280
|
+
const family = reference ? "grey" : FAMILIES[picked % FAMILIES.length];
|
|
5281
|
+
const scheme = isScheme(askedScheme) ? askedScheme === "rainbow" && field !== "reference" ? family : askedScheme : family;
|
|
5282
|
+
return { field, scheme };
|
|
5283
|
+
}
|
|
5284
|
+
var BASE_T = 0.5;
|
|
5285
|
+
var toLinear = (c) => c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
5286
|
+
var toGamma = (c) => c <= 31308e-7 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055;
|
|
5287
|
+
function oklab(hex) {
|
|
5288
|
+
const [r, g, b] = [1, 3, 5].map(
|
|
5289
|
+
(i) => toLinear(Number.parseInt(hex.slice(i, i + 2), 16) / 255)
|
|
5290
|
+
);
|
|
5291
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
5292
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
5293
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
5294
|
+
return [
|
|
5295
|
+
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
|
|
5296
|
+
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
|
|
5297
|
+
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s
|
|
5298
|
+
];
|
|
5299
|
+
}
|
|
5300
|
+
function oklabToRgb([L, a, b]) {
|
|
5301
|
+
const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
5302
|
+
const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
5303
|
+
const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
5304
|
+
return [
|
|
5305
|
+
4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
5306
|
+
-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
5307
|
+
-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
|
|
5308
|
+
].map((c) => toGamma(Math.max(0, Math.min(1, c))) * 255);
|
|
5288
5309
|
}
|
|
5289
|
-
|
|
5290
|
-
var DEEP = 0.28;
|
|
5291
|
-
function schemeHsl(scheme, t) {
|
|
5310
|
+
function schemeRgb(scheme, t) {
|
|
5292
5311
|
const x = Math.max(0, Math.min(1, t));
|
|
5293
|
-
if (scheme === "rainbow") {
|
|
5294
|
-
return { h: x * REFERENCE_RAMP_MAX_HUE, s: 0.7, l: 0.5 };
|
|
5295
|
-
}
|
|
5296
5312
|
const family = WALK_SCHEMES.find((s) => s.value === scheme);
|
|
5297
|
-
|
|
5298
|
-
|
|
5313
|
+
if (!family || !("ends" in family)) {
|
|
5314
|
+
return hslToRgb(x * REFERENCE_RAMP_MAX_HUE, 0.7, 0.5).map((c) => c * 255);
|
|
5315
|
+
}
|
|
5316
|
+
const from = oklab(family.ends[0]);
|
|
5317
|
+
const to = oklab(family.ends[1]);
|
|
5318
|
+
return oklabToRgb(from.map((v, i) => v + (to[i] - v) * x));
|
|
5299
5319
|
}
|
|
5300
5320
|
function schemeCss(scheme, t) {
|
|
5301
|
-
const
|
|
5302
|
-
return `
|
|
5321
|
+
const [r, g, b] = schemeRgb(scheme, t).map(Math.round);
|
|
5322
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
5303
5323
|
}
|
|
5304
5324
|
function schemeColor(scheme, t) {
|
|
5305
|
-
const
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
Math.round(b * 255),
|
|
5311
|
-
255
|
|
5312
|
-
);
|
|
5325
|
+
const [r, g, b] = schemeRgb(scheme, t).map(Math.round);
|
|
5326
|
+
return packAbgr3(r, g, b, 255);
|
|
5327
|
+
}
|
|
5328
|
+
function encodedColor({ field, scheme }, t) {
|
|
5329
|
+
return field === "walk" ? schemeColor(scheme, BASE_T) : t === void 0 ? NO_VALUE_COLOR : schemeColor(scheme, t);
|
|
5313
5330
|
}
|
|
5314
5331
|
var NO_VALUE_COLOR = REFERENCE_RAMP_ALT_COLOR;
|
|
5315
|
-
var STRAND_T = { same: 0.2, reversed: 0.95 };
|
|
5316
5332
|
function encodingSwatchCss({ field, scheme }) {
|
|
5317
|
-
if (field === "
|
|
5318
|
-
|
|
5319
|
-
const reversed = schemeCss(scheme, STRAND_T.reversed);
|
|
5320
|
-
return `linear-gradient(to right, ${same} 50%, ${reversed} 50%)`;
|
|
5333
|
+
if (field === "walk") {
|
|
5334
|
+
return schemeCss(scheme, BASE_T);
|
|
5321
5335
|
}
|
|
5322
5336
|
const stops = Array.from({ length: 7 }, (_, i) => {
|
|
5323
5337
|
const t = i / 6;
|
|
@@ -5364,9 +5378,16 @@ function walkHighlight(graph, name) {
|
|
|
5364
5378
|
before += length;
|
|
5365
5379
|
}
|
|
5366
5380
|
const reference = referenceOf(graph);
|
|
5381
|
+
const originName = pathOrigin(name).name;
|
|
5382
|
+
const origin = graph.anchorPaths?.find((a) => a.name === originName && a.length === bp) ?? graph.anchorPaths?.find((a) => a.name === originName);
|
|
5367
5383
|
return {
|
|
5368
5384
|
name,
|
|
5369
5385
|
reference: reference === path,
|
|
5386
|
+
range: origin ? {
|
|
5387
|
+
contig: path.contig ?? panSNContig(origin.name),
|
|
5388
|
+
start: origin.start,
|
|
5389
|
+
end: origin.start + origin.length
|
|
5390
|
+
} : void 0,
|
|
5370
5391
|
nodeIds: new Set(path.nodeIds),
|
|
5371
5392
|
edgeIndexes,
|
|
5372
5393
|
progress,
|
|
@@ -5375,37 +5396,39 @@ function walkHighlight(graph, name) {
|
|
|
5375
5396
|
referenceBp: reference && reference !== path ? reference.nodeIds.reduce((sum, id) => sum + lengthOf(id), 0) : void 0
|
|
5376
5397
|
};
|
|
5377
5398
|
}
|
|
5378
|
-
function laneColors(graph, walk,
|
|
5379
|
-
const colors = /* @__PURE__ */ new Map();
|
|
5399
|
+
function laneColors(graph, walk, encoding, ramp) {
|
|
5380
5400
|
const byId = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
5381
|
-
const
|
|
5382
|
-
const reference = referenceOf(graph);
|
|
5383
|
-
const referencePath = reference ? pathOrigin(reference.name).name : void 0;
|
|
5384
|
-
const path = graph.paths.find((p) => p.name === walk.name);
|
|
5385
|
-
const visits = /* @__PURE__ */ new Map();
|
|
5386
|
-
for (const id of path.nodeIds) {
|
|
5387
|
-
visits.set(id, (visits.get(id) ?? 0) + 1);
|
|
5388
|
-
}
|
|
5389
|
-
const strandOf = (segment, of) => graph.pathVisits?.get(segment)?.find((v) => v.path === of)?.strand;
|
|
5401
|
+
const colors = /* @__PURE__ */ new Map();
|
|
5390
5402
|
for (const [id, progress] of walk.progress) {
|
|
5391
5403
|
const node = byId.get(id);
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
} else if (field === "visits") {
|
|
5396
|
-
t = (Math.min(visits.get(id) ?? 1, 4) - 1) / 3;
|
|
5397
|
-
} else if (field === "reference") {
|
|
5398
|
-
const mid = ramp?.midpoints.get(id);
|
|
5399
|
-
t = ramp && mid !== void 0 && !(node?.stable && node.stable.rank > 0) ? (mid - ramp.start) / ramp.span : void 0;
|
|
5400
|
-
} else if (node) {
|
|
5401
|
-
const own = strandOf(node.name, walkPath);
|
|
5402
|
-
const theirs = strandOf(node.name, referencePath);
|
|
5403
|
-
t = own && theirs ? own === theirs ? STRAND_T.same : STRAND_T.reversed : void 0;
|
|
5404
|
-
}
|
|
5405
|
-
colors.set(id, t === void 0 ? NO_VALUE_COLOR : schemeColor(scheme, t));
|
|
5404
|
+
const mid = ramp?.midpoints.get(id);
|
|
5405
|
+
const t = encoding.field === "progress" ? progress : ramp && mid !== void 0 && !(node?.stable && node.stable.rank > 0) ? (mid - ramp.start) / ramp.span : void 0;
|
|
5406
|
+
colors.set(id, encodedColor(encoding, t));
|
|
5406
5407
|
}
|
|
5407
5408
|
return colors;
|
|
5408
5409
|
}
|
|
5410
|
+
function reversedNodes(graph, walk) {
|
|
5411
|
+
const reference = referenceOf(graph);
|
|
5412
|
+
const reversed = /* @__PURE__ */ new Set();
|
|
5413
|
+
let bp = 0;
|
|
5414
|
+
if (!reference || walk.reference) {
|
|
5415
|
+
return { reversed, bp };
|
|
5416
|
+
}
|
|
5417
|
+
const walkPath = pathOrigin(walk.name).name;
|
|
5418
|
+
const referencePath = pathOrigin(reference.name).name;
|
|
5419
|
+
const byId = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
5420
|
+
for (const id of walk.progress.keys()) {
|
|
5421
|
+
const node = byId.get(id);
|
|
5422
|
+
const visits = node ? graph.pathVisits?.get(node.name) : void 0;
|
|
5423
|
+
const own = visits?.find((v) => v.path === walkPath)?.strand;
|
|
5424
|
+
const theirs = visits?.find((v) => v.path === referencePath)?.strand;
|
|
5425
|
+
if (own && theirs && own !== theirs) {
|
|
5426
|
+
reversed.add(id);
|
|
5427
|
+
bp += node.length;
|
|
5428
|
+
}
|
|
5429
|
+
}
|
|
5430
|
+
return { reversed, bp };
|
|
5431
|
+
}
|
|
5409
5432
|
function walkLift(graph, layers, ramp) {
|
|
5410
5433
|
const seen = /* @__PURE__ */ new Set();
|
|
5411
5434
|
const lifted = layers.filter((layer) => !seen.has(layer.walk) && seen.add(layer.walk)).flatMap((layer) => {
|
|
@@ -5420,16 +5443,21 @@ function walkLift(graph, layers, ramp) {
|
|
|
5420
5443
|
const encoding = resolveEncoding(
|
|
5421
5444
|
layer,
|
|
5422
5445
|
walk.reference,
|
|
5423
|
-
walk.reference ? 0 : picked
|
|
5446
|
+
walk.reference ? 0 : picked++,
|
|
5447
|
+
lifted.length === 1
|
|
5424
5448
|
);
|
|
5449
|
+
const { reversed, bp } = reversedNodes(graph, walk);
|
|
5425
5450
|
return {
|
|
5426
5451
|
...walk,
|
|
5427
5452
|
encoding,
|
|
5428
|
-
colors: laneColors(graph, walk, encoding, ramp)
|
|
5453
|
+
colors: laneColors(graph, walk, encoding, ramp),
|
|
5454
|
+
reversed,
|
|
5455
|
+
reversedBp: bp
|
|
5429
5456
|
};
|
|
5430
5457
|
});
|
|
5431
5458
|
return {
|
|
5432
5459
|
walks,
|
|
5460
|
+
referenceDomain: ramp ? { start: ramp.start, end: ramp.start + ramp.span } : void 0,
|
|
5433
5461
|
nodeIds: new Set(walks.flatMap((w) => [...w.nodeIds])),
|
|
5434
5462
|
edgeIndexes: new Set(walks.flatMap((w) => [...w.edgeIndexes])),
|
|
5435
5463
|
names: new Set(walks.map((w) => w.name))
|
package/dist/types/pipeline.d.ts
CHANGED
|
@@ -60,10 +60,12 @@ export declare function fitTransform(bounds: {
|
|
|
60
60
|
minY: number;
|
|
61
61
|
w: number;
|
|
62
62
|
h: number;
|
|
63
|
-
}, paneWidth: number, paneHeight: number, pixelRows: boolean, { minScale, padLeft, padTop }?: {
|
|
63
|
+
}, paneWidth: number, paneHeight: number, pixelRows: boolean, { minScale, padLeft, padTop, padRight, padBottom, }?: {
|
|
64
64
|
minScale?: number | undefined;
|
|
65
65
|
padLeft?: number | undefined;
|
|
66
66
|
padTop?: number | undefined;
|
|
67
|
+
padRight?: number | undefined;
|
|
68
|
+
padBottom?: number | undefined;
|
|
67
69
|
}): {
|
|
68
70
|
scale: number;
|
|
69
71
|
translateX: number;
|
|
@@ -9,10 +9,11 @@ export interface StripBlock {
|
|
|
9
9
|
bp1: number;
|
|
10
10
|
color: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function referenceStripBlocks(graph: Graph, { colorScheme, referenceRamp, walkNodes, }: {
|
|
12
|
+
export declare function referenceStripBlocks(graph: Graph, { colorScheme, referenceRamp, walkNodes, walkColors, }: {
|
|
13
13
|
colorScheme: ResolvedColorScheme;
|
|
14
14
|
referenceRamp?: ReferenceRamp;
|
|
15
15
|
walkNodes?: ReadonlySet<string>;
|
|
16
|
+
walkColors?: ReadonlyMap<string, number>;
|
|
16
17
|
}): StripBlock[];
|
|
17
18
|
export interface BpFrame {
|
|
18
19
|
scale: number;
|
|
@@ -4,6 +4,7 @@ import type { Graph, GraphNode, NodeSegment } from '../types.js';
|
|
|
4
4
|
import type { WalkLift } from '../walkHighlight.js';
|
|
5
5
|
import type { RenderBatch } from './types.js';
|
|
6
6
|
import type { AxisScale, BezierCurve } from '../util/geometry.js';
|
|
7
|
+
export declare const LIFT_BACKDROP_COLOR: number;
|
|
7
8
|
export declare const FADED_ALPHA = 0.18;
|
|
8
9
|
export interface BuildOptions {
|
|
9
10
|
nodePositions: Record<string, NodeSegment[]>;
|
|
@@ -1,47 +1,40 @@
|
|
|
1
1
|
export declare const WALK_FIELDS: readonly [{
|
|
2
2
|
readonly value: "progress";
|
|
3
3
|
readonly label: "Progress along the walk";
|
|
4
|
-
readonly legend: "
|
|
4
|
+
readonly legend: "light where each walk starts, dark where it ends";
|
|
5
|
+
}, {
|
|
6
|
+
readonly value: "walk";
|
|
7
|
+
readonly label: "One colour for the walk";
|
|
8
|
+
readonly legend: "";
|
|
5
9
|
}, {
|
|
6
10
|
readonly value: "reference";
|
|
7
11
|
readonly label: "Reference position";
|
|
8
12
|
readonly legend: "along the reference left to right, charcoal off it";
|
|
9
|
-
}, {
|
|
10
|
-
readonly value: "strand";
|
|
11
|
-
readonly label: "Strand against the reference";
|
|
12
|
-
readonly legend: "pale where the walk runs as the reference does, deep where reversed";
|
|
13
|
-
}, {
|
|
14
|
-
readonly value: "visits";
|
|
15
|
-
readonly label: "Visits";
|
|
16
|
-
readonly legend: "pale where the walk passes once, deep four times or more";
|
|
17
13
|
}];
|
|
18
14
|
export type WalkField = (typeof WALK_FIELDS)[number]['value'];
|
|
19
15
|
export declare const WALK_SCHEMES: readonly [{
|
|
20
|
-
readonly value: "
|
|
21
|
-
readonly label: "
|
|
22
|
-
|
|
23
|
-
readonly value: "blues";
|
|
24
|
-
readonly label: "Blues";
|
|
25
|
-
readonly hue: 215;
|
|
16
|
+
readonly value: "grey";
|
|
17
|
+
readonly label: "Grey to black";
|
|
18
|
+
readonly ends: readonly ["#a3a3a3", "#151515"];
|
|
26
19
|
}, {
|
|
27
|
-
readonly value: "
|
|
28
|
-
readonly label: "
|
|
29
|
-
readonly
|
|
20
|
+
readonly value: "blue";
|
|
21
|
+
readonly label: "Cyan to navy";
|
|
22
|
+
readonly ends: readonly ["#6ee0f0", "#0b2c7a"];
|
|
30
23
|
}, {
|
|
31
|
-
readonly value: "
|
|
32
|
-
readonly label: "
|
|
33
|
-
readonly
|
|
24
|
+
readonly value: "red";
|
|
25
|
+
readonly label: "Yellow to red";
|
|
26
|
+
readonly ends: readonly ["#ffd24a", "#b3121b"];
|
|
34
27
|
}, {
|
|
35
|
-
readonly value: "
|
|
36
|
-
readonly label: "
|
|
37
|
-
readonly
|
|
28
|
+
readonly value: "purple";
|
|
29
|
+
readonly label: "Pink to plum";
|
|
30
|
+
readonly ends: readonly ["#f5a3d8", "#5e1a6e"];
|
|
38
31
|
}, {
|
|
39
|
-
readonly value: "
|
|
40
|
-
readonly label: "
|
|
41
|
-
readonly
|
|
32
|
+
readonly value: "green";
|
|
33
|
+
readonly label: "Lime to forest";
|
|
34
|
+
readonly ends: readonly ["#b6e36c", "#0b5d3b"];
|
|
42
35
|
}, {
|
|
43
|
-
readonly value: "
|
|
44
|
-
readonly label: "
|
|
36
|
+
readonly value: "rainbow";
|
|
37
|
+
readonly label: "Rainbow";
|
|
45
38
|
}];
|
|
46
39
|
export type WalkScheme = (typeof WALK_SCHEMES)[number]['value'];
|
|
47
40
|
export interface WalkEncoding {
|
|
@@ -52,19 +45,12 @@ export interface WalkLayer {
|
|
|
52
45
|
walk: string;
|
|
53
46
|
color?: Partial<WalkEncoding>;
|
|
54
47
|
}
|
|
55
|
-
export declare function resolveEncoding(layer: WalkLayer, reference: boolean, picked: number): WalkEncoding;
|
|
56
|
-
export declare function
|
|
57
|
-
h: number;
|
|
58
|
-
s: number;
|
|
59
|
-
l: number;
|
|
60
|
-
};
|
|
48
|
+
export declare function resolveEncoding(layer: WalkLayer, reference: boolean, picked: number, alone?: boolean): WalkEncoding;
|
|
49
|
+
export declare function schemeRgb(scheme: WalkScheme, t: number): number[];
|
|
61
50
|
export declare function schemeCss(scheme: WalkScheme, t: number): string;
|
|
62
51
|
export declare function schemeColor(scheme: WalkScheme, t: number): number;
|
|
52
|
+
export declare function encodedColor({ field, scheme }: WalkEncoding, t?: number): number;
|
|
63
53
|
export declare const NO_VALUE_COLOR: number;
|
|
64
54
|
export declare const NO_VALUE_CSS: string;
|
|
65
|
-
export declare const STRAND_T: {
|
|
66
|
-
same: number;
|
|
67
|
-
reversed: number;
|
|
68
|
-
};
|
|
69
55
|
export declare function encodingSwatchCss({ field, scheme }: WalkEncoding): string;
|
|
70
|
-
export declare function fieldLegend(field: WalkField): "
|
|
56
|
+
export declare function fieldLegend(field: WalkField): "" | "light where each walk starts, dark where it ends" | "along the reference left to right, charcoal off it";
|
|
@@ -10,13 +10,24 @@ export interface WalkHighlight {
|
|
|
10
10
|
steps: number;
|
|
11
11
|
bp: number;
|
|
12
12
|
referenceBp?: number;
|
|
13
|
+
range?: {
|
|
14
|
+
contig: string;
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
};
|
|
13
18
|
}
|
|
14
19
|
export interface LiftedWalk extends WalkHighlight {
|
|
15
20
|
encoding: WalkEncoding;
|
|
16
21
|
colors: Map<string, number>;
|
|
22
|
+
reversed: Set<string>;
|
|
23
|
+
reversedBp: number;
|
|
17
24
|
}
|
|
18
25
|
export interface WalkLift {
|
|
19
26
|
walks: LiftedWalk[];
|
|
27
|
+
referenceDomain?: {
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
};
|
|
20
31
|
nodeIds: Set<string>;
|
|
21
32
|
edgeIndexes: Set<number>;
|
|
22
33
|
names: Set<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/bandage-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
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": {
|