@jbrowse/bandage-core 10.0.0 → 10.1.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/README.md +23 -0
- package/dist/bubbles/popBubble.js +2 -2
- package/dist/bubbles/superbubbles.js +3 -3
- package/dist/chunks/{chunk-ICXMWYOA.js → chunk-4R6QNG23.js} +5 -5
- package/dist/chunks/{chunk-KJYSOHVN.js → chunk-5BGP5Z64.js} +1 -1
- package/dist/chunks/{chunk-VOWI544A.js → chunk-ALDGONEI.js} +1 -1
- package/dist/chunks/{chunk-3APK25GI.js → chunk-C7MZJSPT.js} +1 -1
- package/dist/chunks/{chunk-RJXPPYA7.js → chunk-CFPER2S2.js} +13 -13
- package/dist/chunks/{chunk-33T67FPZ.js → chunk-CRTD2SBP.js} +1 -1
- package/dist/chunks/{chunk-IM4SJUPO.js → chunk-DK5P2YOL.js} +2 -2
- package/dist/chunks/{chunk-VK6XMP6B.js → chunk-FLUQODT2.js} +1 -3
- package/dist/chunks/{chunk-BEWLQADP.js → chunk-FNGIQF43.js} +1 -1
- package/dist/chunks/{chunk-OEPCRURR.js → chunk-GNTTI6LA.js} +1 -1
- package/dist/chunks/{chunk-EU6FBTQF.js → chunk-IUDJKOLB.js} +4 -4
- package/dist/chunks/{chunk-QXAB2FLJ.js → chunk-IW6CYVX2.js} +1 -1
- package/dist/chunks/{chunk-OOLNLCIO.js → chunk-L5WF4ZPS.js} +1 -1
- package/dist/chunks/{chunk-EMUUNWRU.js → chunk-M6LK4GII.js} +7 -1
- package/dist/chunks/{chunk-E5UEYZWK.js → chunk-MVFDSFV2.js} +1 -1
- package/dist/chunks/{chunk-CDPYXHVR.js → chunk-MZIOBJZB.js} +1 -1
- package/dist/chunks/{chunk-FG762CCP.js → chunk-PKFMP65V.js} +2 -2
- package/dist/chunks/{chunk-QIVPRZ4H.js → chunk-R456ME6J.js} +2 -2
- package/dist/chunks/chunk-RIPAA7OK.js +284 -0
- package/dist/chunks/{chunk-WI7ZHJ27.js → chunk-RPDXZLCG.js} +2 -2
- package/dist/chunks/{chunk-NP356MC2.js → chunk-SBMJNRTV.js} +1 -1
- package/dist/chunks/{chunk-4QTNXTGW.js → chunk-T6V4KI2L.js} +1 -1
- package/dist/chunks/{chunk-REE4GUDM.js → chunk-TWRLC3KK.js} +1 -1
- package/dist/chunks/{chunk-Q6IOQP4J.js → chunk-VIERZJO2.js} +8 -8
- package/dist/chunks/{chunk-JVLURPFW.js → chunk-VPE4AYP7.js} +1 -2
- package/dist/chunks/{chunk-W4GZCVUK.js → chunk-XTCNEKO5.js} +7 -7
- package/dist/chunks/{chunk-VZNKA3K2.js → chunk-XYP6WL2N.js} +7 -3
- package/dist/chunks/{chunk-B4645SM2.js → chunk-YPYWYPHX.js} +3 -3
- package/dist/chunks/{chunk-DCJC32QW.js → chunk-ZIUKZUPJ.js} +1 -1
- package/dist/cli/figure.js +22 -24
- package/dist/cli/fold.js +5 -5
- package/dist/figure.js +16 -16
- package/dist/figureData.js +17 -19
- package/dist/figureSettings.js +5 -5
- package/dist/foldVariants.js +1 -1
- package/dist/gfa/gfaConverter.js +2 -2
- package/dist/index.js +50 -51
- package/dist/layout/deletionRoutes.js +1 -3
- package/dist/layout/forceCache.js +5 -5
- package/dist/layout/trimToWindow.js +1 -1
- package/dist/layout/tubeMapLayout.js +3 -3
- package/dist/layout/walkRowDraw.js +5 -5
- package/dist/layout/walkRowLayout.js +3 -3
- package/dist/layout/walkRows.js +2 -2
- package/dist/layout/walkStrip.js +6 -6
- package/dist/layoutEngines.js +1 -5
- package/dist/layoutModes.js +7 -7
- package/dist/pathAnchoring.js +1 -1
- package/dist/pathColors.js +2 -2
- package/dist/pipeline.js +4 -4
- package/dist/referenceRampCss.js +4 -4
- package/dist/referenceStrip.js +4 -4
- package/dist/renderer/GeometryBuilder.js +3 -3
- package/dist/tubeMap/bundle.js +4 -4
- package/dist/tubeMap/coarsen.js +3 -3
- package/dist/tubeMap/draw.js +3 -3
- package/dist/tubeMap/nodeColors.js +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/layout/deletionRoutes.d.ts +0 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/viewport.js +5 -5
- package/dist/walkEncoding.js +4 -4
- package/dist/walkHighlight.js +5 -5
- package/package.json +2 -1
- package/dist/chunks/chunk-KAN2WTG5.js +0 -226
- package/dist/chunks/chunk-LYJ4US66.js +0 -664
- package/dist/chunks/chunk-Q6FRNVDU.js +0 -531
- package/dist/layout/stressEngine.js +0 -11
- package/dist/layout/stressPlacement.js +0 -7
- package/dist/types/layout/stressEngine.d.ts +0 -27
- package/dist/types/layout/stressPlacement.d.ts +0 -5
package/dist/viewport.js
CHANGED
|
@@ -5,17 +5,17 @@ import {
|
|
|
5
5
|
screenToLayout,
|
|
6
6
|
viewportOf,
|
|
7
7
|
zoomAbout
|
|
8
|
-
} from "./chunks/chunk-
|
|
9
|
-
import "./chunks/chunk-
|
|
8
|
+
} from "./chunks/chunk-L5WF4ZPS.js";
|
|
9
|
+
import "./chunks/chunk-XTCNEKO5.js";
|
|
10
10
|
import "./chunks/chunk-IGVV37VI.js";
|
|
11
11
|
import "./chunks/chunk-OPPVSPEF.js";
|
|
12
|
+
import "./chunks/chunk-VPE4AYP7.js";
|
|
12
13
|
import "./chunks/chunk-PUG7LXDF.js";
|
|
13
|
-
import "./chunks/chunk-
|
|
14
|
+
import "./chunks/chunk-IW6CYVX2.js";
|
|
14
15
|
import "./chunks/chunk-QYBZZI5H.js";
|
|
15
16
|
import "./chunks/chunk-PSMKPSO4.js";
|
|
16
17
|
import "./chunks/chunk-CDLPYR5O.js";
|
|
17
|
-
import "./chunks/chunk-
|
|
18
|
-
import "./chunks/chunk-EMUUNWRU.js";
|
|
18
|
+
import "./chunks/chunk-M6LK4GII.js";
|
|
19
19
|
import "./chunks/chunk-RAEABQNW.js";
|
|
20
20
|
import "./chunks/chunk-ES2N6V56.js";
|
|
21
21
|
import "./chunks/chunk-G45YY72K.js";
|
package/dist/walkEncoding.js
CHANGED
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
schemeColor,
|
|
10
10
|
schemeCss,
|
|
11
11
|
schemeRgb
|
|
12
|
-
} from "./chunks/chunk-
|
|
13
|
-
import "./chunks/chunk-
|
|
12
|
+
} from "./chunks/chunk-ALDGONEI.js";
|
|
13
|
+
import "./chunks/chunk-SBMJNRTV.js";
|
|
14
14
|
import "./chunks/chunk-G2FD7S3C.js";
|
|
15
15
|
import "./chunks/chunk-WFB5TXRA.js";
|
|
16
|
-
import "./chunks/chunk-
|
|
16
|
+
import "./chunks/chunk-TWRLC3KK.js";
|
|
17
17
|
import "./chunks/chunk-PBENCR5L.js";
|
|
18
|
-
import "./chunks/chunk-
|
|
18
|
+
import "./chunks/chunk-M6LK4GII.js";
|
|
19
19
|
import "./chunks/chunk-RAEABQNW.js";
|
|
20
20
|
import "./chunks/chunk-ES2N6V56.js";
|
|
21
21
|
import "./chunks/chunk-BPLIXMH7.js";
|
package/dist/walkHighlight.js
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
facetLifts,
|
|
3
3
|
walkHighlight,
|
|
4
4
|
walkLift
|
|
5
|
-
} from "./chunks/chunk-
|
|
6
|
-
import "./chunks/chunk-
|
|
7
|
-
import "./chunks/chunk-
|
|
5
|
+
} from "./chunks/chunk-R456ME6J.js";
|
|
6
|
+
import "./chunks/chunk-ALDGONEI.js";
|
|
7
|
+
import "./chunks/chunk-SBMJNRTV.js";
|
|
8
8
|
import "./chunks/chunk-G2FD7S3C.js";
|
|
9
9
|
import "./chunks/chunk-WFB5TXRA.js";
|
|
10
|
-
import "./chunks/chunk-
|
|
10
|
+
import "./chunks/chunk-TWRLC3KK.js";
|
|
11
11
|
import "./chunks/chunk-PBENCR5L.js";
|
|
12
|
-
import "./chunks/chunk-
|
|
12
|
+
import "./chunks/chunk-M6LK4GII.js";
|
|
13
13
|
import "./chunks/chunk-RAEABQNW.js";
|
|
14
14
|
import "./chunks/chunk-ES2N6V56.js";
|
|
15
15
|
import "./chunks/chunk-BPLIXMH7.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/bandage-core",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.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": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@gmod/gbz-base": "^7.0.0",
|
|
39
39
|
"@gmod/tabix": "^3.9.1",
|
|
40
|
+
"@jbrowse/graph-stress-layout": "^0.1.1",
|
|
40
41
|
"@jbrowse/tubemap-core": "^0.2.4"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
pathOrigin
|
|
3
|
-
} from "./chunk-EMUUNWRU.js";
|
|
4
|
-
import {
|
|
5
|
-
panSNContig,
|
|
6
|
-
panSNSample
|
|
7
|
-
} from "./chunk-BPLIXMH7.js";
|
|
8
|
-
|
|
9
|
-
// src/layout/walkRows.ts
|
|
10
|
-
function sampleOf(path) {
|
|
11
|
-
return path.sample ?? panSNSample(path.name);
|
|
12
|
-
}
|
|
13
|
-
function labelOf(path) {
|
|
14
|
-
return path.haplotype !== void 0 && path.sample !== void 0 ? `${path.sample}#${path.haplotype}` : sampleOf(path);
|
|
15
|
-
}
|
|
16
|
-
function stepsOf(pieces, lengthOf) {
|
|
17
|
-
const steps = [];
|
|
18
|
-
let end;
|
|
19
|
-
for (const piece of pieces) {
|
|
20
|
-
if (end !== void 0 && piece.start !== void 0 && piece.start > end) {
|
|
21
|
-
steps.push(piece.start - end);
|
|
22
|
-
}
|
|
23
|
-
steps.push(...piece.nodeIds);
|
|
24
|
-
const bp = piece.nodeIds.reduce(
|
|
25
|
-
(sum, id) => sum + (lengthOf.get(id) ?? 0),
|
|
26
|
-
0
|
|
27
|
-
);
|
|
28
|
-
end = piece.start === void 0 ? void 0 : piece.start + bp;
|
|
29
|
-
}
|
|
30
|
-
return steps;
|
|
31
|
-
}
|
|
32
|
-
function stepSpans(pieces, lengthOf) {
|
|
33
|
-
const spans = [];
|
|
34
|
-
let end;
|
|
35
|
-
for (const piece of pieces) {
|
|
36
|
-
if (piece.start === void 0 || end !== void 0 && piece.start < end) {
|
|
37
|
-
return void 0;
|
|
38
|
-
}
|
|
39
|
-
if (end !== void 0 && piece.start > end) {
|
|
40
|
-
spans.push({ start: end, end: piece.start });
|
|
41
|
-
}
|
|
42
|
-
let pos = piece.start;
|
|
43
|
-
for (const id of piece.nodeIds) {
|
|
44
|
-
const len = lengthOf.get(id) ?? 0;
|
|
45
|
-
spans.push({ start: pos, end: pos + len });
|
|
46
|
-
pos += len;
|
|
47
|
-
}
|
|
48
|
-
end = pos;
|
|
49
|
-
}
|
|
50
|
-
return spans;
|
|
51
|
-
}
|
|
52
|
-
function sliceBetween(steps, span, region, flanked = true) {
|
|
53
|
-
if (!region || !flanked) {
|
|
54
|
-
return { ids: steps, complete: true, from: -1, to: -1 };
|
|
55
|
-
}
|
|
56
|
-
const spanAt = (i) => {
|
|
57
|
-
const id = steps[i];
|
|
58
|
-
return typeof id === "string" ? span.get(id) : void 0;
|
|
59
|
-
};
|
|
60
|
-
let i0 = -1;
|
|
61
|
-
let i1 = -1;
|
|
62
|
-
let bestEnd = -Infinity;
|
|
63
|
-
let bestStart = Infinity;
|
|
64
|
-
steps.forEach((_, i) => {
|
|
65
|
-
const s = spanAt(i);
|
|
66
|
-
if (s) {
|
|
67
|
-
if (s.end <= region.start && s.end > bestEnd) {
|
|
68
|
-
bestEnd = s.end;
|
|
69
|
-
i0 = i;
|
|
70
|
-
}
|
|
71
|
-
if (s.start >= region.end && s.start < bestStart) {
|
|
72
|
-
bestStart = s.start;
|
|
73
|
-
i1 = i;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
if (i0 >= 0 && i1 >= 0) {
|
|
78
|
-
const ids2 = steps.slice(Math.min(i0, i1) + 1, Math.max(i0, i1));
|
|
79
|
-
return {
|
|
80
|
-
ids: i0 < i1 ? ids2 : ids2.reverse(),
|
|
81
|
-
complete: true,
|
|
82
|
-
from: i0,
|
|
83
|
-
to: i1
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
const flank = i0 >= 0 ? i0 : i1;
|
|
87
|
-
let near = -1;
|
|
88
|
-
for (let d = 1; flank >= 0 && near < 0 && d < steps.length; d++) {
|
|
89
|
-
near = [flank - d, flank + d].find((j) => spanAt(j) !== void 0) ?? -1;
|
|
90
|
-
}
|
|
91
|
-
if (near < 0) {
|
|
92
|
-
return { ids: steps, complete: false, from: -1, to: -1 };
|
|
93
|
-
}
|
|
94
|
-
const forward = near > flank === spanAt(near).start > spanAt(flank).start;
|
|
95
|
-
const after = forward === (flank === i0);
|
|
96
|
-
const ids = after ? steps.slice(flank + 1) : steps.slice(0, flank).reverse();
|
|
97
|
-
const last = ids.length > 0 ? ids.length - 1 : -1;
|
|
98
|
-
const end = last < 0 ? spanAt(flank) : spanAt(after ? flank + 1 + last : 0);
|
|
99
|
-
const stop = {
|
|
100
|
-
contigEnds: end !== void 0,
|
|
101
|
-
shortBp: !end ? 0 : Math.max(0, region.start - end.end, end.start - region.end)
|
|
102
|
-
};
|
|
103
|
-
return {
|
|
104
|
-
ids,
|
|
105
|
-
complete: false,
|
|
106
|
-
from: flank,
|
|
107
|
-
to: after ? steps.length : -1,
|
|
108
|
-
stop
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function filterSamples(rows, samples) {
|
|
112
|
-
return samples ? rows.filter((r) => samples.includes(r.sample)).sort(
|
|
113
|
-
(a, b) => samples.indexOf(a.sample) - samples.indexOf(b.sample) || a.label.localeCompare(b.label)
|
|
114
|
-
) : rows;
|
|
115
|
-
}
|
|
116
|
-
function walkRows(graph, region, unit) {
|
|
117
|
-
const paths = graph.paths ?? [];
|
|
118
|
-
const isReference = (p) => pathOrigin(p.name).name === graph.referencePath;
|
|
119
|
-
const referencePieces = paths.some(isReference) ? paths.filter(isReference).sort((a, b) => (a.start ?? 0) - (b.start ?? 0)) : paths.slice(0, 1);
|
|
120
|
-
const first = referencePieces[0];
|
|
121
|
-
const others = paths.filter((p) => !referencePieces.includes(p));
|
|
122
|
-
if (!first || others.length === 0) {
|
|
123
|
-
return void 0;
|
|
124
|
-
}
|
|
125
|
-
const walks = /* @__PURE__ */ new Map();
|
|
126
|
-
for (const path of others) {
|
|
127
|
-
walks.set(path.name, [...walks.get(path.name) ?? [], path]);
|
|
128
|
-
}
|
|
129
|
-
const lengthOf = new Map(graph.nodes.map((n) => [n.id, n.length]));
|
|
130
|
-
const referenceStart = first.start ?? 0;
|
|
131
|
-
const cut = region && region.end > region.start ? region : void 0;
|
|
132
|
-
const span = /* @__PURE__ */ new Map();
|
|
133
|
-
for (const piece of referencePieces) {
|
|
134
|
-
let pos = piece.start ?? 0;
|
|
135
|
-
for (const id of piece.nodeIds) {
|
|
136
|
-
const len = lengthOf.get(id) ?? 0;
|
|
137
|
-
if (!span.has(id)) {
|
|
138
|
-
span.set(id, { start: pos, end: pos + len });
|
|
139
|
-
}
|
|
140
|
-
pos += len;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
const flanked = cut === void 0 || [...span.values()].some((s) => s.end <= cut.start) && [...span.values()].some((s) => s.start >= cut.end);
|
|
144
|
-
const rowOf = (pieces) => {
|
|
145
|
-
const path = pieces[0];
|
|
146
|
-
const ordered = [...pieces].sort((a, b) => (a.start ?? 0) - (b.start ?? 0));
|
|
147
|
-
const { ids, complete, from, to, stop } = sliceBetween(
|
|
148
|
-
stepsOf(ordered, lengthOf),
|
|
149
|
-
span,
|
|
150
|
-
cut,
|
|
151
|
-
flanked
|
|
152
|
-
);
|
|
153
|
-
const spans = stepSpans(ordered, lengthOf);
|
|
154
|
-
const contig = path.contig ?? panSNContig(pathOrigin(path.name).name);
|
|
155
|
-
const axis = !spans?.length ? void 0 : from < 0 ? { contig, start: spans[0].start, reversed: false } : from < to ? { contig, start: spans[from].end, reversed: false } : { contig, start: spans[from].start, reversed: true };
|
|
156
|
-
const runs = [];
|
|
157
|
-
let bp = 0;
|
|
158
|
-
let offReferenceBp = 0;
|
|
159
|
-
let gapBp = 0;
|
|
160
|
-
let step = 0;
|
|
161
|
-
for (const id of ids) {
|
|
162
|
-
if (typeof id === "number") {
|
|
163
|
-
runs.push({ start: bp, bp: id, onReference: false, gap: true });
|
|
164
|
-
bp += id;
|
|
165
|
-
gapBp += id;
|
|
166
|
-
step = 0;
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
const len = lengthOf.get(id) ?? 0;
|
|
170
|
-
const s = span.get(id);
|
|
171
|
-
const last = runs.at(-1);
|
|
172
|
-
const at = last?.referenceStart;
|
|
173
|
-
const forward = s && at !== void 0 && step >= 0 && at + last.bp === s.start;
|
|
174
|
-
const backward = s && at !== void 0 && step <= 0 && s.end === at;
|
|
175
|
-
if (!s && last && !last.onReference && !last.gap) {
|
|
176
|
-
last.bp += len;
|
|
177
|
-
} else if (forward || backward) {
|
|
178
|
-
last.bp += len;
|
|
179
|
-
if (!forward) {
|
|
180
|
-
last.referenceStart = s.start;
|
|
181
|
-
last.reversed = true;
|
|
182
|
-
}
|
|
183
|
-
step = forward ? 1 : -1;
|
|
184
|
-
} else {
|
|
185
|
-
runs.push({
|
|
186
|
-
start: bp,
|
|
187
|
-
bp: len,
|
|
188
|
-
onReference: s !== void 0,
|
|
189
|
-
referenceStart: s?.start
|
|
190
|
-
});
|
|
191
|
-
step = 0;
|
|
192
|
-
}
|
|
193
|
-
bp += len;
|
|
194
|
-
if (!s) {
|
|
195
|
-
offReferenceBp += len;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
name: path.name,
|
|
200
|
-
label: labelOf(path),
|
|
201
|
-
sample: sampleOf(path),
|
|
202
|
-
haplotype: path.haplotype,
|
|
203
|
-
bp,
|
|
204
|
-
offReferenceBp,
|
|
205
|
-
gapBp,
|
|
206
|
-
complete,
|
|
207
|
-
stop,
|
|
208
|
-
runs,
|
|
209
|
-
axis
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
const origin = cut ? cut.start : referenceStart;
|
|
213
|
-
return {
|
|
214
|
-
origin,
|
|
215
|
-
unit,
|
|
216
|
-
reference: rowOf(referencePieces),
|
|
217
|
-
rows: [...walks.values()].map(rowOf).sort(
|
|
218
|
-
(a, b) => Number(b.complete) - Number(a.complete) || b.bp - a.bp || a.label.localeCompare(b.label)
|
|
219
|
-
)
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export {
|
|
224
|
-
filterSamples,
|
|
225
|
-
walkRows
|
|
226
|
-
};
|