jbrowse-plugin-graphgenomeviewer 6.0.1 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/GbzBaseSyntenyAdapter-MB7NQPOZ.js +8 -0
- package/dist/chunks/{GbzBaseSyntenyAdapter-TQVDD3OC.js.map → GbzBaseSyntenyAdapter-MB7NQPOZ.js.map} +3 -3
- package/dist/chunks/{GraphGenomeView-AY2FO4P2.js → GraphGenomeView-QAJUST4R.js} +2 -2
- package/dist/chunks/{GraphGenomeView-AY2FO4P2.js.map → GraphGenomeView-QAJUST4R.js.map} +1 -1
- package/dist/chunks/GraphTrackSettingsDialog-CLI6V424.js +4 -0
- package/dist/chunks/{GraphTrackSettingsDialog-QJXPMWYG.js.map → GraphTrackSettingsDialog-CLI6V424.js.map} +1 -1
- package/dist/chunks/LinearGraphDisplay-2ZCJVTOZ.js +2 -0
- package/dist/chunks/{LinearGraphDisplay-GKVG72J4.js.map → LinearGraphDisplay-2ZCJVTOZ.js.map} +1 -1
- package/dist/chunks/MinigraphBubbleAdapter-5AQXW2NH.js +2 -0
- package/dist/chunks/{MinigraphBubbleAdapter-CZYQROL2.js.map → MinigraphBubbleAdapter-5AQXW2NH.js.map} +1 -1
- package/dist/chunks/RgfaTabixAdapter-P3RQBV2A.js +3 -0
- package/dist/chunks/{RgfaTabixAdapter-LQGQXCVO.js.map → RgfaTabixAdapter-P3RQBV2A.js.map} +1 -1
- package/dist/chunks/{bandage-layout-UCRW4G4J.js → bandage-layout-3AR6BCUD-7PXT4PRO.js} +15 -15
- package/dist/chunks/bandage-layout-3AR6BCUD-7PXT4PRO.js.map +7 -0
- package/dist/chunks/chunk-3TODQETZ.js +2 -0
- package/dist/chunks/{chunk-LJZDHT2C.js.map → chunk-3TODQETZ.js.map} +1 -1
- package/dist/chunks/chunk-5TCH4S5W.js +2 -0
- package/dist/chunks/chunk-5TCH4S5W.js.map +7 -0
- package/dist/chunks/chunk-6YAGPYAT.js +3 -0
- package/dist/chunks/chunk-6YAGPYAT.js.map +7 -0
- package/dist/chunks/chunk-KTZHBWBF.js +5 -0
- package/dist/chunks/chunk-KTZHBWBF.js.map +7 -0
- package/dist/chunks/chunk-NRYLVZMG.js +3 -0
- package/dist/chunks/chunk-NRYLVZMG.js.map +7 -0
- package/dist/chunks/chunk-TIMQMQZE.js +2 -0
- package/dist/chunks/chunk-TIMQMQZE.js.map +7 -0
- package/dist/chunks/chunk-X7R52TDL.js +2 -0
- package/dist/chunks/chunk-X7R52TDL.js.map +7 -0
- package/dist/chunks/chunk-XEY4OTQ5.js +2 -0
- package/dist/chunks/chunk-XEY4OTQ5.js.map +7 -0
- package/dist/chunks/chunk-XYYKXQ73.js +2 -0
- package/dist/chunks/chunk-XYYKXQ73.js.map +7 -0
- package/dist/chunks/{chunk-S3X3QFQD.js → chunk-Y5WX5MAD.js} +2 -2
- package/dist/chunks/chunk-YBLNN5FU.js +1 -0
- package/dist/chunks/chunk-YBLNN5FU.js.map +7 -0
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +5 -5
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +3 -7
- package/src/GraphGenomeView/components/ReferenceStripOverlay.tsx +1 -1
- package/src/GraphGenomeView/components/TubeMapOverlay.tsx +1 -1
- package/src/GraphGenomeView/pane/fitViews.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/chunks/GbzBaseSyntenyAdapter-TQVDD3OC.js +0 -8
- package/dist/chunks/GraphTrackSettingsDialog-QJXPMWYG.js +0 -4
- package/dist/chunks/LinearGraphDisplay-GKVG72J4.js +0 -2
- package/dist/chunks/MinigraphBubbleAdapter-CZYQROL2.js +0 -2
- package/dist/chunks/RgfaTabixAdapter-LQGQXCVO.js +0 -3
- package/dist/chunks/bandage-layout-UCRW4G4J.js.map +0 -7
- package/dist/chunks/chunk-2V27PV25.js +0 -3
- package/dist/chunks/chunk-2V27PV25.js.map +0 -7
- package/dist/chunks/chunk-7BKUWQE5.js +0 -2
- package/dist/chunks/chunk-7BKUWQE5.js.map +0 -7
- package/dist/chunks/chunk-FNHKEAKB.js +0 -5
- package/dist/chunks/chunk-FNHKEAKB.js.map +0 -7
- package/dist/chunks/chunk-K5Z47YVI.js +0 -2
- package/dist/chunks/chunk-K5Z47YVI.js.map +0 -7
- package/dist/chunks/chunk-KULNKXPT.js +0 -2
- package/dist/chunks/chunk-KULNKXPT.js.map +0 -7
- package/dist/chunks/chunk-LJZDHT2C.js +0 -2
- package/dist/chunks/chunk-NWJN4C4V.js +0 -2
- package/dist/chunks/chunk-NWJN4C4V.js.map +0 -7
- package/dist/chunks/chunk-SCMIJAAX.js +0 -3
- package/dist/chunks/chunk-SCMIJAAX.js.map +0 -7
- package/dist/chunks/chunk-UQEPPJEO.js +0 -2
- package/dist/chunks/chunk-UQEPPJEO.js.map +0 -7
- /package/dist/chunks/{chunk-S3X3QFQD.js.map → chunk-Y5WX5MAD.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as x}from"./chunk-
|
|
1
|
+
import{a as x}from"./chunk-NRYLVZMG.js";import"./chunk-3TODQETZ.js";import"./chunk-XYYKXQ73.js";import{ca as L}from"./chunk-5TCH4S5W.js";import"./chunk-TIMQMQZE.js";import"./chunk-6YAGPYAT.js";import"./chunk-XEY4OTQ5.js";import"./chunk-YBLNN5FU.js";import"./chunk-X7R52TDL.js";import"./chunk-FCWXYIFC.js";import{a as B}from"./chunk-J6KYLXRD.js";import{a as s,b as v,c as g,d as G}from"./chunk-TYJTJGPO.js";import{b as a}from"./chunk-FY3BTKY4.js";var S=a(g(),1);var m=a(v(),1),n=a(G(),1),C=a(g(),1),P=a(L(),1),o=a(s(),1),I=(0,P.makeStyles)()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),b=(0,C.observer)(function({model:e}){let{classes:r}=I();return e.isLoading?(0,o.jsxs)(n.Paper,{className:r.paper,"data-testid":"graph-genome-loading",children:[(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(m.LoadingEllipses,{variant:"h6",message:e.statusMessage}),(0,o.jsx)(n.Button,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{e.cancelLoad()},children:"Cancel"})]}),(0,o.jsx)(n.LinearProgress,{variant:"indeterminate"})]}):e.error?(0,o.jsx)(n.Paper,{className:r.paper,children:(0,o.jsx)(m.ErrorBanner,{error:e.error,onReset:()=>{e.retryLoad()}})}):(0,o.jsx)(n.Paper,{className:r.paper,"data-testid":"graph-genome-load-canceled",children:(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(n.Typography,{variant:"h6",children:"Loading canceled"}),(0,o.jsx)(n.Button,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{e.retryLoad()},children:"Retry"})]})})}),h=b;var M=a(B(),1),N=a(v(),1),i=a(G(),1),w=a(g(),1),E=a(L(),1),t=a(s(),1),k=`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`,z=(0,E.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"}}),R=(0,w.observer)(function({model:e}){let{classes:r}=z(),[d,T]=(0,M.useState)("");function y(){d.trim()&&e.loadGFAFromLocation({uri:d,locationType:"UriLocation"})}function A(p){let c=p.target.files?.[0];c&&c.text().then(f=>e.loadGFA(f,c.name)).catch(f=>{e.setError(f)})}return(0,t.jsxs)(i.Paper,{className:r.paper,children:[(0,t.jsx)("div",{className:r.header,children:(0,t.jsx)(i.Typography,{variant:"h6",children:"Load a GFA graph"})}),(0,t.jsxs)("div",{className:r.column,children:[(0,t.jsxs)("div",{className:r.rowCenter,children:[(0,t.jsxs)(i.Button,{variant:"outlined",component:"label",size:"small",children:["Choose file",(0,t.jsx)("input",{type:"file",accept:".gfa,.gfa1,.gfa2",hidden:!0,onChange:p=>{A(p)}})]}),(0,t.jsx)(i.Typography,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),(0,t.jsxs)("div",{className:r.rowEnd,children:[(0,t.jsx)(i.TextField,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:d,onChange:p=>{T(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&y()},className:r.flex1}),(0,t.jsx)(i.Button,{variant:"contained",onClick:()=>{y()},disabled:!d.trim(),children:"Open"})]})]}),(0,t.jsx)("div",{className:r.footer,children:(0,t.jsx)(i.Button,{size:"small",onClick:()=>{e.loadGFA(k,"Example graph")},children:"Load 4-node example"})}),e.error?(0,t.jsx)(N.ErrorBanner,{error:e.error}):null]})}),F=R;var l=a(s(),1),U=(0,S.observer)(function({model:e}){return e.hasGraph?(0,l.jsx)(x,{model:e}):e.canRetryLoad&&(e.error||e.loadCanceled)?(0,l.jsx)(h,{model:e}):(0,l.jsxs)(l.Fragment,{children:[e.isLoading?(0,l.jsx)(h,{model:e}):null,(0,l.jsx)("div",{hidden:e.isLoading,children:(0,l.jsx)(F,{model:e})})]})}),O=U;export{O as default};
|
|
10
|
-
//# sourceMappingURL=GraphGenomeView-
|
|
10
|
+
//# sourceMappingURL=GraphGenomeView-QAJUST4R.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/GraphGenomeView/components/GraphGenomeView.tsx", "../../src/GraphGenomeView/components/GraphLoadStatus.tsx", "../../src/GraphGenomeView/components/ImportForm.tsx"],
|
|
4
4
|
"sourcesContent": ["import { observer } from 'mobx-react'\n\nimport GraphCanvas from './GraphCanvas'\nimport GraphLoadStatus from './GraphLoadStatus'\nimport ImportForm from './ImportForm'\n\nimport type { GraphPaneModel } from '../model'\n\nconst GraphGenomeView = observer(function GraphGenomeView({\n model,\n}: {\n model: GraphPaneModel\n}) {\n if (model.hasGraph) {\n return <GraphCanvas model={model} />\n }\n // A launched or restored view has a source of its own, so the import form\n // has nothing to offer it when that source fails\n if (model.canRetryLoad && (model.error || model.loadCanceled)) {\n return <GraphLoadStatus model={model} />\n }\n // Hidden rather than unmounted, so a typed URL survives a failed load\n return (\n <>\n {model.isLoading ? <GraphLoadStatus model={model} /> : null}\n <div hidden={model.isLoading}>\n <ImportForm model={model} />\n </div>\n </>\n )\n})\n\nexport default GraphGenomeView\n", "import { ErrorBanner, LoadingEllipses } from '@jbrowse/core/ui'\nimport { Button, LinearProgress, Paper, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n paper: {\n padding: 16,\n margin: 8,\n maxWidth: 560,\n marginInline: 'auto',\n display: 'flex',\n flexDirection: 'column',\n gap: 12,\n },\n row: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 8,\n },\n})\n\n// What a view with no graph on screen shows while its load runs, and after a\n// load of a source it can retry was canceled or failed.\nconst GraphLoadStatus = observer(function GraphLoadStatus({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n if (model.isLoading) {\n return (\n <Paper className={classes.paper} data-testid=\"graph-genome-loading\">\n <div className={classes.row}>\n <LoadingEllipses variant=\"h6\" message={model.statusMessage} />\n <Button\n size=\"small\"\n data-testid=\"graph-genome-cancel\"\n onClick={() => {\n model.cancelLoad()\n }}\n >\n Cancel\n </Button>\n </div>\n <LinearProgress variant=\"indeterminate\" />\n </Paper>\n )\n }\n if (model.error) {\n return (\n <Paper className={classes.paper}>\n <ErrorBanner\n error={model.error}\n onReset={() => {\n model.retryLoad()\n }}\n />\n </Paper>\n )\n }\n return (\n <Paper className={classes.paper} data-testid=\"graph-genome-load-canceled\">\n <div className={classes.row}>\n <Typography variant=\"h6\">Loading canceled</Typography>\n <Button\n variant=\"contained\"\n size=\"small\"\n data-testid=\"graph-genome-retry\"\n onClick={() => {\n model.retryLoad()\n }}\n >\n Retry\n </Button>\n </div>\n </Paper>\n )\n})\n\nexport default GraphLoadStatus\n", "import { useState } from 'react'\n\nimport { ErrorBanner } from '@jbrowse/core/ui'\nimport { Button, Paper, TextField, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst EXAMPLE_GFA = `H\\tVN:Z:1.0\nS\\t1\\tACGT\nS\\t2\\tGGCC\nS\\t3\\tTTAA\nS\\t4\\tCCGG\nL\\t1\\t+\\t2\\t+\\t0M\nL\\t1\\t+\\t3\\t+\\t0M\nL\\t2\\t+\\t4\\t+\\t0M\nL\\t3\\t+\\t4\\t+\\t0M`\n\nconst useStyles = makeStyles()({\n column: { display: 'flex', flexDirection: 'column', gap: 8 },\n rowEnd: { display: 'flex', gap: 8, alignItems: 'flex-end' },\n rowCenter: { display: 'flex', gap: 8, alignItems: 'center' },\n flex1: { flex: 1 },\n paper: { padding: 16, margin: 8, maxWidth: 560, marginInline: 'auto' },\n header: { marginBottom: 12 },\n footer: { marginTop: 12, display: 'flex', justifyContent: 'flex-end' },\n})\n\nconst ImportForm = observer(function ImportForm({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const [url, setUrl] = useState('')\n\n function handleUrlLoad() {\n if (url.trim()) {\n void model.loadGFAFromLocation({ uri: url, locationType: 'UriLocation' })\n }\n }\n\n function handleFileUpload(event: React.ChangeEvent<HTMLInputElement>) {\n const file = event.target.files?.[0]\n if (file) {\n file\n .text()\n .then(text => model.loadGFA(text, file.name))\n .catch((err: unknown) => {\n model.setError(err)\n })\n }\n }\n\n return (\n <Paper className={classes.paper}>\n <div className={classes.header}>\n <Typography variant=\"h6\">Load a GFA graph</Typography>\n </div>\n\n <div className={classes.column}>\n <div className={classes.rowCenter}>\n <Button variant=\"outlined\" component=\"label\" size=\"small\">\n Choose file\n <input\n type=\"file\"\n accept=\".gfa,.gfa1,.gfa2\"\n hidden\n onChange={event => {\n handleFileUpload(event)\n }}\n />\n </Button>\n <Typography variant=\"caption\" color=\"text.secondary\">\n Whole-file GFA; best for small/medium graphs.\n </Typography>\n </div>\n\n <div className={classes.rowEnd}>\n <TextField\n size=\"small\"\n label=\"URL\"\n placeholder=\"https://example.com/graph.gfa\"\n value={url}\n onChange={e => {\n setUrl(e.target.value)\n }}\n onKeyDown={e => {\n if (e.key === 'Enter') {\n handleUrlLoad()\n }\n }}\n className={classes.flex1}\n />\n <Button\n variant=\"contained\"\n onClick={() => {\n handleUrlLoad()\n }}\n disabled={!url.trim()}\n >\n Open\n </Button>\n </div>\n </div>\n\n <div className={classes.footer}>\n <Button\n size=\"small\"\n onClick={() => {\n void model.loadGFA(EXAMPLE_GFA, 'Example graph')\n }}\n >\n Load 4-node example\n </Button>\n </div>\n\n {model.error ? <ErrorBanner error={model.error} /> : null}\n </Paper>\n )\n})\n\nexport default ImportForm\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "8bAAA,IAAAA,EAAyB,SCAzB,IAAAC,EAA6C,SAC7CC,EAA0D,SAC1DC,EAAyB,SACzBC,EAA2B,SAiCnBC,EAAA,SA7BFC,KAAY,cAAW,EAAE,CAC7B,MAAO,CACL,QAAS,GACT,OAAQ,EACR,SAAU,IACV,aAAc,OACd,QAAS,OACT,cAAe,SACf,IAAK,EACP,EACA,IAAK,CACH,QAAS,OACT,WAAY,SACZ,eAAgB,gBAChB,IAAK,CACP,CACF,CAAC,EAIKC,KAAkB,YAAS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B,EACA,SAAU,CAACF,EAAI,KAAK,EACrB,gBAED,GACF,GACF,KAEA,OAAC,OAAI,UAAWD,EAAQ,OACtB,mBAAC,UACC,KAAK,QACL,QAAS,IAAM,CACRD,EAAM,QAAQH,EAAa,eAAe,CACjD,EACD,+BAED,EACF,EAECG,EAAM,SAAQ,OAAC,eAAY,MAAOA,EAAM,MAAO,EAAK,MACvD,CAEJ,CAAC,EAEMW,EAAQZ,EF7GJ,IAAAa,EAAA,SANLC,KAAkB,YAAS,SAAyB,CACxD,MAAAC,CACF,EAEG,CACD,OAAIA,EAAM,YACD,OAACC,EAAA,CAAY,MAAOD,EAAO,EAIhCA,EAAM,eAAiBA,EAAM,OAASA,EAAM,iBACvC,OAACE,EAAA,CAAgB,MAAOF,EAAO,KAItC,oBACG,UAAAA,EAAM,aAAY,OAACE,EAAA,CAAgB,MAAOF,EAAO,EAAK,QACvD,OAAC,OAAI,OAAQA,EAAM,UACjB,mBAACG,EAAA,CAAW,MAAOH,EAAO,EAC5B,GACF,CAEJ,CAAC,EAEMI,EAAQL",
|
|
6
6
|
"names": ["import_mobx_react", "import_ui", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "GraphLoadStatus", "model", "classes", "GraphLoadStatus_default", "import_react", "import_ui", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "EXAMPLE_GFA", "useStyles", "ImportForm", "model", "classes", "url", "setUrl", "handleUrlLoad", "handleFileUpload", "event", "file", "text", "err", "e", "ImportForm_default", "import_jsx_runtime", "GraphGenomeView", "model", "GraphCanvas_default", "GraphLoadStatus_default", "ImportForm_default", "GraphGenomeView_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as g}from"./chunk-3TODQETZ.js";import{ca as f}from"./chunk-5TCH4S5W.js";import"./chunk-XEY4OTQ5.js";import"./chunk-X7R52TDL.js";import{a as x}from"./chunk-J6KYLXRD.js";import{a as l,c as m,d as y}from"./chunk-TYJTJGPO.js";import{b as o}from"./chunk-FY3BTKY4.js";var a=o(y(),1),b=o(m(),1),S=o(f(),1),n=o(l(),1),L=(0,S.makeStyles)()({section:{marginBottom:24},formControl:{minWidth:200}}),w=[{value:0,label:"None"},{value:1,label:"1 hop"},{value:2,label:"2 hops"}],k=(0,b.observer)(function({model:e}){let{classes:t}=L();return(0,n.jsxs)("div",{className:t.section,children:[(0,n.jsxs)(a.FormControl,{className:t.formControl,children:[(0,n.jsx)(a.InputLabel,{children:"Graph context"}),(0,n.jsx)(a.Select,{value:e.subgraphContext,label:"Graph context","data-testid":"graph-context-select",onChange:p=>{e.setSubgraphContext(p.target.value),e.cut()},children:w.map(({value:p,label:u})=>(0,n.jsx)(a.MenuItem,{value:p,children:u},p))})]}),(0,n.jsx)(a.Typography,{variant:"caption",color:"text.secondary",children:"How far the cut follows links out of the region, one hop by default. A detour that leaves the reference before the window and rejoins after it is indexed under its own sequence, so at none its middle is missing and the one bubble draws as two unrelated stubs. Each hop costs a query per off-reference segment already reached."})]})}),v=k;var C=o(x(),1),d=o(y(),1),c=o(m(),1),G=o(f(),1),i=o(l(),1),T=(0,G.makeStyles)()({section:{marginBottom:24}});function M(r){let e=r.split(/[\s,]+/).map(t=>t.trim()).filter(t=>t!=="");return e.length===0?void 0:e}var F=(0,c.observer)(function({model:e}){let[t,p]=(0,C.useState)(e.chosenHaplotypes?.join(", ")??""),u=()=>{let s=M(t)??[];s.join(`
|
|
2
|
+
`)===(e.chosenHaplotypes??[]).join(`
|
|
3
|
+
`)||(e.setSubgraphHaplotypes(s),e.cut())};return(0,i.jsx)(d.TextField,{fullWidth:!0,label:"Haplotypes",placeholder:"every haplotype",value:t,slotProps:{htmlInput:{"data-testid":"graph-haplotypes-field"}},onChange:s=>{p(s.target.value)},onBlur:()=>{u()},onKeyDown:s=>{s.key==="Enter"&&u()}})}),N=(0,c.observer)(function({model:e}){let{classes:t}=T();return e.adapterConfig.type==="GbzBaseSyntenyAdapter"?(0,i.jsxs)("div",{className:t.section,children:[(0,i.jsx)(F,{model:e},e.chosenHaplotypes?.join(",")??""),(0,i.jsx)(d.Typography,{variant:"caption",color:"text.secondary",children:"The haplotypes the cut is for, as lane assembly names or PanSN prefixes (HG002#1, or HG002 for both), separated by commas. The cut keeps their walks and the nodes those walks visit, with the reference. Empty is every haplotype."})]}):null}),H=N;var h=o(l(),1);function B({model:r,open:e,onClose:t}){return(0,h.jsxs)(g,{model:r,open:e,onClose:t,children:[(0,h.jsx)(v,{model:r}),(0,h.jsx)(H,{model:r})]})}export{B as default};
|
|
4
|
+
//# sourceMappingURL=GraphTrackSettingsDialog-CLI6V424.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/LinearGraphDisplay/components/SubgraphContextSelect.tsx", "../../src/LinearGraphDisplay/components/SubgraphHaplotypesField.tsx", "../../src/LinearGraphDisplay/components/GraphTrackSettingsDialog.tsx"],
|
|
4
4
|
"sourcesContent": ["import {\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Typography,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { LinearGraphCutModel } from '../model'\n\nconst useStyles = makeStyles()({\n section: {\n marginBottom: 24,\n },\n formControl: {\n minWidth: 200,\n },\n})\n\n// Hops past the region's own segments, each costing a tabix query per\n// off-reference segment already reached. One is the default: at none a single\n// detour draws as two unrelated stubs, which is a wrong picture of the graph\n// rather than a cheaper one. Two exists for a graph whose alleles have alleles\n// (HPRC's amylase window keeps growing at 2, the E. coli paa locus does not), and\n// it stops there because a frontier is still not a bubble decomposition. Cut an\n// exact slice with gfatools when that is what is wanted.\nconst SUBGRAPH_CONTEXTS = [\n { value: 0, label: 'None' },\n { value: 1, label: '1 hop' },\n { value: 2, label: '2 hops' },\n]\n\nconst SubgraphContextSelect = observer(function SubgraphContextSelect({\n model,\n}: {\n model: LinearGraphCutModel\n}) {\n const { classes } = useStyles()\n return (\n <div className={classes.section}>\n <FormControl className={classes.formControl}>\n <InputLabel>Graph context</InputLabel>\n <Select\n value={model.subgraphContext}\n label=\"Graph context\"\n data-testid=\"graph-context-select\"\n onChange={e => {\n model.setSubgraphContext(e.target.value)\n void model.cut()\n }}\n >\n {SUBGRAPH_CONTEXTS.map(({ value, label }) => (\n <MenuItem key={value} value={value}>\n {label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n <Typography variant=\"caption\" color=\"text.secondary\">\n How far the cut follows links out of the region, one hop by default. A\n detour that leaves the reference before the window and rejoins after it\n is indexed under its own sequence, so at none its middle is missing and\n the one bubble draws as two unrelated stubs. Each hop costs a query per\n off-reference segment already reached.\n </Typography>\n </div>\n )\n})\n\nexport default SubgraphContextSelect\n", "import { useState } from 'react'\n\nimport { TextField, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { LinearGraphCutModel } from '../model'\n\nconst useStyles = makeStyles()({\n section: {\n marginBottom: 24,\n },\n})\n\nexport function parseHaplotypeList(text: string) {\n const names = text\n .split(/[\\s,]+/)\n .map(name => name.trim())\n .filter(name => name !== '')\n return names.length === 0 ? undefined : names\n}\n\nconst HaplotypeListField = observer(function HaplotypeListField({\n model,\n}: {\n model: LinearGraphCutModel\n}) {\n const [draft, setDraft] = useState(model.chosenHaplotypes?.join(', ') ?? '')\n const apply = () => {\n const parsed = parseHaplotypeList(draft) ?? []\n const unchanged =\n parsed.join('\\n') === (model.chosenHaplotypes ?? []).join('\\n')\n if (!unchanged) {\n model.setSubgraphHaplotypes(parsed)\n void model.cut()\n }\n }\n return (\n <TextField\n fullWidth\n label=\"Haplotypes\"\n placeholder=\"every haplotype\"\n value={draft}\n slotProps={{ htmlInput: { 'data-testid': 'graph-haplotypes-field' } }}\n onChange={e => {\n setDraft(e.target.value)\n }}\n onBlur={() => {\n apply()\n }}\n onKeyDown={e => {\n if (e.key === 'Enter') {\n apply()\n }\n }}\n />\n )\n})\n\n// Only a GBZ cut reads the set. The inner field is keyed on it so an outside\n// change (a restored session, a launch) resets the draft rather than fighting\n// it.\nconst SubgraphHaplotypesField = observer(function SubgraphHaplotypesField({\n model,\n}: {\n model: LinearGraphCutModel\n}) {\n const { classes } = useStyles()\n return model.adapterConfig.type === 'GbzBaseSyntenyAdapter' ? (\n <div className={classes.section}>\n <HaplotypeListField\n key={model.chosenHaplotypes?.join(',') ?? ''}\n model={model}\n />\n <Typography variant=\"caption\" color=\"text.secondary\">\n The haplotypes the cut is for, as lane assembly names or PanSN prefixes\n (HG002#1, or HG002 for both), separated by commas. The cut keeps their\n walks and the nodes those walks visit, with the reference. Empty is\n every haplotype.\n </Typography>\n </div>\n ) : null\n})\n\nexport default SubgraphHaplotypesField\n", "import SubgraphContextSelect from './SubgraphContextSelect'\nimport SubgraphHaplotypesField from './SubgraphHaplotypesField'\nimport GraphSettingsDialog from '../../GraphGenomeView/components/GraphSettingsDialog'\n\nimport type { LinearGraphCutModel } from '../model'\n\nexport default function GraphTrackSettingsDialog({\n model,\n open,\n onClose,\n}: {\n model: LinearGraphCutModel\n open: boolean\n onClose: () => void\n}) {\n return (\n <GraphSettingsDialog model={model} open={open} onClose={onClose}>\n <SubgraphContextSelect model={model} />\n <SubgraphHaplotypesField model={model} />\n </GraphSettingsDialog>\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "+QAAA,IAAAA,EAMO,SACPC,EAAyB,SACzBC,EAA2B,SAkCrBC,EAAA,SA9BAC,KAAY,cAAW,EAAE,CAC7B,QAAS,CACP,aAAc,EAChB,EACA,YAAa,CACX,SAAU,GACZ,CACF,CAAC,EASKC,EAAoB,CACxB,CAAE,MAAO,EAAG,MAAO,MAAO,EAC1B,CAAE,MAAO,EAAG,MAAO,OAAQ,EAC3B,CAAE,MAAO,EAAG,MAAO,QAAS,CAC9B,EAEMC,KAAwB,YAAS,SAA+B,CACpE,MAAAC,CACF,EAEG,CACD,GAAM,CAAE,QAAAC,CAAQ,EAAIJ,EA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,cAAe,wBAAyB,CAAE,EACpE,SAAUI,GAAK,CACbH,EAASG,EAAE,OAAO,KAAK,CACzB,EACA,OAAQ,IAAM,CACZF,EAAM,CACR,EACA,UAAWE,GAAK,CACVA,EAAE,MAAQ,SACZF,EAAM,CAEV,EACF,CAEJ,CAAC,EAKKG,KAA0B,YAAS,SAAiC,CACxE,MAAAN,CACF,EAEG,CACD,GAAM,CAAE,QAAAO,CAAQ,EAAIb,EAAU,EAC9B,OAAOM,EAAM,cAAc,OAAS,2BAClC,QAAC,OAAI,UAAWO,EAAQ,QACtB,oBAACR,EAAA,CAEC,MAAOC,GADFA,EAAM,kBAAkB,KAAK,GAAG,GAAK,EAE5C,KACA,OAAC,cAAW,QAAQ,UAAU,MAAM,iBAAiB,+OAKrD,GACF,EACE,IACN,CAAC,EAEMQ,EAAQF,ECpEX,IAAAG,EAAA,SAVW,SAARC,EAA0C,CAC/C,MAAAC,EACA,KAAAC,EACA,QAAAC,CACF,EAIG,CACD,SACE,QAACC,EAAA,CAAoB,MAAOH,EAAO,KAAMC,EAAM,QAASC,EACtD,oBAACE,EAAA,CAAsB,MAAOJ,EAAO,KACrC,OAACK,EAAA,CAAwB,MAAOL,EAAO,GACzC,CAEJ",
|
|
6
6
|
"names": ["import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "SUBGRAPH_CONTEXTS", "SubgraphContextSelect", "model", "classes", "e", "value", "label", "SubgraphContextSelect_default", "import_react", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "parseHaplotypeList", "text", "names", "name", "HaplotypeListField", "model", "draft", "setDraft", "apply", "parsed", "e", "SubgraphHaplotypesField", "classes", "SubgraphHaplotypesField_default", "import_jsx_runtime", "GraphTrackSettingsDialog", "model", "open", "onClose", "GraphSettingsDialog_default", "SubgraphContextSelect_default", "SubgraphHaplotypesField_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as i}from"./chunk-NRYLVZMG.js";import"./chunk-3TODQETZ.js";import"./chunk-XYYKXQ73.js";import"./chunk-5TCH4S5W.js";import"./chunk-TIMQMQZE.js";import"./chunk-6YAGPYAT.js";import"./chunk-XEY4OTQ5.js";import"./chunk-YBLNN5FU.js";import"./chunk-X7R52TDL.js";import"./chunk-FCWXYIFC.js";import"./chunk-J6KYLXRD.js";import{a as e,c as d}from"./chunk-TYJTJGPO.js";import{a as h,b as t}from"./chunk-FY3BTKY4.js";var p=h((l,o)=>{o.exports=JBrowseExports["@jbrowse/display-kit/DisplayChrome"]});var s=t(p(),1),n=t(d(),1);var r=t(e(),1),y=(0,n.observer)(function({model:a}){return(0,r.jsx)(s.DisplayStatusChrome,{model:a,phase:a.displayPhase,drawn:a.painted&&a.geometryPainted,testid:"linear-graph-display","data-layout":a.chosenLayoutMode,"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:{width:a.paneWidth,height:a.height,overflow:"hidden"},children:(0,r.jsx)(i,{model:a,ownChrome:!1})})}),c=y;export{c as default};
|
|
2
|
+
//# sourceMappingURL=LinearGraphDisplay-2ZCJVTOZ.js.map
|
package/dist/chunks/{LinearGraphDisplay-GKVG72J4.js.map → LinearGraphDisplay-2ZCJVTOZ.js.map}
RENAMED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["global-externals:@jbrowse/display-kit/DisplayChrome", "../../src/LinearGraphDisplay/components/LinearGraphDisplay.tsx"],
|
|
4
4
|
"sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/display-kit/DisplayChrome\"];", "import { DisplayStatusChrome } from '@jbrowse/display-kit/DisplayChrome'\nimport { observer } from 'mobx-react'\n\nimport GraphCanvas from '../../GraphGenomeView/components/GraphCanvas'\n\nimport type { LinearGraphDisplayModel } from '../model'\n\nconst LinearGraphDisplay = observer(function LinearGraphDisplay({\n model,\n}: {\n model: LinearGraphDisplayModel\n}) {\n return (\n <DisplayStatusChrome\n model={model}\n phase={model.displayPhase}\n drawn={model.painted && model.geometryPainted}\n testid=\"linear-graph-display\"\n data-layout={model.chosenLayoutMode}\n data-cut-tier={model.cutTier}\n data-recuts={model.recuts}\n data-node-count={model.hasGraph ? model.nodeCount : undefined}\n data-loading={model.isLoading ? '' : undefined}\n style={{\n width: model.paneWidth,\n height: model.height,\n overflow: 'hidden',\n }}\n >\n <GraphCanvas model={model} ownChrome={false} />\n </DisplayStatusChrome>\n )\n})\n\nexport default LinearGraphDisplay\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "8ZAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,oCAAoC,ICApE,IAAAC,EAAoC,SACpCC,EAAyB,SA4BnB,IAAAC,EAAA,SAtBAC,KAAqB,YAAS,SAA4B,CAC9D,MAAAC,CACF,EAEG,CACD,SACE,OAAC,uBACC,MAAOA,EACP,MAAOA,EAAM,aACb,MAAOA,EAAM,SAAWA,EAAM,gBAC9B,OAAO,uBACP,cAAaA,EAAM,iBACnB,gBAAeA,EAAM,QACrB,cAAaA,EAAM,OACnB,kBAAiBA,EAAM,SAAWA,EAAM,UAAY,OACpD,eAAcA,EAAM,UAAY,GAAK,OACrC,MAAO,CACL,MAAOA,EAAM,UACb,OAAQA,EAAM,OACd,SAAU,QACZ,EAEA,mBAACC,EAAA,CAAY,MAAOD,EAAO,UAAW,GAAO,EAC/C,CAEJ,CAAC,EAEME,EAAQH",
|
|
6
6
|
"names": ["require_DisplayChrome", "__commonJSMin", "exports", "module", "import_DisplayChrome", "import_mobx_react", "import_jsx_runtime", "LinearGraphDisplay", "model", "GraphCanvas_default", "LinearGraphDisplay_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as N,b as C,d as b,e as p}from"./chunk-Y5WX5MAD.js";import"./chunk-KWAXLUPQ.js";import{a as y}from"./chunk-J4OLMLS5.js";import{a as u,c as m,e as g}from"./chunk-TIMQMQZE.js";import"./chunk-YBLNN5FU.js";import"./chunk-X7R52TDL.js";import{b as n}from"./chunk-FY3BTKY4.js";var f=n(N(),1),r=n(y(),1),c=n(C(),1);var o=class extends f.BaseFeatureDataAdapter{static{this.capabilities=["getFeatures","getRefNames"]}constructor(t,a,s){super(t,a,s),this.bubbles=b(this,["bubblesLocation"],["index"]),this.refNames=new p(this.bubbles,this)}async getRefNames(t={}){return this.refNames.assemblyRefNames(t)}async hasDataForRefName(){return!0}getFeatures(t,a={}){let{signal:s,statusCallback:d}=a;return(0,c.ObservableCreate)(async i=>{let l=await this.refNames.resolve(t,a);l!==void 0&&await(0,r.updateStatus)("Downloading bubbles",d,()=>this.bubbles.getLines(l,t.start,t.end,{signal:s,lineCallback:(h,A)=>{let e=u(h);i.next(new r.SimpleFeature({uniqueId:`bubble-${A}`,refName:t.refName,start:e.start,end:e.end,name:m(e),description:g(e),type:"bubble",score:e.segmentCount,segmentCount:e.segmentCount,pathCount:e.pathCount,inversion:e.inversion,shortestAlleleLength:e.shortestAlleleLength,longestAlleleLength:e.longestAlleleLength,segments:e.segments,shortestAllele:e.shortestAllele,longestAllele:e.longestAllele}))}})),i.complete()},s)}};export{o as default};
|
|
2
|
+
//# sourceMappingURL=MinigraphBubbleAdapter-5AQXW2NH.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/MinigraphBubbleAdapter/MinigraphBubbleAdapter.ts"],
|
|
4
4
|
"sourcesContent": ["import {\n bubbleDescription,\n bubbleLabel,\n parseBubbleLine,\n} from '@jbrowse/bandage-core/bubbles/bubbleLine'\nimport { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { SimpleFeature, updateStatus } from '@jbrowse/core/util'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\n\nimport { PanSNRefNames, openTabixSlot } from '../panSNTabix.ts'\n\nimport type { MinigraphBubbleAdapterConfig } from './configSchema.ts'\nimport type PluginManager from '@jbrowse/core/PluginManager'\nimport type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport type { Feature } from '@jbrowse/core/util'\nimport type { Region } from '@jbrowse/core/util/types'\n\nexport default class MinigraphBubbleAdapter extends BaseFeatureDataAdapter<MinigraphBubbleAdapterConfig> {\n public static capabilities = ['getFeatures', 'getRefNames']\n\n private readonly bubbles\n // `gfatools bubble` names each row after the graph's stable sequence, so a\n // Minigraph-Cactus graph produces PanSN rows (`GRCh38#0#chr6`) where a plain\n // minigraph graph produces bare ones (`chr6`). Same resolution the segment\n // adapter does, through the same `assemblyNameToPanSN` slot.\n private readonly refNames\n\n public constructor(\n config: MinigraphBubbleAdapterConfig,\n getSubAdapter?: getSubAdapterType,\n pluginManager?: PluginManager,\n ) {\n super(config, getSubAdapter, pluginManager)\n this.bubbles = openTabixSlot(this, ['bubblesLocation'], ['index'])\n this.refNames = new PanSNRefNames(this.bubbles, this)\n }\n\n async getRefNames(opts: BaseOptions = {}) {\n return this.refNames.assemblyRefNames(opts)\n }\n\n public async hasDataForRefName() {\n return true\n }\n\n getFeatures(query: Region, opts: BaseOptions = {}) {\n const { signal, statusCallback } = opts\n return ObservableCreate<Feature>(async observer => {\n const tabixRefName = await this.refNames.resolve(query, opts)\n if (tabixRefName !== undefined) {\n await updateStatus('Downloading bubbles', statusCallback, () =>\n this.bubbles.getLines(tabixRefName, query.start, query.end, {\n signal,\n lineCallback: (line, fileOffset) => {\n const bubble = parseBubbleLine(line)\n observer.next(\n new SimpleFeature({\n uniqueId: `bubble-${fileOffset}`,\n refName: query.refName,\n start: bubble.start,\n end: bubble.end,\n // How variable this spot is, in two words, since that is the\n // whole point of the track.\n name: bubbleLabel(bubble),\n description: bubbleDescription(bubble),\n type: 'bubble',\n score: bubble.segmentCount,\n segmentCount: bubble.segmentCount,\n pathCount: bubble.pathCount,\n inversion: bubble.inversion,\n shortestAlleleLength: bubble.shortestAlleleLength,\n longestAlleleLength: bubble.longestAlleleLength,\n segments: bubble.segments,\n shortestAllele: bubble.shortestAllele,\n longestAllele: bubble.longestAllele,\n }),\n )\n },\n }),\n )\n }\n observer.complete()\n }, signal)\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "uRAKA,IAAAA,EAAuC,SACvCC,EAA4C,SAC5CC,EAAiC,SAWjC,IAAqBC,EAArB,cAAoD,wBAAqD,CACvG,YAAc,aAAe,CAAC,cAAe,aAAa,EASnD,YACLC,EACAC,EACAC,EACA,CACA,MAAMF,EAAQC,EAAeC,CAAa,EAC1C,KAAK,QAAUC,EAAc,KAAM,CAAC,iBAAiB,EAAG,CAAC,OAAO,CAAC,EACjE,KAAK,SAAW,IAAIC,EAAc,KAAK,QAAS,IAAI,CACtD,CAEA,MAAM,YAAYC,EAAoB,CAAC,EAAG,CACxC,OAAO,KAAK,SAAS,iBAAiBA,CAAI,CAC5C,CAEA,MAAa,mBAAoB,CAC/B,MAAO,EACT,CAEA,YAAYC,EAAeD,EAAoB,CAAC,EAAG,CACjD,GAAM,CAAE,OAAAE,EAAQ,eAAAC,CAAe,EAAIH,EACnC,SAAO,oBAA0B,MAAMI,GAAY,CACjD,IAAMC,EAAe,MAAM,KAAK,SAAS,QAAQJ,EAAOD,CAAI,EACxDK,IAAiB,QACnB,QAAM,gBAAa,sBAAuBF,EAAgB,IACxD,KAAK,QAAQ,SAASE,EAAcJ,EAAM,MAAOA,EAAM,IAAK,CAC1D,OAAAC,EACA,aAAc,CAACI,EAAMC,IAAe,CAClC,IAAMC,EAASC,EAAgBH,CAAI,EACnCF,EAAS,KACP,IAAI,gBAAc,CAChB,SAAU,UAAUG,CAAU,GAC9B,QAASN,EAAM,QACf,MAAOO,EAAO,MACd,IAAKA,EAAO,IAGZ,KAAME,EAAYF,CAAM,EACxB,YAAaG,EAAkBH,CAAM,EACrC,KAAM,SACN,MAAOA,EAAO,aACd,aAAcA,EAAO,aACrB,UAAWA,EAAO,UAClB,UAAWA,EAAO,UAClB,qBAAsBA,EAAO,qBAC7B,oBAAqBA,EAAO,oBAC5B,SAAUA,EAAO,SACjB,eAAgBA,EAAO,eACvB,cAAeA,EAAO,aACxB,CAAC,CACH,CACF,CACF,CAAC,CACH,EAEFJ,EAAS,SAAS,CACpB,EAAGF,CAAM,CACX,CACF",
|
|
6
6
|
"names": ["import_BaseAdapter", "import_util", "import_rxjs", "MinigraphBubbleAdapter", "config", "getSubAdapter", "pluginManager", "openTabixSlot", "PanSNRefNames", "opts", "query", "signal", "statusCallback", "observer", "tabixRefName", "line", "fileOffset", "bubble", "parseBubbleLine", "bubbleLabel", "bubbleDescription"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as G,b as Z,d as R,e as w}from"./chunk-Y5WX5MAD.js";import"./chunk-KWAXLUPQ.js";import{a as j}from"./chunk-J4OLMLS5.js";import"./chunk-YBLNN5FU.js";import"./chunk-X7R52TDL.js";import{b as N}from"./chunk-FY3BTKY4.js";var P=N(G(),1),h=N(j(),1),B=N(Z(),1);function x(n){let e=n.split(" ");return{refName:e[0],start:+e[1],end:+e[2],id:e[3],rank:+e[4],tags:e[5]??""}}function I(n){let e=n.tags.split(" ").find(s=>s.startsWith("SM:Z:"));if(e===void 0)return;let r=e.slice(5).split(",").map(s=>s.trim()).filter(Boolean);return r.length>0?r:void 0}function A(n){return{id:n.slice(0,-1),strand:n.slice(-1)}}function k(n){let e=n.split(" "),r=A(e[3]),s=A(e[4]);return{source:r.id,sourceStrand:r.strand,target:s.id,targetStrand:s.strand,sourceSegment:{id:r.id,refName:e[5],start:+e[6],end:+e[7],rank:+e[8],tags:e[13]??""},targetSegment:{id:s.id,refName:e[9],start:+e[10],end:+e[11],rank:+e[12],tags:e[14]??""}}}function L(n){return`${n.source}${n.sourceStrand}${n.target}${n.targetStrand}`}function M(n,e,r){let s=t=>t.refName!==r.refName||t.end<=r.start||t.start>=r.end;return[...C(n.filter(t=>t.rank>0),e,r.end-r.start),...C(n.filter(t=>t.rank===0&&s(t)),new Set(n.map(t=>t.id)),0)]}function C(n,e,r){let s=[...n].sort((a,i)=>S(a.refName,i.refName)||a.start-i.start),t=[];for(let a of s){let i=t.at(-1);i?.refName===a.refName&&a.start-i.end<=r?(i.needed||=a.start>i.end||e.has(a.id),i.end=Math.max(i.end,a.end)):t.push({refName:a.refName,start:a.start,end:a.end,needed:e.has(a.id)})}return t.filter(a=>a.needed).map(({refName:a,start:i,end:f})=>({refName:a,start:i,end:f}))}function T(n,e,r){let s=t=>e.has(t.id)||r.some(a=>a.refName===t.refName&&t.start>=a.start&&t.end<=a.end);return n.filter(t=>s(t.sourceSegment)&&s(t.targetSegment))}var D=/^[A-Za-z][A-Za-z0-9]:[AifZJHB]:/;function _(n){let{id:e,refName:r,start:s,end:t,rank:a,tags:i}=n,f=i.split(" ").filter(g=>D.test(g)),m=f.length===0?"":` ${f.join(" ")}`;return`S ${e} * LN:i:${t-s} SN:Z:${r} SO:i:${s} SR:i:${a}${m}`}function z(n){let{source:e,sourceStrand:r,target:s,targetStrand:t}=n;return`L ${e} ${r} ${s} ${t} 0M`}function S(n,e){return n<e?-1:n>e?1:0}function F(n,e){let r=[...n.values()].sort((t,a)=>S(t.refName,a.refName)||t.start-a.start||S(t.id,a.id)),s=[...e.keys()].sort((t,a)=>S(t,a));return["H VN:Z:1.0",...r.map(t=>_(t)),...s.map(t=>z(e.get(t)))].join(`
|
|
2
|
+
`)}function v(n){return n.filter(e=>e.rank>0)}var y=class extends P.BaseFeatureDataAdapter{static{this.capabilities=["getFeatures","getRefNames"]}constructor(e,r,s){super(e,r,s),this.fine=this.openIndex([])}openIndex(e){let r=R(this,[...e,"segmentsLocation"],[...e,"segmentsIndex"]);return{segments:r,links:R(this,[...e,"linksLocation"],[...e,"linksIndex"]),refNames:new w(r,this)}}index(e="fine"){return e==="fine"?this.fine:(this.coarse??=this.openIndex(["coarse"]),this.coarse)}async getRefNames(e={}){return this.fine.refNames.assemblyRefNames(e)}async hasDataForRefName(){return!0}getFeatures(e,r={}){let{signal:s,statusCallback:t}=r;return(0,B.ObservableCreate)(async a=>{let i=await this.fine.refNames.resolve(e,r);i!==void 0&&await(0,h.updateStatus)("Downloading segments",t,()=>this.fine.segments.getLines(i,e.start,e.end,{signal:s,lineCallback:f=>{let m=x(f),g=I(m);a.next(new h.SimpleFeature({uniqueId:m.id,refName:e.refName,start:m.start,end:m.end,name:m.id,type:"segment",rank:m.rank,stableName:m.refName,...g&&{samples:g,sampleCount:g.length}}))}})),a.complete()},s)}async getSubgraph(e,r={}){let{hops:s=0,signal:t,tier:a}=r,i=this.index(a),f=new Map,m=new Map,g=await i.refNames.resolve(e,{signal:t}),$=async(d,p,o)=>{let c=[];return await i.links.getLines(d,p,o,{signal:t,lineCallback:O=>{let u=k(O);m.set(L(u),u);for(let l of[u.sourceSegment,u.targetSegment])f.has(l.id)||(f.set(l.id,l),c.push(l))}}),c};if(g===void 0)throw new Error(`${e.assemblyName} ${e.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${e.assemblyName} mapped to its prefix in assemblyNameToPanSN`);await i.segments.getLines(g,e.start,e.end,{signal:t,lineCallback:d=>{let p=x(d);f.set(p.id,p)}});let b=v(await $(g,e.start,e.end));for(let d=0;d<s;d++){let p=await Promise.all(b.map(o=>$(o.refName,o.start,o.end)));b=v(p.flat())}if(s>0){let d=M([...f.values()],new Set(b.map(o=>o.id)),{refName:g,start:e.start,end:e.end}),p=[];await Promise.all(d.map(o=>i.links.getLines(o.refName,o.start,o.end,{signal:t,lineCallback:c=>{p.push(k(c))}})));for(let o of T(p,f,d)){m.set(L(o),o);for(let c of[o.sourceSegment,o.targetSegment])f.has(c.id)||f.set(c.id,c)}}return F(f,m)}};export{y as default};
|
|
3
|
+
//# sourceMappingURL=RgfaTabixAdapter-P3RQBV2A.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/RgfaTabixAdapter/RgfaTabixAdapter.ts", "../../src/RgfaTabixAdapter/rgfaBed.ts"],
|
|
4
4
|
"sourcesContent": ["import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { SimpleFeature, updateStatus } from '@jbrowse/core/util'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\n\nimport { PanSNRefNames, openTabixSlot } from '../panSNTabix.ts'\nimport {\n closingLinks,\n closingSpans,\n formatSubgraph,\n linkKey,\n parseLinkLine,\n parseSegmentLine,\n segmentSamples,\n} from './rgfaBed.ts'\n\nimport type { RgfaTabixAdapterConfig } from './configSchema.ts'\nimport type { SubgraphAdapterOptions, SubgraphTier } from '../GetSubgraph.ts'\nimport type { RgfaLink, RgfaSegment } from './rgfaBed.ts'\nimport type { TabixIndexedFile } from '@gmod/tabix'\nimport type PluginManager from '@jbrowse/core/PluginManager'\nimport type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport type { Feature } from '@jbrowse/core/util'\nimport type { Region } from '@jbrowse/core/util/types'\n\n// What a hop follows: alleles, never the backbone. A rank-0 segment reached\n// through a link is flanking backbone, usually outside the window, so querying\n// its links walks the reference away from the region, brings back more backbone,\n// and closes nothing. Every segment that closes a bubble is an allele interior,\n// and an allele interior is rank > 0 in both index formats (rGFA's SR tag, and\n// pggb's rank 0-or-1 against the anchor path). Reached backbone still becomes a\n// node and its edge still draws; it is only not walked through.\n//\n// This is gfabase's rule, arrived at from the other end. `gfabase sub` expands\n// from a seed either to the whole connected component (`--connected`, which its\n// own README calls overkill) or with `--cutpoints 1`, which takes the biconnected\n// component by *stopping at cutpoints*, the segments every end-to-end walk of\n// the chromosome must traverse. In a reference-anchored pangenome the cutpoints\n// are the backbone, and rank is what the index already states about it, so\n// `rank > 0` is that stopping rule without a connectivity index to build. The\n// third tool is the same shape again: `gfatools view -R` maps the region onto its\n// precomputed bubble decomposition and returns whole overlapping bubbles\n// (gfa_query_by_reg), which is complete for the same reason. Bandage's own\n// `--distance` is a node-step radius, but Bandage holds the entire graph in\n// memory, so its scope is a drawing filter rather than a fetch strategy.\n//\n// Measured with this rule: the E. coli paa window converges at one hop (17\n// segments at 1 and at 2), so the cut closes and stays closed. HPRC's amylase\n// window keeps growing (63 at 0, 78 at 1, 92 at 2) because its alleles have\n// alleles, and wall-clock is flat across all three, since a hop's queries go out\n// together and the remote index dominates.\n//\n// The exact version, when a graph ships a bubble index beside its segments:\n// gfatools' bubble rows carry the member segment ids of every bubble, so the\n// bubbles overlapping the region state which segments a complete cut must\n// contain. That turns the hop count into a termination condition rather than a\n// setting, and MinigraphBubbleAdapter already parses those rows.\nfunction offReference(segments: RgfaSegment[]) {\n return segments.filter(segment => segment.rank > 0)\n}\n\ninterface GraphIndex {\n segments: TabixIndexedFile\n links: TabixIndexedFile\n refNames: PanSNRefNames\n}\n\nexport default class RgfaTabixAdapter extends BaseFeatureDataAdapter<RgfaTabixAdapterConfig> {\n public static capabilities = ['getFeatures', 'getRefNames']\n\n private readonly fine\n private coarse: GraphIndex | undefined\n\n public constructor(\n config: RgfaTabixAdapterConfig,\n getSubAdapter?: getSubAdapterType,\n pluginManager?: PluginManager,\n ) {\n super(config, getSubAdapter, pluginManager)\n this.fine = this.openIndex([])\n }\n\n // refNames off the SEGMENT index: it is the one that names every stable\n // sequence the graph is anchored to, where the link index only names those a\n // link touches.\n private openIndex(under: string[]): GraphIndex {\n const segments = openTabixSlot(\n this,\n [...under, 'segmentsLocation'],\n [...under, 'segmentsIndex'],\n )\n return {\n segments,\n links: openTabixSlot(\n this,\n [...under, 'linksLocation'],\n [...under, 'linksIndex'],\n ),\n refNames: new PanSNRefNames(segments, this),\n }\n }\n\n private index(tier: SubgraphTier = 'fine') {\n if (tier === 'fine') {\n return this.fine\n }\n this.coarse ??= this.openIndex(['coarse'])\n return this.coarse\n }\n\n async getRefNames(opts: BaseOptions = {}) {\n return this.fine.refNames.assemblyRefNames(opts)\n }\n\n public async hasDataForRefName() {\n return true\n }\n\n getFeatures(query: Region, opts: BaseOptions = {}) {\n const { signal, statusCallback } = opts\n return ObservableCreate<Feature>(async observer => {\n const tabixRefName = await this.fine.refNames.resolve(query, opts)\n if (tabixRefName !== undefined) {\n await updateStatus('Downloading segments', statusCallback, () =>\n this.fine.segments.getLines(tabixRefName, query.start, query.end, {\n signal,\n lineCallback: line => {\n const segment = parseSegmentLine(line)\n // `samples` lists the haplotypes whose paths visit the segment and\n // `sampleCount` counts them. A lane's color reads the count, and\n // a count in jexl would otherwise rely on `.length` resolving\n // through a member access on an array.\n const samples = segmentSamples(segment)\n observer.next(\n new SimpleFeature({\n uniqueId: segment.id,\n refName: query.refName,\n start: segment.start,\n end: segment.end,\n name: segment.id,\n type: 'segment',\n rank: segment.rank,\n stableName: segment.refName,\n ...(samples && { samples, sampleCount: samples.length }),\n }),\n )\n },\n }),\n )\n }\n observer.complete()\n }, signal)\n }\n\n // Extract the graph around a region as GFA text, for GraphGenomeView. The\n // region's own segments come from segs.bed.gz; links.bed.gz supplies the edges\n // incident to them *and* the coordinates of the segments on the other end,\n // which typically sit on a different stable sequence (a rank>0 bubble) and so\n // are not reachable by any coordinate query on this region.\n //\n // `hops` is extra rounds of link-following past the region's own segments\n // and their immediate neighbours, each costing one tabix query per\n // off-reference segment newly reached. After the last round, one more read\n // per stretch of stable sequence the cut holds closes it (closingSpans), so\n // an allele reached from both ends draws whole. The view asks for one hop; a\n // hopless cut stays as cheap as it was. `signal` goes to every one of those\n // queries, so a cut the view has replaced stops.\n // `tier: 'coarse'` reads the `coarse` pair instead, the same way.\n async getSubgraph(region: Region, opts: SubgraphAdapterOptions = {}) {\n const { hops = 0, signal, tier } = opts\n const index = this.index(tier)\n const segments = new Map<string, RgfaSegment>()\n const links = new Map<string, RgfaLink>()\n const tabixRefName = await index.refNames.resolve(region, { signal })\n\n const addLinksOver = async (\n refName: string,\n start: number,\n end: number,\n ) => {\n const reached: RgfaSegment[] = []\n await index.links.getLines(refName, start, end, {\n signal,\n lineCallback: line => {\n const link = parseLinkLine(line)\n links.set(linkKey(link), link)\n for (const segment of [link.sourceSegment, link.targetSegment]) {\n if (!segments.has(segment.id)) {\n segments.set(segment.id, segment)\n reached.push(segment)\n }\n }\n },\n })\n return reached\n }\n\n if (tabixRefName === undefined) {\n throw new Error(\n `${region.assemblyName} ${region.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${region.assemblyName} mapped to its prefix in assemblyNameToPanSN`,\n )\n }\n await index.segments.getLines(tabixRefName, region.start, region.end, {\n signal,\n lineCallback: line => {\n const segment = parseSegmentLine(line)\n segments.set(segment.id, segment)\n },\n })\n let frontier = offReference(\n await addLinksOver(tabixRefName, region.start, region.end),\n )\n for (let hop = 0; hop < hops; hop++) {\n // One hop's queries are independent of each other, so they go out\n // together rather than one round-trip at a time. Their callbacks share\n // the segment and link maps, which is safe because only one of them runs\n // at a time, and the output is sorted at the end regardless of the order\n // they arrive in.\n const reached = await Promise.all(\n frontier.map(segment =>\n addLinksOver(segment.refName, segment.start, segment.end),\n ),\n )\n frontier = offReference(reached.flat())\n }\n if (hops > 0) {\n const spans = closingSpans(\n [...segments.values()],\n new Set(frontier.map(segment => segment.id)),\n { refName: tabixRefName, start: region.start, end: region.end },\n )\n const found: RgfaLink[] = []\n await Promise.all(\n spans.map(span =>\n index.links.getLines(span.refName, span.start, span.end, {\n signal,\n lineCallback: line => {\n found.push(parseLinkLine(line))\n },\n }),\n ),\n )\n for (const link of closingLinks(found, segments, spans)) {\n links.set(linkKey(link), link)\n for (const segment of [link.sourceSegment, link.targetSegment]) {\n if (!segments.has(segment.id)) {\n segments.set(segment.id, segment)\n }\n }\n }\n }\n\n return formatSubgraph(segments, links)\n }\n}\n", "// A segment as it appears in segs.bed.gz, and as it is repeated inside every\n// links.bed.gz row: `stableName start end segmentId rank [tags]`. The first\n// five are the SN/SO/SR tags rGFA already carries, projected to BED by\n// `gfatools gfa2bed -m`.\n//\n// `tags` is a space-separated list of GFA tags, written verbatim onto the\n// S-line formatSegment synthesizes, where the GFA parser reads them into\n// `GraphNode.tags` with no work here. It is the extension point for everything\n// the five columns cannot say: carriage on a path-derived graph (`SM:Z:`), the\n// collapse summary on a level-of-detail tier (`ct:Z:`, `cn:i:`, ...), a\n// precomputed layout position later. rGFA files have no sixth column at all,\n// so this is empty for them and nothing changes.\nexport interface RgfaSegment {\n refName: string\n start: number\n end: number\n id: string\n rank: number\n tags: string\n}\n\nexport interface RgfaLink {\n source: string\n sourceStrand: string\n target: string\n targetStrand: string\n sourceSegment: RgfaSegment\n targetSegment: RgfaSegment\n}\n\nexport function parseSegmentLine(line: string): RgfaSegment {\n const cols = line.split('\\t')\n return {\n refName: cols[0]!,\n start: +cols[1]!,\n end: +cols[2]!,\n id: cols[3]!,\n rank: +cols[4]!,\n tags: cols[5] ?? '',\n }\n}\n\n// Carriage as an ordinary feature attribute, for the linear track rather than\n// the graph. The tag column reaches the graph view through the synthesized\n// S-line (formatSegment below, then gfaConverter reads SM into\n// `GraphNode.samples`), and that route ends at the graph: `getFeatures` builds\n// its own features and had no way to say who carries a segment, so a lane\n// colored by carriage was not expressible.\n//\n// `SM:Z:` is its own grammar check here. build_pggb_tabix.sh wrote a bare\n// comma-separated list in this column before the tag column existed, and those\n// files are still hosted; a bare list has no prefix to match, so it is dropped\n// rather than read as one sample named `K12,Sakai,CFT073`.\n//\n// Undefined rather than [] when the tag is absent, matching gfaConverter: an\n// rGFA has no sixth column at all, so a segment that says nothing about\n// carriage stays distinguishable from one carried by nobody.\nexport function segmentSamples(segment: RgfaSegment) {\n const tag = segment.tags.split(' ').find(t => t.startsWith('SM:Z:'))\n if (tag === undefined) {\n return undefined\n }\n const samples = tag\n .slice('SM:Z:'.length)\n .split(',')\n .map(s => s.trim())\n .filter(Boolean)\n return samples.length > 0 ? samples : undefined\n}\n\n// `s322+` \u2014 the L-line's segment id with its orientation appended, mirroring\n// the GFA record it came from.\nfunction parseEndpoint(field: string) {\n return { id: field.slice(0, -1), strand: field.slice(-1) }\n}\n\nexport function parseLinkLine(line: string): RgfaLink {\n const cols = line.split('\\t')\n const source = parseEndpoint(cols[3]!)\n const target = parseEndpoint(cols[4]!)\n return {\n source: source.id,\n sourceStrand: source.strand,\n target: target.id,\n targetStrand: target.strand,\n sourceSegment: {\n id: source.id,\n refName: cols[5]!,\n start: +cols[6]!,\n end: +cols[7]!,\n rank: +cols[8]!,\n tags: cols[13] ?? '',\n },\n targetSegment: {\n id: target.id,\n refName: cols[9]!,\n start: +cols[10]!,\n end: +cols[11]!,\n rank: +cols[12]!,\n tags: cols[14] ?? '',\n },\n }\n}\n\nexport function linkKey(link: RgfaLink) {\n return `${link.source}${link.sourceStrand}${link.target}${link.targetStrand}`\n}\n\n// Both endpoints of a link are written into every row, so the same link is\n// indexed under each endpoint's stable sequence and arrives twice for a region\n// covering both. Callers dedupe on linkKey.\n\nexport interface StableSpan {\n refName: string\n start: number\n end: number\n}\n\n// Where a cut reads links once more to close itself. A hop reads the links of\n// the segments the round before it reached, so a link between two segments of\n// the last round is never read and an allele reached from both ends draws as\n// two stubs. rGFA lays an allele out as one stretch of the stable sequence that\n// introduced it, so pieces of one sequence within the window's length of each\n// other merge into a span, and reading it brings the pieces between too.\n// Backbone reached past the window is unread for the same reason; its spans\n// join only abutting pieces, since the reference past the window is not the\n// cut's to fill. A span whose segments were all read and abut is skipped.\nexport function closingSpans(\n held: RgfaSegment[],\n unread: Set<string>,\n window: StableSpan,\n) {\n const outside = (segment: RgfaSegment) =>\n segment.refName !== window.refName ||\n segment.end <= window.start ||\n segment.start >= window.end\n return [\n ...mergedSpans(\n held.filter(segment => segment.rank > 0),\n unread,\n window.end - window.start,\n ),\n ...mergedSpans(\n held.filter(segment => segment.rank === 0 && outside(segment)),\n new Set(held.map(segment => segment.id)),\n 0,\n ),\n ]\n}\n\nfunction mergedSpans(\n segments: RgfaSegment[],\n unread: Set<string>,\n maxGap: number,\n) {\n const sorted = [...segments].sort(\n (a, b) => compare(a.refName, b.refName) || a.start - b.start,\n )\n const spans: (StableSpan & { needed: boolean })[] = []\n for (const segment of sorted) {\n const span = spans.at(-1)\n if (\n span?.refName === segment.refName &&\n segment.start - span.end <= maxGap\n ) {\n span.needed ||= segment.start > span.end || unread.has(segment.id)\n span.end = Math.max(span.end, segment.end)\n } else {\n spans.push({\n refName: segment.refName,\n start: segment.start,\n end: segment.end,\n needed: unread.has(segment.id),\n })\n }\n }\n return spans\n .filter(span => span.needed)\n .map(({ refName, start, end }): StableSpan => ({ refName, start, end }))\n}\n\n// The links a closing read keeps: each end is a segment the cut holds or one\n// lying inside a span. Following anything else is what another hop is for.\nexport function closingLinks(\n found: RgfaLink[],\n held: Map<string, RgfaSegment>,\n spans: StableSpan[],\n) {\n const inside = (segment: RgfaSegment) =>\n held.has(segment.id) ||\n spans.some(\n span =>\n span.refName === segment.refName &&\n segment.start >= span.start &&\n segment.end <= span.end,\n )\n return found.filter(\n link => inside(link.sourceSegment) && inside(link.targetSegment),\n )\n}\n\n// Segments carry no sequence here \u2014 the BED records only their span \u2014 so every\n// S-line is written with `*` and an LN tag, which is what the GFA spec asks for\n// and what packages/graph-core's parser reads back as the node length.\n// `NM:i:0`, `SM:Z:HG002.1,HG002.2` \u2014 the GFA tag grammar, checked rather than\n// trusted. Files built before the tag column existed put a bare comma-separated\n// sample list here, and passing that through would put a field that is not a\n// tag on an S-line, which is a malformed GFA rather than a missing annotation.\n// Dropping it degrades to the pre-tag behaviour instead.\nconst GFA_TAG = /^[A-Za-z][A-Za-z0-9]:[AifZJHB]:/\n\nfunction formatSegment(segment: RgfaSegment) {\n const { id, refName, start, end, rank, tags } = segment\n const valid = tags.split(' ').filter(t => GFA_TAG.test(t))\n const extra = valid.length === 0 ? '' : `\\t${valid.join('\\t')}`\n return `S\\t${id}\\t*\\tLN:i:${end - start}\\tSN:Z:${refName}\\tSO:i:${start}\\tSR:i:${rank}${extra}`\n}\n\nfunction formatLink(link: RgfaLink) {\n const { source, sourceStrand, target, targetStrand } = link\n return `L\\t${source}\\t${sourceStrand}\\t${target}\\t${targetStrand}\\t0M`\n}\n\n// Codepoint order, not localeCompare: the byte-identical-output guarantee below\n// has to hold across locales.\nfunction compare(a: string, b: string) {\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n// Deterministic ordering: the same region always produces byte-identical GFA,\n// so a layout computed from it is reproducible.\nexport function formatSubgraph(\n segments: Map<string, RgfaSegment>,\n links: Map<string, RgfaLink>,\n) {\n const sortedSegments = [...segments.values()].sort(\n (a, b) =>\n compare(a.refName, b.refName) || a.start - b.start || compare(a.id, b.id),\n )\n const sortedLinks = [...links.keys()].sort((a, b) => compare(a, b))\n return [\n 'H\\tVN:Z:1.0',\n ...sortedSegments.map(s => formatSegment(s)),\n ...sortedLinks.map(k => formatLink(links.get(k)!)),\n ].join('\\n')\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "iOAAA,IAAAA,EAAuC,SACvCC,EAA4C,SAC5CC,EAAiC,SC4B1B,SAASC,EAAiBC,EAA2B,CAC1D,IAAMC,EAAOD,EAAK,MAAM,GAAI,EAC5B,MAAO,CACL,QAASC,EAAK,CAAC,EACf,MAAO,CAACA,EAAK,CAAC,EACd,IAAK,CAACA,EAAK,CAAC,EACZ,GAAIA,EAAK,CAAC,EACV,KAAM,CAACA,EAAK,CAAC,EACb,KAAMA,EAAK,CAAC,GAAK,EACnB,CACF,CAiBO,SAASC,EAAeC,EAAsB,CACnD,IAAMC,EAAMD,EAAQ,KAAK,MAAM,GAAG,EAAE,KAAKE,GAAKA,EAAE,WAAW,OAAO,CAAC,EACnE,GAAID,IAAQ,OACV,OAEF,IAAME,EAAUF,EACb,MAAM,CAAc,EACpB,MAAM,GAAG,EACT,IAAI,GAAK,EAAE,KAAK,CAAC,EACjB,OAAO,OAAO,EACjB,OAAOE,EAAQ,OAAS,EAAIA,EAAU,MACxC,CAIA,S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EAAGA,EAAMZ,EAAMY,IAAO,CAMnC,IAAML,EAAU,MAAM,QAAQ,IAC5BI,EAAS,IAAI/B,GACXuB,EAAavB,EAAQ,QAASA,EAAQ,MAAOA,EAAQ,GAAG,CAC1D,CACF,EACA+B,EAAWjC,EAAa6B,EAAQ,KAAK,CAAC,CACxC,CACA,GAAIP,EAAO,EAAG,CACZ,IAAMa,EAAQC,EACZ,CAAC,GAAGnC,EAAS,OAAO,CAAC,EACrB,IAAI,IAAIgC,EAAS,IAAI/B,GAAWA,EAAQ,EAAE,CAAC,EAC3C,CAAE,QAASc,EAAc,MAAOK,EAAO,MAAO,IAAKA,EAAO,GAAI,CAChE,EACMgB,EAAoB,CAAC,EAC3B,MAAM,QAAQ,IACZF,EAAM,IAAIG,GACRf,EAAM,MAAM,SAASe,EAAK,QAASA,EAAK,MAAOA,EAAK,IAAK,CACvD,OAAAzB,EACA,aAAcI,GAAQ,CACpBoB,EAAM,KAAKN,EAAcd,CAAI,CAAC,CAChC,CACF,CAAC,CACH,CACF,EACA,QAAWa,KAAQS,EAAaF,EAAOpC,EAAUkC,CAAK,EAAG,CACvDX,EAAM,IAAIQ,EAAQF,CAAI,EAAGA,CAAI,EAC7B,QAAW5B,IAAW,CAAC4B,EAAK,cAAeA,EAAK,aAAa,EACtD7B,EAAS,IAAIC,EAAQ,EAAE,GAC1BD,EAAS,IAAIC,EAAQ,GAAIA,CAAO,CAGtC,CACF,CAEA,OAAOsC,EAAevC,EAAUuB,CAAK,CACvC,CACF",
|
|
6
6
|
"names": ["import_BaseAdapter", "import_util", "import_rxjs", "parseSegmentLine", "line", "cols", "segmentSamples", "segment", "tag", "t", "samples", "parseEndpoint", "field", "parseLinkLine", "source", "target", "linkKey", "link", "closingSpans", "held", "unread", "window", "outside", "mergedSpans", "segments", "maxGap", "sorted", "b", "compare", "spans", "span", "refName", "start", "end", "closingLinks", "found", "inside", "GFA_TAG", "formatSegment", "id", "rank", "tags", "valid", "extra", "formatLink", "sourceStrand", "targetStrand", "a", "formatSubgraph", "links", "sortedSegments", "sortedLinks", "s", "k", "offReference", "segments", "segment", "RgfaTabixAdapter", "config", "getSubAdapter", "pluginManager", "under", "openTabixSlot", "PanSNRefNames", "tier", "opts", "query", "signal", "statusCallback", "observer", "tabixRefName", "line", "parseSegmentLine", "samples", "segmentSamples", "region", "hops", "index", "links", "addLinksOver", "refName", "start", "end", "reached", "link", "parseLinkLine", "linkKey", "frontier", "hop", "spans", "closingSpans", "found", "span", "closingLinks", "formatSubgraph"]
|
|
7
7
|
}
|