jbrowse-plugin-graphgenomeviewer 6.1.2 → 6.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{GbzBaseSyntenyAdapter-Z4NDQGEZ.js → GbzBaseSyntenyAdapter-6EBOJZQS.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-Z4NDQGEZ.js.map → GbzBaseSyntenyAdapter-6EBOJZQS.js.map} +1 -1
- package/dist/chunks/{GraphGenomeView-KS7FVZJ5.js → GraphGenomeView-75XANSTR.js} +2 -2
- package/dist/chunks/{GraphTrackSettingsDialog-PTKKSSBE.js → GraphTrackSettingsDialog-7MLMEMHB.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-LWHPENRV.js → LinearGraphDisplay-ZGNF7F54.js} +2 -2
- package/dist/chunks/{MinigraphBubbleAdapter-HGW2CBIT.js → MinigraphBubbleAdapter-TSD3M2U6.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-H3N36A4S.js → RgfaTabixAdapter-ZYB65GT7.js} +2 -2
- package/dist/chunks/{bandage-layout-3AR6BCUD-HF5PAMCE.js → bandage-layout-3AR6BCUD-OD6Z4Q56.js} +1 -1
- package/dist/chunks/{bandage-layout-3AR6BCUD-HF5PAMCE.js.map → bandage-layout-3AR6BCUD-OD6Z4Q56.js.map} +1 -1
- package/dist/chunks/chunk-5AOGDAVJ.js +2 -0
- package/dist/chunks/chunk-5AOGDAVJ.js.map +7 -0
- package/dist/chunks/{chunk-WV6GUYH7.js → chunk-B4HN3AAG.js} +2 -2
- package/dist/chunks/{chunk-WV6GUYH7.js.map → chunk-B4HN3AAG.js.map} +1 -1
- package/dist/chunks/{chunk-U3XWI3ON.js → chunk-EAK4DAP4.js} +3 -3
- package/dist/chunks/{chunk-U3XWI3ON.js.map → chunk-EAK4DAP4.js.map} +3 -3
- package/dist/chunks/{chunk-EAFQ3OQR.js → chunk-G54OD5EP.js} +2 -2
- package/dist/chunks/{chunk-EAFQ3OQR.js.map → chunk-G54OD5EP.js.map} +4 -4
- package/dist/chunks/{chunk-EYWDKUI6.js → chunk-MD4VWZQN.js} +1 -1
- package/dist/chunks/{chunk-EYWDKUI6.js.map → chunk-MD4VWZQN.js.map} +1 -1
- package/dist/chunks/{chunk-B2UJRFGO.js → chunk-QYRJFWZX.js} +2 -2
- package/dist/chunks/chunk-SZTJRDEL.js +2 -0
- package/dist/chunks/{chunk-7PF6DB6Y.js.map → chunk-SZTJRDEL.js.map} +4 -4
- package/dist/chunks/{chunk-YPZ64NPV.js → chunk-TR65JUGL.js} +1 -1
- package/dist/chunks/{chunk-YPZ64NPV.js.map → chunk-TR65JUGL.js.map} +1 -1
- package/dist/chunks/{chunk-QU4UAKXZ.js → chunk-UG4JHBOR.js} +1 -1
- package/dist/chunks/{chunk-QU4UAKXZ.js.map → chunk-UG4JHBOR.js.map} +1 -1
- package/dist/chunks/{chunk-6UUUO22M.js → chunk-ZSHFOSVW.js} +1 -1
- package/dist/chunks/{chunk-6UUUO22M.js.map → chunk-ZSHFOSVW.js.map} +1 -1
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +6 -6
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +2 -2
- package/src/GraphGenomeView/components/GraphSettingsDialog.tsx +5 -6
- package/src/GraphGenomeView/components/WalkRowsOverlay.tsx +1 -1
- package/src/GraphGenomeView/model.test.ts +46 -0
- package/src/GraphGenomeView/pane/fitViews.ts +48 -10
- package/src/GraphGenomeView/pane/graphViews.ts +8 -3
- package/src/GraphGenomeView/pane/loadActions.ts +3 -2
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-7PF6DB6Y.js +0 -2
- package/dist/chunks/chunk-WA4J2BQ5.js +0 -2
- package/dist/chunks/chunk-WA4J2BQ5.js.map +0 -7
- /package/dist/chunks/{GraphGenomeView-KS7FVZJ5.js.map → GraphGenomeView-75XANSTR.js.map} +0 -0
- /package/dist/chunks/{GraphTrackSettingsDialog-PTKKSSBE.js.map → GraphTrackSettingsDialog-7MLMEMHB.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-LWHPENRV.js.map → LinearGraphDisplay-ZGNF7F54.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-HGW2CBIT.js.map → MinigraphBubbleAdapter-TSD3M2U6.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-H3N36A4S.js.map → RgfaTabixAdapter-ZYB65GT7.js.map} +0 -0
- /package/dist/chunks/{chunk-B2UJRFGO.js.map → chunk-QYRJFWZX.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{N as u,T as w,W as S,ca as k,fa as D}from"./chunk-SZTJRDEL.js";import{a as y,b as A,c as N,d as R}from"./chunk-TYJTJGPO.js";import{b as c}from"./chunk-FY3BTKY4.js";var m=[{value:0,label:"Fastest"},{value:1,label:"Fast"},{value:2,label:"Default"},{value:3,label:"Fine"},{value:4,label:"Best"}];var L=c(A(),1),o=c(R(),1),b=c(N(),1),G=c(D(),1),e=c(y(),1),C=(0,G.makeStyles)()({section:{marginBottom:24},formControl:{minWidth:200}});function s({warn:l=!1,children:n}){return(0,e.jsx)(o.Typography,{variant:"caption",color:l?"warning.main":"text.secondary",children:n})}var T=(0,b.observer)(function({model:n}){return n.hasGraph&&!n.usesLayoutEngine?(0,e.jsx)(s,{warn:!0,children:"No effect on this layout: only the force-directed layout is drawn by the engine that reads this."}):null});function g({label:l,checked:n,onChange:t,children:p}){let{classes:i}=C();return(0,e.jsxs)("div",{className:i.section,children:[(0,e.jsx)(o.FormControlLabel,{control:(0,e.jsx)(o.Switch,{checked:n,onChange:d=>{t(d.target.checked)}}),label:l}),p]})}function h({label:l,value:n,options:t,testId:p,sx:i,onChange:d}){let{classes:r}=C();return(0,e.jsxs)(o.FormControl,{className:r.formControl,sx:i,children:[(0,e.jsx)(o.InputLabel,{children:l}),(0,e.jsx)(o.Select,{value:n,label:l,"data-testid":p,onChange:a=>{d(a.target.value)},children:t.map(({value:a,label:v,description:f})=>(0,e.jsx)(o.MenuItem,{value:a,children:f?(0,e.jsx)(o.Tooltip,{title:f,placement:"right",children:(0,e.jsx)("span",{children:v})}):v},a))})]})}var I=l=>l.map(({trackId:n,name:t})=>({value:n,label:t})),P=(0,b.observer)(function(n){let{model:t,open:p,onClose:i,children:d}=n,{classes:r}=C();return(0,e.jsxs)(L.Dialog,{open:p,onClose:i,title:"Graph settings",children:[(0,e.jsxs)(o.DialogContent,{children:[(0,e.jsx)("div",{className:r.section,children:(0,e.jsxs)(o.FormControl,{fullWidth:!0,children:[(0,e.jsx)(o.FormLabel,{component:"legend",children:"Layout quality"}),(0,e.jsx)(o.RadioGroup,{value:t.layoutQuality,onChange:a=>{t.setLayoutQuality(parseInt(a.target.value)),t.recomputeLayout()},children:m.map(a=>(0,e.jsx)(o.FormControlLabel,{value:a.value,control:(0,e.jsx)(o.Radio,{}),label:a.label},a.value))}),(0,e.jsx)(s,{children:"FMMM's iteration budget, the same scale Bandage exposes. Higher is slower: on a thousand-node cut the top setting is seconds rather than tenths."}),(0,e.jsx)(T,{model:t})]})}),(0,e.jsxs)(g,{label:"Draw paths",checked:t.drawPaths,onChange:a=>{t.setDrawPaths(a)},children:[(0,e.jsx)(s,{children:"Color each node and connector by the paths through it, one lane per path in legend order, so a path that skips a node leaves its lane empty"}),t.drawPaths&&!t.effectiveDrawPaths?(0,e.jsx)(s,{warn:!0,children:t.pathCount>u?`Off: ${t.pathCount.toLocaleString()} paths is past the ${u} this can tell apart`:"Off: this graph states no paths"}):null]}),(0,e.jsx)(g,{label:"Mark bubbles",checked:t.showBubbles,onChange:a=>{t.setShowBubbles(a)},children:(0,e.jsx)(s,{children:"A halo along the nodes of each bubble, labelled by what it is, with the label opening the bubble on its own"})}),(0,e.jsxs)(g,{label:"Genes on the backbone",checked:t.showGenes,onChange:a=>{t.setShowGenes(a)},children:[(0,e.jsx)(s,{children:"Exons along the reference nodes that carry them and each gene's name at its midpoint, from the assembly's annotation track"}),t.geneTrackChoices.length>1?(0,e.jsx)(h,{label:"Gene track",value:t.geneTrack?.trackId??"",options:I(t.geneTrackChoices),testId:"graph-gene-track-select",sx:{mt:1},onChange:a=>{t.setGeneTrackId(a),t.reloadGenes()}}):null,t.repeatTrackChoices.length>1?(0,e.jsx)(h,{label:"Repeat track",value:t.repeatTrack?.trackId??"",options:I(t.repeatTrackChoices),testId:"graph-repeat-track-select",sx:{mt:1},onChange:a=>{t.setRepeatTrackId(a),t.reloadRepeats()}}):null]}),t.anchorPaths.length>1?(0,e.jsxs)("div",{className:r.section,children:[(0,e.jsx)(h,{label:"Reference path",value:t.activeReferencePath??"",options:t.anchorPaths.map(({name:a})=>({value:a,label:a})),testId:"graph-reference-path-select",onChange:a=>{t.setReferencePath(a),t.recomputeLayout()}}),(0,e.jsx)(s,{children:"Which path the anchored layouts draw x against. A GFA with no rGFA tags states its coordinates only in its paths, and marks none of them as the reference."})]}):null,(0,e.jsxs)("div",{className:r.section,children:[(0,e.jsx)(h,{label:"Bubble spread",value:t.bubbleSpread,options:k,testId:"graph-bubble-spread-select",onChange:a=>{t.setBubbleSpread(a),t.recomputeLayout()}}),(0,e.jsx)(s,{children:"How far the force layout opens a bubble. A pangenome allele is a few bp, so at Bandage's own scale both arms land inside one node thickness and the graph draws as a rope."}),(0,e.jsx)(T,{model:t})]}),(0,e.jsxs)("div",{className:r.section,children:[(0,e.jsx)(h,{label:"Node width",value:t.nodeWidth,options:S,testId:"graph-node-width-select",onChange:a=>{t.setNodeWidth(a)}}),(0,e.jsx)(s,{children:"Bandage's depth as width. In a cut with walks, depth is how many haplotypes carry the node."})]}),d,(0,e.jsxs)("div",{className:r.section,children:[(0,e.jsx)(h,{label:"Color scheme",value:t.chosenColorScheme,options:w,onChange:a=>{t.setColorScheme(a)}}),t.colorSchemeLock?(0,e.jsxs)(s,{warn:!0,children:["No effect now. ",t.colorSchemeLock.why]}):null]})]}),(0,e.jsx)(o.DialogActions,{children:(0,e.jsx)(o.Button,{variant:"contained",color:"primary",onClick:i,children:"Close"})})]})}),W=P;export{W as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5AOGDAVJ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@7.3.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-K5SIJGAE.js", "../../src/GraphGenomeView/components/GraphSettingsDialog.tsx"],
|
|
4
|
+
"sourcesContent": ["// src/layoutQualities.ts\nvar LAYOUT_QUALITIES = [\n { value: 0, label: \"Fastest\" },\n { value: 1, label: \"Fast\" },\n { value: 2, label: \"Default\" },\n { value: 3, label: \"Fine\" },\n { value: 4, label: \"Best\" }\n];\n\nexport {\n LAYOUT_QUALITIES\n};\n", "import type { ReactNode } from 'react'\n\nimport { BUBBLE_SPREADS } from '@jbrowse/bandage-core/bubbleSpreads'\nimport { COLOR_SCHEMES } from '@jbrowse/bandage-core/colorSchemes'\nimport { LAYOUT_QUALITIES } from '@jbrowse/bandage-core/layoutQualities'\nimport { NODE_WIDTHS } from '@jbrowse/bandage-core/nodeWidths'\nimport { MAX_PATH_COLORS } from '@jbrowse/bandage-core/pathColors'\nimport { Dialog } from '@jbrowse/core/ui'\nimport {\n Button,\n DialogActions,\n DialogContent,\n FormControl,\n FormControlLabel,\n FormLabel,\n InputLabel,\n MenuItem,\n Radio,\n RadioGroup,\n Select,\n Switch,\n Tooltip,\n Typography,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\nimport type { SxProps } from '@mui/material'\n\nconst useStyles = makeStyles()({\n section: {\n marginBottom: 24,\n },\n formControl: {\n minWidth: 200,\n },\n})\n\nfunction Caption({\n warn = false,\n children,\n}: {\n warn?: boolean\n children: ReactNode\n}) {\n return (\n <Typography\n variant=\"caption\"\n color={warn ? 'warning.main' : 'text.secondary'}\n >\n {children}\n </Typography>\n )\n}\n\n// Layout quality and bubble spread are the engine's inputs, and an anchored\n// layout places a node from its coordinates without reaching it. Left enabled\n// so the force layout can be set up before switching to it.\nconst EngineOnly = observer(function EngineOnly({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return model.hasGraph && !model.usesLayoutEngine ? (\n <Caption warn>\n No effect on this layout: only the force-directed layout is drawn by the\n engine that reads this.\n </Caption>\n ) : null\n})\n\nfunction SettingSwitch({\n label,\n checked,\n onChange,\n children,\n}: {\n label: string\n checked: boolean\n onChange: (checked: boolean) => void\n children?: ReactNode\n}) {\n const { classes } = useStyles()\n return (\n <div className={classes.section}>\n <FormControlLabel\n control={\n <Switch\n checked={checked}\n onChange={e => {\n onChange(e.target.checked)\n }}\n />\n }\n label={label}\n />\n {children}\n </div>\n )\n}\n\n// One dropdown setting; an option's description is its tooltip\nfunction SettingSelect<T extends string>({\n label,\n value,\n options,\n testId,\n sx,\n onChange,\n}: {\n label: string\n value: T\n options: readonly { value: T; label: string; description?: string }[]\n testId?: string\n sx?: SxProps\n onChange: (value: T) => void\n}) {\n const { classes } = useStyles()\n return (\n <FormControl className={classes.formControl} sx={sx}>\n <InputLabel>{label}</InputLabel>\n <Select\n value={value}\n label={label}\n data-testid={testId}\n onChange={e => {\n onChange(e.target.value as T)\n }}\n >\n {options.map(({ value, label, description }) => (\n <MenuItem key={value} value={value}>\n {description ? (\n <Tooltip title={description} placement=\"right\">\n <span>{label}</span>\n </Tooltip>\n ) : (\n label\n )}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n}\n\nconst trackOptions = (tracks: { trackId: string; name: string }[]) =>\n tracks.map(({ trackId, name }) => ({ value: trackId, label: name }))\n\n// `children` is the host's own section, between node width and colour\nconst GraphSettingsDialog = observer(function GraphSettingsDialog(props: {\n model: GraphPaneModel\n open: boolean\n onClose: () => void\n children?: ReactNode\n}) {\n const { model, open, onClose, children } = props\n const { classes } = useStyles()\n\n return (\n <Dialog open={open} onClose={onClose} title=\"Graph settings\">\n <DialogContent>\n <div className={classes.section}>\n <FormControl fullWidth>\n <FormLabel component=\"legend\">Layout quality</FormLabel>\n <RadioGroup\n value={model.layoutQuality}\n onChange={e => {\n model.setLayoutQuality(parseInt(e.target.value))\n void model.recomputeLayout()\n }}\n >\n {LAYOUT_QUALITIES.map(q => (\n <FormControlLabel\n key={q.value}\n value={q.value}\n control={<Radio />}\n label={q.label}\n />\n ))}\n </RadioGroup>\n <Caption>\n FMMM's iteration budget, the same scale Bandage exposes.\n Higher is slower: on a thousand-node cut the top setting is\n seconds rather than tenths.\n </Caption>\n <EngineOnly model={model} />\n </FormControl>\n </div>\n\n <SettingSwitch\n label=\"Draw paths\"\n checked={model.drawPaths}\n onChange={draw => {\n model.setDrawPaths(draw)\n }}\n >\n <Caption>\n Color each node and connector by the paths through it, one lane per\n path in legend order, so a path that skips a node leaves its lane\n empty\n </Caption>\n {model.drawPaths && !model.effectiveDrawPaths ? (\n <Caption warn>\n {model.pathCount > MAX_PATH_COLORS\n ? `Off: ${model.pathCount.toLocaleString()} paths is past the ${MAX_PATH_COLORS} this can tell apart`\n : 'Off: this graph states no paths'}\n </Caption>\n ) : null}\n </SettingSwitch>\n\n <SettingSwitch\n label=\"Mark bubbles\"\n checked={model.showBubbles}\n onChange={show => {\n model.setShowBubbles(show)\n }}\n >\n <Caption>\n A halo along the nodes of each bubble, labelled by what it is, with\n the label opening the bubble on its own\n </Caption>\n </SettingSwitch>\n\n <SettingSwitch\n label=\"Genes on the backbone\"\n checked={model.showGenes}\n onChange={show => {\n model.setShowGenes(show)\n }}\n >\n <Caption>\n Exons along the reference nodes that carry them and each gene's name\n at its midpoint, from the assembly's annotation track\n </Caption>\n {model.geneTrackChoices.length > 1 ? (\n <SettingSelect\n label=\"Gene track\"\n value={model.geneTrack?.trackId ?? ''}\n options={trackOptions(model.geneTrackChoices)}\n testId=\"graph-gene-track-select\"\n sx={{ mt: 1 }}\n onChange={trackId => {\n model.setGeneTrackId(trackId)\n void model.reloadGenes()\n }}\n />\n ) : null}\n {model.repeatTrackChoices.length > 1 ? (\n <SettingSelect\n label=\"Repeat track\"\n value={model.repeatTrack?.trackId ?? ''}\n options={trackOptions(model.repeatTrackChoices)}\n testId=\"graph-repeat-track-select\"\n sx={{ mt: 1 }}\n onChange={trackId => {\n model.setRepeatTrackId(trackId)\n void model.reloadRepeats()\n }}\n />\n ) : null}\n </SettingSwitch>\n\n {model.anchorPaths.length > 1 ? (\n <div className={classes.section}>\n <SettingSelect\n label=\"Reference path\"\n value={model.activeReferencePath ?? ''}\n options={model.anchorPaths.map(({ name }) => ({\n value: name,\n label: name,\n }))}\n testId=\"graph-reference-path-select\"\n onChange={name => {\n model.setReferencePath(name)\n void model.recomputeLayout()\n }}\n />\n <Caption>\n Which path the anchored layouts draw x against. A GFA with no rGFA\n tags states its coordinates only in its paths, and marks none of\n them as the reference.\n </Caption>\n </div>\n ) : null}\n\n <div className={classes.section}>\n <SettingSelect\n label=\"Bubble spread\"\n value={model.bubbleSpread}\n options={BUBBLE_SPREADS}\n testId=\"graph-bubble-spread-select\"\n onChange={spread => {\n model.setBubbleSpread(spread)\n void model.recomputeLayout()\n }}\n />\n <Caption>\n How far the force layout opens a bubble. A pangenome allele is a few\n bp, so at Bandage's own scale both arms land inside one node\n thickness and the graph draws as a rope.\n </Caption>\n <EngineOnly model={model} />\n </div>\n\n <div className={classes.section}>\n <SettingSelect\n label=\"Node width\"\n value={model.nodeWidth}\n options={NODE_WIDTHS}\n testId=\"graph-node-width-select\"\n onChange={width => {\n model.setNodeWidth(width)\n }}\n />\n <Caption>\n Bandage's depth as width. In a cut with walks, depth is how\n many haplotypes carry the node.\n </Caption>\n </div>\n\n {children}\n\n <div className={classes.section}>\n <SettingSelect\n label=\"Color scheme\"\n value={model.chosenColorScheme}\n options={COLOR_SCHEMES}\n onChange={scheme => {\n model.setColorScheme(scheme)\n }}\n />\n {model.colorSchemeLock ? (\n <Caption warn>No effect now. {model.colorSchemeLock.why}</Caption>\n ) : null}\n </div>\n </DialogContent>\n\n <DialogActions>\n <Button variant=\"contained\" color=\"primary\" onClick={onClose}>\n Close\n </Button>\n </DialogActions>\n </Dialog>\n )\n})\n\nexport default GraphSettingsDialog\n"],
|
|
5
|
+
"mappings": "2KACA,IAAIA,EAAmB,CACrB,CAAE,MAAO,EAAG,MAAO,SAAU,EAC7B,CAAE,MAAO,EAAG,MAAO,MAAO,EAC1B,CAAE,MAAO,EAAG,MAAO,SAAU,EAC7B,CAAE,MAAO,EAAG,MAAO,MAAO,EAC1B,CAAE,MAAO,EAAG,MAAO,MAAO,CAC5B,ECAA,IAAAC,EAAuB,SACvBC,EAeO,SACPC,EAAyB,SACzBC,EAA2B,SAsBvBC,EAAA,SAjBEC,KAAY,cAAW,EAAE,CAC7B,QAAS,CACP,aAAc,EAChB,EACA,YAAa,CACX,SAAU,GACZ,CACF,CAAC,EAED,SAASC,EAAQ,CACf,KAAAC,EAAO,GACP,SAAAC,CACF,EAGG,CACD,SACE,OAAC,cACC,QAAQ,UACR,MAAOD,EAAO,eAAiB,iBAE9B,SAAAC,EACH,CAEJ,CAKA,IAAMC,KAAa,YAAS,SAAoB,CAC9C,MAAAC,CACF,EAEG,CACD,OAAOA,EAAM,UAAY,CAACA,EAAM,oBAC9B,OAACJ,EAAA,CAAQ,KAAI,GAAC,4GAGd,EACE,IACN,CAAC,EAED,SAASK,EAAc,CACrB,MAAAC,EACA,QAAAC,EACA,SAAAC,EACA,SAAAN,CACF,EAKG,CACD,GAAM,CAAE,QAAAO,CAAQ,EAAIV,EAAU,EAC9B,SACE,QAAC,OAAI,UAAWU,EAAQ,QACtB,oBAAC,oBACC,WACE,OAAC,UACC,QAASF,EACT,SAAUG,GAAK,CACbF,EAASE,EAAE,OAAO,OAAO,CAC3B,EACF,EAEF,MAAOJ,EACT,EACCJ,GACH,CAEJ,CAGA,SAASS,EAAgC,CACvC,MAAAL,EACA,MAAAM,EACA,QAAAC,EACA,OAAAC,EACA,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BACN,MAAOP,EAAM,qBAAuB,GACpC,QAASA,EAAM,YAAY,IAAI,CAAC,CAAE,KAAAgB,CAAK,KAAO,CAC5C,MAAOA,EACP,MAAOA,CACT,EAAE,EACF,OAAO,8BACP,SAAUA,GAAQ,CAChBhB,EAAM,iBAAiBgB,CAAI,EACtBhB,EAAM,gBAAgB,CAC7B,EACF,KACA,OAACJ,EAAA,CAAQ,sKAIT,GACF,EACE,QAEJ,QAAC,OAAI,UAAWS,EAAQ,QACtB,oBAACE,EAAA,CACC,MAAM,gBACN,MAAOP,EAAM,aACb,QAAS0B,EACT,OAAO,6BACP,SAAUC,GAAU,CAClB3B,EAAM,gBAAgB2B,CAAM,EACvB3B,EAAM,gBAAgB,CAC7B,EACF,KACA,OAACJ,EAAA,CAAQ,sLAIT,KACA,OAACG,EAAA,CAAW,MAAOC,EAAO,GAC5B,KAEA,QAAC,OAAI,UAAWK,EAAQ,QACtB,oBAACE,EAAA,CACC,MAAM,aACN,MAAOP,EAAM,UACb,QAAS4B,EACT,OAAO,0BACP,SAAUC,GAAS,CACjB7B,EAAM,aAAa6B,CAAK,CAC1B,EACF,KACA,OAACjC,EAAA,CAAQ,uGAGT,GACF,EAECE,KAED,QAAC,OAAI,UAAWO,EAAQ,QACtB,oBAACE,EAAA,CACC,MAAM,eACN,MAAOP,EAAM,kBACb,QAAS8B,EACT,SAAUC,GAAU,CAClB/B,EAAM,eAAe+B,CAAM,CAC7B,EACF,EACC/B,EAAM,mBACL,QAACJ,EAAA,CAAQ,KAAI,GAAC,4BAAgBI,EAAM,gBAAgB,KAAI,EACtD,MACN,GACF,KAEA,OAAC,iBACC,mBAAC,UAAO,QAAQ,YAAY,MAAM,UAAU,QAASoB,EAAS,iBAE9D,EACF,GACF,CAEJ,CAAC,EAEMY,EAAQf",
|
|
6
|
+
"names": ["LAYOUT_QUALITIES", "import_ui", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "Caption", "warn", "children", "EngineOnly", "model", "SettingSwitch", "label", "checked", "onChange", "classes", "e", "SettingSelect", "value", "options", "testId", "sx", "description", "trackOptions", "tracks", "trackId", "name", "GraphSettingsDialog", "props", "open", "onClose", "LAYOUT_QUALITIES", "q", "draw", "MAX_PATH_COLORS", "show", "BUBBLE_SPREADS", "spread", "NODE_WIDTHS", "width", "COLOR_SCHEMES", "scheme", "GraphSettingsDialog_default"]
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{c as y}from"./chunk-
|
|
1
|
+
import{c as y}from"./chunk-TR65JUGL.js";import{a as m,b as L,c as S,d as u,e as N}from"./chunk-UG4JHBOR.js";var O="unknown";function T(e){let t=e.split(" ");return{fields:t,name:t.slice(1,4).join(" "),start:+t[4],end:+t[5]}}var b=e=>e.fields[6].match(/[<>][^<>]+/g)??[];function A(e){let t=new Map;for(let o of e)if(o.startsWith("S ")){let[,n,s,...a]=o.split(" "),i=a.find(r=>r.startsWith("LN:i:"));t.set(n,s==="*"&&i?+i.slice(5):s.length)}return t}function G(e,t,o){if(t.end<=e.end)return e;let n=b(t),s=t.start;for(let[a,i]of n.entries()){if(s===e.end){let f=[...e.fields];return f[5]=String(t.end),f[6]=e.fields[6]+n.slice(a).join(""),{...e,fields:f,end:t.end}}let r=o.get(i.slice(1));if(s>e.end||r===void 0)return;s+=r}}function B(e,t,o){let n=[];for(let s of e.sort((a,i)=>a.start-i.start)){let a=n.at(-1),[,i,r,f]=s.fields,d=a!==void 0&&(s.start<a.end||s.start===a.end&&!o(i,+r,f,s.start))?G(a,s,t):void 0;d?n[n.length-1]=d:n.push(s)}return n}var M=e=>e==="+"?"-":"+";function*R(e){let t=b(e).map(o=>({id:o.slice(1),sign:o.startsWith(">")?"+":"-"}));for(let o=1;o<t.length;o++){let n=t[o-1],s=t[o];yield{forward:`L ${n.id} ${n.sign} ${s.id} ${s.sign} 0M`,reverse:`L ${s.id} ${M(s.sign)} ${n.id} ${M(n.sign)} 0M`}}}function x(e,t){if(e.length<=1)return e[0]??"";let o=e.map(c=>c.split(`
|
|
2
2
|
`).filter(l=>l!=="")),n=(c,l)=>c.filter(w=>w.startsWith(`${l} `)),s=A(o.flat()),a=0,i=o.map(c=>{let l=n(c,"W").map(T),w=a;for(let h of l.filter(g=>g.fields[1]===O)){let g=+h.fields[2]+w;h.fields[2]=String(g),h.name=h.fields.slice(1,4).join(" "),a=Math.max(a,g)}return l}),r=new Map;for(let c of[...i.flatMap(l=>l.slice(0,1)),...i.flatMap(l=>l.slice(1))]){let l=r.get(c.name);l?l.push(c):r.set(c.name,[c])}let f=[...r.values()].flatMap(c=>B(c,s,t)),p=new Set(o.flatMap(c=>n(c,"L")));for(let c of f)for(let l of R(c))!p.has(l.forward)&&!p.has(l.reverse)&&p.add(l.forward);return`${[...new Set([...n(o[0],"H"),...o.flatMap(c=>n(c,"S")),...p,...f.map(c=>c.fields.join(" "))])].join(`
|
|
3
3
|
`)}
|
|
4
4
|
`}var F=new Map([["hg38","GRCh38"],["hg19","GRCh37"],["hs1","CHM13"],["t2t-chm13","CHM13"],["chm13v2","CHM13"]]);function v(e){return F.get(e.toLowerCase())}function $(e){let t=e.includes("#")?m(e):void 0;return t===void 0||L(t)?void 0:t}function C(e){return S(e)??m(e)}function E(e){let t=new Set((e.anchorPaths??[]).map(n=>n.name));for(let n of e.nodes)n.stable&&t.add(n.stable.refName);let o=new Map;for(let n of t){let s=$(n);s!==void 0&&(o.get(s)??o.set(s,new Set).get(s)).add(C(n))}return o}function k(e,t){let o=new Set(e.map(f=>$(f.refName))),[n]=o;if(o.size!==1||n===void 0)return{contigs:e,prefixes:[],named:!1};let s=new Set(e.map(f=>C(f.refName))),a=[...t.get(n)??[]].every(f=>s.has(f)),i=new Set(e.map(f=>S(f.refName))),[r]=i;return{contigs:e,prefixes:[...a?[n]:[],...i.size===1&&r?[r]:[]],named:!0}}function H(e){let t=new Map;for(let n of e.nodes)if(y(n)){let{refName:s,start:a}=n.stable,i=a+n.length,r=t.get(s);r?(r.start=Math.min(r.start,a),r.end=Math.max(r.end,i)):t.set(s,{refName:s,contig:u(s),start:a,end:i})}let o=[...t.values()];return o.length?k(o,E(e)):void 0}function te(e,t){let o=H(e),n=t?u(t.refName):o?.contigs.length===1?o.contigs[0].contig:void 0,s=o?.named?m(o.contigs[0].refName):void 0;return n&&(s?`${s} ${n}`:n)}function U(e,t){let o=i=>[i.name,...i.aliases??[]],n=i=>r=>o(r).some(f=>f.toLowerCase()===i.toLowerCase()),s=[...e?.prefixes??[]].reverse(),a=e?.prefixes.find(i=>!i.includes("#"))?.toLowerCase();for(let i of s){let r=t.find(n(i));if(r)return r}return a===void 0?void 0:t.find(i=>o(i).some(r=>v(r)?.toLowerCase()===a))}function ne(e,t){let o=E(e);return e.anchorPaths?.find(n=>U(k([{refName:n.name,contig:u(n.name),start:n.start,end:n.start+n.length}],o),[t]))}function z(e){let t=e.replace(/^chr/i,""),o=t?/^(M|MT)$/i.test(t)?["M","MT"]:[t]:[];return[...new Set([e,...o.flatMap(n=>[n,`chr${n}`])])]}function K(e,t={}){let o=new Set(e),n=new Map;for(let s of o){let a=u(s),i=t[a];for(let r of new Set([...z(a),...i?[i]:[]]))n.set(r,n.has(r)?void 0:s)}return s=>o.has(s)?s:n.get(s)}function oe(e,t,o){let n=K(t.contigs.map(s=>s.refName),o);return e.flatMap(s=>{let a=n(s.refName);return a===void 0?[]:[a===s.refName?s:{...s,refName:a}]})}var W=class extends Error{constructor(e,t){super(t.length===0?`the graph names no reference sample (gbwt_reference_samples) and the anchor "${e}" maps to none; set referenceSample`:`the anchor "${e}" is none of the graph's reference samples (${t.join(", ")}); set referenceSample or map it through assemblyNameToPanSN`),this.name="NoReferenceSampleError"}},j=class extends Error{constructor(e,t,o){super(`this ${t.toLocaleString()} bp window reads more than nodeLimit (${e.toLocaleString()}) graph nodes; zoom in to about ${o.toLocaleString()} bp or raise nodeLimit`),this.fitsBp=o,this.name="NodeLimitError",this.regionTooLarge=!0}};function P(e){return`${e.sample}#${e.haplotype}`}function D(e,t){let o=P(e);return t===void 0||t.some(n=>N(o,n))}async function Q(e){return(await e.tag("gbwt_reference_samples")??"").split(/\s+/).filter(t=>t!=="")}function Z(e,t){let o=e.toLowerCase(),n=v(e)?.toLowerCase();return t.find(s=>s===e)??t.find(s=>s.toLowerCase()===o)??t.find(s=>s.toLowerCase()===n)}function q({configured:e,anchorPrefix:t,referenceSamples:o}){if(e!=="")return e;let n=Z(m(t),o)??(o.length===1?o[0]:void 0);if(n===void 0)throw new W(t,o);return n}async function I(e,t,o){let n=(await e.paths()).find(s=>s.isIndexed&&s.name.sample===t&&s.name.contig===o);return n?{sample:n.name.sample,contig:o,haplotype:n.name.haplotype}:void 0}function _(e,t,o){if(e instanceof Error&&(e.name==="SubgraphLimitError"||/^Subgraph size limit of \d+ nodes exceeded/.test(e.message))){let s=e.walkedBp,a=typeof s=="number"&&s>0?Math.floor(s*.8):Math.floor(o/2);return new j(t,o,Math.max(a,1))}else return}var J={context:1e3,snarls:"contained",limit:1e5};async function V(e,t,o,n,s){if(!t)return"";let a=await e.getSubgraphs({...s,path:t,start:o,end:n,haplotypes:"all"}).catch(r=>{throw _(r,s.limit,n-o)??r}),i=await e.paths();return x(await Promise.all(a.map(r=>r.toGFA())),(r,f,p,d)=>i.some(({name:c})=>c.sample===r&&c.haplotype===f&&c.contig===p&&c.fragment===d))}export{H as a,te as b,U as c,ne as d,oe as e,W as f,j as g,P as h,D as i,Q as j,q as k,I as l,_ as m,J as n,V as o};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-B4HN3AAG.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@7.
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@7.3.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-WSIFAZU7.js", "../../node_modules/.pnpm/@jbrowse+bandage-core@7.3.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-RAKOB6IV.js", "../../node_modules/.pnpm/@jbrowse+bandage-core@7.3.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-LTUWJKHD.js"],
|
|
4
4
|
"sourcesContent": ["// src/gbzJoin.ts\nvar UNKNOWN_SAMPLE = \"unknown\";\nfunction parseWalk(line) {\n const fields = line.split(\"\t\");\n return {\n fields,\n name: fields.slice(1, 4).join(\"\t\"),\n start: +fields[4],\n end: +fields[5]\n };\n}\nvar stepsOf = (walk) => walk.fields[6].match(/[<>][^<>]+/g) ?? [];\nfunction segmentLengths(lines) {\n const lengths = /* @__PURE__ */ new Map();\n for (const line of lines) {\n if (line.startsWith(\"S\t\")) {\n const [, id, sequence, ...tags] = line.split(\"\t\");\n const ln = tags.find((tag) => tag.startsWith(\"LN:i:\"));\n lengths.set(\n id,\n sequence === \"*\" && ln ? +ln.slice(\"LN:i:\".length) : sequence.length\n );\n }\n }\n return lengths;\n}\nfunction extend(a, b, lengths) {\n if (b.end <= a.end) {\n return a;\n }\n const steps = stepsOf(b);\n let pos = b.start;\n for (const [i, step] of steps.entries()) {\n if (pos === a.end) {\n const fields = [...a.fields];\n fields[5] = String(b.end);\n fields[6] = a.fields[6] + steps.slice(i).join(\"\");\n return { ...a, fields, end: b.end };\n }\n const length = lengths.get(step.slice(1));\n if (pos > a.end || length === void 0) {\n return void 0;\n }\n pos += length;\n }\n return void 0;\n}\nfunction joinPieces(pieces, lengths, startsPath) {\n const joined = [];\n for (const piece of pieces.sort((a, b) => a.start - b.start)) {\n const last = joined.at(-1);\n const [, sample, haplotype, contig] = piece.fields;\n const joins = last !== void 0 && (piece.start < last.end || piece.start === last.end && !startsPath(sample, +haplotype, contig, piece.start));\n const extended = joins ? extend(last, piece, lengths) : void 0;\n if (extended) {\n joined[joined.length - 1] = extended;\n } else {\n joined.push(piece);\n }\n }\n return joined;\n}\nvar flip = (sign) => sign === \"+\" ? \"-\" : \"+\";\nfunction* stepLinks(walk) {\n const steps = stepsOf(walk).map((step) => ({\n id: step.slice(1),\n sign: step.startsWith(\">\") ? \"+\" : \"-\"\n }));\n for (let i = 1; i < steps.length; i++) {\n const a = steps[i - 1];\n const b = steps[i];\n yield {\n forward: `L\t${a.id}\t${a.sign}\t${b.id}\t${b.sign}\t0M`,\n reverse: `L\t${b.id}\t${flip(b.sign)}\t${a.id}\t${flip(a.sign)}\t0M`\n };\n }\n}\nfunction joinCuts(gfas, startsPath) {\n if (gfas.length <= 1) {\n return gfas[0] ?? \"\";\n }\n const cuts = gfas.map((gfa) => gfa.split(\"\\n\").filter((line) => line !== \"\"));\n const ofType = (cut, type) => cut.filter((line) => line.startsWith(`${type}\t`));\n const lengths = segmentLengths(cuts.flat());\n let unknownOffset = 0;\n const walksByCut = cuts.map((cut) => {\n const walks2 = ofType(cut, \"W\").map(parseWalk);\n const offset = unknownOffset;\n for (const walk of walks2.filter((w) => w.fields[1] === UNKNOWN_SAMPLE)) {\n const haplotype = +walk.fields[2] + offset;\n walk.fields[2] = String(haplotype);\n walk.name = walk.fields.slice(1, 4).join(\"\t\");\n unknownOffset = Math.max(unknownOffset, haplotype);\n }\n return walks2;\n });\n const byName = /* @__PURE__ */ new Map();\n for (const walk of [\n ...walksByCut.flatMap((walks2) => walks2.slice(0, 1)),\n ...walksByCut.flatMap((walks2) => walks2.slice(1))\n ]) {\n const pieces = byName.get(walk.name);\n if (pieces) {\n pieces.push(walk);\n } else {\n byName.set(walk.name, [walk]);\n }\n }\n const walks = [...byName.values()].flatMap(\n (pieces) => joinPieces(pieces, lengths, startsPath)\n );\n const links = new Set(cuts.flatMap((cut) => ofType(cut, \"L\")));\n for (const walk of walks) {\n for (const link of stepLinks(walk)) {\n if (!links.has(link.forward) && !links.has(link.reverse)) {\n links.add(link.forward);\n }\n }\n }\n const lines = /* @__PURE__ */ new Set([\n ...ofType(cuts[0], \"H\"),\n ...cuts.flatMap((cut) => ofType(cut, \"S\")),\n ...links,\n ...walks.map((walk) => walk.fields.join(\"\t\"))\n ]);\n return `${[...lines].join(\"\\n\")}\n`;\n}\n\nexport {\n joinCuts\n};\n", "import {\n isGenericSample,\n panSNContig,\n panSNHaplotype,\n panSNSample\n} from \"./chunk-BPLIXMH7.js\";\nimport {\n isBackbone\n} from \"./chunk-FYQWPEEY.js\";\n\n// src/reference.ts\nvar WELL_KNOWN_SAMPLES = /* @__PURE__ */ new Map([\n [\"hg38\", \"GRCh38\"],\n [\"hg19\", \"GRCh37\"],\n [\"hs1\", \"CHM13\"],\n [\"t2t-chm13\", \"CHM13\"],\n [\"chm13v2\", \"CHM13\"]\n]);\nfunction wellKnownSample(assemblyName) {\n return WELL_KNOWN_SAMPLES.get(assemblyName.toLowerCase());\n}\nfunction sampleOf(refName) {\n const sample = refName.includes(\"#\") ? panSNSample(refName) : void 0;\n return sample === void 0 || isGenericSample(sample) ? void 0 : sample;\n}\nfunction haplotypeOf(refName) {\n return panSNHaplotype(refName) ?? panSNSample(refName);\n}\nfunction graphHaplotypes(graph) {\n const refNames = new Set((graph.anchorPaths ?? []).map((p) => p.name));\n for (const node of graph.nodes) {\n if (node.stable) {\n refNames.add(node.stable.refName);\n }\n }\n const bySample = /* @__PURE__ */ new Map();\n for (const refName of refNames) {\n const sample = sampleOf(refName);\n if (sample !== void 0) {\n const haplotypes = bySample.get(sample) ?? bySample.set(sample, /* @__PURE__ */ new Set()).get(sample);\n haplotypes.add(haplotypeOf(refName));\n }\n }\n return bySample;\n}\nfunction backboneFrom(contigs, haplotypes) {\n const samples = new Set(contigs.map((c) => sampleOf(c.refName)));\n const [sample] = samples;\n if (samples.size !== 1 || sample === void 0) {\n return { contigs, prefixes: [], named: false };\n }\n const own = new Set(contigs.map((c) => haplotypeOf(c.refName)));\n const unique = [...haplotypes.get(sample) ?? []].every((h) => own.has(h));\n const shared = new Set(contigs.map((c) => panSNHaplotype(c.refName)));\n const [haplotype] = shared;\n return {\n contigs,\n prefixes: [\n ...unique ? [sample] : [],\n ...shared.size === 1 && haplotype ? [haplotype] : []\n ],\n named: true\n };\n}\nfunction graphBackbone(graph) {\n const spans = /* @__PURE__ */ new Map();\n for (const node of graph.nodes) {\n if (isBackbone(node)) {\n const { refName, start } = node.stable;\n const end = start + node.length;\n const span = spans.get(refName);\n if (span) {\n span.start = Math.min(span.start, start);\n span.end = Math.max(span.end, end);\n } else {\n spans.set(refName, {\n refName,\n contig: panSNContig(refName),\n start,\n end\n });\n }\n }\n }\n const contigs = [...spans.values()];\n return contigs.length ? backboneFrom(contigs, graphHaplotypes(graph)) : void 0;\n}\nfunction referenceLabel(graph, region) {\n const backbone = graphBackbone(graph);\n const contig = region ? panSNContig(region.refName) : backbone?.contigs.length === 1 ? backbone.contigs[0].contig : void 0;\n const sample = backbone?.named ? panSNSample(backbone.contigs[0].refName) : void 0;\n return contig && (sample ? `${sample} ${contig}` : contig);\n}\nfunction backboneAssembly(backbone, assemblies) {\n const names = (a) => [a.name, ...a.aliases ?? []];\n const naming = (prefix) => (a) => names(a).some((n) => n.toLowerCase() === prefix.toLowerCase());\n const prefixes = [...backbone?.prefixes ?? []].reverse();\n const sample = backbone?.prefixes.find((p) => !p.includes(\"#\"))?.toLowerCase();\n for (const prefix of prefixes) {\n const assembly = assemblies.find(naming(prefix));\n if (assembly) {\n return assembly;\n }\n }\n return sample === void 0 ? void 0 : assemblies.find(\n (a) => names(a).some((n) => wellKnownSample(n)?.toLowerCase() === sample)\n );\n}\nfunction assemblyWalk(graph, assembly) {\n const haplotypes = graphHaplotypes(graph);\n return graph.anchorPaths?.find(\n (walk) => backboneAssembly(\n backboneFrom(\n [\n {\n refName: walk.name,\n contig: panSNContig(walk.name),\n start: walk.start,\n end: walk.start + walk.length\n }\n ],\n haplotypes\n ),\n [assembly]\n )\n );\n}\nfunction contigNames(contig) {\n const bare = contig.replace(/^chr/i, \"\");\n const forms = !bare ? [] : /^(M|MT)$/i.test(bare) ? [\"M\", \"MT\"] : [bare];\n return [.../* @__PURE__ */ new Set([contig, ...forms.flatMap((f) => [f, `chr${f}`])])];\n}\nfunction refNameBinding(refNames, aliases = {}) {\n const exact = new Set(refNames);\n const byName = /* @__PURE__ */ new Map();\n for (const refName of exact) {\n const contig = panSNContig(refName);\n const alias = aliases[contig];\n for (const name of /* @__PURE__ */ new Set([\n ...contigNames(contig),\n ...alias ? [alias] : []\n ])) {\n byName.set(name, byName.has(name) ? void 0 : refName);\n }\n }\n return (name) => exact.has(name) ? name : byName.get(name);\n}\nfunction featuresOnBackbone(features, backbone, aliases) {\n const bind = refNameBinding(\n backbone.contigs.map((c) => c.refName),\n aliases\n );\n return features.flatMap((f) => {\n const refName = bind(f.refName);\n return refName === void 0 ? [] : [refName === f.refName ? f : { ...f, refName }];\n });\n}\n\nexport {\n WELL_KNOWN_SAMPLES,\n wellKnownSample,\n graphBackbone,\n referenceLabel,\n backboneAssembly,\n assemblyWalk,\n contigNames,\n refNameBinding,\n featuresOnBackbone\n};\n", "import {\n joinCuts\n} from \"./chunk-WSIFAZU7.js\";\nimport {\n wellKnownSample\n} from \"./chunk-RAKOB6IV.js\";\nimport {\n panSNMatchesPrefix,\n panSNSample\n} from \"./chunk-BPLIXMH7.js\";\n\n// src/gbzWindow.ts\nvar NoReferenceSampleError = class extends Error {\n constructor(anchor, referenceSamples) {\n super(\n referenceSamples.length === 0 ? `the graph names no reference sample (gbwt_reference_samples) and the anchor \"${anchor}\" maps to none; set referenceSample` : `the anchor \"${anchor}\" is none of the graph's reference samples (${referenceSamples.join(\", \")}); set referenceSample or map it through assemblyNameToPanSN`\n );\n this.name = \"NoReferenceSampleError\";\n }\n};\nvar NodeLimitError = class extends Error {\n constructor(limit, windowBp, fitsBp) {\n super(\n `this ${windowBp.toLocaleString()} bp window reads more than nodeLimit (${limit.toLocaleString()}) graph nodes; zoom in to about ${fitsBp.toLocaleString()} bp or raise nodeLimit`\n );\n this.fitsBp = fitsBp;\n this.name = \"NodeLimitError\";\n this.regionTooLarge = true;\n }\n};\nfunction haplotypePrefix(name) {\n return `${name.sample}#${name.haplotype}`;\n}\nfunction haplotypeWanted(name, wanted) {\n const prefix = haplotypePrefix(name);\n return wanted === void 0 || wanted.some((candidate) => panSNMatchesPrefix(prefix, candidate));\n}\nasync function referenceSamplesOf(db) {\n return (await db.tag(\"gbwt_reference_samples\") ?? \"\").split(/\\s+/).filter((sample) => sample !== \"\");\n}\nfunction aliasedSample(anchorSample, referenceSamples) {\n const lower = anchorSample.toLowerCase();\n const alias = wellKnownSample(anchorSample)?.toLowerCase();\n return referenceSamples.find((s) => s === anchorSample) ?? referenceSamples.find((s) => s.toLowerCase() === lower) ?? referenceSamples.find((s) => s.toLowerCase() === alias);\n}\nfunction resolveReferenceSample({\n configured,\n anchorPrefix,\n referenceSamples\n}) {\n if (configured !== \"\") {\n return configured;\n }\n const sample = aliasedSample(panSNSample(anchorPrefix), referenceSamples) ?? (referenceSamples.length === 1 ? referenceSamples[0] : void 0);\n if (sample === void 0) {\n throw new NoReferenceSampleError(anchorPrefix, referenceSamples);\n }\n return sample;\n}\nasync function referencePathQuery(db, referenceSample, refName) {\n const path = (await db.paths()).find(\n (p) => p.isIndexed && p.name.sample === referenceSample && p.name.contig === refName\n );\n return path ? {\n sample: path.name.sample,\n contig: refName,\n haplotype: path.name.haplotype\n } : void 0;\n}\nfunction nodeLimitError(error, limit, windowBp) {\n const isLimit = error instanceof Error && (error.name === \"SubgraphLimitError\" || /^Subgraph size limit of \\d+ nodes exceeded/.test(error.message));\n if (!isLimit) {\n return void 0;\n } else {\n const walked = error.walkedBp;\n const fits = typeof walked === \"number\" && walked > 0 ? Math.floor(walked * 0.8) : Math.floor(windowBp / 2);\n return new NodeLimitError(limit, windowBp, Math.max(fits, 1));\n }\n}\nvar GBZ_CUT_DEFAULTS = {\n context: 1e3,\n snarls: \"contained\",\n limit: 1e5\n};\nasync function cutWindowGFA(db, query, start, end, opts) {\n if (!query) {\n return \"\";\n }\n const subgraphs = await db.getSubgraphs({ ...opts, path: query, start, end, haplotypes: \"all\" }).catch((error) => {\n throw nodeLimitError(error, opts.limit, end - start) ?? error;\n });\n const paths = await db.paths();\n return joinCuts(\n await Promise.all(subgraphs.map((subgraph) => subgraph.toGFA())),\n (sample, haplotype, contig, at) => paths.some(\n ({ name }) => name.sample === sample && name.haplotype === haplotype && name.contig === contig && name.fragment === at\n )\n );\n}\n\nexport {\n NoReferenceSampleError,\n NodeLimitError,\n haplotypePrefix,\n haplotypeWanted,\n referenceSamplesOf,\n resolveReferenceSample,\n referencePathQuery,\n nodeLimitError,\n GBZ_CUT_DEFAULTS,\n cutWindowGFA\n};\n"],
|
|
5
5
|
"mappings": "4GACA,IAAIA,EAAiB,UACrB,SAASC,EAAUC,EAAM,CACvB,IAAMC,EAASD,EAAK,MAAM,GAAG,EAC7B,MAAO,CACL,OAAAC,EACA,KAAMA,EAAO,MAAM,EAAG,CAAC,EAAE,KAAK,GAAG,EACjC,MAAO,CAACA,EAAO,CAAC,EAChB,IAAK,CAACA,EAAO,CAAC,CAChB,CACF,CACA,IAAIC,EAAWC,GAASA,EAAK,OAAO,CAAC,EAAE,MAAM,aAAa,GAAK,CAAC,EAChE,SAASC,EAAeC,EAAO,CAC7B,IAAMC,EAA0B,IAAI,IACpC,QAAWN,KAAQK,EACjB,GAAIL,EAAK,WAAW,IAAI,EAAG,CACzB,GAAM,CAAC,CAAEO,EAAIC,EAAU,GAAGC,CAAI,EAAIT,EAAK,MAAM,GAAG,EAC1CU,EAAKD,EAAK,KAAME,GAAQA,EAAI,WAAW,OAAO,CAAC,EACrDL,EAAQ,IACNC,EACAC,IAAa,KAAOE,EAAK,CAACA,EAAG,MAAM,CAAc,EAAIF,EAAS,MAChE,CACF,CAEF,OAAOF,CACT,CACA,SAASM,EAAOC,EAAGC,EAAGR,EAAS,CAC7B,GAAIQ,EAAE,KAAOD,EAAE,IACb,OAAOA,EAET,IAAME,EAAQb,EAAQY,CAAC,EACnBE,EAAMF,EAAE,MACZ,OAAW,CAACG,EAAGC,CAAI,IAAKH,EAAM,QAAQ,EA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EAAKC,EAAM,CACvD,GAAI,CAACH,EACH,MAAO,GAET,IAAMI,EAAY,MAAM1B,EAAG,aAAa,CAAE,GAAGyB,EAAM,KAAMH,EAAO,MAAAC,EAAO,IAAAC,EAAK,WAAY,KAAM,CAAC,EAAE,MAAOP,GAAU,CAChH,MAAMD,EAAeC,EAAOQ,EAAK,MAAOD,EAAMD,CAAK,GAAKN,CAC1D,CAAC,EACKU,EAAQ,MAAM3B,EAAG,MAAM,EAC7B,OAAO4B,EACL,MAAM,QAAQ,IAAIF,EAAU,IAAKG,GAAaA,EAAS,MAAM,CAAC,CAAC,EAC/D,CAAC5B,EAAQ6B,EAAWC,EAAQC,IAAOL,EAAM,KACvC,CAAC,CAAE,KAAAlC,CAAK,IAAMA,EAAK,SAAWQ,GAAUR,EAAK,YAAcqC,GAAarC,EAAK,SAAWsC,GAAUtC,EAAK,WAAauC,CACtH,CACF,CACF",
|
|
6
6
|
"names": ["UNKNOWN_SAMPLE", "parseWalk", "line", "fields", "stepsOf", "walk", "segmentLengths", "lines", "lengths", "id", "sequence", "tags", "ln", "tag", "extend", "a", "b", "steps", "pos", "i", "step", "length", "joinPieces", "pieces", "startsPath", "joined", "piece", "last", "sample", "haplotype", "contig", "extended", "flip", "sign", "stepLinks", "joinCuts", "gfas", "cuts", "gfa", "ofType", "cut", "type", "unknownOffset", "walksByCut", "walks2", "offset", "w", "byName", "walks", "links", "link", "WELL_KNOWN_SAMPLES", "wellKnownSample", "assemblyName", "sampleOf", "refName", "sample", "panSNSample", "isGenericSample", "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", "referenceLabel", "region", "backbone", "contig", "backboneAssembly", "assemblies", "names", "a", "naming", "prefix", "n", "prefixes", "assembly", "assemblyWalk", "walk", "contigNames", "bare", "forms", "f", "refNameBinding", "aliases", "exact", "byName", "alias", "name", "featuresOnBackbone", "features", "bind", "NoReferenceSampleError", "anchor", "referenceSamples", "NodeLimitError", "limit", "windowBp", "fitsBp", "haplotypePrefix", "name", "haplotypeWanted", "wanted", "prefix", "candidate", "panSNMatchesPrefix", "referenceSamplesOf", "db", "sample", "aliasedSample", "anchorSample", "lower", "alias", "wellKnownSample", "resolveReferenceSample", "configured", "anchorPrefix", "panSNSample", "referencePathQuery", "referenceSample", "refName", "path", "p", "nodeLimitError", "error", "walked", "fits", "GBZ_CUT_DEFAULTS", "cutWindowGFA", "query", "start", "end", "opts", "subgraphs", "paths", "joinCuts", "subgraph", "haplotype", "contig", "at"]
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as Dt}from"./chunk-WA4J2BQ5.js";import{Ba as It,Ca as Gt,D as we,E as ut,F as ft,Ga as Tt,Ia as Ht,M as ae,N as mt,Oa as Wt,P as ee,R as gt,S as bt,T as vt,U as wt,Ua as Bt,Wa as _t,X as ye,Xa as Nt,Y as yt,Z as kt,Za as At,_ as St,a as C,b as We,ba as ke,cb as Re,d as _e,db as Fe,e as Ne,fa as xt,fb as Ot,ga as Rt,gb as zt,ha as Mt,ia as Lt,ja as Se,ka as de,la as se,m as ct,ma as Ae,na as Oe,pa as Ct,r as pe,ra as ze,s as dt,ta as De,ua as Pt,va as xe,wa as Et}from"./chunk-EAFQ3OQR.js";import{F as ve,S as pt,ea as ie,g as $,i as be}from"./chunk-7PF6DB6Y.js";import{b as ht}from"./chunk-EYWDKUI6.js";import{a as ge}from"./chunk-FCWXYIFC.js";import{a as N}from"./chunk-J6KYLXRD.js";import{a as m,b as Be,c as M,d as Q}from"./chunk-TYJTJGPO.js";import{a as vo,b as s}from"./chunk-FY3BTKY4.js";var Xt=vo((fa,Ft)=>{Ft.exports=JBrowseExports["@jbrowse/render-core/useRenderingBackend"]});var He=s(N(),1);var re=s(Be(),1),it=s(ge(),1),fo=s(Xt(),1);var $t=s(m(),1),Yt=(0,C.createSvgIcon)((0,$t.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 _=s(M(),1);var Xe=s(M(),1);var T={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},w={display:"flex",alignItems:"center",gap:5};var B=s(m(),1),wo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},yo=(0,Xe.observer)(function({model:e}){let{bubbleHalos:n,walkLift:o,hoveredBubble:a}=e;if(n.length===0)return null;let{scaleX:r,scaleY:c,translateX:l,translateY:d,paneWidth:u,canvasHeight:f}=e,p=e.contigThickness*Pt,b=g=>o!==void 0&&!g.nodeIds.some(I=>o.nodeIds.has(I));return(0,B.jsx)("svg",{style:wo,width:u,height:f,"data-testid":"graph-bubble-halos",children:(0,B.jsx)("g",{transform:`translate(${l} ${d}) scale(${r} ${c})`,children:n.filter(g=>!g.whole).map(g=>(0,B.jsx)("path",{d:g.path,fill:"none",stroke:ae[g.kind],strokeOpacity:a&&ht(g.bubble,a)?.45:b(g)?.06:.22,strokeWidth:p,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},`${g.bubble.start}-${g.bubble.end}`))})})}),Vt=yo;function ko({color:t}){return(0,B.jsx)("svg",{width:18,height:10,style:{flex:"none"},children:(0,B.jsx)("line",{x1:5,y1:5,x2:13,y2:5,stroke:t,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"})})}var Kt=(0,Xe.observer)(function({model:e}){let n=new Map;for(let o of e.bubbleHalos)if(!o.whole){let a=ae[o.kind],r=n.get(a)??new Set;r.add(mt[o.kind]),n.set(a,r)}return n.size>0?(0,B.jsx)("div",{style:T,"data-testid":"graph-halo-legend",children:[...n].map(([o,a])=>(0,B.jsxs)("div",{style:w,children:[(0,B.jsx)(ko,{color:o}),(0,B.jsxs)("span",{children:["bubble: ",[...a].join(", ")]})]},o))}):null});var Le=s(N(),1);var Ce=s(We(),1),Ye=s(M(),1);var D=s(m(),1),te={width:18,height:8,borderRadius:2,flex:"none"},So={marginBottom:2},xo={...te,width:48};function ue({walk:t,label:e,reference:n,hint:o,at:a}){let r=Ct(t,n);return(0,D.jsxs)("div",{style:So,title:[r.hover,o].filter(Boolean).join(" \xB7 ")||void 0,children:[(0,D.jsxs)("div",{style:w,children:[(0,D.jsx)("div",{style:{...r.shades?xo:te,background:we(t.encoding)}}),(0,D.jsxs)("span",{children:[(0,D.jsx)("strong",{children:e}),r.delta,r.outside,r.reversed]})]}),a?(0,D.jsx)("div",{"data-testid":"graph-walk-at",children:a}):r.scale?(0,D.jsx)("div",{children:r.scale}):null]})}var A=s(N(),1);var Ro=1.1,Mo=100,Lo=40,Co=800,Po=10,Zt=2;function $e(t){let e=t.deltaY*(t.deltaMode===1?Lo:t.deltaMode===2?Co:1),n=(t.ctrlKey?Po:1)*e/Mo;return Ro**-Math.max(-Zt,Math.min(Zt,n))}var jt=s(ge(),1);function Me(t,e){(0,A.useEffect)(()=>{if(!t)return;let n=t;function o(a){if(e.hostPlacesX)return;e.host&&a.stopPropagation(),a.preventDefault();let r=n.getBoundingClientRect();e.zoom($e(a),a.clientX-r.left,a.clientY-r.top)}return n.addEventListener("wheel",o,{passive:!1}),()=>{n.removeEventListener("wheel",o)}},[t,e])}function Ut(t){let e=(0,A.useRef)({x:0,y:0}),n=(0,A.useRef)(!1),o=(0,A.useRef)({frame:0,pan:null,hover:null});(0,A.useEffect)(()=>()=>{cancelAnimationFrame(o.current.frame)},[]);let[a,r]=(0,A.useState)(void 0),[c,l]=(0,A.useState)(void 0);function d(h,k){return{x:(h-t.translateX)/t.scaleX,y:(k-t.translateY)/t.scaleY}}function u(h){let k=h.currentTarget.getBoundingClientRect();return d(h.clientX-k.left,h.clientY-k.top)}function f(h,k){let{nodePositions:R}=t,S=h*t.scaleX+t.translateX,W=k*t.scaleY+t.translateY;if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(S,W);let lt=t.referenceStripNodeAt(S,W);return lt||(R?ze(R,h,k,t.axisScale,t.positionsVersion,t.nodeInk):null)}function p(h){if(h.button===0){if(n.current=!1,t.hostPlacesX)return;t.host&&h.stopPropagation();let{x:k,y:R}=u(h),S=t.layoutResult?.tubeMap||h.nativeEvent.offsetY<t.referenceStripZonePx?null:f(k,R);S?t.setDraggingNode(S):t.setPanning(!0),e.current={x:h.clientX,y:h.clientY}}}function b(){let h=o.current;h.frame=0,h.pan&&(t.setTransform(t.scale,t.translateX+h.pan.dx,t.translateY+h.pan.dy),h.pan=null);let k=t.walkRowBars;if(h.hover&&k){let R=t.walkRowAt(h.hover.x,h.hover.y);t.setHoveredWalkRow(R===void 0?null:[k.reference,...k.rows][R].name)}if(h.hover&&t.nodePositions&&t.graph){let{x:R,y:S}=d(h.hover.x,h.hover.y);h.hover=null;let W=f(R,S);t.setHoveredNode(W),t.setHoveredEdge(W||t.layoutResult?.tubeMap?null:De(t.nodePositions,t.graph,R,S,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded))}}function g(){o.current.frame||(o.current.frame=requestAnimationFrame(b))}function I(){let h=o.current;cancelAnimationFrame(h.frame),h.frame=0,h.pan=null,h.hover=null}function E(h){let k=h.clientX-e.current.x,R=h.clientY-e.current.y;e.current={x:h.clientX,y:h.clientY},(Math.abs(k)>1||Math.abs(R)>1)&&(n.current=!0);let S=o.current;if(t.draggingNode)t.moveNode(t.draggingNode,k/t.scaleX,R/t.scaleY);else if(t.isPanning)S.pan={dx:(S.pan?.dx??0)+k,dy:(S.pan?.dy??0)+R},g();else{let W=h.currentTarget.getBoundingClientRect();S.hover={x:h.clientX-W.left,y:h.clientY-W.top},g()}}function G(){t.stopDragging()}function me(){I(),(0,jt.isAlive)(t)&&(t.stopDragging(),t.setHoveredNode(null),t.setHoveredEdge(null),t.setHoveredWalkRow(null))}function go(h){let{x:k,y:R}=u(h),S=f(k,R);if(S){h.preventDefault(),r({nodeId:S,top:h.clientY,left:h.clientX});return}let W=t.walkRowAt(k*t.scaleX+t.translateX,R*t.scaleY+t.translateY);W!==void 0&&(h.preventDefault(),l({row:W,top:h.clientY,left:h.clientX}))}function bo(h){if(!n.current){let{x:k,y:R}=u(h),S=f(k,R);t.setSelectedNode(S),S&&t.showNodeDetails(S)}}return{handlers:{onMouseDown:p,onMouseMove:E,onMouseUp:G,onMouseLeave:me,onClick:bo,onContextMenu:go},contextNode:a,contextRow:c,closeContextMenu:()=>{r(void 0),l(void 0)}}}var Y=s(m(),1),Eo={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:ut,lineHeight:"normal"},Io={height:ft,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Go=(0,Ye.observer)(function({model:e,lift:n,width:o,height:a,cell:r,handlers:c}){let[l,d]=(0,Le.useState)(null),u=n.walks[0];Me(l,e),(0,Le.useEffect)(()=>{if(!l)return;let p=new de(l);p.resize(o,a);let b=(0,Ce.computed)(()=>e.buildDrawing(n,!1)),g,I=(0,Ce.autorun)(()=>{let E=b.get();E&&(E!==g&&(p.uploadGeometry(E.batch),g=E),e.applyHighlights(p),e.paint(p))});return()=>{I(),p.dispose()}},[l,e,n,o,a]);let f=e.walkLabel(u.name);return(0,Y.jsxs)("div",{style:r,children:[(0,Y.jsx)("button",{type:"button",style:Io,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([u.name]),e.setFacet("")},children:(0,Y.jsx)(ue,{walk:u,label:f,reference:e.walkReference,hint:`click to lift ${f} alone`,at:e.hoveredOn(u)})}),(0,Y.jsx)("canvas",{ref:d,"data-testid":"graph-facet-canvas",style:{width:o,height:a,display:"block",cursor:e.isPanning||e.draggingNode?"grabbing":"grab"},...c})]})}),To=(0,Ye.observer)(function({model:e,handlers:n}){let o=e.facetPanels,a=e.facetGrid,r=e.facetPlacement;if(!o||!a||!r)return null;let{columns:c,width:l,height:d}=a;return(0,Y.jsx)("div",{"data-testid":"graph-facet-panels",style:{...Eo,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${c}, ${l}px)`,background:e.darkMode?"#1f1f1f":"white"},children:o.map((u,f)=>(0,Y.jsx)(Go,{model:e,lift:u,width:l,height:d,cell:{gridRow:Math.floor(r.cells[f]/c)+1,gridColumn:r.cells[f]%c+1},handlers:n},u.walks[0].name))})}),qt=To;var en=s(N(),1);var tn=s(M(),1);var Jt=s(N(),1);function Ho(t){return t==="class"?"className":/^(data|aria)-/.test(t)?t:t.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function Qt(t,e){if(typeof t=="string")return t;let n={key:e};for(let[o,a]of Object.entries(t.attrs))a!==void 0&&(n[Ho(o)]=a);return(0,Jt.createElement)(t.tag,n,...t.children.map(Qt))}function F({el:t}){return Qt(t,0)}var Ve=s(m(),1),Wo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},Bo=(0,tn.observer)(function({model:e}){let n=`exon-outline-${(0,en.useId)().replaceAll(/[^\w-]/g,"")}`,{genePins:o,walkLift:a,nodeInk:r}=e,{scaleX:c,scaleY:l,translateX:d,translateY:u,paneWidth:f,canvasHeight:p}=e,b=Oe(Ae(o,r.halfWidthPx,a),{id:n,width:f,height:p,transform:`translate(${d} ${u}) scale(${c} ${l})`});return b?(0,Ve.jsx)("svg",{style:Wo,width:f,height:p,"data-testid":"graph-gene-pins",children:(0,Ve.jsx)(F,{el:b})}):null}),nn=Bo;var on=s(m(),1),rn=(0,C.createSvgIcon)((0,on.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 Ke=s(m(),1),an=(0,C.createSvgIcon)([(0,Ke.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,Ke.jsx)("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var sn=s(m(),1),ln=(0,C.createSvgIcon)((0,sn.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 z=s(Q(),1),qe=s(M(),1),Tn=s(ie(),1);var V=s(Q(),1),cn=s(M(),1),pn=s(ie(),1),le=s(m(),1),_o=(0,pn.makeStyles)()({formControl:{minWidth:100}}),No=(0,cn.observer)(function({model:e}){let{classes:n}=_o(),o=e.colorSchemeLock;return(0,le.jsxs)(V.FormControl,{size:"small",className:n.formControl,disabled:o!==void 0,title:o?.why,children:[(0,le.jsx)(V.InputLabel,{children:"Color"}),(0,le.jsx)(V.Select,{value:e.chosenColorScheme,label:"Color",renderValue:o?()=>o.value:void 0,onChange:a=>{e.setColorScheme(a.target.value)},children:pt.map(({value:a,label:r})=>(0,le.jsx)(V.MenuItem,{value:a,children:r},a))})]})}),dn=No;var je=s(Q(),1),Ue=s(M(),1),un=s(ie(),1),ce=s(m(),1),fn=(0,un.makeStyles)()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function Ze(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Ao=(0,Ue.observer)(function({model:e}){let{classes:n}=fn(),{lastFetchMs:o,lastLayoutMs:a,lastGeometryMs:r}=e,c=o!==void 0||a!==void 0||r!==void 0;return e.showPerf&&c?(0,ce.jsxs)(je.Typography,{variant:"caption",className:n.perf,"data-testid":"graph-perf-stats",children:["fetch ",Ze(o)," \xB7 layout ",Ze(a)," \xB7 geom"," ",Ze(r)]}):null}),Oo=(0,Ue.observer)(function({model:e}){let{classes:n}=fn();return(0,ce.jsxs)("div",{className:n.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,ce.jsxs)(je.Typography,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",(0,ce.jsx)(Ao,{model:e})]})}),hn=Oo;var O=s(Q(),1),mn=s(M(),1),gn=s(ie(),1),K=s(m(),1),zo=(0,gn.makeStyles)()({formControl:{minWidth:150}}),Do=(0,mn.observer)(function({model:e}){let{classes:n}=zo(),{graph:o}=e;return(0,K.jsxs)(O.FormControl,{size:"small",className:n.formControl,children:[(0,K.jsx)(O.InputLabel,{children:"Layout"}),(0,K.jsx)(O.Select,{value:e.chosenLayoutMode,label:"Layout","data-testid":"graph-layout-select",onChange:a=>{e.switchLayout(a.target.value)},children:ct.map(({value:a,label:r,description:c,available:l})=>(0,K.jsx)(O.MenuItem,{value:a,disabled:o?!l(o):!1,children:(0,K.jsx)(O.Tooltip,{title:c,placement:"right",children:(0,K.jsx)("span",{children:r})})},a))})]})}),bn=Do;var X=s(Q(),1),vn=s(M(),1),wn=s(ie(),1),Z=s(m(),1),Fo=(0,wn.makeStyles)()({formControl:{minWidth:130,maxWidth:240}}),Xo=(0,vn.observer)(function({model:e}){let{classes:n}=Fo(),{repeatChoices:o}=e;if(e.chosenLayoutMode!=="walkrows"||o.length===0)return null;let a=new Set(o.map(r=>r.key));return(0,Z.jsxs)(X.FormControl,{size:"small",className:n.formControl,children:[(0,Z.jsx)(X.InputLabel,{children:"Repeat"}),(0,Z.jsxs)(X.Select,{value:a.has(e.repeatKey)?e.repeatKey:"",label:"Repeat","data-testid":"graph-repeat-select",onChange:r=>{e.setRepeatKey(r.target.value)},children:[(0,Z.jsx)(X.MenuItem,{value:"",children:(0,Z.jsx)("em",{children:"Whole window"})}),o.map(({key:r,name:c,unit:l})=>(0,Z.jsxs)(X.MenuItem,{value:r,children:[c," \xB7 ",l.toLocaleString()," bp unit"]},r))]})]})}),yn=Xo;var Mn=s(N(),1),Ln=s(Be(),1);var kn=s(m(),1),Sn=(0,C.createSvgIcon)((0,kn.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 xn=s(m(),1),Rn=(0,C.createSvgIcon)((0,xn.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 Cn=s(M(),1);var j=s(m(),1),$o=(0,Cn.observer)(function({model:e}){let[n,o]=(0,Mn.useState)(!1);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ln.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.toggleDeletionEdges()}},{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}},{type:"divider"},{label:"Settings",icon:zt,onClick:()=>{o(!0)}},{type:"divider"},{label:"Return to import form",icon:Sn,onClick:()=>{e.clearGraph()}}],children:(0,j.jsx)(Rn,{})}),(0,j.jsx)(Dt,{model:e,open:n,onClose:()=>{o(!1)}})]})}),Pn=$o;var H=s(Q(),1),En=s(M(),1),In=s(ie(),1),U=s(m(),1),Yo=(0,In.makeStyles)()({formControl:{minWidth:130,maxWidth:260}}),Vo=(0,En.observer)(function({model:e}){let{classes:n}=Yo(),{walkChoices:o}=e;if(o.length===0||!e.liftsWalks)return null;let a=new Set(o.map(l=>l.name)),r=new Map(o.map(l=>[l.name,l.label])),c=e.walkLayers.map(l=>l.walk).filter(l=>a.has(l));return(0,U.jsxs)(H.FormControl,{size:"small",className:n.formControl,children:[(0,U.jsx)(H.InputLabel,{children:"Walks"}),(0,U.jsx)(H.Select,{multiple:!0,value:c,label:"Walks","data-testid":"graph-walk-select",renderValue:l=>l.map(d=>r.get(d)).join(", "),onChange:l=>{let{value:d}=l.target;e.liftWalks(typeof d=="string"?d.split(","):d)},children:o.map(({name:l,label:d})=>(0,U.jsxs)(H.MenuItem,{value:l,dense:!0,children:[(0,U.jsx)(H.Checkbox,{size:"small",checked:c.includes(l)}),(0,U.jsx)(H.ListItemText,{primary:d})]},l))})]})}),Gn=Vo;var x=s(m(),1),Ko=(0,Tn.makeStyles)()({toolbar:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Zo=(0,qe.observer)(function({model:e}){return(0,x.jsx)(z.Typography,{variant:"body2",children:e.zoomPercent})}),jo=(0,qe.observer)(function({model:e}){let{classes:n}=Ko();return(0,x.jsxs)("div",{className:n.toolbar,children:[(0,x.jsx)(bn,{model:e}),(0,x.jsx)(dn,{model:e}),(0,x.jsx)(Gn,{model:e}),(0,x.jsx)(yn,{model:e}),(0,x.jsx)(z.Tooltip,{title:"Zoom in",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoom(1.5,e.viewBox.width/2,e.viewBox.height/2)},children:(0,x.jsx)(an,{})})}),(0,x.jsx)(z.Tooltip,{title:"Zoom out",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoom(1/1.5,e.viewBox.width/2,e.viewBox.height/2)},children:(0,x.jsx)(ln,{})})}),(0,x.jsx)(z.Tooltip,{title:"Zoom to fit",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoomToFit()},children:(0,x.jsx)(rn,{})})}),(0,x.jsx)(Zo,{model:e}),(0,x.jsx)(hn,{model:e}),(0,x.jsx)(Pn,{model:e})]})}),Hn=jo;var Bn=s(ge(),1),_n=s(M(),1);var ne=s(m(),1);function fe({x:t,y:e,w:n,text:o,note:a,color:r,edge:c=r,italic:l,small:d,dimmed:u,title:f,testId:p,onClick:b,onHover:g}){return(0,ne.jsxs)("g",{style:{pointerEvents:b||g?"auto":"none",cursor:b?"pointer":void 0,opacity:u?.35:1},"data-testid":p,onClick:b,onMouseEnter:()=>{g?.(!0)},onMouseLeave:()=>{g?.(!1)},children:[f?(0,ne.jsx)("title",{children:f}):null,(0,ne.jsx)("rect",{x:t-n/2,y:e-$-be+2,width:n,height:$+be*2-2,rx:3,fill:"rgba(255,255,255,0.85)",stroke:c,strokeWidth:d?.6:1}),(0,ne.jsxs)("text",{x:t,y:e,fontSize:d?$-1:$,fontFamily:"sans-serif",fontStyle:l?"italic":void 0,fontWeight:l?600:void 0,fill:r,textAnchor:"middle",children:[o,a?(0,ne.jsx)("tspan",{fontStyle:"normal",fontWeight:"normal",children:a}):null]})]})}var q=s(m(),1),Uo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:3},Wn="#1c1c22",qo=(0,_n.observer)(function({model:e}){let{bubbles:n,genes:o,routes:a}=e.overlayLabels;if(n.length+o.length+a.length===0)return null;let{walkLift:r,scaleY:c,translateY:l,contigThickness:d}=e,u=p=>r!==void 0&&!p.nodeIds.some(b=>r.nodeIds.has(b)),f=p=>r!==void 0&&!p.route.walks.some(b=>r.names.has(b));return(0,q.jsxs)("svg",{style:Uo,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-label-layer",children:[o.map(({item:p,x:b,y:g,w:I,text:E})=>{let{gene:G}=p,me=Et(p);return(0,q.jsxs)("g",{children:[(0,q.jsx)("line",{x1:b,x2:b,y1:g-$-2,y2:p.at.y*c+l+d/2,stroke:Wn,strokeWidth:.8,strokeOpacity:.6}),(0,q.jsx)(fe,{x:b,y:g,w:I,text:G.name,note:E.slice(G.name.length)||void 0,color:Wn,edge:se,italic:!0,title:`${G.name} ${G.refName}:${G.start.toLocaleString()}-${G.end.toLocaleString()}${me?`, ${me} in the cut`:""}`,testId:"graph-gene-pin-label"})]},`${G.name}-${G.start}`)}),a.map(({item:{halo:p,route:b},x:g,y:I,w:E,text:G})=>(0,q.jsx)(fe,{x:g,y:I,w:E,text:G,color:ae[p.kind],small:!0,dimmed:f(b),title:`${b.route.walks.length} walk(s): ${b.route.walks.join(", ")}`,testId:"graph-route-label"},`${p.bubble.start}-${p.bubble.end}-${b.route.steps.join(",")}`)),n.map(({item:p,x:b,y:g,w:I,text:E})=>(0,q.jsx)(fe,{x:b,y:g,w:I,text:E,color:ae[p.kind],dimmed:u(p),title:`${p.label}
|
|
2
|
-
${p.bubble.segmentCount} segments \xB7 click to open`,testId:"graph-bubble-halo-label",onClick:()=>{e.popBubble(p.bubble)},onHover:G=>{(0,Bn.isAlive)(e)&&e.setHoveredBubble(G?p.bubble:null)}},`${p.bubble.start}-${p.bubble.end}`))]})}),Nn=qo;var Pe=s(N(),1);var On=s(We(),1),Je=s(M(),1);var L=s(m(),1),Jo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:5},Qo=(0,Je.observer)(function({model:e}){let n=(0,Pe.useRef)(null),{referenceStripShown:o,paneWidth:a,canvasHeight:r}=e;return(0,Pe.useEffect)(()=>(0,On.autorun)(()=>{let c=n.current,l=e.referenceStripFrame,d=c?.getContext("2d");if(c&&d&&l&&e.referenceStripShown){let u=Se(),f=e.paneWidth,p=e.canvasHeight;c.width=Math.round(f*u),c.height=Math.round(p*u),d.setTransform(u,0,0,u,0,0),d.clearRect(0,0,f,p),Bt(d,e.referenceStripBlocks,l,{width:f,lit:e.referenceStripLit,darkMode:e.darkMode,dpr:u})}}),[e]),(0,L.jsx)("canvas",{ref:n,"data-testid":o?"graph-reference-strip":void 0,style:{...Jo,width:a,height:r,display:o?"block":"none"}})}),zn=Qo,Dn=18,er="linear-gradient(to right, hsl(0, 70%, 50%) 0 33%, hsl(120, 70%, 50%) 33% 61%, hsl(240, 70%, 50%) 61%)",tr=6;function nr(t){let e=t.filter((a,r)=>a!==t[r-1]),n=Math.min(tr,e.length),o=Array.from({length:n},(a,r)=>e[n>1?Math.round(r*(e.length-1)/(n-1)):0]);return o.length>1?`linear-gradient(to right, ${o.join(", ")})`:o[0]??pe}function An({rows:t}){return(0,L.jsx)("div",{style:{width:Dn,flex:"none"},children:t.map(({key:e,background:n})=>(0,L.jsx)("div",{style:{height:t.length>1?3:4,background:n}},e))})}function or(t){return t.walkLift?.walks.map(e=>({key:e.name,background:we(e.encoding)}))??[{key:"scheme",background:t.effectiveColorScheme==="reference-position"?er:nr(t.referenceStripBlocks.map(e=>e.colors[0]))}]}function rr(){return(0,L.jsx)("svg",{width:Dn,height:10,style:{flex:"none"},children:(0,L.jsx)("path",{d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"})})}var Fn=(0,Je.observer)(function({model:e}){let n=(e.walkLift?.walks.length??0)>1;return e.referenceStripShown?(0,L.jsxs)("div",{style:T,"data-testid":"graph-reference-strip-legend",children:[(0,L.jsxs)("div",{style:w,children:[(0,L.jsx)(An,{rows:or(e)}),(0,L.jsxs)("span",{children:["top strip: reference segments at their bp",n?", a row per walk":""]})]}),e.referenceStripFaded?(0,L.jsxs)("div",{style:w,children:[(0,L.jsx)(An,{rows:[{key:"pale",background:pe}]}),(0,L.jsxs)("span",{children:["reference not on"," ",n?"that row's walk":e.liftedWalksLabel]})]}):null,e.referenceStripOverhangs?(0,L.jsxs)("div",{style:w,children:[(0,L.jsx)(rr,{}),(0,L.jsx)("span",{children:"the graph draws reference past this edge"})]}):null]}):null});var Ie=s(N(),1);var $n=s(We(),1),et=s(M(),1);var v=s(m(),1),ar={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1},sr=(0,et.observer)(function({model:e}){let n=(0,Ie.useRef)(null),{tubeMapPicture:o,paneWidth:a,canvasHeight:r}=e;return(0,Ie.useEffect)(()=>(0,$n.autorun)(()=>{let c=n.current,l=e.tubeMapPicture,d=e.tubeMapFrame,u=c?.getContext("2d");if(c&&u&&l&&d){let f=Se(),p=e.paneWidth,b=e.canvasHeight;c.width=Math.round(p*f),c.height=Math.round(b*f),u.setTransform(f,0,0,f,0,0),u.clearRect(0,0,p,b);let g={...d,width:p,highlightNode:e.hoveredNode??e.selectedNode,darkMode:e.darkMode,tubeColors:e.tubeMapTubeColors,nodeColors:e.tubeMapNodeColors};Ht(u,l,g),Nt(u,e.tubeMapDeviations,g),Tt(u,e.tubeMapConnectors,e.connectorZoneBottom,g);let{bounds:I}=l;Wt(u,e.tubeMapGenes,g,d.y(I.minY)-2);let E=e.tubeMapRulerBoxes;E&&Gt(u,E,g,d.y(I.maxY)+4,e.layoutResult?.referenceAxis)}}),[e]),(0,v.jsx)("canvas",{ref:n,"data-testid":o?"graph-tube-map":void 0,style:{...ar,width:a,height:r,display:o?"block":"none"}})}),Yn=sr,Ee=18;function ir(){let t=[[.5,5.5],[8.5,Ee-.5]];return(0,v.jsx)("svg",{width:Ee,height:7,style:{flex:"none"},children:(0,v.jsx)("path",{d:t.map(([e,n])=>`M${e},6 V1.5 H${n} V6`).join(" "),fill:"none",stroke:It(),strokeWidth:1})})}var tt={width:Ee,height:7,flex:"none"},lr={...tt,display:"flex",justifyContent:"center",backgroundColor:"#b8b8c0"};function cr(){return(0,v.jsx)("div",{style:lr,children:(0,v.jsx)("div",{style:{width:2,backgroundColor:_t()}})})}function Xn({colors:t}){let e=100/t.length,n=t.map((o,a)=>`${o} ${a*e}% ${(a+1)*e}%`);return(0,v.jsx)("div",{style:{...tt,background:`linear-gradient(to right, ${n.join(", ")})`}})}var Qe={width:Ee,flex:"none",textAlign:"center",fontFamily:"monospace",fontSize:12};function pr(){return(0,v.jsx)("div",{style:{...tt,backgroundColor:"grey"}})}function J({swatch:t,children:e}){return(0,v.jsxs)("div",{style:w,children:[t,(0,v.jsx)("span",{children:e})]})}var Vn=(0,et.observer)(function({model:e}){let{logWidths:n,foldBp:o,forwardReads:a,reverseReads:r,mismatches:c}=e.tubeMapKeys,l=e.readsShown,d=l&&l.shown<l.total?l:void 0,u=[a&&(0,v.jsx)(J,{swatch:(0,v.jsx)(Xn,{colors:_e}),children:"read on the forward strand"},"fwd"),r&&(0,v.jsx)(J,{swatch:(0,v.jsx)(Xn,{colors:Ne}),children:"read on the reverse strand"},"rev"),d&&(0,v.jsxs)(J,{swatch:(0,v.jsx)("span",{style:Qe}),children:[d.shown.toLocaleString("en-US")," of"," ",d.total.toLocaleString("en-US")," reads shown"]},"sampled"),c.has("substitution")&&(0,v.jsx)(J,{swatch:(0,v.jsx)("span",{style:Qe,children:"A"}),children:"a read's base unlike the node's"},"sub"),c.has("insertion")&&(0,v.jsx)(J,{swatch:(0,v.jsx)("span",{style:Qe,children:"*"}),children:"bases a read inserts"},"ins"),c.has("deletion")&&(0,v.jsx)(J,{swatch:(0,v.jsx)(pr,{}),children:"bases a read skips"},"del"),o!==void 0&&(0,v.jsxs)(J,{swatch:(0,v.jsx)(cr,{}),children:["a haplotype's variant under ",ve(o)]},"fold"),n&&(0,v.jsx)(J,{swatch:(0,v.jsx)(ir,{}),children:"width grows with log of length"},"log")].filter(Boolean);return u.length>0?(0,v.jsx)("div",{style:T,"data-testid":"graph-tube-map-legend",children:u}):null});var Kn=s(Q(),1),Zn=s(M(),1),Un=s(m(),1),dr={position:"absolute",left:8,zIndex:5,background:"rgba(255,255,255,0.9)",textTransform:"none"},ur=(0,Zn.observer)(function({model:e}){let{poppedFrom:n}=e;return n?(0,Un.jsxs)(Kn.Button,{size:"small",variant:"outlined",style:{...dr,...e.facetPanels?{bottom:8}:{top:8}},"data-testid":"graph-unpop-bubble",onClick:()=>{e.unpopBubble()},children:["\u25C0 Back to ",n.label]}):null}),jn=ur;var to=s(Be(),1);var qn=s(m(),1),Jn=(0,C.createSvgIcon)((0,qn.jsx)("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var Qn=s(m(),1),eo=(0,C.createSvgIcon)((0,Qn.jsx)("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var no=s(M(),1);var oo=s(m(),1),Ge=(0,no.observer)(function({model:e,row:n,bars:o,top:a,left:r,onClose:c}){let l=o??e.walkRowBars,d=e.walkRowLaunchTarget(n,l),u=d?.assembly,f=n>0?l?.rows[n-1]?.sample:void 0,p=!o&&e.walkRowBars,b=e.walkRowSamples;return(0,oo.jsx)(to.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:a,left:r},onClose:()=>{c()},onMenuItemClick:g=>{g()},menuItems:[d&&u?{label:`Linear genome view \u2014 ${u} ${Re(d.location)}`,icon:Fe,onClick:()=>{e.showInLinearView({location:d.location,assembly:u})}}:{label:"Linear genome view",icon:Fe,disabled:!0,disabledHelpText:d?`No assembly in this session is ${d.location.haplotype??d.label}`:"This walk states no contig coordinates",onClick:()=>{}},...p&&f&&!(b?.length===1&&b[0]===f)?[{label:`Show only ${f}`,icon:Jn,onClick:()=>{e.setWalkRowSamples([f])}}]:[],...p&&b?[{label:"Show every sample",icon:eo,onClick:()=>{e.setWalkRowSamples(void 0)}}]:[]]})});var ro=s(N(),1);var ot=s(M(),1);var y=s(m(),1),hr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},Te={width:18,height:bt-4,borderRadius:2},mr={...Te,display:"flex",justifyContent:"center"};function nt({color:t}){return(0,y.jsx)("div",{style:mr,children:(0,y.jsx)("div",{style:{width:2,backgroundColor:t}})})}function rt({swatch:t}){return t.kind==="gene"?(0,y.jsx)("div",{style:{...Te,boxSizing:"border-box",border:`1.5px solid ${gt}`,borderRadius:0}}):(0,y.jsx)("div",{style:{...Te,height:t.kind==="gap"?vt:Te.height,background:t.fill}})}var ao=(0,ot.observer)(function({model:e}){let n=e.walkRowBars;if(!n)return null;let o=[n.reference,...n.rows].flatMap(r=>r.call??[]),a=ye(n,{ramp:e.referenceRampDomain,rampCss:ee,genes:e.walkRowGenes?.size?e.walkRowGeneGaps:void 0});return(0,y.jsxs)("div",{style:T,"data-testid":"graph-walk-rows-legend",children:[a.map(r=>r.note?(0,y.jsx)("div",{style:{color:"#666",fontStyle:"italic"},children:r.label},r.label):(0,y.jsxs)("div",{style:w,children:[(0,y.jsx)(rt,{swatch:r.swatch}),(0,y.jsx)("span",{children:r.label})]},r.label)),o.some(r=>r.spanningReads!==0)?(0,y.jsxs)("div",{style:w,children:[(0,y.jsx)(nt,{color:yt}),(0,y.jsx)("span",{children:"allele length called for this walk"})]}):null,o.some(r=>r.spanningReads===0)?(0,y.jsxs)("div",{style:w,children:[(0,y.jsx)(nt,{color:kt}),(0,y.jsx)("span",{children:"called with no read spanning it"})]}):null,o.some(r=>r.agrees===!1)?(0,y.jsxs)("div",{style:w,children:[(0,y.jsx)(nt,{color:St}),(0,y.jsxs)("span",{children:["walk and call over ",Math.round(.1*100),"% apart"]})]}):null]})}),gr=(0,ot.observer)(function({model:e}){let n=(0,ro.useId)().replace(/[^\w-]/g,""),o=e.walkRowBars;if(!o)return null;let{paneWidth:a,canvasHeight:r,walkRowPitch:c}=e,l=e.hoveredWalkRowText?[o.reference,...o.rows].findIndex(u=>u.name===e.hoveredWalkRow):-1,d=l>=0?[o.reference,...o.rows][l]:void 0;return(0,y.jsxs)("svg",{style:hr,width:a,height:r,"data-testid":"graph-walk-rows",children:[(0,y.jsx)(F,{el:ke(o,{scaleX:e.scaleX,scaleY:e.scaleY,translateX:e.translateX,translateY:e.translateY,width:a,height:r,...e.walkRowPitch},{ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,idPrefix:n})}),d&&c?(0,y.jsx)("rect",{"data-testid":"graph-walk-row-hovered",x:o.origin*e.scaleX+e.translateX-2,y:l*c.rowPx*e.scaleY+e.translateY-c.rowPx/2-1,width:d.bp*e.scaleX+4,height:c.rowPx+2,fill:"none",stroke:"#111",strokeWidth:1}):null]})}),so=gr;var oe=s(N(),1);var io=s(ge(),1),at=s(M(),1);var P=s(m(),1),br={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},vr={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},wr=(0,at.observer)(function({bars:e,frame:n,ramp:o,rowGenes:a}){let r=(0,oe.useId)().replace(/[^\w-]/g,""),c=(0,oe.useMemo)(()=>ke(e,n,{ramp:o,rowGenes:a,idPrefix:r}),[e,n,o,a,r]);return(0,P.jsx)(F,{el:c})}),yr=(0,at.observer)(function({model:e}){let n=e.walkStripRows,o=e.walkStripFrame,[a,r]=(0,oe.useState)(void 0),[c,l]=(0,oe.useState)(void 0);if(!n||!o)return null;let d=f=>{let p=f.currentTarget.getBoundingClientRect(),b=f.clientX-p.left,g=f.clientY-p.top;return{...xt(n,o,b,g),x:b,y:g}},u=ye(n,{ramp:e.referenceRampDomain,rampCss:ee,genes:Lt(o,e.walkRowGenes,e.walkRowGeneGaps)});return(0,P.jsxs)("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,io.isAlive)(e)&&(e.setPointerInPane(!1),e.setStripHover(null)),l(void 0)},children:[(0,P.jsxs)("svg",{width:o.width,height:o.height,style:{display:"block",cursor:"pointer"},onMouseMove:f=>{let p=d(f);p.row?(e.setStripHover({row:p.row.name,offset:p.offset}),l(o.labelled?void 0:{text:`${p.row.label} \xB7 ${wt(p.row,p.index===0?void 0:n.reference)}`,x:p.x,y:p.y})):(e.setStripHover(null),l(void 0))},onClick:f=>{let p=d(f);p.row&&p.index>0&&e.toggleWalk(p.row.name)},onContextMenu:f=>{let p=d(f);p.row&&(f.preventDefault(),r({row:p.index,top:f.clientY,left:f.clientX}))},children:[(0,P.jsx)(wr,{bars:n,frame:o,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),(0,P.jsx)(F,{el:Rt(n,o,e.walkStripMarks)}),(0,P.jsx)(F,{el:Mt(n,o,new Set(e.walkLayers.map(f=>f.walk)))})]}),c?(0,P.jsx)("div",{style:{...vr,left:c.x+12,top:c.y-18},children:c.text}):null,(0,P.jsxs)("div",{style:br,"data-testid":"graph-walk-strip-key",children:[u.map(f=>(0,P.jsxs)("div",{style:w,children:[(0,P.jsx)(rt,{swatch:f.swatch}),(0,P.jsx)("span",{children:f.label})]},f.label)),(0,P.jsx)("div",{style:w,children:(0,P.jsx)("span",{children:"\u25AE ticks: where each walk passes the node under the pointer \xB7 click a bar to lift its walk"})})]}),a?(0,P.jsx)(Ge,{model:e,row:a.row,bars:n,top:a.top,left:a.left,onClose:()=>{r(void 0)}}):null]})}),lo=yr;var co=s(M(),1),he=s(m(),1),kr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:4},Sr=(0,co.observer)(function({model:e}){let n=e.walkStripLocator;return n?(0,he.jsxs)("svg",{style:kr,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-walk-strip-locator",children:[(0,he.jsx)("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),(0,he.jsx)("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),po=Sr;function uo(t){return Promise.resolve(new de(t))}var i=s(m(),1),st={position:"absolute",bottom:8,right:8,background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6},xr={position:"relative"},Rr={position:"relative",lineHeight:0,isolation:"isolate"},Mr={position:"absolute",left:0,right:0,bottom:0,zIndex:0},Lr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Cr={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},Pr=(0,_.observer)(function({model:e}){let n=e.drawnRowLabels;return(0,i.jsx)(i.Fragment,{children:n.map(({label:o,y:a})=>{let r=a*e.scaleY+e.translateY;return r>=0&&r<=e.canvasHeight?(0,i.jsx)("div",{"data-testid":"graph-row-label",style:{...Cr,top:r},children:o},a):null})})}),Er={position:"absolute",top:xe,right:xe,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none",zIndex:4},Ir={width:18,height:3,borderRadius:2},Gr=(0,_.observer)(function({model:e}){let{pathLegend:n}=e;return n.length>0?(0,i.jsx)("div",{style:T,"data-testid":"graph-path-legend",children:n.map(({name:o,label:a,color:r})=>(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:{...Ir,backgroundColor:r}}),(0,i.jsx)("span",{children:a})]},o))}):null}),Tr=(0,_.observer)(function({model:e}){let n=e.walkLift;return n?(0,i.jsxs)("div",{style:T,"data-testid":"graph-walk-readout",children:[n.walks.map(o=>(0,i.jsx)(ue,{walk:o,label:e.walkLabel(o.name),reference:e.walkReference,at:e.hoveredOn(o)},o.name)),e.liftPaintsOffReference?(0,i.jsx)(ho,{}):null,(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:{...te,background:pe}}),(0,i.jsxs)("span",{children:["not on ",e.liftedWalksLabel]})]})]}):null}),Hr={minWidth:90,height:8,borderRadius:2,background:ee},Wr={display:"flex",justifyContent:"space-between",gap:8},Br=(0,_.observer)(function({model:e}){let n=e.walkLift?void 0:e.referenceRampDomain,{offReference:o,unplaced:a}=e.referenceRampOffKeys,r=Math.round(n?.start??0),c=Math.round(n?.end??0);return n?(0,i.jsxs)("div",{style:T,"data-testid":"graph-ramp-legend",children:[(0,i.jsx)("div",{style:Hr}),(0,i.jsxs)("div",{style:Wr,children:[(0,i.jsx)("span",{children:r.toLocaleString()}),(0,i.jsxs)("span",{children:["(",ve(c-r),")"]}),(0,i.jsx)("span",{children:c.toLocaleString()})]}),o?(0,i.jsx)(ho,{}):null,a?(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:{...te,background:_r}}),(0,i.jsx)("span",{children:"no reference position"})]}):null]}):null}),_r="rgb(160, 160, 160)";function ho(){return(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:{...te,background:dt}}),(0,i.jsx)("span",{children:"off the reference"})]})}var Nr={...te,border:`2px solid ${se}`,borderRadius:5,boxSizing:"border-box"},Ar=(0,_.observer)(function({model:e}){return e.genePins.some(n=>n.exonsByNode.length>0)?(0,i.jsx)("div",{style:T,"data-testid":"graph-gene-legend",children:(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:Nr}),(0,i.jsx)("span",{children:"exon"})]})}):null}),mo={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},Or={...mo,color:"#18181c",fontWeight:600},zr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:2},Dr=(0,_.observer)(function({model:e}){let n=(0,He.useRef)(null);return(0,He.useEffect)(()=>{let o=n.current;if(!o)return;let a=new ResizeObserver(()=>{(0,it.isAlive)(e)&&e.hoveredNode===null&&e.setLegendSize({width:o.offsetWidth,height:o.offsetHeight})});return a.observe(o),()=>{a.disconnect()}},[e]),(0,i.jsxs)("div",{ref:n,style:{...Er,top:xe+e.referenceStripZonePx},children:[(0,i.jsx)(Br,{model:e}),(0,i.jsx)(Fn,{model:e}),(0,i.jsx)(Kt,{model:e}),(0,i.jsx)(Ar,{model:e}),(0,i.jsx)(Gr,{model:e}),(0,i.jsx)(Vn,{model:e}),(0,i.jsx)(ao,{model:e}),(0,i.jsx)(Tr,{model:e})]})}),Fr=(0,_.observer)(function({model:e}){let n=e.overlayLabels.sizes,o=n.flatMap(({key:a,leader:r})=>r?[{key:a,...r}]:[]);return(0,i.jsxs)(i.Fragment,{children:[o.length>0?(0,i.jsx)("svg",{style:zr,width:e.paneWidth,height:e.canvasHeight,children:o.map(({key:a,arcX:r,arcY:c,labelX:l,labelY:d})=>(0,i.jsx)("line",{"data-testid":"graph-label-leader",x1:r,y1:c,x2:l,y2:d,stroke:"#18181c",strokeWidth:1},a))}):null,n.map(({key:a,text:r,x:c,y:l,kind:d})=>(0,i.jsx)("div",{"data-testid":"graph-size-label",style:{...d==="deletion"?Or:mo,left:c,top:l},children:r},a))]})}),Xr=(0,_.observer)(function({model:e}){let n=e.hoveredNode?e.nodeById?.get(e.hoveredNode):null,o=e.hoveredEdge!==null&&e.graph?e.graph.edges[e.hoveredEdge]:null,a=n?At(n):void 0,r=e.hoveredEdge===null?void 0:e.deletions.find(l=>l.edgeIndex===e.hoveredEdge),c=e.hoveredWalkRowText;return(0,i.jsxs)(i.Fragment,{children:[c&&!n?(0,i.jsxs)("div",{style:st,"data-testid":"graph-walk-row-tooltip",children:[(0,i.jsx)("strong",{children:c.label})," \u2014 ",c.readout]}):null,n?(0,i.jsxs)("div",{style:st,children:[(0,i.jsx)("strong",{children:n.name})," \u2014"," ",n.length.toLocaleString()," bp, depth"," ",n.depth.toFixed(1),a?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("br",{}),a.sample," ",Re(a)," (rank"," ",n.stable?.rank,")"]}):null]}):null,o?(0,i.jsx)("div",{style:st,children:r?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("strong",{children:"Deletion"})," ",r.bp.toLocaleString()," bp",(0,i.jsx)("br",{}),r.refName,":",r.start.toLocaleString(),"-",r.end.toLocaleString()]}):(0,i.jsxs)(i.Fragment,{children:["Edge: ",o.from," \u2192 ",o.to]})}):null]})}),$r=(0,_.observer)(function({model:e,nodeId:n,top:o,left:a,onClose:r}){let{own:c,reference:l,highlight:d}=e.nodeLaunchTargets(n);return(0,i.jsx)(re.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:o,left:a},onClose:()=>{r()},onMenuItemClick:u=>{u()},menuItems:[{label:"Node details",icon:Yt,onClick:()=>{e.showNodeDetails(n)}},...Ot({own:c,reference:l,highlight:d,onShowLinear:u=>{e.showInLinearView(u)},onHighlight:e.canHighlightInLinearView?u=>{e.highlightInLinearView(u)}:void 0})]})}),Yr=(0,_.observer)(function({model:e,ownChrome:n=!0}){let{canvasRef:o,canvas:a,error:r,retry:c}=(0,fo.useRenderingBackend)(uo,e),{handlers:l,contextNode:d,contextRow:u,closeContextMenu:f}=Ut(e);Me(a,e);let p=e.facetPanels!==void 0;return(0,i.jsxs)("div",{style:xr,children:[n?(0,i.jsx)(Hn,{model:e}):null,(0,i.jsxs)("div",{style:Rr,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,it.isAlive)(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?(0,i.jsx)("div",{style:{...Mr,top:e.referenceStripZonePx,background:e.paperCss}}):null,(0,i.jsx)("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{width:e.paneWidth,height:e.canvasHeight,cursor:e.isPanning||e.draggingNode?"grabbing":"grab",display:"block",position:"relative",zIndex:1},...l}),p?(0,i.jsx)(qt,{model:e,handlers:l}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Yn,{model:e}),(0,i.jsx)(zn,{model:e}),(0,i.jsx)(Pr,{model:e}),(0,i.jsx)(Fr,{model:e}),(0,i.jsx)(Vt,{model:e}),(0,i.jsx)(nn,{model:e}),(0,i.jsx)(Nn,{model:e}),(0,i.jsx)(so,{model:e}),(0,i.jsx)(po,{model:e}),(0,i.jsx)(Dr,{model:e})]}),(0,i.jsx)(jn,{model:e}),n?(0,i.jsx)("div",{style:Lr,children:(0,i.jsx)(re.LoadingOverlay,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null]}),e.walkStripShown?(0,i.jsx)(lo,{model:e}):null,(0,i.jsx)(Xr,{model:e}),d?(0,i.jsx)($r,{model:e,nodeId:d.nodeId,top:d.top,left:d.left,onClose:f}):null,u?(0,i.jsx)(Ge,{model:e,row:u.row,top:u.top,left:u.left,onClose:f}):null,r?(0,i.jsx)(re.ErrorBanner,{error:r,onReset:c}):null,n&&e.error?(0,i.jsx)(re.ErrorBanner,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),wl=Yr;export{wl as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as Dt}from"./chunk-5AOGDAVJ.js";import{$ as St,Ca as It,D as we,Da as Gt,E as ut,F as ft,Ha as Tt,Ja as Ht,M as ae,N as mt,P as ee,Pa as Wt,R as gt,S as bt,T as vt,U as wt,Va as Bt,Xa as _t,Y as ye,Ya as Nt,Z as yt,_ as kt,_a as At,a as C,b as We,ca as ke,db as Re,eb as Fe,f as _e,g as Ne,ga as xt,gb as Ot,ha as Rt,hb as zt,ia as Mt,ja as Lt,ka as Se,la as de,m as ct,ma as se,na as Ae,oa as Oe,qa as Ct,r as pe,s as dt,sa as ze,ua as De,va as Pt,wa as xe,xa as Et}from"./chunk-G54OD5EP.js";import{T as pt,b as $,d as be,fa as ie,z as ve}from"./chunk-SZTJRDEL.js";import{b as ht}from"./chunk-MD4VWZQN.js";import{a as ge}from"./chunk-FCWXYIFC.js";import{a as N}from"./chunk-J6KYLXRD.js";import{a as m,b as Be,c as M,d as Q}from"./chunk-TYJTJGPO.js";import{a as vo,b as s}from"./chunk-FY3BTKY4.js";var Xt=vo((fa,Ft)=>{Ft.exports=JBrowseExports["@jbrowse/render-core/useRenderingBackend"]});var He=s(N(),1);var re=s(Be(),1),it=s(ge(),1),fo=s(Xt(),1);var $t=s(m(),1),Yt=(0,C.createSvgIcon)((0,$t.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 _=s(M(),1);var Xe=s(M(),1);var T={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},w={display:"flex",alignItems:"center",gap:5};var B=s(m(),1),wo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},yo=(0,Xe.observer)(function({model:e}){let{bubbleHalos:n,walkLift:o,hoveredBubble:a}=e;if(n.length===0)return null;let{scaleX:r,scaleY:c,translateX:l,translateY:d,paneWidth:u,canvasHeight:f}=e,p=e.contigThickness*Pt,b=g=>o!==void 0&&!g.nodeIds.some(I=>o.nodeIds.has(I));return(0,B.jsx)("svg",{style:wo,width:u,height:f,"data-testid":"graph-bubble-halos",children:(0,B.jsx)("g",{transform:`translate(${l} ${d}) scale(${r} ${c})`,children:n.filter(g=>!g.whole).map(g=>(0,B.jsx)("path",{d:g.path,fill:"none",stroke:ae[g.kind],strokeOpacity:a&&ht(g.bubble,a)?.45:b(g)?.06:.22,strokeWidth:p,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},`${g.bubble.start}-${g.bubble.end}`))})})}),Vt=yo;function ko({color:t}){return(0,B.jsx)("svg",{width:18,height:10,style:{flex:"none"},children:(0,B.jsx)("line",{x1:5,y1:5,x2:13,y2:5,stroke:t,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"})})}var Kt=(0,Xe.observer)(function({model:e}){let n=new Map;for(let o of e.bubbleHalos)if(!o.whole){let a=ae[o.kind],r=n.get(a)??new Set;r.add(mt[o.kind]),n.set(a,r)}return n.size>0?(0,B.jsx)("div",{style:T,"data-testid":"graph-halo-legend",children:[...n].map(([o,a])=>(0,B.jsxs)("div",{style:w,children:[(0,B.jsx)(ko,{color:o}),(0,B.jsxs)("span",{children:["bubble: ",[...a].join(", ")]})]},o))}):null});var Le=s(N(),1);var Ce=s(We(),1),Ye=s(M(),1);var D=s(m(),1),te={width:18,height:8,borderRadius:2,flex:"none"},So={marginBottom:2},xo={...te,width:48};function ue({walk:t,label:e,reference:n,hint:o,at:a}){let r=Ct(t,n);return(0,D.jsxs)("div",{style:So,title:[r.hover,o].filter(Boolean).join(" \xB7 ")||void 0,children:[(0,D.jsxs)("div",{style:w,children:[(0,D.jsx)("div",{style:{...r.shades?xo:te,background:we(t.encoding)}}),(0,D.jsxs)("span",{children:[(0,D.jsx)("strong",{children:e}),r.delta,r.outside,r.reversed]})]}),a?(0,D.jsx)("div",{"data-testid":"graph-walk-at",children:a}):r.scale?(0,D.jsx)("div",{children:r.scale}):null]})}var A=s(N(),1);var Ro=1.1,Mo=100,Lo=40,Co=800,Po=10,Zt=2;function $e(t){let e=t.deltaY*(t.deltaMode===1?Lo:t.deltaMode===2?Co:1),n=(t.ctrlKey?Po:1)*e/Mo;return Ro**-Math.max(-Zt,Math.min(Zt,n))}var jt=s(ge(),1);function Me(t,e){(0,A.useEffect)(()=>{if(!t)return;let n=t;function o(a){if(e.hostPlacesX)return;e.host&&a.stopPropagation(),a.preventDefault();let r=n.getBoundingClientRect();e.zoom($e(a),a.clientX-r.left,a.clientY-r.top)}return n.addEventListener("wheel",o,{passive:!1}),()=>{n.removeEventListener("wheel",o)}},[t,e])}function Ut(t){let e=(0,A.useRef)({x:0,y:0}),n=(0,A.useRef)(!1),o=(0,A.useRef)({frame:0,pan:null,hover:null});(0,A.useEffect)(()=>()=>{cancelAnimationFrame(o.current.frame)},[]);let[a,r]=(0,A.useState)(void 0),[c,l]=(0,A.useState)(void 0);function d(h,k){return{x:(h-t.translateX)/t.scaleX,y:(k-t.translateY)/t.scaleY}}function u(h){let k=h.currentTarget.getBoundingClientRect();return d(h.clientX-k.left,h.clientY-k.top)}function f(h,k){let{nodePositions:R}=t,S=h*t.scaleX+t.translateX,W=k*t.scaleY+t.translateY;if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(S,W);let lt=t.referenceStripNodeAt(S,W);return lt||(R?ze(R,h,k,t.axisScale,t.positionsVersion,t.nodeInk):null)}function p(h){if(h.button===0){if(n.current=!1,t.hostPlacesX)return;t.host&&h.stopPropagation();let{x:k,y:R}=u(h),S=t.layoutResult?.tubeMap||h.nativeEvent.offsetY<t.referenceStripZonePx?null:f(k,R);S?t.setDraggingNode(S):t.setPanning(!0),e.current={x:h.clientX,y:h.clientY}}}function b(){let h=o.current;h.frame=0,h.pan&&(t.setTransform(t.scale,t.translateX+h.pan.dx,t.translateY+h.pan.dy),h.pan=null);let k=t.walkRowBars;if(h.hover&&k){let R=t.walkRowAt(h.hover.x,h.hover.y);t.setHoveredWalkRow(R===void 0?null:[k.reference,...k.rows][R].name)}if(h.hover&&t.nodePositions&&t.graph){let{x:R,y:S}=d(h.hover.x,h.hover.y);h.hover=null;let W=f(R,S);t.setHoveredNode(W),t.setHoveredEdge(W||t.layoutResult?.tubeMap?null:De(t.nodePositions,t.graph,R,S,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded))}}function g(){o.current.frame||(o.current.frame=requestAnimationFrame(b))}function I(){let h=o.current;cancelAnimationFrame(h.frame),h.frame=0,h.pan=null,h.hover=null}function E(h){let k=h.clientX-e.current.x,R=h.clientY-e.current.y;e.current={x:h.clientX,y:h.clientY},(Math.abs(k)>1||Math.abs(R)>1)&&(n.current=!0);let S=o.current;if(t.draggingNode)t.moveNode(t.draggingNode,k/t.scaleX,R/t.scaleY);else if(t.isPanning)S.pan={dx:(S.pan?.dx??0)+k,dy:(S.pan?.dy??0)+R},g();else{let W=h.currentTarget.getBoundingClientRect();S.hover={x:h.clientX-W.left,y:h.clientY-W.top},g()}}function G(){t.stopDragging()}function me(){I(),(0,jt.isAlive)(t)&&(t.stopDragging(),t.setHoveredNode(null),t.setHoveredEdge(null),t.setHoveredWalkRow(null))}function go(h){let{x:k,y:R}=u(h),S=f(k,R);if(S){h.preventDefault(),r({nodeId:S,top:h.clientY,left:h.clientX});return}let W=t.walkRowAt(k*t.scaleX+t.translateX,R*t.scaleY+t.translateY);W!==void 0&&(h.preventDefault(),l({row:W,top:h.clientY,left:h.clientX}))}function bo(h){if(!n.current){let{x:k,y:R}=u(h),S=f(k,R);t.setSelectedNode(S),S&&t.showNodeDetails(S)}}return{handlers:{onMouseDown:p,onMouseMove:E,onMouseUp:G,onMouseLeave:me,onClick:bo,onContextMenu:go},contextNode:a,contextRow:c,closeContextMenu:()=>{r(void 0),l(void 0)}}}var Y=s(m(),1),Eo={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:ut,lineHeight:"normal"},Io={height:ft,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Go=(0,Ye.observer)(function({model:e,lift:n,width:o,height:a,cell:r,handlers:c}){let[l,d]=(0,Le.useState)(null),u=n.walks[0];Me(l,e),(0,Le.useEffect)(()=>{if(!l)return;let p=new de(l);p.resize(o,a);let b=(0,Ce.computed)(()=>e.buildDrawing(n,!1)),g,I=(0,Ce.autorun)(()=>{let E=b.get();E&&(E!==g&&(p.uploadGeometry(E.batch),g=E),e.applyHighlights(p),e.paint(p))});return()=>{I(),p.dispose()}},[l,e,n,o,a]);let f=e.walkLabel(u.name);return(0,Y.jsxs)("div",{style:r,children:[(0,Y.jsx)("button",{type:"button",style:Io,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([u.name]),e.setFacet("")},children:(0,Y.jsx)(ue,{walk:u,label:f,reference:e.walkReference,hint:`click to lift ${f} alone`,at:e.hoveredOn(u)})}),(0,Y.jsx)("canvas",{ref:d,"data-testid":"graph-facet-canvas",style:{width:o,height:a,display:"block",cursor:e.isPanning||e.draggingNode?"grabbing":"grab"},...c})]})}),To=(0,Ye.observer)(function({model:e,handlers:n}){let o=e.facetPanels,a=e.facetGrid,r=e.facetPlacement;if(!o||!a||!r)return null;let{columns:c,width:l,height:d}=a;return(0,Y.jsx)("div",{"data-testid":"graph-facet-panels",style:{...Eo,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${c}, ${l}px)`,background:e.darkMode?"#1f1f1f":"white"},children:o.map((u,f)=>(0,Y.jsx)(Go,{model:e,lift:u,width:l,height:d,cell:{gridRow:Math.floor(r.cells[f]/c)+1,gridColumn:r.cells[f]%c+1},handlers:n},u.walks[0].name))})}),qt=To;var en=s(N(),1);var tn=s(M(),1);var Jt=s(N(),1);function Ho(t){return t==="class"?"className":/^(data|aria)-/.test(t)?t:t.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function Qt(t,e){if(typeof t=="string")return t;let n={key:e};for(let[o,a]of Object.entries(t.attrs))a!==void 0&&(n[Ho(o)]=a);return(0,Jt.createElement)(t.tag,n,...t.children.map(Qt))}function F({el:t}){return Qt(t,0)}var Ve=s(m(),1),Wo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},Bo=(0,tn.observer)(function({model:e}){let n=`exon-outline-${(0,en.useId)().replaceAll(/[^\w-]/g,"")}`,{genePins:o,walkLift:a,nodeInk:r}=e,{scaleX:c,scaleY:l,translateX:d,translateY:u,paneWidth:f,canvasHeight:p}=e,b=Oe(Ae(o,r.halfWidthPx,a),{id:n,width:f,height:p,transform:`translate(${d} ${u}) scale(${c} ${l})`});return b?(0,Ve.jsx)("svg",{style:Wo,width:f,height:p,"data-testid":"graph-gene-pins",children:(0,Ve.jsx)(F,{el:b})}):null}),nn=Bo;var on=s(m(),1),rn=(0,C.createSvgIcon)((0,on.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 Ke=s(m(),1),an=(0,C.createSvgIcon)([(0,Ke.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,Ke.jsx)("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var sn=s(m(),1),ln=(0,C.createSvgIcon)((0,sn.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 z=s(Q(),1),qe=s(M(),1),Tn=s(ie(),1);var V=s(Q(),1),cn=s(M(),1),pn=s(ie(),1),le=s(m(),1),_o=(0,pn.makeStyles)()({formControl:{minWidth:100}}),No=(0,cn.observer)(function({model:e}){let{classes:n}=_o(),o=e.colorSchemeLock;return(0,le.jsxs)(V.FormControl,{size:"small",className:n.formControl,disabled:o!==void 0,title:o?.why,children:[(0,le.jsx)(V.InputLabel,{children:"Color"}),(0,le.jsx)(V.Select,{value:e.chosenColorScheme,label:"Color",renderValue:o?()=>o.value:void 0,onChange:a=>{e.setColorScheme(a.target.value)},children:pt.map(({value:a,label:r})=>(0,le.jsx)(V.MenuItem,{value:a,children:r},a))})]})}),dn=No;var je=s(Q(),1),Ue=s(M(),1),un=s(ie(),1),ce=s(m(),1),fn=(0,un.makeStyles)()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function Ze(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Ao=(0,Ue.observer)(function({model:e}){let{classes:n}=fn(),{lastFetchMs:o,lastLayoutMs:a,lastGeometryMs:r}=e,c=o!==void 0||a!==void 0||r!==void 0;return e.showPerf&&c?(0,ce.jsxs)(je.Typography,{variant:"caption",className:n.perf,"data-testid":"graph-perf-stats",children:["fetch ",Ze(o)," \xB7 layout ",Ze(a)," \xB7 geom"," ",Ze(r)]}):null}),Oo=(0,Ue.observer)(function({model:e}){let{classes:n}=fn();return(0,ce.jsxs)("div",{className:n.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,ce.jsxs)(je.Typography,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",(0,ce.jsx)(Ao,{model:e})]})}),hn=Oo;var O=s(Q(),1),mn=s(M(),1),gn=s(ie(),1),K=s(m(),1),zo=(0,gn.makeStyles)()({formControl:{minWidth:150}}),Do=(0,mn.observer)(function({model:e}){let{classes:n}=zo(),{graph:o}=e;return(0,K.jsxs)(O.FormControl,{size:"small",className:n.formControl,children:[(0,K.jsx)(O.InputLabel,{children:"Layout"}),(0,K.jsx)(O.Select,{value:e.chosenLayoutMode,label:"Layout","data-testid":"graph-layout-select",onChange:a=>{e.switchLayout(a.target.value)},children:ct.map(({value:a,label:r,description:c,available:l})=>(0,K.jsx)(O.MenuItem,{value:a,disabled:o?!l(o):!1,children:(0,K.jsx)(O.Tooltip,{title:c,placement:"right",children:(0,K.jsx)("span",{children:r})})},a))})]})}),bn=Do;var X=s(Q(),1),vn=s(M(),1),wn=s(ie(),1),Z=s(m(),1),Fo=(0,wn.makeStyles)()({formControl:{minWidth:130,maxWidth:240}}),Xo=(0,vn.observer)(function({model:e}){let{classes:n}=Fo(),{repeatChoices:o}=e;if(e.chosenLayoutMode!=="walkrows"||o.length===0)return null;let a=new Set(o.map(r=>r.key));return(0,Z.jsxs)(X.FormControl,{size:"small",className:n.formControl,children:[(0,Z.jsx)(X.InputLabel,{children:"Repeat"}),(0,Z.jsxs)(X.Select,{value:a.has(e.repeatKey)?e.repeatKey:"",label:"Repeat","data-testid":"graph-repeat-select",onChange:r=>{e.setRepeatKey(r.target.value)},children:[(0,Z.jsx)(X.MenuItem,{value:"",children:(0,Z.jsx)("em",{children:"Whole window"})}),o.map(({key:r,name:c,unit:l})=>(0,Z.jsxs)(X.MenuItem,{value:r,children:[c," \xB7 ",l.toLocaleString()," bp unit"]},r))]})]})}),yn=Xo;var Mn=s(N(),1),Ln=s(Be(),1);var kn=s(m(),1),Sn=(0,C.createSvgIcon)((0,kn.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 xn=s(m(),1),Rn=(0,C.createSvgIcon)((0,xn.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 Cn=s(M(),1);var j=s(m(),1),$o=(0,Cn.observer)(function({model:e}){let[n,o]=(0,Mn.useState)(!1);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ln.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.toggleDeletionEdges()}},{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}},{type:"divider"},{label:"Settings",icon:zt,onClick:()=>{o(!0)}},{type:"divider"},{label:"Return to import form",icon:Sn,onClick:()=>{e.clearGraph()}}],children:(0,j.jsx)(Rn,{})}),(0,j.jsx)(Dt,{model:e,open:n,onClose:()=>{o(!1)}})]})}),Pn=$o;var H=s(Q(),1),En=s(M(),1),In=s(ie(),1),U=s(m(),1),Yo=(0,In.makeStyles)()({formControl:{minWidth:130,maxWidth:260}}),Vo=(0,En.observer)(function({model:e}){let{classes:n}=Yo(),{walkChoices:o}=e;if(o.length===0||!e.liftsWalks)return null;let a=new Set(o.map(l=>l.name)),r=new Map(o.map(l=>[l.name,l.label])),c=e.walkLayers.map(l=>l.walk).filter(l=>a.has(l));return(0,U.jsxs)(H.FormControl,{size:"small",className:n.formControl,children:[(0,U.jsx)(H.InputLabel,{children:"Walks"}),(0,U.jsx)(H.Select,{multiple:!0,value:c,label:"Walks","data-testid":"graph-walk-select",renderValue:l=>l.map(d=>r.get(d)).join(", "),onChange:l=>{let{value:d}=l.target;e.liftWalks(typeof d=="string"?d.split(","):d)},children:o.map(({name:l,label:d})=>(0,U.jsxs)(H.MenuItem,{value:l,dense:!0,children:[(0,U.jsx)(H.Checkbox,{size:"small",checked:c.includes(l)}),(0,U.jsx)(H.ListItemText,{primary:d})]},l))})]})}),Gn=Vo;var x=s(m(),1),Ko=(0,Tn.makeStyles)()({toolbar:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Zo=(0,qe.observer)(function({model:e}){return(0,x.jsx)(z.Typography,{variant:"body2",children:e.zoomPercent})}),jo=(0,qe.observer)(function({model:e}){let{classes:n}=Ko();return(0,x.jsxs)("div",{className:n.toolbar,children:[(0,x.jsx)(bn,{model:e}),(0,x.jsx)(dn,{model:e}),(0,x.jsx)(Gn,{model:e}),(0,x.jsx)(yn,{model:e}),(0,x.jsx)(z.Tooltip,{title:"Zoom in",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoom(1.5,e.viewBox.width/2,e.viewBox.height/2)},children:(0,x.jsx)(an,{})})}),(0,x.jsx)(z.Tooltip,{title:"Zoom out",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoom(1/1.5,e.viewBox.width/2,e.viewBox.height/2)},children:(0,x.jsx)(ln,{})})}),(0,x.jsx)(z.Tooltip,{title:"Zoom to fit",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoomToFit()},children:(0,x.jsx)(rn,{})})}),(0,x.jsx)(Zo,{model:e}),(0,x.jsx)(hn,{model:e}),(0,x.jsx)(Pn,{model:e})]})}),Hn=jo;var Bn=s(ge(),1),_n=s(M(),1);var ne=s(m(),1);function fe({x:t,y:e,w:n,text:o,note:a,color:r,edge:c=r,italic:l,small:d,dimmed:u,title:f,testId:p,onClick:b,onHover:g}){return(0,ne.jsxs)("g",{style:{pointerEvents:b||g?"auto":"none",cursor:b?"pointer":void 0,opacity:u?.35:1},"data-testid":p,onClick:b,onMouseEnter:()=>{g?.(!0)},onMouseLeave:()=>{g?.(!1)},children:[f?(0,ne.jsx)("title",{children:f}):null,(0,ne.jsx)("rect",{x:t-n/2,y:e-$-be+2,width:n,height:$+be*2-2,rx:3,fill:"rgba(255,255,255,0.85)",stroke:c,strokeWidth:d?.6:1}),(0,ne.jsxs)("text",{x:t,y:e,fontSize:d?$-1:$,fontFamily:"sans-serif",fontStyle:l?"italic":void 0,fontWeight:l?600:void 0,fill:r,textAnchor:"middle",children:[o,a?(0,ne.jsx)("tspan",{fontStyle:"normal",fontWeight:"normal",children:a}):null]})]})}var q=s(m(),1),Uo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:3},Wn="#1c1c22",qo=(0,_n.observer)(function({model:e}){let{bubbles:n,genes:o,routes:a}=e.overlayLabels;if(n.length+o.length+a.length===0)return null;let{walkLift:r,scaleY:c,translateY:l,contigThickness:d}=e,u=p=>r!==void 0&&!p.nodeIds.some(b=>r.nodeIds.has(b)),f=p=>r!==void 0&&!p.route.walks.some(b=>r.names.has(b));return(0,q.jsxs)("svg",{style:Uo,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-label-layer",children:[o.map(({item:p,x:b,y:g,w:I,text:E})=>{let{gene:G}=p,me=Et(p);return(0,q.jsxs)("g",{children:[(0,q.jsx)("line",{x1:b,x2:b,y1:g-$-2,y2:p.at.y*c+l+d/2,stroke:Wn,strokeWidth:.8,strokeOpacity:.6}),(0,q.jsx)(fe,{x:b,y:g,w:I,text:G.name,note:E.slice(G.name.length)||void 0,color:Wn,edge:se,italic:!0,title:`${G.name} ${G.refName}:${G.start.toLocaleString()}-${G.end.toLocaleString()}${me?`, ${me} in the cut`:""}`,testId:"graph-gene-pin-label"})]},`${G.name}-${G.start}`)}),a.map(({item:{halo:p,route:b},x:g,y:I,w:E,text:G})=>(0,q.jsx)(fe,{x:g,y:I,w:E,text:G,color:ae[p.kind],small:!0,dimmed:f(b),title:`${b.route.walks.length} walk(s): ${b.route.walks.join(", ")}`,testId:"graph-route-label"},`${p.bubble.start}-${p.bubble.end}-${b.route.steps.join(",")}`)),n.map(({item:p,x:b,y:g,w:I,text:E})=>(0,q.jsx)(fe,{x:b,y:g,w:I,text:E,color:ae[p.kind],dimmed:u(p),title:`${p.label}
|
|
2
|
+
${p.bubble.segmentCount} segments \xB7 click to open`,testId:"graph-bubble-halo-label",onClick:()=>{e.popBubble(p.bubble)},onHover:G=>{(0,Bn.isAlive)(e)&&e.setHoveredBubble(G?p.bubble:null)}},`${p.bubble.start}-${p.bubble.end}`))]})}),Nn=qo;var Pe=s(N(),1);var On=s(We(),1),Je=s(M(),1);var L=s(m(),1),Jo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:5},Qo=(0,Je.observer)(function({model:e}){let n=(0,Pe.useRef)(null),{referenceStripShown:o,paneWidth:a,canvasHeight:r}=e;return(0,Pe.useEffect)(()=>(0,On.autorun)(()=>{let c=n.current,l=e.referenceStripFrame,d=c?.getContext("2d");if(c&&d&&l&&e.referenceStripShown){let u=Se(),f=e.paneWidth,p=e.canvasHeight;c.width=Math.round(f*u),c.height=Math.round(p*u),d.setTransform(u,0,0,u,0,0),d.clearRect(0,0,f,p),Bt(d,e.referenceStripBlocks,l,{width:f,lit:e.referenceStripLit,darkMode:e.darkMode,dpr:u})}}),[e]),(0,L.jsx)("canvas",{ref:n,"data-testid":o?"graph-reference-strip":void 0,style:{...Jo,width:a,height:r,display:o?"block":"none"}})}),zn=Qo,Dn=18,er="linear-gradient(to right, hsl(0, 70%, 50%) 0 33%, hsl(120, 70%, 50%) 33% 61%, hsl(240, 70%, 50%) 61%)",tr=6;function nr(t){let e=t.filter((a,r)=>a!==t[r-1]),n=Math.min(tr,e.length),o=Array.from({length:n},(a,r)=>e[n>1?Math.round(r*(e.length-1)/(n-1)):0]);return o.length>1?`linear-gradient(to right, ${o.join(", ")})`:o[0]??pe}function An({rows:t}){return(0,L.jsx)("div",{style:{width:Dn,flex:"none"},children:t.map(({key:e,background:n})=>(0,L.jsx)("div",{style:{height:t.length>1?3:4,background:n}},e))})}function or(t){return t.walkLift?.walks.map(e=>({key:e.name,background:we(e.encoding)}))??[{key:"scheme",background:t.effectiveColorScheme==="reference-position"?er:nr(t.referenceStripBlocks.map(e=>e.colors[0]))}]}function rr(){return(0,L.jsx)("svg",{width:Dn,height:10,style:{flex:"none"},children:(0,L.jsx)("path",{d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"})})}var Fn=(0,Je.observer)(function({model:e}){let n=(e.walkLift?.walks.length??0)>1;return e.referenceStripShown?(0,L.jsxs)("div",{style:T,"data-testid":"graph-reference-strip-legend",children:[(0,L.jsxs)("div",{style:w,children:[(0,L.jsx)(An,{rows:or(e)}),(0,L.jsxs)("span",{children:["top strip: reference segments at their bp",n?", a row per walk":""]})]}),e.referenceStripFaded?(0,L.jsxs)("div",{style:w,children:[(0,L.jsx)(An,{rows:[{key:"pale",background:pe}]}),(0,L.jsxs)("span",{children:["reference not on"," ",n?"that row's walk":e.liftedWalksLabel]})]}):null,e.referenceStripOverhangs?(0,L.jsxs)("div",{style:w,children:[(0,L.jsx)(rr,{}),(0,L.jsx)("span",{children:"the graph draws reference past this edge"})]}):null]}):null});var Ie=s(N(),1);var $n=s(We(),1),et=s(M(),1);var v=s(m(),1),ar={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1},sr=(0,et.observer)(function({model:e}){let n=(0,Ie.useRef)(null),{tubeMapPicture:o,paneWidth:a,canvasHeight:r}=e;return(0,Ie.useEffect)(()=>(0,$n.autorun)(()=>{let c=n.current,l=e.tubeMapPicture,d=e.tubeMapFrame,u=c?.getContext("2d");if(c&&u&&l&&d){let f=Se(),p=e.paneWidth,b=e.canvasHeight;c.width=Math.round(p*f),c.height=Math.round(b*f),u.setTransform(f,0,0,f,0,0),u.clearRect(0,0,p,b);let g={...d,width:p,highlightNode:e.hoveredNode??e.selectedNode,darkMode:e.darkMode,tubeColors:e.tubeMapTubeColors,nodeColors:e.tubeMapNodeColors};Ht(u,l,g),Nt(u,e.tubeMapDeviations,g),Tt(u,e.tubeMapConnectors,e.connectorZoneBottom,g);let{bounds:I}=l;Wt(u,e.tubeMapGenes,g,d.y(I.minY)-2);let E=e.tubeMapRulerBoxes;E&&Gt(u,E,g,d.y(I.maxY)+4,e.layoutResult?.referenceAxis)}}),[e]),(0,v.jsx)("canvas",{ref:n,"data-testid":o?"graph-tube-map":void 0,style:{...ar,width:a,height:r,display:o?"block":"none"}})}),Yn=sr,Ee=18;function ir(){let t=[[.5,5.5],[8.5,Ee-.5]];return(0,v.jsx)("svg",{width:Ee,height:7,style:{flex:"none"},children:(0,v.jsx)("path",{d:t.map(([e,n])=>`M${e},6 V1.5 H${n} V6`).join(" "),fill:"none",stroke:It(),strokeWidth:1})})}var tt={width:Ee,height:7,flex:"none"},lr={...tt,display:"flex",justifyContent:"center",backgroundColor:"#b8b8c0"};function cr(){return(0,v.jsx)("div",{style:lr,children:(0,v.jsx)("div",{style:{width:2,backgroundColor:_t()}})})}function Xn({colors:t}){let e=100/t.length,n=t.map((o,a)=>`${o} ${a*e}% ${(a+1)*e}%`);return(0,v.jsx)("div",{style:{...tt,background:`linear-gradient(to right, ${n.join(", ")})`}})}var Qe={width:Ee,flex:"none",textAlign:"center",fontFamily:"monospace",fontSize:12};function pr(){return(0,v.jsx)("div",{style:{...tt,backgroundColor:"grey"}})}function J({swatch:t,children:e}){return(0,v.jsxs)("div",{style:w,children:[t,(0,v.jsx)("span",{children:e})]})}var Vn=(0,et.observer)(function({model:e}){let{logWidths:n,foldBp:o,forwardReads:a,reverseReads:r,mismatches:c}=e.tubeMapKeys,l=e.readsShown,d=l&&l.shown<l.total?l:void 0,u=[a&&(0,v.jsx)(J,{swatch:(0,v.jsx)(Xn,{colors:_e}),children:"read on the forward strand"},"fwd"),r&&(0,v.jsx)(J,{swatch:(0,v.jsx)(Xn,{colors:Ne}),children:"read on the reverse strand"},"rev"),d&&(0,v.jsxs)(J,{swatch:(0,v.jsx)("span",{style:Qe}),children:[d.shown.toLocaleString("en-US")," of"," ",d.total.toLocaleString("en-US")," reads shown"]},"sampled"),c.has("substitution")&&(0,v.jsx)(J,{swatch:(0,v.jsx)("span",{style:Qe,children:"A"}),children:"a read's base unlike the node's"},"sub"),c.has("insertion")&&(0,v.jsx)(J,{swatch:(0,v.jsx)("span",{style:Qe,children:"*"}),children:"bases a read inserts"},"ins"),c.has("deletion")&&(0,v.jsx)(J,{swatch:(0,v.jsx)(pr,{}),children:"bases a read skips"},"del"),o!==void 0&&(0,v.jsxs)(J,{swatch:(0,v.jsx)(cr,{}),children:["a haplotype's variant under ",ve(o)]},"fold"),n&&(0,v.jsx)(J,{swatch:(0,v.jsx)(ir,{}),children:"width grows with log of length"},"log")].filter(Boolean);return u.length>0?(0,v.jsx)("div",{style:T,"data-testid":"graph-tube-map-legend",children:u}):null});var Kn=s(Q(),1),Zn=s(M(),1),Un=s(m(),1),dr={position:"absolute",left:8,zIndex:5,background:"rgba(255,255,255,0.9)",textTransform:"none"},ur=(0,Zn.observer)(function({model:e}){let{poppedFrom:n}=e;return n?(0,Un.jsxs)(Kn.Button,{size:"small",variant:"outlined",style:{...dr,...e.facetPanels?{bottom:8}:{top:8}},"data-testid":"graph-unpop-bubble",onClick:()=>{e.unpopBubble()},children:["\u25C0 Back to ",n.label]}):null}),jn=ur;var to=s(Be(),1);var qn=s(m(),1),Jn=(0,C.createSvgIcon)((0,qn.jsx)("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var Qn=s(m(),1),eo=(0,C.createSvgIcon)((0,Qn.jsx)("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var no=s(M(),1);var oo=s(m(),1),Ge=(0,no.observer)(function({model:e,row:n,bars:o,top:a,left:r,onClose:c}){let l=o??e.walkRowBars,d=e.walkRowLaunchTarget(n,l),u=d?.assembly,f=n>0?l?.rows[n-1]?.sample:void 0,p=!o&&e.walkRowBars,b=e.walkRowSamples;return(0,oo.jsx)(to.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:a,left:r},onClose:()=>{c()},onMenuItemClick:g=>{g()},menuItems:[d&&u?{label:`Linear genome view \u2014 ${u} ${Re(d.location)}`,icon:Fe,onClick:()=>{e.showInLinearView({location:d.location,assembly:u})}}:{label:"Linear genome view",icon:Fe,disabled:!0,disabledHelpText:d?`No assembly in this session is ${d.location.haplotype??d.label}`:"This walk states no contig coordinates",onClick:()=>{}},...p&&f&&!(b?.length===1&&b[0]===f)?[{label:`Show only ${f}`,icon:Jn,onClick:()=>{e.setWalkRowSamples([f])}}]:[],...p&&b?[{label:"Show every sample",icon:eo,onClick:()=>{e.setWalkRowSamples(void 0)}}]:[]]})});var ro=s(N(),1);var ot=s(M(),1);var y=s(m(),1),hr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},Te={width:18,height:bt-4,borderRadius:2},mr={...Te,display:"flex",justifyContent:"center"};function nt({color:t}){return(0,y.jsx)("div",{style:mr,children:(0,y.jsx)("div",{style:{width:2,backgroundColor:t}})})}function rt({swatch:t}){return t.kind==="gene"?(0,y.jsx)("div",{style:{...Te,boxSizing:"border-box",border:`1.5px solid ${gt}`,borderRadius:0}}):(0,y.jsx)("div",{style:{...Te,height:t.kind==="gap"?vt:Te.height,background:t.fill}})}var ao=(0,ot.observer)(function({model:e}){let n=e.walkRowBars;if(!n)return null;let o=[n.reference,...n.rows].flatMap(r=>r.call??[]),a=ye(n,{ramp:e.referenceRampDomain,rampCss:ee,genes:e.walkRowGeneKey});return(0,y.jsxs)("div",{style:T,"data-testid":"graph-walk-rows-legend",children:[a.map(r=>r.note?(0,y.jsx)("div",{style:{color:"#666",fontStyle:"italic"},children:r.label},r.label):(0,y.jsxs)("div",{style:w,children:[(0,y.jsx)(rt,{swatch:r.swatch}),(0,y.jsx)("span",{children:r.label})]},r.label)),o.some(r=>r.spanningReads!==0)?(0,y.jsxs)("div",{style:w,children:[(0,y.jsx)(nt,{color:yt}),(0,y.jsx)("span",{children:"allele length called for this walk"})]}):null,o.some(r=>r.spanningReads===0)?(0,y.jsxs)("div",{style:w,children:[(0,y.jsx)(nt,{color:kt}),(0,y.jsx)("span",{children:"called with no read spanning it"})]}):null,o.some(r=>r.agrees===!1)?(0,y.jsxs)("div",{style:w,children:[(0,y.jsx)(nt,{color:St}),(0,y.jsxs)("span",{children:["walk and call over ",Math.round(.1*100),"% apart"]})]}):null]})}),gr=(0,ot.observer)(function({model:e}){let n=(0,ro.useId)().replace(/[^\w-]/g,""),o=e.walkRowBars;if(!o)return null;let{paneWidth:a,canvasHeight:r,walkRowPitch:c}=e,l=e.hoveredWalkRowText?[o.reference,...o.rows].findIndex(u=>u.name===e.hoveredWalkRow):-1,d=l>=0?[o.reference,...o.rows][l]:void 0;return(0,y.jsxs)("svg",{style:hr,width:a,height:r,"data-testid":"graph-walk-rows",children:[(0,y.jsx)(F,{el:ke(o,{scaleX:e.scaleX,scaleY:e.scaleY,translateX:e.translateX,translateY:e.translateY,width:a,height:r,...e.walkRowPitch},{ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,idPrefix:n})}),d&&c?(0,y.jsx)("rect",{"data-testid":"graph-walk-row-hovered",x:o.origin*e.scaleX+e.translateX-2,y:l*c.rowPx*e.scaleY+e.translateY-c.rowPx/2-1,width:d.bp*e.scaleX+4,height:c.rowPx+2,fill:"none",stroke:"#111",strokeWidth:1}):null]})}),so=gr;var oe=s(N(),1);var io=s(ge(),1),at=s(M(),1);var P=s(m(),1),br={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},vr={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},wr=(0,at.observer)(function({bars:e,frame:n,ramp:o,rowGenes:a}){let r=(0,oe.useId)().replace(/[^\w-]/g,""),c=(0,oe.useMemo)(()=>ke(e,n,{ramp:o,rowGenes:a,idPrefix:r}),[e,n,o,a,r]);return(0,P.jsx)(F,{el:c})}),yr=(0,at.observer)(function({model:e}){let n=e.walkStripRows,o=e.walkStripFrame,[a,r]=(0,oe.useState)(void 0),[c,l]=(0,oe.useState)(void 0);if(!n||!o)return null;let d=f=>{let p=f.currentTarget.getBoundingClientRect(),b=f.clientX-p.left,g=f.clientY-p.top;return{...xt(n,o,b,g),x:b,y:g}},u=ye(n,{ramp:e.referenceRampDomain,rampCss:ee,genes:Lt(o,e.walkRowGenes,e.walkRowGeneGaps)});return(0,P.jsxs)("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,io.isAlive)(e)&&(e.setPointerInPane(!1),e.setStripHover(null)),l(void 0)},children:[(0,P.jsxs)("svg",{width:o.width,height:o.height,style:{display:"block",cursor:"pointer"},onMouseMove:f=>{let p=d(f);p.row?(e.setStripHover({row:p.row.name,offset:p.offset}),l(o.labelled?void 0:{text:`${p.row.label} \xB7 ${wt(p.row,p.index===0?void 0:n.reference)}`,x:p.x,y:p.y})):(e.setStripHover(null),l(void 0))},onClick:f=>{let p=d(f);p.row&&p.index>0&&e.toggleWalk(p.row.name)},onContextMenu:f=>{let p=d(f);p.row&&(f.preventDefault(),r({row:p.index,top:f.clientY,left:f.clientX}))},children:[(0,P.jsx)(wr,{bars:n,frame:o,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),(0,P.jsx)(F,{el:Rt(n,o,e.walkStripMarks)}),(0,P.jsx)(F,{el:Mt(n,o,new Set(e.walkLayers.map(f=>f.walk)))})]}),c?(0,P.jsx)("div",{style:{...vr,left:c.x+12,top:c.y-18},children:c.text}):null,(0,P.jsxs)("div",{style:br,"data-testid":"graph-walk-strip-key",children:[u.map(f=>(0,P.jsxs)("div",{style:w,children:[(0,P.jsx)(rt,{swatch:f.swatch}),(0,P.jsx)("span",{children:f.label})]},f.label)),(0,P.jsx)("div",{style:w,children:(0,P.jsx)("span",{children:"\u25AE ticks: where each walk passes the node under the pointer \xB7 click a bar to lift its walk"})})]}),a?(0,P.jsx)(Ge,{model:e,row:a.row,bars:n,top:a.top,left:a.left,onClose:()=>{r(void 0)}}):null]})}),lo=yr;var co=s(M(),1),he=s(m(),1),kr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:4},Sr=(0,co.observer)(function({model:e}){let n=e.walkStripLocator;return n?(0,he.jsxs)("svg",{style:kr,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-walk-strip-locator",children:[(0,he.jsx)("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),(0,he.jsx)("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),po=Sr;function uo(t){return Promise.resolve(new de(t))}var i=s(m(),1),st={position:"absolute",bottom:8,right:8,background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6},xr={position:"relative"},Rr={position:"relative",lineHeight:0,isolation:"isolate"},Mr={position:"absolute",left:0,right:0,bottom:0,zIndex:0},Lr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Cr={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},Pr=(0,_.observer)(function({model:e}){let n=e.drawnRowLabels;return(0,i.jsx)(i.Fragment,{children:n.map(({label:o,y:a})=>{let r=a*e.scaleY+e.translateY;return r>=0&&r<=e.canvasHeight?(0,i.jsx)("div",{"data-testid":"graph-row-label",style:{...Cr,top:r},children:o},a):null})})}),Er={position:"absolute",top:xe,right:xe,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none",zIndex:4},Ir={width:18,height:3,borderRadius:2},Gr=(0,_.observer)(function({model:e}){let{pathLegend:n}=e;return n.length>0?(0,i.jsx)("div",{style:T,"data-testid":"graph-path-legend",children:n.map(({name:o,label:a,color:r})=>(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:{...Ir,backgroundColor:r}}),(0,i.jsx)("span",{children:a})]},o))}):null}),Tr=(0,_.observer)(function({model:e}){let n=e.walkLift;return n?(0,i.jsxs)("div",{style:T,"data-testid":"graph-walk-readout",children:[n.walks.map(o=>(0,i.jsx)(ue,{walk:o,label:e.walkLabel(o.name),reference:e.walkReference,at:e.hoveredOn(o)},o.name)),e.liftPaintsOffReference?(0,i.jsx)(ho,{}):null,(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:{...te,background:pe}}),(0,i.jsxs)("span",{children:["not on ",e.liftedWalksLabel]})]})]}):null}),Hr={minWidth:90,height:8,borderRadius:2,background:ee},Wr={display:"flex",justifyContent:"space-between",gap:8},Br=(0,_.observer)(function({model:e}){let n=e.walkLift?void 0:e.referenceRampDomain,{offReference:o,unplaced:a}=e.referenceRampOffKeys,r=Math.round(n?.start??0),c=Math.round(n?.end??0);return n?(0,i.jsxs)("div",{style:T,"data-testid":"graph-ramp-legend",children:[(0,i.jsx)("div",{style:Hr}),(0,i.jsxs)("div",{style:Wr,children:[(0,i.jsx)("span",{children:r.toLocaleString()}),(0,i.jsxs)("span",{children:["(",ve(c-r),")"]}),(0,i.jsx)("span",{children:c.toLocaleString()})]}),o?(0,i.jsx)(ho,{}):null,a?(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:{...te,background:_r}}),(0,i.jsx)("span",{children:"no reference position"})]}):null]}):null}),_r="rgb(160, 160, 160)";function ho(){return(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:{...te,background:dt}}),(0,i.jsx)("span",{children:"off the reference"})]})}var Nr={...te,border:`2px solid ${se}`,borderRadius:5,boxSizing:"border-box"},Ar=(0,_.observer)(function({model:e}){return e.genePins.some(n=>n.exonsByNode.length>0)?(0,i.jsx)("div",{style:T,"data-testid":"graph-gene-legend",children:(0,i.jsxs)("div",{style:w,children:[(0,i.jsx)("div",{style:Nr}),(0,i.jsx)("span",{children:"exon"})]})}):null}),mo={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},Or={...mo,color:"#18181c",fontWeight:600},zr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:2},Dr=(0,_.observer)(function({model:e}){let n=(0,He.useRef)(null);return(0,He.useEffect)(()=>{let o=n.current;if(!o)return;let a=new ResizeObserver(()=>{(0,it.isAlive)(e)&&e.hoveredNode===null&&e.setLegendSize({width:o.offsetWidth,height:o.offsetHeight})});return a.observe(o),()=>{a.disconnect()}},[e]),(0,i.jsxs)("div",{ref:n,style:{...Er,top:xe+e.referenceStripZonePx},children:[(0,i.jsx)(Br,{model:e}),(0,i.jsx)(Fn,{model:e}),(0,i.jsx)(Kt,{model:e}),(0,i.jsx)(Ar,{model:e}),(0,i.jsx)(Gr,{model:e}),(0,i.jsx)(Vn,{model:e}),(0,i.jsx)(ao,{model:e}),(0,i.jsx)(Tr,{model:e})]})}),Fr=(0,_.observer)(function({model:e}){let n=e.overlayLabels.sizes,o=n.flatMap(({key:a,leader:r})=>r?[{key:a,...r}]:[]);return(0,i.jsxs)(i.Fragment,{children:[o.length>0?(0,i.jsx)("svg",{style:zr,width:e.paneWidth,height:e.canvasHeight,children:o.map(({key:a,arcX:r,arcY:c,labelX:l,labelY:d})=>(0,i.jsx)("line",{"data-testid":"graph-label-leader",x1:r,y1:c,x2:l,y2:d,stroke:"#18181c",strokeWidth:1},a))}):null,n.map(({key:a,text:r,x:c,y:l,kind:d})=>(0,i.jsx)("div",{"data-testid":"graph-size-label",style:{...d==="deletion"?Or:mo,left:c,top:l},children:r},a))]})}),Xr=(0,_.observer)(function({model:e}){let n=e.hoveredNode?e.nodeById?.get(e.hoveredNode):null,o=e.hoveredEdge!==null&&e.graph?e.graph.edges[e.hoveredEdge]:null,a=n?At(n):void 0,r=e.hoveredEdge===null?void 0:e.deletions.find(l=>l.edgeIndex===e.hoveredEdge),c=e.hoveredWalkRowText;return(0,i.jsxs)(i.Fragment,{children:[c&&!n?(0,i.jsxs)("div",{style:st,"data-testid":"graph-walk-row-tooltip",children:[(0,i.jsx)("strong",{children:c.label})," \u2014 ",c.readout]}):null,n?(0,i.jsxs)("div",{style:st,children:[(0,i.jsx)("strong",{children:n.name})," \u2014"," ",n.length.toLocaleString()," bp, depth"," ",n.depth.toFixed(1),a?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("br",{}),a.sample," ",Re(a)," (rank"," ",n.stable?.rank,")"]}):null]}):null,o?(0,i.jsx)("div",{style:st,children:r?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("strong",{children:"Deletion"})," ",r.bp.toLocaleString()," bp",(0,i.jsx)("br",{}),r.refName,":",r.start.toLocaleString(),"-",r.end.toLocaleString()]}):(0,i.jsxs)(i.Fragment,{children:["Edge: ",o.from," \u2192 ",o.to]})}):null]})}),$r=(0,_.observer)(function({model:e,nodeId:n,top:o,left:a,onClose:r}){let{own:c,reference:l,highlight:d}=e.nodeLaunchTargets(n);return(0,i.jsx)(re.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:o,left:a},onClose:()=>{r()},onMenuItemClick:u=>{u()},menuItems:[{label:"Node details",icon:Yt,onClick:()=>{e.showNodeDetails(n)}},...Ot({own:c,reference:l,highlight:d,onShowLinear:u=>{e.showInLinearView(u)},onHighlight:e.canHighlightInLinearView?u=>{e.highlightInLinearView(u)}:void 0})]})}),Yr=(0,_.observer)(function({model:e,ownChrome:n=!0}){let{canvasRef:o,canvas:a,error:r,retry:c}=(0,fo.useRenderingBackend)(uo,e),{handlers:l,contextNode:d,contextRow:u,closeContextMenu:f}=Ut(e);Me(a,e);let p=e.facetPanels!==void 0;return(0,i.jsxs)("div",{style:xr,children:[n?(0,i.jsx)(Hn,{model:e}):null,(0,i.jsxs)("div",{style:Rr,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,it.isAlive)(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?(0,i.jsx)("div",{style:{...Mr,top:e.referenceStripZonePx,background:e.paperCss}}):null,(0,i.jsx)("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{width:e.paneWidth,height:e.canvasHeight,cursor:e.isPanning||e.draggingNode?"grabbing":"grab",display:"block",position:"relative",zIndex:1},...l}),p?(0,i.jsx)(qt,{model:e,handlers:l}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Yn,{model:e}),(0,i.jsx)(zn,{model:e}),(0,i.jsx)(Pr,{model:e}),(0,i.jsx)(Fr,{model:e}),(0,i.jsx)(Vt,{model:e}),(0,i.jsx)(nn,{model:e}),(0,i.jsx)(Nn,{model:e}),(0,i.jsx)(so,{model:e}),(0,i.jsx)(po,{model:e}),(0,i.jsx)(Dr,{model:e})]}),(0,i.jsx)(jn,{model:e}),n?(0,i.jsx)("div",{style:Lr,children:(0,i.jsx)(re.LoadingOverlay,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null]}),e.walkStripShown?(0,i.jsx)(lo,{model:e}):null,(0,i.jsx)(Xr,{model:e}),d?(0,i.jsx)($r,{model:e,nodeId:d.nodeId,top:d.top,left:d.left,onClose:f}):null,u?(0,i.jsx)(Ge,{model:e,row:u.row,top:u.top,left:u.left,onClose:f}):null,r?(0,i.jsx)(re.ErrorBanner,{error:r,onReset:c}):null,n&&e.error?(0,i.jsx)(re.ErrorBanner,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),wl=Yr;export{wl as a};
|
|
3
|
+
//# sourceMappingURL=chunk-EAK4DAP4.js.map
|