jbrowse-plugin-graphgenomeviewer 7.5.0 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/chunks/GbzBaseSyntenyAdapter-HT275FAA.js +2 -0
- package/dist/chunks/{GbzBaseSyntenyAdapter-4KVWVUN6.js.map → GbzBaseSyntenyAdapter-HT275FAA.js.map} +2 -2
- package/dist/chunks/GraphGenomeView-NBLEWVY2.js +10 -0
- package/dist/chunks/{GraphGenomeView-KI4FQ5A7.js.map → GraphGenomeView-NBLEWVY2.js.map} +1 -1
- package/dist/chunks/{GraphTrackSettingsDialog-UQNMDXTE.js → GraphTrackSettingsDialog-63UGAGAC.js} +2 -2
- package/dist/chunks/{HighlightColorDialog-D4RCUCUF.js → HighlightColorDialog-MY4MWVCJ.js} +2 -2
- package/dist/chunks/LinearGraphDisplay-3LMAWRNR.js +2 -0
- package/dist/chunks/{LinearGraphDisplay-RPZUZSM2.js.map → LinearGraphDisplay-3LMAWRNR.js.map} +1 -1
- package/dist/chunks/{MinigraphBubbleAdapter-TJYI7KEN.js → MinigraphBubbleAdapter-YMI75DAV.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-5ZMJLFZP.js → RgfaTabixAdapter-AFNTSA6Y.js} +2 -2
- package/dist/chunks/{WalkFormsAdapter-CAJOWOEX.js → WalkFormsAdapter-ZPE2JQJU.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-VI3KA2GX.js → WalkTabixSyntenyAdapter-EOD4RQVU.js} +2 -2
- package/dist/chunks/{chunk-XZGYJ3JC.js → chunk-22A3MS5J.js} +1 -1
- package/dist/chunks/{chunk-XZGYJ3JC.js.map → chunk-22A3MS5J.js.map} +1 -1
- package/dist/chunks/{chunk-LTNFVL2F.js → chunk-2QRCU675.js} +2 -2
- package/dist/chunks/chunk-3Y2G43HK.js +3 -0
- package/dist/chunks/chunk-3Y2G43HK.js.map +7 -0
- package/dist/chunks/chunk-4AXLBI6M.js +2 -0
- package/dist/chunks/chunk-4AXLBI6M.js.map +7 -0
- package/dist/chunks/chunk-AK3UZI6J.js +4 -0
- package/dist/chunks/chunk-AK3UZI6J.js.map +7 -0
- package/dist/chunks/{chunk-HHMJNAA3.js → chunk-DDAG445J.js} +2 -2
- package/dist/chunks/chunk-DFZ6G452.js +4 -0
- package/dist/chunks/chunk-DFZ6G452.js.map +7 -0
- package/dist/chunks/{chunk-GYY6LF5L.js → chunk-DSSZIADV.js} +1 -1
- package/dist/chunks/{chunk-GYY6LF5L.js.map → chunk-DSSZIADV.js.map} +1 -1
- package/dist/chunks/{chunk-OZEKEYT3.js → chunk-E7S7PGEZ.js} +2 -2
- package/dist/chunks/{chunk-OZEKEYT3.js.map → chunk-E7S7PGEZ.js.map} +1 -1
- package/dist/chunks/chunk-EV54SYM7.js +2 -0
- package/dist/chunks/chunk-EV54SYM7.js.map +7 -0
- package/dist/chunks/{chunk-DEWZOJSC.js → chunk-GK5YETAZ.js} +2 -2
- package/dist/chunks/{chunk-DEWZOJSC.js.map → chunk-GK5YETAZ.js.map} +1 -1
- package/dist/chunks/{chunk-42KD4AVY.js → chunk-IFIZMFS6.js} +2 -2
- package/dist/chunks/{chunk-42KD4AVY.js.map → chunk-IFIZMFS6.js.map} +3 -3
- package/dist/chunks/{chunk-HTTONSO4.js → chunk-KY6GXBXU.js} +2 -2
- package/dist/chunks/{chunk-HTTONSO4.js.map → chunk-KY6GXBXU.js.map} +2 -2
- package/dist/chunks/{chunk-SPL3UO2D.js → chunk-LIRBZOBX.js} +2 -2
- package/dist/chunks/{chunk-SPL3UO2D.js.map → chunk-LIRBZOBX.js.map} +1 -1
- package/dist/chunks/chunk-O6HXOTJN.js +2 -0
- package/dist/chunks/{chunk-Z3IKZAYC.js.map → chunk-O6HXOTJN.js.map} +4 -4
- package/dist/chunks/{chunk-FCMXEFJA.js → chunk-ODQSCM3F.js} +1 -1
- package/dist/chunks/{chunk-FCMXEFJA.js.map → chunk-ODQSCM3F.js.map} +1 -1
- package/dist/chunks/chunk-PT3WV5ED.js +4 -0
- package/dist/chunks/chunk-PT3WV5ED.js.map +7 -0
- package/dist/chunks/{chunk-ZV5FNOHS.js → chunk-Q5H6ETNZ.js} +2 -2
- package/dist/chunks/{chunk-K4JL57NR.js → chunk-SXQ6222I.js} +2 -2
- package/dist/chunks/chunk-TUECGSVJ.js +2 -0
- package/dist/chunks/{renderSvg-3PPAEMBT.js → renderSvg-WMFKXKFZ.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +6 -4
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +2 -2
- package/src/GraphGenomeView/components/LegendSwatch.tsx +11 -1
- package/src/GraphGenomeView/components/WalkStrip.tsx +1 -0
- package/src/GraphGenomeView/genes/geneFeatures.ts +8 -0
- package/src/GraphGenomeView/genes/genes.test.ts +14 -1
- package/src/GraphGenomeView/legendSections.ts +42 -6
- package/src/GraphGenomeView/model.test.ts +69 -5
- package/src/GraphGenomeView/nodeColor.test.ts +27 -1
- package/src/GraphGenomeView/nodeColor.ts +38 -29
- package/src/GraphGenomeView/nodeSize.test.ts +1 -0
- package/src/GraphGenomeView/nodeSize.ts +10 -5
- package/src/GraphGenomeView/pane/fitViews.ts +1 -0
- package/src/GraphGenomeView/pane/graphViews.ts +10 -4
- package/src/GraphGenomeView/pane/launchViews.ts +11 -3
- package/src/GraphGenomeView/pane/renderingActions.ts +36 -4
- package/src/GraphGenomeView/pane/settingActions.ts +3 -1
- package/src/GraphGenomeView/retiredNodeColor.test.ts +46 -0
- package/src/GraphGenomeView/retiredNodeColor.ts +76 -0
- package/src/GraphGenomeView/subgraphLoad.test.ts +42 -0
- package/src/GraphGenomeView/viewModel.ts +12 -3
- package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +62 -5
- package/src/LinearGraphDisplay/configSchema.ts +17 -9
- package/src/LinearGraphDisplay/model.ts +4 -2
- package/src/version.ts +1 -1
- package/dist/chunks/GbzBaseSyntenyAdapter-4KVWVUN6.js +0 -2
- package/dist/chunks/GraphGenomeView-KI4FQ5A7.js +0 -10
- package/dist/chunks/LinearGraphDisplay-RPZUZSM2.js +0 -2
- package/dist/chunks/chunk-22ANI2KL.js +0 -2
- package/dist/chunks/chunk-22ANI2KL.js.map +0 -7
- package/dist/chunks/chunk-4NIWMRKH.js +0 -2
- package/dist/chunks/chunk-4NIWMRKH.js.map +0 -7
- package/dist/chunks/chunk-BCOXRUNQ.js +0 -3
- package/dist/chunks/chunk-BCOXRUNQ.js.map +0 -7
- package/dist/chunks/chunk-DAPI7M4M.js +0 -4
- package/dist/chunks/chunk-DAPI7M4M.js.map +0 -7
- package/dist/chunks/chunk-KOC23YNN.js +0 -4
- package/dist/chunks/chunk-KOC23YNN.js.map +0 -7
- package/dist/chunks/chunk-POUV7OPY.js +0 -4
- package/dist/chunks/chunk-POUV7OPY.js.map +0 -7
- package/dist/chunks/chunk-UR2MJJUP.js +0 -2
- package/dist/chunks/chunk-VTMJQFN5.js +0 -2
- package/dist/chunks/chunk-VTMJQFN5.js.map +0 -7
- package/dist/chunks/chunk-Z3IKZAYC.js +0 -2
- /package/dist/chunks/{GraphTrackSettingsDialog-UQNMDXTE.js.map → GraphTrackSettingsDialog-63UGAGAC.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-D4RCUCUF.js.map → HighlightColorDialog-MY4MWVCJ.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-TJYI7KEN.js.map → MinigraphBubbleAdapter-YMI75DAV.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-5ZMJLFZP.js.map → RgfaTabixAdapter-AFNTSA6Y.js.map} +0 -0
- /package/dist/chunks/{WalkFormsAdapter-CAJOWOEX.js.map → WalkFormsAdapter-ZPE2JQJU.js.map} +0 -0
- /package/dist/chunks/{WalkTabixSyntenyAdapter-VI3KA2GX.js.map → WalkTabixSyntenyAdapter-EOD4RQVU.js.map} +0 -0
- /package/dist/chunks/{chunk-LTNFVL2F.js.map → chunk-2QRCU675.js.map} +0 -0
- /package/dist/chunks/{chunk-HHMJNAA3.js.map → chunk-DDAG445J.js.map} +0 -0
- /package/dist/chunks/{chunk-ZV5FNOHS.js.map → chunk-Q5H6ETNZ.js.map} +0 -0
- /package/dist/chunks/{chunk-K4JL57NR.js.map → chunk-SXQ6222I.js.map} +0 -0
- /package/dist/chunks/{chunk-UR2MJJUP.js.map → chunk-TUECGSVJ.js.map} +0 -0
- /package/dist/chunks/{renderSvg-3PPAEMBT.js.map → renderSvg-WMFKXKFZ.js.map} +0 -0
|
@@ -88,7 +88,9 @@ export const withSettingActions = withTubeMapViews
|
|
|
88
88
|
) {
|
|
89
89
|
keptDomain = self.statedColorDomain
|
|
90
90
|
}
|
|
91
|
-
self.writeGrammar({
|
|
91
|
+
self.writeGrammar({
|
|
92
|
+
encoding: { color: colorOfScheme(scheme, keptDomain) },
|
|
93
|
+
})
|
|
92
94
|
},
|
|
93
95
|
}
|
|
94
96
|
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { liftFlatNodeColor } from './retiredNodeColor'
|
|
2
|
+
|
|
3
|
+
test('a bare constant becomes a value', () => {
|
|
4
|
+
expect(liftFlatNodeColor('grey')).toEqual({ value: 'grey' })
|
|
5
|
+
expect(liftFlatNodeColor('uniform')).toEqual({ value: 'uniform' })
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
test('categorical becomes an ordinal scale', () => {
|
|
9
|
+
expect(liftFlatNodeColor({ field: 'id', scale: 'categorical' })).toEqual({
|
|
10
|
+
field: 'id',
|
|
11
|
+
scale: { type: 'ordinal' },
|
|
12
|
+
})
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('scheme and the domain move under scale', () => {
|
|
16
|
+
expect(liftFlatNodeColor({ field: 'id', scheme: 'rainbow' })).toEqual({
|
|
17
|
+
field: 'id',
|
|
18
|
+
scale: { scheme: 'rainbow' },
|
|
19
|
+
})
|
|
20
|
+
expect(
|
|
21
|
+
liftFlatNodeColor({ field: 'position', domainMin: 5, domainMax: 50 }),
|
|
22
|
+
).toEqual({ field: 'position', scale: { domainMin: 5, domainMax: 50 } })
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('labels and title move to scale.names and legend.title', () => {
|
|
26
|
+
expect(
|
|
27
|
+
liftFlatNodeColor({ field: 'id', labels: ['a'], title: 'Node' }),
|
|
28
|
+
).toEqual({ field: 'id', scale: { names: ['a'] }, legend: { title: 'Node' } })
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('a member the channel object already nests wins over its flat twin', () => {
|
|
32
|
+
expect(
|
|
33
|
+
liftFlatNodeColor({
|
|
34
|
+
field: 'position',
|
|
35
|
+
domainMin: 1,
|
|
36
|
+
scale: { domainMin: 7 },
|
|
37
|
+
}),
|
|
38
|
+
).toEqual({ field: 'position', scale: { domainMin: 7 } })
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test('a channel object is the object it was', () => {
|
|
42
|
+
const color = { field: 'position', scale: { domainMin: 1, domainMax: 2 } }
|
|
43
|
+
expect(liftFlatNodeColor(color)).toBe(color)
|
|
44
|
+
expect(liftFlatNodeColor({ field: 'depth' })).toEqual({ field: 'depth' })
|
|
45
|
+
expect(liftFlatNodeColor(undefined)).toBeUndefined()
|
|
46
|
+
})
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { isRecord } from '../isRecord'
|
|
2
|
+
|
|
3
|
+
// Where each member of the flat color object sits in the channel object, as
|
|
4
|
+
// display-kit's `liftFlatColor` places it
|
|
5
|
+
const FLAT_MEMBERS: Readonly<
|
|
6
|
+
Record<string, readonly ['scale' | 'legend', string]>
|
|
7
|
+
> = {
|
|
8
|
+
scale: ['scale', 'type'],
|
|
9
|
+
domain: ['scale', 'domain'],
|
|
10
|
+
range: ['scale', 'range'],
|
|
11
|
+
labels: ['scale', 'names'],
|
|
12
|
+
scheme: ['scale', 'scheme'],
|
|
13
|
+
reverse: ['scale', 'reverse'],
|
|
14
|
+
domainMin: ['scale', 'domainMin'],
|
|
15
|
+
domainMax: ['scale', 'domainMax'],
|
|
16
|
+
domainMid: ['scale', 'domainMid'],
|
|
17
|
+
domainQuantile: ['scale', 'domainQuantile'],
|
|
18
|
+
unknown: ['scale', 'unknown'],
|
|
19
|
+
title: ['legend', 'title'],
|
|
20
|
+
descending: ['legend', 'descending'],
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isFlat(color: Record<string, unknown>) {
|
|
24
|
+
return Object.entries(color).some(
|
|
25
|
+
([key, value]) =>
|
|
26
|
+
key in FLAT_MEMBERS && !(key === 'scale' && isRecord(value)),
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated The node color through 7.5.0, a bare `'grey'` or `'uniform'` or a
|
|
32
|
+
* flat object (`scale: 'categorical'`, `scheme`, `domainMin`, `domainMax`
|
|
33
|
+
* beside `field`), lifted to the channel object: the constants become
|
|
34
|
+
* `value`, scale members go under `scale` and `categorical` becomes
|
|
35
|
+
* `ordinal`. Covers a LinearGraphDisplay's `color` and a GraphGenomeView's
|
|
36
|
+
* saved `color`. Goes once no saved session or hosted config predates `encoding.color`.
|
|
37
|
+
*/
|
|
38
|
+
export function liftFlatNodeColor(color: unknown): unknown {
|
|
39
|
+
if (typeof color === 'string') {
|
|
40
|
+
return { value: color }
|
|
41
|
+
}
|
|
42
|
+
if (!isRecord(color) || !isFlat(color)) {
|
|
43
|
+
return color
|
|
44
|
+
}
|
|
45
|
+
const out: Record<string, unknown> = {}
|
|
46
|
+
const parts: Record<'scale' | 'legend', Record<string, unknown>> = {
|
|
47
|
+
scale: {},
|
|
48
|
+
legend: {},
|
|
49
|
+
}
|
|
50
|
+
for (const [key, value] of Object.entries(color)) {
|
|
51
|
+
const at = FLAT_MEMBERS[key]
|
|
52
|
+
if (!at || (key === 'scale' && isRecord(value))) {
|
|
53
|
+
out[key] = value
|
|
54
|
+
} else if (value !== undefined) {
|
|
55
|
+
parts[at[0]][at[1]] =
|
|
56
|
+
key === 'scale' && value === 'categorical' ? 'ordinal' : value
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const part of ['scale', 'legend'] as const) {
|
|
60
|
+
if (Object.keys(parts[part]).length > 0) {
|
|
61
|
+
const nested = out[part]
|
|
62
|
+
out[part] = { ...parts[part], ...(isRecord(nested) ? nested : {}) }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return out
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated A LinearGraphDisplay's flat `color` as `encoding.color`, for
|
|
70
|
+
* the schema's `retired`. Goes with `liftFlatNodeColor`.
|
|
71
|
+
*/
|
|
72
|
+
export const retiredGraphColor = {
|
|
73
|
+
color: (color: unknown) => ({
|
|
74
|
+
encoding: { color: liftFlatNodeColor(color) },
|
|
75
|
+
}),
|
|
76
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { gfaTables } from '@jbrowse/bandage-core/gfa/gfaTables'
|
|
2
|
+
import { types } from '@jbrowse/mobx-state-tree'
|
|
3
|
+
|
|
1
4
|
import stateModelFactory from './viewModel'
|
|
2
5
|
import { hoverInRegion } from '../hoverSync/lgvHover'
|
|
3
6
|
|
|
@@ -319,6 +322,45 @@ describe('canceling and retrying', () => {
|
|
|
319
322
|
})
|
|
320
323
|
})
|
|
321
324
|
|
|
325
|
+
test('lifting an abridged walk cuts again with its name', async () => {
|
|
326
|
+
const tables = gfaTables(
|
|
327
|
+
[
|
|
328
|
+
GFA,
|
|
329
|
+
'W\tGRCh38\t0\tchr6\t32000000\t32001900\t>s1>s3',
|
|
330
|
+
'W\tNA20809\t2\tCM094351.1\t31900800\t31903000\t>s1>h1>s3',
|
|
331
|
+
].join('\n'),
|
|
332
|
+
)!
|
|
333
|
+
tables.walks.abridgedSteps = Float64Array.from([Number.NaN, 40])
|
|
334
|
+
tables.walks.abridgedBp = Float64Array.from([Number.NaN, 9000])
|
|
335
|
+
mockRpcCall.mockImplementation((_sid: unknown, method: string) =>
|
|
336
|
+
method === 'GetSubgraph'
|
|
337
|
+
? Promise.resolve(tables)
|
|
338
|
+
: Promise.reject(new Error(`Unexpected RPC: ${method}`)),
|
|
339
|
+
)
|
|
340
|
+
const { view: model } = types.model({ view: stateModelFactory() }).create({
|
|
341
|
+
view: {
|
|
342
|
+
type: 'GraphGenomeView',
|
|
343
|
+
layoutMode: 'auto',
|
|
344
|
+
loadedTrackId: TRACK.trackId,
|
|
345
|
+
loadedRegion: ON_HG38,
|
|
346
|
+
} as never,
|
|
347
|
+
})
|
|
348
|
+
await vi.waitFor(() => {
|
|
349
|
+
expect(model.hasGraph).toBe(true)
|
|
350
|
+
})
|
|
351
|
+
model.liftWalks(['GRCh38#0#chr6'])
|
|
352
|
+
expect(model.expandedWalks).toEqual([])
|
|
353
|
+
mockRpcCall.mockClear()
|
|
354
|
+
model.liftWalks(['GRCh38#0#chr6', 'NA20809#2#CM094351.1'])
|
|
355
|
+
expect(model.expandedWalks).toEqual(['NA20809#2#CM094351.1'])
|
|
356
|
+
await vi.waitFor(() => {
|
|
357
|
+
expect(mockRpcCall).toHaveBeenCalledTimes(1)
|
|
358
|
+
})
|
|
359
|
+
expect(mockRpcCall.mock.calls[0]?.[2]).toMatchObject({
|
|
360
|
+
opts: { expand: ['NA20809#2#CM094351.1'] },
|
|
361
|
+
})
|
|
362
|
+
})
|
|
363
|
+
|
|
322
364
|
test('a newer cut aborts the one it replaces', () => {
|
|
323
365
|
pendingCuts()
|
|
324
366
|
const model = launchedView()
|
|
@@ -7,6 +7,7 @@ import { reaction } from 'mobx'
|
|
|
7
7
|
import { HOVER_HIGHLIGHT_VALUES } from './hoverHighlight'
|
|
8
8
|
import { lenientMaybeEnum } from './lenientEnum'
|
|
9
9
|
import { GraphPane, fileName, formatSpanBp } from './model'
|
|
10
|
+
import { liftFlatNodeColor } from './retiredNodeColor'
|
|
10
11
|
import { canonicalRegion } from '../launchFromGraph/launchFromGraph'
|
|
11
12
|
|
|
12
13
|
import type { GraphLayers } from './graphLayers'
|
|
@@ -48,11 +49,16 @@ export default function stateModelFactory() {
|
|
|
48
49
|
hover: lenientMaybeEnum(HOVER_HIGHLIGHT_VALUES),
|
|
49
50
|
}),
|
|
50
51
|
)
|
|
52
|
+
.preProcessSnapshot(snap =>
|
|
53
|
+
snap.color === undefined
|
|
54
|
+
? snap
|
|
55
|
+
: { ...snap, color: liftFlatNodeColor(snap.color) as NodeColor },
|
|
56
|
+
)
|
|
51
57
|
.views(self => ({
|
|
52
58
|
get grammar(): GraphGrammar {
|
|
53
59
|
return {
|
|
54
60
|
layoutMode: self.layoutMode,
|
|
55
|
-
color: self.color,
|
|
61
|
+
encoding: { color: self.color },
|
|
56
62
|
size: self.size,
|
|
57
63
|
layers: self.layers,
|
|
58
64
|
facet: self.facet,
|
|
@@ -62,8 +68,11 @@ export default function stateModelFactory() {
|
|
|
62
68
|
},
|
|
63
69
|
}))
|
|
64
70
|
.actions(self => ({
|
|
65
|
-
writeGrammar(settings: GraphGrammar) {
|
|
66
|
-
Object.assign(
|
|
71
|
+
writeGrammar({ encoding, ...settings }: GraphGrammar) {
|
|
72
|
+
Object.assign(
|
|
73
|
+
self,
|
|
74
|
+
encoding ? { ...settings, color: encoding.color } : settings,
|
|
75
|
+
)
|
|
67
76
|
},
|
|
68
77
|
}))
|
|
69
78
|
.volatile(() => ({
|
|
@@ -16,7 +16,12 @@ import {
|
|
|
16
16
|
} from '@jbrowse/core/pluggableElementTypes/models'
|
|
17
17
|
import { LAUNCH_LABEL } from '@jbrowse/core/ui'
|
|
18
18
|
import SimpleFeature from '@jbrowse/core/util/simpleFeature'
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
applyPatch,
|
|
21
|
+
getSnapshot,
|
|
22
|
+
getType,
|
|
23
|
+
types,
|
|
24
|
+
} from '@jbrowse/mobx-state-tree'
|
|
20
25
|
import { linearGenomeViewStateModelFactory } from '@jbrowse/plugin-linear-genome-view'
|
|
21
26
|
import RocketLaunchIcon from '@mui/icons-material/RocketLaunch'
|
|
22
27
|
import { reaction } from 'mobx'
|
|
@@ -985,7 +990,7 @@ test("a launch names the pane's props without its type, and opens in that layout
|
|
|
985
990
|
{
|
|
986
991
|
type: 'LinearGraphDisplay',
|
|
987
992
|
layoutMode: 'force',
|
|
988
|
-
color: 'uniform',
|
|
993
|
+
encoding: { color: { value: 'uniform' } },
|
|
989
994
|
},
|
|
990
995
|
)
|
|
991
996
|
const display = view.tracks[0]!.displays[0] as LinearGraphDisplayModel
|
|
@@ -997,6 +1002,51 @@ test("a launch names the pane's props without its type, and opens in that layout
|
|
|
997
1002
|
expect(display.hostPlacesX).toBe(false)
|
|
998
1003
|
})
|
|
999
1004
|
|
|
1005
|
+
test.each([
|
|
1006
|
+
['uniform', 'uniform'],
|
|
1007
|
+
[{ field: 'id', scale: 'categorical' }, 'random'],
|
|
1008
|
+
[{ field: 'id', scheme: 'rainbow' }, 'rainbow'],
|
|
1009
|
+
[{ field: 'depth' }, 'depth'],
|
|
1010
|
+
])('a flat color %j in a saved config is read as %s', async (color, scheme) => {
|
|
1011
|
+
const { view } = createEnvironment()
|
|
1012
|
+
view.showTrack('graph', {}, { type: 'LinearGraphDisplay', color })
|
|
1013
|
+
const display = view.tracks[0]!.displays[0] as LinearGraphDisplayModel
|
|
1014
|
+
expect(display.chosenColorScheme).toBe(scheme)
|
|
1015
|
+
expect(getSnapshot(display.configuration)).not.toHaveProperty('color')
|
|
1016
|
+
})
|
|
1017
|
+
|
|
1018
|
+
test('a flat color lifts to encoding.color', async () => {
|
|
1019
|
+
const { view } = createEnvironment()
|
|
1020
|
+
view.showTrack(
|
|
1021
|
+
'graph',
|
|
1022
|
+
{},
|
|
1023
|
+
{
|
|
1024
|
+
type: 'LinearGraphDisplay',
|
|
1025
|
+
color: { field: 'position', domainMin: 5, domainMax: 50 },
|
|
1026
|
+
},
|
|
1027
|
+
)
|
|
1028
|
+
const lifted = view.tracks[0]!.displays[0] as LinearGraphDisplayModel
|
|
1029
|
+
expect(readConfObject(lifted.configuration, 'encoding')).toEqual({
|
|
1030
|
+
color: { field: 'position', scale: { domainMin: 5, domainMax: 50 } },
|
|
1031
|
+
})
|
|
1032
|
+
expect(lifted.statedColorDomain).toEqual({ start: 5, end: 50 })
|
|
1033
|
+
})
|
|
1034
|
+
|
|
1035
|
+
test('an encoding beside a flat color wins', () => {
|
|
1036
|
+
const { view } = createEnvironment()
|
|
1037
|
+
view.showTrack(
|
|
1038
|
+
'graph',
|
|
1039
|
+
{},
|
|
1040
|
+
{
|
|
1041
|
+
type: 'LinearGraphDisplay',
|
|
1042
|
+
color: { field: 'depth', domainMin: 1 },
|
|
1043
|
+
encoding: { color: { field: 'length' } },
|
|
1044
|
+
},
|
|
1045
|
+
)
|
|
1046
|
+
const display = view.tracks[0]!.displays[0] as LinearGraphDisplayModel
|
|
1047
|
+
expect(display.chosenColorScheme).toBe('node-length')
|
|
1048
|
+
})
|
|
1049
|
+
|
|
1000
1050
|
test.each([
|
|
1001
1051
|
['force', false],
|
|
1002
1052
|
['auto', true],
|
|
@@ -1018,7 +1068,14 @@ test('a launch that states one choice takes the rest from the config', async ()
|
|
|
1018
1068
|
const { view, cuts } = createEnvironment()
|
|
1019
1069
|
view.zoomTo(60_000 / WIDTH_PX)
|
|
1020
1070
|
view.scrollTo(1_000_000 / view.bpPerPx)
|
|
1021
|
-
view.showTrack(
|
|
1071
|
+
view.showTrack(
|
|
1072
|
+
'graph',
|
|
1073
|
+
{},
|
|
1074
|
+
{
|
|
1075
|
+
type: 'LinearGraphDisplay',
|
|
1076
|
+
encoding: { color: { value: 'uniform' } },
|
|
1077
|
+
},
|
|
1078
|
+
)
|
|
1022
1079
|
const display = view.tracks[0]!.displays[0] as LinearGraphDisplayModel
|
|
1023
1080
|
display.startRenderingBackend(fakeRenderer())
|
|
1024
1081
|
await wait(SETTLE_MS)
|
|
@@ -1044,7 +1101,7 @@ test('each grammar setter writes the track config, and the pane reads it back',
|
|
|
1044
1101
|
display.setHover('off')
|
|
1045
1102
|
const slots = [
|
|
1046
1103
|
'layoutMode',
|
|
1047
|
-
'
|
|
1104
|
+
'encoding',
|
|
1048
1105
|
'size',
|
|
1049
1106
|
'layers',
|
|
1050
1107
|
'facet',
|
|
@@ -1059,7 +1116,7 @@ test('each grammar setter writes the track config, and the pane reads it back',
|
|
|
1059
1116
|
),
|
|
1060
1117
|
).toEqual({
|
|
1061
1118
|
layoutMode: 'ordered',
|
|
1062
|
-
color: { field: 'depth' },
|
|
1119
|
+
encoding: { color: { field: 'depth' } },
|
|
1063
1120
|
size: { value: 6, links: 'walks' },
|
|
1064
1121
|
layers: { bubbles: true },
|
|
1065
1122
|
facet: { field: 'walk', domain: [] },
|
|
@@ -4,6 +4,7 @@ import { trackHeightConfigSchemaFields } from '@jbrowse/display-kit/trackHeightC
|
|
|
4
4
|
import { types } from '@jbrowse/mobx-state-tree'
|
|
5
5
|
|
|
6
6
|
import { HOVER_HIGHLIGHT_VALUES } from '../GraphGenomeView/hoverHighlight'
|
|
7
|
+
import { retiredGraphColor } from '../GraphGenomeView/retiredNodeColor'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* #config LinearGraphDisplay
|
|
@@ -27,15 +28,17 @@ export function configSchemaFactory() {
|
|
|
27
28
|
},
|
|
28
29
|
/**
|
|
29
30
|
* #slot
|
|
30
|
-
* the
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* the channels the nodes are painted through, as core's `encoding`.
|
|
32
|
+
* `color` is `{ value: 'grey' }` or `{ value: 'uniform' }`, or the
|
|
33
|
+
* `field` nodes are colored by, `depth`, `length`, `rank`, `position` or
|
|
34
|
+
* `id` (`scale: { type: 'ordinal' }` or `scale: { scheme: 'rainbow' }`).
|
|
35
|
+
* `scale.domainMin` and `scale.domainMax` span the position ramp. `{}`
|
|
36
|
+
* colors an anchored graph by position.
|
|
34
37
|
* ```js
|
|
35
|
-
* { color: { field: 'depth' } }
|
|
38
|
+
* { encoding: { color: { field: 'depth' } } }
|
|
36
39
|
* ```
|
|
37
40
|
*/
|
|
38
|
-
|
|
41
|
+
encoding: {
|
|
39
42
|
type: 'frozen',
|
|
40
43
|
defaultValue: {},
|
|
41
44
|
plot: true,
|
|
@@ -44,8 +47,9 @@ export function configSchemaFactory() {
|
|
|
44
47
|
* #slot
|
|
45
48
|
* the node thickness: a px number draws every node that thick;
|
|
46
49
|
* `{ field: 'depth', value }` thickens a node the more paths carry it,
|
|
47
|
-
* around `value` px; `
|
|
48
|
-
*
|
|
50
|
+
* around `value` px; `{ field: 'frequency', value }` draws it as wide as
|
|
51
|
+
* the share of haplotypes through it, `value` px at 100%; `links:
|
|
52
|
+
* 'walks'` thickens a link the more walks take it
|
|
49
53
|
*/
|
|
50
54
|
size: {
|
|
51
55
|
type: 'frozen',
|
|
@@ -102,7 +106,11 @@ export function configSchemaFactory() {
|
|
|
102
106
|
height: 'the height of the track the graph is drawn in',
|
|
103
107
|
}),
|
|
104
108
|
},
|
|
105
|
-
{
|
|
109
|
+
{
|
|
110
|
+
explicitlyTyped: true,
|
|
111
|
+
explicitIdentifier: 'displayId',
|
|
112
|
+
retired: retiredGraphColor,
|
|
113
|
+
},
|
|
106
114
|
)
|
|
107
115
|
}
|
|
108
116
|
|
|
@@ -129,7 +129,7 @@ export function stateModelFactory(configSchema: LinearGraphDisplayConfigModel) {
|
|
|
129
129
|
get grammar(): GraphGrammar {
|
|
130
130
|
return {
|
|
131
131
|
layoutMode: getConf(self, 'layoutMode'),
|
|
132
|
-
|
|
132
|
+
encoding: getConf(self, 'encoding'),
|
|
133
133
|
size: getConf(self, 'size'),
|
|
134
134
|
layers: getConf(self, 'layers') as GraphLayers,
|
|
135
135
|
facet: getConf(self, 'facet'),
|
|
@@ -590,6 +590,7 @@ export function stateModelFactory(configSchema: LinearGraphDisplayConfigModel) {
|
|
|
590
590
|
}
|
|
591
591
|
const start = Math.floor(seen.start)
|
|
592
592
|
const end = Math.ceil(seen.end)
|
|
593
|
+
const { encoding, ...grammar } = self.grammar
|
|
593
594
|
return {
|
|
594
595
|
...paneSettings(self),
|
|
595
596
|
loadedTrackId: trackId,
|
|
@@ -601,7 +602,8 @@ export function stateModelFactory(configSchema: LinearGraphDisplayConfigModel) {
|
|
|
601
602
|
},
|
|
602
603
|
subgraphHaplotypes: self.cutHaplotypes,
|
|
603
604
|
maxRegionBp: Math.max(self.maxRegionBp, end - start),
|
|
604
|
-
...
|
|
605
|
+
...grammar,
|
|
606
|
+
color: encoding?.color,
|
|
605
607
|
layoutMode: self.chosenLayoutMode,
|
|
606
608
|
connectedViewId: self.host?.id,
|
|
607
609
|
} satisfies GraphViewSpec
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '7.
|
|
1
|
+
export const version = '7.7.0'
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as ne,b as ae,c as ue,d as re,e as oe,f as O,g as ie,h as se}from"./chunk-HHMJNAA3.js";import{a as te}from"./chunk-UR2MJJUP.js";import{a as ee}from"./chunk-KOB7YIMR.js";import{a as Q,b as D,c as Z,d as u,e as k,f as M,g as j,h as $,i as W,k as U}from"./chunk-HTTONSO4.js";import"./chunk-M2D7NUOY.js";import"./chunk-22ANI2KL.js";import{b as z,c as E}from"./chunk-POUV7OPY.js";import"./chunk-YBLNN5FU.js";import"./chunk-DEWZOJSC.js";import"./chunk-SPL3UO2D.js";import{C as V,a as K,c as L}from"./chunk-ZV5FNOHS.js";import"./chunk-YBLNN5FU.js";import"./chunk-JRJHXLGP.js";import{g as F,h as N,i as C}from"./chunk-FCMXEFJA.js";import"./chunk-T4R3ZVEM.js";import"./chunk-7WIBGKBU.js";import{d as G,g as X,h as Y,i as J}from"./chunk-IKJZPPOA.js";import{a as P}from"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{e as _,o as B}from"./chunk-TENPGIPX.js";function A(n){let i=/\.gbz\.db$/i;return i.test(n)?n.replace(i,".haplotype-index.db"):void 0}function ge(n){return Y(n)&&A(X(n))?J(n,i=>A(i)):void 0}function ye(n){return n instanceof Error&&(/\bHTTP 40[34]\b/.test(n.message)||n.code==="ENOENT")}async function ce(n,i){let e=ge(n);if(!e)return{};try{return await P(e,i).stat(),{location:e}}catch(t){return ye(t)?{}:{unreadable:String(t)}}}var be=5e3,we=50*2**20,H=class extends Error{constructor(e){super(`this GAF is ${(e/2**20).toFixed(0)} MB without an index; bgzip it and index it with tabix -p gaf`);this.name="UnindexedGafTooLargeError"}};function xe(n,i){if(n.length<=i)return n;let e=n.length/i;return Array.from({length:i},(t,a)=>n[Math.floor(a*e)])}var pe=(n,i)=>n.path.some(e=>i.has(e.name)),v=class{constructor(i,e){this.file=i;this.tabix=e;this.whole=L({setup:async({signal:i})=>{let{size:e}=await this.file.stat();if(e>we)throw new H(e);let t=await this.file.readFile({signal:i}),a=new TextDecoder().decode(t[0]===31&&t[1]===139?await K(t):t);return E(a)}})}async readIndexed(i,e,t){let a=1/0,r=-1/0;for(let s of e){let c=Number(s);Number.isInteger(c)&&(a=Math.min(a,c),r=Math.max(r,c))}let o=[];return a<=r&&await i.getLines("{node}",a,r+1,{signal:t,lineCallback:s=>{let c=z(s);c&&pe(c,e)&&o.push(c)}}),o}async readsOver(i,{signal:e}={}){let t=this.tabix?await this.readIndexed(this.tabix,i,e):(await this.whole({signal:e})).filter(a=>pe(a,i));return{records:xe(t,be),total:t.length}}};var I=class extends Error{constructor(e){super(e===void 0?"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":`the haplotype index beside the graph database could not be checked (${e}), so the walks cannot be named; if it is there, reload to try again, or set haplotypeIndexLocation`);this.name="NoHaplotypeIndexError"}},q=class extends Error{constructor(e,t){super(`the graph is cut on its reference, ${t}; a window on ${e} has no reference coordinates to cut at. Open the graph from a ${t} view, and find this haplotype's lane there`);this.name="HaplotypeWindowError"}};function Se(n,i){return`${u(n)}#${n.contig}@${i.start.node}.${i.start.offset}`}function Ne({alignment:n,assemblyName:i,refName:e,lane:t}){let{refStart:a,refEnd:r,strand:o,cigar:s}=n;if(!(r<=a)){let{name:c,hapStart:p,hapEnd:l}=n,f=Se(c,n),g={uniqueId:f,assemblyName:i,refName:e,start:a,end:r,type:"match",strand:o==="-"?-1:1,CIGAR:s,syntenyId:f,mate:{refName:c.contig,start:p,end:l,assemblyName:t}};return new ne(g)}}function Pe({pair:n,lane:i,mateLane:e}){return se({target:{name:`${u(n.target)}#${n.target.contig}`,assemblyName:i,refName:n.target.contig,start:n.targetStart,end:n.targetEnd},query:{name:`${u(n.query)}#${n.query.contig}`,assemblyName:e,refName:n.query.contig,start:n.queryStart,end:n.queryEnd},strand:n.strand,cigar:n.cigar,matches:n.matches,columns:n.columns})}var Le=12e4;function Re(n,i){let e=new Map;for(let a of n)for(let{name:r,start:o,end:s}of a.walkSpans()){let c=u(r);if(i.has(c)){let p=`${c}#${r.contig}`,l=e.get(p);l?l.push([o,s]):e.set(p,[[o,s]])}}let t=0;for(let a of e.values()){a.sort((r,o)=>r[0]-o[0]);for(let r=1;r<a.length;r++){let o=a[r][0]-a[r-1][1];o>0&&o<=Le&&(t=Math.max(t,o))}}return t}function fe(n,i){return n instanceof Z&&(n.message=`Zoom in to about ${_(n.fitsBp)} to see ${i}`),n}var le=(n,i,e)=>ie(fe(W(n,i,e)??n,"lanes"),e),me=n=>({...n,start:Math.floor(n.start),end:Math.ceil(n.end)}),T=class extends ae{constructor(){super(...arguments);this.graph=L({label:"Opening pangenome database",setup:async()=>{let e=this.getConf("gbzDbLocation"),t=this.getConf("haplotypeIndexLocation"),a=G(t)?{location:t}:await ce(e,this.pluginManager),r=a.location,o=await D.open({source:P(e,this.pluginManager),haplotypeIndex:r?P(r,this.pluginManager):void 0}),s=this.getConf("assemblyNames")[0];if(s===void 0)throw new Error("GbzBaseSyntenyAdapter needs assemblyNames: its first entry is the assembly the reference sample is loaded as");let c=await M(o),p=j({configured:this.getConf("referenceSample"),anchorPrefix:N(this,s),referenceSamples:c});return{db:o,anchor:s,referenceSample:p,referenceSamples:c,unreadableIndex:a.unreadable}}});this.gaf=L({label:"Opening reads",setup:async()=>{let e=this.getConf("readsLocation"),t=this.getConf(["readsIndex","location"]);return G(e)?new v(P(e,this.pluginManager),G(t)?V(this,["readsLocation"],["readsIndex"]):void 0):void 0}})}async referenceQuery(e,t){let{db:a,referenceSample:r}=await this.graph(t);return $(a,r,e)}async getHaplotypes(e={}){let{db:t,referenceSamples:a}=await this.graph(e),r=new Map;for(let o of await t.paths()){let s=u(o.name),c=r.get(s);c?c.contigs.includes(o.name.contig)||c.contigs.push(o.name.contig):r.set(s,{prefix:s,sample:o.name.sample,haplotype:o.name.haplotype,contigs:[o.name.contig],isReference:a.includes(o.name.sample)})}return[...r.values()]}async getHeader(e={}){let{anchor:t,referenceSample:a}=await this.graph(e),r=C(this),o=[];for(let s of await this.getHaplotypes(e))s.sample!==a&&o.push({name:O(r,s.prefix),label:s.prefix,group:s.sample});return{hasCoarseTier:!1,anchorAssemblyName:t,lanes:o}}async getRefNames(e={}){let{db:t,anchor:a,referenceSample:r}=await this.graph(e),{assemblyName:o}=e,s=o===a?void 0:N(this,o),c=(await t.paths()).filter(p=>o===a?p.isIndexed&&p.name.sample===r:F(u(p.name),s)).map(p=>p.name.contig);return[...new Set(c)]}keepPredicate(e,t){let a=e===void 0||e.length===0?void 0:e.map(r=>N(this,r));return a===void 0&&t===void 0?void 0:r=>k(r,a)&&(t===void 0||F(u(r),t))}async getSubgraph(e,t={}){let{signal:a}=t,{db:r,anchor:o,referenceSample:s,unreadableIndex:c}=await this.graph({signal:a}),{assemblyName:p,refName:l,start:f,end:g}=me(e);if(p!==o)throw new q(p,o);let y=await this.referenceQuery(l,{signal:a});if(!y)throw new Error(`${s} has no indexed path ${l} in this graph`);let b=this.keepPredicate(t.haplotypes);if(b!==void 0&&!r.hasHaplotypeIndex)throw new I(c);let d=await U(r,y,f,g,{context:this.getConf("context"),snarls:t.snarls??this.getConf("subgraphSnarls"),limit:this.getConf("nodeLimit"),signal:t.signal,keep:b}).catch(w=>{throw fe(w,"the graph")});return typeof d=="string"?d:te(d,{start:f,end:g},t.walkRows)}async getReads(e,t={}){let a=await this.gaf(t);return a?a.readsOver(new Set(e),t):{records:[],total:0}}async laneHaplotypes(e,t){let a=N(this,e);return(await this.getHaplotypes(t)).filter(r=>F(r.prefix,a))}async anchorFeatures(e,t){let{db:a}=await this.graph(t),{assemblyName:r,refName:o,start:s,end:c}=e,p=N(this,t.targetAssemblyName),l=C(this),f=this.keepPredicate(t.haplotypes,p),g=await this.referenceQuery(o,t),y=this.getConf("nodeLimit");return(g?await B(`Reading graph ${o}:${s.toLocaleString()}-${c.toLocaleString()}`,t.statusCallback,()=>a.getAlignments({path:g,start:s,end:c,context:this.getConf("context"),haplotypes:"all",limit:y,signal:t.signal,keep:f}).catch(d=>{throw le(d,y,c-s)})):[]).flatMap(d=>{let w=d.resolved?Ne({alignment:d,assemblyName:r,refName:o,lane:O(l,u(d.name))}):void 0;return w===void 0?[]:[w]})}async pairFeatures(e,t,a){let{db:r}=await this.graph(a),{refName:o,start:s,end:c}=e,l=(await Promise.all(t.map(async m=>({pair:m,featureSide:await this.laneHaplotypes(m.queryAssemblyName,a),mateSide:await this.laneHaplotypes(m.targetAssemblyName,a)})))).filter(({featureSide:m,mateSide:h})=>m.length>0&&h.length>0),f=new Set(l.flatMap(({featureSide:m,mateSide:h})=>[...m,...h].map(u))),g=await this.referenceQuery(o,a),y=this.getConf("nodeLimit"),b=this.getConf("context"),d=(m,h)=>r.getSubgraphs({path:m,start:s,end:c,context:h,snarls:this.getConf("subgraphSnarls"),haplotypes:"all",limit:y,signal:a.signal,keep:x=>f.has(u(x))}),w=async m=>{let h=await d(m,b).catch(S=>{throw le(S,y,c-s)}),x=Re(h,f),R=Math.ceil(x/2)+2e3;return x>0&&R>b?d(m,R).catch(S=>{if(S instanceof Q)return h;throw S}):h};return(g&&l.length>0?await B(oe(t),a.statusCallback,()=>w(g)):[]).flatMap(m=>l.flatMap(({pair:h,featureSide:x,mateSide:R})=>x.flatMap(S=>R.flatMap(de=>m.pairAlignments({target:S,query:de,bases:!1}).map(he=>Pe({pair:he,lane:h.queryAssemblyName,mateLane:h.targetAssemblyName}))))))}getFeatures(e,t={}){let a=me(e);return ee(async r=>{let{db:o,anchor:s,unreadableIndex:c}=await this.graph(t);if(!o.hasHaplotypeIndex)throw new I(c);if(a.assemblyName===s){let p=re(t),l=p.length>0?await this.pairFeatures(a,p,t):await this.anchorFeatures(a,t);for(let f of l)r.next(f)}r.complete()},t.signal)}};export{I as NoHaplotypeIndexError,ue as PairTargetError,T as default,Re as widestWalkGap};
|
|
2
|
-
//# sourceMappingURL=GbzBaseSyntenyAdapter-4KVWVUN6.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{a as C}from"./chunk-42KD4AVY.js";import"./chunk-OZEKEYT3.js";import"./chunk-KOC23YNN.js";import"./chunk-DAPI7M4M.js";import{n as d}from"./chunk-Z3IKZAYC.js";import"./chunk-BCOXRUNQ.js";import"./chunk-VTMJQFN5.js";import"./chunk-XZGYJ3JC.js";import"./chunk-4NIWMRKH.js";import"./chunk-GYY6LF5L.js";import"./chunk-22ANI2KL.js";import"./chunk-POUV7OPY.js";import"./chunk-YBLNN5FU.js";import"./chunk-DEWZOJSC.js";import"./chunk-SPL3UO2D.js";import"./chunk-YBLNN5FU.js";import"./chunk-JRJHXLGP.js";import"./chunk-FCMXEFJA.js";import"./chunk-IKJZPPOA.js";import"./chunk-NDRLCGPC.js";import"./chunk-TENPGIPX.js";import{h as L}from"./chunk-YU7T5WOQ.js";import{A as l,F as G,H as p,e as s,j as v,o as n,x as y}from"./chunk-UGCNPRKC.js";import{a as h,b as e,c as r,d as i}from"./chunk-JMBDTNUR.js";var N=d()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),S=i(function({model:a}){let{classes:t}=N();return!a.error&&!a.loadCanceled?r(l,{className:t.paper,"data-testid":"graph-genome-loading",children:[r("div",{className:t.row,children:[e(v,{variant:"h6",message:a.statusMessage||void 0}),a.canCancelLoad?e(n,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{a.cancelLoad()},children:"Cancel"}):null]}),e(y,{variant:"indeterminate"})]}):a.error?e(l,{className:t.paper,children:e(s,{error:a.error,onReset:()=>{a.retryLoad()}})}):e(l,{className:t.paper,"data-testid":"graph-genome-load-canceled",children:r("div",{className:t.row,children:[e(p,{variant:"h6",children:"Loading canceled"}),e(n,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{a.retryLoad()},children:"Retry"})]})})}),f=S;var T=`H VN:Z:1.0
|
|
2
|
-
S 1 ACGT
|
|
3
|
-
S 2 GGCC
|
|
4
|
-
S 3 TTAA
|
|
5
|
-
S 4 CCGG
|
|
6
|
-
L 1 + 2 + 0M
|
|
7
|
-
L 1 + 3 + 0M
|
|
8
|
-
L 2 + 4 + 0M
|
|
9
|
-
L 3 + 4 + 0M`,E=d()({column:{display:"flex",flexDirection:"column",gap:8},rowEnd:{display:"flex",gap:8,alignItems:"flex-end"},rowCenter:{display:"flex",gap:8,alignItems:"center"},flex1:{flex:1},paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto"},header:{marginBottom:12},footer:{marginTop:12,display:"flex",justifyContent:"flex-end"}}),F=i(function({model:a}){let{classes:t}=E(),[m,w]=L("");function u(){let o=m.trim();o&&a.openGfaLocation({uri:o,locationType:"UriLocation"})}function M(o){let c=o.target.files?.[0];o.target.value="",c&&a.loadGFAFile(c,c.name)}return r(l,{className:t.paper,children:[e("div",{className:t.header,children:e(p,{variant:"h6",children:"Load a GFA graph"})}),r("div",{className:t.column,children:[r("div",{className:t.rowCenter,children:[r(n,{variant:"outlined",component:"label",size:"small",children:["Choose file",e("input",{type:"file",accept:".gfa,.gfa1,.gfa2,.gz",hidden:!0,onChange:o=>{M(o)}})]}),e(p,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),r("div",{className:t.rowEnd,children:[e(G,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:m,onChange:o=>{w(o.target.value)},onKeyDown:o=>{o.key==="Enter"&&u()},className:t.flex1}),e(n,{variant:"contained",onClick:()=>{u()},disabled:!m.trim(),children:"Open"})]})]}),e("div",{className:t.footer,children:e(n,{size:"small",onClick:()=>{a.loadGFA(T,"Example graph")},children:"Load 4-node example"})}),a.error?e(s,{error:a.error}):null]})}),x=F;var B=i(function({model:a}){return a.hasGraph?e(C,{model:a}):a.canRetryLoad?e(f,{model:a}):r(h,{children:[a.isLoading?e(f,{model:a}):null,e("div",{hidden:a.isLoading,children:e(x,{model:a})})]})}),q=B;export{q as default};
|
|
10
|
-
//# sourceMappingURL=GraphGenomeView-KI4FQ5A7.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as h}from"./chunk-42KD4AVY.js";import"./chunk-OZEKEYT3.js";import"./chunk-KOC23YNN.js";import"./chunk-DAPI7M4M.js";import"./chunk-Z3IKZAYC.js";import"./chunk-BCOXRUNQ.js";import"./chunk-VTMJQFN5.js";import"./chunk-XZGYJ3JC.js";import"./chunk-4NIWMRKH.js";import"./chunk-GYY6LF5L.js";import"./chunk-22ANI2KL.js";import"./chunk-POUV7OPY.js";import"./chunk-YBLNN5FU.js";import"./chunk-DEWZOJSC.js";import"./chunk-SPL3UO2D.js";import"./chunk-YBLNN5FU.js";import"./chunk-JRJHXLGP.js";import"./chunk-FCMXEFJA.js";import"./chunk-IKJZPPOA.js";import"./chunk-NDRLCGPC.js";import"./chunk-TENPGIPX.js";import{h as T}from"./chunk-YU7T5WOQ.js";import"./chunk-UGCNPRKC.js";import{b as r,c as d,d as i}from"./chunk-JMBDTNUR.js";var n=JBrowseExports["@jbrowse/display-kit/DisplayBackgroundProgress"];var f=n&&n.__esModule?n.default:n;var l=JBrowseExports["@jbrowse/display-kit/DisplayErrorBar"];var v=l&&l.__esModule?l.default:l;var p=JBrowseExports["@jbrowse/display-kit/DisplayLoadingOverlay"];var O=p&&p.__esModule?p.default:p;var c=JBrowseExports["@jbrowse/display-kit/TooLargeMessage"];var L=c&&c.__esModule?c.default:c;var s=JBrowseExports["@jbrowse/display-ui"],u=e=>s!=null&&e in Object(s)?s[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-ui' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var w=u("BottomRightCornerContext");var g=u("TrackOverlayPortal");var C=u("useChromeOverlayOverride");var U=s&&s.__esModule?s.default:s;var k={TooLarge:L,ErrorBar:v,Loading:O,BackgroundProgress:f},m="Zoom in to see features, or force load this track for the rest of the session (may be slow)",M="Force load this track for the rest of the session (may be slow)";function H(e){let{error:o}=e,t=o instanceof Error&&o.regionTooLarge===!0;return{error:{error:o,onRetry:t?void 0:()=>{e.reload()}},tooLarge:{message:[e.regionTooLargeReason,e.zoomCanReleaseGate?m:M].filter(Boolean).join(". "),onForceLoad:()=>{e.forceLoad()}},loading:{message:e.statusMessage,progress:e.statusProgress,canceled:e.fetchCanceled,onCancel:()=>{e.cancelFetchByUser()},onRetry:()=>{e.reload()}},background:{message:e.statusMessage,progress:e.statusProgress}}}var _=i(function({model:o,phase:t,drawn:x,testid:E,style:B,children:G,...S}){let{TooLarge:b,ErrorBar:P,Loading:A,BackgroundProgress:D}=C()??k,[R,I]=T(null),a=H(o),y={...S,"data-testid":E,"data-display-id":o.configuration.displayId,"data-display-drawn":x,"data-display-phase":t};return t==="tooLarge"?r("div",{style:{display:"contents"},...y,children:r(g,{children:r("div",{style:{pointerEvents:"auto"},children:r(b,{model:o,...a.tooLarge})})})}):d("div",{style:{position:"relative",height:o.height,...B},...y,children:[r(w,{value:R,children:G}),d(g,{children:[t==="error"&&o.error!==void 0?r(P,{model:o,visible:!0,...a.error}):null,r(A,{model:o,...a.loading,visible:t==="loading"||t==="canceled",immediate:!x}),r("div",{ref:I,style:{position:"absolute",bottom:2,right:2,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none"},children:t==="ready"&&o.statusMessage?r(D,{model:o,visible:!0,...a.background}):null})]})]})});var j=i(function({model:o}){return r(_,{model:o,phase:o.displayPhase,drawn:o.painted&&o.geometryPainted,testid:"linear-graph-display","data-layout":o.chosenLayoutMode,"data-cut-tier":o.cutTier,"data-recuts":o.recuts,"data-node-count":o.hasGraph?o.nodeCount:void 0,"data-loading":o.isLoading?"":void 0,style:{width:o.paneWidth,height:o.height,overflow:"hidden"},children:r(h,{model:o,ownChrome:!1})})}),so=j;export{so as default};
|
|
2
|
-
//# sourceMappingURL=LinearGraphDisplay-RPZUZSM2.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as d,g as l}from"./chunk-SPL3UO2D.js";import{a as m,b as u,c as p,d as f}from"./chunk-FCMXEFJA.js";var v=new Map([["hg38","GRCh38"],["hg19","GRCh37"],["hs1","CHM13"],["t2t-chm13","CHM13"],["chm13v2","CHM13"]]);function M(n){return v.get(n.toLowerCase())}function h(n){let t=n.includes("#")?m(n):void 0;return t===void 0||u(t)?void 0:t}function N(n){return p(n)??m(n)}function b(n){let t=new Set((n.anchorPaths??[]).map(e=>e.name));for(let e of n.nodes)e.stable&&t.add(e.stable.refName);let s=new Map;for(let e of t){let o=h(e);o!==void 0&&d(s,o,N(e))}return s}function g(n,t){let s=new Set(n.map(i=>h(i.refName))),[e]=s;if(s.size!==1||e===void 0)return{contigs:n,prefixes:[],named:!1};let o=new Set(n.map(i=>N(i.refName))),c=[...t.get(e)??[]].every(i=>o.has(i)),a=new Set(n.map(i=>p(i.refName))),[r]=a;return{contigs:n,prefixes:[...c?[e]:[],...a.size===1&&r?[r]:[]],named:!0}}function S(n){let t=new Map;for(let e of n.nodes)if(l(e)){let{refName:o,start:c}=e.stable,a=c+e.length,r=t.get(o);r?(r.start=Math.min(r.start,c),r.end=Math.max(r.end,a)):t.set(o,{refName:o,contig:f(o),start:c,end:a})}let s=[...t.values()];return s.length?g(s,b(n)):void 0}function B(n,t){let s=S(n),e=t?f(t.refName):s?.contigs.length===1?s.contigs[0].contig:void 0,o=s?.named?m(s.contigs[0].refName):void 0;return e&&(o?`${o} ${e}`:e)}function w(n,t){let s=a=>[a.name,...a.aliases??[]],e=a=>r=>s(r).some(i=>i.toLowerCase()===a.toLowerCase()),o=[...n?.prefixes??[]].reverse(),c=n?.prefixes.find(a=>!a.includes("#"))?.toLowerCase();for(let a of o){let r=t.find(e(a));if(r)return r}return c===void 0?void 0:t.find(a=>s(a).some(r=>M(r)?.toLowerCase()===c))}function O(n,t){let s=b(n);return n.anchorPaths?.find(e=>w(g([{refName:e.name,contig:f(e.name),start:e.start,end:e.start+e.length}],s),[t]))}function y(n){let t=n.replace(/^chr/i,""),s=t?/^(M|MT)$/i.test(t)?["M","MT"]:[t]:[];return[...new Set([n,...s.flatMap(e=>[e,`chr${e}`])])]}function C(n,t={}){let s=new Set(n),e=new Map;for(let o of s){let c=f(o),a=t[c];for(let r of new Set([...y(c),...a?[a]:[]]))e.set(r,e.has(r)?void 0:o)}return o=>s.has(o)?o:e.get(o)}function $(n,t,s){let e=C(t.contigs.map(o=>o.refName),s);return n.flatMap(o=>{let c=e(o.refName);return c===void 0?[]:[c===o.refName?o:{...o,refName:c}]})}export{M as a,S as b,B as c,w as d,O as e,$ as f};
|
|
2
|
-
//# sourceMappingURL=chunk-22ANI2KL.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@11.11.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-5ORP7EFJ.js"],
|
|
4
|
-
"sourcesContent": ["import {\n addTo\n} from \"./chunk-BSOZW3FC.js\";\nimport {\n isBackbone\n} from \"./chunk-RJWPJCIB.js\";\nimport {\n isGenericSample,\n panSNContig,\n panSNHaplotype,\n panSNSample\n} from \"./chunk-2JL2JVZ2.js\";\n\n// src/reference.ts\nvar WELL_KNOWN_SAMPLES = /* @__PURE__ */ new Map([\n [\"hg38\", \"GRCh38\"],\n [\"hg19\", \"GRCh37\"],\n [\"hs1\", \"CHM13\"],\n [\"t2t-chm13\", \"CHM13\"],\n [\"chm13v2\", \"CHM13\"]\n]);\nfunction wellKnownSample(assemblyName) {\n return WELL_KNOWN_SAMPLES.get(assemblyName.toLowerCase());\n}\nfunction sampleOf(refName) {\n const sample = refName.includes(\"#\") ? panSNSample(refName) : void 0;\n return sample === void 0 || isGenericSample(sample) ? void 0 : sample;\n}\nfunction haplotypeOf(refName) {\n return panSNHaplotype(refName) ?? panSNSample(refName);\n}\nfunction graphHaplotypes(graph) {\n const refNames = new Set((graph.anchorPaths ?? []).map((p) => p.name));\n for (const node of graph.nodes) {\n if (node.stable) {\n refNames.add(node.stable.refName);\n }\n }\n const bySample = /* @__PURE__ */ new Map();\n for (const refName of refNames) {\n const sample = sampleOf(refName);\n if (sample !== void 0) {\n addTo(bySample, sample, haplotypeOf(refName));\n }\n }\n return bySample;\n}\nfunction backboneFrom(contigs, haplotypes) {\n const samples = new Set(contigs.map((c) => sampleOf(c.refName)));\n const [sample] = samples;\n if (samples.size !== 1 || sample === void 0) {\n return { contigs, prefixes: [], named: false };\n }\n const own = new Set(contigs.map((c) => haplotypeOf(c.refName)));\n const unique = [...haplotypes.get(sample) ?? []].every((h) => own.has(h));\n const shared = new Set(contigs.map((c) => panSNHaplotype(c.refName)));\n const [haplotype] = shared;\n return {\n contigs,\n prefixes: [\n ...unique ? [sample] : [],\n ...shared.size === 1 && haplotype ? [haplotype] : []\n ],\n named: true\n };\n}\nfunction graphBackbone(graph) {\n const spans = /* @__PURE__ */ new Map();\n for (const node of graph.nodes) {\n if (isBackbone(node)) {\n const { refName, start } = node.stable;\n const end = start + node.length;\n const span = spans.get(refName);\n if (span) {\n span.start = Math.min(span.start, start);\n span.end = Math.max(span.end, end);\n } else {\n spans.set(refName, {\n refName,\n contig: panSNContig(refName),\n start,\n end\n });\n }\n }\n }\n const contigs = [...spans.values()];\n return contigs.length ? backboneFrom(contigs, graphHaplotypes(graph)) : void 0;\n}\nfunction referenceLabel(graph, region) {\n const backbone = graphBackbone(graph);\n const contig = region ? panSNContig(region.refName) : backbone?.contigs.length === 1 ? backbone.contigs[0].contig : void 0;\n const sample = backbone?.named ? panSNSample(backbone.contigs[0].refName) : void 0;\n return contig && (sample ? `${sample} ${contig}` : contig);\n}\nfunction backboneAssembly(backbone, assemblies) {\n const names = (a) => [a.name, ...a.aliases ?? []];\n const naming = (prefix) => (a) => names(a).some((n) => n.toLowerCase() === prefix.toLowerCase());\n const prefixes = [...backbone?.prefixes ?? []].reverse();\n const sample = backbone?.prefixes.find((p) => !p.includes(\"#\"))?.toLowerCase();\n for (const prefix of prefixes) {\n const assembly = assemblies.find(naming(prefix));\n if (assembly) {\n return assembly;\n }\n }\n return sample === void 0 ? void 0 : assemblies.find(\n (a) => names(a).some((n) => wellKnownSample(n)?.toLowerCase() === sample)\n );\n}\nfunction assemblyWalk(graph, assembly) {\n const haplotypes = graphHaplotypes(graph);\n return graph.anchorPaths?.find(\n (walk) => backboneAssembly(\n backboneFrom(\n [\n {\n refName: walk.name,\n contig: panSNContig(walk.name),\n start: walk.start,\n end: walk.start + walk.length\n }\n ],\n haplotypes\n ),\n [assembly]\n )\n );\n}\nfunction contigNames(contig) {\n const bare = contig.replace(/^chr/i, \"\");\n const forms = !bare ? [] : /^(M|MT)$/i.test(bare) ? [\"M\", \"MT\"] : [bare];\n return [.../* @__PURE__ */ new Set([contig, ...forms.flatMap((f) => [f, `chr${f}`])])];\n}\nfunction refNameBinding(refNames, aliases = {}) {\n const exact = new Set(refNames);\n const byName = /* @__PURE__ */ new Map();\n for (const refName of exact) {\n const contig = panSNContig(refName);\n const alias = aliases[contig];\n for (const name of /* @__PURE__ */ new Set([\n ...contigNames(contig),\n ...alias ? [alias] : []\n ])) {\n byName.set(name, byName.has(name) ? void 0 : refName);\n }\n }\n return (name) => exact.has(name) ? name : byName.get(name);\n}\nfunction featuresOnBackbone(features, backbone, aliases) {\n const bind = refNameBinding(\n backbone.contigs.map((c) => c.refName),\n aliases\n );\n return features.flatMap((f) => {\n const refName = bind(f.refName);\n return refName === void 0 ? [] : [refName === f.refName ? f : { ...f, refName }];\n });\n}\n\nexport {\n WELL_KNOWN_SAMPLES,\n wellKnownSample,\n graphBackbone,\n referenceLabel,\n backboneAssembly,\n assemblyWalk,\n contigNames,\n refNameBinding,\n featuresOnBackbone\n};\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["WELL_KNOWN_SAMPLES", "wellKnownSample", "assemblyName", "sampleOf", "refName", "sample", "panSNSample", "isGenericSample", "haplotypeOf", "panSNHaplotype", "graphHaplotypes", "graph", "refNames", "p", "node", "bySample", "addTo", "backboneFrom", "contigs", "haplotypes", "samples", "c", "own", "unique", "h", "shared", "haplotype", "graphBackbone", "spans", "isBackbone", "start", "end", "span", "panSNContig", "referenceLabel", "region", "backbone", "contig", "backboneAssembly", "assemblies", "names", "naming", "prefix", "a", "n", "prefixes", "assembly", "assemblyWalk", "walk", "contigNames", "bare", "forms", "f", "refNameBinding", "aliases", "exact", "byName", "alias", "name", "featuresOnBackbone", "features", "bind"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as lt,c as dt,d as ht,g as N,j as J,l as xt,q as pt,r as R,w as mt,x as Mt}from"./chunk-SPL3UO2D.js";import{b as yt}from"./chunk-FCMXEFJA.js";var bt=20;function lo(t){let n=o=>Math.round(o*100)/100;return t.map((o,e)=>`${e?"L":"M"}${n(o.x)},${n(o.y)}`).join("")}function gt(t,n,o,e,s){let r=Math.hypot(e-n,o-t);if(r===0)return[o,e];let c=(o-t)/r,a=(e-n)/r;return[o+s*c,e+s*a]}function Y(t,n){let o=1-n,e=o*o*o,s=3*o*o*n,r=3*o*n*n,c=n*n*n;return{x:e*t.x0+s*t.cx0+r*t.cx1+c*t.x1,y:e*t.y0+s*t.cy0+r*t.cy1+c*t.y1}}function Ot(t){let n=t[Math.floor(t.length/2)];return n?Y(n,.5):void 0}function St(t){let n=1/0,o=1/0,e=-1/0,s=-1/0;for(let r of t)n=Math.min(n,r.x0,r.cx0,r.cx1,r.x1),e=Math.max(e,r.x0,r.cx0,r.cx1,r.x1),o=Math.min(o,r.y0,r.cy0,r.cy1,r.y1),s=Math.max(s,r.y0,r.cy0,r.cy1,r.y1);return{minX:n,minY:o,maxX:e,maxY:s}}function Qt(t,n,o){let e=Y(t,n),s=Y(t,o),r=(o-n)/3,c=vt(t,n),a=vt(t,o);return{x0:e.x,y0:e.y,cx0:e.x+c.x*r,cy0:e.y+c.y*r,cx1:s.x-a.x*r,cy1:s.y-a.y*r,x1:s.x,y1:s.y}}function vt(t,n){let o=1-n,e=3*o*o,s=6*o*n,r=3*n*n;return{x:e*(t.cx0-t.x0)+s*(t.cx1-t.cx0)+r*(t.x1-t.cx1),y:e*(t.cy0-t.y0)+s*(t.cy1-t.cy0)+r*(t.y1-t.cy1)}}var H=32;function Zt(t,n,o,e){let s=[],r=0;return t.forEach((c,a)=>{let i=n[a],d=i/H,l=Y(c,0);for(let u=1;u<=H;u++){let h=Y(c,u/H);if(Math.max(l.x,h.x)+d>=o.minX&&Math.min(l.x,h.x)-d<=o.maxX&&Math.max(l.y,h.y)+d/e>=o.minY&&Math.min(l.y,h.y)-d/e<=o.maxY){let f=r+i*(u-1)/H,x=r+i*u/H,y=s.at(-1);y&&y[1]>=f?y[1]=x:s.push([f,x])}l=h}r+=i}),s}function ho(t,n,o=1,e){let s=t.map(u=>Math.hypot(u.cx0-u.x0,(u.cy0-u.y0)*o)+Math.hypot(u.cx1-u.cx0,(u.cy1-u.cy0)*o)+Math.hypot(u.x1-u.cx1,(u.y1-u.cy1)*o)),r=s.reduce((u,h)=>u+h,0),c=Math.round(r/n),a=Math.max(3,c%2?c:c+1),i=e?Zt(t,s,e,o):void 0,d=0,l=[];for(let u=0;u<a;u+=2){let h=u/a*r,f=(u+1)/a*r;if(i){for(;d<i.length&&i[d][1]<h;)d++;if(d===i.length)break;if(i[d][0]>f)continue}let x=[],y=[],p=0;t.forEach((b,m)=>{let M=s[m],v=p+M;if(M>0&&v>h&&p<f){let g=Math.max(0,(h-p)/M),w=Math.min(1,(f-p)/M);x.push(Qt(b,g,w)),y.push((m+g)/t.length,(m+w)/t.length)}p=v}),x.length&&l.push({curves:x,startAlong:y[0],endAlong:y.at(-1)})}return l}var xo=(t,n,o)=>({dx:t.dx+(n.dx-t.dx)*o,dy:t.dy+(n.dy-t.dy)*o});function yo(t,n,o,e,s){let r=t.length,c=new Array(r);for(let a=0;a<r;a++){let i=t[a],d=a/r,l=(a+1)/r,u=n+(e-n)*d,h=o+(s-o)*d,f=n+(e-n)*l,x=o+(s-o)*l;c[a]={x0:i.x0+u,y0:i.y0+h,cx0:i.cx0+u,cy0:i.cy0+h,cx1:i.cx1+f,cy1:i.cy1+x,x1:i.x1+f,y1:i.y1+x}}return c}function po(t,n,o){let e=new Array(t.length);for(let s=0;s<t.length;s++){let r=t[s];e[s]={x0:r.x0+n,y0:r.y0+o,cx0:r.cx0+n,cy0:r.cy0+o,cx1:r.cx1+n,cy1:r.cy1+o,x1:r.x1+n,y1:r.y1+o}}return e}function $(t,n){let o=t.length-1;return n==="end"?{at:t[o],inward:t[o-1]}:{at:t[0],inward:t[1]}}var tn=.5,nn=80;function F(t){return t.endsWith("-")?"-":"+"}function G(t){let n=(o,e)=>(e??F(o))===F(o);return{from:n(t.from,t.fromStrand)?"end":"start",to:n(t.to,t.toStrand)?"start":"end"}}function wt(t){let n=1/0,o=-1/0;for(let e of t)n=Math.min(n,e.x),o=Math.max(o,e.x);return{min:n,max:o}}function At(t,n){return Math.max(0,n.min-t,t-n.max)}function _t(t,n,o){let e=At(t[0].x,n),s=At(t[t.length-1].x,n);return e===s?o:e<s?"start":"end"}function on(t,n){return{from:_t(t,wt(n),"end"),to:_t(n,wt(t),"start")}}var Et=new WeakMap;function en(t,n){let o=Et.get(t);o||(o=new WeakMap,Et.set(t,o));let e=o.get(n);return e||(e=on(t,n),o.set(n,e)),e}var sn=.75,rn=1.15,cn=.35,an=3*bt;function fn(t,n,o,e,s,r){let c=Math.hypot(o-t,e-n),a=c===0?1:(o-t)/c,i=c===0?0:(e-n)/c,d=0,l=1/0,u=-1/0;for(let y of s){let p=y.x-t,b=y.y-n,m=p*-i+b*a;Math.abs(m)>Math.abs(d)&&(d=m);let M=p*a+b*i;l=Math.min(l,M),u=Math.max(u,M)}let h=s.length?u-l:0,f=Math.max(Math.abs(d)*rn/sn,h*cn),x=r===void 0?f:Math.min(f,r);return d<0?-x:x}function Pt({scaleX:t,scaleY:n}){return n/t}var un=3;function K(t,n,o){let e=n.x-t.x,s=(n.y-t.y)*o,r=Math.hypot(e,s);return r===0?void 0:{x:e/r,y:s/r}}function mo(t,n,o,e){let s=Pt(e),r=un/Math.max(e.scaleX,1e-6),c=K(t[t.length-1],n[0],s)??K(t[0],t.at(-1),s)??K(n[0],n.at(-1),s)??{x:1,y:0},a=[];for(let i=0;i<o;i++){let d=(i-(o-1)/2)*r;a.push({x:-c.y*d,y:c.x*d/s})}return a}function Q(t,n){return t.map(o=>({x:o.x,y:o.y*n}))}function ln(t,n){for(let o of t)o.y0/=n,o.cy0/=n,o.cy1/=n,o.y1/=n;return t}function Z(t,n,o){let e=0;for(let s=1;s<t.length;s++){let r=t[s-1],c=t[s];e+=Math.hypot((c.x-r.x)*n,(c.y-r.y)*o)}return e}var dn=12,hn=40;function It(t,n){let o=Z(t,n,n);return Math.min(hn,Math.max(dn,o/2))/Math.max(n,Number.EPSILON)}function xn(t){return t.from!==t.to?!1:t.fromStrand&&t.toStrand&&t.fromStrand!==t.toStrand?t.fromStrand==="+"?"end":"start":!0}function Xt(t,n=!1){let o=xn(t);if(!n)return o;let e=G(t);return o===!1?e:e.from===e.to?e.from:!0}function yn(t,n){let{at:o,inward:e}=t,s=e?o.x-e.x:1,r=e?o.y-e.y:0,c=Math.hypot(s,r)||1,a=s/c,i=r/c,d=o.x,l=o.y,u=d+a*n/3,h=l+i*n/3,f=d+a*n,x=l+i*n,y=-i*n/2,p=a*n/2;return[{x0:d,y0:l,cx0:u,cy0:h,cx1:f+y,cy1:x+p,x1:f,y1:x},{x0:f,y0:x,cx0:f-y,cy0:x-p,cx1:u,cy1:h,x1:d,y1:l}]}function tt(t,n,o,e,s=[],r){let c=e.scaleX,a=Pt(e),i=r??(e.pixelRows?an:void 0);if(o===!1&&(o=en(t,n)),a!==1)return ln(tt(Q(t,a),Q(n,a),o,{scaleX:c,scaleY:c},Q(s,a),i===void 0?void 0:i*a),a);if(typeof o=="string")return yn($(t,o),It(t,c));let d=o===!0,l=o===!0?{from:"end",to:"start"}:o,u=$(t,l.from),h=$(n,l.to),f=u.at,x=h.at,y=f.x,p=f.y,b=x.x,m=x.y;if(d){let M=1,v=0;if(u.inward){let S=f.x-u.inward.x,P=f.y-u.inward.y,C=Math.hypot(S,P);C>0&&(M=S/C,v=P/C)}let g=It(t,c),w=-v,_=M,I=(f.x+x.x)/2+w*g,E=(f.y+x.y)/2+_*g,A=y+M*g,X=p+v*g,O=b-M*g,L=m-v*g;return[{x0:y,y0:p,cx0:A,cy0:X,cx1:A+w*g,cy1:X+_*g,x1:I,y1:E},{x0:I,y0:E,cx0:O+w*g,cy0:L+_*g,cx1:O,cy1:L,x1:b,y1:m}]}else{let M=u.inward??{x:f.x-(x.x-f.x),y:f.y-(x.y-f.y)},v=h.inward??{x:x.x-(f.x-x.x),y:x.y-(f.y-x.y)},g=Math.hypot(b-y,m-p),w=(ct,at,Ut,Jt)=>{let it=at.x-ct.x,ft=at.y-ct.y,ut=Math.hypot(it,ft),Kt=ut===0?0:(Ut*it+Jt*ft)/ut;return Math.max(0,Math.min(g*tn,nn,Kt*.5))},_=x.x-f.x,I=x.y-f.y,[E,A]=gt(M.x,M.y,f.x,f.y,w(M,f,_,I)),[X,O]=gt(v.x,v.y,x.x,x.y,w(v,x,-_,-I)),L=s.length?fn(y,p,b,m,s,i):0,S=g===0?1:g,P=(b-y)/S,C=(m-p)/S,T=-C*L,B=P*L,W=P*Math.abs(L),rt=C*Math.abs(L);return[{x0:y,y0:p,cx0:E+T-W,cy0:A+B-rt,cx1:X+T+W,cy1:O+B+rt,x1:b,y1:m}]}}function Lt(t,n){let o=t[0],e=t.at(-1);return Math.hypot(o.x-n.x,o.y-n.y)<Math.hypot(e.x-n.x,e.y-n.y)?"start":"end"}function Ct(t,n,o,e){let s=$(t,e?.from??Lt(t,o[0])),r=$(n,e?.to??Lt(n,o.at(-1))),c=[s.at,...o,r.at],a=d=>{let l=c[d],u=f=>Math.hypot(f.x-l.x,f.y-l.y),h=(f,x)=>{let y=f?u(f):0,p=u(x);return y===0?{x:x.x-l.x,y:x.y-l.y}:{x:(l.x-f.x)/y*p,y:(l.y-f.y)/y*p}};if(d===0)return h(s.inward,c[1]);if(d===c.length-1){let f=h(r.inward,c[d-1]);return{x:-f.x,y:-f.y}}return{x:(c[d+1].x-c[d-1].x)/2,y:(c[d+1].y-c[d-1].y)/2}},i=[];for(let d=0;d<c.length-1;d++){let l=c[d],u=c[d+1],h=a(d),f=a(d+1);i.push({x0:l.x,y0:l.y,cx0:l.x+h.x/3,cy0:l.y+h.y/3,cx1:u.x-f.x/3,cy1:u.y-f.y/3,x1:u.x,y1:u.y})}return i}function nt(){let t=new WeakMap;return(n,o,e)=>{let s=t.get(n);if(s?.deps.length===o.length&&s.deps.every((c,a)=>Object.is(c,o[a])))return s.value;let r=e();return t.set(n,{deps:o,value:r}),r}}var Nt=11,pn=6.2,V=4;function ot(t){return t.length*pn+V*2}function mn(t,n){return t.x0<n.x1&&t.x1>n.x0&&t.y0<n.y1&&t.y1>n.y0}function kt(t,n){return t.x1<=0||t.x0>=n.width||t.y1<=0||t.y0>=n.height}function Mn(t,n){return t.x0>=0&&t.x1<=n.width&&t.y0>=0&&t.y1<=n.height}function Bt(t,n=[]){let o=[...n];return e=>kt(e,t)||o.some(s=>mn(s,e))?!1:(o.push(e),!0)}function go(t,n,o){let e=[],s=Nt+V*2,r=(c,a)=>{let i=ot(a),d=c.y>n.height/2?-1:1;for(let l=0;l<=(c.stack??0);l++){let u=c.y+d*l*s,h={x0:c.x-i/2,x1:c.x+i/2,y0:u-Nt-V,y1:u+V};if(kt(h,n))return;if(Mn(h,n)&&(c.fits?.(h)??!0)&&o(h))return{...c,text:a,y:u,w:i}}};for(let c of t){let a=r(c,c.text)??(c.fallback===void 0?void 0:r(c,c.fallback));a&&e.push(a)}return e}function Tt(t){return t==="+"?"-":"+"}function Eo(t,n=new Set){let o=t.edges.map(G),e=new Map,s=(f,x,y)=>{lt(e,`${f}|${x}`,y)};t.edges.forEach((f,x)=>{s(f.from,o[x].from,x),s(f.to,o[x].to,x)});let r=f=>{let x=e.get(`${f}|end`);if(x?.length!==1)return;let y=x[0],p=t.edges[y];return p.from===f&&p.to!==f&&!n.has(f)&&!n.has(p.to)&&o[y].from==="end"&&o[y].to==="start"&&e.get(`${p.to}|start`)?.length===1?y:void 0},c=new Set,a=new Map,i=new Map;for(let f of t.nodes){let x=e.get(`${f.id}|start`),y=x?.length===1?t.edges[x[0]].from:void 0;if(a.has(f.id)||y!==void 0&&r(y)===x[0])continue;let p=[f.id];for(;;){let b=r(p.at(-1)),m=b===void 0?void 0:t.edges[b].to;if(m===void 0||a.has(m))break;c.add(b),p.push(m)}for(let b of p)a.set(b,f.id);p.length>1&&i.set(f.id,p)}for(let f of t.nodes)a.has(f.id)||a.set(f.id,f.id);let d=new Map(t.nodes.map(f=>[f.id,f])),l=[];for(let f of t.nodes){if(a.get(f.id)!==f.id)continue;let x=i.get(f.id);if(!x){l.push(f);continue}let y=x.map(m=>d.get(m)),p=y.filter(N),b=p.length?p.reduce((m,M)=>m.stable.start<=M.stable.start?m:M):y[0];l.push({id:f.id,name:f.name,length:y.reduce((m,M)=>m+M.length,0),depth:f.depth,stable:b.stable})}let u=new Set,h=[];return t.edges.forEach((f,x)=>{let y=a.get(f.from),p=a.get(f.to),b=o[x],m=`${y}|${b.from}>${p}|${b.to}`;c.has(x)||u.has(m)||(u.add(m),h.push({from:y,to:p,...b.from==="start"?{fromStrand:Tt(F(y))}:{},...b.to==="end"?{toStrand:Tt(F(p))}:{}}))}),{graph:{...t,nodes:l,edges:h,paths:void 0,pathVisits:void 0},runs:i}}function Io(t,n,o){let e={...t};for(let[s,r]of n){let c=t[s];if(!c?.length)continue;delete e[s];let a=st(c),i=a.at(-1),d=r.map(h=>Math.max(o(h),0)),l=d.reduce((h,f)=>h+f,0),u=0;r.forEach((h,f)=>{let x=l?d[f]/l*i:i/r.length,y=f===r.length-1?i:u+x;e[h]=Ht(c,a,u,y),u=y})}return e}function Lo(t,n,o){if(t.length===0)return[];let e=st(t),s=e.at(-1);return Ht(t,e,n*s,o*s)}function Wt(t){let n=st(t);return et(t,n,n.at(-1)/2)}function st(t){let n=[0];for(let o=1;o<t.length;o++)n.push(n[o-1]+Math.hypot(t[o].x-t[o-1].x,t[o].y-t[o-1].y));return n}function Rt(t,n){let o=0,e=t.length;for(;o<e;){let s=o+e>>1;t[s]<n?o=s+1:e=s}return o}function et(t,n,o){if(o<=0)return{...t[0]};let e=Rt(n,o);if(e>=n.length)return{...t.at(-1)};let s=n[e]-n[e-1],r=s>0?(o-n[e-1])/s:0,c=t[e-1],a=t[e];return{x:c.x+(a.x-c.x)*r,y:c.y+(a.y-c.y)*r}}function Ht(t,n,o,e){let s=[et(t,n,o)];for(let r=Rt(n,o);r<t.length&&n[r]<e;r++)n[r]>o&&s.push({...t[r]});return s.push(et(t,n,e)),s}function Co(t,n){let o=new Set(t.nodes.filter(i=>N(i)&&J(i,n)).map(i=>i.id)),e=t.paths??[];if(o.size===0||e.length===0)return t;let s=e.map(i=>{let d=-1,l=-1;return i.nodeIds.forEach((u,h)=>{o.has(u)&&(d<0&&(d=h),l=h)}),d<0?void 0:{first:d,last:l}});if(s.every((i,d)=>i?.first===0&&i.last===e[d].nodeIds.length-1))return t;let r=new Set,c=[],a=new Map;return e.forEach((i,d)=>{let l=s[d];if(l){let u=i.nodeIds.slice(l.first,l.last+1);for(let h of u)r.add(h);c.push({...i,nodeIds:u}),a.set(i.name,{first:l.first,nodeIds:u})}}),{...t,nodes:t.nodes.filter(i=>r.has(i.id)),edges:t.edges.filter(i=>r.has(i.from)&&r.has(i.to)),paths:c,pathVisits:t.pathVisits&&bn(t.pathVisits,e,s,new Map(t.nodes.map(i=>[i.id,i.name]))),anchorPaths:mt(t,a)}}function bn(t,n,o,e){let s=t.replay(),r=new pt;return n.forEach((c,a)=>{let i=t.pathIndex(R(c.name).name),d=o[a];c.nodeIds.forEach((l,u)=>{let h=e.get(l)??l,f=s(t.slot(h),i);f>=0&&d&&u>=d.first&&u<=d.last&&r.add(h,t.paths[i],t.samples[i],t.start[f],t.reversed[f]===1)})}),r.build()}function No(t,n,o){let e=t.nodes.map(s=>{if(!N(s))return s;let r=s.stable.start,c=r+s.length,[a,i]=J(s,n)?[Math.max(r,n.start),Math.min(c,n.end)]:c<=n.start?[Math.max(r,c-o),c]:[r,Math.min(c,r+o)];return a===r&&i===c?s:{...s,length:i-a,stable:{...s.stable,start:a},unclipped:{start:r,length:s.length}}});return e.some((s,r)=>s!==t.nodes[r])?{...t,nodes:e}:t}function $t(t){return t.nodes.some(n=>n.unclipped)?{...t,nodes:t.nodes.map(({unclipped:n,...o})=>n&&o.stable?{...o,length:n.length,stable:{...o.stable,start:n.start}}:o)}:t}var gn=1;function vn(t,n){return n.flatMap(o=>t[o]??[])}function Ft(t,n,o,e,s,r){let c=t[n.from],a=t[n.to];if(!(!c?.length||!a?.length))return s?Ct(c,a,s,r?G(n):void 0):tt(c,a,Xt(n,r),o,e?vn(t,e):[])}function wn(t){let n=dt(t.nodes.filter(N),o=>o.stable.refName);for(let o of n.values())o.sort((e,s)=>e.stable.start-s.stable.start);return n}function An(t,n,o){let e=[];if(t)for(let s=xt(t,n);s<t.length;s++){let r=t[s];if(r.stable.start>=o)break;r.stable.start+r.length<=o&&e.push(r.id)}return e}function _n(t,n,o,e){let{fromStrand:s,toStrand:r}=t;if(s===void 0||r===void 0)return!0;let c=s===(n.stable.strand??"+"),a=r===(o.stable.strand??"+");return e?c&&a:!c&&!a}function En(t,n,o,e){let s;for(let r of e(n))for(let c of e(o)){let a=r<=c,i=a?{start:r+n.length,end:c}:{start:c+o.length,end:r};_n(t,n,o,a)&&(!s||Math.abs(i.end-i.start)<Math.abs(s.end-s.start))&&(s=i)}return s}var In=.01;function Ln(t,n){let o=new Map;for(let[e,s]of t){let r=s.flatMap(c=>{let a=n(c);return a.slice(1).map((i,d)=>({at:a[d],copy:i-a[d]}))});r.length&&o.set(e,r.sort((c,a)=>c.at-a.at))}return o}function On(t,n,o){if(!t)return!1;let e=ht(t.length,r=>t[r].at<n),s=[t[e-1],t[e]].filter(r=>r!==void 0).sort((r,c)=>Math.abs(r.at-n)-Math.abs(c.at-n))[0];return s!==void 0&&Math.abs(s.at-n)<=s.copy&&Math.abs(o-s.copy)<=s.copy*In}function Yo(t){let n=$t(t),o=new Map(n.nodes.map(a=>[a.id,a])),e=wn(n),s=Mt(n),r=Ln(e,s),c=[];for(let a=0;a<n.edges.length;a++){let i=n.edges[a],d=o.get(i.from),l=o.get(i.to);if(!i.foldBridge&&d!==void 0&&l!==void 0&&N(d)&&N(l)&&d.stable.refName===l.stable.refName){let u=En(i,d,l,s),h=d.stable.refName,f=u?u.end-u.start:0;if(u&&f>=gn&&!On(r.get(h),u.start,f)){let{start:x,end:y}=u;c.push({edgeIndex:a,from:i.from,to:i.to,...i.fromStrand?{fromStrand:i.fromStrand}:{},...i.toStrand?{toStrand:i.toStrand}:{},refName:h,start:x,end:y,bp:f,bypassed:An(e.get(h),x,y)})}}}return c}function Sn(t,n){let o=new Map,e=c=>{let a=c;for(;o.has(a);)a=o.get(a);return a!==c&&o.set(c,a),a},s=(c,a)=>{let[i,d]=[e(c),e(a)];return i!==d&&o.set(i,d),i!==d},r=new Set(n.map(c=>c.edgeIndex));return t.edges.forEach((c,a)=>{r.has(a)||s(c.from,c.to)}),new Set(n.filter(c=>!s(c.from,c.to)).map(c=>c.edgeIndex))}var Yt=new WeakMap;function Fo(t,n,o=!0){let e=Yt.get(n);e||(e=new Map,Yt.set(n,e));let s=e.get(o);if(!s){let r=o?new Set:Sn(t,n);s={shown:n.filter(c=>!r.has(c.edgeIndex)),bypassed:new Map(n.map(c=>[c.edgeIndex,c.bypassed])),hidden:r},e.set(o,s)}return s}var Pn=26,Xn=4e4,Cn=8,Nn=8,kn=5.7,Bn=6,Tn=13,D=3,q=2;function U(t){return(t.length*kn+Bn+D)/2}var k=(Tn+D)/2,Wn=U("1 bp");function j(t,n,o){return{x0:n-t,x1:n+t,y0:o-k,y1:o+k}}function Uo(t,n){return{x0:6,x1:6+ot(t)+D,y0:n-8-D/2,y1:n+8+D/2}}function z(t,n,o){return o<n?t:Math.min(Math.max(t,n),o)}function Vt(t){return String(t).replace(/\B(?=(\d{3})+$)/g,",")}function qt(t){let[n,o]=t>=999500?[t/1e6,"Mb"]:t>=1e3?[t/1e3,"kb"]:[];return n===void 0?`${t} bp`:`${+n.toFixed(n>=100?0:1)} ${o}`}function Gt(t){return`${qt(t)} del`}function Rn(t,n,o,e){let s=t[0],r=t[t.length-1],c=(n.x-(s.x0+r.x1)/2)*o,a=(n.y-(s.y0+r.y1)/2)*e,i=Math.hypot(c,a);return i===0?{x:0,y:-1}:{x:c/i,y:a/i}}function Hn(t,n){return Math.abs(n.x)*(t.x1-t.x0)/2+Math.abs(n.y)*(t.y1-t.y0)/2}function $n(t,n){let o=(t.x1-t.x0)/2,e=(t.y1-t.y0)/2;return Math.min(n.x===0?1/0:o/Math.abs(n.x),n.y===0?1/0:e/Math.abs(n.y))}function Yn(t,n){let o=1/0,e=1/0,s=-1/0,r=-1/0;for(let c of t)for(let a of n[c]??[])o=Math.min(o,a.x),s=Math.max(s,a.x),e=Math.min(e,a.y),r=Math.max(r,a.y);return o===1/0?void 0:{minX:o,minY:e,maxX:s,maxY:r}}var Fn=nt();function Gn(t,n){return Fn(t,[n],()=>Object.entries(t).filter(([o,e])=>e.length>0&&n.has(o)).sort(([o],[e])=>n.get(e)-n.get(o)))}var Dn=nt();function Vn(t,n,o,e,s,r){let{scaleX:c,scaleY:a}=o;return Dn(t,[n,s,r,c,a,e],()=>{let i=[];for(let d of[...n].sort((l,u)=>u.bp-l.bp)){let l=Ft(t,d,o,d.bypassed,s?.[d.edgeIndex],r),u=l?Ot(l):void 0;if(l&&u){let{minX:h,minY:f,maxX:x,maxY:y}=St(l);i.push({deletion:d,curves:l,apex:u,extent:Math.max((x-h)*c,(y-f)*a)})}}return i})}function qn({nodePositions:t,nodeLengths:n,deletions:o,deletionRoutes:e,stranded:s=!1,alleleDeletions:r,axis:c,translateX:a,translateY:i,width:d,height:l,version:u=0}){let{scaleX:h,scaleY:f}=c,x=[],y=[];for(let{deletion:m,curves:M,apex:v,extent:g}of Vn(t,o,c,u,e,s))if(g>=Pn){let w=Gt(m.bp),_=U(w),I=j(_,0,0),E=v.x*h+a,A=v.y*f+i;if(E<0||E>d||A<0||A>l)continue;let X=g>=_*2/q,O=Rn(M,v,h,f),L=Hn(I,O)+Nn,S=X?E:z(E+O.x*L,_,d-_),P=X?A:z(A+O.y*L,k,l-k),C=Math.hypot(S-E,P-A),T;if(C>0){let B={x:(S-E)/C,y:(P-A)/C},W=$n(I,B);T={arcX:E,arcY:A,labelX:S-B.x*W,labelY:P-B.y*W}}x.push({label:{key:`del:${m.edgeIndex}`,text:w,x:S,y:P,kind:"deletion",leader:T},box:j(_,S,P)})}let p=new Set,b=[...r??[]].sort((m,M)=>M.bp-m.bp);for(let m of b){let M=Yn(m.nodeIds,t);if(!M)continue;let v=Math.max(M.minX*h+a,0),g=Math.min(M.maxX*h+a,d),w=Math.max(M.minY*f+i,0),_=Math.min(M.maxY*f+i,l);if(g<v||_<w)continue;let I=Math.max(g-v,_-w),E=Gt(m.bp),A=U(E);if(I>=A*2/q){for(let L of m.nodeIds)p.add(L);let X=z((v+g)/2,A,d-A),O=z((w+_)/2,k,l-k);x.push({label:{key:`alleledel:${m.nodeIds.join(",")}`,text:E,x:X,y:O,kind:"deletion"},box:j(A,X,O)})}}for(let[m,M]of Gn(t,n)){if(p.has(m))continue;let{x:v,y:g}=Wt(M),w=g*f+i;if(w+k<=0||w-k>=l)continue;let _=Z(M,h,f);if(_<Wn*2/q)continue;let I=qt(n.get(m)),E=U(I);if(_>=E*2/q){let A=v*h+a;y.push({label:{key:`node:${m}`,text:I,x:A,y:w,kind:"node"},box:j(E,A,w)})}}return{deletions:x,nodes:y}}function jn(t,n){return Math.max(Cn,Math.floor(t*n/Xn))}function Dt(t,n,o=1/0){let e=[];for(let{label:s,box:r}of t){if(e.length>=o)break;n(r)&&e.push(s)}return e}function Jo({reserved:t,take:n,...o}){n??=Bt(o,t);let{deletions:e,nodes:s}=qn(o);return[...Dt(e,n),...Dt(s,n,jn(o.width,o.height))]}function ne(t){let n=0;for(let o=0;o<t.length;o++)n=t.charCodeAt(o)+((n<<5)-n);return Math.abs(n%360)}function zn(t,n){return t*360/n}var Un=.7,Jn=.5,Kn=16;function oe(t){return t>0&&t<=Kn}function Qn(t,n){return`hsl(${zn(t,n)}, ${Un*100}%, ${Jn*100}%)`}function ee(t,n){return`hsl(0, 0%, ${n>1?25+45*t/(n-1):45}%)`}function Zn(t){let n=R(t).name.split("#"),o=n.join("#");if(n.length>=3&&yt(n[0])){let e=n.slice(2).join("#");return[e,e,o]}return[n[0],n.slice(0,2).join("#"),o]}function to(t,n){let{start:o}=R(t);return n.map(e=>`${e} @${Vt(o)}`)}function se(t,n){let o=new Map;t.forEach((l,u)=>{o.has(l.name)||o.set(l.name,u)});let e=[...o].map(([l,u])=>({name:l,i:u})),s=e.map(l=>Zn(l.name)),r=l=>e.map((u,h)=>s[h][l]),c=l=>e.map((u,h)=>to(u.name,s[h])[l]),a=[r(0),r(1),c(0),r(2),c(1),c(2)],d=a.find(l=>new Set(l).size===e.length)??a.at(-1);return e.map(({name:l,i:u},h)=>({name:l,label:d[h],color:n?.[u]??Qn(u,t.length)}))}function re(t){let n=new Map;return new Map([...t].sort((o,e)=>o.label.localeCompare(e.label)).map(o=>{let e=(n.get(o.label)??0)+1;return n.set(o.label,e),[o.name,e>1?`${o.label} (${e})`:o.label]}))}var ae=[{value:"depth",label:"By depth",description:"Thicker the more paths carry a node, on the square root of its depth against the mean. A graph with one depth everywhere draws uniform."},{value:"uniform",label:"Uniform",description:"Every node the same thickness."}],no=.3,jt=3;function oo(t){let n=0,o=0;for(let e of t.nodes)n+=e.depth*e.length,o+=e.length;return o>0?n/o:0}function eo(t,n){return!(n>0)||!(t.depth>0)?1:Math.min(jt,Math.max(no,Math.sqrt(t.depth/n)))}function so(t,n,o,e){return n*(o==="depth"?eo(t,e):1)}function ro(t,n){return t*(n==="depth"?jt:1)}var co=4;function ao(t,n){return Math.max(t/n,co)}function ie(t,n,o,e,s=0){let r=t?oo(t):0,c=a=>s>0?ao(a,s)*s/2:a/2;return{maxHalfWidthPx:c(ro(o,e)),halfWidthPx:a=>{let i=n?.get(a);return c(i?so(i,o,e,r):o)}}}var ue=[{value:"uniform",label:"Uniform",description:"Every link the same thickness."},{value:"walks",label:"By walks",description:"Thicker the more walks take a link, on the square root of its count against the busiest link in the cut. A graph without walks draws uniform."}],zt=.5,io=4;function le(t){let n=0;for(let o of t.edges)n=Math.max(n,o.pathIds?.length??0);return n}function de(t,n,o){return o==="uniform"||n===0?1:zt+(io-zt)*Math.sqrt(t/n)}export{bt as a,lo as b,St as c,ho as d,xo as e,yo as f,po as g,F as h,G as i,Pt as j,mo as k,Z as l,nt as m,Nt as n,pn as o,V as p,ot as q,Bt as r,go as s,Eo as t,Io as u,Lo as v,Co as w,No as x,Ft as y,Yo as z,Fo as A,Uo as B,Vt as C,qt as D,Jo as E,ne as F,zn as G,Un as H,Jn as I,Kn as J,oe as K,Qn as L,ee as M,se as N,re as O,ae as P,oo as Q,so as R,ao as S,ie as T,ue as U,le as V,de as W};
|
|
2
|
-
//# sourceMappingURL=chunk-4NIWMRKH.js.map
|