@jbrowse/bandage-core 9.10.0 → 10.0.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/bubbles/popBubble.js +3 -2
- package/dist/bubbles/superbubbles.js +4 -3
- package/dist/chunks/{chunk-Q6UIUY6X.js → chunk-33T67FPZ.js} +1 -1
- package/dist/chunks/{chunk-TOVOJNT7.js → chunk-3APK25GI.js} +1 -1
- package/dist/chunks/{chunk-A6PSWTLX.js → chunk-4QTNXTGW.js} +1 -1
- package/dist/chunks/{chunk-5GZEPPEW.js → chunk-BEWLQADP.js} +1 -1
- package/dist/chunks/{chunk-2VTM3DHG.js → chunk-CDPYXHVR.js} +1 -1
- package/dist/chunks/{chunk-K5NYTPLC.js → chunk-DCJC32QW.js} +1 -1
- package/dist/chunks/{chunk-IZI7KIVX.js → chunk-E5UEYZWK.js} +1 -1
- package/dist/chunks/{chunk-IGJCTPFB.js → chunk-EMUUNWRU.js} +52 -43
- package/dist/chunks/{chunk-PIN7ZMTZ.js → chunk-EU6FBTQF.js} +4 -4
- package/dist/chunks/{chunk-LZWSZRUY.js → chunk-FG762CCP.js} +3 -8
- package/dist/chunks/{chunk-73RSLGZT.js → chunk-FLFBYSJO.js} +1 -1
- package/dist/chunks/{chunk-FUUJ76KD.js → chunk-ICXMWYOA.js} +5 -5
- package/dist/chunks/{chunk-CXKZYLYS.js → chunk-IM4SJUPO.js} +12 -22
- package/dist/chunks/{chunk-6PYZYBBF.js → chunk-KAN2WTG5.js} +1 -1
- package/dist/chunks/{chunk-BDWQQK33.js → chunk-KJYSOHVN.js} +1 -1
- package/dist/chunks/{chunk-4IYP43W6.js → chunk-NP356MC2.js} +1 -1
- package/dist/chunks/{chunk-TFAFIRZB.js → chunk-OEPCRURR.js} +1 -1
- package/dist/chunks/{chunk-PT37VS5B.js → chunk-OOLNLCIO.js} +1 -1
- package/dist/chunks/{chunk-OA7RIMZ2.js → chunk-PSMKPSO4.js} +89 -22
- package/dist/chunks/{chunk-NGODVSCA.js → chunk-Q6IOQP4J.js} +8 -8
- package/dist/chunks/{chunk-LTUWJKHD.js → chunk-Q7LYHGGQ.js} +114 -6
- package/dist/chunks/{chunk-MVMP6AGI.js → chunk-QIVPRZ4H.js} +12 -7
- package/dist/chunks/{chunk-J7YKQ5YW.js → chunk-QXAB2FLJ.js} +1 -1
- package/dist/chunks/chunk-RAEABQNW.js +227 -0
- package/dist/chunks/{chunk-XZ2BLAA6.js → chunk-REE4GUDM.js} +1 -1
- package/dist/chunks/{chunk-2FLBFVMO.js → chunk-RJXPPYA7.js} +13 -13
- package/dist/chunks/{chunk-KYY5363X.js → chunk-VOWI544A.js} +1 -1
- package/dist/chunks/{chunk-FJZ2TB46.js → chunk-VZNKA3K2.js} +2 -2
- package/dist/chunks/{chunk-HRAU4VTB.js → chunk-W4GZCVUK.js} +6 -6
- package/dist/chunks/{chunk-DMH4NL2M.js → chunk-WI7ZHJ27.js} +2 -2
- package/dist/cli/figure.js +24 -23
- package/dist/cli/fold.js +6 -5
- package/dist/figure.js +19 -18
- package/dist/figureData.js +20 -19
- package/dist/figureSettings.js +7 -6
- package/dist/gbzCut.js +3 -2
- package/dist/gbzWindow.js +6 -1
- package/dist/gfa/gfaConverter.js +3 -2
- package/dist/gfa/graphTables.js +2 -1
- package/dist/index.js +57 -47
- package/dist/layout/forceCache.js +7 -6
- package/dist/layout/trimToWindow.js +17 -23
- package/dist/layout/tubeMapLayout.js +4 -3
- package/dist/layout/walkRowDraw.js +6 -5
- package/dist/layout/walkRowLayout.js +4 -3
- package/dist/layout/walkRows.js +3 -2
- package/dist/layout/walkStrip.js +7 -6
- package/dist/layoutModes.js +8 -7
- package/dist/pathAnchoring.js +2 -1
- package/dist/pathColors.js +3 -2
- package/dist/pathVisits.js +8 -0
- package/dist/pipeline.js +6 -5
- package/dist/referenceRampCss.js +5 -4
- package/dist/referenceStrip.js +5 -4
- package/dist/renderer/GeometryBuilder.js +4 -3
- package/dist/tubeMap/bundle.js +5 -4
- package/dist/tubeMap/coarsen.js +15 -13
- package/dist/tubeMap/draw.js +4 -3
- package/dist/tubeMap/nodeColors.js +5 -4
- package/dist/types/gbzWindow.d.ts +15 -1
- package/dist/types/gfa/gfaConverter.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/layout/deletionRoutes.d.ts +1 -1
- package/dist/types/pathAnchoring.d.ts +3 -2
- package/dist/types/pathVisits.d.ts +64 -0
- package/dist/types/types.d.ts +2 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/viewport.js +7 -6
- package/dist/walkEncoding.js +5 -4
- package/dist/walkHighlight.js +6 -5
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bubbleSubgraph
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-4QTNXTGW.js";
|
|
4
|
+
import "../chunks/chunk-EMUUNWRU.js";
|
|
5
|
+
import "../chunks/chunk-RAEABQNW.js";
|
|
5
6
|
import "../chunks/chunk-BPLIXMH7.js";
|
|
6
7
|
import "../chunks/chunk-FYQWPEEY.js";
|
|
7
8
|
export {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
graphBubbles,
|
|
3
3
|
superbubblesFromGraph
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-BEWLQADP.js";
|
|
5
5
|
import "../chunks/chunk-CLOP7UVD.js";
|
|
6
|
-
import "../chunks/chunk-
|
|
6
|
+
import "../chunks/chunk-4QTNXTGW.js";
|
|
7
7
|
import "../chunks/chunk-EHUBJDDB.js";
|
|
8
8
|
import "../chunks/chunk-XKWD2RY3.js";
|
|
9
9
|
import "../chunks/chunk-FX4RDMDN.js";
|
|
10
10
|
import "../chunks/chunk-HNQPEMYE.js";
|
|
11
|
-
import "../chunks/chunk-
|
|
11
|
+
import "../chunks/chunk-EMUUNWRU.js";
|
|
12
|
+
import "../chunks/chunk-RAEABQNW.js";
|
|
12
13
|
import "../chunks/chunk-BPLIXMH7.js";
|
|
13
14
|
import "../chunks/chunk-2CVHXFK7.js";
|
|
14
15
|
import "../chunks/chunk-CPMHA4W5.js";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PathVisitsBuilder
|
|
3
|
+
} from "./chunk-RAEABQNW.js";
|
|
1
4
|
import {
|
|
2
5
|
panSNSample
|
|
3
6
|
} from "./chunk-BPLIXMH7.js";
|
|
@@ -13,23 +16,13 @@ function pathOrigin(pathName) {
|
|
|
13
16
|
}
|
|
14
17
|
function surveyPaths(paths, lengthOf) {
|
|
15
18
|
const anchorPaths = [];
|
|
16
|
-
const
|
|
19
|
+
const visits = new PathVisitsBuilder();
|
|
17
20
|
for (const path of paths) {
|
|
18
21
|
const sample = panSNSample(path.name);
|
|
22
|
+
const p = visits.pathOf(path.name, sample);
|
|
19
23
|
let pos = path.start;
|
|
20
24
|
for (const step of path.steps) {
|
|
21
|
-
|
|
22
|
-
path: path.name,
|
|
23
|
-
sample,
|
|
24
|
-
start: pos,
|
|
25
|
-
strand: step.strand
|
|
26
|
-
};
|
|
27
|
-
const existing = pathVisits.get(step.id);
|
|
28
|
-
if (existing) {
|
|
29
|
-
existing.push(visit);
|
|
30
|
-
} else {
|
|
31
|
-
pathVisits.set(step.id, [visit]);
|
|
32
|
-
}
|
|
25
|
+
visits.addAt(visits.declare(step.id), p, pos, step.strand === "-");
|
|
33
26
|
pos += lengthOf(step.id);
|
|
34
27
|
}
|
|
35
28
|
anchorPaths.push({
|
|
@@ -39,7 +32,7 @@ function surveyPaths(paths, lengthOf) {
|
|
|
39
32
|
length: pos - path.start
|
|
40
33
|
});
|
|
41
34
|
}
|
|
42
|
-
return { anchorPaths, pathVisits };
|
|
35
|
+
return { anchorPaths, pathVisits: visits.build() };
|
|
43
36
|
}
|
|
44
37
|
function chooseReferencePath(anchorPaths, preferred) {
|
|
45
38
|
const named = anchorPaths.find(
|
|
@@ -49,41 +42,56 @@ function chooseReferencePath(anchorPaths, preferred) {
|
|
|
49
42
|
}
|
|
50
43
|
var OFF_REFERENCE_RANK = 1;
|
|
51
44
|
function anchorNode(node, visits, reference, samplesOf) {
|
|
52
|
-
|
|
53
|
-
if (visits
|
|
54
|
-
|
|
55
|
-
anchored = {
|
|
56
|
-
...node,
|
|
57
|
-
stable: {
|
|
58
|
-
refName: anchor.path,
|
|
59
|
-
start: anchor.start,
|
|
60
|
-
rank: anchor.path === reference ? REFERENCE_RANK : OFF_REFERENCE_RANK,
|
|
61
|
-
strand: anchor.strand
|
|
62
|
-
},
|
|
63
|
-
samples: samplesOf(visits)
|
|
64
|
-
};
|
|
45
|
+
const slot = visits.slot(node.name);
|
|
46
|
+
if (slot < 0 || visits.offsets[slot] === visits.offsets[slot + 1]) {
|
|
47
|
+
return node;
|
|
65
48
|
}
|
|
66
|
-
|
|
49
|
+
const own = visits.firstBy(slot, reference);
|
|
50
|
+
const anchor = own >= 0 ? own : visits.offsets[slot];
|
|
51
|
+
return {
|
|
52
|
+
...node,
|
|
53
|
+
stable: {
|
|
54
|
+
refName: visits.paths[visits.path[anchor]],
|
|
55
|
+
start: visits.start[anchor],
|
|
56
|
+
rank: own >= 0 ? REFERENCE_RANK : OFF_REFERENCE_RANK,
|
|
57
|
+
strand: visits.strand(anchor)
|
|
58
|
+
},
|
|
59
|
+
samples: samplesOf(slot)
|
|
60
|
+
};
|
|
67
61
|
}
|
|
68
|
-
function sampleSorter(
|
|
69
|
-
const sorted = [...new Set(
|
|
62
|
+
function sampleSorter(visits) {
|
|
63
|
+
const sorted = [...new Set(visits.samples)].sort();
|
|
70
64
|
const rank = new Map(sorted.map((sample, i) => [sample, i]));
|
|
65
|
+
const pathRank = Int32Array.from(visits.samples, (s) => rank.get(s));
|
|
71
66
|
const seen = new Uint8Array(sorted.length);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
ranks.forEach((r2) => seen[r2] = 0);
|
|
78
|
-
return [...new Set(visits.map((v) => v.sample))].sort();
|
|
79
|
-
}
|
|
67
|
+
const ranks = new Int32Array(sorted.length);
|
|
68
|
+
return (slot) => {
|
|
69
|
+
let n = 0;
|
|
70
|
+
for (let i = visits.offsets[slot]; i < visits.offsets[slot + 1]; i++) {
|
|
71
|
+
const r = pathRank[visits.path[i]];
|
|
80
72
|
if (seen[r] === 0) {
|
|
81
73
|
seen[r] = 1;
|
|
82
|
-
ranks
|
|
74
|
+
ranks[n++] = r;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
let out;
|
|
78
|
+
if (n === sorted.length) {
|
|
79
|
+
out = sorted;
|
|
80
|
+
seen.fill(0);
|
|
81
|
+
} else if (n * 8 < sorted.length) {
|
|
82
|
+
const found = ranks.subarray(0, n);
|
|
83
|
+
found.forEach((r) => seen[r] = 0);
|
|
84
|
+
out = Array.from(found.sort(), (r) => sorted[r]);
|
|
85
|
+
} else {
|
|
86
|
+
out = [];
|
|
87
|
+
for (let r = 0; r < sorted.length; r++) {
|
|
88
|
+
if (seen[r] === 1) {
|
|
89
|
+
seen[r] = 0;
|
|
90
|
+
out.push(sorted[r]);
|
|
91
|
+
}
|
|
83
92
|
}
|
|
84
93
|
}
|
|
85
|
-
|
|
86
|
-
return Array.from(Int32Array.from(ranks).sort(), (r) => sorted[r]);
|
|
94
|
+
return out;
|
|
87
95
|
};
|
|
88
96
|
}
|
|
89
97
|
function anchorFromPaths(graph, preferred) {
|
|
@@ -92,11 +100,12 @@ function anchorFromPaths(graph, preferred) {
|
|
|
92
100
|
if (!reference || !anchorPaths || !pathVisits) {
|
|
93
101
|
return graph;
|
|
94
102
|
}
|
|
95
|
-
const samplesOf = sampleSorter(
|
|
103
|
+
const samplesOf = sampleSorter(pathVisits);
|
|
104
|
+
const referenceIndex = pathVisits.pathIndex(reference.name);
|
|
96
105
|
return {
|
|
97
106
|
...graph,
|
|
98
107
|
nodes: graph.nodes.map(
|
|
99
|
-
(node) => anchorNode(node, pathVisits
|
|
108
|
+
(node) => anchorNode(node, pathVisits, referenceIndex, samplesOf)
|
|
100
109
|
),
|
|
101
110
|
anchoredBy: "paths",
|
|
102
111
|
referencePath: reference.name
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
tubeMapMismatches
|
|
3
|
-
} from "./chunk-XXT2JCAC.js";
|
|
4
1
|
import {
|
|
5
2
|
MAX_GAP_PX
|
|
6
3
|
} from "./chunk-HK5Y2YWV.js";
|
|
4
|
+
import {
|
|
5
|
+
tubeMapMismatches
|
|
6
|
+
} from "./chunk-XXT2JCAC.js";
|
|
7
7
|
import {
|
|
8
8
|
readColor
|
|
9
9
|
} from "./chunk-CWFNEKST.js";
|
|
10
10
|
import {
|
|
11
11
|
pathOrigin
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EMUUNWRU.js";
|
|
13
13
|
|
|
14
14
|
// src/tubeMap/draw.ts
|
|
15
15
|
import { curvePaths, nodeOutlinePath } from "@jbrowse/tubemap-core";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pathSteps
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IM4SJUPO.js";
|
|
4
4
|
import {
|
|
5
5
|
pathOrigin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EMUUNWRU.js";
|
|
7
7
|
|
|
8
8
|
// src/tubeMap/bundle.ts
|
|
9
9
|
function bundleRoutes(graph, groupOf = () => "", merge = true) {
|
|
@@ -67,12 +67,7 @@ function bundleRoutes(graph, groupOf = () => "", merge = true) {
|
|
|
67
67
|
...graph,
|
|
68
68
|
paths: kept,
|
|
69
69
|
anchorPaths: graph.anchorPaths?.filter((p) => keptWalks.has(p.name)),
|
|
70
|
-
pathVisits: graph.pathVisits
|
|
71
|
-
[...graph.pathVisits].map(([segment, visits]) => [
|
|
72
|
-
segment,
|
|
73
|
-
visits.filter((v) => keptWalks.has(v.path))
|
|
74
|
-
])
|
|
75
|
-
) : void 0
|
|
70
|
+
pathVisits: graph.pathVisits?.filter((path) => keptWalks.has(path))
|
|
76
71
|
};
|
|
77
72
|
}
|
|
78
73
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sampleRowLayout
|
|
3
|
-
} from "./chunk-LOEA5IHZ.js";
|
|
4
1
|
import {
|
|
5
2
|
hasTubeMapBackbone,
|
|
6
3
|
hasTubeMapPaths,
|
|
7
4
|
tubeMapLayout,
|
|
8
5
|
tubeMapReferenceLayout
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IM4SJUPO.js";
|
|
7
|
+
import {
|
|
8
|
+
sampleRowLayout
|
|
9
|
+
} from "./chunk-LOEA5IHZ.js";
|
|
10
10
|
import {
|
|
11
11
|
anchoredLayout
|
|
12
12
|
} from "./chunk-L3O7AWLI.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-HNQPEMYE.js";
|
|
16
16
|
import {
|
|
17
17
|
walkRowLayout
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3APK25GI.js";
|
|
19
19
|
import {
|
|
20
20
|
isBackbone,
|
|
21
21
|
isOffReference
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
pathCssColor,
|
|
8
8
|
pathGreyCssColor
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-REE4GUDM.js";
|
|
10
10
|
import {
|
|
11
11
|
pathOrigin
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EMUUNWRU.js";
|
|
13
13
|
import {
|
|
14
14
|
ownStrand,
|
|
15
15
|
strandSides
|
|
@@ -22,30 +22,19 @@ import {
|
|
|
22
22
|
import { forward, isReverse, layoutTubeMap } from "@jbrowse/tubemap-core";
|
|
23
23
|
function pathSteps(graph) {
|
|
24
24
|
const nodeById = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
for (const visit of visits) {
|
|
28
|
-
const key = `${visit.path} ${segment}`;
|
|
29
|
-
const list = strands.get(key);
|
|
30
|
-
if (list) {
|
|
31
|
-
list.push(visit.strand);
|
|
32
|
-
} else {
|
|
33
|
-
strands.set(key, [visit.strand]);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const seen = /* @__PURE__ */ new Map();
|
|
25
|
+
const visits = graph.pathVisits;
|
|
26
|
+
const next = visits?.replay();
|
|
38
27
|
return (graph.paths ?? []).map((path) => {
|
|
39
|
-
const walk = pathOrigin(path.name).name;
|
|
28
|
+
const walk = visits?.pathIndex(pathOrigin(path.name).name) ?? -1;
|
|
40
29
|
return path.nodeIds.flatMap((id) => {
|
|
41
30
|
const node = nodeById.get(id);
|
|
42
31
|
if (!node) {
|
|
43
32
|
return [];
|
|
44
33
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
const at = visits && next ? next(visits.slot(node.name), walk) : -1;
|
|
35
|
+
return [
|
|
36
|
+
{ node, strand: at >= 0 ? visits.strand(at) : canonicalStrand(node) }
|
|
37
|
+
];
|
|
49
38
|
});
|
|
50
39
|
});
|
|
51
40
|
}
|
|
@@ -208,8 +197,9 @@ function boxGraph(graph, { members, flipped }) {
|
|
|
208
197
|
...path,
|
|
209
198
|
nodeIds: path.nodeIds.filter((id) => !absorbed.has(id))
|
|
210
199
|
})),
|
|
211
|
-
pathVisits: graph.pathVisits
|
|
212
|
-
|
|
200
|
+
pathVisits: graph.pathVisits?.filter(
|
|
201
|
+
() => true,
|
|
202
|
+
(segment) => !absorbedNames.has(segment)
|
|
213
203
|
)
|
|
214
204
|
};
|
|
215
205
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PathVisits
|
|
3
|
+
} from "./chunk-RAEABQNW.js";
|
|
1
4
|
import {
|
|
2
5
|
panSNSample
|
|
3
6
|
} from "./chunk-BPLIXMH7.js";
|
|
@@ -7,6 +10,32 @@ function walkFields(panSN) {
|
|
|
7
10
|
const [sample = "", haplotype = "", ...contig] = panSN.split("#");
|
|
8
11
|
return { sample, haplotype, contig: contig.join("#") };
|
|
9
12
|
}
|
|
13
|
+
function namesByList(lists, names, listCount, pathNames) {
|
|
14
|
+
const starts = new Int32Array(listCount + 1);
|
|
15
|
+
for (const list of lists) {
|
|
16
|
+
starts[list + 1]++;
|
|
17
|
+
}
|
|
18
|
+
for (let i = 0; i < listCount; i++) {
|
|
19
|
+
starts[i + 1] += starts[i];
|
|
20
|
+
}
|
|
21
|
+
const fill = starts.slice(0, listCount);
|
|
22
|
+
const grouped = new Int32Array(lists.length);
|
|
23
|
+
lists.forEach((list, i) => {
|
|
24
|
+
grouped[fill[list]++] = names[i];
|
|
25
|
+
});
|
|
26
|
+
const listed = new Int32Array(pathNames.length).fill(-1);
|
|
27
|
+
return Array.from({ length: listCount }, (_, list) => {
|
|
28
|
+
const out = [];
|
|
29
|
+
for (let i = starts[list]; i < starts[list + 1]; i++) {
|
|
30
|
+
const k = grouped[i];
|
|
31
|
+
if (listed[k] !== list) {
|
|
32
|
+
listed[k] = list;
|
|
33
|
+
out.push(pathNames[k]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
10
39
|
function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA") {
|
|
11
40
|
const count = n.names.length;
|
|
12
41
|
const declared = n.lengths.length;
|
|
@@ -95,27 +124,54 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
|
|
|
95
124
|
}
|
|
96
125
|
edgeLists.push(list);
|
|
97
126
|
}
|
|
127
|
+
const adjacency = new Int32Array(count + 1);
|
|
128
|
+
for (let a = 0; a < count; a++) {
|
|
129
|
+
adjacency[a + 1] = adjacency[a] + (neighbours[a]?.length ?? 0) / 2;
|
|
130
|
+
}
|
|
131
|
+
const adjacentNode = new Int32Array(adjacency[count]);
|
|
132
|
+
const adjacentList = new Int32Array(adjacency[count]);
|
|
133
|
+
neighbours.forEach((near, a) => {
|
|
134
|
+
for (let j = 0; j < near.length; j += 2) {
|
|
135
|
+
adjacentNode[adjacency[a] + j / 2] = near[j];
|
|
136
|
+
adjacentList[adjacency[a] + j / 2] = near[j + 1];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const listOf = (a, b) => {
|
|
140
|
+
for (let j = adjacency[a]; j < adjacency[a + 1]; j++) {
|
|
141
|
+
if (adjacentNode[j] === b) {
|
|
142
|
+
return adjacentList[j];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return -1;
|
|
146
|
+
};
|
|
98
147
|
const nameIndex = /* @__PURE__ */ new Map();
|
|
99
148
|
const pathNames = [];
|
|
100
|
-
const
|
|
149
|
+
const crossedList = new Int32Array(w.offsets[w.names.length] ?? 0);
|
|
150
|
+
const crossedName = new Int32Array(crossedList.length);
|
|
151
|
+
let crossings = 0;
|
|
101
152
|
const lastWalk = new Int32Array(lists).fill(-1);
|
|
102
153
|
const paths = [];
|
|
103
154
|
const anchorPaths = [];
|
|
104
|
-
const
|
|
105
|
-
const
|
|
155
|
+
const totalSteps = w.offsets[w.names.length] ?? 0;
|
|
156
|
+
const visitPath = new Int32Array(totalSteps);
|
|
157
|
+
const visitStart = new Float64Array(totalSteps);
|
|
158
|
+
const visitReversed = new Uint8Array(totalSteps);
|
|
159
|
+
const fill = new Int32Array(count).fill(-1);
|
|
106
160
|
const visitOrder = [];
|
|
161
|
+
const blocks = [0];
|
|
162
|
+
const pathSamples = [];
|
|
107
163
|
for (const p of drawnWalks) {
|
|
108
164
|
const { sample, haplotype, contig } = walkFields(w.names[p]);
|
|
109
165
|
const pathName = `${sample}#${+haplotype}#${contig}`;
|
|
110
166
|
let named = nameIndex.get(pathName);
|
|
111
|
-
const repeat = named !== void 0;
|
|
112
167
|
if (named === void 0) {
|
|
113
168
|
named = pathNames.length;
|
|
114
169
|
nameIndex.set(pathName, named);
|
|
115
170
|
pathNames.push(pathName);
|
|
171
|
+
pathSamples.push(panSNSample(pathName));
|
|
116
172
|
}
|
|
117
173
|
const start = w.starts[p];
|
|
118
|
-
const visitSample =
|
|
174
|
+
const visitSample = pathSamples[named];
|
|
119
175
|
const first = w.offsets[p];
|
|
120
176
|
const nodeIds = new Array(w.offsets[p + 1] - first);
|
|
121
177
|
let pos = start;
|
|
@@ -123,25 +179,22 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
|
|
|
123
179
|
for (let s = first; s < w.offsets[p + 1]; s++) {
|
|
124
180
|
const node = w.steps[s];
|
|
125
181
|
nodeIds[s - first] = ids[node];
|
|
126
|
-
if (
|
|
127
|
-
|
|
182
|
+
if (fill[node] === -1) {
|
|
183
|
+
fill[node] = blocks.at(-1);
|
|
184
|
+
blocks.push(fill[node] + traversals[node]);
|
|
128
185
|
visitOrder.push(node);
|
|
129
186
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
strand: w.reversed[s] ? "-" : "+"
|
|
135
|
-
};
|
|
187
|
+
const at = fill[node]++;
|
|
188
|
+
visitPath[at] = named;
|
|
189
|
+
visitStart[at] = pos;
|
|
190
|
+
visitReversed[at] = w.reversed[s];
|
|
136
191
|
pos += node < declared ? n.lengths[node] : 0;
|
|
137
192
|
if (prev >= 0) {
|
|
138
|
-
const list =
|
|
139
|
-
if (list
|
|
193
|
+
const list = listOf(prev, node);
|
|
194
|
+
if (list >= 0 && lastWalk[list] !== p) {
|
|
140
195
|
lastWalk[list] = p;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
names.push(named);
|
|
144
|
-
}
|
|
196
|
+
crossedList[crossings] = list;
|
|
197
|
+
crossedName[crossings++] = named;
|
|
145
198
|
}
|
|
146
199
|
}
|
|
147
200
|
prev = node;
|
|
@@ -161,10 +214,16 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
|
|
|
161
214
|
length: pos - start
|
|
162
215
|
});
|
|
163
216
|
}
|
|
217
|
+
const listNames = namesByList(
|
|
218
|
+
crossedList.subarray(0, crossings),
|
|
219
|
+
crossedName,
|
|
220
|
+
lists,
|
|
221
|
+
pathNames
|
|
222
|
+
);
|
|
164
223
|
edges.forEach((edge, i) => {
|
|
165
|
-
const names =
|
|
224
|
+
const names = listNames[edgeLists[i]];
|
|
166
225
|
if (names.length > 0) {
|
|
167
|
-
edge.pathIds = names
|
|
226
|
+
edge.pathIds = names;
|
|
168
227
|
}
|
|
169
228
|
});
|
|
170
229
|
const walked = drawnWalks.length > 0;
|
|
@@ -174,7 +233,15 @@ function graphFromTables({ nodes: n, links: l, walks: w }, name = "Imported GFA"
|
|
|
174
233
|
edges,
|
|
175
234
|
paths: walked ? paths : void 0,
|
|
176
235
|
anchorPaths: walked ? anchorPaths : void 0,
|
|
177
|
-
pathVisits: walked ? new
|
|
236
|
+
pathVisits: walked ? new PathVisits({
|
|
237
|
+
segments: visitOrder.map((node) => n.names[node]),
|
|
238
|
+
offsets: Int32Array.from(blocks),
|
|
239
|
+
path: visitPath.subarray(0, blocks.at(-1)),
|
|
240
|
+
start: visitStart.subarray(0, blocks.at(-1)),
|
|
241
|
+
reversed: visitReversed.subarray(0, blocks.at(-1)),
|
|
242
|
+
paths: pathNames,
|
|
243
|
+
samples: pathSamples
|
|
244
|
+
}) : void 0,
|
|
178
245
|
anchoredBy: nodes.some((node) => node.stable) ? "tags" : void 0
|
|
179
246
|
};
|
|
180
247
|
}
|
|
@@ -3,30 +3,30 @@ import {
|
|
|
3
3
|
} from "./chunk-VK6XMP6B.js";
|
|
4
4
|
import {
|
|
5
5
|
layoutModeByValue
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ICXMWYOA.js";
|
|
7
7
|
import {
|
|
8
8
|
parseRegion
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FLFBYSJO.js";
|
|
10
10
|
import {
|
|
11
11
|
layoutGeometryInputs
|
|
12
12
|
} from "./chunk-LOCJN3BZ.js";
|
|
13
13
|
import {
|
|
14
14
|
version
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CDPYXHVR.js";
|
|
16
16
|
import {
|
|
17
17
|
axisScaleOf
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-OOLNLCIO.js";
|
|
19
19
|
import {
|
|
20
20
|
facetLifts,
|
|
21
21
|
walkLift
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QIVPRZ4H.js";
|
|
23
23
|
import {
|
|
24
24
|
walkKey
|
|
25
25
|
} from "./chunk-2LQ5BWT7.js";
|
|
26
26
|
import {
|
|
27
27
|
buildGeometry,
|
|
28
28
|
computeReferenceRamp
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-NP356MC2.js";
|
|
30
30
|
import {
|
|
31
31
|
abgrAlpha,
|
|
32
32
|
abgrBlue,
|
|
@@ -36,14 +36,14 @@ import {
|
|
|
36
36
|
import {
|
|
37
37
|
pathLegend,
|
|
38
38
|
walkLabelsOf
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-REE4GUDM.js";
|
|
40
40
|
import {
|
|
41
41
|
drawingBounds,
|
|
42
42
|
engineSettingsOf,
|
|
43
43
|
fitTransform,
|
|
44
44
|
forceLayout,
|
|
45
45
|
loadGraph
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-W4GZCVUK.js";
|
|
47
47
|
import {
|
|
48
48
|
referenceLabel
|
|
49
49
|
} from "./chunk-RAKOB6IV.js";
|