jbrowse-plugin-graphgenomeviewer 4.0.3 → 4.0.5
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/AddTrackWorkflow-I4EPGFPJ.js +2 -0
- package/dist/chunks/{AddTrackWorkflow-TPCKXM2H.js.map → AddTrackWorkflow-I4EPGFPJ.js.map} +2 -2
- package/dist/chunks/{GraphGenomeView-WPKSNN4I.js → GraphGenomeView-BQYWWF6Z.js} +2 -2
- package/dist/chunks/LinearGraphDisplay-7O3VQHKU.js +2 -0
- package/dist/chunks/{LinearGraphDisplay-7POYIRIB.js.map → LinearGraphDisplay-7O3VQHKU.js.map} +2 -2
- package/dist/chunks/chunk-5WJPRX4N.js +2 -0
- package/dist/chunks/{chunk-A4ZWFDQY.js.map → chunk-5WJPRX4N.js.map} +2 -2
- package/dist/chunks/{chunk-SDTCVLC3.js → chunk-RSAY56Y4.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +3 -3
- package/package.json +1 -1
- package/src/GraphAddTrackWorkflow/buildTrackConfig.test.ts +4 -0
- package/src/GraphAddTrackWorkflow/buildTrackConfig.ts +13 -1
- package/src/GraphGenomeView/host.test.ts +41 -0
- package/src/GraphGenomeView/host.ts +38 -9
- package/src/GraphGenomeView/layoutModes.ts +10 -0
- package/src/GraphGenomeView/model.ts +15 -4
- package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +27 -2
- package/src/LinearGraphDisplay/components/LinearGraphDisplay.tsx +1 -0
- package/src/hoverSync/graphViewHighlights.test.ts +21 -0
- package/src/hoverSync/graphViewHighlights.ts +26 -0
- package/src/version.ts +1 -1
- package/dist/chunks/AddTrackWorkflow-TPCKXM2H.js +0 -2
- package/dist/chunks/LinearGraphDisplay-7POYIRIB.js +0 -2
- package/dist/chunks/chunk-A4ZWFDQY.js +0 -2
- /package/dist/chunks/{GraphGenomeView-WPKSNN4I.js.map → GraphGenomeView-BQYWWF6Z.js.map} +0 -0
- /package/dist/chunks/{chunk-SDTCVLC3.js.map → chunk-RSAY56Y4.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as z}from"./chunk-FCWXYIFC.js";import{a as $}from"./chunk-D7XFR2IV.js";import{a as H}from"./chunk-J4OLMLS5.js";import{a as x,b as j,c as O,d as J,e as U}from"./chunk-XEJ47DLD.js";import{a as W,b as r}from"./chunk-FY3BTKY4.js";var C=W((Z,T)=>{T.exports=JBrowseExports["@jbrowse/core/util/tss-react"]});var c=r(U(),1),p=r(J(),1),m=r(H(),1),B=r(C(),1),E=r(z(),1),i=r(O(),1),P=r(j(),1);var b=r($(),1),G={RgfaTabixAdapter:"rGFA segments (tabix BED pair)",MinigraphBubbleAdapter:"Minigraph bubbles (tabix BED)"},S={RgfaTabixAdapter:"Path to segments BED (.segs.bed.gz from build_rgfa_tabix.sh; the .links.bed.gz and both .tbi are assumed beside it)",MinigraphBubbleAdapter:"Path to bubbles BED (.bed.gz from gfatools bubble; the .tbi is assumed beside it)"},u=".segs.bed.gz";function f(t){return"uri"in t?t.uri:"localPath"in t?t.localPath:""}function X(t){let e=f(t);if(!e.endsWith(u))throw new Error(`Expected a segments BED ending in ${u}, got ${e||"a blob"}`);let a=`${e.slice(0,-u.length)}.links.bed.gz`;return"uri"in t?{...t,uri:a}:"localPath"in t?{...t,localPath:a}:t}function A(t,e){return e?{location:e,indexType:(0,b.makeIndexType)(f(e),"CSI","TBI")}:{location:(0,b.makeIndex)(t,".tbi"),indexType:"TBI"}}function q(t,e){return e!==void 0&&f(e).endsWith(".csi")?{location:(0,b.makeIndex)(t,".csi"),indexType:"CSI"}:{location:(0,b.makeIndex)(t,".tbi"),indexType:"TBI"}}function I(t,e){let a=e.trim();return a?{assemblyNameToPanSN:{[t]:a}}:{}}function K({choice:t,loc:e,indexLoc:a,assembly:s,sample:l}){if(t==="MinigraphBubbleAdapter")return{type:"MinigraphBubbleAdapter",bubblesLocation:e,index:A(e,a),...I(s,l)};let d=X(e);return{type:"RgfaTabixAdapter",segmentsLocation:e,segmentsIndex:A(e,a),linksLocation:d,linksIndex:q(d,a),...I(s,l)}}function R(t){let{choice:e,assembly:a,trackId:s,name:l}=t;return{type:"FeatureTrack",trackId:s,name:l,assemblyNames:[a],adapter:K(t),...e==="RgfaTabixAdapter"?{displays:[{type:"LinearGraphDisplay",displayId:`${s}-LinearGraphDisplay`},{type:"LinearBasicDisplay",displayId:`${s}-LinearBasicDisplay`}],displayDefaults:{showLabels:"none"}}:{}}}var n=r(x(),1),Q=(0,B.makeStyles)()(t=>({paper:{margin:t.spacing(),padding:t.spacing()},field:{marginTop:t.spacing(2)},submit:{marginTop:25,marginBottom:100,display:"block"}})),V=["RgfaTabixAdapter","MinigraphBubbleAdapter"],Y=(0,P.observer)(function({model:e}){let{classes:a}=Q(),s=(0,m.getSession)(e),l=(0,E.getRoot)(e),[d,M]=(0,c.useState)("RgfaTabixAdapter"),[h,N]=(0,c.useState)(),[y,D]=(0,c.useState)(),[F,v]=(0,c.useState)(""),[g,w]=(0,c.useState)("Pangenome graph"),[L,k]=(0,c.useState)();function _(){if(!(!h||!e.assembly))try{k(void 0);let o=g.trim();(0,m.addTrackFromWidget)({model:e,session:s,conf:R({choice:d,loc:h,indexLoc:y,assembly:e.assembly,sample:F,trackId:(0,m.makeTrackId)({name:o}),name:o})})}catch(o){k(o)}}return(0,n.jsxs)(i.Paper,{className:a.paper,children:[L?(0,n.jsx)(p.ErrorMessage,{error:L}):null,(0,n.jsxs)(i.FormControl,{children:[(0,n.jsx)(i.FormLabel,{children:"File type"}),(0,n.jsx)(i.RadioGroup,{value:d,onChange:o=>{M(o.target.value)},children:V.map(o=>(0,n.jsx)(i.FormControlLabel,{value:o,control:(0,n.jsx)(i.Radio,{}),label:G[o]},o))})]}),(0,n.jsx)(p.FileSelector,{location:h,name:S[d],rootModel:l,setLocation:N}),(0,n.jsx)(p.FileSelector,{location:y,name:"Path to tabix index (optional; the sibling .tbi is assumed, a .csi is recognised by name)",rootModel:l,setLocation:D}),(0,n.jsx)(i.TextField,{className:a.field,value:F,onChange:o=>{v(o.target.value)},label:"Sample name in the graph",slotProps:{htmlInput:{"data-testid":"graph-sample-input"}},helperText:"Optional. The PanSN prefix the graph gives this assembly, e.g. GRCh38 for HPRC's GRCh38#0#chr1; leave blank when the graph's stable names are bare",placeholder:"GRCh38",fullWidth:!0}),(0,n.jsx)(i.TextField,{className:a.field,value:g,helperText:"Track name",slotProps:{htmlInput:{"data-testid":"graph-track-name-input"}},onChange:o=>{w(o.target.value)}}),(0,n.jsx)(p.AssemblySelector,{session:s,helperText:"Select assembly to add track to",selected:e.assembly,onChange:o=>{e.setAssembly(o)},fullWidth:!0}),(0,n.jsx)(i.Button,{variant:"contained",className:a.submit,disabled:!h||!g.trim()||!e.assembly,onClick:_,children:"Submit"})]})}),ae=Y;export{ae as default};
|
|
2
|
+
//# sourceMappingURL=AddTrackWorkflow-I4EPGFPJ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["global-externals:@jbrowse/core/util/tss-react", "../../src/GraphAddTrackWorkflow/AddTrackWorkflow.tsx", "../../src/GraphAddTrackWorkflow/buildTrackConfig.ts"],
|
|
4
|
-
"sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/core/util/tss-react\"];", "import { useState } from 'react'\n\nimport { AssemblySelector, ErrorMessage, FileSelector } from '@jbrowse/core/ui'\nimport { addTrackFromWidget, getSession, makeTrackId } from '@jbrowse/core/util'\nimport { makeStyles } from '@jbrowse/core/util/tss-react'\nimport { getRoot } from '@jbrowse/mobx-state-tree'\nimport {\n Button,\n FormControl,\n FormControlLabel,\n FormLabel,\n Paper,\n Radio,\n RadioGroup,\n TextField,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport {\n GRAPH_FILE_FIELDS,\n GRAPH_FILE_LABELS,\n buildTrackConfig,\n} from './buildTrackConfig'\n\nimport type { GraphFileChoice } from './buildTrackConfig'\nimport type {\n AbstractRootModel,\n AddTrackWorkflowModel,\n FileLocation,\n} from '@jbrowse/core/util'\n\nconst useStyles = makeStyles()(theme => ({\n paper: {\n margin: theme.spacing(),\n padding: theme.spacing(),\n },\n field: {\n marginTop: theme.spacing(2),\n },\n submit: {\n marginTop: 25,\n marginBottom: 100,\n display: 'block',\n },\n}))\n\nconst CHOICES: GraphFileChoice[] = [\n 'RgfaTabixAdapter',\n 'MinigraphBubbleAdapter',\n]\n\nconst GraphAddTrackWidget = observer(function GraphAddTrackWidget({\n model,\n}: {\n model: AddTrackWorkflowModel\n}) {\n const { classes } = useStyles()\n const session = getSession(model)\n const rootModel = getRoot<AbstractRootModel>(model)\n const [choice, setChoice] = useState<GraphFileChoice>('RgfaTabixAdapter')\n const [loc, setLoc] = useState<FileLocation>()\n const [indexLoc, setIndexLoc] = useState<FileLocation>()\n const [sample, setSample] = useState('')\n const [trackName, setTrackName] = useState('Pangenome graph')\n const [error, setError] = useState<unknown>()\n\n function handleSubmit() {\n if (!loc || !model.assembly) {\n return\n }\n try {\n setError(undefined)\n const name = trackName.trim()\n addTrackFromWidget({\n model,\n session,\n conf: buildTrackConfig({\n choice,\n loc,\n indexLoc,\n assembly: model.assembly,\n sample,\n trackId: makeTrackId({ name }),\n name,\n }),\n })\n } catch (e) {\n setError(e)\n }\n }\n\n return (\n <Paper className={classes.paper}>\n {error ? <ErrorMessage error={error} /> : null}\n <FormControl>\n <FormLabel>File type</FormLabel>\n <RadioGroup\n value={choice}\n onChange={event => {\n setChoice(event.target.value as GraphFileChoice)\n }}\n >\n {CHOICES.map(option => (\n <FormControlLabel\n key={option}\n value={option}\n control={<Radio />}\n label={GRAPH_FILE_LABELS[option]}\n />\n ))}\n </RadioGroup>\n </FormControl>\n <FileSelector\n location={loc}\n name={GRAPH_FILE_FIELDS[choice]}\n rootModel={rootModel}\n setLocation={setLoc}\n />\n <FileSelector\n location={indexLoc}\n name=\"Path to tabix index (optional; the sibling .tbi is assumed, a .csi is recognised by name)\"\n rootModel={rootModel}\n setLocation={setIndexLoc}\n />\n <TextField\n className={classes.field}\n value={sample}\n onChange={event => {\n setSample(event.target.value)\n }}\n label=\"Sample name in the graph\"\n slotProps={{ htmlInput: { 'data-testid': 'graph-sample-input' } }}\n helperText=\"Optional. The PanSN prefix the graph gives this assembly, e.g. GRCh38 for HPRC's GRCh38#0#chr1; leave blank when the graph's stable names are bare\"\n placeholder=\"GRCh38\"\n fullWidth\n />\n <TextField\n className={classes.field}\n value={trackName}\n helperText=\"Track name\"\n slotProps={{ htmlInput: { 'data-testid': 'graph-track-name-input' } }}\n onChange={event => {\n setTrackName(event.target.value)\n }}\n />\n <AssemblySelector\n session={session}\n helperText=\"Select assembly to add track to\"\n selected={model.assembly}\n onChange={arg => {\n model.setAssembly(arg)\n }}\n fullWidth\n />\n <Button\n variant=\"contained\"\n className={classes.submit}\n disabled={!loc || !trackName.trim() || !model.assembly}\n onClick={handleSubmit}\n >\n Submit\n </Button>\n </Paper>\n )\n})\n\nexport default GraphAddTrackWidget\n", "import { makeIndex, makeIndexType } from '@jbrowse/core/util/tracks'\n\nimport type { FileLocation } from '@jbrowse/core/util'\n\nexport type GraphFileChoice = 'RgfaTabixAdapter' | 'MinigraphBubbleAdapter'\n\nexport const GRAPH_FILE_LABELS: Record<GraphFileChoice, string> = {\n RgfaTabixAdapter: 'rGFA segments (tabix BED pair)',\n MinigraphBubbleAdapter: 'Minigraph bubbles (tabix BED)',\n}\n\nexport const GRAPH_FILE_FIELDS: Record<GraphFileChoice, string> = {\n RgfaTabixAdapter:\n 'Path to segments BED (.segs.bed.gz from build_rgfa_tabix.sh; the .links.bed.gz and both .tbi are assumed beside it)',\n MinigraphBubbleAdapter:\n 'Path to bubbles BED (.bed.gz from gfatools bubble; the .tbi is assumed beside it)',\n}\n\nconst SEGMENTS_SUFFIX = '.segs.bed.gz'\n\nfunction locationName(loc: FileLocation) {\n return 'uri' in loc ? loc.uri : 'localPath' in loc ? loc.localPath : ''\n}\n\nfunction linksLocation(loc: FileLocation) {\n const name = locationName(loc)\n if (!name.endsWith(SEGMENTS_SUFFIX)) {\n throw new Error(\n `Expected a segments BED ending in ${SEGMENTS_SUFFIX}, got ${name || 'a blob'}`,\n )\n }\n const links = `${name.slice(0, -SEGMENTS_SUFFIX.length)}.links.bed.gz`\n return 'uri' in loc\n ? { ...loc, uri: links }\n : 'localPath' in loc\n ? { ...loc, localPath: links }\n : loc\n}\n\nfunction tabixIndex(loc: FileLocation, indexLoc: FileLocation | undefined) {\n return indexLoc\n ? {\n location: indexLoc,\n indexType: makeIndexType(locationName(indexLoc), 'CSI', 'TBI'),\n }\n : { location: makeIndex(loc, '.tbi'), indexType: 'TBI' }\n}\n\n// The links file's index is assumed beside it, of the kind the segments' is.\nfunction siblingIndex(loc: FileLocation, indexLoc: FileLocation | undefined) {\n const csi = indexLoc !== undefined && locationName(indexLoc).endsWith('.csi')\n return csi\n ? { location: makeIndex(loc, '.csi'), indexType: 'CSI' }\n : { location: makeIndex(loc, '.tbi'), indexType: 'TBI' }\n}\n\nfunction panSN(assembly: string, sample: string) {\n const name = sample.trim()\n return name ? { assemblyNameToPanSN: { [assembly]: name } } : {}\n}\n\nexport function buildAdapterConfig({\n choice,\n loc,\n indexLoc,\n assembly,\n sample,\n}: {\n choice: GraphFileChoice\n loc: FileLocation\n indexLoc: FileLocation | undefined\n assembly: string\n sample: string\n}) {\n if (choice === 'MinigraphBubbleAdapter') {\n return {\n type: 'MinigraphBubbleAdapter',\n bubblesLocation: loc,\n index: tabixIndex(loc, indexLoc),\n ...panSN(assembly, sample),\n }\n }\n const links = linksLocation(loc)\n return {\n type: 'RgfaTabixAdapter',\n segmentsLocation: loc,\n segmentsIndex: tabixIndex(loc, indexLoc),\n linksLocation: links,\n linksIndex: siblingIndex(links, indexLoc),\n ...panSN(assembly, sample),\n }\n}\n\nexport function buildTrackConfig(args: {\n choice: GraphFileChoice\n loc: FileLocation\n indexLoc: FileLocation | undefined\n assembly: string\n sample: string\n trackId: string\n name: string\n}) {\n const { choice, assembly, trackId, name } = args\n return {\n type: 'FeatureTrack',\n trackId,\n name,\n assemblyNames: [assembly],\n adapter: buildAdapterConfig(args),\n ...(choice === 'RgfaTabixAdapter'\n ? { displayDefaults: { showLabels: 'none' }
|
|
5
|
-
"mappings": "2OAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,8BAA8B,ICA9D,IAAAC,EAAyB,SAEzBC,EAA6D,SAC7DC,EAA4D,SAC5DC,EAA2B,SAC3BC,EAAwB,SACxBC,EASO,SACPC,EAAyB,SChBzB,IAAAC,EAAyC,SAM5BC,EAAqD,CAChE,iBAAkB,iCAClB,uBAAwB,+BAC1B,EAEaC,EAAqD,CAChE,iBACE,sHACF,uBACE,mFACJ,EAEMC,EAAkB,eAExB,SAASC,EAAaC,EAAmB,CACvC,MAAO,QAASA,EAAMA,EAAI,IAAM,cAAeA,EAAMA,EAAI,UAAY,EACvE,CAEA,SAASC,EAAcD,EAAmB,CACxC,IAAME,EAAOH,EAAaC,CAAG,EAC7B,GAAI,CAACE,EAAK,SAASJ,CAAe,EAChC,MAAM,IAAI,MACR,qCAAqCA,CAAe,SAASI,GAAQ,QAAQ,EAC/E,EAEF,IAAMC,EAAQ,GAAGD,EAAK,MAAM,EAAG,CAACJ,EAAgB,MAAM,CAAC,gBACvD,MAAO,QAASE,EACZ,CAAE,GAAGA,EAAK,IAAKG,CAAM,EACrB,cAAeH,EACb,CAAE,GAAGA,EAAK,UAAWG,CAAM,EAC3BH,CACR,CAEA,SAASI,EAAWJ,EAAmBK,EAAoC,CACzE,OAAOA,EACH,CACE,SAAUA,EACV,aAAW,iBAAcN,EAAaM,CAAQ,EAAG,MAAO,KAAK,CAC/D,EACA,CAAE,YAAU,aAAUL,EAAK,MAAM,EAAG,UAAW,KAAM,CAC3D,CAGA,SAASM,EAAaN,EAAmBK,EAAoC,CAE3E,OADYA,IAAa,QAAaN,EAAaM,CAAQ,EAAE,SAAS,MAAM,EAExE,CAAE,YAAU,aAAUL,EAAK,MAAM,EAAG,UAAW,KAAM,EACrD,CAAE,YAAU,aAAUA,EAAK,MAAM,EAAG,UAAW,KAAM,CAC3D,CAEA,SAASO,EAAMC,EAAkBC,EAAgB,CAC/C,IAAMP,EAAOO,EAAO,KAAK,EACzB,OAAOP,EAAO,CAAE,oBAAqB,CAAE,CAACM,CAAQ,EAAGN,CAAK,CAAE,EAAI,CAAC,CACjE,CAEO,SAASQ,EAAmB,CACjC,OAAAC,EACA,IAAAX,EACA,SAAAK,EACA,SAAAG,EACA,OAAAC,CACF,EAMG,CACD,GAAIE,IAAW,yBACb,MAAO,CACL,KAAM,yBACN,gBAAiBX,EACjB,MAAOI,EAAWJ,EAAKK,CAAQ,EAC/B,GAAGE,EAAMC,EAAUC,CAAM,CAC3B,EAEF,IAAMN,EAAQF,EAAcD,CAAG,EAC/B,MAAO,CACL,KAAM,mBACN,iBAAkBA,EAClB,cAAeI,EAAWJ,EAAKK,CAAQ,EACvC,cAAeF,EACf,WAAYG,EAAaH,EAAOE,CAAQ,EACxC,GAAGE,EAAMC,EAAUC,CAAM,CAC3B,CACF,CAEO,SAASG,EAAiBC,EAQ9B,CACD,GAAM,CAAE,OAAAF,EAAQ,SAAAH,EAAU,QAAAM,EAAS,KAAAZ,CAAK,EAAIW,EAC5C,MAAO,CACL,KAAM,eACN,QAAAC,EACA,KAAAZ,EACA,cAAe,CAACM,CAAQ,EACxB,QAASE,EAAmBG,CAAI,EAChC,GAAIF,IAAW,mBACX,
|
|
4
|
+
"sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/core/util/tss-react\"];", "import { useState } from 'react'\n\nimport { AssemblySelector, ErrorMessage, FileSelector } from '@jbrowse/core/ui'\nimport { addTrackFromWidget, getSession, makeTrackId } from '@jbrowse/core/util'\nimport { makeStyles } from '@jbrowse/core/util/tss-react'\nimport { getRoot } from '@jbrowse/mobx-state-tree'\nimport {\n Button,\n FormControl,\n FormControlLabel,\n FormLabel,\n Paper,\n Radio,\n RadioGroup,\n TextField,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport {\n GRAPH_FILE_FIELDS,\n GRAPH_FILE_LABELS,\n buildTrackConfig,\n} from './buildTrackConfig'\n\nimport type { GraphFileChoice } from './buildTrackConfig'\nimport type {\n AbstractRootModel,\n AddTrackWorkflowModel,\n FileLocation,\n} from '@jbrowse/core/util'\n\nconst useStyles = makeStyles()(theme => ({\n paper: {\n margin: theme.spacing(),\n padding: theme.spacing(),\n },\n field: {\n marginTop: theme.spacing(2),\n },\n submit: {\n marginTop: 25,\n marginBottom: 100,\n display: 'block',\n },\n}))\n\nconst CHOICES: GraphFileChoice[] = [\n 'RgfaTabixAdapter',\n 'MinigraphBubbleAdapter',\n]\n\nconst GraphAddTrackWidget = observer(function GraphAddTrackWidget({\n model,\n}: {\n model: AddTrackWorkflowModel\n}) {\n const { classes } = useStyles()\n const session = getSession(model)\n const rootModel = getRoot<AbstractRootModel>(model)\n const [choice, setChoice] = useState<GraphFileChoice>('RgfaTabixAdapter')\n const [loc, setLoc] = useState<FileLocation>()\n const [indexLoc, setIndexLoc] = useState<FileLocation>()\n const [sample, setSample] = useState('')\n const [trackName, setTrackName] = useState('Pangenome graph')\n const [error, setError] = useState<unknown>()\n\n function handleSubmit() {\n if (!loc || !model.assembly) {\n return\n }\n try {\n setError(undefined)\n const name = trackName.trim()\n addTrackFromWidget({\n model,\n session,\n conf: buildTrackConfig({\n choice,\n loc,\n indexLoc,\n assembly: model.assembly,\n sample,\n trackId: makeTrackId({ name }),\n name,\n }),\n })\n } catch (e) {\n setError(e)\n }\n }\n\n return (\n <Paper className={classes.paper}>\n {error ? <ErrorMessage error={error} /> : null}\n <FormControl>\n <FormLabel>File type</FormLabel>\n <RadioGroup\n value={choice}\n onChange={event => {\n setChoice(event.target.value as GraphFileChoice)\n }}\n >\n {CHOICES.map(option => (\n <FormControlLabel\n key={option}\n value={option}\n control={<Radio />}\n label={GRAPH_FILE_LABELS[option]}\n />\n ))}\n </RadioGroup>\n </FormControl>\n <FileSelector\n location={loc}\n name={GRAPH_FILE_FIELDS[choice]}\n rootModel={rootModel}\n setLocation={setLoc}\n />\n <FileSelector\n location={indexLoc}\n name=\"Path to tabix index (optional; the sibling .tbi is assumed, a .csi is recognised by name)\"\n rootModel={rootModel}\n setLocation={setIndexLoc}\n />\n <TextField\n className={classes.field}\n value={sample}\n onChange={event => {\n setSample(event.target.value)\n }}\n label=\"Sample name in the graph\"\n slotProps={{ htmlInput: { 'data-testid': 'graph-sample-input' } }}\n helperText=\"Optional. The PanSN prefix the graph gives this assembly, e.g. GRCh38 for HPRC's GRCh38#0#chr1; leave blank when the graph's stable names are bare\"\n placeholder=\"GRCh38\"\n fullWidth\n />\n <TextField\n className={classes.field}\n value={trackName}\n helperText=\"Track name\"\n slotProps={{ htmlInput: { 'data-testid': 'graph-track-name-input' } }}\n onChange={event => {\n setTrackName(event.target.value)\n }}\n />\n <AssemblySelector\n session={session}\n helperText=\"Select assembly to add track to\"\n selected={model.assembly}\n onChange={arg => {\n model.setAssembly(arg)\n }}\n fullWidth\n />\n <Button\n variant=\"contained\"\n className={classes.submit}\n disabled={!loc || !trackName.trim() || !model.assembly}\n onClick={handleSubmit}\n >\n Submit\n </Button>\n </Paper>\n )\n})\n\nexport default GraphAddTrackWidget\n", "import { makeIndex, makeIndexType } from '@jbrowse/core/util/tracks'\n\nimport type { FileLocation } from '@jbrowse/core/util'\n\nexport type GraphFileChoice = 'RgfaTabixAdapter' | 'MinigraphBubbleAdapter'\n\nexport const GRAPH_FILE_LABELS: Record<GraphFileChoice, string> = {\n RgfaTabixAdapter: 'rGFA segments (tabix BED pair)',\n MinigraphBubbleAdapter: 'Minigraph bubbles (tabix BED)',\n}\n\nexport const GRAPH_FILE_FIELDS: Record<GraphFileChoice, string> = {\n RgfaTabixAdapter:\n 'Path to segments BED (.segs.bed.gz from build_rgfa_tabix.sh; the .links.bed.gz and both .tbi are assumed beside it)',\n MinigraphBubbleAdapter:\n 'Path to bubbles BED (.bed.gz from gfatools bubble; the .tbi is assumed beside it)',\n}\n\nconst SEGMENTS_SUFFIX = '.segs.bed.gz'\n\nfunction locationName(loc: FileLocation) {\n return 'uri' in loc ? loc.uri : 'localPath' in loc ? loc.localPath : ''\n}\n\nfunction linksLocation(loc: FileLocation) {\n const name = locationName(loc)\n if (!name.endsWith(SEGMENTS_SUFFIX)) {\n throw new Error(\n `Expected a segments BED ending in ${SEGMENTS_SUFFIX}, got ${name || 'a blob'}`,\n )\n }\n const links = `${name.slice(0, -SEGMENTS_SUFFIX.length)}.links.bed.gz`\n return 'uri' in loc\n ? { ...loc, uri: links }\n : 'localPath' in loc\n ? { ...loc, localPath: links }\n : loc\n}\n\nfunction tabixIndex(loc: FileLocation, indexLoc: FileLocation | undefined) {\n return indexLoc\n ? {\n location: indexLoc,\n indexType: makeIndexType(locationName(indexLoc), 'CSI', 'TBI'),\n }\n : { location: makeIndex(loc, '.tbi'), indexType: 'TBI' }\n}\n\n// The links file's index is assumed beside it, of the kind the segments' is.\nfunction siblingIndex(loc: FileLocation, indexLoc: FileLocation | undefined) {\n const csi = indexLoc !== undefined && locationName(indexLoc).endsWith('.csi')\n return csi\n ? { location: makeIndex(loc, '.csi'), indexType: 'CSI' }\n : { location: makeIndex(loc, '.tbi'), indexType: 'TBI' }\n}\n\nfunction panSN(assembly: string, sample: string) {\n const name = sample.trim()\n return name ? { assemblyNameToPanSN: { [assembly]: name } } : {}\n}\n\nexport function buildAdapterConfig({\n choice,\n loc,\n indexLoc,\n assembly,\n sample,\n}: {\n choice: GraphFileChoice\n loc: FileLocation\n indexLoc: FileLocation | undefined\n assembly: string\n sample: string\n}) {\n if (choice === 'MinigraphBubbleAdapter') {\n return {\n type: 'MinigraphBubbleAdapter',\n bubblesLocation: loc,\n index: tabixIndex(loc, indexLoc),\n ...panSN(assembly, sample),\n }\n }\n const links = linksLocation(loc)\n return {\n type: 'RgfaTabixAdapter',\n segmentsLocation: loc,\n segmentsIndex: tabixIndex(loc, indexLoc),\n linksLocation: links,\n linksIndex: siblingIndex(links, indexLoc),\n ...panSN(assembly, sample),\n }\n}\n\nexport function buildTrackConfig(args: {\n choice: GraphFileChoice\n loc: FileLocation\n indexLoc: FileLocation | undefined\n assembly: string\n sample: string\n trackId: string\n name: string\n}) {\n const { choice, assembly, trackId, name } = args\n return {\n type: 'FeatureTrack',\n trackId,\n name,\n assemblyNames: [assembly],\n adapter: buildAdapterConfig(args),\n ...(choice === 'RgfaTabixAdapter'\n ? {\n displays: [\n {\n type: 'LinearGraphDisplay',\n displayId: `${trackId}-LinearGraphDisplay`,\n },\n {\n type: 'LinearBasicDisplay',\n displayId: `${trackId}-LinearBasicDisplay`,\n },\n ],\n displayDefaults: { showLabels: 'none' },\n }\n : {}),\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["require_tss_react", "__commonJSMin", "exports", "module", "import_react", "import_ui", "import_util", "import_tss_react", "import_mobx_state_tree", "import_material", "import_mobx_react", "import_tracks", "GRAPH_FILE_LABELS", "GRAPH_FILE_FIELDS", "SEGMENTS_SUFFIX", "locationName", "loc", "linksLocation", "name", "links", "tabixIndex", "indexLoc", "siblingIndex", "panSN", "assembly", "sample", "buildAdapterConfig", "choice", "buildTrackConfig", "args", "trackId", "import_jsx_runtime", "useStyles", "theme", "CHOICES", "GraphAddTrackWidget", "model", "classes", "session", "rootModel", "choice", "setChoice", "loc", "setLoc", "indexLoc", "setIndexLoc", "sample", "setSample", "trackName", "setTrackName", "error", "setError", "handleSubmit", "name", "buildTrackConfig", "e", "event", "option", "GRAPH_FILE_LABELS", "GRAPH_FILE_FIELDS", "arg", "AddTrackWorkflow_default"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,b as d}from"./chunk-
|
|
1
|
+
import{a as h,b as d}from"./chunk-RSAY56Y4.js";import"./chunk-5WJPRX4N.js";import"./chunk-ZNGDWZ6Z.js";import"./chunk-OHT6UX4C.js";import{F as M}from"./chunk-OP7IRVG6.js";import"./chunk-F4C3BEPV.js";import{a as p,b as c,c as F,d as A,e as E}from"./chunk-XEJ47DLD.js";import{b as a}from"./chunk-FY3BTKY4.js";var x=a(c(),1);var u=a(E(),1),g=a(A(),1),o=a(F(),1),G=a(c(),1),v=a(M(),1),t=a(p(),1),T=`H VN:Z:1.0
|
|
2
2
|
S 1 ACGT
|
|
3
3
|
S 2 GGCC
|
|
4
4
|
S 3 TTAA
|
|
@@ -7,4 +7,4 @@ L 1 + 2 + 0M
|
|
|
7
7
|
L 1 + 3 + 0M
|
|
8
8
|
L 2 + 4 + 0M
|
|
9
9
|
L 3 + 4 + 0M`,N=(0,v.makeStyles)()({column:{display:"flex",flexDirection:"column",gap:8},rowEnd:{display:"flex",gap:8,alignItems:"flex-end"},rowCenter:{display:"flex",gap:8,alignItems:"center"},flex1:{flex:1},paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto"},header:{marginBottom:12},footer:{marginTop:12,display:"flex",justifyContent:"flex-end"}}),S=(0,G.observer)(function({model:e}){let{classes:n}=N(),[l,L]=(0,u.useState)("");function f(){l.trim()&&e.loadGFAFromLocation({uri:l,locationType:"UriLocation"})}function w(i){let m=i.target.files?.[0];m&&m.text().then(s=>e.loadGFA(s,m.name)).catch(s=>{e.setError(s)})}return(0,t.jsxs)(o.Paper,{className:n.paper,children:[(0,t.jsx)("div",{className:n.header,children:(0,t.jsx)(o.Typography,{variant:"h6",children:"Load a GFA graph"})}),(0,t.jsxs)("div",{className:n.column,children:[(0,t.jsxs)("div",{className:n.rowCenter,children:[(0,t.jsxs)(o.Button,{variant:"outlined",component:"label",size:"small",children:["Choose file",(0,t.jsx)("input",{type:"file",accept:".gfa,.gfa1,.gfa2",hidden:!0,onChange:i=>{w(i)}})]}),(0,t.jsx)(o.Typography,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),(0,t.jsxs)("div",{className:n.rowEnd,children:[(0,t.jsx)(o.TextField,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:l,onChange:i=>{L(i.target.value)},onKeyDown:i=>{i.key==="Enter"&&f()},className:n.flex1}),(0,t.jsx)(o.Button,{variant:"contained",onClick:()=>{f()},disabled:!l.trim(),children:"Open"})]})]}),(0,t.jsx)("div",{className:n.footer,children:(0,t.jsx)(o.Button,{size:"small",onClick:()=>{e.loadGFA(T,"Example graph")},children:"Load 4-node example"})}),e.error?(0,t.jsx)(g.ErrorBanner,{error:e.error}):null]})}),y=S;var r=a(p(),1),I=(0,x.observer)(function({model:e}){return e.hasGraph?(0,r.jsx)(h,{model:e}):e.canRetryLoad&&(e.error||e.loadCanceled)?(0,r.jsx)(d,{model:e}):(0,r.jsxs)(r.Fragment,{children:[e.isLoading?(0,r.jsx)(d,{model:e}):null,(0,r.jsx)("div",{hidden:e.isLoading,children:(0,r.jsx)(y,{model:e})})]})}),U=I;export{U as default};
|
|
10
|
-
//# sourceMappingURL=GraphGenomeView-
|
|
10
|
+
//# sourceMappingURL=GraphGenomeView-BQYWWF6Z.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as r,b as i}from"./chunk-RSAY56Y4.js";import"./chunk-5WJPRX4N.js";import"./chunk-ZNGDWZ6Z.js";import"./chunk-OHT6UX4C.js";import"./chunk-OP7IRVG6.js";import"./chunk-F4C3BEPV.js";import{a as e,b as s,c as u}from"./chunk-XEJ47DLD.js";import{b as o}from"./chunk-FY3BTKY4.js";var d=o(u(),1),n=o(s(),1);var t=o(e(),1),h={position:"absolute",left:8,top:4,zIndex:5,background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3},c=(0,n.observer)(function({model:p}){let{pane:a,height:l}=p;return(0,t.jsxs)("div",{"data-testid":"linear-graph-display","data-layout":a.layoutMode,"data-cut-tier":a.cutTier,"data-recuts":a.recuts,"data-node-count":a.hasGraph?a.nodeCount:void 0,"data-loading":a.isLoading?"":void 0,style:{position:"relative",width:a.width,height:l,overflow:"hidden"},children:[(0,t.jsx)(r,{model:a,toolbar:!1}),a.hasGraph?null:(0,t.jsx)(i,{model:a}),a.cutNote?(0,t.jsx)(d.Typography,{variant:"caption",color:"warning.main",style:h,"data-testid":"graph-cut-note",children:a.cutNote}):null]})}),g=c;export{g as default};
|
|
2
|
+
//# sourceMappingURL=LinearGraphDisplay-7O3VQHKU.js.map
|
package/dist/chunks/{LinearGraphDisplay-7POYIRIB.js.map → LinearGraphDisplay-7O3VQHKU.js.map}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/LinearGraphDisplay/components/LinearGraphDisplay.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport GraphCanvas from '../../GraphGenomeView/components/GraphCanvas'\nimport GraphLoadStatus from '../../GraphGenomeView/components/GraphLoadStatus'\n\nimport type { LinearGraphDisplayModel } from '../model'\n\nconst noteStyle = {\n position: 'absolute' as const,\n left: 8,\n top: 4,\n zIndex: 5,\n background: 'rgba(255,255,255,0.82)',\n padding: '0 4px',\n borderRadius: 3,\n}\n\nconst LinearGraphDisplay = observer(function LinearGraphDisplay({\n model,\n}: {\n model: LinearGraphDisplayModel\n}) {\n const { pane, height } = model\n return (\n <div\n data-testid=\"linear-graph-display\"\n data-layout={pane.layoutMode}\n data-cut-tier={pane.cutTier}\n data-recuts={pane.recuts}\n data-node-count={pane.hasGraph ? pane.nodeCount : undefined}\n style={{\n position: 'relative',\n width: pane.width,\n height,\n overflow: 'hidden',\n }}\n >\n <GraphCanvas model={pane} toolbar={false} />\n {pane.hasGraph ? null : <GraphLoadStatus model={pane} />}\n {pane.cutNote ? (\n <Typography\n variant=\"caption\"\n color=\"warning.main\"\n style={noteStyle}\n data-testid=\"graph-cut-note\"\n >\n {pane.cutNote}\n </Typography>\n ) : null}\n </div>\n )\n})\n\nexport default LinearGraphDisplay\n"],
|
|
5
|
-
"mappings": "yRAAA,IAAAA,EAA2B,SAC3BC,EAAyB,SAwBrB,IAAAC,EAAA,SAjBEC,EAAY,CAChB,SAAU,WACV,KAAM,EACN,IAAK,EACL,OAAQ,EACR,WAAY,yBACZ,QAAS,QACT,aAAc,CAChB,EAEMC,KAAqB,YAAS,SAA4B,CAC9D,MAAAC,CACF,EAEG,CACD,GAAM,CAAE,KAAAC,EAAM,OAAAC,CAAO,EAAIF,EACzB,SACE,QAAC,OACC,cAAY,uBACZ,cAAaC,EAAK,WAClB,gBAAeA,EAAK,QACpB,cAAaA,EAAK,OAClB,kBAAiBA,EAAK,SAAWA,EAAK,UAAY,OAClD,MAAO,CACL,SAAU,WACV,MAAOA,EAAK,MACZ,OAAAC,EACA,SAAU,QACZ,EAEA,oBAACC,EAAA,CAAY,MAAOF,EAAM,QAAS,GAAO,EACzCA,EAAK,SAAW,QAAO,OAACG,EAAA,CAAgB,MAAOH,EAAM,EACrDA,EAAK,WACJ,OAAC,cACC,QAAQ,UACR,MAAM,eACN,MAAOH,EACP,cAAY,iBAEX,SAAAG,EAAK,QACR,EACE,MACN,CAEJ,CAAC,EAEMI,EAAQN",
|
|
4
|
+
"sourcesContent": ["import { Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport GraphCanvas from '../../GraphGenomeView/components/GraphCanvas'\nimport GraphLoadStatus from '../../GraphGenomeView/components/GraphLoadStatus'\n\nimport type { LinearGraphDisplayModel } from '../model'\n\nconst noteStyle = {\n position: 'absolute' as const,\n left: 8,\n top: 4,\n zIndex: 5,\n background: 'rgba(255,255,255,0.82)',\n padding: '0 4px',\n borderRadius: 3,\n}\n\nconst LinearGraphDisplay = observer(function LinearGraphDisplay({\n model,\n}: {\n model: LinearGraphDisplayModel\n}) {\n const { pane, height } = model\n return (\n <div\n data-testid=\"linear-graph-display\"\n data-layout={pane.layoutMode}\n data-cut-tier={pane.cutTier}\n data-recuts={pane.recuts}\n data-node-count={pane.hasGraph ? pane.nodeCount : undefined}\n data-loading={pane.isLoading ? '' : undefined}\n style={{\n position: 'relative',\n width: pane.width,\n height,\n overflow: 'hidden',\n }}\n >\n <GraphCanvas model={pane} toolbar={false} />\n {pane.hasGraph ? null : <GraphLoadStatus model={pane} />}\n {pane.cutNote ? (\n <Typography\n variant=\"caption\"\n color=\"warning.main\"\n style={noteStyle}\n data-testid=\"graph-cut-note\"\n >\n {pane.cutNote}\n </Typography>\n ) : null}\n </div>\n )\n})\n\nexport default LinearGraphDisplay\n"],
|
|
5
|
+
"mappings": "yRAAA,IAAAA,EAA2B,SAC3BC,EAAyB,SAwBrB,IAAAC,EAAA,SAjBEC,EAAY,CAChB,SAAU,WACV,KAAM,EACN,IAAK,EACL,OAAQ,EACR,WAAY,yBACZ,QAAS,QACT,aAAc,CAChB,EAEMC,KAAqB,YAAS,SAA4B,CAC9D,MAAAC,CACF,EAEG,CACD,GAAM,CAAE,KAAAC,EAAM,OAAAC,CAAO,EAAIF,EACzB,SACE,QAAC,OACC,cAAY,uBACZ,cAAaC,EAAK,WAClB,gBAAeA,EAAK,QACpB,cAAaA,EAAK,OAClB,kBAAiBA,EAAK,SAAWA,EAAK,UAAY,OAClD,eAAcA,EAAK,UAAY,GAAK,OACpC,MAAO,CACL,SAAU,WACV,MAAOA,EAAK,MACZ,OAAAC,EACA,SAAU,QACZ,EAEA,oBAACC,EAAA,CAAY,MAAOF,EAAM,QAAS,GAAO,EACzCA,EAAK,SAAW,QAAO,OAACG,EAAA,CAAgB,MAAOH,EAAM,EACrDA,EAAK,WACJ,OAAC,cACC,QAAQ,UACR,MAAM,eACN,MAAOH,EACP,cAAY,iBAEX,SAAAG,EAAK,QACR,EACE,MACN,CAEJ,CAAC,EAEMI,EAAQN",
|
|
6
6
|
"names": ["import_material", "import_mobx_react", "import_jsx_runtime", "noteStyle", "LinearGraphDisplay", "model", "pane", "height", "GraphCanvas_default", "GraphLoadStatus_default", "LinearGraphDisplay_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as Ve}from"./chunk-ZNGDWZ6Z.js";import{A as Ge,B as Oe,a as ue,b as S,c as Ne,d as F,e as j,f as Ue,h as we,p as ke,v as qe,w as Je,y as Ze,z as Qe}from"./chunk-OP7IRVG6.js";import{a as Re,b as je,c as Ke}from"./chunk-F4C3BEPV.js";import{a as Me}from"./chunk-XEJ47DLD.js";import{a as Ie,b as ee}from"./chunk-FY3BTKY4.js";var tt=Ie((gr,et)=>{et.exports=JBrowseExports["@mui/material/SvgIcon"]});var _e=Ie((xr,nt)=>{nt.exports=JBrowseExports["@jbrowse/core/util/colorBits"]});var Yn=Ie((mo,At)=>{At.exports=JBrowseExports["@jbrowse/render-core/canvas2dUtils"]});var T=ee(tt(),1);var C=ee(_e(),1);var A=ee(_e(),1);function de(e,t){return(0,A.packAbgr)((0,A.abgrRed)(e),(0,A.abgrGreen)(e),(0,A.abgrBlue)(e),Math.round((0,A.abgrAlpha)(e)*t))}function Mr(e,t){return(0,A.packAbgr)(Math.min(255,Math.round((0,A.abgrRed)(e)*t)),Math.min(255,Math.round((0,A.abgrGreen)(e)*t)),Math.min(255,Math.round((0,A.abgrBlue)(e)*t)),(0,A.abgrAlpha)(e))}var Ft=4;function fe(e){let t=new Map;function n(r,o){let s=t.get(r);s?s.push(o):t.set(r,[o])}for(let r of e.edges)n(r.from,r.to),n(r.to,r.from);return t}function jt({nodeId:e,nodeById:t,neighbors:n}){let r=new Set([e]),o=[e],s=1/0,a=-1/0;for(let i=0;i<Ft&&o.length>0;i++){let l=[];for(let f of o){let d=n.get(f);if(d){for(let u of d)if(!r.has(u)){r.add(u);let c=t.get(u);c&&S(c)?(s=Math.min(s,c.stable.start+c.length),a=Math.max(a,c.stable.start)):l.push(u)}}}o=l}return s===1/0?void 0:{start:Math.min(s,a),end:Math.max(s,a)}}function Kt({nodeId:e,nodeById:t,neighbors:n}){let r=t.get(e);return r===void 0?void 0:S(r)?{start:r.stable.start,end:r.stable.start+r.length}:jt({nodeId:e,nodeById:t,neighbors:n})}function rt(e){let t=new Map(e.nodes.map(o=>[o.id,o])),n=fe(e),r=new Map;for(let o of e.nodes){let s=Kt({nodeId:o.id,nodeById:t,neighbors:n});s&&r.set(o.id,(s.start+s.end)/2)}return r}function Lr(e){let t=n=>Math.round(n*100)/100;return e.map((n,r)=>`${r?"L":"M"}${t(n.x)},${t(n.y)}`).join("")}function ot(e,t,n,r,o){let s=Math.hypot(r-t,n-e);if(s===0)return[n,r];let a=(n-e)/s,i=(r-t)/s;return[n+o*a,r+o*i]}function Pe(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,s=3*n*t*t,a=t*t*t;return{x:r*e.x0+o*e.cx0+s*e.cx1+a*e.x1,y:r*e.y0+o*e.cy0+s*e.cy1+a*e.y1}}function vr(e){let t=e[Math.floor(e.length/2)];return t?Pe(t,.5):void 0}function Cr(e){let t=1/0,n=1/0,r=-1/0,o=-1/0;for(let s of e)t=Math.min(t,s.x0,s.cx0,s.cx1,s.x1),r=Math.max(r,s.x0,s.cx0,s.cx1,s.x1),n=Math.min(n,s.y0,s.cy0,s.cy1,s.y1),o=Math.max(o,s.y0,s.cy0,s.cy1,s.y1);return{minX:t,minY:n,maxX:r,maxY:o}}function Ut(e,t,n){let r=Pe(e,t),o=Pe(e,n),s=(n-t)/3,a=st(e,t),i=st(e,n);return{x0:r.x,y0:r.y,cx0:r.x+a.x*s,cy0:r.y+a.y*s,cx1:o.x-i.x*s,cy1:o.y-i.y*s,x1:o.x,y1:o.y}}function st(e,t){let n=1-t,r=3*n*n,o=6*n*t,s=3*t*t;return{x:r*(e.cx0-e.x0)+o*(e.cx1-e.cx0)+s*(e.x1-e.cx1),y:r*(e.cy0-e.y0)+o*(e.cy1-e.cy0)+s*(e.y1-e.cy1)}}function ut(e,t){let n=[];for(let r of e){let o=Math.hypot(r.cx0-r.x0,r.cy0-r.y0)+Math.hypot(r.cx1-r.cx0,r.cy1-r.cy0)+Math.hypot(r.x1-r.cx1,r.y1-r.cy1),s=Math.max(3,Math.round(o/t)|1);for(let a=0;a<s;a+=2)n.push([Ut(r,a/s,(a+1)/s)])}return n}function dt(e,t,n){let r=new Array(e.length);for(let o=0;o<e.length;o++){let s=e[o];r[o]={x0:s.x0+t,y0:s.y0+n,cx0:s.cx0+t,cy0:s.cy0+n,cx1:s.cx1+t,cy1:s.cy1+n,x1:s.x1+t,y1:s.y1+n}}return r}function at(e,t){let n=e.length-1;return t==="end"?{at:e[n],inward:e[n-1]}:{at:e[0],inward:e[1]}}var Vt=.5,qt=80;function it(e){let t=1/0,n=-1/0;for(let r of e)t=Math.min(t,r.x),n=Math.max(n,r.x);return{min:t,max:n}}function ct(e,t){return Math.max(0,t.min-e,e-t.max)}function lt(e,t,n){let r=ct(e[0].x,t),o=ct(e[e.length-1].x,t);return r===o?n:r<o?"start":"end"}function Jt(e,t){return{from:lt(e,it(t),"end"),to:lt(t,it(e),"start")}}var Zt=.75,Qt=1.15,en=.35,tn=60;function nn(e,t,n,r,o,s){let a=Math.hypot(n-e,r-t),i=a===0?1:(n-e)/a,l=a===0?0:(r-t)/a,f=0,d=1/0,u=-1/0;for(let h of o){let g=h.x-e,b=h.y-t,y=g*-l+b*i;Math.abs(y)>Math.abs(f)&&(f=y);let N=g*i+b*l;d=Math.min(d,N),u=Math.max(u,N)}let c=o.length?u-d:0,m=Math.max(Math.abs(f)*Qt/Zt,c*en),p=s===void 0?m:Math.min(m,s);return f<0?-p:p}function Se({scaleX:e,scaleY:t}){return t/e}var rn=3;function Be(e,t,n){let r=t.x-e.x,o=(t.y-e.y)*n,s=Math.hypot(r,o);return s===0?void 0:{x:r/s,y:o/s}}function ft(e,t,n,r,o=rn){let s=Se(r),a=Be(e[e.length-1],t[0],s)??Be(e[0],e.at(-1),s)??Be(t[0],t.at(-1),s)??{x:1,y:0},i=[];for(let l=0;l<n;l++){let f=(l-(n-1)/2)*o;i.push({x:-a.y*f,y:a.x*f/s})}return i}function Te(e,t){return e.map(n=>({x:n.x,y:n.y*t}))}function on(e,t){for(let n of e)n.y0/=t,n.cy0/=t,n.cy1/=t,n.y1/=t;return e}function pe(e,t,n,r,o,s,a=[],i){let l=s.scaleX,f=Se(s),d=i??(s.pixelRows?tn:void 0);if(f!==1)return on(pe(Te(e,f),Te(t,f),n,r,o*f,{scaleX:l,scaleY:l},Te(a,f),d===void 0?void 0:d*f),f);let u=n?{from:"end",to:"start"}:Jt(e,t),c=at(e,u.from),m=at(t,u.to),p=c.at,h=m.at,g=p.x+r,b=p.y+o,y=h.x+r,N=h.y+o;if(n){let w=1,M=0;if(c.inward){let J=p.x-c.inward.x,Z=p.y-c.inward.y,$=Math.hypot(J,Z);$>0&&(w=J/$,M=Z/$)}let R=Math.min(50,50*l),L=-M,G=w,I=(p.x+h.x)/2+r+L*R,V=(p.y+h.y)/2+o+G*R,ne=g+w*R,q=b+M*R,P=y-w*R,k=N-M*R;return[{x0:g,y0:b,cx0:ne,cy0:q,cx1:ne+L*R,cy1:q+G*R,x1:I,y1:V},{x0:I,y0:V,cx0:P+L*R,cy0:k+G*R,cx1:P,cy1:k,x1:y,y1:N}]}else{let w=c.inward??{x:p.x-(h.x-p.x),y:p.y-(h.y-p.y)},M=m.inward??{x:h.x-(p.x-h.x),y:h.y-(p.y-h.y)},R=Math.hypot(y-g,N-b),L=(H,_,D,oe)=>{let z=_.x-H.x,W=_.y-H.y,X=Math.hypot(z,W),Q=X===0?0:(D*z+oe*W)/X;return Math.max(0,Math.min(R*Vt,qt,Q*.5))},G=h.x-p.x,I=h.y-p.y,[V,ne]=ot(w.x,w.y,p.x,p.y,L(w,p,G,I)),[q,P]=ot(M.x,M.y,h.x,h.y,L(M,h,-G,-I)),k=a.length?nn(g,b,y,N,a,d):0,J=R===0?1:R,Z=(y-g)/J,$=(N-b)/J,me=-$*k,x=Z*k,v=Z*Math.abs(k),O=$*Math.abs(k);return[{x0:g,y0:b,cx0:V+r+me-v,cy0:ne+o+x-O,cx1:q+r+me+v,cy1:P+o+x+O,x1:y,y1:N}]}}var sn=1;function $e(e,t){return t.flatMap(n=>e[n]??[])}function Gr(e,t,n){let r=e[t.from],o=e[t.to];return r?.length&&o?.length?pe(r,o,t.from===t.to,0,0,n,$e(e,t.bypassed)):void 0}function an(e){let t=new Map;for(let n of e.nodes)if(S(n)){let r=t.get(n.stable.refName);r?r.push(n):t.set(n.stable.refName,[n])}for(let n of t.values())n.sort((r,o)=>r.stable.start-o.stable.start);return t}function cn(e,t,n){let r=[];if(e)for(let o=Ue(e,t);o<e.length;o++){let s=e[o];if(s.stable.start>=n)break;s.stable.start+s.length<=n&&r.push(s.id)}return r}function ln(e,t,n,r){let{fromStrand:o,toStrand:s}=e;if(o===void 0||s===void 0)return!0;let a=o===(t.stable.strand??"+"),i=s===(n.stable.strand??"+");return r?a&&i:!a&&!i}function Or(e){let t=new Map(e.nodes.map(o=>[o.id,o])),n=an(e),r=[];for(let o=0;o<e.edges.length;o++){let s=e.edges[o],a=t.get(s.from),i=t.get(s.to);if(a!==void 0&&i!==void 0&&S(a)&&S(i)&&a.stable.refName===i.stable.refName){let l=a.stable.start<=i.stable.start,[f,d]=l?[a,i]:[i,a],u=f.stable.start+f.length,c=d.stable.start,m=c-u;if(m>=sn&&ln(s,a,i,l)){let p=f.stable.refName;r.push({edgeIndex:o,from:s.from,to:s.to,refName:p,start:u,end:c,bp:m,bypassed:cn(n.get(p),u,c)})}}}return r}var pt=new WeakMap;function mt(e,t,n,r,o){let{scaleX:s,scaleY:a}=n,i=pt.get(e);if(i?.graph===t&&i.scaleX===s&&i.scaleY===a&&i.deletions===r&&i.version===o)return i.curves;let l=new Map;for(let f=0;f<t.edges.length;f++){let d=t.edges[f],u=e[d.from],c=e[d.to];if(u?.length&&c?.length){let m=r?.get(f);l.set(f,pe(u,c,d.from===d.to,0,0,n,m?$e(e,m):[]))}}return pt.set(e,{graph:t,scaleX:s,scaleY:a,deletions:r,version:o,curves:l}),l}var un=(0,C.packAbgr)(119,119,119,217),ht=(0,C.packAbgr)(136,136,136,217),dn=(0,C.packAbgr)(24,24,28,240),fn=2.2,pn=(0,C.packAbgr)(30,30,36,245),mn=1.8,Ae=.18,hn=11,bn=1.2,gn=1e-6,yn=12,xn=.45;function Mn(e,t=1){let n=t===1?e:e.map(o=>({x:o.x,y:o.y*t})),r=[];for(let o=0;o<n.length;o++){let s=0,a=0;if(o===0){let i=n[1].x-n[0].x,l=n[1].y-n[0].y,f=Math.hypot(i,l);f>0&&(s=-l/f,a=i/f)}else if(o===n.length-1){let i=n[o].x-n[o-1].x,l=n[o].y-n[o-1].y,f=Math.hypot(i,l);f>0&&(s=-l/f,a=i/f)}else{let i=n[o].x-n[o-1].x,l=n[o].y-n[o-1].y,f=Math.hypot(i,l),d=n[o+1].x-n[o].x,u=n[o+1].y-n[o].y,c=Math.hypot(d,u);if(f>0&&c>0){let m=-l/f,p=i/f,h=-u/c,g=d/c;s=(m+h)/2,a=(p+g)/2;let b=m*s+p*a;b>.1&&(s/=b,a/=b)}else f>0?(s=-l/f,a=i/f):c>0&&(s=-u/c,a=d/c)}r.push({nx:s,ny:a})}return r}function Rn(e,t,n,r=1){return e.map((o,s)=>({x:o.x+t[s].nx*n,y:o.y+t[s].ny*n/r}))}function Le(e,t,n,r){return(0,C.packAbgr)(Math.round(e*255),Math.round(t*255),Math.round(n*255),Math.round(r*255))}function ve(e,t,n){let r=(1-Math.abs(2*n-1))*t,o=r*(1-Math.abs(e/60%2-1)),s=n-r/2,a=0,i=0,l=0;return e<60?(a=r,i=o):e<120?(a=o,i=r):e<180?(i=r,l=o):e<240?(i=o,l=r):e<300?(a=o,l=r):(a=r,l=o),[a+s,i+s,l+s]}var Nn=[[68,1,84],[59,82,139],[33,145,140],[94,201,98],[253,231,37]],wn=[[237,137,44],[158,42,122]],Sn=[[220,50,50],[50,120,220]];function He(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),r=Math.min(e.length-2,Math.floor(n)),o=n-r,s=e[r],a=e[r+1];return(0,C.packAbgr)(Math.round(s[0]+(a[0]-s[0])*o),Math.round(s[1]+(a[1]-s[1])*o),Math.round(s[2]+(a[2]-s[2])*o),255)}function An(e,t){let[n,r,o]=ve(Ze(e),Ge,Oe);return Le(n,r,o,t)}var Ln=300,vn=.7,Cn=.5,En=(0,C.packAbgr)(60,65,72,255);function Yr(e,t){let n=rt(e);if(t&&t.end>t.start)return{start:t.start,span:t.end-t.start,midpoints:n};let r=1/0,o=-1/0;for(let s of n.values())r=Math.min(r,s),o=Math.max(o,s);return{start:r===1/0?0:r,span:o>r?o-r:1,midpoints:n}}function In(e){let t=1/0,n=-1/0,r=1/0,o=-1/0,s=0;for(let a of e.nodes)a.stable!==void 0&&a.stable.rank>s&&(s=a.stable.rank),a.depth<t&&(t=a.depth),a.depth>n&&(n=a.depth),a.length<r&&(r=a.length),a.length>o&&(o=a.length);return{minDepth:t,maxDepth:n,minLength:r,maxLength:o,maxRank:s,nodeCount:e.nodes.length}}function kn(e,t,n,r){switch(n){case"random":return An(e.id,1);case"depth":return He(Nn,r.maxDepth>r.minDepth?(e.depth-r.minDepth)/(r.maxDepth-r.minDepth):.5);case"node-length":return He(Sn,r.maxLength>r.minLength?(e.length-r.minLength)/(r.maxLength-r.minLength):.5);case"stable-rank":return e.stable===void 0?(0,C.packAbgr)(160,160,160,255):e.stable.rank===0?(0,C.packAbgr)(52,152,219,255):He(wn,r.maxRank>1?(e.stable.rank-1)/(r.maxRank-1):0);case"reference-position":{let o=r.referenceRamp,s=o?.midpoints.get(e.id);if(o===void 0||s===void 0)return(0,C.packAbgr)(160,160,160,255);if(e.stable!==void 0&&e.stable.rank>0)return En;let a=Math.max(0,Math.min(1,(s-o.start)/o.span)),[i,l,f]=ve(a*Ln,vn,Cn);return Le(i,l,f,1)}case"grey":return(0,C.packAbgr)(160,160,160,255);case"rainbow":{let o=r.nodeCount>1?t/r.nodeCount*360:0,[s,a,i]=ve(o,.75,.5);return Le(s,a,i,1)}default:return(0,C.packAbgr)(52,152,219,255)}}function Gn(e,t=1){let n=e.x1-e.cx1,r=(e.y1-e.cy1)*t;return Math.hypot(n,r)>0?Math.atan2(r,n):Math.atan2((e.y1-e.y0)*t,e.x1-e.x0)}function On(e,t){let n=!1;for(let r=0;r<e.length-1&&!n;r++){let o=e[r],s=e[r+1];n=Math.max(o.x,s.x)>=t.minX&&Math.min(o.x,s.x)<=t.maxX&&Math.max(o.y,s.y)>=t.minY&&Math.min(o.y,s.y)<=t.maxY}return n}function _n(e,t){for(let n of e){let r=Math.min(n.x0,n.cx0,n.cx1,n.x1),o=Math.max(n.x0,n.cx0,n.cx1,n.x1),s=Math.min(n.y0,n.cy0,n.cy1,n.y1),a=Math.max(n.y0,n.cy0,n.cy1,n.y1);if(o>=t.minX&&r<=t.maxX&&a>=t.minY&&s<=t.maxY)return!0}return!1}var bt=new WeakMap;function Bn(e){let t=bt.get(e);if(!t){let n=[],r=new Map,o=e.paths??[];for(let s=0;s<o.length;s++){let[a,i,l]=ve(Qe(s,o.length),Ge,Oe);n.push(Le(a,i,l,.85)),r.has(o[s].name)||r.set(o[s].name,s)}t={pathColorByIndex:n,pathIndexByName:r},bt.set(e,t)}return t}var gt=new WeakMap,Tn=new Map;function Pn(e){let t=gt.get(e);if(!t){t=new Map;for(let[n,r]of(e.paths??[]).entries())for(let o of new Set(r.nodeIds)){let s=t.get(o);s?s.push(n):t.set(o,[n])}gt.set(e,t)}return t}function Fr(e){let{nodePositions:t,graph:n,nodeById:r,colorScheme:o,contigThickness:s,connectorThickness:a,drawPaths:i,nodeWidth:l="uniform",highlight:f,axis:d,linearLayout:u,viewportBounds:c,referenceRamp:m,deletions:p,hiddenEdges:h,version:g=0}=e,b=l==="depth"?qe(n):0,y=d.scaleX,N=Se(d),w=mt(t,n,d,p,g),M=[],R=new Map,L=[],G=new Map,I=[],V=new Map,ne={...In(n),referenceRamp:m},q=new Map;if(o==="rainbow")for(let x=0;x<n.nodes.length;x++)q.set(n.nodes[x].id,x);let P=n.paths?.length??0,{pathColorByIndex:k,pathIndexByName:J}=Bn(n),Z=x=>k[J.get(x)??-1]??ht,$=i&&P>1?Pn(n):Tn,me=y>(u?1:xn);for(let x=0;x<n.edges.length;x++){let v=n.edges[x],O=t[v.from],H=t[v.to],_=w.get(x);if(!O?.length||!H?.length||!_||h?.has(x))continue;let D=v.pathIds?.length??0,z=p?.get(x)!==void 0,W=f?.edgeIndexes.has(x)??!1,X=a/2*(z?fn:1)*(W?mn:1),Q=i&&D>0,se=z?dn:un,re=f?W?pn:de(se,Ae):se,he=(ye,xe,B,ce)=>{let Y=ye===0&&xe===0?_:dt(_,ye,xe);if(!(c&&!_n(Y,c))){if(z)for(let le of ut(Y,hn/y))I.push({curves:le,thickness:X,color:B});else I.push({curves:Y,thickness:X,color:B});if(me&&ce!==void 0){let le=Y[Y.length-1];L.push({x:le.x1,y:le.y1,angle:Gn(le,N),size:yn,color:ce})}}},be=I.length,ae=L.length;if(!Q)he(0,0,re,re);else{let ye=ft(O,H,D,d),xe=Math.floor((D-1)/2);for(let B=0;B<D;B++){let ce=ye[B],Y=Z(v.pathIds[B]);he(ce.x,ce.y,f&&v.pathIds[B]!==f.name?de(Y,Ae):Y,B===xe?re:void 0)}}let ge=I.length-be;ge>0&&V.set(x,{start:be,count:ge});let ie=L.length-ae;ie>0&&G.set(x,{start:ae,count:ie})}for(let[x,v]of Object.entries(t)){let O=r.get(x);if(!O||c&&!On(v,c))continue;let H=kn(O,q.get(x)??0,o,ne),_=f!==void 0&&!f.nodeIds.has(x),D=_?de(H,Ae):H,oe=Je(O,s,l,b),z=oe/2,W=M.length,X=$.get(x),Q=oe/P,se=v.length>=2;if(se&&X?.length&&Q>=bn){let he=Mn(v,N),be=1/Math.max(y,gn);for(let ae of X){let ge=(ae-(P-1)/2)*Q*be,ie=k[ae]??ht;M.push({points:Rn(v,he,ge,N),thickness:Q/2,color:_?de(ie,Ae):ie})}}else se&&M.push({points:v,thickness:z,color:D});let re=M.length-W;re>0&&R.set(x,{start:W,count:re})}return{nodeStrokes:M,nodeStrokeRuns:R,arrows:L,arrowRuns:G,edgeCurves:I,edgeCurveRuns:V}}function Vr(e){return ue(e)?yt(e):void 0}function yt(e){return{sample:Re(e.stable.refName),haplotype:je(e.stable.refName),refName:Ke(e.stable.refName),start:e.stable.start,end:e.stable.start+e.length}}function $n(e,t){let n=[...e].sort((s,a)=>s.start-a.start),r,o;for(let s of n)o=o&&s.start-o.end<=t?{start:o.start,end:Math.max(o.end,s.end)}:{start:s.start,end:s.end},(!r||o.end-o.start>r.end-r.start)&&(r=o);return r}function Hn(e){return`${e.haplotype??e.sample}\0${e.refName}`}function qr(e,{maxGap:t=1/0}={}){let n=new Map;for(let o of e.nodes)if(ue(o)){let s=yt(o),a=Hn(s),i=n.get(a);i?(i.spans.push({start:s.start,end:s.end}),i.rank=Math.min(i.rank,o.stable.rank)):n.set(a,{sample:s.sample,haplotype:s.haplotype,refName:s.refName,rank:o.stable.rank,spans:[{start:s.start,end:s.end}]})}let r=new Map;for(let o of n.values()){let s=$n(o.spans,t);if(s){let a={sample:o.sample,haplotype:o.haplotype,refName:o.refName,start:s.start,end:s.end,rank:o.rank,nodeCount:o.spans.length},i=o.haplotype??o.sample,l=r.get(i);(!l||a.nodeCount>l.nodeCount)&&r.set(i,a)}}return[...r.values()].sort((o,s)=>+(o.rank!==0)-+(s.rank!==0)||o.sample.localeCompare(s.sample)||(o.haplotype??"").localeCompare(s.haplotype??""))}function Dn(e,t){return(t.haplotype===void 0?void 0:e(t.haplotype))??e(t.sample)}function Jr(e,t){return e.flatMap(n=>{let r=Dn(t,n);return r===void 0?[]:[{...n,sample:r}]})}function Zr(e){return`${e.refName}:${e.start+1}-${e.end}`}function De(e){return`${e.refName}:${(e.start+1).toLocaleString()}-${e.end.toLocaleString()}`}var xt=ee(Me(),1),Mt=(0,T.createSvgIcon)((0,xt.jsx)("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows");var Rt=ee(Me(),1),Nt=(0,T.createSvgIcon)((0,Rt.jsx)("path",{d:"M17 5h-2V3h2zm-2 16h2v-2.59L19.59 21 21 19.59 18.41 17H21v-2h-6zm4-12h2V7h-2zm0 4h2v-2h-2zm-8 8h2v-2h-2zM7 5h2V3H7zM3 17h2v-2H3zm2 4v-2H3c0 1.1.9 2 2 2M19 3v2h2c0-1.1-.9-2-2-2m-8 2h2V3h-2zM3 9h2V7H3zm4 12h2v-2H7zm-4-8h2v-2H3zm0-8h2V3c-1.1 0-2 .9-2 2"}),"HighlightAlt");var wt=ee(Me(),1),ze=(0,T.createSvgIcon)((0,wt.jsx)("path",{d:"M3 16h5v-2H3zm6.5 0h5v-2h-5zm6.5 0h5v-2h-5zM3 20h2v-2H3zm4 0h2v-2H7zm4 0h2v-2h-2zm4 0h2v-2h-2zm4 0h2v-2h-2zM3 12h8v-2H3zm10 0h8v-2h-8zM3 4v4h18V4z"}),"LineStyle");var zn="Linear genome view",Wn="Linear synteny view",Xn="No synteny track in this session aligns these assemblies";function St({label:e,icon:t,entries:n,entryLabel:r,onSelect:o,disabledHelpText:s,nameTheOnlyEntry:a=!0}){let[i]=n,l=s?[{label:e,icon:t,disabled:!0,disabledHelpText:s,onClick:()=>{}}]:[];return n.length===0?l:n.length===1&&i?[{label:a?`${e} \u2014 ${r(i)}`:e,icon:t,onClick:o(i)}]:[{label:e,icon:t,type:"subMenu",subMenu:n.map(f=>({label:r(f),onClick:o(f)}))}]}function uo({contributors:e,syntenyTracks:t,onShowLinear:n,onShowSynteny:r}){let o=t[0]?.coverage??e.length;return[...St({label:zn,icon:ze,entries:e,entryLabel:s=>`${s.sample} ${De(s)}`,onSelect:s=>()=>{n({location:s,assembly:s.sample})}}),...e.length>=2?St({label:`${Wn} (${o} assemblies)`,icon:Mt,entries:t,entryLabel:s=>s.coverage<o?`${s.name} (${s.coverage} of ${o})`:s.name,nameTheOnlyEntry:!1,disabledHelpText:Xn,onSelect:s=>()=>{r(s.trackId)}}):[]]}function fo({own:e,reference:t,highlight:n,onShowLinear:r,onHighlight:o}){let s=[e?{label:`Open in ${e.assembly} \u2014 ${De(e.location)}`,target:e}:void 0,t&&t.assembly!==e?.assembly?{label:`Open in ${t.assembly} \u2014 around this node`,target:t}:void 0].filter(a=>a!==void 0);return[...o&&n?[{label:`Highlight in ${n.assembly}`,icon:Nt,onClick:()=>{o(n)}}]:[],...s.map(({label:a,target:i})=>({label:a,icon:ze,onClick:()=>{r(i)}}))]}var Fn=40;function te(e){return e>=1e4?`${(e/1e3).toFixed(0)} kb`:e>=1e3?`${(e/1e3).toFixed(1)} kb`:`${e} bp`}function jn(e,t){let n=te(e),r=te(t),o=r.slice(r.indexOf(" "));return n.endsWith(o)?`${n.slice(0,-o.length)}\u2013${r}`:`${n}\u2013${r}`}function Lt(e){return e>=Ve?"\u22652.1B routes":e>=1e5?`${(e/1e3).toFixed(0)}k routes`:`${e} routes`}function bo(e){let t=Kn(e);return e.partial?{...t,label:`${t.label}, partial`}:t}function Kn(e){let t=e.end-e.start,{shortestAlleleLength:n,longestAlleleLength:r,pathCount:o,segmentCount:s,inversion:a}=e,i=jn(n,r);if(s>=Fn)return{kind:"superbubble",label:`${i} superbubble, ${s} segments, ${Lt(o)}${a?", inv":""}`};if(a)return{kind:"inversion",label:`${te(r)} inv`};if(o>=8&&r>5*Math.max(n,1))return{kind:"repeat",label:`${i} repeat array, ${Lt(o)}`};let l=o>2?`, ${o} alleles`:"";return n===r&&n===t?t<=1?{kind:"snp",label:"SNP"}:{kind:"substitution",label:`${te(t)} sub`}:t===0||n===t?{kind:"insertion",label:`\u2264${te(r-t)} ins${l}`}:r===t?{kind:"deletion",label:`${te(t-n)} del${l}`}:{kind:"complex",label:`${te(t)} ref \u2192 ${i}, ${o} alleles`}}var go={snp:"#5b6b7a",substitution:"#5b6b7a",insertion:"#2f8fd6",deletion:"#c94040",inversion:"#e07b00",repeat:"#8e3fbf",superbubble:"#8e3fbf",complex:"#8e3fbf"},yo={snp:"SNP",substitution:"substitution",insertion:"insertion",deletion:"deletion",inversion:"inversion",repeat:"repeat array",superbubble:"superbubble",complex:"site"};function xo(e){return e.segments.split(",").filter(Boolean)}function No(e){let t=new Map,n=new Map,r=(c,m,p)=>{let h=c.get(m);h?h.push(p):c.set(m,[p])};for(let c of e.edges)r(t,c.from,c.to),r(n,c.to,c.from);let o=(c,m)=>c!==m&&t.get(c)?.length===1&&n.get(m)?.length===1,s=new Map,a=new Map;for(let c of e.nodes){let m=n.get(c.id);if(s.has(c.id)||m?.length===1&&o(m[0],c.id))continue;let p=[c.id];for(;;){let h=t.get(p.at(-1))?.[0];if(h===void 0||s.has(h)||!o(p.at(-1),h))break;p.push(h)}for(let h of p)s.set(h,c.id);p.length>1&&a.set(c.id,p)}for(let c of e.nodes)s.has(c.id)||s.set(c.id,c.id);let i=new Map(e.nodes.map(c=>[c.id,c])),l=[];for(let c of e.nodes){if(s.get(c.id)!==c.id)continue;let m=a.get(c.id);if(!m){l.push(c);continue}let p=m.map(b=>i.get(b)),h=p.filter(S),g=h.length?h.reduce((b,y)=>b.stable.start<=y.stable.start?b:y):p[0];l.push({id:c.id,name:c.name,length:p.reduce((b,y)=>b+y.length,0),depth:c.depth,stable:g.stable})}let f=new Set;for(let c of a.values())for(let m=1;m<c.length;m++)f.add(`${c[m-1]}>${c[m]}`);let d=new Set,u=[];for(let c of e.edges){let m=`${s.get(c.from)}>${s.get(c.to)}`;f.has(`${c.from}>${c.to}`)||d.has(m)||(d.add(m),u.push({from:s.get(c.from),to:s.get(c.to)}))}return{graph:{...e,nodes:l,edges:u,paths:void 0,pathVisits:void 0},runs:a}}function wo(e,t,n){let r={...e};for(let[o,s]of t){let a=e[o];if(!a?.length)continue;delete r[o];let i=Xe(a),l=i.at(-1),f=s.map(c=>Math.max(n(c),0)),d=f.reduce((c,m)=>c+m,0)||s.length,u=0;s.forEach((c,m)=>{let p=d?f[m]/d*l:l/s.length,h=m===s.length-1?l:u+p;r[c]=vt(a,i,u,h),u=h})}return r}function So(e,t,n){if(e.length===0)return[];let r=Xe(e),o=r.at(-1);return vt(e,r,t*o,n*o)}function Ao(e){let t=Xe(e);return We(e,t,t.at(-1)/2)}function Xe(e){let t=[0];for(let n=1;n<e.length;n++)t.push(t[n-1]+Math.hypot(e[n].x-e[n-1].x,e[n].y-e[n-1].y));return t}function We(e,t,n){if(n<=0)return{...e[0]};let r=1;for(;r<t.length&&t[r]<n;)r++;if(r>=t.length)return{...e.at(-1)};let o=t[r]-t[r-1],s=o>0?(n-t[r-1])/o:0,a=e[r-1],i=e[r];return{x:a.x+(i.x-a.x)*s,y:a.y+(i.y-a.y)*s}}function vt(e,t,n,r){let o=[We(e,t,n)];for(let s=0;s<e.length;s++)t[s]>n&&t[s]<r&&o.push({...e[s]});return o.push(We(e,t,r)),o}function Ct(e){return e.sample??Re(e.name)}function Un(e){return e.haplotype!==void 0&&e.sample!==void 0?`${e.sample}#${e.haplotype}`:Ct(e)}function Vn(e,t,n,r=!0){if(!n||!r)return{ids:e,complete:!0};let o=-1,s=-1,a=-1/0,i=1/0;if(e.forEach((f,d)=>{let u=t.get(f);u&&(u.end<=n.start&&u.end>a&&(a=u.end,o=d),u.start>=n.end&&u.start<i&&(i=u.start,s=d))}),o<0||s<0)return{ids:e,complete:!1};let l=e.slice(Math.min(o,s)+1,Math.max(o,s));return{ids:o<s?l:l.reverse(),complete:!0}}function Et(e,t,n){let r=e.paths??[],o=r.find(p=>ke(p.name).name===e.referencePath)??r[0];if(!o||r.length<2)return;let s=new Map(e.nodes.map(p=>[p.id,p.length])),a=new Set(o.nodeIds),i=e.anchorPaths?.find(p=>p.name===ke(o.name).name)?.start??0,l=t&&t.end>t.start?t:void 0,f=new Map,d=i;for(let p of o.nodeIds){let h=s.get(p)??0;f.has(p)||f.set(p,{start:d,end:d+h}),d+=h}let u=l===void 0||[...f.values()].some(p=>p.end<=l.start)&&[...f.values()].some(p=>p.start>=l.end),c=p=>{let{ids:h,complete:g}=Vn(p.nodeIds,f,l,u),b=[],y=0,N=0;for(let w of h){let M=s.get(w)??0,R=a.has(w),L=b.at(-1);L?.onReference===R?L.bp+=M:b.push({start:y,bp:M,onReference:R}),y+=M,R||(N+=M)}return{name:p.name,label:Un(p),sample:Ct(p),bp:y,offReferenceBp:N,complete:g,runs:b}};return{origin:l?l.start:i,unit:n,reference:c(o),rows:r.filter(p=>p!==o).map(c).sort((p,h)=>Number(h.complete)-Number(p.complete)||h.bp-p.bp||p.label.localeCompare(h.label))}}var qn=1.3;function Jn(e){let t=e.reference.bp;for(let n of e.rows)t=Math.max(t,n.bp);return{maxX:e.origin+t*qn,maxY:e.rows.length*20}}function It(e,t){let n=F(e),r=Et(e,t);if(n.length===0||!r)return;let o=j(n),s=[{label:r.reference.label,y:0},...r.rows.map((a,i)=>({label:a.label,y:(i+1)*20}))];return{nodePositions:o,rowLabels:s,referenceAxis:!0,pixelRows:!0,extent:Jn(r)}}function Ce(e){let t=e.split("#"),n=t.length>=2?Number(t[1]):Number.NaN;return{sample:t[0]??e,haplotype:Number.isFinite(n)?n:void 0}}function Zn(e,t,n,r){let o=[],s=[],a=[e];for(r.add(e);a.length>0;){let i=a.pop(),l=t.get(i);if(l){o.push(l);for(let f of n.get(i)??[]){let d=t.get(f);d&&(d.stable.rank===0?s.push(d):r.has(f)||(r.add(f),a.push(f)))}}}return{members:o,anchors:s}}function Qn(e){if(new Set(e.map(i=>i.stable.refName)).size!==1||e.length<2)return;let n=[...e].sort((i,l)=>i.stable.start-l.stable.start),r=n[0],o=n.at(-1),s=r.stable.start+r.length,a=o.stable.start;return a>=s?{start:s,end:a,entry:r}:void 0}function er(e,t,n){let r=new Map(e.map(a=>[a.id,a])),o=new Map,s=[];for(let a of n.get(t.id)??[])r.has(a)&&(o.set(a,0),s.push(a));if(s.length===0)for(let a of e)o.set(a.id,0),s.push(a.id);for(let a of s){let i=o.get(a)+r.get(a).length;for(let l of n.get(a)??[])if(r.has(l)){let f=o.get(l);(f===void 0||i<f)&&(o.set(l,i),s.push(l))}}return o}function tr(e,t,n){let r=er(e,t,n),o=[...e].sort((l,f)=>r.get(l.id)-r.get(f.id)),s=new Map(o.map((l,f)=>[l.id,f])),a=new Map(e.map(l=>[l.id,l])),i=new Map;for(let[l,f]of o.entries()){let d=0;for(let u of n.get(f.id)??[]){let c=a.get(u);c&&s.get(u)<l&&(d=Math.max(d,i.get(u)+c.length))}i.set(f.id,d)}return{offsets:i,ordered:o}}function Gt(e){let t=new Map(e.nodes.filter(ue).map(s=>[s.id,s])),n=fe(e),r=new Set,o=[];for(let s of t.values())if(s.stable.rank!==0&&!r.has(s.id)){let{members:a,anchors:i}=Zn(s.id,t,n,r),l=Qn(i);if(l){let{offsets:f,ordered:d}=tr(a,l.entry,n);o.push({start:l.start,refSpan:l.end-l.start,nodeIds:d.map(u=>u.id),nodeOffsets:d.map(u=>f.get(u.id)),pathLength:d.reduce((u,c)=>Math.max(u,f.get(c.id)+c.length),0)})}}return o.sort((s,a)=>s.start-a.start)}var nr=1,rr=.015;function Ee({graph:e,span:t,rowY:n,positions:r}){let o=t*rr,s=Gt(e),a=new Map(e.nodes.map(d=>[d.id,d])),i=[];for(let d of s){let u=d.refSpan-d.pathLength;u>=nr&&i.push({nodeIds:d.nodeIds,bp:u});let c=Math.max(d.refSpan,o),m=d.pathLength>0?c/d.pathLength:0;d.nodeIds.forEach((p,h)=>{let g=a.get(p);if(g){let b=d.nodeOffsets[h],y=c/d.nodeIds.length,N=M=>d.start+M*m,w=n(g);r[p]=m?[{x:N(b),y:w},{x:N(b+g.length),y:w}]:[{x:d.start+h*y,y:w},{x:d.start+(h+1)*y,y:w}]}})}let l=fe(e),f=Object.keys(r);for(let d of f){let u=r[d].at(-1).x;for(let c of l.get(d)??[]){let m=a.get(c);if(m&&!(c in r)){let p=n(m);r[c]=[{x:u,y:p},{x:u+o,y:p}],f.push(c)}}}return i}function or(e){let t=new Set;for(let n of e.nodes)n.stable&&t.add(n.stable.rank);return new Map([...t].sort((n,r)=>n-r).map((n,r)=>[n,r]))}function Ot(e,t){let n=F(e);if(n.length===0)return;let r=we(n,t),o=or(e),s=j(n),a=Ee({graph:e,span:r,rowY:l=>(l.stable?o.get(l.stable.rank)??o.size:o.size)*20,positions:s}),i=[...o].map(([l,f])=>({label:l===0?"Reference (rank 0)":`Rank ${l}`,y:f*20}));return{nodePositions:s,rowLabels:i,referenceAxis:!0,pixelRows:!0,alleleDeletions:a}}var sr=12,Ye=20;function _t(e){return 10+8*Math.log2(1+e.length)}function K(e,t){return e<t?-1:e>t?1:0}function Tt(e,t){return K(e.at,t.at)||K(e.side,t.side)||K(e.hops,t.hops)}var Bt={at:1/0,side:0,hops:0};function ar(e){let t=new Map(e.nodes.map(r=>[r.id,r])),n=lr(e);return e.nodes.map(r=>r.id).sort((r,o)=>Tt(n.get(r)??Bt,n.get(o)??Bt)||K(t.get(r).name,t.get(o).name)||K(r,o))}function ir(e,t){let n=new Set(e.nodes.map(d=>d.id)),r=new Map(t.map(d=>[d.id,d.stable.start])),o=new Map,s=new Map;t.forEach((d,u)=>{s.set(d.id,t[u-1]?.id),o.set(d.id,t[u+1]?.id)});let a=t[0]?.id,i=(d,u)=>{let c=o.get(d);o.set(d,u),s.set(u,d),o.set(u,c),c!==void 0&&s.set(c,u)},l=(d,u)=>{let c=s.get(d);c===void 0?(a=u,s.set(u,void 0),o.set(u,d),s.set(d,u)):i(c,u)};for(let d of e.paths??[]){let u=0,c=0,m;for(let b of d.nodeIds){let y=r.get(b);y!==void 0&&(m!==void 0&&y!==m&&(y>m?u++:c++),m=y)}let p=c>u?[...d.nodeIds].reverse():d.nodeIds,h,g=new Set;for(let b of p)if(o.has(b)){if(h===void 0)for(let y of g)l(b,y);h=b}else n.has(b)&&(h===void 0?g.add(b):(i(h,b),h=b))}let f=[];for(let d=a;d!==void 0;d=o.get(d))f.push(d);return f}function cr(e,t){let n=[...t.entries()].sort(([a,i],[l,f])=>Tt(i,f)||K(a,l)).map(([a])=>a),r=n.length;for(let a of n){let i=t.get(a);for(let l of e.get(a)??[])t.has(l)||(t.set(l,{at:i.at,side:1,hops:i.hops+1}),n.push(l))}let o=new Set(n.slice(r)),s=new Set;for(let a of o){if(s.has(a))continue;let{at:i}=t.get(a),l=[a];s.add(a);let f=!0;for(let d of l){let{hops:u}=t.get(d),c=!0,m=!1;for(let p of e.get(d)??[]){let h=t.get(p);h.at===i&&o.has(p)?(c&&=h.hops<=u,s.has(p)||(s.add(p),l.push(p))):h.at!==i&&(m||=h.at<i,f&&=h.at<i)}f&&=!c||m}if(f)for(let d of l){let u=t.get(d);t.set(d,{...u,side:-1,hops:-u.hops})}}}function lr(e){let t=new Set(e.nodes.map(s=>s.id)),n=new Map;for(let s of e.edges)!t.has(s.from)||!t.has(s.to)||((n.get(s.from)??n.set(s.from,[]).get(s.from)).push(s.to),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push(s.from));let r=e.nodes.filter(S).sort((s,a)=>K(s.stable.start,a.stable.start)||K(s.name,a.name)),o=new Map;return ir(e,r).forEach((s,a)=>{o.set(s,{at:a,side:0,hops:0})}),cr(n,o),o}function ur(e){let t=new Map(e.nodes.map(u=>[u.id,u])),n=ar(e),r=new Map(n.map((u,c)=>[u,c])),o=u=>S(t.get(u)),s=new Map(n.map(u=>[u,[]])),a=new Map(n.map(u=>[u,[]])),i=(u,c)=>{s.get(c).push(u),a.get(u).push(c)};for(let u of e.edges)u.from===u.to||!r.has(u.from)||!r.has(u.to)||(r.get(u.from)<r.get(u.to)?i(u.from,u.to):i(u.to,u.from));let l=n.filter(o);for(let u=1;u<l.length;u++)i(l[u-1],l[u]);let f=new Map;for(let u of n){let c=0;for(let m of s.get(u))c=Math.max(c,f.get(m)+1);f.set(u,c)}for(let u=n.length-1;u>=0;u--){let c=n[u],m=a.get(c);if(o(c)||m.length===0)continue;let p=1/0;for(let b of m)p=Math.min(p,f.get(b));let h=f.get(c),g=Math.max(h,p-1);f.set(c,Math.floor((h+g)/2))}let d=[];for(let u of n)(d[f.get(u)]??=[]).push(u);return{layers:d,layerOf:f,preds:s}}function Pt(e){if(!e.nodes.some(S))return;let t=new Map(e.nodes.map(u=>[u.id,u])),n=u=>S(t.get(u)),{layers:r,layerOf:o,preds:s}=ur(e),a=r.map(u=>{let c=0;for(let m of u)c=Math.max(c,_t(t.get(m)));return c}),i=[],l=0;for(let u=0;u<r.length;u++)i[u]=l,l+=a[u]+sr;let f=new Map;for(let u of r){let c=[];for(let p of u){if(n(p)){f.set(p,0);continue}let h=s.get(p).filter(b=>f.has(b)),g=0;for(let b of h)g+=f.get(b)/h.length;c.push({id:p,ideal:g===0?Ye:g})}c.sort((p,h)=>p.ideal-h.ideal);let m=new Set([0]);for(let{id:p,ideal:h}of c){let g=Math.round(h/Ye);g===0&&(g=h>=0?1:-1);for(let b=1;m.has(g);b++)m.has(g+b)?m.has(g-b)||(g-=b):g+=b;m.add(g),f.set(p,g*Ye)}}let d={};for(let u of e.nodes){let c=o.get(u.id),m=_t(u),p=i[c]+a[c]/2,h=f.get(u.id);d[u.id]=[{x:p-m/2,y:h},{x:p+m/2,y:h}]}return{nodePositions:d,referenceAxis:!1,pixelRows:!0}}function dr(e,t){let n=new Map;for(let o of e.nodes)if(Ne(o)){let{sample:s}=Ce(o.stable.refName);n.set(s,(n.get(s)??0)+o.length)}let r=new Map(t.map((o,s)=>[o,s]));return[...n.keys()].sort((o,s)=>(r.get(o)??1/0)-(r.get(s)??1/0)||n.get(s)-n.get(o)||o.localeCompare(s))}function $t(e,t,n=[]){let r=F(e),o=dr(e,n);if(r.length===0||o.length===0)return;let s=we(r,t),a=new Map(o.map((c,m)=>[c,m+1])),i=j(r),l=o.length+1,f=Ee({graph:e,span:s,rowY:c=>{let m=c.stable;return((m?a.get(Ce(m.refName).sample):void 0)??l)*20},positions:i}),u=[{label:Ce(r[0].stable.refName).sample,y:0},...o.map(c=>({label:c,y:a.get(c)*20}))];return{nodePositions:i,rowLabels:u,sampleRows:o,referenceAxis:!0,pixelRows:!0,alleleDeletions:f}}function Ht(e){let t=F(e);if(t.length!==0)return{nodePositions:j(t),referenceAxis:!0,pixelRows:!0}}var fr="Force-directed layout",U=e=>e.nodes.some(S),Dt=e=>U(e)&&(e.paths?.length??0)>1,zt=e=>U(e)&&e.nodes.some(Ne),Fe=[{value:"auto",label:"Anchored",description:"x is reference bp, one row per stable rank. Needs rGFA tags or a reference path.",run:Ot,referenceAxis:!0,available:U,drawsLocally:U},{value:"samplerows",label:"Sample rows",description:"x is reference bp, one row per contributing assembly. Needs rGFA tags or a reference path.",run:$t,referenceAxis:!0,available:zt,drawsLocally:zt},{value:"walkrows",label:"Walk rows",description:"x is each walk's own bp: one bar per haplotype, sequence the reference also carries in blue and sequence it does not in purple, so a repeat expansion reads as bar length. Needs W or P lines.",run:It,referenceAxis:!0,available:Dt,drawsLocally:Dt},{value:"ordered",label:"Ordered",description:"x is reference order, not bp: every node gets room, bubbles read as lenses. Needs rGFA tags or a reference path.",run:Pt,referenceAxis:!1,available:U,drawsLocally:U},{value:"variants",label:"Variant map",description:"The reference as a line with one typed glyph per bubble, from the bubble index or from the graph itself: SNP, indel, deletion, inversion, repeat array. Click a glyph to open the graph inside it.",run:Ht,referenceAxis:!0,available:U,drawsLocally:U},{value:"force",label:fr,description:"OGDF FMMM, via the external Bandage engine.",run:()=>{},referenceAxis:!1,available:()=>!0,drawsLocally:()=>!1}],as=Fe.map(e=>e.value);function is(e,t){return!pr(e).drawsLocally(t)}function pr(e){return Fe.find(t=>t.value===e)??Fe[0]}function mr(e,t){return Math.abs(t-e)<=.1*Math.max(e,t)}function hr(e,t){let n=e.length,r=t.length,o=Array.from({length:n+1},()=>new Array(r+1).fill(0)),s=Array.from({length:n+1},()=>new Array(r+1).fill(!1));for(let i=n-1;i>=0;i--)for(let l=r-1;l>=0;l--){let f=Math.abs(e[i]-t[l])+o[i+1][l+1],d=n-i>r-l?o[i+1][l]:1/0,u=r-l>n-i?o[i][l+1]:1/0;o[i][l]=Math.min(f,d,u),s[i][l]=o[i][l]===f}let a=new Array(n).fill(void 0);for(let i=0,l=0;i<n&&l<r;)s[i][l]?a[i++]=l++:n-i>r-l?i++:l++;return a}function Wt(e,t){return e.map((n,r)=>({item:n,i:r})).sort((n,r)=>t(n.item)-t(r.item))}var Xt=e=>e.spanningReads!==0;function br(e,t){let n=new Map,r=new Set,o=Wt(e,a=>a.bp),s=[[o.filter(a=>a.item.complete),t.filter(Xt)],[o,t]];for(let[a,i]of s){let l=a.filter(d=>!n.has(d.i)),f=Wt(i.filter(d=>!r.has(d)),d=>d.bp);hr(l.map(d=>d.item.bp),f.map(d=>d.item.bp)).forEach((d,u)=>{if(d!==void 0){let c=l[u],m=f[d].item;r.add(m),n.set(c.i,{...m,agrees:c.item.complete&&Xt(m)?mr(c.item.bp,m.bp):void 0})}})}return n}function ls(e,t){if(!t)return e;let n=new Map,r=new Map;for(let o of e)r.set(o.sample,[...r.get(o.sample)??[],o]);for(let[o,s]of r){let a=t[o];if(a)for(let[i,l]of br(s,a))n.set(s[i],l)}return e.map(o=>({...o,call:n.get(o)}))}var Yt=ee(Me(),1),fs=(0,T.createSvgIcon)((0,Yt.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");export{T as a,_e as b,Yn as c,te as d,bo as e,go as f,yo as g,xo as h,Lr as i,vr as j,Cr as k,dt as l,Se as m,ft as n,ar as o,Gr as p,Or as q,No as r,wo as s,So as t,Ao as u,fe as v,Kt as w,Et as x,Jn as y,Fe as z,as as A,is as B,pr as C,Mr as D,mt as E,Ln as F,Yr as G,Fr as H,ls as I,Vr as J,qr as K,Dn as L,Jr as M,Zr as N,De as O,uo as P,fo as Q,fs as R};
|
|
2
|
+
//# sourceMappingURL=chunk-5WJPRX4N.js.map
|