jbrowse-plugin-graphgenomeviewer 7.3.0 → 7.3.2
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/{GbzBaseSyntenyAdapter-FXMGIM7Z.js → GbzBaseSyntenyAdapter-3MELVQRM.js} +2 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-3MELVQRM.js.map +7 -0
- package/dist/chunks/{GraphGenomeView-WJ3FIDY2.js → GraphGenomeView-6EDKLBOJ.js} +2 -2
- package/dist/chunks/{GraphTrackSettingsDialog-ZW7ALMDV.js → GraphTrackSettingsDialog-KYEZWI4Z.js} +2 -2
- package/dist/chunks/{HighlightColorDialog-VBZRUKD5.js → HighlightColorDialog-IMLYI64R.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-SPOPTJEN.js → LinearGraphDisplay-CRIZLJDE.js} +2 -2
- package/dist/chunks/{MinigraphBubbleAdapter-QCOMFPLL.js → MinigraphBubbleAdapter-2HPTGZ5N.js} +2 -2
- package/dist/chunks/RgfaTabixAdapter-GNH3QCPZ.js +2 -0
- package/dist/chunks/RgfaTabixAdapter-GNH3QCPZ.js.map +7 -0
- package/dist/chunks/{WalkTabixSyntenyAdapter-7VDCNSFD.js → WalkTabixSyntenyAdapter-CUPHY36S.js} +2 -2
- package/dist/chunks/{chunk-44CJ2N3N.js → chunk-4EKOQHUX.js} +2 -2
- package/dist/chunks/{chunk-44CJ2N3N.js.map → chunk-4EKOQHUX.js.map} +4 -4
- package/dist/chunks/{chunk-RFDSEB2X.js → chunk-6DRBCLWY.js} +4 -4
- package/dist/chunks/chunk-B5SVBPXN.js +2 -0
- package/dist/chunks/chunk-B5SVBPXN.js.map +7 -0
- package/dist/chunks/chunk-CJMBJJLO.js +3 -0
- package/dist/chunks/chunk-CJMBJJLO.js.map +7 -0
- package/dist/chunks/{chunk-BXRTG7FU.js → chunk-F4T7JI7S.js} +2 -2
- package/dist/chunks/{chunk-BXRTG7FU.js.map → chunk-F4T7JI7S.js.map} +1 -1
- package/dist/chunks/chunk-GN4HSVLB.js +4 -0
- package/dist/chunks/{chunk-VQ77X5QU.js.map → chunk-GN4HSVLB.js.map} +4 -4
- package/dist/chunks/{chunk-WUSKVEA6.js → chunk-HOSCIP4U.js} +2 -2
- package/dist/chunks/{chunk-WUSKVEA6.js.map → chunk-HOSCIP4U.js.map} +2 -2
- package/dist/chunks/chunk-HTSG4T32.js +3 -0
- package/dist/chunks/chunk-HTSG4T32.js.map +7 -0
- package/dist/chunks/{chunk-2O3YVA2I.js → chunk-IFBKAC2H.js} +2 -2
- package/dist/chunks/{chunk-RW775LQN.js → chunk-MNL7IPTH.js} +2 -2
- package/dist/chunks/{chunk-RW775LQN.js.map → chunk-MNL7IPTH.js.map} +2 -2
- package/dist/chunks/chunk-N5VWQHTK.js +2 -0
- package/dist/chunks/{chunk-YKSUKPYY.js.map → chunk-N5VWQHTK.js.map} +2 -2
- package/dist/chunks/{chunk-DBPEUVUC.js → chunk-NGR473EL.js} +2 -2
- package/dist/chunks/{chunk-DBPEUVUC.js.map → chunk-NGR473EL.js.map} +2 -2
- package/dist/chunks/chunk-ORHUPW3G.js +3 -0
- package/dist/chunks/chunk-ORHUPW3G.js.map +7 -0
- package/dist/chunks/{chunk-DUR437TH.js → chunk-PUFH6DMJ.js} +2 -2
- package/dist/chunks/{chunk-DUR437TH.js.map → chunk-PUFH6DMJ.js.map} +1 -1
- package/dist/chunks/{chunk-FIRQAKMX.js → chunk-Q55PHRHV.js} +1 -1
- package/dist/chunks/{chunk-FIRQAKMX.js.map → chunk-Q55PHRHV.js.map} +1 -1
- package/dist/chunks/chunk-QQCTNB2Z.js +2 -0
- package/dist/chunks/chunk-QQCTNB2Z.js.map +7 -0
- package/dist/chunks/chunk-R25GOTED.js +2 -0
- package/dist/chunks/chunk-R25GOTED.js.map +7 -0
- package/dist/chunks/chunk-TQKSF3NI.js +2 -0
- package/dist/chunks/{chunk-7HWHWPRW.js.map → chunk-TQKSF3NI.js.map} +3 -3
- package/dist/chunks/{chunk-6MUBJVBG.js → chunk-ULLEUORS.js} +2 -2
- package/dist/chunks/{chunk-6MUBJVBG.js.map → chunk-ULLEUORS.js.map} +4 -4
- package/dist/chunks/chunk-VW4PPXH6.js +2 -0
- package/dist/chunks/{renderSvg-WD6YDV2I.js → renderSvg-HEEQJD5B.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +2 -2
- package/package.json +3 -3
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.ts +3 -1
- package/src/RgfaTabixAdapter/configSchema.ts +4 -4
- package/src/RgfaTabixAdapter/test_data/{walks3_follow.GRCh38.walks.bed.gz → walks4_follow.GRCh38.walks.bed.gz} +0 -0
- package/src/RgfaTabixAdapter/test_data/{walks3_header.GRCh38.walks.bed.gz → walks4_header.GRCh38.walks.bed.gz} +0 -0
- package/src/RgfaTabixAdapter/test_data/walks4_inversion.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks4_inversion.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks4_lanepairs.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks4_lanepairs.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks4_maxnode.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks4_rejoin.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/{walks3_twopart.GRCh38.walks.bed.gz → walks4_twopart.GRCh38.walks.bed.gz} +0 -0
- package/src/RgfaTabixAdapter/walkFiles.test.ts +9 -9
- package/src/RgfaTabixAdapter/walkReader.ts +5 -1
- package/src/WalkTabixSyntenyAdapter/WalkTabixSyntenyAdapter.test.ts +5 -5
- package/src/WalkTabixSyntenyAdapter/configSchema.ts +3 -3
- package/src/WalkTabixSyntenyAdapter/gbzParity.test.ts +2 -2
- package/src/panSNAliases/panSNAliases.test.ts +2 -2
- package/src/panSNTabix.ts +3 -3
- package/src/version.ts +1 -1
- package/dist/chunks/GbzBaseSyntenyAdapter-FXMGIM7Z.js.map +0 -7
- package/dist/chunks/RgfaTabixAdapter-O3NMNRZ2.js +0 -2
- package/dist/chunks/RgfaTabixAdapter-O3NMNRZ2.js.map +0 -7
- package/dist/chunks/chunk-2M4XYSLG.js +0 -2
- package/dist/chunks/chunk-2M4XYSLG.js.map +0 -7
- package/dist/chunks/chunk-6KUHGRHU.js +0 -2
- package/dist/chunks/chunk-6KUHGRHU.js.map +0 -7
- package/dist/chunks/chunk-7HWHWPRW.js +0 -2
- package/dist/chunks/chunk-B2EP6FOQ.js +0 -3
- package/dist/chunks/chunk-B2EP6FOQ.js.map +0 -7
- package/dist/chunks/chunk-JCAZTNYG.js +0 -2
- package/dist/chunks/chunk-N74HGPAW.js +0 -3
- package/dist/chunks/chunk-N74HGPAW.js.map +0 -7
- package/dist/chunks/chunk-PEDWEPNK.js +0 -2
- package/dist/chunks/chunk-PEDWEPNK.js.map +0 -7
- package/dist/chunks/chunk-PYQG3JHP.js +0 -3
- package/dist/chunks/chunk-PYQG3JHP.js.map +0 -7
- package/dist/chunks/chunk-VQ77X5QU.js +0 -4
- package/dist/chunks/chunk-YKSUKPYY.js +0 -2
- package/src/RgfaTabixAdapter/test_data/walks3_inversion.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_inversion.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_lanepairs.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_lanepairs.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_maxnode.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_rejoin.GRCh38.walks.bed.gz +0 -0
- /package/dist/chunks/{GraphGenomeView-WJ3FIDY2.js.map → GraphGenomeView-6EDKLBOJ.js.map} +0 -0
- /package/dist/chunks/{GraphTrackSettingsDialog-ZW7ALMDV.js.map → GraphTrackSettingsDialog-KYEZWI4Z.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-VBZRUKD5.js.map → HighlightColorDialog-IMLYI64R.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-SPOPTJEN.js.map → LinearGraphDisplay-CRIZLJDE.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-QCOMFPLL.js.map → MinigraphBubbleAdapter-2HPTGZ5N.js.map} +0 -0
- /package/dist/chunks/{WalkTabixSyntenyAdapter-7VDCNSFD.js.map → WalkTabixSyntenyAdapter-CUPHY36S.js.map} +0 -0
- /package/dist/chunks/{chunk-RFDSEB2X.js.map → chunk-6DRBCLWY.js.map} +0 -0
- /package/dist/chunks/{chunk-2O3YVA2I.js.map → chunk-IFBKAC2H.js.map} +0 -0
- /package/dist/chunks/{chunk-JCAZTNYG.js.map → chunk-VW4PPXH6.js.map} +0 -0
- /package/dist/chunks/{renderSvg-WD6YDV2I.js.map → renderSvg-HEEQJD5B.js.map} +0 -0
- /package/src/RgfaTabixAdapter/test_data/{walks3_follow.GRCh38.walks.bed.gz.tbi → walks4_follow.GRCh38.walks.bed.gz.tbi} +0 -0
- /package/src/RgfaTabixAdapter/test_data/{walks3_header.GRCh38.walks.bed.gz.tbi → walks4_header.GRCh38.walks.bed.gz.tbi} +0 -0
- /package/src/RgfaTabixAdapter/test_data/{walks3_maxnode.GRCh38.walks.bed.gz.tbi → walks4_maxnode.GRCh38.walks.bed.gz.tbi} +0 -0
- /package/src/RgfaTabixAdapter/test_data/{walks3_rejoin.GRCh38.walks.bed.gz.tbi → walks4_rejoin.GRCh38.walks.bed.gz.tbi} +0 -0
- /package/src/RgfaTabixAdapter/test_data/{walks3_twopart.GRCh38.walks.bed.gz.tbi → walks4_twopart.GRCh38.walks.bed.gz.tbi} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jbrowse-plugin-graphgenomeviewer",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.2",
|
|
4
4
|
"description": "JBrowse 2 graph genome (pangenome) view: rGFA reference-anchored layouts, the Bandage force-directed engine, and haplotype lanes read from a gbz-base database",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@jbrowse/core": "5.0.0-beta.11",
|
|
33
33
|
"@jbrowse/display-kit": "5.0.0-beta.11",
|
|
34
34
|
"@jbrowse/display-ui": "5.0.0-beta.11",
|
|
35
|
-
"@jbrowse/graph-walks": "^
|
|
35
|
+
"@jbrowse/graph-walks": "^3.1.0",
|
|
36
36
|
"@jbrowse/render-core": "5.0.0-beta.11",
|
|
37
37
|
"@jbrowse/synteny-core": "5.0.0-beta.11"
|
|
38
38
|
},
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@emotion/react": "^11.14.0",
|
|
41
41
|
"@emotion/styled": "^11.14.1",
|
|
42
42
|
"@eslint/js": "^10.0.1",
|
|
43
|
-
"@jbrowse/bandage-core": "^11.
|
|
43
|
+
"@jbrowse/bandage-core": "^11.6.1",
|
|
44
44
|
"@jbrowse/cli": "^4.3.0",
|
|
45
45
|
"@jbrowse/mobx-state-tree": "^6.9.0",
|
|
46
46
|
"@jbrowse/plugin-linear-genome-view": "5.0.0-beta.11",
|
|
@@ -90,7 +90,9 @@ export default class RgfaTabixAdapter extends BaseFeatureDataAdapter<RgfaTabixAd
|
|
|
90
90
|
return refNames.regionBytes(
|
|
91
91
|
regions,
|
|
92
92
|
opts,
|
|
93
|
-
walks &&
|
|
93
|
+
walks &&
|
|
94
|
+
((refName, { start, end }) =>
|
|
95
|
+
walks.reader.queryStart(start, { ...opts, refName, end })),
|
|
94
96
|
)
|
|
95
97
|
}
|
|
96
98
|
|
|
@@ -30,8 +30,8 @@ import type { Instance } from '@jbrowse/mobx-state-tree'
|
|
|
30
30
|
* `walksUri` takes the prefix of a walk file in place of `uri`, and resolves
|
|
31
31
|
* `<walksUri>.walks.bed.gz` and its `.tbi`. `gfa-to-tabix --walks -o <prefix>`
|
|
32
32
|
* writes one per reference sample, so a track names one as
|
|
33
|
-
* `<prefix>.<sample>`. The adapter reads walk format
|
|
34
|
-
* writes from 1.
|
|
33
|
+
* `<prefix>.<sample>`. The adapter reads walk format 4, which gfa-to-tabix
|
|
34
|
+
* writes from 1.2, through @jbrowse/graph-walks. Such a graph's cut carries
|
|
35
35
|
* the haplotypes' walks, and `defaultHaplotypes` names the ones it is cut for
|
|
36
36
|
* until the user picks others.
|
|
37
37
|
*
|
|
@@ -48,7 +48,7 @@ import type { Instance } from '@jbrowse/mobx-state-tree'
|
|
|
48
48
|
* ```js
|
|
49
49
|
* {
|
|
50
50
|
* type: 'RgfaTabixAdapter',
|
|
51
|
-
* walksUri: 'https://
|
|
51
|
+
* walksUri: 'https://jbrowse.org/demos/hprc/hprc-v2.1-mc-grch38-f4.GRCh38',
|
|
52
52
|
* assemblyNameToPanSN: { hg38: 'GRCh38' },
|
|
53
53
|
* defaultHaplotypes: ['HG002', 'HG00733', 'HG02257', 'NA19240'],
|
|
54
54
|
* }
|
|
@@ -152,7 +152,7 @@ const RgfaTabixAdapter = ConfigurationSchema(
|
|
|
152
152
|
),
|
|
153
153
|
/**
|
|
154
154
|
* #slot
|
|
155
|
-
* a `gfa-to-tabix --walks` file in walk format
|
|
155
|
+
* a `gfa-to-tabix --walks` file in walk format 4: per reference chunk,
|
|
156
156
|
* the reference's path, the ways haplotypes leave it and each haplotype's
|
|
157
157
|
* piece. Unset means the graph has no walks.
|
|
158
158
|
*/
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -17,9 +17,9 @@ import type { WalkCut } from './walkCut.ts'
|
|
|
17
17
|
import type { GraphTables } from '@jbrowse/bandage-core/gfa/graphTables'
|
|
18
18
|
|
|
19
19
|
// chr22 of HPRC v2.1 at base level, one walk file per reference in walk
|
|
20
|
-
// format
|
|
20
|
+
// format 4, built under ~/work/scratch/walks-20261008/f4. Skipped where the
|
|
21
21
|
// files are absent.
|
|
22
|
-
const chr22 = '/home/cdiesh/work/scratch/walks-20261008/
|
|
22
|
+
const chr22 = '/home/cdiesh/work/scratch/walks-20261008/f4/chr22'
|
|
23
23
|
const present = ['GRCh38', 'CHM13'].every(sample =>
|
|
24
24
|
existsSync(`${chr22}.${sample}.walks.bed.gz`),
|
|
25
25
|
)
|
|
@@ -34,27 +34,27 @@ const fixture = (name: string) =>
|
|
|
34
34
|
// W HG002 1 chr1 >1>2>7>4>5>6 7 replaces 3
|
|
35
35
|
// W HG002 2 chr1 >1>2>3>4>8>6 8 replaces 5
|
|
36
36
|
// W HG00097 1 chr1 >1>2>3>4>5>6
|
|
37
|
-
const headerPrefix = fixture('
|
|
37
|
+
const headerPrefix = fixture('walks4_header')
|
|
38
38
|
|
|
39
|
-
//
|
|
39
|
+
// walks4_header's walks with the reference named as pggb names a P-line,
|
|
40
40
|
// GRCh38#chr1
|
|
41
|
-
const twoPartPrefix = fixture('
|
|
41
|
+
const twoPartPrefix = fixture('walks4_twopart')
|
|
42
42
|
|
|
43
43
|
// An unchopped graph, node 1 spanning 0-2600 and filed under chunk 0 alone:
|
|
44
44
|
// W GRCh38 0 chr1 >1>2>4
|
|
45
45
|
// W HG002 1 chr1 >1>3>4 3 replaces 2
|
|
46
|
-
const maxNodePrefix = fixture('
|
|
46
|
+
const maxNodePrefix = fixture('walks4_maxnode')
|
|
47
47
|
|
|
48
48
|
// Twelve 500 bp reference nodes over chr1:0-6000 in one 10 kb chunk:
|
|
49
49
|
// W GRCh38 0 chr1 >1>2>3>4>5>6>7>8>9>10>11>12
|
|
50
50
|
// W HG002 1 chr1 >1>2>3>20>21>9>10>11>12 20 and 21, 2 kb each, replace 4-8
|
|
51
51
|
// W HG002 2 chr1 >1>2>3>4>5>6>7>8>9>10>11>12
|
|
52
52
|
// W HG003 1 chr1 >1>2>3>22 the contig ends on 22, 300 bp
|
|
53
|
-
const rejoinPrefix = fixture('
|
|
53
|
+
const rejoinPrefix = fixture('walks4_rejoin')
|
|
54
54
|
|
|
55
55
|
// The same graph in 1 kb chunks, whose rows name the chunks their path goes on
|
|
56
56
|
// in: HG002#1 leaves chunk 1000 for 20 and 21 and rejoins at 9, in chunk 4000
|
|
57
|
-
const followPrefix = fixture('
|
|
57
|
+
const followPrefix = fixture('walks4_follow')
|
|
58
58
|
|
|
59
59
|
function makeAdapter(prefix: string, slots = {}) {
|
|
60
60
|
const local = (path: string) => ({
|
|
@@ -215,7 +215,7 @@ test('a cut for some haplotypes keeps a reference walk named without a haplotype
|
|
|
215
215
|
|
|
216
216
|
test('a format 1 walk file is refused, with what to rebuild it with', async () => {
|
|
217
217
|
const cut = makeAdapter(fixture('walks1_header')).getSubgraph(chr1(0, 600))
|
|
218
|
-
await expect(cut).rejects.toThrow(/rebuild it with gfa-to-tabix 1.
|
|
218
|
+
await expect(cut).rejects.toThrow(/rebuild it with gfa-to-tabix 1.2/)
|
|
219
219
|
})
|
|
220
220
|
|
|
221
221
|
test('a cut over walkByteBudget reads no row', async () => {
|
|
@@ -87,7 +87,11 @@ export class WalkIndex {
|
|
|
87
87
|
await getLines(
|
|
88
88
|
this.file,
|
|
89
89
|
refName,
|
|
90
|
-
await this.reader.queryStart(region.start,
|
|
90
|
+
await this.reader.queryStart(region.start, {
|
|
91
|
+
...opts,
|
|
92
|
+
refName,
|
|
93
|
+
end: region.end,
|
|
94
|
+
}),
|
|
91
95
|
region.end,
|
|
92
96
|
{
|
|
93
97
|
signal: opts.signal,
|
|
@@ -34,7 +34,7 @@ const fixture = (name: string) =>
|
|
|
34
34
|
|
|
35
35
|
function makeAdapter(
|
|
36
36
|
slots: Record<string, unknown> = {},
|
|
37
|
-
name = '
|
|
37
|
+
name = 'walks4_header',
|
|
38
38
|
) {
|
|
39
39
|
const local = (path: string) => ({
|
|
40
40
|
localPath: path,
|
|
@@ -111,7 +111,7 @@ test('a fetch for some haplotypes answers those lanes in the order asked, named
|
|
|
111
111
|
})
|
|
112
112
|
|
|
113
113
|
test('a fetch for some haplotypes reads them against a reference walk named without a haplotype', async () => {
|
|
114
|
-
const found = await feats(makeAdapter({}, '
|
|
114
|
+
const found = await feats(makeAdapter({}, 'walks4_twopart'), {
|
|
115
115
|
haplotypes: ['HG002#1'],
|
|
116
116
|
})
|
|
117
117
|
expect(found.map(summary)).toEqual([
|
|
@@ -172,7 +172,7 @@ test('a batch of lane pairs answers each pair what it answers alone', async () =
|
|
|
172
172
|
expect(batch).toHaveLength(2)
|
|
173
173
|
})
|
|
174
174
|
|
|
175
|
-
//
|
|
175
|
+
// walks4_lanepairs, a 5.5 kb reference of 2 kb flanks around three 500 bp
|
|
176
176
|
// nodes, in 1 kb chunks:
|
|
177
177
|
// W GRCh38 0 chr1 >1>2>3>4>5
|
|
178
178
|
// W HG002 1 chr1 >1>2>3>4>5
|
|
@@ -180,7 +180,7 @@ test('a batch of lane pairs answers each pair what it answers alone', async () =
|
|
|
180
180
|
// W HG00097 1 chr1 >1>2>6>2>6>2>3>4>5 2 three times, 6 a 30 bp spacer
|
|
181
181
|
test('a lane pair matches through a copy-number array, and draws an inversion between the lanes as a reverse-strand record', async () => {
|
|
182
182
|
const found = await firstValueFrom(
|
|
183
|
-
makeAdapter({}, '
|
|
183
|
+
makeAdapter({}, 'walks4_lanepairs')
|
|
184
184
|
.getFeatures(
|
|
185
185
|
{ ...window, end: 5500 },
|
|
186
186
|
{
|
|
@@ -554,7 +554,7 @@ test('a walk turned against the reference for 10 kb or more gains a reverse-stra
|
|
|
554
554
|
// W HG00097 1 chr1 >1>2>3>4>5
|
|
555
555
|
test('the anchor window answers a haplotype turned against the reference with a reverse-strand record of the turned stretch', async () => {
|
|
556
556
|
const records = await firstValueFrom(
|
|
557
|
-
makeAdapter({}, '
|
|
557
|
+
makeAdapter({}, 'walks4_inversion')
|
|
558
558
|
.getFeatures({ ...window, end: 55_000 }, {})
|
|
559
559
|
.pipe(toArray()),
|
|
560
560
|
)
|
|
@@ -25,14 +25,14 @@ import type { Instance } from '@jbrowse/mobx-state-tree'
|
|
|
25
25
|
*
|
|
26
26
|
* `walksUri` takes the prefix of one reference's walk file, `<prefix>.<sample>`,
|
|
27
27
|
* and resolves `<walksUri>.walks.bed.gz` and its `.tbi`. The adapter reads walk
|
|
28
|
-
* format
|
|
28
|
+
* format 4, which gfa-to-tabix writes from 1.2, through @jbrowse/graph-walks.
|
|
29
29
|
* Only a window on the anchor is answered.
|
|
30
30
|
*
|
|
31
31
|
* #example
|
|
32
32
|
* ```js
|
|
33
33
|
* {
|
|
34
34
|
* type: 'WalkTabixSyntenyAdapter',
|
|
35
|
-
* walksUri: 'https://
|
|
35
|
+
* walksUri: 'https://jbrowse.org/demos/hprc/hprc-v2.1-mc-grch38-f4.GRCh38',
|
|
36
36
|
* assemblyNames: ['hg38'],
|
|
37
37
|
* assemblyNameToPanSN: { hg38: 'GRCh38' },
|
|
38
38
|
* }
|
|
@@ -56,7 +56,7 @@ const WalkTabixSyntenyAdapter = ConfigurationSchema(
|
|
|
56
56
|
},
|
|
57
57
|
/**
|
|
58
58
|
* #slot
|
|
59
|
-
* a `gfa-to-tabix --walks` file in walk format
|
|
59
|
+
* a `gfa-to-tabix --walks` file in walk format 4
|
|
60
60
|
*/
|
|
61
61
|
walksLocation: fileLocationSlot('/path/to/graph.walks.bed.gz'),
|
|
62
62
|
/**
|
|
@@ -12,10 +12,10 @@ import type { Feature } from '@jbrowse/core/util'
|
|
|
12
12
|
import type { SyntenyMate } from '@jbrowse/synteny-core'
|
|
13
13
|
|
|
14
14
|
// chr22 of HPRC v2.1 as a gbz-base database and as gfa-to-tabix's GRCh38
|
|
15
|
-
// walk file in walk format
|
|
15
|
+
// walk file in walk format 4, built 2026-10-08 and 2026-10-20. Skipped where
|
|
16
16
|
// the files are absent.
|
|
17
17
|
const dir = '/home/cdiesh/work/scratch/walks-20261008'
|
|
18
|
-
const walkPrefix = `${dir}/
|
|
18
|
+
const walkPrefix = `${dir}/f4/chr22.GRCh38`
|
|
19
19
|
const present =
|
|
20
20
|
existsSync(`${walkPrefix}.walks.bed.gz`) && existsSync(`${dir}/chr22.gbz.db`)
|
|
21
21
|
|
|
@@ -123,11 +123,11 @@ describe("a lanes track anchored on an alias of the window's assembly", () => {
|
|
|
123
123
|
{
|
|
124
124
|
type: 'WalkTabixSyntenyAdapter',
|
|
125
125
|
walksLocation: local(
|
|
126
|
-
'../RgfaTabixAdapter/test_data/
|
|
126
|
+
'../RgfaTabixAdapter/test_data/walks4_header.GRCh38.walks.bed.gz',
|
|
127
127
|
),
|
|
128
128
|
walksIndex: {
|
|
129
129
|
location: local(
|
|
130
|
-
'../RgfaTabixAdapter/test_data/
|
|
130
|
+
'../RgfaTabixAdapter/test_data/walks4_header.GRCh38.walks.bed.gz.tbi',
|
|
131
131
|
),
|
|
132
132
|
},
|
|
133
133
|
assemblyNames: ['GRCh38'],
|
package/src/panSNTabix.ts
CHANGED
|
@@ -182,12 +182,12 @@ export class PanSNRefNames {
|
|
|
182
182
|
/**
|
|
183
183
|
* The compressed bytes a read of `regions` fetches from the file, as its
|
|
184
184
|
* index estimates them, for the display's byte gate. `queryStart` moves a
|
|
185
|
-
*
|
|
185
|
+
* window's start to where the read begins.
|
|
186
186
|
*/
|
|
187
187
|
async regionBytes(
|
|
188
188
|
regions: Region[],
|
|
189
189
|
opts: BaseOptions = {},
|
|
190
|
-
queryStart = async (
|
|
190
|
+
queryStart = async (_refName: string, region: Region) => region.start,
|
|
191
191
|
) {
|
|
192
192
|
const spans = []
|
|
193
193
|
for (const region of regions) {
|
|
@@ -195,7 +195,7 @@ export class PanSNRefNames {
|
|
|
195
195
|
if (refName !== undefined) {
|
|
196
196
|
spans.push({
|
|
197
197
|
refName,
|
|
198
|
-
start: await queryStart(region
|
|
198
|
+
start: await queryStart(refName, region),
|
|
199
199
|
end: region.end,
|
|
200
200
|
})
|
|
201
201
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '7.3.
|
|
1
|
+
export const version = '7.3.2'
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@11.4.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-TUQKGAK3.js", "../../src/GbzBaseSyntenyAdapter/companion.ts", "../../src/gaf/gafFile.ts", "../../src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n GBZ_CUT_DEFAULTS,\n NoReferenceSampleError,\n aliasedSample,\n cutWindowGFA,\n haplotypeWanted,\n referencePathQuery,\n referenceSamplesOf\n} from \"./chunk-NMWQUFPF.js\";\nimport {\n panSNSample\n} from \"./chunk-4XWZNPQ2.js\";\n\n// src/gbzCut.ts\nimport { GBZBase } from \"@gmod/gbz-base\";\nvar HPRC_GBZ = {\n db: \"https://s3-us-west-2.amazonaws.com/human-pangenomics/pangenomes/freeze/release2/minigraph-cactus/v2.1/hprc-v2.1-mc-grch38/hprc-v2.1-mc-grch38.gbz.db\",\n index: \"https://jbrowse.org/demos/hprc/hprc-v2.1-mc-grch38.haplotype-index.f3.db\"\n};\nfunction gbzLocations({ db, index }) {\n return db === \"hprc\" ? { db: HPRC_GBZ.db, index: index ?? HPRC_GBZ.index } : { db, index };\n}\nfunction haplotypeIndexBeside(db) {\n const GBZ_DB = /\\.gbz\\.db$/i;\n return GBZ_DB.test(db) ? db.replace(GBZ_DB, \".haplotype-index.db\") : void 0;\n}\nfunction parseRegion(text) {\n const m = /^\\s*([^:\\s]+):([\\d,]+)-([\\d,]+)\\s*$/.exec(text);\n if (!m) {\n throw new Error(\n `\"${text}\" is not a region like chr6:160,614,798-160,647,758`\n );\n }\n const n = (s) => Number(s.replaceAll(\",\", \"\"));\n const region = { refName: m[1], start: n(m[2]), end: n(m[3]) };\n if (region.end <= region.start) {\n throw new Error(`\"${text}\" ends at or before it starts`);\n }\n return region;\n}\nasync function openGbz(db, index) {\n const base = await GBZBase.open({ source: db, haplotypeIndex: index });\n return { base, referenceSamples: await referenceSamplesOf(base) };\n}\nfunction referenceSample(ref, samples) {\n if (ref) {\n return aliasedSample(panSNSample(ref), samples) ?? ref;\n }\n const first = samples[0];\n if (first === void 0) {\n throw new NoReferenceSampleError(\"\", samples);\n }\n return first;\n}\nasync function cutGbzRegion({ base, referenceSamples }, src, signal) {\n const region = parseRegion(src.region);\n const sample = referenceSample(src.referenceSample, referenceSamples);\n const query = await referencePathQuery(base, sample, region.refName);\n if (!query) {\n throw new Error(`${sample} has no indexed path named ${region.refName}`);\n }\n signal?.throwIfAborted();\n const wanted = src.haplotypes?.length ? src.haplotypes : void 0;\n const text = await cutWindowGFA(base, query, region.start, region.end, {\n context: src.context ?? GBZ_CUT_DEFAULTS.context,\n snarls: src.snarls ?? GBZ_CUT_DEFAULTS.snarls,\n limit: GBZ_CUT_DEFAULTS.limit,\n signal,\n keep: wanted ? (name) => haplotypeWanted(name, wanted) : void 0\n });\n return { text, region, sample };\n}\n\nexport {\n HPRC_GBZ,\n gbzLocations,\n haplotypeIndexBeside,\n parseRegion,\n openGbz,\n cutGbzRegion\n};\n", "import { haplotypeIndexBeside } from '@jbrowse/bandage-core/gbzCut'\nimport { openLocation } from '@jbrowse/core/util/io'\n\nimport { locationName, readsSiblings, renamed } from '../locationName'\n\nimport type PluginManager from '@jbrowse/core/PluginManager'\nimport type { FileLocation } from '@jbrowse/core/util/types'\n\nexport function siblingCompanion(gbzDb: FileLocation) {\n return readsSiblings(gbzDb) && haplotypeIndexBeside(locationName(gbzDb))\n ? renamed(gbzDb, name => haplotypeIndexBeside(name)!)\n : undefined\n}\n\n// 404 is a missing file, and so is 403 from a bucket that does not let a\n// reader list it; anything else leaves the file's presence unknown\nfunction isMissing(error: unknown) {\n return (\n error instanceof Error &&\n (/\\bHTTP 40[34]\\b/.test(error.message) ||\n (error as { code?: unknown }).code === 'ENOENT')\n )\n}\n\n// `unreadable` is why a companion that may be there could not be checked, such\n// as a network error, or a server that answers a missing file without CORS\nexport async function findCompanion(\n gbzDb: FileLocation,\n pluginManager?: PluginManager,\n): Promise<{ location?: FileLocation; unreadable?: string }> {\n const candidate = siblingCompanion(gbzDb)\n if (!candidate) {\n return {}\n }\n try {\n await openLocation(candidate, pluginManager).stat()\n return { location: candidate }\n } catch (error) {\n return isMissing(error) ? {} : { unreadable: String(error) }\n }\n}\n", "import { unzip } from '@gmod/bgzf-filehandle'\nimport { parseGaf, parseGafLine } from '@jbrowse/bandage-core/gaf/parseGaf'\nimport { cachedSetup } from '@jbrowse/core/data_adapters/BaseAdapter'\n\nimport type { TabixIndexedFile } from '@gmod/tabix'\nimport type { GafRecord } from '@jbrowse/bandage-core/gaf/parseGaf'\n\ninterface WholeFile {\n stat(): Promise<{ size: number }>\n readFile(opts?: { signal?: AbortSignal }): Promise<Uint8Array>\n}\n\nexport interface GafReads {\n records: GafRecord[]\n // reads over the nodes before sampling\n total: number\n}\n\n// The tube map lays reads out on the main thread at about 40 ms per thousand\nexport const MAX_READS = 5000\n\n// An unindexed GAF is read whole, once, into the worker\nconst MAX_UNINDEXED_BYTES = 50 * 2 ** 20\n\nexport class UnindexedGafTooLargeError extends Error {\n override name = 'UnindexedGafTooLargeError'\n\n constructor(size: number) {\n super(\n `this GAF is ${(size / 2 ** 20).toFixed(0)} MB without an index; bgzip it and index it with tabix -p gaf`,\n )\n }\n}\n\n// Evenly spaced, so a pileup thins out rather than losing its right half\nfunction sample(records: GafRecord[], max: number) {\n if (records.length <= max) {\n return records\n }\n const stride = records.length / max\n return Array.from({ length: max }, (_, k) => records[Math.floor(k * stride)]!)\n}\n\nconst touches = (record: GafRecord, names: ReadonlySet<string>) =>\n record.path.some(step => names.has(step.name))\n\n// A GAF over a graph's segments: bgzipped and indexed with `tabix -p gaf`,\n// which keys each line by its lowest and highest node id and so needs numeric\n// segment names, or plain or gzipped and read whole.\nexport class GafFile {\n // Shared by every window, so the signal is cachedSetup's own, which aborts\n // once no caller is left waiting\n private whole = cachedSetup({\n setup: async ({ signal }) => {\n const { size } = await this.file.stat()\n if (size > MAX_UNINDEXED_BYTES) {\n throw new UnindexedGafTooLargeError(size)\n }\n const bytes = await this.file.readFile({ signal })\n const text = new TextDecoder().decode(\n bytes[0] === 0x1f && bytes[1] === 0x8b ? await unzip(bytes) : bytes,\n )\n return parseGaf(text)\n },\n })\n\n constructor(\n private file: WholeFile,\n private tabix?: TabixIndexedFile,\n ) {}\n\n private async readIndexed(\n tabix: TabixIndexedFile,\n names: ReadonlySet<string>,\n signal?: AbortSignal,\n ) {\n let lo = Infinity\n let hi = -Infinity\n for (const name of names) {\n const id = Number(name)\n if (Number.isInteger(id)) {\n lo = Math.min(lo, id)\n hi = Math.max(hi, id)\n }\n }\n const records: GafRecord[] = []\n if (lo <= hi) {\n // a GAF index ignores the refName, and getLines keeps a read whose node\n // ids span min..max when min < end && max >= start, hence hi + 1\n await tabix.getLines('{node}', lo, hi + 1, {\n signal,\n lineCallback: line => {\n const record = parseGafLine(line)\n if (record && touches(record, names)) {\n records.push(record)\n }\n },\n })\n }\n return records\n }\n\n async readsOver(\n names: ReadonlySet<string>,\n { signal }: { signal?: AbortSignal } = {},\n ): Promise<GafReads> {\n const records = this.tabix\n ? await this.readIndexed(this.tabix, names, signal)\n : (await this.whole({ signal })).filter(r => touches(r, names))\n return { records: sample(records, MAX_READS), total: records.length }\n }\n}\n", "import { GBZBase, SubgraphLimitError } from '@gmod/gbz-base'\nimport {\n NodeLimitError,\n cutWindowTables,\n haplotypePrefix,\n haplotypeWanted,\n nodeLimitError,\n referencePathQuery,\n referenceSamplesOf,\n resolveReferenceSample,\n} from '@jbrowse/bandage-core/gbzWindow'\nimport {\n assemblyByPanSNPrefix,\n panSNMatchesPrefix,\n resolvePanSNPrefix,\n} from '@jbrowse/bandage-core/pansn'\nimport { cachedSetup } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { getBpDisplayStr, updateStatus } from '@jbrowse/core/util'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\n\nimport { findCompanion } from './companion.ts'\nimport { walkCutFor } from '../RgfaTabixAdapter/walkCut.ts'\nimport { GafFile } from '../gaf/gafFile.ts'\nimport { locationIsSet } from '../locationName.ts'\nimport { openTabixSlot } from '../panSNTabix.ts'\nimport { ComparativeAdapterBase } from '../synteny/ComparativeAdapterBase.ts'\nimport SyntenyFeature from '../synteny/SyntenyFeature.ts'\nimport {\n laneAssemblyName,\n lanePairsStatus,\n requestedPairs,\n} from '../synteny/lanePairs.ts'\nimport { laneZoomNotice } from '../synteny/laneZoomNotice.ts'\nimport { matchFeature } from '../synteny/matchFeature.ts'\n\nimport type { GbzBaseSyntenyAdapterConfig } from './configSchema.ts'\nimport type { SubgraphAdapterOptions } from '../GetSubgraph.ts'\nimport type { GafReads } from '../gaf/gafFile.ts'\nimport type { LaneFeatureOptions, LanePair } from '../synteny/lanePairs.ts'\nimport type {\n HaplotypeAlignment,\n HaplotypeRef,\n PairAlignment,\n PathName,\n PathQuery,\n Subgraph,\n} from '@gmod/gbz-base'\nimport type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util'\nimport type { FileLocation, Region } from '@jbrowse/core/util/types'\n\nexport class NoHaplotypeIndexError extends Error {\n override name = 'NoHaplotypeIndexError'\n\n constructor(unreadable?: string) {\n super(\n unreadable === undefined\n ? 'no haplotype index is set, so the walks cannot be named; build one with gbz-haplotype-index (cargo install gbz-haplotype-index) and set it as haplotypeIndexLocation'\n : `the haplotype index beside the graph database could not be checked (${unreadable}), so the walks cannot be named; if it is there, reload to try again, or set haplotypeIndexLocation`,\n )\n }\n}\n\ninterface GbzHaplotype {\n prefix: string\n sample: string\n haplotype: number\n contigs: string[]\n isReference: boolean\n}\n\n/**\n * One lane the header declares, in the shape MultiWaySyntenyDisplay's lane\n * picker reads: `name` is the lane's assembly name, the same string the\n * fetched features' mates carry, `label` its PanSN prefix and `group` its\n * sample, so a diploid sample's two lanes sit together\n */\ninterface GbzHeaderLane {\n name: string\n label: string\n group: string\n}\n\nexport { PairTargetError } from '../synteny/lanePairs.ts'\n\nclass HaplotypeWindowError extends Error {\n override name = 'HaplotypeWindowError'\n\n constructor(assemblyName: string, anchor: string) {\n super(\n `the graph is cut on its reference, ${anchor}; a window on ${assemblyName} has no reference coordinates to cut at. Open the graph from a ${anchor} view, and find this haplotype's lane there`,\n )\n }\n}\n\ntype ResolvedAlignment = Extract<HaplotypeAlignment, { resolved: true }>\n\n/**\n * The id of one haplotype fragment: the walk's GBWT position at its first node\n * in the window, which is a property of the graph, so the same fragment gets\n * the same id on a refetch of the same window and the display's hover and\n * selection survive it. `clipToRegion` suffixes the window.\n */\nfunction fragmentId(name: PathName, alignment: ResolvedAlignment) {\n return `${haplotypePrefix(name)}#${name.contig}@${alignment.start.node}.${alignment.start.offset}`\n}\n\nfunction fragmentFeature({\n alignment,\n assemblyName,\n refName,\n lane,\n}: {\n alignment: ResolvedAlignment\n assemblyName: string\n refName: string\n lane: string\n}) {\n const { refStart, refEnd, strand, cigar } = alignment\n if (refEnd <= refStart) {\n return undefined\n } else {\n const { name, hapStart, hapEnd } = alignment\n const id = fragmentId(name, alignment)\n const data: SimpleFeatureSerialized = {\n uniqueId: id,\n assemblyName,\n refName,\n start: refStart,\n end: refEnd,\n type: 'match',\n strand: strand === '-' ? -1 : 1,\n CIGAR: cigar,\n syntenyId: id,\n mate: {\n refName: name.contig,\n start: hapStart,\n end: hapEnd,\n assemblyName: lane,\n },\n }\n return new SyntenyFeature(data)\n }\n}\n\n// gbz-base writes the CIGAR along the target, which is the side a JBrowse\n// feature is, so it passes through unchanged\nfunction pairFeature({\n pair,\n lane,\n mateLane,\n}: {\n pair: PairAlignment\n lane: string\n mateLane: string\n}) {\n return matchFeature({\n target: {\n name: `${haplotypePrefix(pair.target)}#${pair.target.contig}`,\n assemblyName: lane,\n refName: pair.target.contig,\n start: pair.targetStart,\n end: pair.targetEnd,\n },\n query: {\n name: `${haplotypePrefix(pair.query)}#${pair.query.contig}`,\n assemblyName: mateLane,\n refName: pair.query.contig,\n start: pair.queryStart,\n end: pair.queryEnd,\n },\n strand: pair.strand,\n cigar: pair.cigar,\n matches: pair.matches,\n columns: pair.columns,\n })\n}\n\n// The longest detour a pair cut widens its context to take in\nconst BRIDGE_MAX_BP = 120_000\n\n/**\n * The widest gap, up to `BRIDGE_MAX_BP`, between two pieces of one kept walk:\n * a haplotype that left the cut's nodes for sequence the reference lacks and\n * came back. Two kept haplotypes that share that sequence only align across it\n * once its nodes are in the cut.\n */\nexport function widestWalkGap(subgraphs: Subgraph[], kept: Set<string>) {\n const byPath = new Map<string, [number, number][]>()\n for (const subgraph of subgraphs) {\n for (const { name, start, end } of subgraph.walkSpans()) {\n const prefix = haplotypePrefix(name)\n if (kept.has(prefix)) {\n const key = `${prefix}#${name.contig}`\n const spans = byPath.get(key)\n if (spans) {\n spans.push([start, end])\n } else {\n byPath.set(key, [[start, end]])\n }\n }\n }\n }\n let widest = 0\n for (const spans of byPath.values()) {\n spans.sort((a, b) => a[0] - b[0])\n for (let i = 1; i < spans.length; i++) {\n const gap = spans[i]![0] - spans[i - 1]![1]\n if (gap > 0 && gap <= BRIDGE_MAX_BP) {\n widest = Math.max(widest, gap)\n }\n }\n }\n return widest\n}\n\n// A window past the node limit fails as a zoom-in notice naming a span that\n// fits\nfunction zoomInNotice(error: unknown, what: string) {\n if (error instanceof NodeLimitError) {\n error.message = `Zoom in to about ${getBpDisplayStr(error.fitsBp)} to see ${what}`\n }\n return error\n}\n\nconst laneLimitNotice = (error: unknown, nodeLimit: number, windowBp: number) =>\n laneZoomNotice(\n zoomInNotice(nodeLimitError(error, nodeLimit, windowBp) ?? error, 'lanes'),\n windowBp,\n )\n\n// gbz-base reads whole bp; a view asks at fractional ones\nconst wholeBp = (region: Region) => ({\n ...region,\n start: Math.floor(region.start),\n end: Math.ceil(region.end),\n})\n\nexport default class GbzBaseSyntenyAdapter extends ComparativeAdapterBase<GbzBaseSyntenyAdapterConfig> {\n private graph = cachedSetup({\n label: 'Opening pangenome database',\n setup: async () => {\n const gbzDb: FileLocation = this.getConf('gbzDbLocation')\n const configured: FileLocation = this.getConf('haplotypeIndexLocation')\n const companion = locationIsSet(configured)\n ? { location: configured }\n : await findCompanion(gbzDb, this.pluginManager)\n const indexLocation = companion.location\n const db = await GBZBase.open({\n source: openLocation(gbzDb, this.pluginManager),\n haplotypeIndex: indexLocation\n ? openLocation(indexLocation, this.pluginManager)\n : undefined,\n })\n const anchor = this.getConf('assemblyNames')[0]\n if (anchor === undefined) {\n throw new Error(\n 'GbzBaseSyntenyAdapter needs assemblyNames: its first entry is the assembly the reference sample is loaded as',\n )\n }\n const referenceSamples = await referenceSamplesOf(db)\n const referenceSample = resolveReferenceSample({\n configured: this.getConf('referenceSample'),\n anchorPrefix: resolvePanSNPrefix(this, anchor),\n referenceSamples,\n })\n return {\n db,\n anchor,\n referenceSample,\n referenceSamples,\n unreadableIndex: companion.unreadable,\n }\n },\n })\n\n /**\n * The indexed reference path a window on `refName` resolves against, or\n * undefined when the reference sample has no indexed path by that contig.\n */\n private async referenceQuery(\n refName: string,\n opts: BaseOptions,\n ): Promise<PathQuery | undefined> {\n const { db, referenceSample } = await this.graph(opts)\n return referencePathQuery(db, referenceSample, refName)\n }\n\n /**\n * Every haplotype the graph carries a walk for, `sample#haplotype` with its\n * contigs, from the Paths scan the adapter already makes; the lane picker's\n * source list. Reference samples are included and flagged.\n */\n async getHaplotypes(opts: BaseOptions = {}): Promise<GbzHaplotype[]> {\n const { db, referenceSamples } = await this.graph(opts)\n const byPrefix = new Map<string, GbzHaplotype>()\n for (const path of await db.paths()) {\n const prefix = haplotypePrefix(path.name)\n const entry = byPrefix.get(prefix)\n if (entry) {\n if (!entry.contigs.includes(path.name.contig)) {\n entry.contigs.push(path.name.contig)\n }\n } else {\n byPrefix.set(prefix, {\n prefix,\n sample: path.name.sample,\n haplotype: path.name.haplotype,\n contigs: [path.name.contig],\n isReference: referenceSamples.includes(path.name.sample),\n })\n }\n }\n return [...byPrefix.values()]\n }\n\n /**\n * `lanes` is every haplotype but the reference sample's own, which is the\n * anchor rather than a lane, declared up front so the display can offer the\n * whole graph's haplotypes before a fetch has placed any of them.\n */\n async getHeader(opts: BaseOptions = {}) {\n const { anchor, referenceSample } = await this.graph(opts)\n const asmByPrefix = assemblyByPanSNPrefix(this)\n const lanes: GbzHeaderLane[] = []\n for (const haplotype of await this.getHaplotypes(opts)) {\n if (haplotype.sample !== referenceSample) {\n lanes.push({\n name: laneAssemblyName(asmByPrefix, haplotype.prefix),\n label: haplotype.prefix,\n group: haplotype.sample,\n })\n }\n }\n return {\n hasCoarseTier: false,\n anchorAssemblyName: anchor,\n lanes,\n }\n }\n\n async getRefNames(opts: BaseOptions = {}) {\n const { db, anchor, referenceSample } = await this.graph(opts)\n const { assemblyName } = opts\n const prefix =\n assemblyName === anchor\n ? undefined\n : resolvePanSNPrefix(this, assemblyName)\n const contigs = (await db.paths())\n .filter(path =>\n assemblyName === anchor\n ? path.isIndexed && path.name.sample === referenceSample\n : panSNMatchesPrefix(haplotypePrefix(path.name), prefix),\n )\n .map(path => path.name.contig)\n return [...new Set(contigs)]\n }\n\n /**\n * The predicate gbz-base builds a window for, from the lanes a fetch asks\n * for. With a companion whose stray rows cover the window gbz-base walks\n * only the wanted haplotypes; otherwise it names every walk and keeps the\n * ones the predicate accepts, and throws rather than guess when a walk has\n * no name. Either way a cut holds those walks, the reference, and the nodes\n * they visit. Undefined when every haplotype is wanted.\n */\n //\n // `targetPrefix` is a pairwise view's one lane, and it belongs in here: left\n // to filter what came back, it handed gbz-base no predicate, and every\n // haplotype in the graph was walked for one to be kept.\n private keepPredicate(\n haplotypes: string[] | undefined,\n targetPrefix?: string,\n ) {\n const wantedPrefixes =\n haplotypes === undefined || haplotypes.length === 0\n ? undefined\n : haplotypes.map(lane => resolvePanSNPrefix(this, lane))\n return wantedPrefixes === undefined && targetPrefix === undefined\n ? undefined\n : (name: PathName) =>\n haplotypeWanted(name, wantedPrefixes) &&\n (targetPrefix === undefined ||\n panSNMatchesPrefix(haplotypePrefix(name), targetPrefix))\n }\n\n /**\n * The graph view's cut of the window, as tables: the reference walk, every\n * top-level snarl contained in it, and one walk per haplotype, PanSN-named\n * when the database (or its companion) carries the haplotype index and\n * `unknown#N` otherwise. The reference walk is the first, which is the one\n * the view anchors on by default. With `haplotypes` the walks are that\n * set's and the nodes those walks visit, the reference walk kept. With\n * `walkRows` the rows' runs come along, as on a walk-file cut.\n *\n * Only a window on the anchor can be cut: a haplotype lane's coordinates\n * are its own contig's, and the graph is indexed for random access on the\n * reference sample's paths alone.\n */\n async getSubgraph(region: Region, opts: SubgraphAdapterOptions = {}) {\n const { signal } = opts\n const { db, anchor, referenceSample, unreadableIndex } = await this.graph({\n signal,\n })\n const { assemblyName, refName, start, end } = wholeBp(region)\n if (assemblyName !== anchor) {\n throw new HaplotypeWindowError(assemblyName, anchor)\n }\n const query = await this.referenceQuery(refName, { signal })\n if (!query) {\n throw new Error(\n `${referenceSample} has no indexed path ${refName} in this graph`,\n )\n }\n const keep = this.keepPredicate(opts.haplotypes)\n if (keep !== undefined && !db.hasHaplotypeIndex) {\n throw new NoHaplotypeIndexError(unreadableIndex)\n }\n const cut = await cutWindowTables(db, query, start, end, {\n context: this.getConf('context'),\n snarls: opts.snarls ?? this.getConf('subgraphSnarls'),\n limit: this.getConf('nodeLimit'),\n signal: opts.signal,\n keep,\n }).catch((error: unknown) => {\n throw zoomInNotice(error, 'the graph')\n })\n return typeof cut === 'string'\n ? cut\n : walkCutFor(cut, { start, end }, opts.walkRows)\n }\n\n private gaf = cachedSetup({\n label: 'Opening reads',\n setup: async () => {\n const location: FileLocation = this.getConf('readsLocation')\n const index: FileLocation = this.getConf(['readsIndex', 'location'])\n return locationIsSet(location)\n ? new GafFile(\n openLocation(location, this.pluginManager),\n locationIsSet(index)\n ? openTabixSlot(this, ['readsLocation'], ['readsIndex'])\n : undefined,\n )\n : undefined\n },\n })\n\n /**\n * The reads over a cut's segments, from `readsLocation`, sampled down to\n * what the tube map lays out at interactive speed\n */\n async getReads(\n nodeNames: string[],\n opts: BaseOptions = {},\n ): Promise<GafReads> {\n const gaf = await this.gaf(opts)\n return gaf\n ? gaf.readsOver(new Set(nodeNames), opts)\n : { records: [], total: 0 }\n }\n\n private async laneHaplotypes(\n assemblyName: string,\n opts: BaseOptions,\n ): Promise<HaplotypeRef[]> {\n const prefix = resolvePanSNPrefix(this, assemblyName)\n return (await this.getHaplotypes(opts)).filter(haplotype =>\n panSNMatchesPrefix(haplotype.prefix, prefix),\n )\n }\n\n private async anchorFeatures(region: Region, opts: LaneFeatureOptions) {\n const { db } = await this.graph(opts)\n const { assemblyName, refName, start, end } = region\n const targetPrefix = resolvePanSNPrefix(this, opts.targetAssemblyName)\n const asmByPrefix = assemblyByPanSNPrefix(this)\n const keep = this.keepPredicate(opts.haplotypes, targetPrefix)\n const query = await this.referenceQuery(refName, opts)\n const nodeLimit: number = this.getConf('nodeLimit')\n const alignments = query\n ? await updateStatus(\n `Reading graph ${refName}:${start.toLocaleString()}-${end.toLocaleString()}`,\n opts.statusCallback,\n () =>\n db\n .getAlignments({\n path: query,\n start,\n end,\n context: this.getConf('context'),\n haplotypes: 'all',\n limit: nodeLimit,\n signal: opts.signal,\n keep,\n })\n .catch((error: unknown) => {\n throw laneLimitNotice(error, nodeLimit, end - start)\n }),\n )\n : []\n return alignments.flatMap(alignment => {\n const feature = alignment.resolved\n ? fragmentFeature({\n alignment,\n assemblyName,\n refName,\n lane: laneAssemblyName(\n asmByPrefix,\n haplotypePrefix(alignment.name),\n ),\n })\n : undefined\n return feature === undefined ? [] : [feature]\n })\n }\n\n /**\n * Each pair's two lanes cut out of the anchor window alone, all pairs in one\n * cut, and each walk of a pair's query lane aligned to each walk of its\n * target lane on the nodes both visit, with no base compared. A pair's\n * records sit on its query lane's contigs, the lane the display draws on top.\n *\n * Whether the index has anchor rows changes only how fast gbz-base finds\n * the walks: both routes cut the same pieces.\n */\n private async pairFeatures(\n region: Region,\n pairs: LanePair[],\n opts: LaneFeatureOptions,\n ) {\n const { db } = await this.graph(opts)\n const { refName, start, end } = region\n const sides = await Promise.all(\n pairs.map(async pair => ({\n pair,\n featureSide: await this.laneHaplotypes(pair.queryAssemblyName, opts),\n mateSide: await this.laneHaplotypes(pair.targetAssemblyName, opts),\n })),\n )\n const answerable = sides.filter(\n ({ featureSide, mateSide }) =>\n featureSide.length > 0 && mateSide.length > 0,\n )\n const kept = new Set(\n answerable.flatMap(({ featureSide, mateSide }) =>\n [...featureSide, ...mateSide].map(haplotypePrefix),\n ),\n )\n const query = await this.referenceQuery(refName, opts)\n const nodeLimit: number = this.getConf('nodeLimit')\n const baseContext: number = this.getConf('context')\n const cut = (path: PathQuery, context: number) =>\n db.getSubgraphs({\n path,\n start,\n end,\n context,\n snarls: this.getConf('subgraphSnarls'),\n haplotypes: 'all',\n limit: nodeLimit,\n signal: opts.signal,\n keep: name => kept.has(haplotypePrefix(name)),\n })\n // a cut past the node limit for the wider context keeps the first one\n const bridged = async (path: PathQuery) => {\n const subgraphs = await cut(path, baseContext).catch((error: unknown) => {\n throw laneLimitNotice(error, nodeLimit, end - start)\n })\n const gap = widestWalkGap(subgraphs, kept)\n const context = Math.ceil(gap / 2) + 2000\n return gap > 0 && context > baseContext\n ? cut(path, context).catch((error: unknown) => {\n if (error instanceof SubgraphLimitError) {\n return subgraphs\n }\n throw error\n })\n : subgraphs\n }\n const subgraphs =\n query && answerable.length > 0\n ? await updateStatus(lanePairsStatus(pairs), opts.statusCallback, () =>\n bridged(query),\n )\n : []\n return subgraphs.flatMap(subgraph =>\n answerable.flatMap(({ pair, featureSide, mateSide }) =>\n featureSide.flatMap(target =>\n mateSide.flatMap(mate =>\n subgraph\n .pairAlignments({ target, query: mate, bases: false })\n .map(alignment =>\n pairFeature({\n pair: alignment,\n lane: pair.queryAssemblyName,\n mateLane: pair.targetAssemblyName,\n }),\n ),\n ),\n ),\n ),\n )\n }\n\n getFeatures(asked: Region, opts: LaneFeatureOptions = {}) {\n const region = wholeBp(asked)\n return ObservableCreate<Feature>(async observer => {\n const { db, anchor, unreadableIndex } = await this.graph(opts)\n if (!db.hasHaplotypeIndex) {\n throw new NoHaplotypeIndexError(unreadableIndex)\n }\n // the graph is indexed on its reference alone, so a window on a\n // haplotype lane has no answer: a lane pair is read inside the anchor's\n if (region.assemblyName === anchor) {\n const pairs = requestedPairs(opts)\n const features =\n pairs.length > 0\n ? await this.pairFeatures(region, pairs, opts)\n : await this.anchorFeatures(region, opts)\n for (const feature of features) {\n observer.next(feature)\n }\n }\n observer.complete()\n }, opts.signal)\n }\n}\n"],
|
|
5
|
-
"mappings": "g2BAsBA,SAASA,EAAqBC,EAAI,CAChC,IAAMC,EAAS,cACf,OAAOA,EAAO,KAAKD,CAAE,EAAIA,EAAG,QAAQC,EAAQ,qBAAqB,EAAI,MACvE,CCjBO,SAASC,GAAiBC,EAAqB,CACpD,OAAOC,EAAcD,CAAK,GAAKE,EAAqBC,EAAaH,CAAK,CAAC,EACnEI,EAAQJ,EAAOK,GAAQH,EAAqBG,CAAI,CAAE,EAClD,MACN,CAIA,SAASC,GAAUC,EAAgB,CACjC,OACEA,aAAiB,QAChB,kBAAkB,KAAKA,EAAM,OAAO,GAClCA,EAA6B,OAAS,SAE7C,CAIA,eAAsBC,GACpBR,EACAS,EAC2D,CAC3D,IAAMC,EAAYX,GAAiBC,CAAK,EACxC,GAAI,CAACU,EACH,MAAO,CAAC,EAEV,GAAI,CACF,aAAMC,EAAaD,EAAWD,CAAa,EAAE,KAAK,EAC3C,CAAE,SAAUC,CAAU,CAC/B,OAASH,EAAO,CACd,OAAOD,GAAUC,CAAK,EAAI,CAAC,EAAI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AM,OAAS,EACX,MAAM,KAAK,aAAajD,EAAQiD,EAAO3B,CAAI,EAC3C,MAAM,KAAK,eAAetB,EAAQsB,CAAI,EAC5C,QAAW0B,KAAWgB,EACpBF,EAAS,KAAKd,CAAO,CAEzB,CACAc,EAAS,SAAS,CACpB,EAAGxC,EAAK,MAAM,CAChB,CACF",
|
|
6
|
-
"names": ["haplotypeIndexBeside", "db", "GBZ_DB", "siblingCompanion", "gbzDb", "readsSiblings", "haplotypeIndexBeside", "locationName", "renamed", "name", "isMissing", "error", "findCompanion", "pluginManager", "candidate", "openLocation", "MAX_READS", "MAX_UNINDEXED_BYTES", "UnindexedGafTooLargeError", "size", "sample", "records", "max", "stride", "_", "k", "touches", "record", "names", "step", "GafFile", "file", "tabix", "cachedSetup", "signal", "bytes", "text", "unzip", "parseGaf", "lo", "hi", "name", "id", "line", "parseGafLine", "r", "NoHaplotypeIndexError", "unreadable", "HaplotypeWindowError", "assemblyName", "anchor", "fragmentId", "name", "alignment", "haplotypePrefix", "fragmentFeature", "refName", "lane", "refStart", "refEnd", "strand", "cigar", "hapStart", "hapEnd", "id", "data", "SyntenyFeature", "pairFeature", "pair", "mateLane", "matchFeature", "BRIDGE_MAX_BP", "widestWalkGap", "subgraphs", "kept", "byPath", "subgraph", "start", "end", "prefix", "key", "spans", "widest", "a", "b", "i", "gap", "zoomInNotice", "error", "what", "NodeLimitError", "getBpDisplayStr", "laneLimitNotice", "nodeLimit", "windowBp", "laneZoomNotice", "nodeLimitError", "wholeBp", "region", "GbzBaseSyntenyAdapter", "ComparativeAdapterBase", "cachedSetup", "gbzDb", "configured", "companion", "locationIsSet", "findCompanion", "indexLocation", "db", "GBZBase", "openLocation", "referenceSamples", "referenceSamplesOf", "referenceSample", "resolveReferenceSample", "resolvePanSNPrefix", "location", "index", "GafFile", "openTabixSlot", "opts", "referencePathQuery", "byPrefix", "path", "entry", "asmByPrefix", "assemblyByPanSNPrefix", "lanes", "haplotype", "laneAssemblyName", "contigs", "panSNMatchesPrefix", "haplotypes", "targetPrefix", "wantedPrefixes", "haplotypeWanted", "signal", "unreadableIndex", "query", "keep", "cut", "cutWindowTables", "walkCutFor", "nodeNames", "gaf", "updateStatus", "feature", "pairs", "answerable", "featureSide", "mateSide", "baseContext", "context", "bridged", "SubgraphLimitError", "lanePairsStatus", "target", "mate", "asked", "ObservableCreate", "observer", "requestedPairs", "features"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as b}from"./chunk-YKSUKPYY.js";import"./chunk-JCAZTNYG.js";import{a as N}from"./chunk-KOB7YIMR.js";import"./chunk-YBLNN5FU.js";import"./chunk-6KUHGRHU.js";import"./chunk-6MUBJVBG.js";import{b as g,h as c,i as u,j as h,k as w,p as m,q as k,r as x}from"./chunk-B2EP6FOQ.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-7HWHWPRW.js";import{d}from"./chunk-IKJZPPOA.js";import"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{a as p,o as f}from"./chunk-TENPGIPX.js";var l=class extends g{constructor(){super(...arguments);this.fine=this.openIndex([])}static{this.capabilities=["getFeatures","getRefNames"]}openIndex(e){let t=m(this,[...e,"segmentsLocation"],[...e,"segmentsIndex"]),s=m(this,[...e,"linksLocation"],[...e,"linksIndex"]),n=this.getConf("walksLocation"),i=e.length===0&&d(n)?new b(m(this,["walksLocation"],["walksIndex"]),this):void 0;return{segments:t,links:s,walks:i,refNames:new x(i?.file??t,this)}}async getHaplotypeNames(e={}){return this.fine.walks?.haplotypeNames(e)}index(e="fine"){return e==="fine"?this.fine:(this.coarse??=this.openIndex(["coarse"]),this.coarse)}async getRefNames(e={}){return this.fine.refNames.assemblyRefNames(e)}async getRegionByteSize(e,t={}){let{walks:s,refNames:n}=this.fine;return n.regionBytes(e,t,s&&(i=>s.reader.queryStart(i,t)))}async hasDataForRefName(){return!0}getFeatures(e,t={}){return N(async s=>{let n=await this.fine.refNames.resolveMapped(e,t);if(n!==void 0){let{walks:i}=this.fine,a=r=>{s.next(r)};await(i?this.walkFeatures(i,n,e,t,a):this.segmentFeatures(n,e,t,a))}s.complete()},t.signal)}async walkFeatures(e,t,s,n,i){let a=await f("Downloading walks",n.statusCallback,()=>e.referenceNodes(t,s,n));for(let r of a){let o=String(r.id);i(new p({uniqueId:o,refName:s.refName,start:r.start,end:r.end,name:o,type:"segment",rank:0,stableName:r.refName}))}}async segmentFeatures(e,t,s,n){await f("Downloading segments",s.statusCallback,()=>w(this.fine.segments,e,t.start,t.end,{signal:s.signal,lineCallback:i=>{let{segment:a,anchored:r}=c(i);if(r&&a.refName!==e)return;let o=u(a);n(new p({uniqueId:a.id,refName:t.refName,start:a.start,end:a.end,name:a.id,type:"segment",rank:a.rank,stableName:a.refName,...o&&{samples:o,sampleCount:o.length}}))}}))}async getSubgraph(e,t={}){let{hops:s,signal:n,tier:i}=t,a=this.index(i),r=await a.refNames.resolve(e,{signal:n});if(r===void 0)throw new Error(k(e));return a.walks?a.walks.subgraph(r,e,t):h(a,{refName:r,start:e.start,end:e.end},{hops:s,signal:n})}};export{l as default};
|
|
2
|
-
//# sourceMappingURL=RgfaTabixAdapter-O3NMNRZ2.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/RgfaTabixAdapter/RgfaTabixAdapter.ts"],
|
|
4
|
-
"sourcesContent": ["import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { SimpleFeature, updateStatus } from '@jbrowse/core/util'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\nimport { parseSegmentRow, rgfaCut, segmentSamples } from '@jbrowse/graph-walks'\n\nimport { locationIsSet } from '../locationName.ts'\nimport {\n PanSNRefNames,\n openTabixSlot,\n unmappedRegionMessage,\n} from '../panSNTabix.ts'\nimport { getLines } from '../tabixRange.ts'\nimport { WalkIndex } from './walkReader.ts'\n\nimport type { RgfaTabixAdapterConfig } from './configSchema.ts'\nimport type { SubgraphAdapterOptions, SubgraphTier } from '../GetSubgraph.ts'\nimport type { WalkCut } from './walkCut.ts'\nimport type { TabixIndexedFile } from '@gmod/tabix'\nimport type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { Feature } from '@jbrowse/core/util'\nimport type { FileLocation, Region } from '@jbrowse/core/util/types'\n\ninterface GraphIndex {\n segments: TabixIndexedFile\n links: TabixIndexedFile\n walks?: WalkIndex\n refNames: PanSNRefNames\n}\n\nexport default class RgfaTabixAdapter extends BaseFeatureDataAdapter<RgfaTabixAdapterConfig> {\n public static capabilities = ['getFeatures', 'getRefNames']\n\n private readonly fine = this.openIndex([])\n private coarse: GraphIndex | undefined\n\n // refNames off the SEGMENT index: it is the one that names every stable\n // sequence the graph is anchored to, where the link index only names those a\n // link touches. A walk-indexed graph's walk file names the same sequences,\n // and it has no segment file.\n private openIndex(under: string[]): GraphIndex {\n const segments = openTabixSlot(\n this,\n [...under, 'segmentsLocation'],\n [...under, 'segmentsIndex'],\n )\n const links = openTabixSlot(\n this,\n [...under, 'linksLocation'],\n [...under, 'linksIndex'],\n )\n const walksLocation: FileLocation = this.getConf('walksLocation')\n const walks =\n under.length === 0 && locationIsSet(walksLocation)\n ? new WalkIndex(\n openTabixSlot(this, ['walksLocation'], ['walksIndex']),\n this,\n )\n : undefined\n return {\n segments,\n links,\n walks,\n refNames: new PanSNRefNames(walks?.file ?? segments, this),\n }\n }\n\n /**\n * The haplotypes a walk-indexed graph's header names, `sample#haplotype`\n * in byte order, or undefined when it names none\n */\n async getHaplotypeNames(opts: BaseOptions = {}) {\n return this.fine.walks?.haplotypeNames(opts)\n }\n\n private index(tier: SubgraphTier = 'fine') {\n if (tier === 'fine') {\n return this.fine\n }\n this.coarse ??= this.openIndex(['coarse'])\n return this.coarse\n }\n\n async getRefNames(opts: BaseOptions = {}) {\n return this.fine.refNames.assemblyRefNames(opts)\n }\n\n // getFeatures reads a walk file from the chunk before the window\n async getRegionByteSize(regions: Region[], opts: BaseOptions = {}) {\n const { walks, refNames } = this.fine\n return refNames.regionBytes(\n regions,\n opts,\n walks && (start => walks.reader.queryStart(start, opts)),\n )\n }\n\n public async hasDataForRefName() {\n return true\n }\n\n getFeatures(query: Region, opts: BaseOptions = {}) {\n return ObservableCreate<Feature>(async observer => {\n const tabixRefName = await this.fine.refNames.resolveMapped(query, opts)\n if (tabixRefName !== undefined) {\n const { walks } = this.fine\n const emit = (feature: Feature) => {\n observer.next(feature)\n }\n await (walks\n ? this.walkFeatures(walks, tabixRefName, query, opts, emit)\n : this.segmentFeatures(tabixRefName, query, opts, emit))\n }\n observer.complete()\n }, opts.signal)\n }\n\n // A walk-indexed graph's reference nodes are its ref rows' steps\n private async walkFeatures(\n walks: WalkIndex,\n tabixRefName: string,\n query: Region,\n opts: BaseOptions,\n emit: (feature: Feature) => void,\n ) {\n const nodes = await updateStatus(\n 'Downloading walks',\n opts.statusCallback,\n () => walks.referenceNodes(tabixRefName, query, opts),\n )\n for (const node of nodes) {\n const id = String(node.id)\n emit(\n new SimpleFeature({\n uniqueId: id,\n refName: query.refName,\n start: node.start,\n end: node.end,\n name: id,\n type: 'segment',\n rank: 0,\n stableName: node.refName,\n }),\n )\n }\n }\n\n private async segmentFeatures(\n tabixRefName: string,\n query: Region,\n opts: BaseOptions,\n emit: (feature: Feature) => void,\n ) {\n await updateStatus('Downloading segments', opts.statusCallback, () =>\n getLines(this.fine.segments, tabixRefName, query.start, query.end, {\n signal: opts.signal,\n lineCallback: line => {\n const { segment, anchored } = parseSegmentRow(line)\n // An anchored index also returns the alleles under the region,\n // which lie on other stable sequences and have no place on this one\n if (anchored && segment.refName !== tabixRefName) {\n return\n }\n // `samples` lists the haplotypes whose paths visit the segment and\n // `sampleCount` counts them. A lane's color reads the count, and\n // a count in jexl would otherwise rely on `.length` resolving\n // through a member access on an array.\n const samples = segmentSamples(segment)\n emit(\n new SimpleFeature({\n uniqueId: segment.id,\n refName: query.refName,\n start: segment.start,\n end: segment.end,\n name: segment.id,\n type: 'segment',\n rank: segment.rank,\n stableName: segment.refName,\n ...(samples && { samples, sampleCount: samples.length }),\n }),\n )\n },\n }),\n )\n }\n\n // The graph around a region for GraphGenomeView: GFA text (rgfaCut), or a\n // walk-indexed graph's tables (WalkIndex.subgraph). `tier: 'coarse'` reads\n // the `coarse` pair instead, the same way.\n async getSubgraph(\n region: Region,\n opts: SubgraphAdapterOptions = {},\n ): Promise<string | WalkCut> {\n const { hops, signal, tier } = opts\n const index = this.index(tier)\n const tabixRefName = await index.refNames.resolve(region, { signal })\n if (tabixRefName === undefined) {\n throw new Error(unmappedRegionMessage(region))\n }\n if (index.walks) {\n return index.walks.subgraph(tabixRefName, region, opts)\n }\n return rgfaCut(\n index,\n { refName: tabixRefName, start: region.start, end: region.end },\n { hops, signal },\n )\n }\n}\n"],
|
|
5
|
-
"mappings": "ufA6BA,IAAqBA,EAArB,cAA8CC,CAA+C,CAA7F,kCAGE,KAAiB,KAAO,KAAK,UAAU,CAAC,CAAC,EAFzC,YAAc,aAAe,CAAC,cAAe,aAAa,EASlD,UAAUC,EAA6B,CAC7C,IAAMC,EAAWC,EACf,KACA,CAAC,GAAGF,EAAO,kBAAkB,EAC7B,CAAC,GAAGA,EAAO,eAAe,CAC5B,EACMG,EAAQD,EACZ,KACA,CAAC,GAAGF,EAAO,eAAe,EAC1B,CAAC,GAAGA,EAAO,YAAY,CACzB,EACMI,EAA8B,KAAK,QAAQ,eAAe,EAC1DC,EACJL,EAAM,SAAW,GAAKM,EAAcF,CAAa,EAC7C,IAAIG,EACFL,EAAc,KAAM,CAAC,eAAe,EAAG,CAAC,YAAY,CAAC,EACrD,IACF,EACA,OACN,MAAO,CACL,SAAAD,EACA,MAAAE,EACA,MAAAE,EACA,SAAU,IAAIG,EAAcH,GAAO,MAAQJ,EAAU,IAAI,CAC3D,CACF,CAMA,MAAM,kBAAkBQ,EAAoB,CAAC,EAAG,CAC9C,OAAO,KAAK,K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segments", "openTabixSlot", "links", "walksLocation", "walks", "locationIsSet", "WalkIndex", "PanSNRefNames", "opts", "tier", "regions", "refNames", "start", "query", "ObservableCreate", "observer", "tabixRefName", "emit", "feature", "nodes", "updateStatus", "node", "id", "SimpleFeature", "getLines", "line", "segment", "anchored", "parseSegmentRow", "samples", "segmentSamples", "region", "hops", "signal", "index", "unmappedRegionMessage", "rgfaCut"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{B as Yt,C as jt,D as Et,E as xt,M as Vt,N as lt,a as Gt,k as Wt,l as gt,n as Bt,o as $t,p as Xt,q as Kt,u as Ut}from"./chunk-PEDWEPNK.js";import{a as J,g as Q}from"./chunk-6MUBJVBG.js";function p(t,e,n,o){return(o<<24|n<<16|e<<8|t)>>>0}function Mt(t){return t&255}function _t(t){return t>>>8&255}function Rt(t){return t>>>16&255}function yt(t){return t>>>24&255}function zt(t){return`rgba(${Mt(t)},${_t(t)},${Rt(t)},${yt(t)/255})`}function me(t,e){return`rgba(${Math.round(t[0]*255)},${Math.round(t[1]*255)},${Math.round(t[2]*255)},${e})`}function j(t,e){return p(Mt(t),_t(t),Rt(t),Math.round(yt(t)*e))}function pe(t,e){let n=Math.max(0,1-1/e),o=r=>Math.round(r+(255-r)*n);return p(o(Mt(t)),o(_t(t)),o(Rt(t)),yt(t))}var qt=300,Z=.7,tt=.5;function An(t){return`hsl(${t}, ${Z*100}%, ${tt*100}%)`}function nt(t){return Math.max(0,Math.min(1,t))*qt}function At(t,e){return nt((t-e.start)/(e.end-e.start))}var bn=30;function Ee({start:t,bp:e,reversed:n},o){let r=At(t,o),s=At(t+e,o);if(s-r<1)return[(r+s)/2];let a=Math.ceil((s-r)/bn);return Array.from({length:a+1},(c,i)=>At(t+e*(n?a-i:i)/a,o))}var vn=Array.from({length:7},(t,e)=>({offset:e/6,color:An(e/6*qt)})),xe=`linear-gradient(to right, ${vn.map(t=>`${t.color} ${t.offset*100}%`).join(", ")})`;var Cn=Gt();function Jt(t,e,n,o,r,s,a=!1){return Cn(t,[e,n.scaleX,n.scaleY,o,s,a,r],()=>{let c=new Map;for(let i=0;i<e.edges.length;i++){let l=o?.get(i),d=Ut(t,e.edges[i],n,l,l&&s?.[i],a);d&&c.set(i,d)}return c})}var Sn=4;function In(t){let e=new Map;for(let n of t.edges)J(e,n.from,n.to),J(e,n.to,n.from);return e}function wn({nodeId:t,nodeById:e,neighbors:n}){let o=new Set([t]),r=[t],s=1/0,a=-1/0;for(let c=0;c<Sn&&r.length>0;c++){let i=[];for(let l of r){let d=n.get(l);if(d){for(let m of d)if(!o.has(m)){o.add(m);let h=e.get(m);h&&Q(h)?(s=Math.min(s,h.stable.start+h.length),a=Math.max(a,h.stable.start)):i.push(m)}}}r=i}return s===1/0?void 0:{start:Math.min(s,a),end:Math.max(s,a)}}function Tn({nodeId:t,nodeById:e,neighbors:n}){let o=e.get(t);return o===void 0?void 0:Q(o)?{start:o.stable.start,end:o.stable.start+o.length}:wn({nodeId:t,nodeById:e,neighbors:n})}function Qt(t){let e=new Map(t.nodes.map(r=>[r.id,r])),n=In(t),o=new Map;for(let r of t.nodes){let s=Tn({nodeId:r.id,nodeById:e,neighbors:n});s&&o.set(r.id,(s.start+s.end)/2)}return o}var Nn=p(119,119,119,217),Zt=p(136,136,136,217),Ln=p(24,24,28,240),On=2.2,cn=p(160,160,160,255),et=.18,Pe=zt(j(cn,et)),kn=11,Pn=1.2,tn=4,Dn=1e-6,Fn=7,Hn=3,Gn=3,Wn=1.5,nn=3,Bn=.5,$n=.45,bt=12,Xn=1e-6,w=new Float64Array(64),D=new Float64Array(64),F=new Float64Array(64);function Kn(t,e,n,o){let r=t.length*bt+1;w.length<r&&(w=new Float64Array(r),D=new Float64Array(r),F=new Float64Array(r));let s=t[t.length-1];w[0]=s.x1,D[0]=s.y1,F[0]=0;let a=1,c=0;for(let i=t.length-1;i>=0&&c<o;i--){let l=t[i];for(let d=1;d<=bt&&c<o;d++){let m=1-(d/bt)**2,h=1-m,_=h*h*h,M=3*h*h*m,T=3*h*m*m,A=m*m*m,N=_*l.x0+M*l.cx0+T*l.cx1+A*l.x1,L=_*l.y0+M*l.cy0+T*l.cy1+A*l.y1;c+=Math.hypot(N-w[a-1],(L-D[a-1])*n)*e,w[a]=N,D[a]=L,F[a]=c,a++}}return a}function en(t,e){let n=1;for(;n<t-1&&F[n]<e;)n++;let o=F[n-1],r=F[n],s=r>o?Math.min(1,Math.max(0,(e-o)/(r-o))):0;return{x:w[n-1]+(w[n]-w[n-1])*s,y:D[n-1]+(D[n]-D[n-1])*s}}function Un({curves:t,edgeHalfWidth:e,nodeHalfWidth:n,scale:o,yToX:r,color:s,fromSegments:a,toSegments:c}){let i=Fn+Hn*e,l=Kn(t,o,r,n+nn*i),d=F[l-1],m=d<Xn,h=Math.min(n,d),_=m?Math.min(1,Kt(a,o,o*r)/i):1;if(m?_<Bn:d<nn*i)return;let M=en(l,h),T=en(l,h+i*_),A=M.x-T.x,N=(M.y-T.y)*r,L=t[t.length-1];return{x:M.x,y:M.y,angle:Math.hypot(A,N)>0?Math.atan2(N,A):te(L,r,jn(L,c)),length:i*_,halfWidth:(Gn+Wn*e)*_,color:s}}function Yn(t,e,n,o,r){if(o)return Bt(t).from==="start";let s=a=>Math.hypot(a.x-n.x0,(a.y-n.y0)*r);return s(e[0])<s(e.at(-1))}function jn(t,e){if(e.length<2)return;let n=e[0],o=e[e.length-1];return Math.hypot(t.x1-n.x,t.y1-n.y)<=Math.hypot(t.x1-o.x,t.y1-o.y)?{from:n,to:e[1]}:{from:o,to:e[e.length-2]}}function on(t,e){if(!t||!e)return;let n=e.x-t.x,o=e.y-t.y,r=Math.hypot(n,o);return r>0?{nx:-o/r,ny:n/r}:void 0}function vt(t,e=1){let n=e===1?t:t.map(o=>({x:o.x,y:o.y*e}));return n.map((o,r)=>{let s=on(n[r-1],o),a=on(o,n[r+1]);if(s&&a){let c=(s.nx+a.nx)/2,i=(s.ny+a.ny)/2,l=s.nx*c+s.ny*i;return l>.1?{nx:c/l,ny:i/l}:{nx:c,ny:i}}return s??a??{nx:0,ny:0}})}function rn(t,e,n,o=1){return t.map((r,s)=>({x:r.x+e[s].nx*n,y:r.y+e[s].ny*n/o}))}function St(t,e,n){let o=(1-Math.abs(2*n-1))*e,r=o*(1-Math.abs(t/60%2-1)),s=n-o/2,a=0,c=0,i=0;return t<60?(a=o,c=r):t<120?(a=r,c=o):t<180?(c=o,i=r):t<240?(c=r,i=o):t<300?(a=r,i=o):(a=o,i=r),[a+s,c+s,i+s]}function ft(t,e,n,o=1){let[r,s,a]=St(t,e,n);return p(Math.round(r*255),Math.round(s*255),Math.round(a*255),Math.round(o*255))}var Vn=[[68,1,84],[59,82,139],[33,145,140],[94,201,98],[253,231,37]],zn=[[237,137,44],[158,42,122]],qn=[[220,50,50],[50,120,220]];function Ct(t,e){let n=Math.max(0,Math.min(1,e))*(t.length-1),o=Math.min(t.length-2,Math.floor(n)),r=n-o,s=t[o],a=t[o+1];return p(Math.round(s[0]+(a[0]-s[0])*r),Math.round(s[1]+(a[1]-s[1])*r),Math.round(s[2]+(a[2]-s[2])*r),255)}function Jn(t,e){return ft(Yt(t),Et,xt,e)}var ln=[60,65,72],It=p(...ln,255),De=`rgb(${ln.join(", ")})`;function Fe(t,e){let n=Qt(t);if(e&&e.end>e.start)return{start:e.start,span:e.end-e.start,midpoints:n};let o=1/0,r=-1/0;for(let s of n.values())o=Math.min(o,s),r=Math.max(r,s);return{start:o===1/0?0:o,span:r>o?r-o:1,midpoints:n}}function Qn(t,e){let n=1/0,o=-1/0,r=1/0,s=-1/0,a=0;for(let c of t.nodes)c.stable!==void 0&&c.stable.rank>a&&(a=c.stable.rank),c.depth<n&&(n=c.depth),c.depth>o&&(o=c.depth),c.length<r&&(r=c.length),c.length>s&&(s=c.length);return{minDepth:n,maxDepth:o,minLength:r,maxLength:s,maxRank:a,nodeCount:t.nodes.length,referenceRamp:e}}function Zn(t,e,n,o){switch(n){case"random":return Jn(t.id,1);case"depth":return Ct(Vn,o.maxDepth>o.minDepth?(t.depth-o.minDepth)/(o.maxDepth-o.minDepth):.5);case"node-length":return Ct(qn,o.maxLength>o.minLength?(t.length-o.minLength)/(o.maxLength-o.minLength):.5);case"stable-rank":return t.stable===void 0?p(160,160,160,255):t.stable.rank===0?p(52,152,219,255):Ct(zn,o.maxRank>1?(t.stable.rank-1)/(o.maxRank-1):0);case"reference-position":{let r=o.referenceRamp;if(r===void 0)return p(160,160,160,255);let s=r.midpoints.get(t.id);return!Q(t)||s===void 0?It:ft(nt((s-r.start)/r.span),Z,tt)}case"grey":return p(160,160,160,255);case"rainbow":{let r=o.nodeCount>1?e/o.nodeCount*360:0;return ft(r,.75,.5)}default:return p(52,152,219,255)}}function te(t,e=1,n){let o=[[t.cx1,t.cy1],[t.cx0,t.cy0],[t.x0,t.y0]];for(let[r,s]of o){let a=t.x1-r,c=(t.y1-s)*e;if(Math.hypot(a,c)>0)return Math.atan2(c,a)}return n?Math.atan2((n.to.y-n.from.y)*e,n.to.x-n.from.x):0}function ne(t,e){let n=!1;for(let o=0;o<t.length-1&&!n;o++){let r=t[o],s=t[o+1];n=Math.max(r.x,s.x)>=e.minX&&Math.min(r.x,s.x)<=e.maxX&&Math.max(r.y,s.y)>=e.minY&&Math.min(r.y,s.y)<=e.maxY}return n}function ee(t,e){for(let n of t){let o=Math.min(n.x0,n.cx0,n.cx1,n.x1),r=Math.max(n.x0,n.cx0,n.cx1,n.x1),s=Math.min(n.y0,n.cy0,n.cy1,n.y1),a=Math.max(n.y0,n.cy0,n.cy1,n.y1);if(r>=e.minX&&o<=e.maxX&&a>=e.minY&&s<=e.maxY)return!0}return!1}var sn=new WeakMap;function oe(t){let e=sn.get(t);if(!e){let n=[],o=new Map,r=t.paths??[];for(let s=0;s<r.length;s++)n.push(ft(jt(s,r.length),Et,xt,.85)),o.has(r[s].name)||o.set(r[s].name,s);e={pathColorByIndex:n,pathIndexByName:o},sn.set(t,e)}return e}var an=new WeakMap,re=new Map;function se(t){let e=an.get(t);if(!e){e=new Map;for(let[n,o]of(t.paths??[]).entries())for(let r of new Set(o.nodeIds))J(e,r,n);an.set(t,e)}return e}function He(t){let{nodePositions:e,graph:n,nodeById:o,colorScheme:r,contigThickness:s,connectorThickness:a,drawPaths:c,nodeWidth:i="uniform",highlight:l,axis:d,linearLayout:m,viewportBounds:h,referenceRamp:_,deletions:M,deletionRoutes:T,stranded:A,hiddenEdges:N,version:L=0}=t,ut=i==="depth"?Vt(n):0,ot=d.scaleX,dt=1/Math.max(ot,Dn),b=$t(d),gn=Jt(e,n,d,M,L,T,A),H=[],Nt=new Map,rt=[],Lt=new Map,G=[],Ot=new Map,En=Qn(n,_),kt=new Map;if(r==="rainbow")for(let f=0;f<n.nodes.length;f++)kt.set(n.nodes[f].id,f);let mt=n.paths?.length??0,{pathColorByIndex:Pt,pathIndexByName:xn}=oe(n),Mn=f=>Pt[xn.get(f)??-1]??Zt,_n=c&&mt>1?se(n):re,Rn=ot>(m?1:$n);for(let f=0;f<n.edges.length;f++){let u=n.edges[f],R=e[u.from],v=e[u.to],g=gn.get(f);if(!R?.length||!v?.length||!g||N?.has(f))continue;let W=u.pathIds?.length??0,V=M?.get(f)!==void 0,B=l?.edgeIndexes.has(f)??!1,$=a/2*(V?On:1),X=c&&W>0,O=V?Ln:Nn,C=!l||B?O:j(O,et),z=o.get(u.to),K=(z?lt(z,s,i,ut):s)/2,S=x=>!h||ee(x,h),k=(x,y,E)=>{if(V)for(let P of Wt(x,kn/ot))G.push({curves:P,thickness:y,color:E});else G.push({curves:x,thickness:y,color:E})},I=x=>{let y=Rn?Un({curves:x,edgeHalfWidth:a/2,nodeHalfWidth:K,scale:ot,yToX:b,color:C,fromSegments:R,toSegments:v}):void 0;y&&rt.push(y)},U=G.length,at=rt.length,ct=l?.walks.length&&B&&!X?l.walks:void 0;if(ct){let x=o.get(u.from),y=x?lt(x,s,i,ut):s,E=Math.max(y/ct.length,tn),P=vt(R,b),{nx:it,ny:q}=(Yn(u,R,g[0],A,b)?P[0]:P.at(-1))??{nx:0,ny:0};ct.forEach((Y,yn)=>{if(!Y.edgeIndexes.has(f))return;let pt=(yn-(ct.length-1)/2)*E*dt,Ht=pt===0?g:gt(g,it*pt,q*pt/b);S(Ht)&&k(Ht,E/2,Y.colors.get(u.from)??Y.colors.get(u.to)??O)}),G.length>U&&I(g)}else if(!X)S(g)&&(k(g,$,C),I(g));else{let x=Xt(R,v,W,d),y=Math.floor((W-1)/2);for(let E=0;E<W;E++){let{x:P,y:it}=x[E],q=P===0&&it===0?g:gt(g,P,it);if(!S(q))continue;let Y=Mn(u.pathIds[E]);k(q,$,l&&(l.walks.length?!l.names.has(u.pathIds[E]):!B)?j(Y,et):Y),E===y&&I(q)}}let Dt=G.length-U;Dt>0&&Ot.set(f,{start:U,count:Dt});let Ft=rt.length-at;Ft>0&&Lt.set(f,{start:at,count:Ft})}for(let[f,u]of Object.entries(e)){let R=o.get(f);if(!R||h&&!ne(u,h))continue;let v=l!==void 0&&!l.nodeIds.has(f),g=v?cn:Zn(R,kt.get(f)??0,r,En),W=v?j(g,et):g,st=lt(R,s,i,ut),V=st/2,B=H.length,$=_n.get(f),X=st/mt,O=u.length>=2,C=l?.walks.length&&!v&&!$?.length?l.walks:void 0;if(O&&C){let K=Math.max(st/C.length,tn),S=vt(u,b);C.forEach((k,I)=>{let U=k.colors.get(f);if(U===void 0)return;let at=(I-(C.length-1)/2)*K*dt;H.push({points:C.length===1?u:rn(u,S,at,b),thickness:K/2,color:U})})}else if(O&&$?.length&&X>=Pn){let K=vt(u,b);for(let S of $){let k=(S-(mt-1)/2)*X*dt,I=Pt[S]??Zt;H.push({points:rn(u,K,k,b),thickness:X/2,color:v?j(I,et):I})}}else O&&H.push({points:u,thickness:V,color:W});let z=H.length-B;z>0&&Nt.set(f,{start:B,count:z})}return{nodeStrokes:H,nodeStrokeRuns:Nt,arrows:rt,arrowRuns:Lt,edgeCurves:G,edgeCurveRuns:Ot}}var un=[{value:"progress",label:"Progress along the walk"},{value:"walk",label:"One colour for the walk"},{value:"reference",label:"Reference position"}],wt=[{value:"grey",label:"Grey to black",ends:["#a3a3a3","#151515"]},{value:"blue",label:"Cyan to navy",ends:["#6ee0f0","#0b2c7a"]},{value:"red",label:"Yellow to red",ends:["#ffd24a","#b3121b"]},{value:"purple",label:"Pink to plum",ends:["#f5a3d8","#5e1a6e"]},{value:"green",label:"Lime to forest",ends:["#b6e36c","#0b5d3b"]},{value:"rainbow",label:"Rainbow"}],fn=["blue","red","purple","green"],ae=t=>un.some(e=>e.value===t),ce=t=>wt.some(e=>e.value===t);function ie(t,e,n,o=!0){let{field:r,scheme:s}=t.color??{},a=ae(r)?r:o?"progress":"walk",c=e?"grey":fn[n%fn.length],i=ce(s)?s==="rainbow"&&a!=="reference"?c:s:c;return{field:a,scheme:i}}var dn=.5,le=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4,fe=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;function hn(t){let[e,n,o]=[1,3,5].map(c=>le(Number.parseInt(t.slice(c,c+2),16)/255)),r=Math.cbrt(.4122214708*e+.5363325363*n+.0514459929*o),s=Math.cbrt(.2119034982*e+.6806995451*n+.1073969566*o),a=Math.cbrt(.0883024619*e+.2817188376*n+.6299787005*o);return[.2104542553*r+.793617785*s-.0040720468*a,1.9779984951*r-2.428592205*s+.4505937099*a,.0259040371*r+.7827717662*s-.808675766*a]}function he([t,e,n]){let o=(t+.3963377774*e+.2158037573*n)**3,r=(t-.1055613458*e-.0638541728*n)**3,s=(t-.0894841775*e-1.291485548*n)**3;return[4.0767416621*o-3.3077115913*r+.2309699292*s,-1.2684380046*o+2.6097574011*r-.3413193965*s,-.0041960863*o-.7034186147*r+1.707614701*s].map(a=>fe(Math.max(0,Math.min(1,a)))*255)}function Tt(t,e){let n=Math.max(0,Math.min(1,e)),o=wt.find(a=>a.value===t);if(!o||!("ends"in o))return St(nt(n),Z,tt).map(a=>a*255);let r=hn(o.ends[0]),s=hn(o.ends[1]);return he(r.map((a,c)=>a+(s[c]-a)*n))}function mn(t,e){let[n,o,r]=Tt(t,e).map(Math.round);return`rgb(${n}, ${o}, ${r})`}function ht(t,e){let[n,o,r]=Tt(t,e).map(Math.round);return p(n,o,r,255)}function ue({field:t,scheme:e},n){return t==="walk"?ht(e,dn):n===void 0?pn:ht(e,n)}var pn=It;function de({field:t,scheme:e}){let n=(o,r)=>({offset:o,color:mn(e,r),abgr:ht(e,r)});return t==="walk"?[n(0,dn)]:Array.from({length:7},(o,r)=>n(r/6,r/6))}export{In as a,Tn as b,p as c,zt as d,me as e,j as f,pe as g,An as h,Ee as i,vn as j,xe as k,Jt as l,Pe as m,St as n,De as o,Fe as p,Qn as q,Zn as r,He as s,un as t,wt as u,ie as v,ue as w,pn as x,de as y};
|
|
2
|
-
//# sourceMappingURL=chunk-2M4XYSLG.js.map
|