jbrowse-plugin-graphgenomeviewer 4.0.6 → 4.0.7
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 +55 -236
- package/dist/chunks/AddTrackWorkflow-J44PELJE.js +2 -0
- package/dist/chunks/AddTrackWorkflow-J44PELJE.js.map +7 -0
- package/dist/chunks/GraphGenomeView-U4XVAEO3.js +10 -0
- package/dist/chunks/GraphGenomeView-U4XVAEO3.js.map +7 -0
- package/dist/chunks/GraphTrackSettingsDialog-6KKN5F3W.js +4 -0
- package/dist/chunks/GraphTrackSettingsDialog-6KKN5F3W.js.map +7 -0
- package/dist/chunks/LinearGraphDisplay-IBECRYKJ.js +2 -0
- package/dist/chunks/LinearGraphDisplay-IBECRYKJ.js.map +7 -0
- package/dist/chunks/chunk-C6PIPNZS.js +2 -0
- package/dist/chunks/chunk-C6PIPNZS.js.map +7 -0
- package/dist/chunks/chunk-IVUTPSHP.js +2 -0
- package/dist/chunks/chunk-IVUTPSHP.js.map +7 -0
- package/dist/chunks/chunk-J2UKZSOC.js +2 -0
- package/dist/chunks/chunk-J2UKZSOC.js.map +7 -0
- package/dist/chunks/chunk-MT25CI4U.js +4 -0
- package/dist/chunks/chunk-MT25CI4U.js.map +7 -0
- package/dist/chunks/chunk-N7EFSGPU.js +2 -0
- package/dist/chunks/chunk-N7EFSGPU.js.map +7 -0
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +1 -1
- package/src/GbzBaseSyntenyAdapter/index.ts +1 -2
- package/src/GetSubgraph.test.ts +1 -1
- package/src/GetSubgraph.ts +8 -1
- package/src/GraphAddTrackWorkflow/buildTrackConfig.test.ts +0 -4
- package/src/GraphAddTrackWorkflow/buildTrackConfig.ts +6 -14
- package/src/GraphComputeLayout.ts +7 -13
- package/src/GraphGenomeView/bubbles/bubbleHalos.test.ts +12 -1
- package/src/GraphGenomeView/bubbles/bubbleHalos.ts +16 -11
- package/src/GraphGenomeView/bubbles/classifyBubble.test.ts +47 -12
- package/src/GraphGenomeView/bubbles/classifyBubble.ts +45 -6
- package/src/GraphGenomeView/colorSchemes.ts +16 -0
- package/src/GraphGenomeView/components/BubbleHalos.tsx +10 -96
- package/src/GraphGenomeView/components/BubbleOverlay.tsx +18 -37
- package/src/GraphGenomeView/components/ColorSchemeSelect.tsx +3 -3
- package/src/GraphGenomeView/components/GenePins.tsx +7 -47
- package/src/GraphGenomeView/components/GraphCanvas.tsx +83 -66
- package/src/GraphGenomeView/components/GraphGenomeView.test.tsx +3 -3
- package/src/GraphGenomeView/components/GraphGenomeView.tsx +2 -2
- package/src/GraphGenomeView/components/GraphLoadStatus.tsx +2 -2
- package/src/GraphGenomeView/components/GraphSettingsDialog.tsx +11 -11
- package/src/GraphGenomeView/components/GraphStats.tsx +3 -4
- package/src/GraphGenomeView/components/GraphToolbar.tsx +5 -5
- package/src/GraphGenomeView/components/ImportForm.tsx +2 -2
- package/src/GraphGenomeView/components/LabelChip.tsx +1 -1
- package/src/GraphGenomeView/components/LabelLayer.tsx +106 -0
- package/src/GraphGenomeView/components/LayoutSelect.tsx +3 -3
- package/src/GraphGenomeView/components/RepeatSelect.tsx +3 -3
- package/src/GraphGenomeView/components/SettingsMenu.tsx +2 -2
- package/src/GraphGenomeView/components/WalkRowsOverlay.tsx +13 -6
- package/src/GraphGenomeView/components/WalkSelect.tsx +2 -2
- package/src/GraphGenomeView/graphLabels.ts +74 -75
- package/src/GraphGenomeView/host.ts +4 -3
- package/src/GraphGenomeView/index.ts +1 -1
- package/src/GraphGenomeView/labelLayout.test.ts +220 -0
- package/src/GraphGenomeView/labelLayout.ts +223 -0
- package/src/GraphGenomeView/model.test.ts +102 -315
- package/src/GraphGenomeView/model.ts +424 -813
- package/src/GraphGenomeView/nodeWidths.ts +21 -0
- package/src/GraphGenomeView/{components/overlayLabels.test.ts → overlayLabels.test.ts} +17 -2
- package/src/GraphGenomeView/{components/overlayLabels.ts → overlayLabels.ts} +47 -18
- package/src/GraphGenomeView/pipeline.ts +227 -0
- package/src/GraphGenomeView/renderPasses.bench.ts +31 -24
- package/src/GraphGenomeView/renderPipeline.test.ts +8 -1
- package/src/GraphGenomeView/renderer/recordingCanvas.ts +1 -2
- package/src/GraphGenomeView/subgraphLoad.test.ts +20 -12
- package/src/GraphGenomeView/viewModel.ts +135 -0
- package/src/LaunchGraphGenomeView.ts +3 -3
- package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +157 -30
- package/src/LinearGraphDisplay/components/GraphTrackSettingsDialog.tsx +22 -0
- package/src/LinearGraphDisplay/components/LinearGraphDisplay.tsx +15 -36
- package/src/{GraphGenomeView → LinearGraphDisplay}/components/SubgraphContextSelect.tsx +7 -10
- package/src/{GraphGenomeView → LinearGraphDisplay}/components/SubgraphHaplotypesField.tsx +11 -12
- package/src/LinearGraphDisplay/configSchema.ts +1 -2
- package/src/LinearGraphDisplay/model.ts +291 -234
- package/src/RgfaTabixAdapter/index.ts +1 -1
- package/src/core.test.ts +29 -0
- package/src/core.ts +111 -0
- package/src/graphTrackConfig.test.ts +20 -0
- package/src/graphTrackConfig.ts +33 -0
- package/src/graphTrackDefaults/graphTrackDefaults.test.ts +49 -0
- package/src/graphTrackDefaults/index.ts +51 -0
- package/src/hoverSync/graphViewHighlights.test.ts +2 -2
- package/src/hoverSync/graphViewHighlights.ts +16 -17
- package/src/index.ts +2 -0
- package/src/launchFromGraph/launchFromGraph.ts +7 -2
- package/src/launchFromGraph/launchTracks.ts +1 -1
- package/src/launchFromGraph/syntenyTracks.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/chunks/AddTrackWorkflow-I4EPGFPJ.js +0 -2
- package/dist/chunks/AddTrackWorkflow-I4EPGFPJ.js.map +0 -7
- package/dist/chunks/GraphGenomeView-XPAI2P62.js +0 -10
- package/dist/chunks/GraphGenomeView-XPAI2P62.js.map +0 -7
- package/dist/chunks/GraphSettingsDialog-KQK4YZN5.js +0 -2
- package/dist/chunks/GraphSettingsDialog-KQK4YZN5.js.map +0 -7
- package/dist/chunks/LinearGraphDisplay-K4WU7WQ4.js +0 -2
- package/dist/chunks/LinearGraphDisplay-K4WU7WQ4.js.map +0 -7
- package/dist/chunks/chunk-5T6MYZYN.js +0 -2
- package/dist/chunks/chunk-5T6MYZYN.js.map +0 -7
- package/dist/chunks/chunk-FCWXYIFC.js +0 -2
- package/dist/chunks/chunk-FCWXYIFC.js.map +0 -7
- package/dist/chunks/chunk-HG4BVF35.js +0 -4
- package/dist/chunks/chunk-HG4BVF35.js.map +0 -7
- package/dist/chunks/chunk-OHT6UX4C.js +0 -4
- package/dist/chunks/chunk-OHT6UX4C.js.map +0 -7
- package/dist/chunks/chunk-OP7IRVG6.js +0 -2
- package/dist/chunks/chunk-OP7IRVG6.js.map +0 -7
- package/src/GraphGenomeView/laneRamp.test.ts +0 -97
- package/src/GraphGenomeView/laneRamp.ts +0 -88
- package/src/launchSubgraph/launchSubgraphView.ts +0 -132
- package/src/launchSubgraph/subgraphTracks.test.ts +0 -165
- package/src/launchSubgraph/subgraphTracks.ts +0 -151
- package/src/launchSubgraph/testEnv.ts +0 -255
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["global-externals:tss-react/mui", "../../src/GraphGenomeView/layout/drawnScale.ts", "../../src/GraphGenomeView/bubbleSpreads.ts", "../../src/GraphGenomeView/colorSchemes.ts", "../../src/GraphGenomeView/nodeWidths.ts", "../../src/GraphGenomeView/anchoredNodes.ts", "../../src/GraphGenomeView/pathAnchoring.ts", "../../src/GraphGenomeView/pathColors.ts"],
|
|
4
|
+
"sourcesContent": ["module.exports = JBrowseExports[\"tss-react/mui\"];", "import type { Graph, GraphNode } from '../types'\n\nexport interface BandageScaleOpts {\n nodeLengthPerMegabase: number\n minimumNodeLength: number\n nodeSegmentLength: number\n edgeLength: number\n}\n\n// Node drawn length, in FMMM units, as a function of bp. Used both by the layouts\n// that run here and by the options handed to the WASM engine, so a graph is drawn\n// at the same scale whichever one draws it. Bandage's own auto rule\n// (`AssemblyGraph::determineGraphInfo`):\n// pick units-per-megabase so the *mean* drawn node length lands on 40, with a\n// floor on total drawn length so a small graph doesn't collapse to a speck.\n//\n// This has to be derived per graph, not fixed. The scale that suits a bacterial\n// assembly's 10-100 kb contigs is wrong by orders of magnitude for a minigraph\n// pangenome window, whose nodes run 300 bp to a few kb: a fixed 1000 units/Mbp\n// makes every node shorter than the edges between them and the graph reads as\n// beads on a string, while 1 unit/bp makes each node a long sweeping curve and\n// the graph sprawls. For the 53-node E. coli window this lands near 35,000.\n//\n// It matters most at the small end. The WASM wrapper's own default of 1000\n// units/Mbp puts *every* node in a 400 bp pggb window below minimumNodeLength,\n// so all 31 clamp to the floor and a 1 bp SNP allele draws the same size as the\n// 164 bp backbone segment beside it \u2014 which is what made that figure read as a\n// chain of same-sized two-node bubbles. Bandage draws the same file with a 75:1\n// length ratio, the SNP alleles as specks.\n//\n// The remaining three are upstream Bandage's shipped defaults\n// (`program/settings.cpp`), which the WASM wrapper's own header does not match \u2014\n// it defaults all of them to 1.0, so they have to be passed explicitly.\nconst MEAN_NODE_LENGTH = 40\nconst MIN_TOTAL_GRAPH_LENGTH = 500\n\n// Bandage's own floor on a node's drawn length. Right for an assembly graph,\n// whose nodes are kb to Mb, and the reason a variation graph draws as a rope:\n// see BUBBLE_SPREADS, which is how a view asks for more.\nconst BANDAGE_MINIMUM_NODE_LENGTH = 5\n\n// The engine's own rule (`settings.h`, `getDrawnNodeLength`), so a seed computed\n// here spans exactly the chain the engine builds from the same numbers.\nexport function drawnNodeLength(opts: BandageScaleOpts, length: number) {\n return Math.max(\n (opts.nodeLengthPerMegabase * length) / 1_000_000,\n opts.minimumNodeLength,\n )\n}\n\nexport function bandageAutoScale(\n graph: Graph,\n // Floor on a node's drawn length, in the same FMMM units as the scale below.\n // Anything at or under Bandage's own floor leaves the drawing exactly as it\n // was, which is what keeps `'auto'` byte-identical to the shipped behaviour.\n minNodeLength = BANDAGE_MINIMUM_NODE_LENGTH,\n): BandageScaleOpts {\n const totalLength = graph.nodes.reduce((sum, n) => sum + n.length, 0)\n const megabases = totalLength / 1_000_000\n const target = Math.max(\n graph.nodes.length * MEAN_NODE_LENGTH,\n MIN_TOTAL_GRAPH_LENGTH,\n )\n return {\n nodeLengthPerMegabase: megabases > 0 ? target / megabases : 10_000,\n minimumNodeLength: Math.max(BANDAGE_MINIMUM_NODE_LENGTH, minNodeLength),\n edgeLength: 5,\n nodeSegmentLength: 20,\n }\n}\n\n// How a node's bp becomes its drawn length, as a power law against the graph's\n// own mean. The idiom is Bandage's, moved onto the axis a pangenome needs it on:\n// upstream derives a node's *width* from its depth exactly this way\n// (`graph/graphicsitemnode.cpp`, `getNodeWidth`), at a `depthPower` of 0.5 and a\n// `depthEffectOnWidth` of 0.5, because depth in an assembly graph spans orders\n// of magnitude and drawing it linearly is unreadable.\n//\n// drawn = meanDrawn * (((bp / meanBp) ^ power - 1) * effect + 1)\n//\n// Length in a *variation* graph spans those same orders of magnitude \u2014 a 1 bp\n// allele beside a 16 kb backbone segment \u2014 and upstream still maps it linearly,\n// because its own nodes are assembled contigs where that range does not arise.\n// That linear map is what draws a pggb window as one rope: past the small end\n// every allele falls under `minimumNodeLength` and clamps, so both arms of a\n// bubble land inside one node thickness of each other.\n//\n// power 1 with effect 1 is exactly proportional, so Bandage's shipped behaviour\n// is a point in this family rather than a mechanism sitting beside it. See\n// BUBBLE_SPREADS for the points a view can ask for.\nexport interface DrawnLengthLaw {\n // exponent applied to a node's length relative to the graph's mean\n power: number\n // how much of that relative length survives. 0 draws every node at the mean,\n // 1 applies the power law undamped.\n effect: number\n}\n\nexport const PROPORTIONAL_LENGTH: DrawnLengthLaw = { power: 1, effect: 1 }\n\nexport function isProportional(law: DrawnLengthLaw) {\n return law.power === 1 && law.effect === 1\n}\n\n// Drawn length in FMMM units for one node of `graph`, under `law`.\nexport function drawnLengthFor(graph: Graph, law: DrawnLengthLaw) {\n const count = graph.nodes.length\n const totalLength = graph.nodes.reduce((sum, n) => sum + n.length, 0)\n const meanBp = count > 0 ? totalLength / count : 0\n // The mean drawn length `bandageAutoScale` already targets, small-graph floor\n // included, so a compressed drawing comes out the same overall size as the\n // proportional one it replaces. That is the property a per-node floor does\n // not have, and the reason raising one is unusable at scale: it lifts the\n // hundreds of non-branching chain nodes along with the alleles, which on a\n // 521-node cut inflates the drawing past what zoom-to-fit can frame.\n const meanDrawn =\n count > 0\n ? Math.max(count * MEAN_NODE_LENGTH, MIN_TOTAL_GRAPH_LENGTH) / count\n : MEAN_NODE_LENGTH\n return (bp: number) => {\n if (meanBp <= 0) {\n return meanDrawn\n }\n const relative = (bp / meanBp) ** law.power\n return Math.max(\n meanDrawn * ((relative - 1) * law.effect + 1),\n BANDAGE_MINIMUM_NODE_LENGTH,\n )\n }\n}\n\n// The engine's own length rule is linear with a floor and takes two numbers\n// (`settings.h`, `getDrawnNodeLength`), so a non-linear law cannot be expressed\n// through them. It can be expressed in the lengths themselves: node length\n// crosses the RPC boundary only to become a drawn length \u2014 `getLength()` has\n// exactly two call sites upstream, both inside that rule \u2014 so handing the engine\n// pre-transformed lengths and a 1:1 scale draws the law without touching the\n// WASM build. Scaled by this factor first because the binding reads a node's\n// length as an `unsigned`, and rounding drawn units straight to integers would\n// quantise the small end where the whole point is legibility.\nconst LAYOUT_LENGTH_PRECISION = 1000\n\n// How a view asks for its node lengths: a law, plus Bandage's own per-node\n// floor. Orthogonal on purpose \u2014 see BUBBLE_SPREADS for which does what.\nexport interface NodeLengthSpread {\n law: DrawnLengthLaw\n // in the same FMMM units as the drawn lengths. At or under Bandage's own\n // floor this leaves the drawing exactly as it was.\n minNodeLength: number\n}\n\nexport const PROPORTIONAL_SPREAD: NodeLengthSpread = {\n law: PROPORTIONAL_LENGTH,\n minNodeLength: 0,\n}\n\nexport interface LayoutScaling {\n // the nodes to hand the engine. Under any law but the proportional one their\n // `length` is a scaled drawn length rather than a bp count, which is why this\n // is a separate array and never the graph's own nodes.\n nodes: GraphNode[]\n opts: BandageScaleOpts\n}\n\nexport function layoutScaling(\n graph: Graph,\n spread: NodeLengthSpread = PROPORTIONAL_SPREAD,\n): LayoutScaling {\n const { law, minNodeLength } = spread\n const opts = bandageAutoScale(graph, minNodeLength)\n // The proportional law is what every committed force figure was drawn\n // against, and it is already exactly what `bandageAutoScale` expresses, so it\n // keeps the untransformed path rather than round-tripping through a rounding\n // step FMMM would be free to amplify. Every floor-based spread comes through\n // here too, unchanged.\n if (isProportional(law)) {\n return { nodes: graph.nodes, opts }\n }\n const drawn = drawnLengthFor(graph, law)\n return {\n nodes: graph.nodes.map(node => ({\n ...node,\n length: Math.round(drawn(node.length) * LAYOUT_LENGTH_PRECISION),\n })),\n opts: {\n ...opts,\n nodeLengthPerMegabase: 1_000_000 / LAYOUT_LENGTH_PRECISION,\n // Bandage's own floor only. A law and a raised floor are alternatives\n // rather than a stack: the law has already lifted the small end, and a\n // floor on top of it would flatten exactly what it just spread.\n minimumNodeLength: BANDAGE_MINIMUM_NODE_LENGTH,\n },\n }\n}\n\n// The mean drawn node length `bandageAutoScale` targets, exported so\n// BUBBLE_SPREADS can state its laws against it rather than against unanchored\n// constants.\nexport { MEAN_NODE_LENGTH }\n", "import { MEAN_NODE_LENGTH, PROPORTIONAL_LENGTH } from './layout/drawnScale'\n\nimport type { NodeLengthSpread } from './layout/drawnScale'\n\n// How far apart the force layout draws the two arms of a bubble, as the law\n// turning a node's bp into its drawn length. One table drives the persisted\n// enum, the dropdown and the value handed to the engine, the same way\n// LAYOUT_MODES and COLOR_SCHEMES do.\n//\n// Why this needs to be a control rather than a better default: the drawn-length\n// law is the one thing standing between a variation graph and a legible force\n// layout, and compressing it costs the property that node length is proportional\n// to bp. Bandage maps length linearly, which suits an assembly graph whose nodes\n// are kb to Mb. In a pangenome an allele is 1-50 bp against a backbone segment\n// of several kb, so on that map every alt clamps to the engine's 5-unit floor,\n// both arms of a bubble land inside one node thickness of each other, and FMMM\n// has nothing to spread \u2014 zoom-to-fit then delivers a single rope with the\n// variation invisible inside it. Compressing the law opens the bubbles and\n// flattens the length ratio, and which of those a reader wants depends on the\n// figure, so the view asks rather than assumes.\n//\n// The compression is Bandage's own, taken off the axis upstream uses it on: it\n// draws node *width* from depth as a power law against the mean, at power 0.5\n// and effect 0.5, for the same reason. 'open' is those two numbers. See\n// DrawnLengthLaw.\n//\n// Measured on an odgi extract of GRCh38#0#chrM:8,200-8,400 from HPRC release 2's\n// chrM pggb graph (61 nodes, 84 edges, 234 haplotype paths), fitted to a 900x560\n// pane: proportional is one squiggle with a single knot in it, and the bubbles\n// come apart into legible lenses once the law compresses.\n//\n// The floor and the law are different instruments and both are kept, because\n// neither does the other's job:\n//\n// - a FLOOR lifts the small end and leaves everything above it proportional. It\n// is what a figure wants when one long node has to stay long \u2014 the ribbons in\n// `pangenome/pggb_haplotype_paths` separate along a 1.2 kb deletion arc, and\n// shortening that arc towards the mean piles them up. Its cost is that it is a\n// per-node minimum, so it lifts a graph's non-branching chain nodes along with\n// its alleles and the drawing inflates with node count: on the 521-node pggb\n// cut in `pangenome/graph_resolution` it reached ~52,000 units and a 1.4% fit,\n// which is why that figure could once afford a spread on its 7-node half only.\n// - the LAW compresses both ends towards the mean, so the drawing stays the size\n// it already was whatever the node count, and a cut spanning 6 bp to 16 kb\n// fits one pane. Its cost is the top end: a node that has to read as long no\n// longer does.\n//\n// So a figure about bubble shape at scale takes 'compress', and a figure about\n// what is drawn along one long edge takes 'open'.\n//\n// 'auto' is the proportional map, unchanged, so every existing figure and the\n// `bandageAutoScale` length-proportionality test are untouched by this existing.\nexport const BUBBLE_SPREADS = [\n {\n value: 'auto',\n label: 'Proportional',\n description:\n \"Bandage's own scale: a node draws proportional to its length, so a 1 bp allele is a speck.\",\n law: PROPORTIONAL_LENGTH,\n minNodeFactor: 0,\n },\n {\n value: 'open',\n label: 'Open bubbles',\n description:\n 'Give every allele a drawn length, so a bubble reads as two arms rather than a knot.',\n law: PROPORTIONAL_LENGTH,\n minNodeFactor: 2.5,\n },\n {\n value: 'wide',\n label: 'Wide bubbles',\n description:\n 'As open, spread further. Best on a window of a dozen bubbles.',\n law: PROPORTIONAL_LENGTH,\n minNodeFactor: 10,\n },\n {\n value: 'compress',\n label: 'Compress lengths',\n description:\n 'Pull the longest and shortest nodes towards the graph\\u2019s mean, so a cut spanning kb and bp fits one pane.',\n law: { power: 0.5, effect: 0.5 },\n minNodeFactor: 0,\n },\n] as const\n\nexport type BubbleSpread = (typeof BUBBLE_SPREADS)[number]['value']\n\nexport const BUBBLE_SPREAD_VALUES = BUBBLE_SPREADS.map(s => s.value)\n\n// The law and floor behind a spread, resolved so the model has one place that\n// knows how a spread becomes numbers. An unknown value draws proportionally\n// rather than throwing, which is what a session persisted by a newer build\n// degrades to.\nexport function spreadFor(spread: string): NodeLengthSpread {\n const entry = BUBBLE_SPREADS.find(s => s.value === spread)\n return {\n law: entry?.law ?? PROPORTIONAL_LENGTH,\n minNodeLength: (entry?.minNodeFactor ?? 0) * MEAN_NODE_LENGTH,\n }\n}\n", "import type { Graph } from './types'\n\n// One table drives the persisted enum and both colour dropdowns, the same way\n// LAYOUT_MODES drives the layout enum and its menu. The values and their labels\n// used to live in two lists in two directories, so adding a scheme meant editing\n// both and a mismatch showed up as a dropdown entry that selected nothing.\n//\n// Kept out of the components directory because the model needs it too.\nexport const COLOR_SCHEMES = [\n // Mirrors `layoutModes`' 'auto': a value the model resolves rather than a\n // colour of its own. It exists because 'uniform' was the default, so a\n // launched graph opened flat grey and both tutorials spent a step saying \"now\n // pick a colour\" \u2014 one figure literally drives that click. A graph with\n // reference coordinates resolves to 'reference-position', which is the one\n // ramp a linear track beside it can be painted with too; a graph with none\n // keeps 'uniform', because there the ramp would be a hue nothing earned.\n //\n // Resolve through `effectiveColorScheme`; the dropdown reads the raw prop, so\n // \"Auto\" stays selectable and visible as what it is.\n { value: 'auto', label: 'Auto' },\n { value: 'uniform', label: 'Uniform' },\n { value: 'random', label: 'Random' },\n { value: 'rainbow', label: 'Rainbow' },\n { value: 'depth', label: 'Depth' },\n { value: 'node-length', label: 'Node Length' },\n { value: 'stable-rank', label: 'Stable rank' },\n { value: 'reference-position', label: 'Reference position' },\n { value: 'grey', label: 'Grey' },\n] as const\n\nexport type ColorScheme = (typeof COLOR_SCHEMES)[number]['value']\n\n// What the renderer can actually paint with: every scheme except the one that\n// stands for \"work it out\". Stated as its own type so `getNodeColor`'s switch\n// has no 'auto' arm to forget.\nexport type ResolvedColorScheme = Exclude<ColorScheme, 'auto'>\n\nexport const COLOR_SCHEME_VALUES = COLOR_SCHEMES.map(s => s.value)\n\n// 'auto' asks the GRAPH, not the layout: a hue along the reference means\n// something whenever the segments have reference coordinates, force-directed\n// drawings included.\nexport function resolveColorScheme(\n scheme: ColorScheme,\n graph: Graph | undefined,\n): ResolvedColorScheme {\n return scheme !== 'auto'\n ? scheme\n : graph?.anchoredBy\n ? 'reference-position'\n : 'uniform'\n}\n", "import type { Graph, GraphNode } from './types'\nimport type { NodeInk } from './util/hitDetection'\n\n// How thick a node draws. Bandage widens a node by its depth, the square root\n// of its depth against the graph's mean, so a contig every read covers is fat\n// and a spurious one is a hair. In a pangenome cut depth is carriage, how many\n// walks go through the node, and the same rule makes the reference thick and a\n// private allele thin. One table drives the persisted enum and the dropdown,\n// the way BUBBLE_SPREADS does.\nexport const NODE_WIDTHS = [\n {\n value: 'depth',\n label: 'By depth',\n description:\n '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.',\n },\n {\n value: 'uniform',\n label: 'Uniform',\n description: 'Every node the same thickness.',\n },\n] as const\n\nexport type NodeWidth = (typeof NODE_WIDTHS)[number]['value']\n\nexport const NODE_WIDTH_VALUES = NODE_WIDTHS.map(w => w.value)\n\nconst MIN_FACTOR = 0.3\nconst MAX_FACTOR = 3\n\n// Length-weighted, as Bandage's mean depth is, so a cut's long reference nodes\n// set the norm and the alleles read against it.\nexport function meanDepth(graph: Graph) {\n let weighted = 0\n let length = 0\n for (const node of graph.nodes) {\n weighted += node.depth * node.length\n length += node.length\n }\n return length > 0 ? weighted / length : 0\n}\n\nexport function depthWidthFactor(node: GraphNode, mean: number) {\n if (!(mean > 0) || !(node.depth > 0)) {\n return 1\n }\n return Math.min(\n MAX_FACTOR,\n Math.max(MIN_FACTOR, Math.sqrt(node.depth / mean)),\n )\n}\n\n// How wide a node is drawn, in screen px. One function for the geometry and\n// for the hit test, so the pointer finds a node exactly where its ink is.\nexport function nodeWidthPx(\n node: GraphNode,\n contigThickness: number,\n nodeWidth: NodeWidth,\n mean: number,\n) {\n return (\n contigThickness * (nodeWidth === 'depth' ? depthWidthFactor(node, mean) : 1)\n )\n}\n\nexport function maxNodeWidthPx(contigThickness: number, nodeWidth: NodeWidth) {\n return contigThickness * (nodeWidth === 'depth' ? MAX_FACTOR : 1)\n}\n\n// How far each node's ink reaches from its centreline, for the hit test: the\n// widths the geometry draws with, from the same function.\nexport function nodeInk(\n graph: Graph | undefined,\n nodeById: ReadonlyMap<string, GraphNode> | undefined,\n contigThickness: number,\n nodeWidth: NodeWidth,\n): NodeInk {\n const mean = graph ? meanDepth(graph) : 0\n return {\n maxHalfWidthPx: maxNodeWidthPx(contigThickness, nodeWidth) / 2,\n halfWidthPx: id => {\n const node = nodeById?.get(id)\n return node\n ? nodeWidthPx(node, contigThickness, nodeWidth, mean) / 2\n : contigThickness / 2\n },\n }\n}\n", "import type { Graph, GraphNode, NodeSegment } from './types'\nimport type { StableCoordinate } from '../gfa-core/index'\n\n// A node whose stable coordinate is known to be present. rGFA states SN/SO/SR\n// on every segment and a path walk derives the same for every segment a path\n// visits (pathAnchoring.ts), so the anchored layouts and the allele projection\n// all work with nodes whose `stable` is a fact rather than an optional \u2014\n// narrowing once here keeps them from asserting it at every use.\nexport type AnchoredNode = GraphNode & { stable: StableCoordinate }\n\n// Stable rank: 0 is the reference backbone, higher ranks are the sequence that\n// diverges from it. rGFA counts those up in build order; a path-derived graph\n// has only the one distinction its paths support, on the reference or off it.\nexport const REFERENCE_RANK = 0\n\nexport function isAnchored(node: GraphNode): node is AnchoredNode {\n return node.stable !== undefined\n}\n\n// Narrows to AnchoredNode so `filter` yields nodes whose coordinate is a fact.\n// Only use it on nodes that may be unanchored: negating a type predicate on an\n// AnchoredNode narrows the other branch to `never`, which is not what \"off the\n// backbone\" means. Where a node is already anchored, compare the rank directly.\nexport function isBackbone(node: GraphNode): node is AnchoredNode {\n return node.stable?.rank === REFERENCE_RANK\n}\n\n// Anchored and above rank 0: sequence that diverges from the reference. Not\n// simply `!isBackbone`, which would also admit nodes carrying no coordinate.\nexport function isOffReference(node: GraphNode): node is AnchoredNode {\n return node.stable !== undefined && node.stable.rank > REFERENCE_RANK\n}\n\nexport function backboneNodes(graph: Graph) {\n return graph.nodes.filter(isBackbone)\n}\n\n// The backbone on row 0 at its declared offsets: the x axis of every layout\n// whose x is reference bp.\nexport function backbonePositions(backbone: AnchoredNode[]) {\n const positions: Record<string, NodeSegment[]> = {}\n for (const node of backbone) {\n positions[node.id] = [\n { x: node.stable.start, y: 0 },\n { x: node.stable.start + node.length, y: 0 },\n ]\n }\n return positions\n}\n\n// Index of the first node starting at or after `bp`, in a list sorted by start.\nexport function firstNodeAtOrAfter(nodes: AnchoredNode[], bp: number) {\n let lo = 0\n let hi = nodes.length\n while (lo < hi) {\n const mid = (lo + hi) >> 1\n if (nodes[mid]!.stable.start < bp) {\n lo = mid + 1\n } else {\n hi = mid\n }\n }\n return lo\n}\n\n// bp the backbone covers in this subgraph. Both anchored layouts scale their row\n// spacing and their minimum drawn allele length off it.\n//\n// A fold rather than Math.max(...starts): the subgraph path is capped at 100 kb\n// but a whole-file GFA import is not, and spreading a backbone of more than\n// ~130k segments into an argument list throws RangeError.\nexport function backboneSpan(backbone: AnchoredNode[]) {\n let min = Infinity\n let max = -Infinity\n for (const node of backbone) {\n min = Math.min(min, node.stable.start)\n max = Math.max(max, node.stable.start + node.length)\n }\n return max - min\n}\n\n// The reference interval the drawing is scaled against: the region the cut was\n// made for, when there is one.\n//\n// Not the same as the backbone's own extent, and the difference is not small. A\n// hop reaches the far anchor of a long-range allele, and that anchor is a rank-0\n// segment: in the E. coli pggb graph a 75 bp CFT073 segment bridges K12:997,574\n// and K12:1,004,667, so a 484 bp window's backbone measured 7,395 bp. Everything\n// scaled off that span went with it \u2014 rows 15x too far apart, and an off-\n// reference floor of 111 bp inside a 484 bp window.\n//\n// A whole-file import has no region, and there the measured extent is the only\n// answer available.\nexport function referenceSpan(\n backbone: AnchoredNode[],\n region?: { start: number; end: number },\n) {\n return region && region.end > region.start\n ? region.end - region.start\n : backboneSpan(backbone)\n}\n", "import { REFERENCE_RANK } from './anchoredNodes'\nimport { panSNSample } from '../pansn'\n\nimport type { Graph, GraphNode, PathOrigin, PathVisit } from './types'\n\n// Reference coordinates for a GFA that tags none of its segments with one.\n//\n// rGFA writes the fact per segment (SN/SO/SR). A pggb / odgi / Minigraph-Cactus\n// graph writes the same fact once per path and leaves the arithmetic to the\n// reader: walking a path's steps in order, accumulating segment lengths,\n// assigns every segment that path visits an interval on the path's own\n// sequence. Same information, different encoding \u2014 so a general GFA is not a\n// degraded rGFA, and the anchored layouts work on it once the walk is done.\n//\n// It carries one thing rGFA cannot: a segment's *carriage*, the set of\n// assemblies that actually traverse it. rGFA's SR is build order, so there the\n// most a segment can say is which assembly first contributed it.\n\n// `odgi extract` names an extracted path for the interval it covers on its own\n// sequence: `K12#1#chr:1004500-1004961`. That suffix is the only place a cut\n// subgraph states where in the genome it sits, so it is split off here rather\n// than carried around as part of the name \u2014 no assembly has a sequence called\n// `K12#1#chr:1004500-1004961`, and PanSN parsing of it yields a contig no\n// linear view can open.\n//\n// Anchored on the digits rather than on a trailing colon, because a stable name\n// may legitimately contain one (the same hazard gfaParser's tag splitting has).\nconst RANGE_SUFFIX = /:(\\d+)-\\d+$/\n\nexport function pathOrigin(pathName: string) {\n const match = RANGE_SUFFIX.exec(pathName)\n return match\n ? { name: pathName.slice(0, match.index), start: +match[1]! }\n : { name: pathName, start: 0 }\n}\n\nexport interface PathSteps {\n name: string\n start: number\n steps: { id: string; strand: '+' | '-' }[]\n}\n\n// The single walk. Every segment visit lands in `pathVisits` at the bp its own\n// path reaches it at; `anchorPaths` is what the walk learned about the paths\n// themselves, which is what a reference-path picker lists.\nexport function surveyPaths(\n paths: PathSteps[],\n lengthOf: (segmentId: string) => number,\n) {\n const anchorPaths: PathOrigin[] = []\n const pathVisits = new Map<string, PathVisit[]>()\n for (const path of paths) {\n const sample = panSNSample(path.name)\n let pos = path.start\n for (const step of path.steps) {\n const visit = {\n path: path.name,\n sample,\n start: pos,\n strand: step.strand,\n }\n const existing = pathVisits.get(step.id)\n if (existing) {\n existing.push(visit)\n } else {\n pathVisits.set(step.id, [visit])\n }\n pos += lengthOf(step.id)\n }\n anchorPaths.push({\n name: path.name,\n sample,\n start: path.start,\n length: pos - path.start,\n })\n }\n return { anchorPaths, pathVisits }\n}\n\n// Which path x is drawn on. This is a choice, not a fact: a general GFA's path\n// names are arbitrary and nothing in the file marks one of them as the\n// reference, so a preference is matched against a path's PanSN sample name (the\n// assembly a subgraph was cut against, which is how the launch path knows) and\n// then against its full name. With no preference the first path in the file\n// wins, which is where pggb and odgi leave the reference.\nexport function chooseReferencePath(\n anchorPaths: PathOrigin[],\n preferred: string | undefined,\n) {\n const named = anchorPaths.find(\n p => p.sample === preferred || p.name === preferred,\n )\n return named ?? anchorPaths[0]\n}\n\n// Rank on a path-derived graph is the one distinction the paths support: on the\n// reference path or off it. rGFA's higher ranks are minigraph's build order,\n// which a path GFA has no equivalent of, so drawing more rows than this would\n// be drawing structure the file does not state.\nconst OFF_REFERENCE_RANK = 1\n\n// A segment the reference path visits sits on the backbone at the offset that\n// visit reaches it. One it never visits is an alternate allele, placed on the\n// coordinates of the first path that does carry it \u2014 the same asymmetry rGFA\n// has, where a rank>0 segment's SO is an offset on the assembly that\n// contributed the sequence rather than on the reference.\n//\n// **First visit wins** when a path reaches the same segment more than once, and\n// collapsed repeats make that real rather than hypothetical: pggb folds the\n// E. coli rRNA operons into shared segments, so every strain's path walks them\n// twice (`odgi depth` reaches 10 over a five-strain graph at chr:4,167,000 and\n// chr:3,942,000). A node draws as one tube at one x, so the alternative to\n// picking a copy is one tube spanning both, claiming reference the segment does\n// not occupy. The repeat stays visible as depth: such a node's traversal count\n// is a multiple of the path count.\nfunction anchorNode(\n node: GraphNode,\n visits: PathVisit[] | undefined,\n reference: string,\n): GraphNode {\n let anchored = node\n if (visits && visits.length > 0) {\n const anchor = visits.find(v => v.path === reference) ?? visits[0]!\n anchored = {\n ...node,\n stable: {\n refName: anchor.path,\n start: anchor.start,\n rank: anchor.path === reference ? REFERENCE_RANK : OFF_REFERENCE_RANK,\n strand: anchor.strand,\n },\n samples: [...new Set(visits.map(v => v.sample))].sort(),\n }\n }\n return anchored\n}\n\n// Re-runnable against a different reference path at no parsing cost, which is\n// what the picker needs: the walk is already recorded in `pathVisits`, and only\n// which path counts as rank 0 changes.\nexport function anchorFromPaths(graph: Graph, preferred: string | undefined) {\n const { anchorPaths, pathVisits } = graph\n const reference =\n anchorPaths && pathVisits\n ? chooseReferencePath(anchorPaths, preferred)\n : undefined\n return reference && pathVisits\n ? ({\n ...graph,\n nodes: graph.nodes.map(node =>\n anchorNode(node, pathVisits.get(node.name), reference.name),\n ),\n anchoredBy: 'paths',\n referencePath: reference.name,\n } satisfies Graph)\n : graph\n}\n\n// rGFA states coordinates on every segment, so only a graph that states none\n// has to derive them. A GFA with neither tags nor paths comes back untouched\n// and falls through to the force layout, which is the honest answer for it.\nexport function anchorGraph(graph: Graph, preferred: string | undefined) {\n return graph.anchoredBy === 'tags' ? graph : anchorFromPaths(graph, preferred)\n}\n", "import { pathOrigin } from './pathAnchoring'\n\nimport type { GraphPath } from './types'\n\n// Deterministic colour from a string (djb2-style hash to an HSL hue). Fine for\n// the `random` node scheme, where a collision between two of thousands of nodes\n// means nothing. NOT what the path ribbons use: see pathHueAt.\nexport function nameHue(name: string) {\n let hash = 0\n for (let i = 0; i < name.length; i++) {\n hash = name.charCodeAt(i) + ((hash << 5) - hash)\n }\n return Math.abs(hash % 360)\n}\n\n// Ribbon hues are spread evenly over the wheel by position in the path list,\n// not hashed from the path name. A hash draws from the wheel at random, and at\n// five paths two of them landing on the same hue is common rather than\n// unlucky: `Sakai#1#chr:1983339-1983535` and `NCTC86#1#chr:1709109-1710286`\n// hash 26 degrees apart, which is two purples and a legend that cannot be read\n// off the drawing. Evenly spaced, the worst case is the best available.\n//\n// The cost is that a path's colour depends on how many paths there are, so it\n// moves when the cut changes. That is what the legend is for, and it is the\n// same trade the Bandage demo this was ported from made.\nexport function pathHueAt(index: number, count: number) {\n return (index * 360) / count\n}\n\nexport const PATH_SATURATION = 0.7\nexport const PATH_LIGHTNESS = 0.5\n\n// Past this many paths a graph cannot be drawn per path at all, and the WHOLE\n// of `drawPaths` goes off with it: the node stripes, the edge ribbons and the\n// key naming them.\n//\n// One number for all three because they are one statement, and they used to\n// disagree. Only the stripes were capped. So a Minigraph-Cactus cut, which\n// writes one W record per haplotype and walks every backbone link with all of\n// them, drew: no stripes at all, a key hundreds of rows tall, and one bezier\n// stroke per path per edge \u2014 measured at 99,800 strokes and 64 ms of geometry\n// for 200 paths over 499 links, against 2,495 strokes for the five-path pggb\n// cut the figures use. Every one of those is its own `beginPath`/`stroke` on\n// the Canvas2D backend, every frame.\n//\n// 16 is where the drawing stops SAYING anything, not where it stops being fast.\n// `pathHueAt` spreads the wheel evenly, so 16 hues are 22 degrees apart and\n// still tellable and 200 are one degree; the ribbon fan is PATH_RIBBON_SPACING\n// per path, so 16 of them is a legible fan and 200 is a band wider than the\n// nodes; and a key past about 16 rows is taller than the drawing beside it.\n// Above the cap the honest picture is the plain one \u2014 which is exactly what a\n// graph carrying no paths at all already draws.\nexport const MAX_PATH_COLORS = 16\n\n// Whether this graph's paths can be drawn as colours. Resolve it once and hand\n// the answer down: the geometry, the hit index and the key each used to decide\n// for themselves, which is how they came to disagree.\nexport function pathColorsLegible(pathCount: number) {\n return pathCount > 0 && pathCount <= MAX_PATH_COLORS\n}\n\nexport function pathCssColor(index: number, count: number) {\n return `hsl(${pathHueAt(index, count)}, ${PATH_SATURATION * 100}%, ${\n PATH_LIGHTNESS * 100\n }%)`\n}\n\n// A path is named the way its file names it \u2014 `K12#1#chr:1004500-1004961` for a\n// P record `odgi extract` wrote, `HG00738#1` for a W record \u2014 and neither is a\n// legend entry. The label is the least of that name which still tells the paths\n// apart: the sample where samples are unique, the haplotype too where they are\n// not, the whole stable name where even that repeats. Widening it for every row\n// rather than only for the colliding ones, because a legend where one entry is\n// `HG00738#1` and its neighbour is `HG01071` reads as two kinds of thing.\nfunction labelTiers(name: string) {\n const parts = pathOrigin(name).name.split('#')\n return [parts[0]!, parts.slice(0, 2).join('#'), parts.join('#')]\n}\n\n// Locale-independent, unlike toLocaleString: a figure regenerated on a machine\n// with a different locale would otherwise differ from the committed one.\nfunction groupDigits(n: number) {\n return String(n).replace(/\\B(?=(\\d{3})+$)/g, ',')\n}\n\n// A collapsed repeat puts one sequence through the same segments more than\n// once, and `odgi extract` emits one path per visit \u2014 nine visits over five\n// E. coli chromosomes at the rRNA operons, where every name tier above collides\n// because the sequence really is the same one. What separates those is the\n// offset each name carried, which is the one thing pathOrigin strips off.\nfunction offsetTiers(name: string, tiers: string[]) {\n const { start } = pathOrigin(name)\n return tiers.map(t => `${t} @${groupDigits(start)}`)\n}\n\nexport interface PathLegendEntry {\n name: string\n label: string\n color: string\n}\n\nexport function pathLegend(paths: GraphPath[]): PathLegendEntry[] {\n const named = paths.map(p => labelTiers(p.name))\n // narrowest first, and the offset is tried before the next name tier: two\n // copies of one operon are told apart by where they are, not by widening a\n // name that is genuinely identical\n const candidates = [0, 1, 2].flatMap(t => [\n paths.map((_, i) => named[i]![t]!),\n paths.map((p, i) => offsetTiers(p.name, named[i]!)[t]!),\n ])\n const distinct = candidates.find(\n labels => new Set(labels).size === paths.length,\n )\n // Nothing separates two paths with the same name and the same offset, so the\n // widest labelling is as close as any can get.\n const labels = distinct ?? candidates.at(-1)!\n return paths.map((path, i) => ({\n name: path.name,\n label: labels[i]!,\n color: pathCssColor(i, paths.length),\n }))\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["require_mui", "__commonJSMin", "exports", "module", "drawnNodeLength", "opts", "length", "bandageAutoScale", "graph", "minNodeLength", "megabases", "sum", "n", "target", "PROPORTIONAL_LENGTH", "isProportional", "law", "drawnLengthFor", "count", "totalLength", "meanBp", "meanDrawn", "bp", "relative", "LAYOUT_LENGTH_PRECISION", "PROPORTIONAL_SPREAD", "layoutScaling", "spread", "drawn", "node", "BUBBLE_SPREADS", "PROPORTIONAL_LENGTH", "BUBBLE_SPREAD_VALUES", "s", "spreadFor", "spread", "entry", "COLOR_SCHEMES", "COLOR_SCHEME_VALUES", "s", "resolveColorScheme", "scheme", "graph", "NODE_WIDTHS", "NODE_WIDTH_VALUES", "w", "MIN_FACTOR", "MAX_FACTOR", "meanDepth", "graph", "weighted", "length", "node", "depthWidthFactor", "mean", "nodeWidthPx", "contigThickness", "nodeWidth", "maxNodeWidthPx", "nodeInk", "nodeById", "id", "isAnchored", "node", "isBackbone", "isOffReference", "backboneNodes", "graph", "backbonePositions", "backbone", "positions", "firstNodeAtOrAfter", "nodes", "bp", "lo", "hi", "mid", "backboneSpan", "min", "max", "referenceSpan", "region", "RANGE_SUFFIX", "pathOrigin", "pathName", "match", "surveyPaths", "paths", "lengthOf", "anchorPaths", "pathVisits", "path", "sample", "panSNSample", "pos", "step", "visit", "existing", "chooseReferencePath", "preferred", "p", "OFF_REFERENCE_RANK", "anchorNode", "node", "visits", "reference", "anchored", "anchor", "v", "anchorFromPaths", "graph", "anchorGraph", "nameHue", "name", "hash", "i", "pathHueAt", "index", "count", "PATH_SATURATION", "PATH_LIGHTNESS", "MAX_PATH_COLORS", "pathColorsLegible", "pathCount", "pathCssColor", "labelTiers", "parts", "pathOrigin", "groupDigits", "n", "offsetTiers", "tiers", "start", "t", "pathLegend", "paths", "named", "p", "candidates", "_", "labels", "path"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as at}from"./chunk-ZNGDWZ6Z.js";import{A as ut,B as He,C as Xe,a as de,b as B,c as Se,d as q,e as J,f as st,h as Ne,q as De,w as it,x as ct,z as lt}from"./chunk-IVUTPSHP.js";import{a as Ae,b as ot,c as rt}from"./chunk-F4C3BEPV.js";import{a as we}from"./chunk-XEJ47DLD.js";import{a as Pe,b as ne}from"./chunk-FY3BTKY4.js";var pt=Pe((hr,dt)=>{dt.exports=JBrowseExports["@mui/material/SvgIcon"]});var Je=Pe((zr,Ht)=>{Ht.exports=JBrowseExports["@jbrowse/core/util/colorBits"]});var br=Pe((ga,yn)=>{yn.exports=JBrowseExports["@jbrowse/render-core/canvas2dUtils"]});var W=ne(pt(),1);function Mr(e){let t=n=>Math.round(n*100)/100;return e.map((n,o)=>`${o?"L":"M"}${t(n.x)},${t(n.y)}`).join("")}function ft(e,t,n,o,r){let s=Math.hypot(o-t,n-e);if(s===0)return[n,o];let a=(n-e)/s,i=(o-t)/s;return[n+r*a,o+r*i]}function We(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,s=3*n*t*t,a=t*t*t;return{x:o*e.x0+r*e.cx0+s*e.cx1+a*e.x1,y:o*e.y0+r*e.cy0+s*e.cy1+a*e.y1}}function xt(e){let t=e[Math.floor(e.length/2)];return t?We(t,.5):void 0}function Mt(e){let t=1/0,n=1/0,o=-1/0,r=-1/0;for(let s of e)t=Math.min(t,s.x0,s.cx0,s.cx1,s.x1),o=Math.max(o,s.x0,s.cx0,s.cx1,s.x1),n=Math.min(n,s.y0,s.cy0,s.cy1,s.y1),r=Math.max(r,s.y0,s.cy0,s.cy1,s.y1);return{minX:t,minY:n,maxX:o,maxY:r}}function xn(e,t,n){let o=We(e,t),r=We(e,n),s=(n-t)/3,a=mt(e,t),i=mt(e,n);return{x0:o.x,y0:o.y,cx0:o.x+a.x*s,cy0:o.y+a.y*s,cx1:r.x-i.x*s,cy1:r.y-i.y*s,x1:r.x,y1:r.y}}function mt(e,t){let n=1-t,o=3*n*n,r=6*n*t,s=3*t*t;return{x:o*(e.cx0-e.x0)+r*(e.cx1-e.cx0)+s*(e.x1-e.cx1),y:o*(e.cy0-e.y0)+r*(e.cy1-e.cy0)+s*(e.y1-e.cy1)}}function Lt(e,t){let n=[];for(let o of e){let r=Math.hypot(o.cx0-o.x0,o.cy0-o.y0)+Math.hypot(o.cx1-o.cx0,o.cy1-o.cy0)+Math.hypot(o.x1-o.cx1,o.y1-o.cy1),s=Math.max(3,Math.round(r/t)|1);for(let a=0;a<s;a+=2)n.push([xn(o,a/s,(a+1)/s)])}return n}function Rt(e,t,n){let o=new Array(e.length);for(let r=0;r<e.length;r++){let s=e[r];o[r]={x0:s.x0+t,y0:s.y0+n,cx0:s.cx0+t,cy0:s.cy0+n,cx1:s.cx1+t,cy1:s.cy1+n,x1:s.x1+t,y1:s.y1+n}}return o}function bt(e,t){let n=e.length-1;return t==="end"?{at:e[n],inward:e[n-1]}:{at:e[0],inward:e[1]}}var Mn=.5,Ln=80;function ht(e){let t=1/0,n=-1/0;for(let o of e)t=Math.min(t,o.x),n=Math.max(n,o.x);return{min:t,max:n}}function gt(e,t){return Math.max(0,t.min-e,e-t.max)}function yt(e,t,n){let o=gt(e[0].x,t),r=gt(e[e.length-1].x,t);return o===r?n:o<r?"start":"end"}function Rn(e,t){return{from:yt(e,ht(t),"end"),to:yt(t,ht(e),"start")}}var wn=.75,An=1.15,Sn=.35,Nn=60;function En(e,t,n,o,r,s){let a=Math.hypot(n-e,o-t),i=a===0?1:(n-e)/a,c=a===0?0:(o-t)/a,p=0,d=1/0,l=-1/0;for(let b of r){let y=b.x-e,h=b.y-t,x=y*-c+h*i;Math.abs(x)>Math.abs(p)&&(p=x);let w=y*i+h*c;d=Math.min(d,w),l=Math.max(l,w)}let u=r.length?l-d:0,m=Math.max(Math.abs(p)*An/wn,u*Sn),f=s===void 0?m:Math.min(m,s);return p<0?-f:f}function Ee({scaleX:e,scaleY:t}){return t/e}var Bn=3;function ze(e,t,n){let o=t.x-e.x,r=(t.y-e.y)*n,s=Math.hypot(o,r);return s===0?void 0:{x:o/s,y:r/s}}function wt(e,t,n,o,r=Bn){let s=Ee(o),a=ze(e[e.length-1],t[0],s)??ze(e[0],e.at(-1),s)??ze(t[0],t.at(-1),s)??{x:1,y:0},i=[];for(let c=0;c<n;c++){let p=(c-(n-1)/2)*r;i.push({x:-a.y*p,y:a.x*p/s})}return i}function $e(e,t){return e.map(n=>({x:n.x,y:n.y*t}))}function Cn(e,t){for(let n of e)n.y0/=t,n.cy0/=t,n.cy1/=t,n.y1/=t;return e}function pe(e,t,n,o,r,s,a=[],i){let c=s.scaleX,p=Ee(s),d=i??(s.pixelRows?Nn:void 0);if(p!==1)return Cn(pe($e(e,p),$e(t,p),n,o,r*p,{scaleX:c,scaleY:c},$e(a,p),d===void 0?void 0:d*p),p);let l=n?{from:"end",to:"start"}:Rn(e,t),u=bt(e,l.from),m=bt(t,l.to),f=u.at,b=m.at,y=f.x+o,h=f.y+r,x=b.x+o,w=b.y+r;if(n){let R=1,L=0;if(u.inward){let H=f.x-u.inward.x,P=f.y-u.inward.y,D=Math.hypot(H,P);D>0&&(R=H/D,L=P/D)}let A=Math.min(50,50*c),g=-L,M=R,S=(f.x+b.x)/2+o+g*A,E=(f.y+b.y)/2+r+M*A,O=y+R*A,I=h+L*A,_=x-R*A,v=w-L*A;return[{x0:y,y0:h,cx0:O,cy0:I,cx1:O+g*A,cy1:I+M*A,x1:S,y1:E},{x0:S,y0:E,cx0:_+g*A,cy0:v+M*A,cx1:_,cy1:v,x1:x,y1:w}]}else{let R=u.inward??{x:f.x-(b.x-f.x),y:f.y-(b.y-f.y)},L=m.inward??{x:b.x-(f.x-b.x),y:b.y-(f.y-b.y)},A=Math.hypot(x-y,w-h),g=(Y,z,F,se)=>{let K=z.x-Y.x,j=z.y-Y.y,U=Math.hypot(K,j),te=U===0?0:(F*K+se*j)/U;return Math.max(0,Math.min(A*Mn,Ln,te*.5))},M=b.x-f.x,S=b.y-f.y,[E,O]=ft(R.x,R.y,f.x,f.y,g(R,f,M,S)),[I,_]=ft(L.x,L.y,b.x,b.y,g(L,b,-M,-S)),v=a.length?En(y,h,x,w,a,d):0,H=A===0?1:A,P=(x-y)/H,D=(w-h)/H,ge=-D*v,N=P*v,k=P*Math.abs(v),X=D*Math.abs(v);return[{x0:y,y0:h,cx0:E+o+ge-k,cy0:O+r+N-X,cx1:I+o+ge+k,cy1:_+r+N+X,x1:x,y1:w}]}}var _n=1;function Ye(e,t){return t.flatMap(n=>e[n]??[])}function At(e,t,n){let o=e[t.from],r=e[t.to];return o?.length&&r?.length?pe(o,r,t.from===t.to,0,0,n,Ye(e,t.bypassed)):void 0}function vn(e){let t=new Map;for(let n of e.nodes)if(B(n)){let o=t.get(n.stable.refName);o?o.push(n):t.set(n.stable.refName,[n])}for(let n of t.values())n.sort((o,r)=>o.stable.start-r.stable.start);return t}function kn(e,t,n){let o=[];if(e)for(let r=st(e,t);r<e.length;r++){let s=e[r];if(s.stable.start>=n)break;s.stable.start+s.length<=n&&o.push(s.id)}return o}function In(e,t,n,o){let{fromStrand:r,toStrand:s}=e;if(r===void 0||s===void 0)return!0;let a=r===(t.stable.strand??"+"),i=s===(n.stable.strand??"+");return o?a&&i:!a&&!i}function Ar(e){let t=new Map(e.nodes.map(r=>[r.id,r])),n=vn(e),o=[];for(let r=0;r<e.edges.length;r++){let s=e.edges[r],a=t.get(s.from),i=t.get(s.to);if(a!==void 0&&i!==void 0&&B(a)&&B(i)&&a.stable.refName===i.stable.refName){let c=a.stable.start<=i.stable.start,[p,d]=c?[a,i]:[i,a],l=p.stable.start+p.length,u=d.stable.start,m=u-l;if(m>=_n&&In(s,a,i,c)){let f=p.stable.refName;o.push({edgeIndex:r,from:s.from,to:s.to,refName:f,start:l,end:u,bp:m,bypassed:kn(n.get(f),l,u)})}}}return o}function Er(e){let t=new Map,n=new Map,o=(u,m,f)=>{let b=u.get(m);b?b.push(f):u.set(m,[f])};for(let u of e.edges)o(t,u.from,u.to),o(n,u.to,u.from);let r=(u,m)=>u!==m&&t.get(u)?.length===1&&n.get(m)?.length===1,s=new Map,a=new Map;for(let u of e.nodes){let m=n.get(u.id);if(s.has(u.id)||m?.length===1&&r(m[0],u.id))continue;let f=[u.id];for(;;){let b=t.get(f.at(-1))?.[0];if(b===void 0||s.has(b)||!r(f.at(-1),b))break;f.push(b)}for(let b of f)s.set(b,u.id);f.length>1&&a.set(u.id,f)}for(let u of e.nodes)s.has(u.id)||s.set(u.id,u.id);let i=new Map(e.nodes.map(u=>[u.id,u])),c=[];for(let u of e.nodes){if(s.get(u.id)!==u.id)continue;let m=a.get(u.id);if(!m){c.push(u);continue}let f=m.map(h=>i.get(h)),b=f.filter(B),y=b.length?b.reduce((h,x)=>h.stable.start<=x.stable.start?h:x):f[0];c.push({id:u.id,name:u.name,length:f.reduce((h,x)=>h+x.length,0),depth:u.depth,stable:y.stable})}let p=new Set;for(let u of a.values())for(let m=1;m<u.length;m++)p.add(`${u[m-1]}>${u[m]}`);let d=new Set,l=[];for(let u of e.edges){let m=`${s.get(u.from)}>${s.get(u.to)}`;p.has(`${u.from}>${u.to}`)||d.has(m)||(d.add(m),l.push({from:s.get(u.from),to:s.get(u.to)}))}return{graph:{...e,nodes:c,edges:l,paths:void 0,pathVisits:void 0},runs:a}}function Br(e,t,n){let o={...e};for(let[r,s]of t){let a=e[r];if(!a?.length)continue;delete o[r];let i=Ke(a),c=i.at(-1),p=s.map(u=>Math.max(n(u),0)),d=p.reduce((u,m)=>u+m,0)||s.length,l=0;s.forEach((u,m)=>{let f=d?p[m]/d*c:c/s.length,b=m===s.length-1?c:l+f;o[u]=Nt(a,i,l,b),l=b})}return o}function Cr(e,t,n){if(e.length===0)return[];let o=Ke(e),r=o.at(-1);return Nt(e,o,t*r,n*r)}function St(e){let t=Ke(e);return Fe(e,t,t.at(-1)/2)}function Ke(e){let t=[0];for(let n=1;n<e.length;n++)t.push(t[n-1]+Math.hypot(e[n].x-e[n-1].x,e[n].y-e[n-1].y));return t}function Fe(e,t,n){if(n<=0)return{...e[0]};let o=1;for(;o<t.length&&t[o]<n;)o++;if(o>=t.length)return{...e.at(-1)};let r=t[o]-t[o-1],s=r>0?(n-t[o-1])/r:0,a=e[o-1],i=e[o];return{x:a.x+(i.x-a.x)*s,y:a.y+(i.y-a.y)*s}}function Nt(e,t,n,o){let r=[Fe(e,t,n)];for(let s=0;s<e.length;s++)t[s]>n&&t[s]<o&&r.push({...e[s]});return r.push(Fe(e,t,o)),r}function je(e){return e.length*6.2+8}function Gn(e,t){return e.x0<t.x1&&e.x1>t.x0&&e.y0<t.y1&&e.y1>t.y0}function Et(e,t){return e.x1<=0||e.x0>=t.width||e.y1<=0||e.y0>=t.height}function Tn(e,t){return e.x0>=0&&e.x1<=t.width&&e.y0>=0&&e.y1<=t.height}function Ue(e,t=[]){let n=[...t];return o=>Et(o,e)||n.some(r=>Gn(r,o))?!1:(n.push(o),!0)}function fe(e,t,n){let o=[];for(let s of e){let a=je(s.text),i=s.y>t.height/2?-1:1;for(let c=0;c<=(s.stack??0);c++){let p=s.y+i*c*19,d={x0:s.x-a/2,x1:s.x+a/2,y0:p-11-4,y1:p+4};if(Et(d,t))break;if(Tn(d,t)&&n(d)){o.push({...s,y:p,w:a});break}}}return o}var On=26,Pn=4e4,Dn=8,Hn=8,Xn=5.7,zn=6,$n=13,me=3,Be=2;function ve(e){return(e.length*Xn+zn+me)/2}var Z=($n+me)/2,Wn=ve("1 bp");function Ce(e,t,n){return{x0:t-e,x1:t+e,y0:n-Z,y1:n+Z}}function vt(e,t){return{x0:6,x1:6+e.length*6.2+8+me,y0:t-8-me/2,y1:t+8+me/2}}function _e(e,t,n){return n<t?e:Math.min(Math.max(e,t),n)}function kt(e){return e>=1e6?`${+(e/1e6).toFixed(1)} Mb`:e>=1e3?`${+(e/1e3).toFixed(1)} kb`:`${e} bp`}function Bt(e){return`${kt(e)} del`}function Yn(e,t,n,o){let r=e[0],s=e[e.length-1],a=(t.x-(r.x0+s.x1)/2)*n,i=(t.y-(r.y0+s.y1)/2)*o,c=Math.hypot(a,i);return c===0?{x:0,y:-1}:{x:a/c,y:i/c}}function Fn(e,t){return Math.abs(t.x)*(e.x1-e.x0)/2+Math.abs(t.y)*(e.y1-e.y0)/2}function Kn(e,t){let n=(e.x1-e.x0)/2,o=(e.y1-e.y0)/2;return Math.min(t.x===0?1/0:n/Math.abs(t.x),t.y===0?1/0:o/Math.abs(t.y))}function jn(e,t,n){let o=0;for(let r=1;r<e.length;r++){let s=e[r-1],a=e[r];o+=Math.hypot((a.x-s.x)*t,(a.y-s.y)*n)}return o}function Un(e,t){let n=1/0,o=1/0,r=-1/0,s=-1/0;for(let a of e)for(let i of t[a]??[])n=Math.min(n,i.x),r=Math.max(r,i.x),o=Math.min(o,i.y),s=Math.max(s,i.y);return n===1/0?void 0:{minX:n,minY:o,maxX:r,maxY:s}}var Ct=new WeakMap;function Vn(e,t){let n=Ct.get(e);if(n?.nodeLengths===t)return n.order;let o=Object.entries(e).filter(([r,s])=>s.length>0&&t.has(r)).sort(([r],[s])=>t.get(s)-t.get(r));return Ct.set(e,{nodeLengths:t,order:o}),o}var _t=new WeakMap;function qn(e,t,n,o){let{scaleX:r,scaleY:s}=n,a=_t.get(e);if(a?.deletions===t&&a.scaleX===r&&a.scaleY===s&&a.version===o)return a.arcs;let i=[];for(let c of[...t].sort((p,d)=>d.bp-p.bp)){let p=At(e,c,n),d=p?xt(p):void 0;if(p&&d){let{minX:l,minY:u,maxX:m,maxY:f}=Mt(p);i.push({deletion:c,curves:p,apex:d,extent:Math.max((m-l)*r,(f-u)*s)})}}return _t.set(e,{deletions:t,scaleX:r,scaleY:s,version:o,arcs:i}),i}function It({nodePositions:e,nodeLengths:t,deletions:n,alleleDeletions:o,axis:r,translateX:s,translateY:a,width:i,height:c,version:p=0}){let{scaleX:d,scaleY:l}=r,u=[],m=[];for(let{deletion:y,curves:h,apex:x,extent:w}of qn(e,n,r,p))if(w>=On){let R=Bt(y.bp),L=ve(R),A=Ce(L,0,0),g=x.x*d+s,M=x.y*l+a,S=w>=L*2/Be,E=Yn(h,x,d,l),O=Fn(A,E)+Hn,I=S?g:_e(g+E.x*O,L,i-L),_=S?M:_e(M+E.y*O,Z,c-Z),v=Math.hypot(I-g,_-M),H;if(v>0){let P={x:(I-g)/v,y:(_-M)/v},D=Kn(A,P);H={arcX:g,arcY:M,labelX:I-P.x*D,labelY:_-P.y*D}}u.push({label:{key:`del:${y.edgeIndex}`,text:R,x:I,y:_,kind:"deletion",leader:H},box:Ce(L,I,_)})}let f=new Set,b=[...o??[]].sort((y,h)=>h.bp-y.bp);for(let y of b){let h=Un(y.nodeIds,e);if(!h)continue;let x=Math.max(h.minX*d+s,0),w=Math.min(h.maxX*d+s,i),R=Math.max(h.minY*l+a,0),L=Math.min(h.maxY*l+a,c);if(w<x||L<R)continue;let A=Math.max(w-x,L-R),g=Bt(y.bp),M=ve(g);if(A>=M*2/Be){for(let O of y.nodeIds)f.add(O);let S=_e((x+w)/2,M,i-M),E=_e((R+L)/2,Z,c-Z);u.push({label:{key:`alleledel:${y.nodeIds.join(",")}`,text:g,x:S,y:E,kind:"deletion"},box:Ce(M,S,E)})}}for(let[y,h]of Vn(e,t)){if(f.has(y))continue;let{x,y:w}=St(h),R=w*l+a;if(R+Z<=0||R-Z>=c)continue;let L=jn(h,d,l);if(L<Wn*2/Be)continue;let A=kt(t.get(y)),g=ve(A);if(L>=g*2/Be){let M=x*d+s;m.push({label:{key:`node:${y}`,text:A,x:M,y:R,kind:"node"},box:Ce(g,M,R)})}}return{deletions:u,nodes:m}}function Gt(e,t){return Math.max(Dn,Math.floor(e*t/Pn))}function Ve(e,t,n=1/0){let o=[];for(let{label:r,box:s}of e){if(o.length>=n)break;t(s)&&o.push(r)}return o}var Zn=3.4,Tt=6,Qn=8,eo=18,to=60,no=8,Ot=15;function qe(e,t){return[...e].sort((n,o)=>t(o)-t(n))}function Hr(e){let{paneWidth:t,canvasHeight:n,translateX:o,translateY:r}=e,{scaleX:s,scaleY:a}=e.axisScale,i={width:t,height:n},c=g=>({x:g.x*s+o,y:g.y*a+r}),p=e.drawnRowLabels.map(({label:g,y:M})=>vt(g,M*a+r));e.legendSize.width>0&&p.push({x0:t-Tt-e.legendSize.width,x1:t,y0:0,y1:Tt+e.legendSize.height}),e.poppedFrom&&p.push({x0:0,x1:60+e.poppedFrom.label.length*6.2*1.2,y0:0,y1:44});let d=Ue(i,p),l=e.drawnRowLabels.length>0,u=l?Math.min(...e.drawnRowLabels.map(g=>g.y)):1/0,m=e.contigThickness*Zn,f=qe(e.bubbleHalos,g=>g.members),b=fe(f.map(g=>{let{x:M,y:S}=c({x:g.labelAt.x,y:Math.min(g.labelAt.y,u)}),E=S-m/2-6;return{item:g,x:M,y:l?Math.max(E,Ot):E,text:g.label}}),i,d),y=Math.max(2,Math.min(no,Math.floor((r-to)/19))),h=fe(qe(e.bubbleGlyphs,g=>g.bubble.end-g.bubble.start).flatMap(g=>{let M=(g.bubble.start+g.bubble.end)/2*s+o,S=je(g.label)/2;return M<0||M>t?[]:[{item:{glyph:g,glyphX:M},x:Math.min(Math.max(M,S),t-S),y:Ot,text:g.label,stack:y-1}]}),i,d),x=fe(qe(e.genePins,g=>g.gene.end-g.gene.start).map(g=>{let{x:M,y:S}=c(g.at);return{item:g,x:M,y:S+e.contigThickness+eo,text:g.covered<.98?`${g.gene.name} \u2026`:g.gene.name}}),i,d),w=e.nodePositions?It({nodePositions:e.nodePositions,nodeLengths:e.nodeLengths,deletions:e.showDeletionEdges?e.deletions:[],alleleDeletions:e.alleleDeletions,axis:e.axisScale,translateX:o,translateY:r,width:t,height:n,version:e.positionsVersion}):{deletions:[],nodes:[]},R=Ve(w.deletions,d),L=fe(f.flatMap(g=>g.routes.map(M=>{let{x:S,y:E}=c(M.at);return{item:{halo:g,route:M},x:S,y:E+4,text:M.text,stack:Qn}})),i,d),A=Ve(w.nodes,d,Gt(t,n));return{bubbles:b,glyphs:h,genes:x,routes:L,sizes:[...R,...A]}}var G=ne(Je(),1);var C=ne(Je(),1);function be(e,t){return(0,C.packAbgr)((0,C.abgrRed)(e),(0,C.abgrGreen)(e),(0,C.abgrBlue)(e),Math.round((0,C.abgrAlpha)(e)*t))}function $r(e,t){return(0,C.packAbgr)(Math.min(255,Math.round((0,C.abgrRed)(e)*t)),Math.min(255,Math.round((0,C.abgrGreen)(e)*t)),Math.min(255,Math.round((0,C.abgrBlue)(e)*t)),(0,C.abgrAlpha)(e))}var oo=4;function he(e){let t=new Map;function n(o,r){let s=t.get(o);s?s.push(r):t.set(o,[r])}for(let o of e.edges)n(o.from,o.to),n(o.to,o.from);return t}function ro({nodeId:e,nodeById:t,neighbors:n}){let o=new Set([e]),r=[e],s=1/0,a=-1/0;for(let i=0;i<oo&&r.length>0;i++){let c=[];for(let p of r){let d=n.get(p);if(d){for(let l of d)if(!o.has(l)){o.add(l);let u=t.get(l);u&&B(u)?(s=Math.min(s,u.stable.start+u.length),a=Math.max(a,u.stable.start)):c.push(l)}}}r=c}return s===1/0?void 0:{start:Math.min(s,a),end:Math.max(s,a)}}function so({nodeId:e,nodeById:t,neighbors:n}){let o=t.get(e);return o===void 0?void 0:B(o)?{start:o.stable.start,end:o.stable.start+o.length}:ro({nodeId:e,nodeById:t,neighbors:n})}function Xt(e){let t=new Map(e.nodes.map(r=>[r.id,r])),n=he(e),o=new Map;for(let r of e.nodes){let s=so({nodeId:r.id,nodeById:t,neighbors:n});s&&o.set(r.id,(s.start+s.end)/2)}return o}var zt=new WeakMap;function $t(e,t,n,o,r){let{scaleX:s,scaleY:a}=n,i=zt.get(e);if(i?.graph===t&&i.scaleX===s&&i.scaleY===a&&i.deletions===o&&i.version===r)return i.curves;let c=new Map;for(let p=0;p<t.edges.length;p++){let d=t.edges[p],l=e[d.from],u=e[d.to];if(l?.length&&u?.length){let m=o?.get(p);c.set(p,pe(l,u,d.from===d.to,0,0,n,m?Ye(e,m):[]))}}return zt.set(e,{graph:t,scaleX:s,scaleY:a,deletions:o,version:r,curves:c}),c}var ao=(0,G.packAbgr)(119,119,119,217),Wt=(0,G.packAbgr)(136,136,136,217),io=(0,G.packAbgr)(24,24,28,240),co=2.2,lo=(0,G.packAbgr)(30,30,36,245),uo=1.8,ke=.18,po=11,fo=1.2,mo=1e-6,bo=12,ho=.45;function go(e,t=1){let n=t===1?e:e.map(r=>({x:r.x,y:r.y*t})),o=[];for(let r=0;r<n.length;r++){let s=0,a=0;if(r===0){let i=n[1].x-n[0].x,c=n[1].y-n[0].y,p=Math.hypot(i,c);p>0&&(s=-c/p,a=i/p)}else if(r===n.length-1){let i=n[r].x-n[r-1].x,c=n[r].y-n[r-1].y,p=Math.hypot(i,c);p>0&&(s=-c/p,a=i/p)}else{let i=n[r].x-n[r-1].x,c=n[r].y-n[r-1].y,p=Math.hypot(i,c),d=n[r+1].x-n[r].x,l=n[r+1].y-n[r].y,u=Math.hypot(d,l);if(p>0&&u>0){let m=-c/p,f=i/p,b=-l/u,y=d/u;s=(m+b)/2,a=(f+y)/2;let h=m*s+f*a;h>.1&&(s/=h,a/=h)}else p>0?(s=-c/p,a=i/p):u>0&&(s=-l/u,a=d/u)}o.push({nx:s,ny:a})}return o}function yo(e,t,n,o=1){return e.map((r,s)=>({x:r.x+t[s].nx*n,y:r.y+t[s].ny*n/o}))}function Ie(e,t,n,o){return(0,G.packAbgr)(Math.round(e*255),Math.round(t*255),Math.round(n*255),Math.round(o*255))}function Ge(e,t,n){let o=(1-Math.abs(2*n-1))*t,r=o*(1-Math.abs(e/60%2-1)),s=n-o/2,a=0,i=0,c=0;return e<60?(a=o,i=r):e<120?(a=r,i=o):e<180?(i=o,c=r):e<240?(i=r,c=o):e<300?(a=r,c=o):(a=o,c=r),[a+s,i+s,c+s]}var xo=[[68,1,84],[59,82,139],[33,145,140],[94,201,98],[253,231,37]],Mo=[[237,137,44],[158,42,122]],Lo=[[220,50,50],[50,120,220]];function Ze(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),o=Math.min(e.length-2,Math.floor(n)),r=n-o,s=e[o],a=e[o+1];return(0,G.packAbgr)(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 Ro(e,t){let[n,o,r]=Ge(lt(e),He,Xe);return Ie(n,o,r,t)}var wo=300,Ao=.7,So=.5,No=(0,G.packAbgr)(60,65,72,255);function ts(e,t){let n=Xt(e);if(t&&t.end>t.start)return{start:t.start,span:t.end-t.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 Eo(e){let t=1/0,n=-1/0,o=1/0,r=-1/0,s=0;for(let a of e.nodes)a.stable!==void 0&&a.stable.rank>s&&(s=a.stable.rank),a.depth<t&&(t=a.depth),a.depth>n&&(n=a.depth),a.length<o&&(o=a.length),a.length>r&&(r=a.length);return{minDepth:t,maxDepth:n,minLength:o,maxLength:r,maxRank:s,nodeCount:e.nodes.length}}function Bo(e,t,n,o){switch(n){case"random":return Ro(e.id,1);case"depth":return Ze(xo,o.maxDepth>o.minDepth?(e.depth-o.minDepth)/(o.maxDepth-o.minDepth):.5);case"node-length":return Ze(Lo,o.maxLength>o.minLength?(e.length-o.minLength)/(o.maxLength-o.minLength):.5);case"stable-rank":return e.stable===void 0?(0,G.packAbgr)(160,160,160,255):e.stable.rank===0?(0,G.packAbgr)(52,152,219,255):Ze(Mo,o.maxRank>1?(e.stable.rank-1)/(o.maxRank-1):0);case"reference-position":{let r=o.referenceRamp,s=r?.midpoints.get(e.id);if(r===void 0||s===void 0)return(0,G.packAbgr)(160,160,160,255);if(e.stable!==void 0&&e.stable.rank>0)return No;let a=Math.max(0,Math.min(1,(s-r.start)/r.span)),[i,c,p]=Ge(a*wo,Ao,So);return Ie(i,c,p,1)}case"grey":return(0,G.packAbgr)(160,160,160,255);case"rainbow":{let r=o.nodeCount>1?t/o.nodeCount*360:0,[s,a,i]=Ge(r,.75,.5);return Ie(s,a,i,1)}default:return(0,G.packAbgr)(52,152,219,255)}}function Co(e,t=1){let n=e.x1-e.cx1,o=(e.y1-e.cy1)*t;return Math.hypot(n,o)>0?Math.atan2(o,n):Math.atan2((e.y1-e.y0)*t,e.x1-e.x0)}function _o(e,t){let n=!1;for(let o=0;o<e.length-1&&!n;o++){let r=e[o],s=e[o+1];n=Math.max(r.x,s.x)>=t.minX&&Math.min(r.x,s.x)<=t.maxX&&Math.max(r.y,s.y)>=t.minY&&Math.min(r.y,s.y)<=t.maxY}return n}function vo(e,t){for(let n of e){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>=t.minX&&o<=t.maxX&&a>=t.minY&&s<=t.maxY)return!0}return!1}var Yt=new WeakMap;function ko(e){let t=Yt.get(e);if(!t){let n=[],o=new Map,r=e.paths??[];for(let s=0;s<r.length;s++){let[a,i,c]=Ge(ut(s,r.length),He,Xe);n.push(Ie(a,i,c,.85)),o.has(r[s].name)||o.set(r[s].name,s)}t={pathColorByIndex:n,pathIndexByName:o},Yt.set(e,t)}return t}var Ft=new WeakMap,Io=new Map;function Go(e){let t=Ft.get(e);if(!t){t=new Map;for(let[n,o]of(e.paths??[]).entries())for(let r of new Set(o.nodeIds)){let s=t.get(r);s?s.push(n):t.set(r,[n])}Ft.set(e,t)}return t}function ns(e){let{nodePositions:t,graph:n,nodeById:o,colorScheme:r,contigThickness:s,connectorThickness:a,drawPaths:i,nodeWidth:c="uniform",highlight:p,axis:d,linearLayout:l,viewportBounds:u,referenceRamp:m,deletions:f,hiddenEdges:b,version:y=0}=e,h=c==="depth"?it(n):0,x=d.scaleX,w=Ee(d),R=$t(t,n,d,f,y),L=[],A=new Map,g=[],M=new Map,S=[],E=new Map,O={...Eo(n),referenceRamp:m},I=new Map;if(r==="rainbow")for(let N=0;N<n.nodes.length;N++)I.set(n.nodes[N].id,N);let _=n.paths?.length??0,{pathColorByIndex:v,pathIndexByName:H}=ko(n),P=N=>v[H.get(N)??-1]??Wt,D=i&&_>1?Go(n):Io,ge=x>(l?1:ho);for(let N=0;N<n.edges.length;N++){let k=n.edges[N],X=t[k.from],Y=t[k.to],z=R.get(N);if(!X?.length||!Y?.length||!z||b?.has(N))continue;let F=k.pathIds?.length??0,K=f?.get(N)!==void 0,j=p?.edgeIndexes.has(N)??!1,U=a/2*(K?co:1)*(j?uo:1),te=i&&F>0,ae=K?io:ao,re=p?j?lo:be(ae,ke):ae,ye=(Le,Re,$,le)=>{let V=Le===0&&Re===0?z:Rt(z,Le,Re);if(!(u&&!vo(V,u))){if(K)for(let ue of Lt(V,po/x))S.push({curves:ue,thickness:U,color:$});else S.push({curves:V,thickness:U,color:$});if(ge&&le!==void 0){let ue=V[V.length-1];g.push({x:ue.x1,y:ue.y1,angle:Co(ue,w),size:bo,color:le})}}},xe=S.length,ie=g.length;if(!te)ye(0,0,re,re);else{let Le=wt(X,Y,F,d),Re=Math.floor((F-1)/2);for(let $=0;$<F;$++){let le=Le[$],V=P(k.pathIds[$]);ye(le.x,le.y,p&&k.pathIds[$]!==p.name?be(V,ke):V,$===Re?re:void 0)}}let Me=S.length-xe;Me>0&&E.set(N,{start:xe,count:Me});let ce=g.length-ie;ce>0&&M.set(N,{start:ie,count:ce})}for(let[N,k]of Object.entries(t)){let X=o.get(N);if(!X||u&&!_o(k,u))continue;let Y=Bo(X,I.get(N)??0,r,O),z=p!==void 0&&!p.nodeIds.has(N),F=z?be(Y,ke):Y,se=ct(X,s,c,h),K=se/2,j=L.length,U=D.get(N),te=se/_,ae=k.length>=2;if(ae&&U?.length&&te>=fo){let ye=go(k,w),xe=1/Math.max(x,mo);for(let ie of U){let Me=(ie-(_-1)/2)*te*xe,ce=v[ie]??Wt;L.push({points:yo(k,ye,Me,w),thickness:te/2,color:z?be(ce,ke):ce})}}else ae&&L.push({points:k,thickness:K,color:F});let re=L.length-j;re>0&&A.set(N,{start:j,count:re})}return{nodeStrokes:L,nodeStrokeRuns:A,arrows:g,arrowRuns:M,edgeCurves:S,edgeCurveRuns:E}}function as(e){return de(e)?Kt(e):void 0}function Kt(e){return{sample:Ae(e.stable.refName),haplotype:ot(e.stable.refName),refName:rt(e.stable.refName),start:e.stable.start,end:e.stable.start+e.length}}function To(e,t){let n=[...e].sort((s,a)=>s.start-a.start),o,r;for(let s of n)r=r&&s.start-r.end<=t?{start:r.start,end:Math.max(r.end,s.end)}:{start:s.start,end:s.end},(!o||r.end-r.start>o.end-o.start)&&(o=r);return o}function Oo(e){return`${e.haplotype??e.sample}\0${e.refName}`}function is(e,{maxGap:t=1/0}={}){let n=new Map;for(let r of e.nodes)if(de(r)){let s=Kt(r),a=Oo(s),i=n.get(a);i?(i.spans.push({start:s.start,end:s.end}),i.rank=Math.min(i.rank,r.stable.rank)):n.set(a,{sample:s.sample,haplotype:s.haplotype,refName:s.refName,rank:r.stable.rank,spans:[{start:s.start,end:s.end}]})}let o=new Map;for(let r of n.values()){let s=To(r.spans,t);if(s){let a={sample:r.sample,haplotype:r.haplotype,refName:r.refName,start:s.start,end:s.end,rank:r.rank,nodeCount:r.spans.length},i=r.haplotype??r.sample,c=o.get(i);(!c||a.nodeCount>c.nodeCount)&&o.set(i,a)}}return[...o.values()].sort((r,s)=>+(r.rank!==0)-+(s.rank!==0)||r.sample.localeCompare(s.sample)||(r.haplotype??"").localeCompare(s.haplotype??""))}function Po(e,t){return(t.haplotype===void 0?void 0:e(t.haplotype))??e(t.sample)}function cs(e,t){return e.flatMap(n=>{let o=Po(t,n);return o===void 0?[]:[{...n,sample:o}]})}function ls(e){return`${e.refName}:${e.start+1}-${e.end}`}function Qe(e){return`${e.refName}:${(e.start+1).toLocaleString()}-${e.end.toLocaleString()}`}var jt=ne(we(),1),Ut=(0,W.createSvgIcon)((0,jt.jsx)("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows");var Vt=ne(we(),1),qt=(0,W.createSvgIcon)((0,Vt.jsx)("path",{d:"M17 5h-2V3h2zm-2 16h2v-2.59L19.59 21 21 19.59 18.41 17H21v-2h-6zm4-12h2V7h-2zm0 4h2v-2h-2zm-8 8h2v-2h-2zM7 5h2V3H7zM3 17h2v-2H3zm2 4v-2H3c0 1.1.9 2 2 2M19 3v2h2c0-1.1-.9-2-2-2m-8 2h2V3h-2zM3 9h2V7H3zm4 12h2v-2H7zm-4-8h2v-2H3zm0-8h2V3c-1.1 0-2 .9-2 2"}),"HighlightAlt");var Jt=ne(we(),1),et=(0,W.createSvgIcon)((0,Jt.jsx)("path",{d:"M3 16h5v-2H3zm6.5 0h5v-2h-5zm6.5 0h5v-2h-5zM3 20h2v-2H3zm4 0h2v-2H7zm4 0h2v-2h-2zm4 0h2v-2h-2zm4 0h2v-2h-2zM3 12h8v-2H3zm10 0h8v-2h-8zM3 4v4h18V4z"}),"LineStyle");var Do="Linear genome view",Ho="Linear synteny view",Xo="No synteny track in this session aligns these assemblies";function Zt({label:e,icon:t,entries:n,entryLabel:o,onSelect:r,disabledHelpText:s,nameTheOnlyEntry:a=!0}){let[i]=n,c=s?[{label:e,icon:t,disabled:!0,disabledHelpText:s,onClick:()=>{}}]:[];return n.length===0?c:n.length===1&&i?[{label:a?`${e} \u2014 ${o(i)}`:e,icon:t,onClick:r(i)}]:[{label:e,icon:t,type:"subMenu",subMenu:n.map(p=>({label:o(p),onClick:r(p)}))}]}function Ls({contributors:e,syntenyTracks:t,onShowLinear:n,onShowSynteny:o}){let r=t[0]?.coverage??e.length;return[...Zt({label:Do,icon:et,entries:e,entryLabel:s=>`${s.sample} ${Qe(s)}`,onSelect:s=>()=>{n({location:s,assembly:s.sample})}}),...e.length>=2?Zt({label:`${Ho} (${r} assemblies)`,icon:Ut,entries:t,entryLabel:s=>s.coverage<r?`${s.name} (${s.coverage} of ${r})`:s.name,nameTheOnlyEntry:!1,disabledHelpText:Xo,onSelect:s=>()=>{o(s.trackId)}}):[]]}function Rs({own:e,reference:t,highlight:n,onShowLinear:o,onHighlight:r}){let s=[e?{label:`Open in ${e.assembly} \u2014 ${Qe(e.location)}`,target:e}:void 0,t&&t.assembly!==e?.assembly?{label:`Open in ${t.assembly} \u2014 around this node`,target:t}:void 0].filter(a=>a!==void 0);return[...r&&n?[{label:`Highlight in ${n.assembly}`,icon:qt,onClick:()=>{r(n)}}]:[],...s.map(({label:a,target:i})=>({label:a,icon:et,onClick:()=>{o(i)}}))]}var zo=10;function $o(e,t){let n=e.end-e.start,o=e.longestAlleleLength-e.shortestAlleleLength;return t.find(r=>o<=zo*(r.end-r.start)&&(n===0?r.start<=e.start&&e.start<=r.end:Math.min(e.end,r.end)-Math.max(e.start,r.start)>=n/2))}var Wo=40;function oe(e){return e>=1e4?`${(e/1e3).toFixed(0)} kb`:e>=1e3?`${(e/1e3).toFixed(1)} kb`:`${e} bp`}function Yo(e,t){let n=oe(e),o=oe(t),r=o.slice(o.indexOf(" "));return n.endsWith(r)?`${n.slice(0,-r.length)}\u2013${o}`:`${n}\u2013${o}`}function Qt(e){return e>=at?"\u22652.1B routes":e>=1e5?`${(e/1e3).toFixed(0)}k routes`:`${e} routes`}function Ss(e,t=[]){let n=Fo(e,t);return e.partial?{...n,label:`${n.label}, partial`}:n}function Fo(e,t){let n=e.end-e.start,{shortestAlleleLength:o,longestAlleleLength:r,pathCount:s,segmentCount:a,inversion:i}=e,c=Yo(o,r);if(a>=Wo)return{kind:"superbubble",label:`${c} superbubble, ${a} segments, ${Qt(s)}${i?", inv":""}`};if(i)return{kind:"inversion",label:`${oe(r)} inv`};let p=r!==o?$o(e,t):void 0;if(p){let l=p.name?` (${p.name})`:"";return{kind:"repeat",label:`${c} repeat array${l}, ${Qt(s)}`}}let d=s>2?`, ${s} alleles`:"";return o===r&&o===n?n<=1?{kind:"snp",label:"SNP"}:{kind:"substitution",label:`${oe(n)} sub`}:n===0||o===n?{kind:"insertion",label:`\u2264${oe(r-n)} ins${d}`}:r===n?{kind:"deletion",label:`${oe(n-o)} del${d}`}:{kind:"complex",label:`${oe(n)} ref \u2192 ${c}, ${s} alleles`}}var Ns={snp:"#5b6b7a",substitution:"#5b6b7a",insertion:"#2f8fd6",deletion:"#c94040",inversion:"#e07b00",repeat:"#8e3fbf",superbubble:"#8e3fbf",complex:"#8e3fbf"},Es={snp:"SNP",substitution:"substitution",insertion:"insertion",deletion:"deletion",inversion:"inversion",repeat:"repeat array",superbubble:"superbubble",complex:"site"};function Bs(e){return e.segments.split(",").filter(Boolean)}function Te(e){let t=e.split("#"),n=t.length>=2?Number(t[1]):Number.NaN;return{sample:t[0]??e,haplotype:Number.isFinite(n)?n:void 0}}function Ko(e,t,n,o){let r=[],s=[],a=[e];for(o.add(e);a.length>0;){let i=a.pop(),c=t.get(i);if(c){r.push(c);for(let p of n.get(i)??[]){let d=t.get(p);d&&(d.stable.rank===0?s.push(d):o.has(p)||(o.add(p),a.push(p)))}}}return{members:r,anchors:s}}function jo(e){if(new Set(e.map(i=>i.stable.refName)).size!==1||e.length<2)return;let n=[...e].sort((i,c)=>i.stable.start-c.stable.start),o=n[0],r=n.at(-1),s=o.stable.start+o.length,a=r.stable.start;return a>=s?{start:s,end:a,entry:o}:void 0}function Uo(e,t,n){let o=new Map(e.map(a=>[a.id,a])),r=new Map,s=[];for(let a of n.get(t.id)??[])o.has(a)&&(r.set(a,0),s.push(a));if(s.length===0)for(let a of e)r.set(a.id,0),s.push(a.id);for(let a of s){let i=r.get(a)+o.get(a).length;for(let c of n.get(a)??[])if(o.has(c)){let p=r.get(c);(p===void 0||i<p)&&(r.set(c,i),s.push(c))}}return r}function Vo(e,t,n){let o=Uo(e,t,n),r=[...e].sort((c,p)=>o.get(c.id)-o.get(p.id)),s=new Map(r.map((c,p)=>[c.id,p])),a=new Map(e.map(c=>[c.id,c])),i=new Map;for(let[c,p]of r.entries()){let d=0;for(let l of n.get(p.id)??[]){let u=a.get(l);u&&s.get(l)<c&&(d=Math.max(d,i.get(l)+u.length))}i.set(p.id,d)}return{offsets:i,ordered:r}}function tn(e){let t=new Map(e.nodes.filter(de).map(s=>[s.id,s])),n=he(e),o=new Set,r=[];for(let s of t.values())if(s.stable.rank!==0&&!o.has(s.id)){let{members:a,anchors:i}=Ko(s.id,t,n,o),c=jo(i);if(c){let{offsets:p,ordered:d}=Vo(a,c.entry,n);r.push({start:c.start,refSpan:c.end-c.start,nodeIds:d.map(l=>l.id),nodeOffsets:d.map(l=>p.get(l.id)),pathLength:d.reduce((l,u)=>Math.max(l,p.get(u.id)+u.length),0)})}}return r.sort((s,a)=>s.start-a.start)}var qo=1,Jo=.015;function Oe({graph:e,span:t,rowY:n,positions:o}){let r=t*Jo,s=tn(e),a=new Map(e.nodes.map(d=>[d.id,d])),i=[];for(let d of s){let l=d.refSpan-d.pathLength;l>=qo&&i.push({nodeIds:d.nodeIds,bp:l});let u=Math.max(d.refSpan,r),m=d.pathLength>0?u/d.pathLength:0;d.nodeIds.forEach((f,b)=>{let y=a.get(f);if(y){let h=d.nodeOffsets[b],x=u/d.nodeIds.length,w=L=>d.start+L*m,R=n(y);o[f]=m?[{x:w(h),y:R},{x:w(h+y.length),y:R}]:[{x:d.start+b*x,y:R},{x:d.start+(b+1)*x,y:R}]}})}let c=he(e),p=Object.keys(o);for(let d of p){let l=o[d].at(-1).x;for(let u of c.get(d)??[]){let m=a.get(u);if(m&&!(u in o)){let f=n(m);o[u]=[{x:l,y:f},{x:l+r,y:f}],p.push(u)}}}return i}function Zo(e){let t=new Set;for(let n of e.nodes)n.stable&&t.add(n.stable.rank);return new Map([...t].sort((n,o)=>n-o).map((n,o)=>[n,o]))}function nn(e,t){let n=q(e);if(n.length===0)return;let o=Ne(n,t),r=Zo(e),s=J(n),a=Oe({graph:e,span:o,rowY:c=>(c.stable?r.get(c.stable.rank)??r.size:r.size)*20,positions:s}),i=[...r].map(([c,p])=>({label:c===0?"Reference (rank 0)":`Rank ${c}`,y:p*20}));return{nodePositions:s,rowLabels:i,referenceAxis:!0,pixelRows:!0,alleleDeletions:a}}var Qo=12,tt=20;function on(e){return 10+8*Math.log2(1+e.length)}function Q(e,t){return e<t?-1:e>t?1:0}function sn(e,t){return Q(e.at,t.at)||Q(e.side,t.side)||Q(e.hops,t.hops)}var rn={at:1/0,side:0,hops:0};function er(e){let t=new Map(e.nodes.map(o=>[o.id,o])),n=or(e);return e.nodes.map(o=>o.id).sort((o,r)=>sn(n.get(o)??rn,n.get(r)??rn)||Q(t.get(o).name,t.get(r).name)||Q(o,r))}function tr(e,t){let n=new Set(e.nodes.map(d=>d.id)),o=new Map(t.map(d=>[d.id,d.stable.start])),r=new Map,s=new Map;t.forEach((d,l)=>{s.set(d.id,t[l-1]?.id),r.set(d.id,t[l+1]?.id)});let a=t[0]?.id,i=(d,l)=>{let u=r.get(d);r.set(d,l),s.set(l,d),r.set(l,u),u!==void 0&&s.set(u,l)},c=(d,l)=>{let u=s.get(d);u===void 0?(a=l,s.set(l,void 0),r.set(l,d),s.set(d,l)):i(u,l)};for(let d of e.paths??[]){let l=0,u=0,m;for(let h of d.nodeIds){let x=o.get(h);x!==void 0&&(m!==void 0&&x!==m&&(x>m?l++:u++),m=x)}let f=u>l?[...d.nodeIds].reverse():d.nodeIds,b,y=new Set;for(let h of f)if(r.has(h)){if(b===void 0)for(let x of y)c(h,x);b=h}else n.has(h)&&(b===void 0?y.add(h):(i(b,h),b=h))}let p=[];for(let d=a;d!==void 0;d=r.get(d))p.push(d);return p}function nr(e,t){let n=[...t.entries()].sort(([a,i],[c,p])=>sn(i,p)||Q(a,c)).map(([a])=>a),o=n.length;for(let a of n){let i=t.get(a);for(let c of e.get(a)??[])t.has(c)||(t.set(c,{at:i.at,side:1,hops:i.hops+1}),n.push(c))}let r=new Set(n.slice(o)),s=new Set;for(let a of r){if(s.has(a))continue;let{at:i}=t.get(a),c=[a];s.add(a);let p=!0;for(let d of c){let{hops:l}=t.get(d),u=!0,m=!1;for(let f of e.get(d)??[]){let b=t.get(f);b.at===i&&r.has(f)?(u&&=b.hops<=l,s.has(f)||(s.add(f),c.push(f))):b.at!==i&&(m||=b.at<i,p&&=b.at<i)}p&&=!u||m}if(p)for(let d of c){let l=t.get(d);t.set(d,{...l,side:-1,hops:-l.hops})}}}function or(e){let t=new Set(e.nodes.map(s=>s.id)),n=new Map;for(let s of e.edges)!t.has(s.from)||!t.has(s.to)||((n.get(s.from)??n.set(s.from,[]).get(s.from)).push(s.to),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push(s.from));let o=e.nodes.filter(B).sort((s,a)=>Q(s.stable.start,a.stable.start)||Q(s.name,a.name)),r=new Map;return tr(e,o).forEach((s,a)=>{r.set(s,{at:a,side:0,hops:0})}),nr(n,r),r}function rr(e){let t=new Map(e.nodes.map(l=>[l.id,l])),n=er(e),o=new Map(n.map((l,u)=>[l,u])),r=l=>B(t.get(l)),s=new Map(n.map(l=>[l,[]])),a=new Map(n.map(l=>[l,[]])),i=(l,u)=>{s.get(u).push(l),a.get(l).push(u)};for(let l of e.edges)l.from===l.to||!o.has(l.from)||!o.has(l.to)||(o.get(l.from)<o.get(l.to)?i(l.from,l.to):i(l.to,l.from));let c=n.filter(r);for(let l=1;l<c.length;l++)i(c[l-1],c[l]);let p=new Map;for(let l of n){let u=0;for(let m of s.get(l))u=Math.max(u,p.get(m)+1);p.set(l,u)}for(let l=n.length-1;l>=0;l--){let u=n[l],m=a.get(u);if(r(u)||m.length===0)continue;let f=1/0;for(let h of m)f=Math.min(f,p.get(h));let b=p.get(u),y=Math.max(b,f-1);p.set(u,Math.floor((b+y)/2))}let d=[];for(let l of n)(d[p.get(l)]??=[]).push(l);return{layers:d,layerOf:p,preds:s}}function an(e){if(!e.nodes.some(B))return;let t=new Map(e.nodes.map(l=>[l.id,l])),n=l=>B(t.get(l)),{layers:o,layerOf:r,preds:s}=rr(e),a=o.map(l=>{let u=0;for(let m of l)u=Math.max(u,on(t.get(m)));return u}),i=[],c=0;for(let l=0;l<o.length;l++)i[l]=c,c+=a[l]+Qo;let p=new Map;for(let l of o){let u=[];for(let f of l){if(n(f)){p.set(f,0);continue}let b=s.get(f).filter(h=>p.has(h)),y=0;for(let h of b)y+=p.get(h)/b.length;u.push({id:f,ideal:y===0?tt:y})}u.sort((f,b)=>f.ideal-b.ideal);let m=new Set([0]);for(let{id:f,ideal:b}of u){let y=Math.round(b/tt);y===0&&(y=b>=0?1:-1);for(let h=1;m.has(y);h++)m.has(y+h)?m.has(y-h)||(y-=h):y+=h;m.add(y),p.set(f,y*tt)}}let d={};for(let l of e.nodes){let u=r.get(l.id),m=on(l),f=i[u]+a[u]/2,b=p.get(l.id);d[l.id]=[{x:f-m/2,y:b},{x:f+m/2,y:b}]}return{nodePositions:d,referenceAxis:!1,pixelRows:!0}}function sr(e,t){let n=new Map;for(let r of e.nodes)if(Se(r)){let{sample:s}=Te(r.stable.refName);n.set(s,(n.get(s)??0)+r.length)}let o=new Map(t.map((r,s)=>[r,s]));return[...n.keys()].sort((r,s)=>(o.get(r)??1/0)-(o.get(s)??1/0)||n.get(s)-n.get(r)||r.localeCompare(s))}function cn(e,t,n=[]){let o=q(e),r=sr(e,n);if(o.length===0||r.length===0)return;let s=Ne(o,t),a=new Map(r.map((u,m)=>[u,m+1])),i=J(o),c=r.length+1,p=Oe({graph:e,span:s,rowY:u=>{let m=u.stable;return((m?a.get(Te(m.refName).sample):void 0)??c)*20},positions:i}),l=[{label:Te(o[0].stable.refName).sample,y:0},...r.map(u=>({label:u,y:a.get(u)*20}))];return{nodePositions:i,rowLabels:l,sampleRows:r,referenceAxis:!0,pixelRows:!0,alleleDeletions:p}}function ln(e){let t=q(e);if(t.length!==0)return{nodePositions:J(t),referenceAxis:!0,pixelRows:!0}}function un(e){return e.sample??Ae(e.name)}function ar(e){return e.haplotype!==void 0&&e.sample!==void 0?`${e.sample}#${e.haplotype}`:un(e)}function ir(e,t,n,o=!0){if(!n||!o)return{ids:e,complete:!0};let r=-1,s=-1,a=-1/0,i=1/0;if(e.forEach((p,d)=>{let l=t.get(p);l&&(l.end<=n.start&&l.end>a&&(a=l.end,r=d),l.start>=n.end&&l.start<i&&(i=l.start,s=d))}),r<0||s<0)return{ids:e,complete:!1};let c=e.slice(Math.min(r,s)+1,Math.max(r,s));return{ids:r<s?c:c.reverse(),complete:!0}}function dn(e,t,n){let o=e.paths??[],r=o.find(f=>De(f.name).name===e.referencePath)??o[0];if(!r||o.length<2)return;let s=new Map(e.nodes.map(f=>[f.id,f.length])),a=new Set(r.nodeIds),i=e.anchorPaths?.find(f=>f.name===De(r.name).name)?.start??0,c=t&&t.end>t.start?t:void 0,p=new Map,d=i;for(let f of r.nodeIds){let b=s.get(f)??0;p.has(f)||p.set(f,{start:d,end:d+b}),d+=b}let l=c===void 0||[...p.values()].some(f=>f.end<=c.start)&&[...p.values()].some(f=>f.start>=c.end),u=f=>{let{ids:b,complete:y}=ir(f.nodeIds,p,c,l),h=[],x=0,w=0;for(let R of b){let L=s.get(R)??0,A=a.has(R),g=h.at(-1);g?.onReference===A?g.bp+=L:h.push({start:x,bp:L,onReference:A}),x+=L,A||(w+=L)}return{name:f.name,label:ar(f),sample:un(f),bp:x,offReferenceBp:w,complete:y,runs:h}};return{origin:c?c.start:i,unit:n,reference:u(r),rows:o.filter(f=>f!==r).map(u).sort((f,b)=>Number(b.complete)-Number(f.complete)||b.bp-f.bp||f.label.localeCompare(b.label))}}var cr=1.3;function lr(e){let t=e.reference.bp;for(let n of e.rows)t=Math.max(t,n.bp);return{maxX:e.origin+t*cr,maxY:e.rows.length*20}}function pn(e,t){let n=q(e),o=dn(e,t);if(n.length===0||!o)return;let r=J(n),s=[{label:o.reference.label,y:0},...o.rows.map((a,i)=>({label:a.label,y:(i+1)*20}))];return{nodePositions:r,rowLabels:s,referenceAxis:!0,pixelRows:!0,extent:lr(o)}}var ur="Force-directed layout",ee=e=>e.nodes.some(B),fn=e=>ee(e)&&(e.paths?.length??0)>1,mn=e=>ee(e)&&e.nodes.some(Se),nt=[{value:"auto",label:"Anchored",description:"x is reference bp, one row per stable rank. Needs rGFA tags or a reference path.",run:nn,cutMargins:!0,available:ee,drawsLocally:ee},{value:"samplerows",label:"Sample rows",description:"x is reference bp, one row per contributing assembly. Needs rGFA tags or a reference path.",run:cn,cutMargins:!0,available:mn,drawsLocally:mn},{value:"walkrows",label:"Walk rows",description:"x is each walk's own bp: one bar per haplotype, sequence the reference also carries in blue and sequence it does not in purple, so a repeat expansion reads as bar length. Needs W or P lines.",run:pn,cutMargins:!1,available:fn,drawsLocally:fn},{value:"ordered",label:"Ordered",description:"x is reference order, not bp: every node gets room, bubbles read as lenses. Needs rGFA tags or a reference path.",run:an,cutMargins:!1,available:ee,drawsLocally:ee},{value:"variants",label:"Variant map",description:"The reference as a line with one typed glyph per bubble, from the bubble index or from the graph itself: SNP, indel, deletion, inversion, repeat array. Click a glyph to open the graph inside it.",run:ln,cutMargins:!0,available:ee,drawsLocally:ee},{value:"force",label:ur,description:"OGDF FMMM, via the external Bandage engine.",run:()=>{},cutMargins:!1,available:()=>!0,drawsLocally:()=>!1}],la=nt.map(e=>e.value);function ua(e,t){return!dr(e).drawsLocally(t)}function dr(e){return nt.find(t=>t.value===e)??nt[0]}function pr(e,t){return Math.abs(t-e)<=.1*Math.max(e,t)}function fr(e,t){let n=e.length,o=t.length,r=Array.from({length:n+1},()=>new Array(o+1).fill(0)),s=Array.from({length:n+1},()=>new Array(o+1).fill(!1));for(let i=n-1;i>=0;i--)for(let c=o-1;c>=0;c--){let p=Math.abs(e[i]-t[c])+r[i+1][c+1],d=n-i>o-c?r[i+1][c]:1/0,l=o-c>n-i?r[i][c+1]:1/0;r[i][c]=Math.min(p,d,l),s[i][c]=r[i][c]===p}let a=new Array(n).fill(void 0);for(let i=0,c=0;i<n&&c<o;)s[i][c]?a[i++]=c++:n-i>o-c?i++:c++;return a}function bn(e,t){return e.map((n,o)=>({item:n,i:o})).sort((n,o)=>t(n.item)-t(o.item))}var hn=e=>e.spanningReads!==0;function mr(e,t){let n=new Map,o=new Set,r=bn(e,a=>a.bp),s=[[r.filter(a=>a.item.complete),t.filter(hn)],[r,t]];for(let[a,i]of s){let c=a.filter(d=>!n.has(d.i)),p=bn(i.filter(d=>!o.has(d)),d=>d.bp);fr(c.map(d=>d.item.bp),p.map(d=>d.item.bp)).forEach((d,l)=>{if(d!==void 0){let u=c[l],m=p[d].item;o.add(m),n.set(u.i,{...m,agrees:u.item.complete&&hn(m)?pr(u.item.bp,m.bp):void 0})}})}return n}function pa(e,t){if(!t)return e;let n=new Map,o=new Map;for(let r of e)o.set(r.sample,[...o.get(r.sample)??[],r]);for(let[r,s]of o){let a=t[r];if(a)for(let[i,c]of mr(s,a))n.set(s[i],c)}return e.map(r=>({...r,call:n.get(r)}))}var gn=ne(we(),1),ba=(0,W.createSvgIcon)((0,gn.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");export{W as a,Je as b,br as c,oe as d,Ss as e,Ns as f,Es as g,Bs as h,Mr as i,Mt as j,Rt as k,Ee as l,wt as m,er as n,Ar as o,Er as p,Br as q,Cr as r,kt as s,Zn as t,Tt as u,Hr as v,dn as w,lr as x,he as y,so as z,nt as A,la as B,ua as C,dr as D,$r as E,$t as F,wo as G,ts as H,ns as I,pa as J,as as K,is as L,Po as M,cs as N,ls as O,Qe as P,Ls as Q,Rs as R,ba as S};
|
|
2
|
+
//# sourceMappingURL=chunk-J2UKZSOC.js.map
|