@jbrowse/bandage-core 0.1.13 → 0.1.15
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
|
@@ -2848,11 +2848,10 @@ var EDGE_DEFAULT_COLOR = packAbgr2(119, 119, 119, 217);
|
|
|
2848
2848
|
var EDGE_PATH_FALLBACK_COLOR = packAbgr2(136, 136, 136, 217);
|
|
2849
2849
|
var EDGE_DELETION_COLOR = packAbgr2(24, 24, 28, 240);
|
|
2850
2850
|
var DELETION_THICKNESS_FACTOR = 2.2;
|
|
2851
|
-
var EDGE_WALK_COLOR = packAbgr2(30, 30, 36, 245);
|
|
2852
|
-
var WALK_EDGE_THICKNESS_FACTOR = 1.8;
|
|
2853
2851
|
var FADED_ALPHA = 0.18;
|
|
2854
2852
|
var DELETION_DASH_PX = 11;
|
|
2855
2853
|
var MIN_PATH_STRIPE_PX = 1.2;
|
|
2854
|
+
var MIN_WALK_LANE_PX = 3;
|
|
2856
2855
|
var MIN_SCALE_FOR_OFFSET = 1e-6;
|
|
2857
2856
|
var ARROW_LENGTH_BASE_PX = 7;
|
|
2858
2857
|
var ARROW_LENGTH_PER_EDGE_PX = 3;
|
|
@@ -3341,10 +3340,10 @@ function buildGeometry(options) {
|
|
|
3341
3340
|
const bypassed = deletions?.get(ei);
|
|
3342
3341
|
const isDeletion = bypassed !== void 0;
|
|
3343
3342
|
const onWalk = highlight?.edgeIndexes.has(ei) ?? false;
|
|
3344
|
-
const edgeThickness = connectorThickness / 2 * (isDeletion ? DELETION_THICKNESS_FACTOR : 1)
|
|
3343
|
+
const edgeThickness = connectorThickness / 2 * (isDeletion ? DELETION_THICKNESS_FACTOR : 1);
|
|
3345
3344
|
const ribbons = drawPaths && numPaths > 0;
|
|
3346
3345
|
const plainEdgeColor = isDeletion ? EDGE_DELETION_COLOR : EDGE_DEFAULT_COLOR;
|
|
3347
|
-
const edgeColor = !highlight
|
|
3346
|
+
const edgeColor = !highlight || onWalk ? plainEdgeColor : fadeAbgr(plainEdgeColor, FADED_ALPHA);
|
|
3348
3347
|
const toNode = nodeById.get(edge.to);
|
|
3349
3348
|
const intoHalfWidth = (toNode ? nodeWidthPx(toNode, contigThickness, nodeWidth2, depthNorm) : contigThickness) / 2;
|
|
3350
3349
|
const buildSingleEdge = (offsetX, offsetY, color, arrowColor) => {
|
|
@@ -3375,7 +3374,33 @@ function buildGeometry(options) {
|
|
|
3375
3374
|
};
|
|
3376
3375
|
const edgeCurveStart = edgeCurves.length;
|
|
3377
3376
|
const arrowStart = arrows.length;
|
|
3378
|
-
|
|
3377
|
+
const laneWalks = highlight && onWalk && !ribbons ? highlight.walks : void 0;
|
|
3378
|
+
if (laneWalks) {
|
|
3379
|
+
const fromNode = nodeById.get(edge.from);
|
|
3380
|
+
const width = fromNode ? nodeWidthPx(fromNode, contigThickness, nodeWidth2, depthNorm) : contigThickness;
|
|
3381
|
+
const laneWidth = Math.max(width / laneWalks.length, MIN_WALK_LANE_PX);
|
|
3382
|
+
const normals = pointNormalsOf(fromSegments, yToX);
|
|
3383
|
+
const { nx, ny } = (edge.fromStrand === "-" ? normals[0] : normals.at(-1)) ?? {
|
|
3384
|
+
nx: 0,
|
|
3385
|
+
ny: 0
|
|
3386
|
+
};
|
|
3387
|
+
const worldPerScreenPx = 1 / Math.max(scale, MIN_SCALE_FOR_OFFSET);
|
|
3388
|
+
laneWalks.forEach((walk, lane) => {
|
|
3389
|
+
if (!walk.edgeIndexes.has(ei)) {
|
|
3390
|
+
return;
|
|
3391
|
+
}
|
|
3392
|
+
const offset = (lane - (laneWalks.length - 1) / 2) * laneWidth * worldPerScreenPx;
|
|
3393
|
+
const curves = offset === 0 ? baseCurves : translateCurves(baseCurves, nx * offset, ny * offset / yToX);
|
|
3394
|
+
if (viewportBounds && !isBezierInBounds(curves, viewportBounds)) {
|
|
3395
|
+
return;
|
|
3396
|
+
}
|
|
3397
|
+
edgeCurves.push({
|
|
3398
|
+
curves,
|
|
3399
|
+
thickness: laneWidth / 2,
|
|
3400
|
+
color: walk.colors.get(edge.from) ?? walk.colors.get(edge.to) ?? plainEdgeColor
|
|
3401
|
+
});
|
|
3402
|
+
});
|
|
3403
|
+
} else if (!ribbons) {
|
|
3379
3404
|
buildSingleEdge(0, 0, edgeColor, edgeColor);
|
|
3380
3405
|
} else {
|
|
3381
3406
|
const offsets = pathRibbonOffsets(
|
|
@@ -3391,7 +3416,7 @@ function buildGeometry(options) {
|
|
|
3391
3416
|
buildSingleEdge(
|
|
3392
3417
|
offset.x,
|
|
3393
3418
|
offset.y,
|
|
3394
|
-
highlight && edge.pathIds[pathIdx]
|
|
3419
|
+
highlight && !highlight.names.has(edge.pathIds[pathIdx]) ? fadeAbgr(ribbonColor, FADED_ALPHA) : ribbonColor,
|
|
3395
3420
|
pathIdx === arrowRibbon ? edgeColor : void 0
|
|
3396
3421
|
);
|
|
3397
3422
|
}
|
|
@@ -3427,7 +3452,24 @@ function buildGeometry(options) {
|
|
|
3427
3452
|
const slots = nodePathSlots.get(nodeId);
|
|
3428
3453
|
const slotWidth = width / pathCount;
|
|
3429
3454
|
const drawable = segments.length >= 2;
|
|
3430
|
-
|
|
3455
|
+
const lanes = highlight && !faded && !slots?.length ? highlight.walks : void 0;
|
|
3456
|
+
if (drawable && lanes) {
|
|
3457
|
+
const laneWidth = Math.max(width / lanes.length, MIN_WALK_LANE_PX);
|
|
3458
|
+
const normals = pointNormalsOf(segments, yToX);
|
|
3459
|
+
const worldPerScreenPx = 1 / Math.max(scale, MIN_SCALE_FOR_OFFSET);
|
|
3460
|
+
lanes.forEach((walk, lane) => {
|
|
3461
|
+
const laneColor = walk.colors.get(nodeId);
|
|
3462
|
+
if (laneColor === void 0) {
|
|
3463
|
+
return;
|
|
3464
|
+
}
|
|
3465
|
+
const offset = (lane - (lanes.length - 1) / 2) * laneWidth * worldPerScreenPx;
|
|
3466
|
+
nodeStrokes.push({
|
|
3467
|
+
points: lanes.length === 1 ? segments : offsetPolyline(segments, normals, offset, yToX),
|
|
3468
|
+
thickness: laneWidth / 2,
|
|
3469
|
+
color: laneColor
|
|
3470
|
+
});
|
|
3471
|
+
});
|
|
3472
|
+
} else if (drawable && slots?.length && slotWidth >= MIN_PATH_STRIPE_PX) {
|
|
3431
3473
|
const normals = pointNormalsOf(segments, yToX);
|
|
3432
3474
|
const worldPerScreenPx = 1 / Math.max(scale, MIN_SCALE_FOR_OFFSET);
|
|
3433
3475
|
for (const slot of slots) {
|
|
@@ -5191,7 +5233,99 @@ function drawTubeMapConnectors(ctx, connectors, bottom, {
|
|
|
5191
5233
|
}
|
|
5192
5234
|
}
|
|
5193
5235
|
|
|
5236
|
+
// src/walkEncoding.ts
|
|
5237
|
+
import { packAbgr as packAbgr3 } from "@jbrowse/core/util/colorBits";
|
|
5238
|
+
var WALK_FIELDS = [
|
|
5239
|
+
{
|
|
5240
|
+
value: "progress",
|
|
5241
|
+
label: "Progress along the walk",
|
|
5242
|
+
legend: "pale where the walk starts, deep where it ends"
|
|
5243
|
+
},
|
|
5244
|
+
{
|
|
5245
|
+
value: "reference",
|
|
5246
|
+
label: "Reference position",
|
|
5247
|
+
legend: "along the reference left to right, charcoal off it"
|
|
5248
|
+
},
|
|
5249
|
+
{
|
|
5250
|
+
value: "strand",
|
|
5251
|
+
label: "Strand against the reference",
|
|
5252
|
+
legend: "pale where the walk runs as the reference does, deep where reversed"
|
|
5253
|
+
},
|
|
5254
|
+
{
|
|
5255
|
+
value: "visits",
|
|
5256
|
+
label: "Visits",
|
|
5257
|
+
legend: "pale where the walk passes once, deep four times or more"
|
|
5258
|
+
}
|
|
5259
|
+
];
|
|
5260
|
+
var WALK_SCHEMES = [
|
|
5261
|
+
{ value: "rainbow", label: "Rainbow" },
|
|
5262
|
+
{ value: "blues", label: "Blues", hue: 215 },
|
|
5263
|
+
{ value: "reds", label: "Reds", hue: 0 },
|
|
5264
|
+
{ value: "greens", label: "Greens", hue: 130 },
|
|
5265
|
+
{ value: "oranges", label: "Oranges", hue: 30 },
|
|
5266
|
+
{ value: "purples", label: "Purples", hue: 280 },
|
|
5267
|
+
{ value: "greys", label: "Greys" }
|
|
5268
|
+
];
|
|
5269
|
+
var DEFAULT_FAMILIES = [
|
|
5270
|
+
"blues",
|
|
5271
|
+
"reds",
|
|
5272
|
+
"greens",
|
|
5273
|
+
"oranges",
|
|
5274
|
+
"purples"
|
|
5275
|
+
];
|
|
5276
|
+
function resolveEncoding(layer, reference, picked) {
|
|
5277
|
+
return {
|
|
5278
|
+
field: layer.color?.field ?? (reference ? "reference" : "progress"),
|
|
5279
|
+
scheme: layer.color?.scheme ?? (reference ? "rainbow" : DEFAULT_FAMILIES[picked % DEFAULT_FAMILIES.length])
|
|
5280
|
+
};
|
|
5281
|
+
}
|
|
5282
|
+
var PALE = 0.82;
|
|
5283
|
+
var DEEP = 0.28;
|
|
5284
|
+
function schemeHsl(scheme, t) {
|
|
5285
|
+
const x = Math.max(0, Math.min(1, t));
|
|
5286
|
+
if (scheme === "rainbow") {
|
|
5287
|
+
return { h: x * REFERENCE_RAMP_MAX_HUE, s: 0.7, l: 0.5 };
|
|
5288
|
+
}
|
|
5289
|
+
const family = WALK_SCHEMES.find((s) => s.value === scheme);
|
|
5290
|
+
const l = PALE + (DEEP - PALE) * x;
|
|
5291
|
+
return family && "hue" in family ? { h: family.hue, s: 0.75, l } : { h: 0, s: 0, l };
|
|
5292
|
+
}
|
|
5293
|
+
function schemeCss(scheme, t) {
|
|
5294
|
+
const { h, s, l } = schemeHsl(scheme, t);
|
|
5295
|
+
return `hsl(${h}, ${s * 100}%, ${l * 100}%)`;
|
|
5296
|
+
}
|
|
5297
|
+
function schemeColor(scheme, t) {
|
|
5298
|
+
const { h, s, l } = schemeHsl(scheme, t);
|
|
5299
|
+
const [r, g, b] = hslToRgb(h, s, l);
|
|
5300
|
+
return packAbgr3(
|
|
5301
|
+
Math.round(r * 255),
|
|
5302
|
+
Math.round(g * 255),
|
|
5303
|
+
Math.round(b * 255),
|
|
5304
|
+
255
|
|
5305
|
+
);
|
|
5306
|
+
}
|
|
5307
|
+
var NO_VALUE_COLOR = REFERENCE_RAMP_ALT_COLOR;
|
|
5308
|
+
var STRAND_T = { same: 0.2, reversed: 0.95 };
|
|
5309
|
+
function encodingSwatchCss({ field, scheme }) {
|
|
5310
|
+
if (field === "strand") {
|
|
5311
|
+
const same = schemeCss(scheme, STRAND_T.same);
|
|
5312
|
+
const reversed = schemeCss(scheme, STRAND_T.reversed);
|
|
5313
|
+
return `linear-gradient(to right, ${same} 50%, ${reversed} 50%)`;
|
|
5314
|
+
}
|
|
5315
|
+
const stops = Array.from({ length: 7 }, (_, i) => {
|
|
5316
|
+
const t = i / 6;
|
|
5317
|
+
return `${schemeCss(scheme, t)} ${t * 100}%`;
|
|
5318
|
+
});
|
|
5319
|
+
return `linear-gradient(to right, ${stops.join(", ")})`;
|
|
5320
|
+
}
|
|
5321
|
+
function fieldLegend(field) {
|
|
5322
|
+
return WALK_FIELDS.find((f) => f.value === field).legend;
|
|
5323
|
+
}
|
|
5324
|
+
|
|
5194
5325
|
// src/walkHighlight.ts
|
|
5326
|
+
function referenceOf(graph) {
|
|
5327
|
+
return graph.referencePath ? graph.paths?.find((p) => pathOrigin(p.name).name === graph.referencePath) : void 0;
|
|
5328
|
+
}
|
|
5195
5329
|
function walkHighlight(graph, name) {
|
|
5196
5330
|
const path = graph.paths?.find((p) => p.name === name);
|
|
5197
5331
|
if (!path) {
|
|
@@ -5202,7 +5336,6 @@ function walkHighlight(graph, name) {
|
|
|
5202
5336
|
graph.edges.forEach((e, i) => {
|
|
5203
5337
|
edgeAt.set(`${e.from}>${e.to}`, i);
|
|
5204
5338
|
});
|
|
5205
|
-
const nodeIds = new Set(path.nodeIds);
|
|
5206
5339
|
const edgeIndexes = /* @__PURE__ */ new Set();
|
|
5207
5340
|
for (let i = 1; i < path.nodeIds.length; i++) {
|
|
5208
5341
|
const a = path.nodeIds[i - 1];
|
|
@@ -5212,15 +5345,87 @@ function walkHighlight(graph, name) {
|
|
|
5212
5345
|
edgeIndexes.add(index);
|
|
5213
5346
|
}
|
|
5214
5347
|
}
|
|
5215
|
-
const
|
|
5216
|
-
const
|
|
5348
|
+
const lengthOf = (id) => byId.get(id)?.length ?? 0;
|
|
5349
|
+
const bp = path.nodeIds.reduce((sum, id) => sum + lengthOf(id), 0);
|
|
5350
|
+
const progress = /* @__PURE__ */ new Map();
|
|
5351
|
+
let before = 0;
|
|
5352
|
+
for (const id of path.nodeIds) {
|
|
5353
|
+
const length = lengthOf(id);
|
|
5354
|
+
if (!progress.has(id)) {
|
|
5355
|
+
progress.set(id, bp > 0 ? (before + length / 2) / bp : 0);
|
|
5356
|
+
}
|
|
5357
|
+
before += length;
|
|
5358
|
+
}
|
|
5359
|
+
const reference = referenceOf(graph);
|
|
5217
5360
|
return {
|
|
5218
5361
|
name,
|
|
5219
|
-
|
|
5362
|
+
reference: reference === path,
|
|
5363
|
+
nodeIds: new Set(path.nodeIds),
|
|
5220
5364
|
edgeIndexes,
|
|
5365
|
+
progress,
|
|
5221
5366
|
steps: path.nodeIds.length,
|
|
5222
|
-
bp
|
|
5223
|
-
referenceBp: reference && reference !== path ?
|
|
5367
|
+
bp,
|
|
5368
|
+
referenceBp: reference && reference !== path ? reference.nodeIds.reduce((sum, id) => sum + lengthOf(id), 0) : void 0
|
|
5369
|
+
};
|
|
5370
|
+
}
|
|
5371
|
+
function laneColors(graph, walk, { field, scheme }, ramp) {
|
|
5372
|
+
const colors = /* @__PURE__ */ new Map();
|
|
5373
|
+
const byId = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
5374
|
+
const walkPath = pathOrigin(walk.name).name;
|
|
5375
|
+
const reference = referenceOf(graph);
|
|
5376
|
+
const referencePath = reference ? pathOrigin(reference.name).name : void 0;
|
|
5377
|
+
const path = graph.paths.find((p) => p.name === walk.name);
|
|
5378
|
+
const visits = /* @__PURE__ */ new Map();
|
|
5379
|
+
for (const id of path.nodeIds) {
|
|
5380
|
+
visits.set(id, (visits.get(id) ?? 0) + 1);
|
|
5381
|
+
}
|
|
5382
|
+
const strandOf = (segment, of) => graph.pathVisits?.get(segment)?.find((v) => v.path === of)?.strand;
|
|
5383
|
+
for (const [id, progress] of walk.progress) {
|
|
5384
|
+
const node = byId.get(id);
|
|
5385
|
+
let t;
|
|
5386
|
+
if (field === "progress") {
|
|
5387
|
+
t = progress;
|
|
5388
|
+
} else if (field === "visits") {
|
|
5389
|
+
t = (Math.min(visits.get(id) ?? 1, 4) - 1) / 3;
|
|
5390
|
+
} else if (field === "reference") {
|
|
5391
|
+
const mid = ramp?.midpoints.get(id);
|
|
5392
|
+
t = ramp && mid !== void 0 && !(node?.stable && node.stable.rank > 0) ? (mid - ramp.start) / ramp.span : void 0;
|
|
5393
|
+
} else if (node) {
|
|
5394
|
+
const own = strandOf(node.name, walkPath);
|
|
5395
|
+
const theirs = strandOf(node.name, referencePath);
|
|
5396
|
+
t = own && theirs ? own === theirs ? STRAND_T.same : STRAND_T.reversed : void 0;
|
|
5397
|
+
}
|
|
5398
|
+
colors.set(id, t === void 0 ? NO_VALUE_COLOR : schemeColor(scheme, t));
|
|
5399
|
+
}
|
|
5400
|
+
return colors;
|
|
5401
|
+
}
|
|
5402
|
+
function walkLift(graph, layers, ramp) {
|
|
5403
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5404
|
+
const lifted = layers.filter((layer) => !seen.has(layer.walk) && seen.add(layer.walk)).flatMap((layer) => {
|
|
5405
|
+
const walk = walkHighlight(graph, layer.walk);
|
|
5406
|
+
return walk ? [{ walk, layer }] : [];
|
|
5407
|
+
}).sort((a, b) => Number(b.walk.reference) - Number(a.walk.reference));
|
|
5408
|
+
if (lifted.length === 0) {
|
|
5409
|
+
return void 0;
|
|
5410
|
+
}
|
|
5411
|
+
let picked = 0;
|
|
5412
|
+
const walks = lifted.map(({ walk, layer }) => {
|
|
5413
|
+
const encoding = resolveEncoding(
|
|
5414
|
+
layer,
|
|
5415
|
+
walk.reference,
|
|
5416
|
+
walk.reference ? 0 : picked++
|
|
5417
|
+
);
|
|
5418
|
+
return {
|
|
5419
|
+
...walk,
|
|
5420
|
+
encoding,
|
|
5421
|
+
colors: laneColors(graph, walk, encoding, ramp)
|
|
5422
|
+
};
|
|
5423
|
+
});
|
|
5424
|
+
return {
|
|
5425
|
+
walks,
|
|
5426
|
+
nodeIds: new Set(walks.flatMap((w) => [...w.nodeIds])),
|
|
5427
|
+
edgeIndexes: new Set(walks.flatMap((w) => [...w.edgeIndexes])),
|
|
5428
|
+
names: new Set(walks.map((w) => w.name))
|
|
5224
5429
|
};
|
|
5225
5430
|
}
|
|
5226
5431
|
|
|
@@ -6053,6 +6258,8 @@ export {
|
|
|
6053
6258
|
REFERENCE_RAMP_MAX_HUE,
|
|
6054
6259
|
REFERENCE_STRIP_ZONE_PX,
|
|
6055
6260
|
ROW_HEIGHT_PX,
|
|
6261
|
+
WALK_FIELDS,
|
|
6262
|
+
WALK_SCHEMES,
|
|
6056
6263
|
WELL_KNOWN_SAMPLES,
|
|
6057
6264
|
assemblyWalk,
|
|
6058
6265
|
axisScaleOf,
|
|
@@ -6075,9 +6282,11 @@ export {
|
|
|
6075
6282
|
drawTubeMapGenes,
|
|
6076
6283
|
drawTubeMapRuler,
|
|
6077
6284
|
drawingBounds,
|
|
6285
|
+
encodingSwatchCss,
|
|
6078
6286
|
engineKey,
|
|
6079
6287
|
engineRequest,
|
|
6080
6288
|
featuresOnBackbone,
|
|
6289
|
+
fieldLegend,
|
|
6081
6290
|
findHoveredEdge,
|
|
6082
6291
|
findHoveredNode,
|
|
6083
6292
|
fitTransform,
|
|
@@ -6111,8 +6320,10 @@ export {
|
|
|
6111
6320
|
referenceSamplesOf,
|
|
6112
6321
|
referenceStripBlocks,
|
|
6113
6322
|
resolveColorScheme,
|
|
6323
|
+
resolveEncoding,
|
|
6114
6324
|
resolveReferenceSample,
|
|
6115
6325
|
rulerBoxes,
|
|
6326
|
+
schemeCss,
|
|
6116
6327
|
screenToLayout,
|
|
6117
6328
|
stripBlockAt,
|
|
6118
6329
|
tubeMapConnectors,
|
|
@@ -6123,6 +6334,7 @@ export {
|
|
|
6123
6334
|
tubeX,
|
|
6124
6335
|
viewportOf,
|
|
6125
6336
|
walkHighlight,
|
|
6337
|
+
walkLift,
|
|
6126
6338
|
walkRows,
|
|
6127
6339
|
walkRowsExtent,
|
|
6128
6340
|
warpX,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -32,7 +32,10 @@ export type { Connector, ReferenceNode } from './tubeMap/connectors.js';
|
|
|
32
32
|
export type { TubeMapColumn, TubeMapDrawing } from './layout/tubeMapLayout.js';
|
|
33
33
|
export { deletionEdges } from './deletionEdges.js';
|
|
34
34
|
export type { DeletionEdge } from './deletionEdges.js';
|
|
35
|
-
export { walkHighlight } from './walkHighlight.js';
|
|
35
|
+
export { walkHighlight, walkLift } from './walkHighlight.js';
|
|
36
|
+
export type { LiftedWalk, WalkLift } from './walkHighlight.js';
|
|
37
|
+
export { WALK_FIELDS, WALK_SCHEMES, encodingSwatchCss, fieldLegend, resolveEncoding, schemeCss, } from './walkEncoding.js';
|
|
38
|
+
export type { WalkEncoding, WalkField, WalkLayer, WalkScheme, } from './walkEncoding.js';
|
|
36
39
|
export { pathColorsLegible, pathLegend } from './pathColors.js';
|
|
37
40
|
export { bubblesFromGraph } from './bubbles/bubblesFromGraph.js';
|
|
38
41
|
export { bubbleHalos } from './bubbles/bubbleHalos.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResolvedColorScheme } from '../colorSchemes.js';
|
|
2
2
|
import type { NodeWidth } from '../nodeWidths.js';
|
|
3
3
|
import type { Graph, GraphNode, NodeSegment } from '../types.js';
|
|
4
|
-
import type {
|
|
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
7
|
export declare const FADED_ALPHA = 0.18;
|
|
@@ -14,7 +14,7 @@ export interface BuildOptions {
|
|
|
14
14
|
connectorThickness: number;
|
|
15
15
|
drawPaths: boolean;
|
|
16
16
|
nodeWidth?: NodeWidth;
|
|
17
|
-
highlight?:
|
|
17
|
+
highlight?: WalkLift;
|
|
18
18
|
axis: AxisScale;
|
|
19
19
|
linearLayout?: boolean;
|
|
20
20
|
viewportBounds?: {
|
|
@@ -30,6 +30,7 @@ export interface BuildOptions {
|
|
|
30
30
|
}
|
|
31
31
|
export declare function hslToRgb(h: number, s: number, l: number): [number, number, number];
|
|
32
32
|
export declare const REFERENCE_RAMP_MAX_HUE = 300;
|
|
33
|
+
export declare const REFERENCE_RAMP_ALT_COLOR: number;
|
|
33
34
|
export declare const REFERENCE_RAMP_ALT_CSS: string;
|
|
34
35
|
export interface ReferenceRamp {
|
|
35
36
|
start: number;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export declare const WALK_FIELDS: readonly [{
|
|
2
|
+
readonly value: "progress";
|
|
3
|
+
readonly label: "Progress along the walk";
|
|
4
|
+
readonly legend: "pale where the walk starts, deep where it ends";
|
|
5
|
+
}, {
|
|
6
|
+
readonly value: "reference";
|
|
7
|
+
readonly label: "Reference position";
|
|
8
|
+
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
|
+
}];
|
|
18
|
+
export type WalkField = (typeof WALK_FIELDS)[number]['value'];
|
|
19
|
+
export declare const WALK_SCHEMES: readonly [{
|
|
20
|
+
readonly value: "rainbow";
|
|
21
|
+
readonly label: "Rainbow";
|
|
22
|
+
}, {
|
|
23
|
+
readonly value: "blues";
|
|
24
|
+
readonly label: "Blues";
|
|
25
|
+
readonly hue: 215;
|
|
26
|
+
}, {
|
|
27
|
+
readonly value: "reds";
|
|
28
|
+
readonly label: "Reds";
|
|
29
|
+
readonly hue: 0;
|
|
30
|
+
}, {
|
|
31
|
+
readonly value: "greens";
|
|
32
|
+
readonly label: "Greens";
|
|
33
|
+
readonly hue: 130;
|
|
34
|
+
}, {
|
|
35
|
+
readonly value: "oranges";
|
|
36
|
+
readonly label: "Oranges";
|
|
37
|
+
readonly hue: 30;
|
|
38
|
+
}, {
|
|
39
|
+
readonly value: "purples";
|
|
40
|
+
readonly label: "Purples";
|
|
41
|
+
readonly hue: 280;
|
|
42
|
+
}, {
|
|
43
|
+
readonly value: "greys";
|
|
44
|
+
readonly label: "Greys";
|
|
45
|
+
}];
|
|
46
|
+
export type WalkScheme = (typeof WALK_SCHEMES)[number]['value'];
|
|
47
|
+
export interface WalkEncoding {
|
|
48
|
+
field: WalkField;
|
|
49
|
+
scheme: WalkScheme;
|
|
50
|
+
}
|
|
51
|
+
export interface WalkLayer {
|
|
52
|
+
walk: string;
|
|
53
|
+
color?: Partial<WalkEncoding>;
|
|
54
|
+
}
|
|
55
|
+
export declare function resolveEncoding(layer: WalkLayer, reference: boolean, picked: number): WalkEncoding;
|
|
56
|
+
export declare function schemeHsl(scheme: WalkScheme, t: number): {
|
|
57
|
+
h: number;
|
|
58
|
+
s: number;
|
|
59
|
+
l: number;
|
|
60
|
+
};
|
|
61
|
+
export declare function schemeCss(scheme: WalkScheme, t: number): string;
|
|
62
|
+
export declare function schemeColor(scheme: WalkScheme, t: number): number;
|
|
63
|
+
export declare const NO_VALUE_COLOR: number;
|
|
64
|
+
export declare const NO_VALUE_CSS: string;
|
|
65
|
+
export declare const STRAND_T: {
|
|
66
|
+
same: number;
|
|
67
|
+
reversed: number;
|
|
68
|
+
};
|
|
69
|
+
export declare function encodingSwatchCss({ field, scheme }: WalkEncoding): string;
|
|
70
|
+
export declare function fieldLegend(field: WalkField): "pale where the walk starts, deep where it ends" | "along the reference left to right, charcoal off it" | "pale where the walk runs as the reference does, deep where reversed" | "pale where the walk passes once, deep four times or more";
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
import type { ReferenceRamp } from './renderer/GeometryBuilder.js';
|
|
1
2
|
import type { Graph } from './types.js';
|
|
3
|
+
import type { WalkEncoding, WalkLayer } from './walkEncoding.js';
|
|
2
4
|
export interface WalkHighlight {
|
|
3
5
|
name: string;
|
|
6
|
+
reference: boolean;
|
|
4
7
|
nodeIds: Set<string>;
|
|
5
8
|
edgeIndexes: Set<number>;
|
|
9
|
+
progress: Map<string, number>;
|
|
6
10
|
steps: number;
|
|
7
11
|
bp: number;
|
|
8
12
|
referenceBp?: number;
|
|
9
13
|
}
|
|
14
|
+
export interface LiftedWalk extends WalkHighlight {
|
|
15
|
+
encoding: WalkEncoding;
|
|
16
|
+
colors: Map<string, number>;
|
|
17
|
+
}
|
|
18
|
+
export interface WalkLift {
|
|
19
|
+
walks: LiftedWalk[];
|
|
20
|
+
nodeIds: Set<string>;
|
|
21
|
+
edgeIndexes: Set<number>;
|
|
22
|
+
names: Set<string>;
|
|
23
|
+
}
|
|
10
24
|
export declare function walkHighlight(graph: Graph, name: string): WalkHighlight | undefined;
|
|
25
|
+
export declare function walkLift(graph: Graph, layers: readonly WalkLayer[], ramp?: ReferenceRamp): WalkLift | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/bandage-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
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": {
|