jbrowse-plugin-graphgenomeviewer 4.0.13 → 4.0.15

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.
Files changed (53) hide show
  1. package/README.md +5 -1
  2. package/dist/chunks/{GbzBaseSyntenyAdapter-Y5NBXK7P.js → GbzBaseSyntenyAdapter-3ZTHTTHA.js} +2 -2
  3. package/dist/chunks/{GraphGenomeView-TTQEJJQD.js → GraphGenomeView-5SMMNFD4.js} +2 -2
  4. package/dist/chunks/{GraphTrackSettingsDialog-3A2PKZRI.js → GraphTrackSettingsDialog-2QV6TPX7.js} +2 -2
  5. package/dist/chunks/{LinearGraphDisplay-MJ5XZFE5.js → LinearGraphDisplay-BEOEIUGA.js} +2 -2
  6. package/dist/chunks/{MinigraphBubbleAdapter-APC7JYOM.js → MinigraphBubbleAdapter-NRDD66AK.js} +2 -2
  7. package/dist/chunks/{RgfaTabixAdapter-4E365PXO.js → RgfaTabixAdapter-NQEERXXI.js} +2 -2
  8. package/dist/chunks/{chunk-5DP7IXD3.js → chunk-33VHHB43.js} +2 -2
  9. package/dist/chunks/{chunk-LA7MQS33.js → chunk-5E7TVPCI.js} +2 -2
  10. package/dist/chunks/chunk-IUIIYSGF.js +2 -0
  11. package/dist/chunks/{chunk-M4YEAXSR.js.map → chunk-IUIIYSGF.js.map} +3 -3
  12. package/dist/chunks/chunk-JXAJ7YLT.js +2 -0
  13. package/dist/chunks/chunk-JXAJ7YLT.js.map +7 -0
  14. package/dist/chunks/chunk-KULNKXPT.js +2 -0
  15. package/dist/chunks/chunk-KULNKXPT.js.map +7 -0
  16. package/dist/chunks/chunk-QSH263Y6.js +2 -0
  17. package/dist/chunks/chunk-QSH263Y6.js.map +7 -0
  18. package/dist/chunks/chunk-UQEPPJEO.js +2 -0
  19. package/dist/chunks/{chunk-VAGPKHHS.js.map → chunk-UQEPPJEO.js.map} +3 -3
  20. package/dist/chunks/chunk-UQN2NWT5.js +4 -0
  21. package/dist/chunks/chunk-UQN2NWT5.js.map +7 -0
  22. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
  23. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +3 -3
  24. package/package.json +2 -2
  25. package/src/GraphGenomeView/components/BubbleHalos.tsx +67 -3
  26. package/src/GraphGenomeView/components/BubbleOverlay.tsx +10 -0
  27. package/src/GraphGenomeView/components/GraphCanvas.tsx +46 -9
  28. package/src/GraphGenomeView/components/LabelChip.tsx +9 -1
  29. package/src/GraphGenomeView/components/LabelLayer.tsx +7 -0
  30. package/src/GraphGenomeView/components/ReferenceStripOverlay.tsx +116 -0
  31. package/src/GraphGenomeView/components/TubeMapOverlay.tsx +109 -41
  32. package/src/GraphGenomeView/model.test.ts +3 -0
  33. package/src/GraphGenomeView/model.ts +204 -43
  34. package/src/LinearGraphDisplay/model.ts +2 -0
  35. package/src/version.ts +1 -1
  36. package/dist/chunks/chunk-CJ56O2VG.js +0 -2
  37. package/dist/chunks/chunk-CJ56O2VG.js.map +0 -7
  38. package/dist/chunks/chunk-IFRDWMQ2.js +0 -2
  39. package/dist/chunks/chunk-IFRDWMQ2.js.map +0 -7
  40. package/dist/chunks/chunk-M4YEAXSR.js +0 -2
  41. package/dist/chunks/chunk-MUK3KYB4.js +0 -2
  42. package/dist/chunks/chunk-MUK3KYB4.js.map +0 -7
  43. package/dist/chunks/chunk-VAGPKHHS.js +0 -2
  44. package/dist/chunks/chunk-XDOIZTY6.js +0 -4
  45. package/dist/chunks/chunk-XDOIZTY6.js.map +0 -7
  46. /package/dist/chunks/{GbzBaseSyntenyAdapter-Y5NBXK7P.js.map → GbzBaseSyntenyAdapter-3ZTHTTHA.js.map} +0 -0
  47. /package/dist/chunks/{GraphGenomeView-TTQEJJQD.js.map → GraphGenomeView-5SMMNFD4.js.map} +0 -0
  48. /package/dist/chunks/{GraphTrackSettingsDialog-3A2PKZRI.js.map → GraphTrackSettingsDialog-2QV6TPX7.js.map} +0 -0
  49. /package/dist/chunks/{LinearGraphDisplay-MJ5XZFE5.js.map → LinearGraphDisplay-BEOEIUGA.js.map} +0 -0
  50. /package/dist/chunks/{MinigraphBubbleAdapter-APC7JYOM.js.map → MinigraphBubbleAdapter-NRDD66AK.js.map} +0 -0
  51. /package/dist/chunks/{RgfaTabixAdapter-4E365PXO.js.map → RgfaTabixAdapter-NQEERXXI.js.map} +0 -0
  52. /package/dist/chunks/{chunk-5DP7IXD3.js.map → chunk-33VHHB43.js.map} +0 -0
  53. /package/dist/chunks/{chunk-LA7MQS33.js.map → chunk-5E7TVPCI.js.map} +0 -0
@@ -1,2 +0,0 @@
1
- import{b as m}from"./chunk-EFVAQ2KM.js";import{a as p,b as d,c}from"./chunk-MUK3KYB4.js";var b=new Map([["hg38","GRCh38"],["hg19","GRCh37"],["hs1","CHM13"],["t2t-chm13","CHM13"],["chm13v2","CHM13"]]);function N(n){return b.get(n.toLowerCase())}var x=new Set(["_gbwt_ref"]);function u(n){let t=n.includes("#")?p(n):void 0;return t===void 0||x.has(t)?void 0:t}function g(n){return d(n)??p(n)}function l(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=u(e);o!==void 0&&(s.get(o)??s.set(o,new Set).get(o)).add(g(e))}return s}function h(n,t){let s=new Set(n.map(f=>u(f.refName))),[e]=s;if(s.size!==1||e===void 0)return{contigs:n,prefixes:[],named:!1};let o=new Set(n.map(f=>g(f.refName))),i=[...t.get(e)??[]].every(f=>o.has(f)),r=new Set(n.map(f=>d(f.refName))),[a]=r;return{contigs:n,prefixes:[...i?[e]:[],...r.size===1&&a?[a]:[]],named:!0}}function M(n){let t=new Map;for(let e of n.nodes)if(m(e)){let{refName:o,start:i}=e.stable,r=i+e.length,a=t.get(o);a?(a.start=Math.min(a.start,i),a.end=Math.max(a.end,r)):t.set(o,{refName:o,contig:c(o),start:i,end:r})}let s=[...t.values()];return s.length?h(s,l(n)):void 0}function y(n,t){let s=r=>[r.name,...r.aliases??[]],e=r=>a=>s(a).some(f=>f.toLowerCase()===r.toLowerCase()),o=[...n?.prefixes??[]].reverse(),i=n?.prefixes.find(r=>!r.includes("#"))?.toLowerCase();for(let r of o){let a=t.find(e(r));if(a)return a}return i===void 0?void 0:t.find(r=>s(r).some(a=>N(a)?.toLowerCase()===i))}function B(n,t){let s=l(n);return n.anchorPaths?.find(e=>y(h([{refName:e.name,contig:c(e.name),start:e.start,end:e.start+e.length}],s),[t]))}function S(n){let t=new Set(n),s=new Map;for(let e of t){let o=c(e);s.set(o,s.has(o)?void 0:e)}return e=>t.has(e)?e:s.get(e)}function k(n,t){let s=S(t.contigs.map(e=>e.refName));return n.flatMap(e=>{let o=s(e.refName);return o===void 0?[]:[o===e.refName?e:{...e,refName:o}]})}export{N as a,M as b,y as c,B as d,k as e};
2
- //# sourceMappingURL=chunk-IFRDWMQ2.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/core/src/reference.ts"],
4
- "sourcesContent": ["import { isBackbone } from './anchoredNodes'\nimport { panSNContig, panSNHaplotype, panSNSample } from './pansn'\n\nimport type { Graph, PathOrigin } from './types'\n\n// A graph's backbone names the sample it lies on (`GRCh38#0#chr6`), not an\n// assembly, and a bare contig (`chr6`) is in every human assembly at once. A\n// backbone binds to an assembly where its PanSN prefix is that assembly's name,\n// one of its aliases, or its well-known sample. One that names no sample binds\n// only where the host knows the assembly otherwise, as a track's config does.\n\nexport interface BackboneContig {\n // as the graph names it, `GRCh38#0#chr6`\n refName: string\n // as an assembly names it, `chr6`\n contig: string\n start: number\n end: number\n}\n\nexport interface Backbone {\n contigs: BackboneContig[]\n // The PanSN prefixes that name the backbone, sample then haplotype:\n // `GRCh38`, `GRCh38#0`. The sample drops out where the graph walks another\n // haplotype of it, as a diploid's `HG002` names `HG002#1` and `HG002#2`.\n prefixes: string[]\n // Whether the contigs name one real sample: false where every contig is bare\n // (`chr6`) or generic (`_gbwt_ref#0#chr6`), or where the samples differ\n named: boolean\n}\n\nexport interface AssemblyNames {\n name: string\n aliases?: string[]\n}\n\n// The sample a reference assembly's graphs name it by, keyed by the assembly's\n// name in lower case: HPRC writes `CHM13` where UCSC's assembly is `hs1`.\nexport const WELL_KNOWN_SAMPLES: ReadonlyMap<string, string> = new Map([\n ['hg38', 'GRCh38'],\n ['hg19', 'GRCh37'],\n ['hs1', 'CHM13'],\n ['t2t-chm13', 'CHM13'],\n ['chm13v2', 'CHM13'],\n])\n\nexport function wellKnownSample(assemblyName: string) {\n return WELL_KNOWN_SAMPLES.get(assemblyName.toLowerCase())\n}\n\n// vg names a reference path that states no sample `_gbwt_ref`, and gbz-base\n// writes its walk as `W _gbwt_ref 0 chr6`\nconst GENERIC_SAMPLES = new Set(['_gbwt_ref'])\n\nfunction sampleOf(refName: string) {\n const sample = refName.includes('#') ? panSNSample(refName) : undefined\n return sample === undefined || GENERIC_SAMPLES.has(sample)\n ? undefined\n : sample\n}\n\n// `HG002#1`, or the sample of a two-part name, which states no haplotype\nfunction haplotypeOf(refName: string) {\n return panSNHaplotype(refName) ?? panSNSample(refName)\n}\n\n// Each sample's haplotypes among the graph's walks and node refNames\nfunction graphHaplotypes(graph: 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 = new Map<string, Set<string>>()\n for (const refName of refNames) {\n const sample = sampleOf(refName)\n if (sample !== undefined) {\n const haplotypes =\n bySample.get(sample) ?? bySample.set(sample, new Set()).get(sample)!\n haplotypes.add(haplotypeOf(refName))\n }\n }\n return bySample\n}\n\nfunction backboneFrom(\n contigs: BackboneContig[],\n haplotypes: Map<string, Set<string>>,\n): Backbone {\n const samples = new Set(contigs.map(c => sampleOf(c.refName)))\n const [sample] = samples\n if (samples.size !== 1 || sample === undefined) {\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}\n\n// The rank-0 nodes' refNames and the span each covers\nexport function graphBackbone(graph: Graph): Backbone | undefined {\n const spans = new Map<string, BackboneContig>()\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\n ? backboneFrom(contigs, graphHaplotypes(graph))\n : undefined\n}\n\n// The assembly the backbone's haplotype names by its name or an alias, else\n// the one its sample names, else the one whose well-known sample it is. A\n// backbone with no prefix binds to none.\nexport function backboneAssembly<T extends AssemblyNames>(\n backbone: Backbone | undefined,\n assemblies: T[],\n): T | undefined {\n const names = (a: T) => [a.name, ...(a.aliases ?? [])]\n const naming = (prefix: string) => (a: T) =>\n 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 === undefined\n ? undefined\n : assemblies.find(a =>\n names(a).some(n => wellKnownSample(n)?.toLowerCase() === sample),\n )\n}\n\n// The first of the graph's walks that a backbone along it would bind to\n// `assembly`, for putting x on the assembly a cut was made for\nexport function assemblyWalk(\n graph: Graph,\n assembly: AssemblyNames,\n): PathOrigin | undefined {\n const haplotypes = graphHaplotypes(graph)\n return graph.anchorPaths?.find(walk =>\n 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}\n\n// Which of `refNames` a feature's refName names: the one it equals, else the\n// only one whose contig it is. A contig two refNames share names neither.\nexport function refNameBinding(refNames: Iterable<string>) {\n const exact = new Set(refNames)\n const byContig = new Map<string, string | undefined>()\n for (const refName of exact) {\n const contig = panSNContig(refName)\n byContig.set(contig, byContig.has(contig) ? undefined : refName)\n }\n return (name: string) => (exact.has(name) ? name : byContig.get(name))\n}\n\n// An assembly's features on a backbone that binds to it, each renamed to the\n// backbone's refName for it, so the assembly's `chr6` becomes the graph's\n// `GRCh38#0#chr6`. genePins and tubeMapGenes take only the renamed.\nexport function featuresOnBackbone<T extends { refName: string }>(\n features: readonly T[],\n backbone: Backbone,\n): T[] {\n const bind = refNameBinding(backbone.contigs.map(c => c.refName))\n return features.flatMap(f => {\n const refName = bind(f.refName)\n return refName === undefined\n ? []\n : [refName === f.refName ? f : { ...f, refName }]\n })\n}\n"],
5
- "mappings": "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",
6
- "names": ["WELL_KNOWN_SAMPLES", "wellKnownSample", "assemblyName", "GENERIC_SAMPLES", "sampleOf", "refName", "sample", "panSNSample", "haplotypeOf", "panSNHaplotype", "graphHaplotypes", "graph", "refNames", "p", "node", "bySample", "backboneFrom", "contigs", "haplotypes", "samples", "c", "own", "unique", "h", "shared", "haplotype", "graphBackbone", "spans", "isBackbone", "start", "end", "span", "panSNContig", "backboneAssembly", "backbone", "assemblies", "names", "a", "naming", "prefix", "n", "prefixes", "assembly", "assemblyWalk", "walk", "refNameBinding", "exact", "byContig", "contig", "name", "featuresOnBackbone", "features", "bind", "f"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as c}from"./chunk-MUK3KYB4.js";import{a as N}from"./chunk-FY3BTKY4.js";var $=N((me,g)=>{g.exports=JBrowseExports["tss-react/mui"]});function X(e,t){return Math.max(e.nodeLengthPerMegabase*t/1e6,e.minimumNodeLength)}function L(e,t=5){let r=e.nodes.reduce((a,s)=>a+s.length,0)/1e6,o=Math.max(e.nodes.length*40,500);return{nodeLengthPerMegabase:r>0?o/r:1e4,minimumNodeLength:Math.max(5,t),edgeLength:5,nodeSegmentLength:20}}var p={power:1,effect:1};function b(e){return e.power===1&&e.effect===1}function E(e,t){let n=e.nodes.length,r=e.nodes.reduce((s,i)=>s+i.length,0),o=n>0?r/n:0,a=n>0?Math.max(n*40,500)/n:40;return s=>{if(o<=0)return a;let i=(s/o)**t.power;return Math.max(a*((i-1)*t.effect+1),5)}}var u=1e3,_={law:p,minNodeLength:0};function j(e,t=_){let{law:n,minNodeLength:r}=t,o=L(e,r);if(b(n))return{nodes:e.nodes,opts:o};let a=E(e,n);return{nodes:e.nodes.map(s=>({...s,length:Math.round(a(s.length)*u)})),opts:{...o,nodeLengthPerMegabase:1e6/u,minimumNodeLength:5}}}var m=[{value:"auto",label:"Proportional",description:"Bandage's own scale: a node draws proportional to its length, so a 1 bp allele is a speck.",law:p,minNodeFactor:0},{value:"open",label:"Open bubbles",description:"Give every allele a drawn length, so a bubble reads as two arms rather than a knot.",law:p,minNodeFactor:2.5},{value:"wide",label:"Wide bubbles",description:"As open, spread further. Best on a window of a dozen bubbles.",law:p,minNodeFactor:10},{value:"compress",label:"Compress lengths",description:"Pull the longest and shortest nodes towards the graph\u2019s mean, so a cut spanning kb and bp fits one pane.",law:{power:.5,effect:.5},minNodeFactor:0}],K=m.map(e=>e.value);function J(e){let t=m.find(n=>n.value===e);return{law:t?.law??p,minNodeLength:(t?.minNodeFactor??0)*40}}var G=[{value:"auto",label:"Auto"},{value:"uniform",label:"Uniform"},{value:"random",label:"Random"},{value:"rainbow",label:"Rainbow"},{value:"depth",label:"Depth"},{value:"node-length",label:"Node Length"},{value:"stable-rank",label:"Stable rank"},{value:"reference-position",label:"Reference position"},{value:"grey",label:"Grey"}],Q=G.map(e=>e.value);function Z(e,t){return e!=="auto"?e:t?.anchoredBy?"reference-position":"uniform"}var A=/:(\d+)-\d+$/;function d(e){let t=A.exec(e);return t?{name:e.slice(0,t.index),start:+t[1]}:{name:e,start:0}}function re(e,t){let n=[],r=new Map;for(let o of e){let a=c(o.name),s=o.start;for(let i of o.steps){let h={path:o.name,sample:a,start:s,strand:i.strand},l=r.get(i.id);l?l.push(h):r.set(i.id,[h]),s+=t(i.id)}n.push({name:o.name,sample:a,start:o.start,length:s-o.start})}return{anchorPaths:n,pathVisits:r}}function O(e,t){return e.find(r=>r.sample===t||r.name===t)??e[0]}var M=1;function w(e,t,n){let r=e;if(t&&t.length>0){let o=t.find(a=>a.path===n)??t[0];r={...e,stable:{refName:o.path,start:o.start,rank:o.path===n?0:M,strand:o.strand},samples:[...new Set(t.map(a=>a.sample))].sort()}}return r}function P(e,t){let{anchorPaths:n,pathVisits:r}=e,o=n&&r?O(n,t):void 0;return o&&r?{...e,nodes:e.nodes.map(a=>w(a,r.get(a.name),o.name)),anchoredBy:"paths",referencePath:o.name}:e}function oe(e,t){return e.anchoredBy==="tags"?e:P(e,t)}function ie(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Math.abs(t%360)}function y(e,t){return e*360/t}var T=.7,D=.5,R=16;function pe(e){return e>0&&e<=R}function H(e,t){return`hsl(${y(e,t)}, ${T*100}%, ${D*100}%)`}function I(e){let t=d(e).name.split("#");return[t[0],t.slice(0,2).join("#"),t.join("#")]}function v(e){return String(e).replace(/\B(?=(\d{3})+$)/g,",")}function B(e,t){let{start:n}=d(e);return t.map(r=>`${r} @${v(n)}`)}function de(e){let t=e.map(a=>I(a.name)),n=[0,1,2].flatMap(a=>[e.map((s,i)=>t[i][a]),e.map((s,i)=>B(s.name,t[i])[a])]),o=n.find(a=>new Set(a).size===e.length)??n.at(-1);return e.map((a,s)=>({name:a.name,label:o[s],color:H(s,e.length)}))}var C=[{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."}],le=C.map(e=>e.value),F=.3,f=3;function U(e){let t=0,n=0;for(let r of e.nodes)t+=r.depth*r.length,n+=r.length;return n>0?t/n:0}function W(e,t){return!(t>0)||!(e.depth>0)?1:Math.min(f,Math.max(F,Math.sqrt(e.depth/t)))}function k(e,t,n,r){return t*(n==="depth"?W(e,r):1)}function V(e,t){return e*(t==="depth"?f:1)}function ce(e,t,n,r){let o=e?U(e):0;return{maxHalfWidthPx:V(n,r)/2,halfWidthPx:a=>{let s=t?.get(a);return s?k(s,n,r,o)/2:n/2}}}export{X as a,j as b,m as c,K as d,J as e,G as f,Q as g,Z as h,d as i,re as j,O as k,P as l,oe as m,ie as n,y as o,T as p,D as q,R as r,pe as s,H as t,de as u,C as v,le as w,U as x,k as y,ce as z,$ as A};
2
- //# sourceMappingURL=chunk-M4YEAXSR.js.map
@@ -1,2 +0,0 @@
1
- function i(t){return t.split("#")[0]}function o(t){let e=t.split("#");return e.length>=3?`${e[0]}#${e[1]}`:void 0}function u(t){let e=t.split("#");return e.length>=3?e.slice(2).join("#"):e.length===2?e[1]:t}function p(t,e){return e!==void 0&&(t===e||t.startsWith(e+"#"))}function s(t){return t.getConf("assemblyNameToPanSN")??{}}function d(t,e){return e===void 0?void 0:s(t)[e]??e}var r=new WeakMap;function f(t){let e=r.get(t);if(e===void 0){let a=s(t);e={};for(let n of new Set([...Object.keys(a),...t.getConf("assemblyNames")]))e[a[n]??n]=n;r.set(t,e)}return e}export{i as a,o as b,u as c,p as d,d as e,f};
2
- //# sourceMappingURL=chunk-MUK3KYB4.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/core/src/pansn.ts"],
4
- "sourcesContent": ["import type { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\n\n// PanSN naming convention: `sample#haplotype#contig`. Shared by the all-vs-all\n// PAF adapters (in-memory and tabix-indexed), which anchor on the sample prefix\n// and strip it to recover each assembly's own refName.\nconst SEP = '#'\n\n// The PanSN sample name is the token before the first separator, e.g.\n// `grape#1#chr1` -> `grape`.\nexport function panSNSample(refName: string) {\n return refName.split(SEP)[0]!\n}\n\n// The haplotype a three-part PanSN name belongs to, `sample#hap`, which is the\n// assembly that contributed it where one sample is two haplotypes (HPRC release\n// 2.1 names every node `NA20809#2#CM094351.1`); undefined for a name that\n// states no haplotype.\nexport function panSNHaplotype(refName: string) {\n const parts = refName.split(SEP)\n return parts.length >= 3 ? `${parts[0]}${SEP}${parts[1]}` : undefined\n}\n\n// Strip the PanSN prefix to recover the assembly's own refName: `sample#hap#chr1`\n// -> `chr1`, `sample#chr1` -> `chr1`. A contig that itself contains the\n// separator is assumed not to occur (PanSN uses `#` only as the delimiter).\nexport function panSNContig(refName: string) {\n const parts = refName.split(SEP)\n return parts.length >= 3\n ? parts.slice(2).join(SEP)\n : parts.length === 2\n ? parts[1]!\n : refName\n}\n\n// Whether a PanSN name belongs to a prefix at either depth: `grape#1#chr1`\n// matches `grape` and `grape#1`, not `grape#2` or `grapefruit`. An undefined\n// prefix is \"no assembly supplied\", which nothing belongs to.\nexport function panSNMatchesPrefix(\n refName: string,\n prefix: string | undefined,\n) {\n return (\n prefix !== undefined &&\n (refName === prefix || refName.startsWith(prefix + SEP))\n )\n}\n\n// How a config maps the session's assembly names onto the PanSN spelling a\n// graph uses, and back. Every adapter here declares an `assemblyNameToPanSN`\n// slot for it \u2014 the graph says `GRCh38#0` where the assembly is `hg38` \u2014 so\n// resolving a name is the same question in all of them, and it used to be\n// answered by two copies of these functions in two directories.\n//\n// `?? {}` so an adapter whose schema lacks the slot identity-maps rather than\n// throwing a TypeError deep inside a query.\nfunction assemblyNameToPanSN(adapter: BaseFeatureDataAdapter) {\n return (adapter.getConf('assemblyNameToPanSN') ?? {}) as Record<\n string,\n string\n >\n}\n\n// One assembly name as its PanSN sample prefix, identity when the config maps\n// it to nothing. Overloaded rather than widened: undefined passes through, so a\n// caller can express \"no anchor/target supplied\", and a caller that has a name\n// gets a `string` back instead of having to re-assert one.\nexport function resolvePanSNPrefix(\n adapter: BaseFeatureDataAdapter,\n name: string,\n): string\nexport function resolvePanSNPrefix(\n adapter: BaseFeatureDataAdapter,\n name: string | undefined,\n): string | undefined\nexport function resolvePanSNPrefix(\n adapter: BaseFeatureDataAdapter,\n name: string | undefined,\n) {\n return name === undefined\n ? undefined\n : (assemblyNameToPanSN(adapter)[name] ?? name)\n}\n\nconst asmByPrefixCache = new WeakMap<\n BaseFeatureDataAdapter,\n Record<string, string>\n>()\n\n// The inverse: PanSN prefix -> the assembly name this session loads it as, for\n// naming the lane a haplotype draws on. A mapped assembly counts whether or not\n// `assemblyNames` also lists it.\nexport function assemblyByPanSNPrefix(adapter: BaseFeatureDataAdapter) {\n let out = asmByPrefixCache.get(adapter)\n if (out === undefined) {\n const map = assemblyNameToPanSN(adapter)\n out = {}\n for (const asm of new Set([\n ...Object.keys(map),\n ...(adapter.getConf('assemblyNames') as string[]),\n ])) {\n out[map[asm] ?? asm] = asm\n }\n asmByPrefixCache.set(adapter, out)\n }\n return out\n}\n"],
5
- "mappings": "AASO,SAASA,EAAYC,EAAiB,CAC3C,OAAOA,EAAQ,MAAM,GAAG,EAAE,CAAC,CAC7B,CAMO,SAASC,EAAeD,EAAiB,CAC9C,IAAME,EAAQF,EAAQ,MAAM,GAAG,EAC/B,OAAOE,EAAM,QAAU,EAAI,GAAGA,EAAM,CAAC,CAAC,IAASA,EAAM,CAAC,CAAC,GAAK,MAC9D,CAKO,SAASC,EAAYH,EAAiB,CAC3C,IAAME,EAAQF,EAAQ,MAAM,GAAG,EAC/B,OAAOE,EAAM,QAAU,EACnBA,EAAM,MAAM,CAAC,EAAE,KAAK,GAAG,EACvBA,EAAM,SAAW,EACfA,EAAM,CAAC,EACPF,CACR,CAKO,SAASI,EACdJ,EACAK,EACA,CACA,OACEA,IAAW,SACVL,IAAYK,GAAUL,EAAQ,WAAWK,EAAS,GAAG,EAE1D,CAUA,SAASC,EAAoBC,EAAiC,CAC5D,OAAQA,EAAQ,QAAQ,qBAAqB,GAAK,CAAC,CAIrD,CAcO,SAASC,EACdD,EACAE,EACA,CACA,OAAOA,IAAS,OACZ,OACCH,EAAoBC,CAAO,EAAEE,CAAI,GAAKA,CAC7C,CAEA,IAAMC,EAAmB,IAAI,QAQtB,SAASC,EAAsBJ,EAAiC,CACrE,IAAIK,EAAMF,EAAiB,IAAIH,CAAO,EACtC,GAAIK,IAAQ,OAAW,CACrB,IAAMC,EAAMP,EAAoBC,CAAO,EACvCK,EAAM,CAAC,EACP,QAAWE,KAAO,IAAI,IAAI,CACxB,GAAG,OAAO,KAAKD,CAAG,EAClB,GAAIN,EAAQ,QAAQ,eAAe,CACrC,CAAC,EACCK,EAAIC,EAAIC,CAAG,GAAKA,CAAG,EAAIA,EAEzBJ,EAAiB,IAAIH,EAASK,CAAG,CACnC,CACA,OAAOA,CACT",
6
- "names": ["panSNSample", "refName", "panSNHaplotype", "parts", "panSNContig", "panSNMatchesPrefix", "prefix", "assemblyNameToPanSN", "adapter", "resolvePanSNPrefix", "name", "asmByPrefixCache", "assemblyByPanSNPrefix", "out", "map", "asm"]
7
- }
@@ -1,2 +0,0 @@
1
- function o(n){return n===void 0||n==="*"?void 0:n}function l(n){let e=n.split(" ");return{refName:e[0],start:+e[1],end:+e[2],segmentCount:+e[3],pathCount:+e[4],inversion:e[5]==="1",shortestAlleleLength:+e[6],longestAlleleLength:+e[7],segments:e[11],shortestAllele:o(e[12]),longestAllele:o(e[13])}}function i(n){let{shortestAlleleLength:e,longestAlleleLength:t}=n;return e===t?`${t.toLocaleString()} bp`:`${e.toLocaleString()}-${t.toLocaleString()} bp`}var s=2147483647;function u(n){let{pathCount:e,segmentCount:t,inversion:r}=n;return[`${t} segments`,e===s?"more paths than gfatools counts":`up to ${e.toLocaleString()} paths`,...r?["inversion"]:[]].join(", ")}export{l as a,i as b,s as c,u as d};
2
- //# sourceMappingURL=chunk-VAGPKHHS.js.map
@@ -1,4 +0,0 @@
1
- import{D as Ve,H as he,I as Ke,J as Ie,K as Pe,P as je,Q as Te,R as Je,T as Qe,X as et,Z as tt,_ as nt,a as X,aa as ot,b as Wn,c as Dn,ea as rt,f as Z,fa as st,ha as at,j as Fe,k as Ze,l as Le,m as pe,ma as it,oa as lt,pa as ct,t as me,u as qe,v as Ee}from"./chunk-CJ56O2VG.js";import{a as On}from"./chunk-FCWXYIFC.js";import{a as ut}from"./chunk-LA7MQS33.js";import{A as ne,f as Ue}from"./chunk-M4YEAXSR.js";import{a as C,b as B,c as Q,d as De,e as de}from"./chunk-XEJ47DLD.js";import{a as We,b as m}from"./chunk-FY3BTKY4.js";var kt=We((Mr,St)=>{St.exports=JBrowseExports["@jbrowse/render-core/useRenderingBackend"]});var Nn=We((Ts,Gn)=>{Gn.exports=JBrowseExports["@jbrowse/render-core/renderingBackendBase"]});var Y=m(de(),1);var Fn=50;function dt(r,e){return e>0?Math.max(1,r/e):Fn}function Zn(r){let e=new Set,t=1/0,n=-1/0;for(let o of r)e.add(o.minY),t=Math.min(t,o.minY),n=Math.max(n,o.minY);return e.size>1?(n-t)/(e.size-1):void 0}function Un(r,e,t){let n=dt(e,r.length);return{x:n,y:t>0?dt(t,r.length):Zn(r)??n}}function pt(r,e,t,n){return r===void 0?Un(e,t,n):typeof r=="number"?{x:r,y:r}:r}function qn(r,e,t){let n=r.get(e);n||(n=new Map,r.set(e,n));let o=n.get(t);return o||(o=[],n.set(t,o)),o}function mt(r,e,t,n,o,s,a){let i=Math.floor(t/e.x),l=Math.floor(o/e.x),c=Math.floor(n/e.y),u=Math.floor(s/e.y);for(let d=i;d<=l;d++)for(let h=c;h<=u;h++)qn(r,d,h).push(a)}function ht(r,e,t,n,o,s){let a=Math.floor((t-o)/e.x),i=Math.floor((t+o)/e.x),l=Math.floor((n-s)/e.y),c=Math.floor((n+s)/e.y),u=[],d=new Set;for(let h=a;h<=i;h++){let b=r.get(h);if(b)for(let M=l;M<=c;M++){let y=b.get(M);if(y)for(let g of y)d.has(g)||(d.add(g),u.push(g))}}return u}var fe=class{constructor(e,t){this.cells=new Map;let n=[],o=0,s=0;for(let[a,i]of Object.entries(e))for(let l=0;l<i.length-1;l++){let c=i[l],u=i[l+1],d=Math.min(c.x,u.x),h=Math.min(c.y,u.y),b=Math.max(c.x,u.x),M=Math.max(c.y,u.y);o+=b-d,s+=M-h,n.push({entry:{nodeId:a,segmentIdx:l},minX:d,minY:h,maxX:b,maxY:M})}this.cellSize=pt(t,n,o,s);for(let a of n)mt(this.cells,this.cellSize,a.minX,a.minY,a.maxX,a.maxY,a.entry)}query(e,t,n,o=n){return ht(this.cells,this.cellSize,e,t,n,o)}},ge=class{constructor(e,t,n,o,s,a,i=0){this.cells=new Map;this.edgeCurves=Ke(e,t,o,a,i);let l=[],c=0,u=0;for(let d=0;d<t.edges.length;d++){let h=t.edges[d],b=e[h.from],M=e[h.to],y=this.edgeCurves.get(d);if(b?.length&&M?.length&&y){let{minX:g,minY:w,maxX:P,maxY:G}=Fe(y),T=h.pathIds?.length??0;if(n&&T>0){let R=0,L=0;for(let N of pe(b,M,T,o))R=Math.max(R,Math.abs(N.x)),L=Math.max(L,Math.abs(N.y));g-=R,w-=L,P+=R,G+=L}c+=P-g,u+=G-w,l.push({ei:d,minX:g,minY:w,maxX:P,maxY:G})}}this.cellSize=pt(s,l,c,u);for(let d of l)mt(this.cells,this.cellSize,d.minX,d.minY,d.maxX,d.maxY,d.ei)}getCurves(e){return this.edgeCurves.get(e)}query(e,t,n,o=n){return ht(this.cells,this.cellSize,e,t,n,o)}};function yt(r,e,t,n,o,s){let a=o-t,i=s-n,l=a*a+i*i;if(l===0)return Math.hypot(r-t,e-n);let c=Math.max(0,Math.min(1,((r-t)*a+(e-n)*i)/l));return Math.hypot(r-(t+c*a),e-(n+c*i))}function Vn(r,e,t,n,o,s,a,i,l,c){let u=1/0,d=20,h=t,b=n;for(let M=1;M<=d;M++){let y=M/d,g=1-y,w=g*g*g*t+3*g*g*y*o+3*g*y*y*a+y*y*y*l,P=g*g*g*n+3*g*g*y*s+3*g*y*y*i+y*y*y*c;u=Math.min(u,yt(r,e,h,b,w,P)),h=w,b=P}return u}function Kn(r,e,t){return Vn(r,e,t.x0,t.y0,t.cx0,t.cy0,t.cx1,t.cy1,t.x1,t.y1)}function ft(r,e,t,n=1){let o=1/0;for(let s of t){let a=Kn(r,e,n===1?s:{x0:s.x0,y0:s.y0*n,cx0:s.cx0,cy0:s.cy0*n,cx1:s.cx1,cy1:s.cy1*n,x1:s.x1,y1:s.y1*n});a<o&&(o=a)}return o}var gt=new WeakMap;function jn(r,e){let t=gt.get(r);if(t?.version===e)return t.index;let n=new fe(r);return gt.set(r,{version:e,index:n}),n}var bt=new WeakMap;function Jn(r,e,t,n,o,s){let a=bt.get(r);if(a?.graph===e&&a.drawPaths===t&&a.scaleX===n.scaleX&&a.scaleY===n.scaleY&&a.version===o&&a.deletions===s)return a.index;let i=new ge(r,e,t,n,void 0,s,o);return bt.set(r,{graph:e,drawPaths:t,scaleX:n.scaleX,scaleY:n.scaleY,version:o,index:i,deletions:s}),i}var Qn=5;function vt(r,e,t,n,o=0,s){let a=Le(n),i=jn(r,o),l=b=>Math.max(Qn,b)/n.scaleX,c=l(s?.maxHalfWidthPx??0),u=i.query(e,t,c,c/a),d=null,h=1/0;for(let{nodeId:b,segmentIdx:M}of u){let y=r[b],g=yt(e,t*a,y[M].x,y[M].y*a,y[M+1].x,y[M+1].y*a);g<h&&g<l(s?.halfWidthPx(b)??0)&&(h=g,d=b)}return d}function xt(r,e,t,n,o,s,a=0,i,l){let c=Le(o),u=10/o.scaleX,d=Jn(r,e,s,o,a,i),h=d.query(t,n,u,u/c),b=null,M=u;for(let y of h){let g=e.edges[y],w=r[g.from],P=r[g.to];if(!w?.length||!P?.length||l?.has(y))continue;let G=g.pathIds?.length??0,T=d.getCurves(y);if(!T)continue;let R;if(!s||G===0)R=ft(t,n*c,T,c);else{let L=1/0;for(let N of pe(w,P,G,o)){let p=N.x===0&&N.y===0?T:Ze(T,N.x,N.y),S=ft(t,n*c,p,c);S<L&&(L=S)}R=L}R<M&&(M=R,b=y)}return b}function Mt(r){let e=r.deltaY*(r.deltaMode===1?40:r.deltaMode===2?800:1),t=(r.ctrlKey?10:1)*e/100;return 1.1**-Math.max(-2,Math.min(2,t))}var te=m(De(),1),zn=m(On(),1),Xn=m(kt(),1);var Ct=m(C(),1),wt=(0,X.createSvgIcon)((0,Ct.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var W=m(B(),1);var Rt=m(B(),1),be=m(C(),1),eo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},to=(0,Rt.observer)(function({model:e}){let{bubbleHalos:t,walkHighlight:n}=e;if(t.length===0)return null;let{scaleX:o,scaleY:s,translateX:a,translateY:i,paneWidth:l,canvasHeight:c}=e,u=e.contigThickness*qe,d=h=>n!==void 0&&!h.nodeIds.some(b=>n.nodeIds.has(b));return(0,be.jsx)("svg",{style:eo,width:l,height:c,"data-testid":"graph-bubble-halos",children:(0,be.jsx)("g",{transform:`translate(${a} ${i}) scale(${o} ${s})`,children:t.filter(h=>!h.whole).map(h=>(0,be.jsx)("path",{d:h.path,fill:"none",stroke:Z[h.kind],strokeOpacity:d(h)?.06:.22,strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},`${h.bubble.start}-${h.bubble.end}`))})})}),Lt=to;var It=m(Q(),1),Pt=m(B(),1),_=m(C(),1),no={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},oo={position:"absolute",left:8,top:8,zIndex:5,background:"rgba(255,255,255,0.9)",textTransform:"none"},ro=10;function Et(r,e){let t=12+26*Math.log10(1+r);return Math.min(t,e)}var so=(0,Pt.observer)(function({model:e}){let{bubbleGlyphs:t,poppedFrom:n}=e,o=n?(0,_.jsxs)(It.Button,{size:"small",variant:"outlined",style:oo,"data-testid":"graph-unpop-bubble",onClick:()=>{e.unpopBubble()},children:["\u25C0 Back to ",n.label]}):null;if(t.length===0)return o;let{scaleX:s,translateX:a,translateY:i,paneWidth:l,canvasHeight:c}=e,u=i,d=g=>g*s+a,h=e.overlayLabels.glyphs,b=Math.max(0,...h.map(g=>g.y+4)),M=Math.max(24,u-b-14),y=[...t].sort((g,w)=>w.bubble.end-w.bubble.start-(g.bubble.end-g.bubble.start));return(0,_.jsxs)(_.Fragment,{children:[o,(0,_.jsxs)("svg",{style:no,width:l,height:c,"data-testid":"graph-bubble-overlay",children:[y.map(({bubble:g,kind:w,label:P})=>{let G=d(g.start),T=d(g.end),R=Math.max(T-G,ro),L=(G+T)/2,N=Et(g.longestAlleleLength,M),p=Z[w],k=g.end-g.start-g.shortestAlleleLength,v=k>0?6+10*Math.log10(1+k):0,E=`${g.start}-${g.end}`;return(0,_.jsxs)("g",{children:[(0,_.jsx)("path",{d:`M${L-R/2},${u} C${L-R/2},${u-N} ${L+R/2},${u-N} ${L+R/2},${u} Z`,fill:p,fillOpacity:.18,stroke:p,strokeWidth:2,style:{pointerEvents:"auto",cursor:"pointer"},onClick:()=>{e.popBubble(g)},children:(0,_.jsx)("title",{children:`${P}
2
- ${g.segmentCount} segments \xB7 click to open`})}),v>0?(0,_.jsx)("path",{d:`M${L-R/2},${u} C${L-R/2},${u+v} ${L+R/2},${u+v} ${L+R/2},${u}`,fill:"none",stroke:p,strokeWidth:2,strokeDasharray:"4 3"}):null]},E)}),h.map(({item:{glyph:g,glyphX:w},x:P,y:G})=>{let T=Z[g.kind],R=u-Et(g.bubble.longestAlleleLength,M);return(0,_.jsxs)("g",{children:[(0,_.jsx)("line",{x1:w,x2:w,y1:G+4,y2:R-2,stroke:T,strokeWidth:.7,strokeOpacity:.5}),(0,_.jsx)("text",{x:P,y:G,fontSize:11,fontFamily:"sans-serif",fill:T,textAnchor:"middle",children:g.label})]},`${g.bubble.start}-${g.bubble.end}-label`)})]})]})}),Tt=so;var Gt=m(B(),1),ve=m(C(),1),ao={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},xe="#1c1c22",io=(0,Gt.observer)(function({model:e}){let{genePins:t}=e;if(t.length===0)return null;let{scaleX:n,scaleY:o,translateX:s,translateY:a,paneWidth:i,canvasHeight:l,contigThickness:c}=e;return(0,ve.jsx)("svg",{style:ao,width:i,height:l,"data-testid":"graph-gene-pins",children:(0,ve.jsx)("g",{transform:`translate(${s} ${a}) scale(${n} ${o})`,children:t.map(u=>u.exons?(0,ve.jsx)("path",{d:u.exons,fill:"none",stroke:xe,strokeOpacity:.9,strokeWidth:c*.55,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},`${u.gene.name}-${u.gene.start}`):null)})})}),Nt=io;var Ht=m(C(),1),Bt=(0,X.createSvgIcon)((0,Ht.jsx)("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Ge=m(C(),1),_t=(0,X.createSvgIcon)([(0,Ge.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),(0,Ge.jsx)("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var $t=m(C(),1),zt=(0,X.createSvgIcon)((0,$t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var O=m(Q(),1),_e=m(B(),1),cn=m(ne(),1);var U=m(Q(),1),Xt=m(B(),1),Yt=m(ne(),1),oe=m(C(),1),lo=(0,Yt.makeStyles)()({formControl:{minWidth:100}}),co=(0,Xt.observer)(function({model:e}){let{classes:t}=lo();return(0,oe.jsxs)(U.FormControl,{size:"small",className:t.formControl,children:[(0,oe.jsx)(U.InputLabel,{children:"Color"}),(0,oe.jsx)(U.Select,{value:e.chosenColorScheme,label:"Color",onChange:n=>{e.setColorScheme(n.target.value)},children:Ue.map(({value:n,label:o})=>(0,oe.jsx)(U.MenuItem,{value:n,children:o},n))})]})}),At=co;var He=m(Q(),1),Be=m(B(),1),Ot=m(ne(),1),re=m(C(),1),Wt=(0,Ot.makeStyles)()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function Ne(r){return r===void 0?"\u2013":`${Math.round(r)}ms`}var uo=(0,Be.observer)(function({model:e}){let{classes:t}=Wt(),{lastFetchMs:n,lastLayoutMs:o,lastGeometryMs:s}=e,a=n!==void 0||o!==void 0||s!==void 0;return e.showPerf&&a?(0,re.jsxs)(He.Typography,{variant:"caption",className:t.perf,"data-testid":"graph-perf-stats",children:["fetch ",Ne(n)," \xB7 layout ",Ne(o)," \xB7 geom"," ",Ne(s)]}):null}),po=(0,Be.observer)(function({model:e}){let{classes:t}=Wt();return(0,re.jsxs)("div",{className:t.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[(0,re.jsxs)(He.Typography,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",(0,re.jsx)(uo,{model:e})]})}),Dt=po;var A=m(Q(),1),Ft=m(B(),1),Zt=m(ne(),1),q=m(C(),1),mo=(0,Zt.makeStyles)()({formControl:{minWidth:150}}),ho=(0,Ft.observer)(function({model:e}){let{classes:t}=mo(),{graph:n}=e;return(0,q.jsxs)(A.FormControl,{size:"small",className:t.formControl,children:[(0,q.jsx)(A.InputLabel,{children:"Layout"}),(0,q.jsx)(A.Select,{value:e.chosenLayoutMode,label:"Layout","data-testid":"graph-layout-select",onChange:o=>{e.switchLayout(o.target.value)},children:Ve.map(({value:o,label:s,description:a,available:i})=>(0,q.jsx)(A.MenuItem,{value:o,disabled:n?!i(n):!1,children:(0,q.jsx)(A.Tooltip,{title:a,placement:"right",children:(0,q.jsx)("span",{children:s})})},o))})]})}),Ut=ho;var D=m(Q(),1),qt=m(B(),1),Vt=m(ne(),1),V=m(C(),1),fo=(0,Vt.makeStyles)()({formControl:{minWidth:130,maxWidth:240}}),go=(0,qt.observer)(function({model:e}){let{classes:t}=fo(),{repeatChoices:n}=e;if(e.chosenLayoutMode!=="walkrows"||n.length===0)return null;let o=new Set(n.map(s=>s.key));return(0,V.jsxs)(D.FormControl,{size:"small",className:t.formControl,children:[(0,V.jsx)(D.InputLabel,{children:"Repeat"}),(0,V.jsxs)(D.Select,{value:o.has(e.repeatKey)?e.repeatKey:"",label:"Repeat","data-testid":"graph-repeat-select",onChange:s=>{e.setRepeatKey(s.target.value)},children:[(0,V.jsx)(D.MenuItem,{value:"",children:(0,V.jsx)("em",{children:"Whole window"})}),n.map(({key:s,name:a,unit:i})=>(0,V.jsxs)(D.MenuItem,{value:s,children:[a," \xB7 ",i.toLocaleString()," bp unit"]},s))]})]})}),Kt=go;var tn=m(de(),1),nn=m(De(),1);var jt=m(C(),1),Jt=(0,X.createSvgIcon)((0,jt.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete");var Qt=m(C(),1),en=(0,X.createSvgIcon)((0,Qt.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var on=m(B(),1);var K=m(C(),1),bo=(0,on.observer)(function({model:e}){let[t,n]=(0,tn.useState)(!1);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(nn.CascadingMenuButton,{size:"small",menuItems:[{type:"checkbox",label:"Linear layout",checked:e.linearLayout,onClick:()=>{e.setLinearLayout(!e.linearLayout),e.recomputeLayout()}},{type:"checkbox",label:"Show deletion edges",checked:e.showDeletionEdges,onClick:()=>{e.setShowDeletionEdges(!e.showDeletionEdges)}},{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}},{type:"divider"},{label:"Settings",icon:ct,onClick:()=>{n(!0)}},{type:"divider"},{label:"Return to import form",icon:Jt,onClick:()=>{e.clearGraph()}}],children:(0,K.jsx)(en,{})}),(0,K.jsx)(ut,{model:e,open:t,onClose:()=>{n(!1)}})]})}),rn=bo;var F=m(Q(),1),sn=m(B(),1),an=m(ne(),1),j=m(C(),1),yo=(0,an.makeStyles)()({formControl:{minWidth:130,maxWidth:220}}),vo=(0,sn.observer)(function({model:e}){let{classes:t}=yo(),{walkChoices:n}=e;if(n.length===0)return null;let o=new Set(n.map(s=>s.name));return(0,j.jsxs)(F.FormControl,{size:"small",className:t.formControl,children:[(0,j.jsx)(F.InputLabel,{children:"Walk"}),(0,j.jsxs)(F.Select,{value:o.has(e.highlightedPath)?e.highlightedPath:"",label:"Walk","data-testid":"graph-walk-select",onChange:s=>{e.setHighlightedPath(s.target.value)},children:[(0,j.jsx)(F.MenuItem,{value:"",children:(0,j.jsx)("em",{children:"None"})}),n.map(({name:s,label:a})=>(0,j.jsx)(F.MenuItem,{value:s,children:a},s))]})]})}),ln=vo;var I=m(C(),1),xo=(0,cn.makeStyles)()({toolbar:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Mo=(0,_e.observer)(function({model:e}){return(0,I.jsx)(O.Typography,{variant:"body2",children:e.zoomPercent})}),So=(0,_e.observer)(function({model:e}){let{classes:t}=xo();return(0,I.jsxs)("div",{className:t.toolbar,children:[(0,I.jsx)(Ut,{model:e}),(0,I.jsx)(At,{model:e}),(0,I.jsx)(ln,{model:e}),(0,I.jsx)(Kt,{model:e}),(0,I.jsx)(O.Tooltip,{title:"Zoom in",children:(0,I.jsx)(O.IconButton,{size:"small",onClick:()=>{e.zoom(1.5,e.paneWidth/2,e.canvasHeight/2)},children:(0,I.jsx)(_t,{})})}),(0,I.jsx)(O.Tooltip,{title:"Zoom out",children:(0,I.jsx)(O.IconButton,{size:"small",onClick:()=>{e.zoom(1/1.5,e.paneWidth/2,e.canvasHeight/2)},children:(0,I.jsx)(zt,{})})}),(0,I.jsx)(O.Tooltip,{title:"Zoom to fit",children:(0,I.jsx)(O.IconButton,{size:"small",onClick:()=>{e.zoomToFit()},children:(0,I.jsx)(Bt,{})})}),(0,I.jsx)(Mo,{model:e}),(0,I.jsx)(Dt,{model:e}),(0,I.jsx)(rn,{model:e})]})}),un=So;var dn=m(B(),1);var ae=m(C(),1);function ce({x:r,y:e,w:t,text:n,color:o,italic:s,small:a,dimmed:i,title:l,testId:c,onClick:u}){return(0,ae.jsxs)("g",{style:{pointerEvents:u?"auto":"none",cursor:u?"pointer":void 0,opacity:i?.35:1},"data-testid":c,onClick:u,children:[l?(0,ae.jsx)("title",{children:l}):null,(0,ae.jsx)("rect",{x:r-t/2,y:e-11-4+2,width:t,height:17,rx:3,fill:"rgba(255,255,255,0.85)",stroke:o,strokeWidth:a?.6:1}),(0,ae.jsx)("text",{x:r,y:e,fontSize:a?10:11,fontFamily:"sans-serif",fontStyle:s?"italic":void 0,fontWeight:s?600:void 0,fill:o,textAnchor:"middle",children:n})]})}var J=m(C(),1),ko={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:3},Co=(0,dn.observer)(function({model:e}){let{bubbles:t,genes:n,routes:o}=e.overlayLabels;if(t.length+n.length+o.length===0)return null;let{walkHighlight:s,scaleY:a,translateY:i,contigThickness:l}=e,c=d=>s!==void 0&&!d.nodeIds.some(h=>s.nodeIds.has(h)),u=d=>s!==void 0&&!d.route.walks.includes(s.name);return(0,J.jsxs)("svg",{style:ko,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-label-layer",children:[n.map(({item:d,x:h,y:b,w:M,text:y})=>(0,J.jsxs)("g",{children:[(0,J.jsx)("line",{x1:h,x2:h,y1:b-11-2,y2:d.at.y*a+i+l/2,stroke:xe,strokeWidth:.8,strokeOpacity:.6}),(0,J.jsx)(ce,{x:h,y:b,w:M,text:y,color:xe,italic:!0,title:`${d.gene.name} ${d.gene.refName}:${d.gene.start.toLocaleString()}-${d.gene.end.toLocaleString()}${d.covered<.98?", runs past the cut":""}`,testId:"graph-gene-pin-label"})]},`${d.gene.name}-${d.gene.start}`)),o.map(({item:{halo:d,route:h},x:b,y:M,w:y,text:g})=>(0,J.jsx)(ce,{x:b,y:M,w:y,text:g,color:Z[d.kind],small:!0,dimmed:u(h),title:`${h.route.walks.length} walk(s): ${h.route.walks.join(", ")}`,testId:"graph-route-label"},`${d.bubble.start}-${d.bubble.end}-${h.route.steps.join(",")}`)),t.map(({item:d,x:h,y:b,w:M,text:y})=>(0,J.jsx)(ce,{x:h,y:b,w:M,text:y,color:Z[d.kind],dimmed:c(d),title:`${d.label}
3
- ${d.bubble.segmentCount} segments \xB7 click to open`,testId:"graph-bubble-halo-label",onClick:()=>{e.popBubble(d.bubble)}},`${d.bubble.start}-${d.bubble.end}`))]})}),pn=Co;var Me=m(de(),1);var hn=m(st(),1),fn=m(Wn(),1),$e=m(B(),1),$=m(C(),1),wo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1},Ro=(0,$e.observer)(function({model:e}){let t=(0,Me.useRef)(null),{tubeMapPicture:n,paneWidth:o,canvasHeight:s}=e;return(0,Me.useEffect)(()=>(0,fn.autorun)(()=>{let a=t.current,i=e.tubeMapPicture,l=e.tubeMapFrame,c=a?.getContext("2d");if(a&&c&&i&&l){let u=(0,hn.getDpr)(),d=e.paneWidth,h=e.canvasHeight;a.width=Math.round(d*u),a.height=Math.round(h*u),c.setTransform(u,0,0,u,0,0),c.clearRect(0,0,d,h);let b={...l,width:d,highlightNode:e.hoveredNode??e.selectedNode,darkMode:e.darkMode};ot(c,i,b),nt(c,e.tubeMapDeviations,b),et(c,e.tubeMapConnectors,e.connectorZoneBottom,b);let{bounds:M}=i;rt(c,e.tubeMapGenes,b,l.y(M.minY)-2);let y=e.tubeMapRulerBoxes;y&&Qe(c,y,b,l.y(M.maxY)+4)}}),[e]),(0,$.jsx)("canvas",{ref:t,"data-testid":n?"graph-tube-map":void 0,style:{...wo,width:o,height:s,display:n?"block":"none"}})}),gn=Ro,Lo={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},mn={display:"flex",alignItems:"center",gap:5},ue=18;function Eo(){let r=Math.round(ue/je),e=ue/r,t=Te+1,n=[`0,${t}`];for(let o=0;o<r;o++)n.push(`${(o+.5)*e},${t+(o%2?1:-1)*Te}`);return n.push(`${ue},${t}`),(0,$.jsx)("svg",{width:ue,height:t*2,style:{flex:"none"},children:(0,$.jsx)("polyline",{points:n.join(" "),fill:"none",stroke:Je(),strokeWidth:1})})}var Io={width:ue,height:7,flex:"none",display:"flex",justifyContent:"center",backgroundColor:"#b8b8c0"};function Po(){return(0,$.jsx)("div",{style:Io,children:(0,$.jsx)("div",{style:{width:2,backgroundColor:tt()}})})}var bn=(0,$e.observer)(function({model:e}){let{squeezed:t,foldBp:n}=e.tubeMapKeys;return t||n!==void 0?(0,$.jsxs)("div",{style:Lo,"data-testid":"graph-tube-map-legend",children:[n!==void 0?(0,$.jsxs)("div",{style:mn,children:[(0,$.jsx)(Po,{}),(0,$.jsxs)("span",{children:["a haplotype's variant under ",me(n)]})]}):null,t?(0,$.jsxs)("div",{style:mn,children:[(0,$.jsx)(Eo,{}),(0,$.jsx)("span",{children:"ruler not to scale, box length below"})]}):null]}):null});var Mn=m(de(),1);var Xe=m(B(),1);function Se(r){return`hsl(${r}, 70%, 50%)`}function ze(r,e){let t=(r-e.start)/(e.end-e.start);return Math.max(0,Math.min(1,t))*Ie}var To=30;function yn({start:r,bp:e,reversed:t},n){let o=ze(r,n),s=ze(r+e,n);if(s-o<1)return[(o+s)/2];let a=Math.ceil((s-o)/To);return Array.from({length:a+1},(i,l)=>ze(r+e*(t?a-l:l)/a,n))}var ke=`linear-gradient(to right, ${Array.from({length:7},(r,e)=>`${Se(e/6*Ie)} ${e/6*100}%`).join(", ")})`;var x=m(C(),1),Bo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},Sn="#2f8fd6",kn="#111",Cn="#9e9e9e",wn="#c62828",Rn="#8e3fbf",z=12,vn=["#4e79a7","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ye="#d0d0d0",_o="rgb(160, 160, 160)";function Ln(r,e){let t=r.findIndex(n=>n.unit===e);return t<0?Ye:vn[t%vn.length]}var $o={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},ee={display:"flex",alignItems:"center",gap:5},ie={width:18,height:z-4,borderRadius:2},zo={...ie,display:"flex",justifyContent:"center"};function xn({color:r}){return(0,x.jsx)("div",{style:zo,children:(0,x.jsx)("div",{style:{width:2,backgroundColor:r}})})}var En=(0,Xe.observer)(function({model:e}){let t=e.walkRowBars;if(!t)return null;let n=e.referenceRampDomain,o=e.walkRowUnits,s=[t.reference,...t.rows],a=s.flatMap(i=>i.call&&!i.call.sequences?i.call:[]);return(0,x.jsxs)("div",{style:$o,"data-testid":"graph-walk-rows-legend",children:[o?(0,x.jsxs)(x.Fragment,{children:[o.map((i,l)=>(0,x.jsxs)("div",{style:ee,children:[(0,x.jsx)("div",{style:{...ie,backgroundColor:Ln(o,i.unit)}}),(0,x.jsxs)("span",{children:["unit ",l+1," \xB7 ",i.unitLength.toLocaleString()," bp"]})]},i.unit)),s.some(i=>!i.call?.sequences)?(0,x.jsxs)("div",{style:ee,children:[(0,x.jsx)("div",{style:{...ie,backgroundColor:Ye}}),(0,x.jsx)("span",{children:"no allele in the repeat track"})]}):null]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{style:ee,children:[(0,x.jsx)("div",{style:{...ie,background:n?ke:Sn}}),(0,x.jsxs)("span",{children:["shared with ",t.reference.label]})]}),(0,x.jsxs)("div",{style:ee,children:[(0,x.jsx)("div",{style:{...ie,backgroundColor:n?Pe:Rn}}),(0,x.jsx)("span",{children:"carried by haplotypes only"})]})]}),a.some(i=>i.spanningReads!==0)?(0,x.jsxs)("div",{style:ee,children:[(0,x.jsx)(xn,{color:kn}),(0,x.jsx)("span",{children:"allele length called for this walk"})]}):null,a.some(i=>i.spanningReads===0)?(0,x.jsxs)("div",{style:ee,children:[(0,x.jsx)(xn,{color:Cn}),(0,x.jsx)("span",{children:"called with no read spanning it"})]}):null,a.some(i=>i.agrees===!1)?(0,x.jsxs)("div",{style:ee,children:[(0,x.jsx)("div",{style:ie}),(0,x.jsxs)("span",{style:{color:wn},children:["walk and call over ",Math.round(.1*100),"% apart"]})]}):null]})});function Ce(r){return`${(r/1e3).toFixed(r<1e4?1:0)} kb`}function Xo(r,e){return e?` \u2248 ${Math.round(r/e)} units`:""}function In(r,e,t){if(!t?.sequences)return Xo(r,e);let n=t.sequences.reduce((o,s)=>o+s.count,0);return` \xB7 ${Number.isInteger(n)?n:n.toFixed(1)} copies`}function Yo(r,e,t){let{bp:n,complete:o,call:s}=r,a=n-e,i=a===0?"":` (${a>0?"+":"\u2212"}${Ce(Math.abs(a))})`,l=s&&!s.sequences?Ao(s):"";return`${Ce(n)}${In(n,t,s)}${i}${o?"":" \xB7 partial walk"}${l}`}function Ao(r){let e=r.spanningReads===0?" \xB7 no spanning read":"";return` \xB7 called ${Ce(r.bp)}${e}`}function Oo(r){let e=0;return r.map(t=>{let n=e,o=t.copyBp??Array.from({length:Math.ceil(t.count)},()=>t.unitLength),s=[],a=n;for(let i of o)s.push(a),a+=i;return e+=t.bp,{start:n,bp:t.bp,unit:t.unit,copyStarts:s}})}var Pn=3;function Wo(r,e,t){if(t(e)-t(0)<Pn)return[];let n=[];for(let o=e;o<r;o+=e)n.push(o);return n}function Do(r,e,t){if(!e)return{fill:r.onReference?Sn:Rn};if(r.referenceStart===void 0)return{fill:Pe};let n=yn({...r,start:r.referenceStart},e);return n.length===1?{fill:Se(n[0])}:{fill:`url(#${t})`,gradient:(0,x.jsx)("linearGradient",{id:t,children:n.map((o,s)=>(0,x.jsx)("stop",{offset:s/(n.length-1),stopColor:Se(o)},s))})}}var Fo=(0,Xe.observer)(function({model:e}){let t=(0,Mn.useId)().replace(/[^\w-]/g,""),{walkRowBars:n,referenceRampDomain:o}=e;if(!n)return null;let{scaleX:s,scaleY:a,translateX:i,translateY:l,paneWidth:c,canvasHeight:u}=e,d=p=>p*s+i,h=p=>p*20*a+l,{origin:b,unit:M,reference:y,rows:g}=n,w=e.walkRowUnits,P=Math.min(b,e.graphRegion?.start??b),G=Math.max(b+y.bp,e.graphRegion?.end??0),T=(p,S,k,v="#333")=>{let E=d(S)+6,H=E+p.length*6.2<c;return(0,x.jsx)("text",{x:H?E:d(S)-6,y:k+4,fontSize:11,fontFamily:"sans-serif",fill:v,stroke:H?void 0:"white",strokeWidth:H?void 0:3,paintOrder:"stroke",textAnchor:H?"start":"end",children:p})},R=(p,S,k)=>p.filter(v=>v>0&&v<S).map(v=>(0,x.jsx)("line",{x1:d(b+v),x2:d(b+v),y1:k-z/2,y2:k+z/2,stroke:"white",strokeWidth:1},v)),L=(p,S,k,v)=>(0,x.jsx)("rect",{x:d(b+p),y:k-z/2,width:Math.max(1,S*s),height:z,fill:v},p),N=(p,S,k)=>{let v=p.call?.sequences?Oo(p.call.sequences):[],E=M!==void 0&&M*s>=Pn;return(0,x.jsxs)(x.Fragment,{children:[L(0,p.bp,S,Ye),v.filter(H=>H.start<p.bp).map(H=>L(H.start,Math.min(H.bp,p.bp-H.start),S,Ln(k,H.unit))),E?R(v.flatMap(H=>H.copyStarts),p.bp,S):null]})};return(0,x.jsxs)("svg",{style:Bo,width:c,height:u,"data-testid":"graph-walk-rows",children:[w?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("rect",{x:d(P)-z/2,y:h(0)-z/2,width:(G-P)*s+z,height:z,rx:z/2,fill:_o}),N(y,h(0),w)]}):null,T(`${Ce(y.bp)}${In(y.bp,M,y.call)}`,G,h(0)),g.map((p,S)=>{let k=h(S+1);if(k<-z||k>u+z)return null;let{call:v}=p;return(0,x.jsxs)("g",{"data-testid":"graph-walk-row",children:[w?N(p,k,w):(0,x.jsxs)(x.Fragment,{children:[p.runs.map(E=>{let{fill:H,gradient:An}=Do(E,o,`${t}-${S}-${E.start}`);return(0,x.jsxs)("g",{children:[An,L(E.start,E.bp,k,H)]},E.start)}),M?R(Wo(p.bp,M,E=>E*s),p.bp,k):null]}),v&&!v.sequences?(0,x.jsx)("rect",{"data-testid":"graph-walk-call",x:d(b+v.bp)-1,y:k-z/2-3,width:2,height:z+6,fill:v.spanningReads===0?Cn:kn}):null,T(Yo(p,y.bp,M),b+p.bp,k,v?.agrees===!1?wn:void 0)]},p.name)})]})}),Tn=Fo;var le=m(Dn(),1),Hn=m(st(),1),Bn=m(Nn(),1);var Re=class extends Bn.Canvas2DRenderingBackendBase{constructor(){super(...arguments);this.transform=null;this.batch=null;this.nodeHighlights=new Map;this.highlightedEdge=null;this.highlightFactor=1}resize(t,n){(0,Hn.syncCanvasSize)(this.ctx.canvas,t,n)}uploadGeometry(t){this.batch=t,this.highlightedEdge=null}setNodeHighlights(t){this.nodeHighlights=t}setEdgeHighlight(t,n){this.highlightedEdge=t,this.highlightFactor=n}updateTransform(t){this.transform=t}render(t){if(!this.transform)return;let o=this.ctx,{width:s,height:a}=o.canvas;o.fillStyle=(0,le.normalizedRgbToCssRgba)([t[0],t[1],t[2]],t[3]),o.fillRect(0,0,s,a);let i=this.batch;i&&(o.lineCap="round",o.lineJoin="round",this.renderEdges(i),this.renderNodes(i),this.renderArrows(i))}renderEdges(t){let n=this.transform,o=this.ctx,s=this.highlightedEdge===null?void 0:t.edgeCurveRuns.get(this.highlightedEdge);for(let{color:a,items:i}of Ae(t.edgeCurves,(l,c)=>({color:we(s,c)?he(l.color,this.highlightFactor):l.color,weight:l.thickness,last:we(s,c)}))){o.strokeStyle=(0,le.abgrToCssRgba)(a),o.lineWidth=i[0].thickness*2*n.dpr,o.beginPath();for(let l of i){let c=l.curves[0];o.moveTo(c.x0*n.scaleX+n.translateX,c.y0*n.scaleY+n.translateY);for(let u of l.curves)o.bezierCurveTo(u.cx0*n.scaleX+n.translateX,u.cy0*n.scaleY+n.translateY,u.cx1*n.scaleX+n.translateX,u.cy1*n.scaleY+n.translateY,u.x1*n.scaleX+n.translateX,u.y1*n.scaleY+n.translateY)}o.stroke()}}renderNodes(t){let n=this.transform,o=this.ctx,s=new Map;for(let[a,i]of this.nodeHighlights){let l=t.nodeStrokeRuns.get(a);if(l)for(let c=l.start;c<l.start+l.count;c++)s.set(c,i)}for(let{color:a,items:i}of Ae(t.nodeStrokes,(l,c)=>{let u=s.get(c);return{color:u===void 0?l.color:he(l.color,u),weight:l.thickness,last:u!==void 0}})){o.strokeStyle=(0,le.abgrToCssRgba)(a),o.lineWidth=i[0].thickness*2*n.dpr,o.beginPath();for(let l of i){let c=l.points[0];o.moveTo(c.x*n.scaleX+n.translateX,c.y*n.scaleY+n.translateY);for(let u=1,d=l.points.length;u<d;u++){let h=l.points[u];o.lineTo(h.x*n.scaleX+n.translateX,h.y*n.scaleY+n.translateY)}}o.stroke()}}renderArrows(t){let n=this.transform,o=this.ctx,s=this.highlightedEdge===null?void 0:t.arrowRuns.get(this.highlightedEdge);for(let{color:a,items:i}of Ae(t.arrows,(l,c)=>({color:we(s,c)?he(l.color,this.highlightFactor):l.color,weight:0,last:we(s,c)}))){o.fillStyle=(0,le.abgrToCssRgba)(a),o.beginPath();for(let l of i){let[c,u,d,h]=Uo(l,n);o.moveTo(c.x,c.y),o.lineTo(u.x,u.y),o.lineTo(d.x,d.y),o.lineTo(h.x,h.y),o.closePath()}o.fill()}}dispose(){super.dispose(),this.batch=null,this.nodeHighlights=new Map,this.highlightedEdge=null}},Zo=.25;function Uo(r,e){let t=Math.cos(r.angle),n=Math.sin(r.angle),o=r.x*e.scaleX+e.translateX,s=r.y*e.scaleY+e.translateY,a=r.length*e.dpr,i=r.halfWidth*e.dpr,l=o-t*a,c=s-n*a,u=a*(1-Zo);return[{x:o,y:s},{x:l-n*i,y:c+t*i},{x:o-t*u,y:s-n*u},{x:l+n*i,y:c-t*i}]}function we(r,e){return r!==void 0&&e>=r.start&&e<r.start+r.count}function Ae(r,e){let t=new Map,n=new Map;for(let o=0,s=r.length;o<s;o++){let a=r[o],{color:i,weight:l,last:c}=e(a,o),u=c?n:t,d=`${i}:${l}`,h=u.get(d);h?h.items.push(a):u.set(d,{color:i,items:[a]})}return[...t.values(),...n.values()]}function _n(r){return Promise.resolve(new Re(r))}var f=m(C(),1),$n={position:"absolute",bottom:8,right:8,background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none"},qo={position:"relative"},Vo={position:"relative",lineHeight:0},Ko={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},jo={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},Jo=(0,W.observer)(function({model:e}){let t=e.drawnRowLabels;return(0,f.jsx)(f.Fragment,{children:t.map(({label:n,y:o})=>{let s=o*e.scaleY+e.translateY;return s>=0&&s<=e.canvasHeight?(0,f.jsx)("div",{"data-testid":"graph-row-label",style:{...jo,top:s},children:n},o):null})})}),Qo={position:"absolute",top:Ee,right:Ee,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none",zIndex:4},Oe={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},er={display:"flex",alignItems:"center",gap:5},tr={width:18,height:3,borderRadius:2},nr=(0,W.observer)(function({model:e}){let{pathLegend:t}=e;return t.length>0?(0,f.jsx)("div",{style:Oe,"data-testid":"graph-path-legend",children:t.map(({name:n,label:o,color:s})=>(0,f.jsxs)("div",{style:er,children:[(0,f.jsx)("div",{style:{...tr,backgroundColor:s}}),(0,f.jsx)("span",{children:o})]},n))}):null}),or=(0,W.observer)(function({model:e}){let t=e.walkHighlight;if(!t)return null;let n=e.walkChoices.find(s=>s.name===t.name)?.label??t.name,o=t.referenceBp===void 0?"":t.bp===t.referenceBp?", the reference length":`, ${t.bp>t.referenceBp?"+":"\u2212"}${Math.abs(t.bp-t.referenceBp).toLocaleString()} bp against the reference`;return(0,f.jsxs)("div",{style:Oe,"data-testid":"graph-walk-readout",children:[(0,f.jsx)("strong",{children:n}),": ",t.steps.toLocaleString()," steps,"," ",t.bp.toLocaleString()," bp",o]})}),rr={minWidth:90,height:8,borderRadius:2,background:ke},sr={display:"flex",justifyContent:"space-between",gap:8},ar=(0,W.observer)(function({model:e}){let t=e.referenceRampDomain;return t?(0,f.jsxs)("div",{style:Oe,"data-testid":"graph-ramp-legend",children:[(0,f.jsx)("div",{style:rr}),(0,f.jsxs)("div",{style:sr,children:[(0,f.jsx)("span",{children:t.start.toLocaleString()}),(0,f.jsxs)("span",{children:["(",me(t.end-t.start),")"]}),(0,f.jsx)("span",{children:t.end.toLocaleString()})]})]}):null}),Yn={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},ir={...Yn,color:"#18181c",fontWeight:600},lr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:2},cr=(0,W.observer)(function({model:e}){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let n=t.current;if(!n)return;let o=new ResizeObserver(()=>{(0,zn.isAlive)(e)&&e.setLegendSize({width:n.offsetWidth,height:n.offsetHeight})});return o.observe(n),()=>{o.disconnect()}},[e]),(0,f.jsxs)("div",{ref:t,style:Qo,children:[(0,f.jsx)(ar,{model:e}),(0,f.jsx)(nr,{model:e}),(0,f.jsx)(bn,{model:e}),(0,f.jsx)(En,{model:e}),(0,f.jsx)(or,{model:e})]})}),ur=(0,W.observer)(function({model:e}){let t=e.overlayLabels.sizes,n=t.flatMap(({key:o,leader:s})=>s?[{key:o,...s}]:[]);return(0,f.jsxs)(f.Fragment,{children:[n.length>0?(0,f.jsx)("svg",{style:lr,width:e.paneWidth,height:e.canvasHeight,children:n.map(({key:o,arcX:s,arcY:a,labelX:i,labelY:l})=>(0,f.jsx)("line",{"data-testid":"graph-label-leader",x1:s,y1:a,x2:i,y2:l,stroke:"#18181c",strokeWidth:1},o))}):null,t.map(({key:o,text:s,x:a,y:i,kind:l})=>(0,f.jsx)("div",{"data-testid":"graph-size-label",style:{...l==="deletion"?ir:Yn,left:a,top:i},children:s},o))]})}),dr=(0,W.observer)(function({model:e}){let t=e.hoveredNode?e.nodeById?.get(e.hoveredNode):null,n=e.hoveredEdge!==null&&e.graph?e.graph.edges[e.hoveredEdge]:null,o=t?at(t):void 0,s=e.hoveredEdge===null?void 0:e.deletions.find(a=>a.edgeIndex===e.hoveredEdge);return(0,f.jsxs)(f.Fragment,{children:[t?(0,f.jsxs)("div",{style:$n,children:[(0,f.jsx)("strong",{children:t.name})," \u2014 length:"," ",t.length.toLocaleString(),", depth:"," ",t.depth.toFixed(1),o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("br",{}),o.sample," ",it(o)," (rank"," ",t.stable?.rank,")"]}):null]}):null,n?(0,f.jsx)("div",{style:$n,children:s?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("strong",{children:"Deletion"})," ",s.bp.toLocaleString()," bp",(0,f.jsx)("br",{}),s.refName,":",s.start.toLocaleString(),"-",s.end.toLocaleString()]}):(0,f.jsxs)(f.Fragment,{children:["Edge: ",n.from," \u2192 ",n.to]})}):null]})}),pr=(0,W.observer)(function({model:e,nodeId:t,top:n,left:o,onClose:s}){let{own:a,reference:i,highlight:l}=e.nodeLaunchTargets(t);return(0,f.jsx)(te.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:n,left:o},onClose:()=>{s()},onMenuItemClick:c=>{c()},menuItems:[{label:"Node details",icon:wt,onClick:()=>{e.showNodeDetails(t)}},...lt({own:a,reference:i,highlight:l,onShowLinear:c=>{e.showInLinearView(c)},onHighlight:e.canHighlightInLinearView?c=>{e.highlightInLinearView(c)}:void 0})]})}),mr=(0,W.observer)(function({model:e,ownChrome:t=!0}){let{canvasRef:n,canvas:o,error:s,retry:a}=(0,Xn.useRenderingBackend)(_n,e),i=(0,Y.useRef)({x:0,y:0}),l=(0,Y.useRef)(!1),c=(0,Y.useRef)({frame:0,pan:null,hover:null});(0,Y.useEffect)(()=>()=>{cancelAnimationFrame(c.current.frame)},[]);let[u,d]=(0,Y.useState)(void 0);(0,Y.useEffect)(()=>{if(o){let k=function(v){if(e.hostPlacesX)return;e.host&&v.stopPropagation(),v.preventDefault();let E=S.getBoundingClientRect();e.zoom(Mt(v),v.clientX-E.left,v.clientY-E.top)};var p=k;let S=o;return S.addEventListener("wheel",k,{passive:!1}),()=>{S.removeEventListener("wheel",k)}}},[o,e]);function h(p,S){return{x:(p-e.translateX)/e.scaleX,y:(S-e.translateY)/e.scaleY}}function b(p){let S=p.currentTarget.getBoundingClientRect();return h(p.clientX-S.left,p.clientY-S.top)}function M(p,S){let{nodePositions:k}=e;return e.layoutResult?.tubeMap?e.tubeMapNodeAt(p*e.scaleX+e.translateX,S*e.scaleY+e.translateY):k?vt(k,p,S,e.axisScale,e.positionsVersion,e.nodeInk):null}function y(p){if(p.button===0){if(l.current=!1,e.hostPlacesX)return;e.host&&p.stopPropagation();let{x:S,y:k}=b(p),v=e.layoutResult?.tubeMap?null:M(S,k);v?e.setDraggingNode(v):e.setPanning(!0),i.current={x:p.clientX,y:p.clientY}}}function g(){let p=c.current;if(p.frame=0,p.pan&&(e.setTransform(e.scale,e.translateX+p.pan.dx,e.translateY+p.pan.dy),p.pan=null),p.hover&&e.nodePositions&&e.graph){let{x:S,y:k}=h(p.hover.x,p.hover.y);p.hover=null;let v=M(S,k);e.setHoveredNode(v),e.setHoveredEdge(v||e.layoutResult?.tubeMap?null:xt(e.nodePositions,e.graph,S,k,e.axisScale,e.effectiveDrawPaths,e.positionsVersion,e.deletionEdgeIndexes,e.hiddenEdgeIndexes))}}function w(){c.current.frame||(c.current.frame=requestAnimationFrame(g))}function P(){let p=c.current;cancelAnimationFrame(p.frame),p.frame=0,p.pan=null,p.hover=null}function G(p){let S=p.clientX-i.current.x,k=p.clientY-i.current.y;i.current={x:p.clientX,y:p.clientY},(Math.abs(S)>1||Math.abs(k)>1)&&(l.current=!0);let v=c.current;if(e.draggingNode)e.moveNode(e.draggingNode,S/e.scaleX,k/e.scaleY);else if(e.isPanning)v.pan={dx:(v.pan?.dx??0)+S,dy:(v.pan?.dy??0)+k},w();else{let E=p.currentTarget.getBoundingClientRect();v.hover={x:p.clientX-E.left,y:p.clientY-E.top},w()}}function T(){e.stopDragging()}function R(){P(),e.stopDragging(),e.setHoveredNode(null),e.setHoveredEdge(null)}function L(p){let{x:S,y:k}=b(p),v=M(S,k);v&&(p.preventDefault(),d({nodeId:v,top:p.clientY,left:p.clientX}))}function N(p){if(!l.current){let{x:S,y:k}=b(p),v=M(S,k);e.setSelectedNode(v),v&&e.showNodeDetails(v)}}return(0,f.jsxs)("div",{style:qo,children:[t?(0,f.jsx)(un,{model:e}):null,(0,f.jsxs)("div",{style:Vo,children:[(0,f.jsx)("canvas",{ref:n,"data-testid":"graph-genome-canvas",style:{width:e.paneWidth,height:e.canvasHeight,cursor:e.isPanning||e.draggingNode?"grabbing":"grab",display:"block"},onMouseDown:y,onMouseMove:G,onMouseUp:T,onMouseLeave:R,onClick:N,onContextMenu:L}),(0,f.jsx)(gn,{model:e}),(0,f.jsx)(Jo,{model:e}),(0,f.jsx)(ur,{model:e}),(0,f.jsx)(Lt,{model:e}),(0,f.jsx)(Nt,{model:e}),(0,f.jsx)(pn,{model:e}),(0,f.jsx)(Tt,{model:e}),(0,f.jsx)(Tn,{model:e}),(0,f.jsx)(cr,{model:e}),t?(0,f.jsx)("div",{style:Ko,children:(0,f.jsx)(te.LoadingOverlay,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null]}),(0,f.jsx)(dr,{model:e}),u?(0,f.jsx)(pr,{model:e,nodeId:u.nodeId,top:u.top,left:u.left,onClose:()=>{d(void 0)}}):null,s?(0,f.jsx)(te.ErrorBanner,{error:s,onReset:a}):null,t&&e.error?(0,f.jsx)(te.ErrorBanner,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Js=mr;export{Js as a};
4
- //# sourceMappingURL=chunk-XDOIZTY6.js.map