jbrowse-plugin-graphgenomeviewer 7.1.4 → 7.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{GbzBaseSyntenyAdapter-LRECKL74.js → GbzBaseSyntenyAdapter-WEQKJ5ZF.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-LRECKL74.js.map → GbzBaseSyntenyAdapter-WEQKJ5ZF.js.map} +1 -1
- package/dist/chunks/{GraphGenomeView-PSDUS64B.js → GraphGenomeView-JYD7HBX7.js} +2 -2
- package/dist/chunks/{GraphTrackSettingsDialog-47PQ6LM7.js → GraphTrackSettingsDialog-ZT7AWO3C.js} +2 -2
- package/dist/chunks/{HighlightColorDialog-2MP3C5AK.js → HighlightColorDialog-A3E5WHXH.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-FTFJFNKT.js → LinearGraphDisplay-QYPXZEX7.js} +2 -2
- package/dist/chunks/{MinigraphBubbleAdapter-HW7XQMAI.js → MinigraphBubbleAdapter-FNP6DISL.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-PSKYWD2X.js → RgfaTabixAdapter-6NY7XZ6E.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-GH6NYQTF.js → WalkTabixSyntenyAdapter-KRNEQL44.js} +2 -2
- package/dist/chunks/{chunk-BUY2PV7D.js → chunk-7UTCUHQI.js} +2 -2
- package/dist/chunks/{chunk-BUY2PV7D.js.map → chunk-7UTCUHQI.js.map} +1 -1
- package/dist/chunks/{chunk-W6EQLQ6H.js → chunk-A7DB4V4C.js} +1 -1
- package/dist/chunks/{chunk-W6EQLQ6H.js.map → chunk-A7DB4V4C.js.map} +1 -1
- package/dist/chunks/{chunk-FVK2THE4.js → chunk-HVBY3TGB.js} +2 -2
- package/dist/chunks/{chunk-FVK2THE4.js.map → chunk-HVBY3TGB.js.map} +2 -2
- package/dist/chunks/{chunk-WAMBI7OX.js → chunk-HYKQBZA4.js} +2 -2
- package/dist/chunks/{chunk-WAMBI7OX.js.map → chunk-HYKQBZA4.js.map} +1 -1
- package/dist/chunks/{chunk-EGDLEQ47.js → chunk-IP3ORVTU.js} +2 -2
- package/dist/chunks/{chunk-S75W27NT.js → chunk-JHCHSGEL.js} +2 -2
- package/dist/chunks/{chunk-S75W27NT.js.map → chunk-JHCHSGEL.js.map} +1 -1
- package/dist/chunks/{chunk-ZMOMFU2B.js → chunk-KM3QNC77.js} +1 -1
- package/dist/chunks/{chunk-ZMOMFU2B.js.map → chunk-KM3QNC77.js.map} +1 -1
- package/dist/chunks/{chunk-RP3L3Z5W.js → chunk-LP73EZV4.js} +3 -3
- package/dist/chunks/{chunk-RP3L3Z5W.js.map → chunk-LP73EZV4.js.map} +4 -4
- package/dist/chunks/{chunk-VJ3SO4CH.js → chunk-NM7JYFMG.js} +1 -1
- package/dist/chunks/{chunk-VJ3SO4CH.js.map → chunk-NM7JYFMG.js.map} +1 -1
- package/dist/chunks/{chunk-MND7GAOG.js → chunk-QFD5OVPZ.js} +2 -2
- package/dist/chunks/{chunk-5O6YRJHL.js → chunk-QJMXLCUM.js} +2 -2
- package/dist/chunks/{chunk-5O6YRJHL.js.map → chunk-QJMXLCUM.js.map} +1 -1
- package/dist/chunks/{chunk-N6PQZSAX.js → chunk-QKEY7EU7.js} +1 -1
- package/dist/chunks/{chunk-N6PQZSAX.js.map → chunk-QKEY7EU7.js.map} +1 -1
- package/dist/chunks/chunk-SP3OUF6G.js +2 -0
- package/dist/chunks/chunk-SP3OUF6G.js.map +7 -0
- package/dist/chunks/{chunk-FHZXW7IG.js → chunk-SQUFY3QO.js} +2 -2
- package/dist/chunks/{chunk-VQUMZEGN.js → chunk-X7LTMIYL.js} +2 -2
- package/dist/chunks/{chunk-VQUMZEGN.js.map → chunk-X7LTMIYL.js.map} +1 -1
- package/dist/chunks/{chunk-LELA7BG7.js → chunk-XO2PD5JO.js} +2 -2
- package/dist/chunks/{chunk-LELA7BG7.js.map → chunk-XO2PD5JO.js.map} +1 -1
- package/dist/chunks/{chunk-TUKJRVBS.js → chunk-Y7UUDKJL.js} +1 -1
- package/dist/chunks/{chunk-TUKJRVBS.js.map → chunk-Y7UUDKJL.js.map} +1 -1
- package/dist/chunks/chunk-YNTSFMXQ.js +4 -0
- package/dist/chunks/chunk-YNTSFMXQ.js.map +7 -0
- package/dist/chunks/{renderSvg-V4OYQTQZ.js → renderSvg-LBMWZDLB.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +2 -2
- package/package.json +2 -2
- package/src/GraphGenomeView/components/FacetPanels.tsx +0 -3
- package/src/GraphGenomeView/components/GraphCanvas.tsx +13 -5
- package/src/GraphGenomeView/components/usePaneGestures.test.tsx +67 -0
- package/src/GraphGenomeView/components/usePaneGestures.ts +46 -14
- package/src/RgfaTabixAdapter/walkFiles.test.ts +9 -1
- package/src/RgfaTabixAdapter/walkRowRuns.ts +4 -5
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-HM57SCYO.js +0 -4
- package/dist/chunks/chunk-HM57SCYO.js.map +0 -7
- package/dist/chunks/chunk-NP42Y2MV.js +0 -2
- package/dist/chunks/chunk-NP42Y2MV.js.map +0 -7
- /package/dist/chunks/{GraphGenomeView-PSDUS64B.js.map → GraphGenomeView-JYD7HBX7.js.map} +0 -0
- /package/dist/chunks/{GraphTrackSettingsDialog-47PQ6LM7.js.map → GraphTrackSettingsDialog-ZT7AWO3C.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-2MP3C5AK.js.map → HighlightColorDialog-A3E5WHXH.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-FTFJFNKT.js.map → LinearGraphDisplay-QYPXZEX7.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-HW7XQMAI.js.map → MinigraphBubbleAdapter-FNP6DISL.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-PSKYWD2X.js.map → RgfaTabixAdapter-6NY7XZ6E.js.map} +0 -0
- /package/dist/chunks/{WalkTabixSyntenyAdapter-GH6NYQTF.js.map → WalkTabixSyntenyAdapter-KRNEQL44.js.map} +0 -0
- /package/dist/chunks/{chunk-EGDLEQ47.js.map → chunk-IP3ORVTU.js.map} +0 -0
- /package/dist/chunks/{chunk-MND7GAOG.js.map → chunk-QFD5OVPZ.js.map} +0 -0
- /package/dist/chunks/{chunk-FHZXW7IG.js.map → chunk-SQUFY3QO.js.map} +0 -0
- /package/dist/chunks/{renderSvg-V4OYQTQZ.js.map → renderSvg-LBMWZDLB.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as ae,b as re,c as de,d as oe,e as se,f as q,g as ie}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=GbzBaseSyntenyAdapter-
|
|
1
|
+
import{a as ae,b as re,c as de,d as oe,e as se,f as q,g as ie}from"./chunk-IP3ORVTU.js";import{a as te}from"./chunk-KOB7YIMR.js";import{a as W,b as Z,c as U,d as u,e as M,f as $,g as k,h as E,i as z,k as X}from"./chunk-JHCHSGEL.js";import"./chunk-QJMXLCUM.js";import{a as O,b as H}from"./chunk-QKEY7EU7.js";import"./chunk-Y7UUDKJL.js";import"./chunk-T4HOC6O3.js";import{a as ne}from"./chunk-HVBY3TGB.js";import{a as V,c as L,m as ee}from"./chunk-SQUFY3QO.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import{e as F,f as P,g as C}from"./chunk-KM3QNC77.js";import"./chunk-E7J6SB5P.js";import{b as G,e as Y,f as J,g as K}from"./chunk-5OI6LO4I.js";import"./chunk-7WIBGKBU.js";import{a as N}from"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{e as j,o as I}from"./chunk-TENPGIPX.js";function A(n){let s=/\.gbz\.db$/i;return s.test(n)?n.replace(s,".haplotype-index.db"):void 0}function he(n){return J(n)&&A(Y(n))?K(n,s=>A(s)):void 0}function ue(n){return n instanceof Error&&(/\bHTTP 40[34]\b/.test(n.message)||n.code==="ENOENT")}async function ce(n,s){let t=he(n);if(!t)return{};try{return await N(t,s).stat(),{location:t}}catch(e){return ue(e)?{}:{unreadable:String(e)}}}var ge=5e3,ye=50*2**20,T=class extends Error{constructor(t){super(`this GAF is ${(t/2**20).toFixed(0)} MB without an index; bgzip it and index it with tabix -p gaf`);this.name="UnindexedGafTooLargeError"}};function be(n,s){if(n.length<=s)return n;let t=n.length/s;return Array.from({length:s},(e,a)=>n[Math.floor(a*t)])}var pe=(n,s)=>n.path.some(t=>s.has(t.name)),v=class{constructor(s,t){this.file=s;this.tabix=t;this.whole=L({setup:async({signal:s})=>{let{size:t}=await this.file.stat();if(t>ye)throw new T(t);let e=await this.file.readFile({signal:s}),a=new TextDecoder().decode(e[0]===31&&e[1]===139?await V(e):e);return H(a)}})}async readIndexed(s,t,e){let a=1/0,r=-1/0;for(let i of t){let c=Number(i);Number.isInteger(c)&&(a=Math.min(a,c),r=Math.max(r,c))}let o=[];return a<=r&&await s.getLines("{node}",a,r+1,{signal:e,lineCallback:i=>{let c=O(i);c&&pe(c,t)&&o.push(c)}}),o}async readsOver(s,{signal:t}={}){let e=this.tabix?await this.readIndexed(this.tabix,s,t):(await this.whole({signal:t})).filter(a=>pe(a,s));return{records:be(e,ge),total:e.length}}};var B=class extends Error{constructor(t){super(t===void 0?"no haplotype index is set, so the walks cannot be named; build one with gbz-haplotype-index (cargo install gbz-haplotype-index) and set it as haplotypeIndexLocation":`the haplotype index beside the graph database could not be checked (${t}), so the walks cannot be named; if it is there, reload to try again, or set haplotypeIndexLocation`);this.name="NoHaplotypeIndexError"}},Q=class extends Error{constructor(t,e){super(`the graph is cut on its reference, ${e}; a window on ${t} has no reference coordinates to cut at. Open the graph from a ${e} view, and find this haplotype's lane there`);this.name="HaplotypeWindowError"}};function we(n,s){return`${u(n)}#${n.contig}@${s.start.node}.${s.start.offset}`}function xe({alignment:n,assemblyName:s,refName:t,lane:e}){let{refStart:a,refEnd:r,strand:o,cigar:i}=n;if(!(r<=a)){let{name:c,hapStart:p,hapEnd:l}=n,d=we(c,n),g={uniqueId:d,assemblyName:s,refName:t,start:a,end:r,type:"match",strand:o==="-"?-1:1,CIGAR:i,syntenyId:d,mate:{refName:c.contig,start:p,end:l,assemblyName:e}};return new ae(g)}}function Se({pair:n,lane:s,mateLane:t}){return ie({target:{name:`${u(n.target)}#${n.target.contig}`,assemblyName:s,refName:n.target.contig,start:n.targetStart,end:n.targetEnd},query:{name:`${u(n.query)}#${n.query.contig}`,assemblyName:t,refName:n.query.contig,start:n.queryStart,end:n.queryEnd},strand:n.strand,cigar:n.cigar,matches:n.matches,columns:n.columns})}var Pe=12e4;function Ne(n,s){let t=new Map;for(let a of n)for(let{name:r,start:o,end:i}of a.walkSpans()){let c=u(r);if(s.has(c)){let p=`${c}#${r.contig}`,l=t.get(p);l?l.push([o,i]):t.set(p,[[o,i]])}}let e=0;for(let a of t.values()){a.sort((r,o)=>r[0]-o[0]);for(let r=1;r<a.length;r++){let o=a[r][0]-a[r-1][1];o>0&&o<=Pe&&(e=Math.max(e,o))}}return e}function _(n,s){return n instanceof U&&(n.message=`Zoom in to about ${j(n.fitsBp)} to see ${s}`),n}var le=n=>({...n,start:Math.floor(n.start),end:Math.ceil(n.end)}),D=class extends re{constructor(){super(...arguments);this.graph=L({label:"Opening pangenome database",setup:async()=>{let t=this.getConf("gbzDbLocation"),e=this.getConf("haplotypeIndexLocation"),a=G(e)?{location:e}:await ce(t,this.pluginManager),r=a.location,o=await Z.open({source:N(t,this.pluginManager),haplotypeIndex:r?N(r,this.pluginManager):void 0}),i=this.getConf("assemblyNames")[0];if(i===void 0)throw new Error("GbzBaseSyntenyAdapter needs assemblyNames: its first entry is the assembly the reference sample is loaded as");let c=await $(o),p=k({configured:this.getConf("referenceSample"),anchorPrefix:P(this,i),referenceSamples:c});return{db:o,anchor:i,referenceSample:p,referenceSamples:c,unreadableIndex:a.unreadable}}});this.gaf=L({label:"Opening reads",setup:async()=>{let t=this.getConf("readsLocation"),e=this.getConf(["readsIndex","location"]);return G(t)?new v(N(t,this.pluginManager),G(e)?ee(this,["readsLocation"],["readsIndex"]):void 0):void 0}})}async referenceQuery(t,e){let{db:a,referenceSample:r}=await this.graph(e);return E(a,r,t)}async getHaplotypes(t={}){let{db:e,referenceSamples:a}=await this.graph(t),r=new Map;for(let o of await e.paths()){let i=u(o.name),c=r.get(i);c?c.contigs.includes(o.name.contig)||c.contigs.push(o.name.contig):r.set(i,{prefix:i,sample:o.name.sample,haplotype:o.name.haplotype,contigs:[o.name.contig],isReference:a.includes(o.name.sample)})}return[...r.values()]}async getHeader(t={}){let{anchor:e,referenceSample:a}=await this.graph(t),r=C(this),o=[];for(let i of await this.getHaplotypes(t))i.sample!==a&&o.push({name:q(r,i.prefix),label:i.prefix,group:i.sample});return{hasCoarseTier:!1,anchorAssemblyName:e,lanes:o}}async getRefNames(t={}){let{db:e,anchor:a,referenceSample:r}=await this.graph(t),{assemblyName:o}=t,i=o===a?void 0:P(this,o),c=(await e.paths()).filter(p=>o===a?p.isIndexed&&p.name.sample===r:F(u(p.name),i)).map(p=>p.name.contig);return[...new Set(c)]}keepPredicate(t,e){let a=t===void 0||t.length===0?void 0:t.map(r=>P(this,r));return a===void 0&&e===void 0?void 0:r=>M(r,a)&&(e===void 0||F(u(r),e))}async getSubgraph(t,e={}){let{signal:a}=e,{db:r,anchor:o,referenceSample:i,unreadableIndex:c}=await this.graph({signal:a}),{assemblyName:p,refName:l,start:d,end:g}=le(t);if(p!==o)throw new Q(p,o);let y=await this.referenceQuery(l,{signal:a});if(!y)throw new Error(`${i} has no indexed path ${l} in this graph`);let w=this.keepPredicate(e.haplotypes);if(w!==void 0&&!r.hasHaplotypeIndex)throw new B(c);let f=await X(r,y,d,g,{context:this.getConf("context"),snarls:e.snarls??this.getConf("subgraphSnarls"),limit:this.getConf("nodeLimit"),signal:e.signal,keep:w}).catch(x=>{throw _(x,"the graph")});return typeof f=="string"?f:ne(f,{start:d,end:g},e.walkRows)}async getReads(t,e={}){let a=await this.gaf(e);return a?a.readsOver(new Set(t),e):{records:[],total:0}}async laneHaplotypes(t,e){let a=P(this,t);return(await this.getHaplotypes(e)).filter(r=>F(r.prefix,a))}async anchorFeatures(t,e){let{db:a}=await this.graph(e),{assemblyName:r,refName:o,start:i,end:c}=t,p=P(this,e.targetAssemblyName),l=C(this),d=this.keepPredicate(e.haplotypes,p),g=await this.referenceQuery(o,e),y=this.getConf("nodeLimit");return(g?await I(`Reading graph ${o}:${i.toLocaleString()}-${c.toLocaleString()}`,e.statusCallback,()=>a.getAlignments({path:g,start:i,end:c,context:this.getConf("context"),haplotypes:"all",limit:y,signal:e.signal,keep:d}).catch(f=>{throw _(z(f,y,c-i)??f,"lanes")})):[]).flatMap(f=>{let x=f.resolved?xe({alignment:f,assemblyName:r,refName:o,lane:q(l,u(f.name))}):void 0;return x===void 0?[]:[x]})}async pairFeatures(t,e,a){let{db:r}=await this.graph(a),{refName:o,start:i,end:c}=t,l=(await Promise.all(e.map(async m=>({pair:m,featureSide:await this.laneHaplotypes(m.queryAssemblyName,a),mateSide:await this.laneHaplotypes(m.targetAssemblyName,a)})))).filter(({featureSide:m,mateSide:h})=>m.length>0&&h.length>0),d=new Set(l.flatMap(({featureSide:m,mateSide:h})=>[...m,...h].map(u))),g=await this.referenceQuery(o,a),y=this.getConf("nodeLimit"),w=this.getConf("context"),f=(m,h)=>r.getSubgraphs({path:m,start:i,end:c,context:h,snarls:this.getConf("subgraphSnarls"),haplotypes:"all",limit:y,signal:a.signal,keep:S=>d.has(u(S))}),x=async m=>{let h=await f(m,w).catch(b=>{throw _(z(b,y,c-i)??b,"lanes")}),S=Ne(h,d),R=Math.ceil(S/2)+2e3;return S>0&&R>w?f(m,R).catch(b=>{if(b instanceof W)return h;throw b}):h};return(g&&l.length>0?await I(se(e),a.statusCallback,()=>x(g)):[]).flatMap(m=>l.flatMap(({pair:h,featureSide:S,mateSide:R})=>S.flatMap(b=>R.flatMap(me=>m.pairAlignments({target:b,query:me,bases:!1}).map(fe=>Se({pair:fe,lane:h.queryAssemblyName,mateLane:h.targetAssemblyName}))))))}getFeatures(t,e={}){let a=le(t);return te(async r=>{let{db:o,anchor:i,unreadableIndex:c}=await this.graph(e);if(!o.hasHaplotypeIndex)throw new B(c);if(a.assemblyName===i){let p=oe(e),l=p.length>0?await this.pairFeatures(a,p,e):await this.anchorFeatures(a,e);for(let d of l)r.next(d)}r.complete()},e.signal)}};export{B as NoHaplotypeIndexError,de as PairTargetError,D as default,Ne as widestWalkGap};
|
|
2
|
+
//# sourceMappingURL=GbzBaseSyntenyAdapter-WEQKJ5ZF.js.map
|
package/dist/chunks/{GbzBaseSyntenyAdapter-LRECKL74.js.map → GbzBaseSyntenyAdapter-WEQKJ5ZF.js.map}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.7/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-VQWHMWLF.js", "../../src/GbzBaseSyntenyAdapter/companion.ts", "../../src/gaf/gafFile.ts", "../../src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts"],
|
|
4
4
|
"sourcesContent": ["import {\n GBZ_CUT_DEFAULTS,\n cutWindowGFA,\n haplotypeWanted,\n referencePathQuery,\n referenceSamplesOf,\n resolveReferenceSample\n} from \"./chunk-Q7LYHGGQ.js\";\n\n// src/gbzCut.ts\nimport { GBZBase } from \"@gmod/gbz-base\";\nvar HPRC_GBZ = {\n db: \"https://s3-us-west-2.amazonaws.com/human-pangenomics/pangenomes/freeze/release2/minigraph-cactus/v2.1/hprc-v2.1-mc-grch38/hprc-v2.1-mc-grch38.gbz.db\",\n index: \"https://jbrowse.org/demos/hprc/hprc-v2.1-mc-grch38.haplotype-index.f3.db\"\n};\nfunction haplotypeIndexBeside(db) {\n const GBZ_DB = /\\.gbz\\.db$/i;\n return GBZ_DB.test(db) ? db.replace(GBZ_DB, \".haplotype-index.db\") : void 0;\n}\nfunction parseRegion(text) {\n const m = /^\\s*([^:\\s]+):([\\d,]+)-([\\d,]+)\\s*$/.exec(text);\n if (!m) {\n throw new Error(\n `\"${text}\" is not a region like chr6:160,614,798-160,647,758`\n );\n }\n const n = (s) => Number(s.replaceAll(\",\", \"\"));\n const region = { refName: m[1], start: n(m[2]), end: n(m[3]) };\n if (region.end <= region.start) {\n throw new Error(`\"${text}\" ends at or before it starts`);\n }\n return region;\n}\nasync function openGbz(db, index) {\n const base = await GBZBase.open({ source: db, haplotypeIndex: index });\n return { base, referenceSamples: await referenceSamplesOf(base) };\n}\nfunction referenceSample(ref, samples) {\n try {\n return resolveReferenceSample({\n configured: \"\",\n anchorPrefix: ref ?? samples[0] ?? \"\",\n referenceSamples: samples\n });\n } catch (e) {\n if (ref) {\n return ref;\n }\n throw e;\n }\n}\nasync function cutGbzRegion({ base, referenceSamples }, src, signal) {\n const region = parseRegion(src.region);\n const sample = referenceSample(src.referenceSample, referenceSamples);\n const query = await referencePathQuery(base, sample, region.refName);\n if (!query) {\n throw new Error(`${sample} has no indexed path named ${region.refName}`);\n }\n signal?.throwIfAborted();\n const wanted = src.haplotypes?.length ? src.haplotypes : void 0;\n const text = await cutWindowGFA(base, query, region.start, region.end, {\n context: src.context ?? GBZ_CUT_DEFAULTS.context,\n snarls: src.snarls ?? GBZ_CUT_DEFAULTS.snarls,\n limit: GBZ_CUT_DEFAULTS.limit,\n signal,\n keep: wanted ? (name) => haplotypeWanted(name, wanted) : void 0\n });\n return { text, region, sample };\n}\n\nexport {\n HPRC_GBZ,\n haplotypeIndexBeside,\n parseRegion,\n openGbz,\n cutGbzRegion\n};\n", "import { haplotypeIndexBeside } from '@jbrowse/bandage-core/gbzCut'\nimport { openLocation } from '@jbrowse/core/util/io'\n\nimport { locationName, readsSiblings, renamed } from '../locationName'\n\nimport type PluginManager from '@jbrowse/core/PluginManager'\nimport type { FileLocation } from '@jbrowse/core/util/types'\n\nexport function siblingCompanion(gbzDb: FileLocation) {\n return readsSiblings(gbzDb) && haplotypeIndexBeside(locationName(gbzDb))\n ? renamed(gbzDb, name => haplotypeIndexBeside(name)!)\n : undefined\n}\n\n// 404 is a missing file, and so is 403 from a bucket that does not let a\n// reader list it; anything else leaves the file's presence unknown\nfunction isMissing(error: unknown) {\n return (\n error instanceof Error &&\n (/\\bHTTP 40[34]\\b/.test(error.message) ||\n (error as { code?: unknown }).code === 'ENOENT')\n )\n}\n\n// `unreadable` is why a companion that may be there could not be checked, such\n// as a network error, or a server that answers a missing file without CORS\nexport async function findCompanion(\n gbzDb: FileLocation,\n pluginManager?: PluginManager,\n): Promise<{ location?: FileLocation; unreadable?: string }> {\n const candidate = siblingCompanion(gbzDb)\n if (!candidate) {\n return {}\n }\n try {\n await openLocation(candidate, pluginManager).stat()\n return { location: candidate }\n } catch (error) {\n return isMissing(error) ? {} : { unreadable: String(error) }\n }\n}\n", "import { unzip } from '@gmod/bgzf-filehandle'\nimport { parseGaf, parseGafLine } from '@jbrowse/bandage-core/gaf/parseGaf'\nimport { cachedSetup } from '@jbrowse/core/data_adapters/BaseAdapter'\n\nimport type { TabixIndexedFile } from '@gmod/tabix'\nimport type { GafRecord } from '@jbrowse/bandage-core/gaf/parseGaf'\n\ninterface WholeFile {\n stat(): Promise<{ size: number }>\n readFile(opts?: { signal?: AbortSignal }): Promise<Uint8Array>\n}\n\nexport interface GafReads {\n records: GafRecord[]\n // reads over the nodes before sampling\n total: number\n}\n\n// The tube map lays reads out on the main thread at about 40 ms per thousand\nexport const MAX_READS = 5000\n\n// An unindexed GAF is read whole, once, into the worker\nconst MAX_UNINDEXED_BYTES = 50 * 2 ** 20\n\nexport class UnindexedGafTooLargeError extends Error {\n override name = 'UnindexedGafTooLargeError'\n\n constructor(size: number) {\n super(\n `this GAF is ${(size / 2 ** 20).toFixed(0)} MB without an index; bgzip it and index it with tabix -p gaf`,\n )\n }\n}\n\n// Evenly spaced, so a pileup thins out rather than losing its right half\nfunction sample(records: GafRecord[], max: number) {\n if (records.length <= max) {\n return records\n }\n const stride = records.length / max\n return Array.from({ length: max }, (_, k) => records[Math.floor(k * stride)]!)\n}\n\nconst touches = (record: GafRecord, names: ReadonlySet<string>) =>\n record.path.some(step => names.has(step.name))\n\n// A GAF over a graph's segments: bgzipped and indexed with `tabix -p gaf`,\n// which keys each line by its lowest and highest node id and so needs numeric\n// segment names, or plain or gzipped and read whole.\nexport class GafFile {\n // Shared by every window, so the signal is cachedSetup's own, which aborts\n // once no caller is left waiting\n private whole = cachedSetup({\n setup: async ({ signal }) => {\n const { size } = await this.file.stat()\n if (size > MAX_UNINDEXED_BYTES) {\n throw new UnindexedGafTooLargeError(size)\n }\n const bytes = await this.file.readFile({ signal })\n const text = new TextDecoder().decode(\n bytes[0] === 0x1f && bytes[1] === 0x8b ? await unzip(bytes) : bytes,\n )\n return parseGaf(text)\n },\n })\n\n constructor(\n private file: WholeFile,\n private tabix?: TabixIndexedFile,\n ) {}\n\n private async readIndexed(\n tabix: TabixIndexedFile,\n names: ReadonlySet<string>,\n signal?: AbortSignal,\n ) {\n let lo = Infinity\n let hi = -Infinity\n for (const name of names) {\n const id = Number(name)\n if (Number.isInteger(id)) {\n lo = Math.min(lo, id)\n hi = Math.max(hi, id)\n }\n }\n const records: GafRecord[] = []\n if (lo <= hi) {\n // a GAF index ignores the refName, and getLines keeps a read whose node\n // ids span min..max when min < end && max >= start, hence hi + 1\n await tabix.getLines('{node}', lo, hi + 1, {\n signal,\n lineCallback: line => {\n const record = parseGafLine(line)\n if (record && touches(record, names)) {\n records.push(record)\n }\n },\n })\n }\n return records\n }\n\n async readsOver(\n names: ReadonlySet<string>,\n { signal }: { signal?: AbortSignal } = {},\n ): Promise<GafReads> {\n const records = this.tabix\n ? await this.readIndexed(this.tabix, names, signal)\n : (await this.whole({ signal })).filter(r => touches(r, names))\n return { records: sample(records, MAX_READS), total: records.length }\n }\n}\n", "import { GBZBase, SubgraphLimitError } from '@gmod/gbz-base'\nimport {\n NodeLimitError,\n cutWindowTables,\n haplotypePrefix,\n haplotypeWanted,\n nodeLimitError,\n referencePathQuery,\n referenceSamplesOf,\n resolveReferenceSample,\n} from '@jbrowse/bandage-core/gbzWindow'\nimport {\n assemblyByPanSNPrefix,\n panSNMatchesPrefix,\n resolvePanSNPrefix,\n} from '@jbrowse/bandage-core/pansn'\nimport { cachedSetup } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { getBpDisplayStr, updateStatus } from '@jbrowse/core/util'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\n\nimport { findCompanion } from './companion.ts'\nimport { walkCutFor } from '../RgfaTabixAdapter/walkRowRuns.ts'\nimport { GafFile } from '../gaf/gafFile.ts'\nimport { locationIsSet } from '../locationName.ts'\nimport { openTabixSlot } from '../panSNTabix.ts'\nimport { ComparativeAdapterBase } from '../synteny/ComparativeAdapterBase.ts'\nimport SyntenyFeature from '../synteny/SyntenyFeature.ts'\nimport {\n laneAssemblyName,\n lanePairsStatus,\n requestedPairs,\n} from '../synteny/lanePairs.ts'\nimport { matchFeature } from '../synteny/matchFeature.ts'\n\nimport type { GbzBaseSyntenyAdapterConfig } from './configSchema.ts'\nimport type { SubgraphAdapterOptions } from '../GetSubgraph.ts'\nimport type { GafReads } from '../gaf/gafFile.ts'\nimport type { LaneFeatureOptions, LanePair } from '../synteny/lanePairs.ts'\nimport type {\n HaplotypeAlignment,\n HaplotypeRef,\n PairAlignment,\n PathName,\n PathQuery,\n Subgraph,\n} from '@gmod/gbz-base'\nimport type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util'\nimport type { FileLocation, Region } from '@jbrowse/core/util/types'\n\nexport class NoHaplotypeIndexError extends Error {\n override name = 'NoHaplotypeIndexError'\n\n constructor(unreadable?: string) {\n super(\n unreadable === undefined\n ? 'no haplotype index is set, so the walks cannot be named; build one with gbz-haplotype-index (cargo install gbz-haplotype-index) and set it as haplotypeIndexLocation'\n : `the haplotype index beside the graph database could not be checked (${unreadable}), so the walks cannot be named; if it is there, reload to try again, or set haplotypeIndexLocation`,\n )\n }\n}\n\ninterface GbzHaplotype {\n prefix: string\n sample: string\n haplotype: number\n contigs: string[]\n isReference: boolean\n}\n\n/**\n * One lane the header declares, in the shape MultiWaySyntenyDisplay's lane\n * picker reads: `name` is the lane's assembly name, the same string the\n * fetched features' mates carry, `label` its PanSN prefix and `group` its\n * sample, so a diploid sample's two lanes sit together\n */\ninterface GbzHeaderLane {\n name: string\n label: string\n group: string\n}\n\nexport { PairTargetError } from '../synteny/lanePairs.ts'\n\nclass HaplotypeWindowError extends Error {\n override name = 'HaplotypeWindowError'\n\n constructor(assemblyName: string, anchor: string) {\n super(\n `the graph is cut on its reference, ${anchor}; a window on ${assemblyName} has no reference coordinates to cut at. Open the graph from a ${anchor} view, and find this haplotype's lane there`,\n )\n }\n}\n\ntype ResolvedAlignment = Extract<HaplotypeAlignment, { resolved: true }>\n\n/**\n * The id of one haplotype fragment: the walk's GBWT position at its first node\n * in the window, which is a property of the graph, so the same fragment gets\n * the same id on a refetch of the same window and the display's hover and\n * selection survive it. `clipToRegion` suffixes the window.\n */\nfunction fragmentId(name: PathName, alignment: ResolvedAlignment) {\n return `${haplotypePrefix(name)}#${name.contig}@${alignment.start.node}.${alignment.start.offset}`\n}\n\nfunction fragmentFeature({\n alignment,\n assemblyName,\n refName,\n lane,\n}: {\n alignment: ResolvedAlignment\n assemblyName: string\n refName: string\n lane: string\n}) {\n const { refStart, refEnd, strand, cigar } = alignment\n if (refEnd <= refStart) {\n return undefined\n } else {\n const { name, hapStart, hapEnd } = alignment\n const id = fragmentId(name, alignment)\n const data: SimpleFeatureSerialized = {\n uniqueId: id,\n assemblyName,\n refName,\n start: refStart,\n end: refEnd,\n type: 'match',\n strand: strand === '-' ? -1 : 1,\n CIGAR: cigar,\n syntenyId: id,\n mate: {\n refName: name.contig,\n start: hapStart,\n end: hapEnd,\n assemblyName: lane,\n },\n }\n return new SyntenyFeature(data)\n }\n}\n\n// gbz-base writes the CIGAR along the target, which is the side a JBrowse\n// feature is, so it passes through unchanged\nfunction pairFeature({\n pair,\n lane,\n mateLane,\n}: {\n pair: PairAlignment\n lane: string\n mateLane: string\n}) {\n return matchFeature({\n target: {\n name: `${haplotypePrefix(pair.target)}#${pair.target.contig}`,\n assemblyName: lane,\n refName: pair.target.contig,\n start: pair.targetStart,\n end: pair.targetEnd,\n },\n query: {\n name: `${haplotypePrefix(pair.query)}#${pair.query.contig}`,\n assemblyName: mateLane,\n refName: pair.query.contig,\n start: pair.queryStart,\n end: pair.queryEnd,\n },\n strand: pair.strand,\n cigar: pair.cigar,\n matches: pair.matches,\n columns: pair.columns,\n })\n}\n\n// The longest detour a pair cut widens its context to take in\nconst BRIDGE_MAX_BP = 120_000\n\n/**\n * The widest gap, up to `BRIDGE_MAX_BP`, between two pieces of one kept walk:\n * a haplotype that left the cut's nodes for sequence the reference lacks and\n * came back. Two kept haplotypes that share that sequence only align across it\n * once its nodes are in the cut.\n */\nexport function widestWalkGap(subgraphs: Subgraph[], kept: Set<string>) {\n const byPath = new Map<string, [number, number][]>()\n for (const subgraph of subgraphs) {\n for (const { name, start, end } of subgraph.walkSpans()) {\n const prefix = haplotypePrefix(name)\n if (kept.has(prefix)) {\n const key = `${prefix}#${name.contig}`\n const spans = byPath.get(key)\n if (spans) {\n spans.push([start, end])\n } else {\n byPath.set(key, [[start, end]])\n }\n }\n }\n }\n let widest = 0\n for (const spans of byPath.values()) {\n spans.sort((a, b) => a[0] - b[0])\n for (let i = 1; i < spans.length; i++) {\n const gap = spans[i]![0] - spans[i - 1]![1]\n if (gap > 0 && gap <= BRIDGE_MAX_BP) {\n widest = Math.max(widest, gap)\n }\n }\n }\n return widest\n}\n\n// A window past the node limit fails as a zoom-in notice naming a span that\n// fits\nfunction zoomInNotice(error: unknown, what: string) {\n if (error instanceof NodeLimitError) {\n error.message = `Zoom in to about ${getBpDisplayStr(error.fitsBp)} to see ${what}`\n }\n return error\n}\n\n// gbz-base reads whole bp; a view asks at fractional ones\nconst wholeBp = (region: Region) => ({\n ...region,\n start: Math.floor(region.start),\n end: Math.ceil(region.end),\n})\n\nexport default class GbzBaseSyntenyAdapter extends ComparativeAdapterBase<GbzBaseSyntenyAdapterConfig> {\n private graph = cachedSetup({\n label: 'Opening pangenome database',\n setup: async () => {\n const gbzDb: FileLocation = this.getConf('gbzDbLocation')\n const configured: FileLocation = this.getConf('haplotypeIndexLocation')\n const companion = locationIsSet(configured)\n ? { location: configured }\n : await findCompanion(gbzDb, this.pluginManager)\n const indexLocation = companion.location\n const db = await GBZBase.open({\n source: openLocation(gbzDb, this.pluginManager),\n haplotypeIndex: indexLocation\n ? openLocation(indexLocation, this.pluginManager)\n : undefined,\n })\n const anchor = this.getConf('assemblyNames')[0]\n if (anchor === undefined) {\n throw new Error(\n 'GbzBaseSyntenyAdapter needs assemblyNames: its first entry is the assembly the reference sample is loaded as',\n )\n }\n const referenceSamples = await referenceSamplesOf(db)\n const referenceSample = resolveReferenceSample({\n configured: this.getConf('referenceSample'),\n anchorPrefix: resolvePanSNPrefix(this, anchor),\n referenceSamples,\n })\n return {\n db,\n anchor,\n referenceSample,\n referenceSamples,\n unreadableIndex: companion.unreadable,\n }\n },\n })\n\n /**\n * The indexed reference path a window on `refName` resolves against, or\n * undefined when the reference sample has no indexed path by that contig.\n */\n private async referenceQuery(\n refName: string,\n opts: BaseOptions,\n ): Promise<PathQuery | undefined> {\n const { db, referenceSample } = await this.graph(opts)\n return referencePathQuery(db, referenceSample, refName)\n }\n\n /**\n * Every haplotype the graph carries a walk for, `sample#haplotype` with its\n * contigs, from the Paths scan the adapter already makes; the lane picker's\n * source list. Reference samples are included and flagged.\n */\n async getHaplotypes(opts: BaseOptions = {}): Promise<GbzHaplotype[]> {\n const { db, referenceSamples } = await this.graph(opts)\n const byPrefix = new Map<string, GbzHaplotype>()\n for (const path of await db.paths()) {\n const prefix = haplotypePrefix(path.name)\n const entry = byPrefix.get(prefix)\n if (entry) {\n if (!entry.contigs.includes(path.name.contig)) {\n entry.contigs.push(path.name.contig)\n }\n } else {\n byPrefix.set(prefix, {\n prefix,\n sample: path.name.sample,\n haplotype: path.name.haplotype,\n contigs: [path.name.contig],\n isReference: referenceSamples.includes(path.name.sample),\n })\n }\n }\n return [...byPrefix.values()]\n }\n\n /**\n * `lanes` is every haplotype but the reference sample's own, which is the\n * anchor rather than a lane, declared up front so the display can offer the\n * whole graph's haplotypes before a fetch has placed any of them.\n */\n async getHeader(opts: BaseOptions = {}) {\n const { anchor, referenceSample } = await this.graph(opts)\n const asmByPrefix = assemblyByPanSNPrefix(this)\n const lanes: GbzHeaderLane[] = []\n for (const haplotype of await this.getHaplotypes(opts)) {\n if (haplotype.sample !== referenceSample) {\n lanes.push({\n name: laneAssemblyName(asmByPrefix, haplotype.prefix),\n label: haplotype.prefix,\n group: haplotype.sample,\n })\n }\n }\n return {\n hasCoarseTier: false,\n anchorAssemblyName: anchor,\n lanes,\n }\n }\n\n async getRefNames(opts: BaseOptions = {}) {\n const { db, anchor, referenceSample } = await this.graph(opts)\n const { assemblyName } = opts\n const prefix =\n assemblyName === anchor\n ? undefined\n : resolvePanSNPrefix(this, assemblyName)\n const contigs = (await db.paths())\n .filter(path =>\n assemblyName === anchor\n ? path.isIndexed && path.name.sample === referenceSample\n : panSNMatchesPrefix(haplotypePrefix(path.name), prefix),\n )\n .map(path => path.name.contig)\n return [...new Set(contigs)]\n }\n\n /**\n * The predicate gbz-base builds a window for, from the lanes a fetch asks\n * for. With a companion whose stray rows cover the window gbz-base walks\n * only the wanted haplotypes; otherwise it names every walk and keeps the\n * ones the predicate accepts, and throws rather than guess when a walk has\n * no name. Either way a cut holds those walks, the reference, and the nodes\n * they visit. Undefined when every haplotype is wanted.\n */\n //\n // `targetPrefix` is a pairwise view's one lane, and it belongs in here: left\n // to filter what came back, it handed gbz-base no predicate, and every\n // haplotype in the graph was walked for one to be kept.\n private keepPredicate(\n haplotypes: string[] | undefined,\n targetPrefix?: string,\n ) {\n const wantedPrefixes =\n haplotypes === undefined || haplotypes.length === 0\n ? undefined\n : haplotypes.map(lane => resolvePanSNPrefix(this, lane))\n return wantedPrefixes === undefined && targetPrefix === undefined\n ? undefined\n : (name: PathName) =>\n haplotypeWanted(name, wantedPrefixes) &&\n (targetPrefix === undefined ||\n panSNMatchesPrefix(haplotypePrefix(name), targetPrefix))\n }\n\n /**\n * The graph view's cut of the window, as tables: the reference walk, every\n * top-level snarl contained in it, and one walk per haplotype, PanSN-named\n * when the database (or its companion) carries the haplotype index and\n * `unknown#N` otherwise. The reference walk is the first, which is the one\n * the view anchors on by default. With `haplotypes` the walks are that\n * set's and the nodes those walks visit, the reference walk kept. With\n * `walkRows` the rows' runs come along, as on a walk-file cut.\n *\n * Only a window on the anchor can be cut: a haplotype lane's coordinates\n * are its own contig's, and the graph is indexed for random access on the\n * reference sample's paths alone.\n */\n async getSubgraph(region: Region, opts: SubgraphAdapterOptions = {}) {\n const { signal } = opts\n const { db, anchor, referenceSample, unreadableIndex } = await this.graph({\n signal,\n })\n const { assemblyName, refName, start, end } = wholeBp(region)\n if (assemblyName !== anchor) {\n throw new HaplotypeWindowError(assemblyName, anchor)\n }\n const query = await this.referenceQuery(refName, { signal })\n if (!query) {\n throw new Error(\n `${referenceSample} has no indexed path ${refName} in this graph`,\n )\n }\n const keep = this.keepPredicate(opts.haplotypes)\n if (keep !== undefined && !db.hasHaplotypeIndex) {\n throw new NoHaplotypeIndexError(unreadableIndex)\n }\n const cut = await cutWindowTables(db, query, start, end, {\n context: this.getConf('context'),\n snarls: opts.snarls ?? this.getConf('subgraphSnarls'),\n limit: this.getConf('nodeLimit'),\n signal: opts.signal,\n keep,\n }).catch((error: unknown) => {\n throw zoomInNotice(error, 'the graph')\n })\n return typeof cut === 'string'\n ? cut\n : walkCutFor(cut, { start, end }, opts.walkRows)\n }\n\n private gaf = cachedSetup({\n label: 'Opening reads',\n setup: async () => {\n const location: FileLocation = this.getConf('readsLocation')\n const index: FileLocation = this.getConf(['readsIndex', 'location'])\n return locationIsSet(location)\n ? new GafFile(\n openLocation(location, this.pluginManager),\n locationIsSet(index)\n ? openTabixSlot(this, ['readsLocation'], ['readsIndex'])\n : undefined,\n )\n : undefined\n },\n })\n\n /**\n * The reads over a cut's segments, from `readsLocation`, sampled down to\n * what the tube map lays out at interactive speed\n */\n async getReads(\n nodeNames: string[],\n opts: BaseOptions = {},\n ): Promise<GafReads> {\n const gaf = await this.gaf(opts)\n return gaf\n ? gaf.readsOver(new Set(nodeNames), opts)\n : { records: [], total: 0 }\n }\n\n private async laneHaplotypes(\n assemblyName: string,\n opts: BaseOptions,\n ): Promise<HaplotypeRef[]> {\n const prefix = resolvePanSNPrefix(this, assemblyName)\n return (await this.getHaplotypes(opts)).filter(haplotype =>\n panSNMatchesPrefix(haplotype.prefix, prefix),\n )\n }\n\n private async anchorFeatures(region: Region, opts: LaneFeatureOptions) {\n const { db } = await this.graph(opts)\n const { assemblyName, refName, start, end } = region\n const targetPrefix = resolvePanSNPrefix(this, opts.targetAssemblyName)\n const asmByPrefix = assemblyByPanSNPrefix(this)\n const keep = this.keepPredicate(opts.haplotypes, targetPrefix)\n const query = await this.referenceQuery(refName, opts)\n const nodeLimit: number = this.getConf('nodeLimit')\n const alignments = query\n ? await updateStatus(\n `Reading graph ${refName}:${start.toLocaleString()}-${end.toLocaleString()}`,\n opts.statusCallback,\n () =>\n db\n .getAlignments({\n path: query,\n start,\n end,\n context: this.getConf('context'),\n haplotypes: 'all',\n limit: nodeLimit,\n signal: opts.signal,\n keep,\n })\n .catch((error: unknown) => {\n throw zoomInNotice(\n nodeLimitError(error, nodeLimit, end - start) ?? error,\n 'lanes',\n )\n }),\n )\n : []\n return alignments.flatMap(alignment => {\n const feature = alignment.resolved\n ? fragmentFeature({\n alignment,\n assemblyName,\n refName,\n lane: laneAssemblyName(\n asmByPrefix,\n haplotypePrefix(alignment.name),\n ),\n })\n : undefined\n return feature === undefined ? [] : [feature]\n })\n }\n\n /**\n * Each pair's two lanes cut out of the anchor window alone, all pairs in one\n * cut, and each walk of a pair's query lane aligned to each walk of its\n * target lane on the nodes both visit, with no base compared. A pair's\n * records sit on its query lane's contigs, the lane the display draws on top.\n *\n * Whether the index has anchor rows changes only how fast gbz-base finds\n * the walks: both routes cut the same pieces.\n */\n private async pairFeatures(\n region: Region,\n pairs: LanePair[],\n opts: LaneFeatureOptions,\n ) {\n const { db } = await this.graph(opts)\n const { refName, start, end } = region\n const sides = await Promise.all(\n pairs.map(async pair => ({\n pair,\n featureSide: await this.laneHaplotypes(pair.queryAssemblyName, opts),\n mateSide: await this.laneHaplotypes(pair.targetAssemblyName, opts),\n })),\n )\n const answerable = sides.filter(\n ({ featureSide, mateSide }) =>\n featureSide.length > 0 && mateSide.length > 0,\n )\n const kept = new Set(\n answerable.flatMap(({ featureSide, mateSide }) =>\n [...featureSide, ...mateSide].map(haplotypePrefix),\n ),\n )\n const query = await this.referenceQuery(refName, opts)\n const nodeLimit: number = this.getConf('nodeLimit')\n const baseContext: number = this.getConf('context')\n const cut = (path: PathQuery, context: number) =>\n db.getSubgraphs({\n path,\n start,\n end,\n context,\n snarls: this.getConf('subgraphSnarls'),\n haplotypes: 'all',\n limit: nodeLimit,\n signal: opts.signal,\n keep: name => kept.has(haplotypePrefix(name)),\n })\n // a cut past the node limit for the wider context keeps the first one\n const bridged = async (path: PathQuery) => {\n const subgraphs = await cut(path, baseContext).catch((error: unknown) => {\n throw zoomInNotice(\n nodeLimitError(error, nodeLimit, end - start) ?? error,\n 'lanes',\n )\n })\n const gap = widestWalkGap(subgraphs, kept)\n const context = Math.ceil(gap / 2) + 2000\n return gap > 0 && context > baseContext\n ? cut(path, context).catch((error: unknown) => {\n if (error instanceof SubgraphLimitError) {\n return subgraphs\n }\n throw error\n })\n : subgraphs\n }\n const subgraphs =\n query && answerable.length > 0\n ? await updateStatus(lanePairsStatus(pairs), opts.statusCallback, () =>\n bridged(query),\n )\n : []\n return subgraphs.flatMap(subgraph =>\n answerable.flatMap(({ pair, featureSide, mateSide }) =>\n featureSide.flatMap(target =>\n mateSide.flatMap(mate =>\n subgraph\n .pairAlignments({ target, query: mate, bases: false })\n .map(alignment =>\n pairFeature({\n pair: alignment,\n lane: pair.queryAssemblyName,\n mateLane: pair.targetAssemblyName,\n }),\n ),\n ),\n ),\n ),\n )\n }\n\n getFeatures(asked: Region, opts: LaneFeatureOptions = {}) {\n const region = wholeBp(asked)\n return ObservableCreate<Feature>(async observer => {\n const { db, anchor, unreadableIndex } = await this.graph(opts)\n if (!db.hasHaplotypeIndex) {\n throw new NoHaplotypeIndexError(unreadableIndex)\n }\n // the graph is indexed on its reference alone, so a window on a\n // haplotype lane has no answer: a lane pair is read inside the anchor's\n if (region.assemblyName === anchor) {\n const pairs = requestedPairs(opts)\n const features =\n pairs.length > 0\n ? await this.pairFeatures(region, pairs, opts)\n : await this.anchorFeatures(region, opts)\n for (const feature of features) {\n observer.next(feature)\n }\n }\n observer.complete()\n }, opts.signal)\n }\n}\n"],
|
|
5
5
|
"mappings": "iyBAeA,SAASA,EAAqBC,EAAI,CAChC,IAAMC,EAAS,cACf,OAAOA,EAAO,KAAKD,CAAE,EAAIA,EAAG,QAAQC,EAAQ,qBAAqB,EAAI,MACvE,CCVO,SAASC,GAAiBC,EAAqB,CACpD,OAAOC,EAAcD,CAAK,GAAKE,EAAqBC,EAAaH,CAAK,CAAC,EACnEI,EAAQJ,EAAOK,GAAQH,EAAqBG,CAAI,CAAE,EAClD,MACN,CAIA,SAASC,GAAUC,EAAgB,CACjC,OACEA,aAAiB,QAChB,kBAAkB,KAAKA,EAAM,OAAO,GAClCA,EAA6B,OAAS,SAE7C,CAIA,eAAsBC,GACpBR,EACAS,EAC2D,CAC3D,IAAMC,EAAYX,GAAiBC,CAAK,EACxC,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AAe,EAIjD,GAAIvC,EAAO,eAAiB3C,EAAQ,CAClC,IAAM8F,EAAQc,GAAe3C,CAAI,EAC3B4C,EACJf,EAAM,OAAS,EACX,MAAM,KAAK,aAAanD,EAAQmD,EAAO7B,CAAI,EAC3C,MAAM,KAAK,eAAetB,EAAQsB,CAAI,EAC5C,QAAW4B,KAAWgB,EACpBF,EAAS,KAAKd,CAAO,CAEzB,CACAc,EAAS,SAAS,CACpB,EAAG1C,EAAK,MAAM,CAChB,CACF",
|
|
6
6
|
"names": ["haplotypeIndexBeside", "db", "GBZ_DB", "siblingCompanion", "gbzDb", "readsSiblings", "haplotypeIndexBeside", "locationName", "renamed", "name", "isMissing", "error", "findCompanion", "pluginManager", "candidate", "openLocation", "MAX_READS", "MAX_UNINDEXED_BYTES", "UnindexedGafTooLargeError", "size", "sample", "records", "max", "stride", "_", "k", "touches", "record", "names", "step", "GafFile", "file", "tabix", "cachedSetup", "signal", "bytes", "text", "unzip", "parseGaf", "lo", "hi", "name", "id", "line", "parseGafLine", "r", "NoHaplotypeIndexError", "unreadable", "HaplotypeWindowError", "assemblyName", "anchor", "fragmentId", "name", "alignment", "haplotypePrefix", "fragmentFeature", "refName", "lane", "refStart", "refEnd", "strand", "cigar", "hapStart", "hapEnd", "id", "data", "SyntenyFeature", "pairFeature", "pair", "mateLane", "matchFeature", "BRIDGE_MAX_BP", "widestWalkGap", "subgraphs", "kept", "byPath", "subgraph", "start", "end", "prefix", "key", "spans", "widest", "a", "b", "i", "gap", "zoomInNotice", "error", "what", "NodeLimitError", "getBpDisplayStr", "wholeBp", "region", "GbzBaseSyntenyAdapter", "ComparativeAdapterBase", "cachedSetup", "gbzDb", "configured", "companion", "locationIsSet", "findCompanion", "indexLocation", "db", "GBZBase", "openLocation", "referenceSamples", "referenceSamplesOf", "referenceSample", "resolveReferenceSample", "resolvePanSNPrefix", "location", "index", "GafFile", "openTabixSlot", "opts", "referencePathQuery", "byPrefix", "path", "entry", "asmByPrefix", "assemblyByPanSNPrefix", "lanes", "haplotype", "laneAssemblyName", "contigs", "panSNMatchesPrefix", "haplotypes", "targetPrefix", "wantedPrefixes", "haplotypeWanted", "signal", "unreadableIndex", "query", "keep", "cut", "cutWindowTables", "walkCutFor", "nodeNames", "gaf", "nodeLimit", "updateStatus", "nodeLimitError", "feature", "pairs", "answerable", "featureSide", "mateSide", "baseContext", "context", "bridged", "SubgraphLimitError", "lanePairsStatus", "target", "mate", "asked", "ObservableCreate", "observer", "requestedPairs", "features"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as C}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-SP3OUF6G.js";import"./chunk-7UTCUHQI.js";import"./chunk-LP73EZV4.js";import"./chunk-YNTSFMXQ.js";import{k as d}from"./chunk-NM7JYFMG.js";import"./chunk-XO2PD5JO.js";import"./chunk-X7LTMIYL.js";import"./chunk-HYKQBZA4.js";import"./chunk-A7DB4V4C.js";import"./chunk-QJMXLCUM.js";import"./chunk-QKEY7EU7.js";import"./chunk-Y7UUDKJL.js";import"./chunk-HVBY3TGB.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-KM3QNC77.js";import"./chunk-5OI6LO4I.js";import"./chunk-NDRLCGPC.js";import"./chunk-TENPGIPX.js";import{h as x}from"./chunk-YU7T5WOQ.js";import{A as l,F as L,H as p,e as s,j as v,o as n,x as G}from"./chunk-UGCNPRKC.js";import{a as y,b as a,c as r,d as i}from"./chunk-JMBDTNUR.js";var w=d()({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}}),E=i(function({model:e}){let{classes:t}=w();return e.isLoading?r(l,{className:t.paper,"data-testid":"graph-genome-loading",children:[r("div",{className:t.row,children:[a(v,{variant:"h6",message:e.statusMessage}),a(n,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{e.cancelLoad()},children:"Cancel"})]}),a(G,{variant:"indeterminate"})]}):e.error?a(l,{className:t.paper,children:a(s,{error:e.error,onReset:()=>{e.retryLoad()}})}):a(l,{className:t.paper,"data-testid":"graph-genome-load-canceled",children:r("div",{className:t.row,children:[a(p,{variant:"h6",children:"Loading canceled"}),a(n,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{e.retryLoad()},children:"Retry"})]})})}),g=E;var F=`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`,S=d()({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"}}),T=i(function({model:e}){let{classes:t}=S(),[m,M]=x("");function u(){let o=m.trim();o&&e.loadGFAFromLocation({uri:o,locationType:"UriLocation"})}function N(o){let c=o.target.files?.[0];o.target.value="",c&&c.text().then(f=>e.loadGFA(f,c.name)).catch(f=>{e.setError(f)})}return r(l,{className:t.paper,children:[a("div",{className:t.header,children:a(p,{variant:"h6",children:"Load a GFA graph"})}),r("div",{className:t.column,children:[r("div",{className:t.rowCenter,children:[r(n,{variant:"outlined",component:"label",size:"small",children:["Choose file",a("input",{type:"file",accept:".gfa,.gfa1,.gfa2",hidden:!0,onChange:o=>{N(o)}})]}),a(p,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),r("div",{className:t.rowEnd,children:[a(L,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:m,onChange:o=>{M(o.target.value)},onKeyDown:o=>{o.key==="Enter"&&u()},className:t.flex1}),a(n,{variant:"contained",onClick:()=>{u()},disabled:!m.trim(),children:"Open"})]})]}),a("div",{className:t.footer,children:a(n,{size:"small",onClick:()=>{e.loadGFA(F,"Example graph")},children:"Load 4-node example"})}),e.error?a(s,{error:e.error}):null]})}),P=T;var A=i(function({model:e}){return e.hasGraph?a(C,{model:e}):e.canRetryLoad&&(e.error||e.loadCanceled)?a(g,{model:e}):r(y,{children:[e.isLoading?a(g,{model:e}):null,a("div",{hidden:e.isLoading,children:a(P,{model:e})})]})}),J=A;export{J as default};
|
|
10
|
-
//# sourceMappingURL=GraphGenomeView-
|
|
10
|
+
//# sourceMappingURL=GraphGenomeView-JYD7HBX7.js.map
|
package/dist/chunks/{GraphTrackSettingsDialog-47PQ6LM7.js → GraphTrackSettingsDialog-ZT7AWO3C.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{b as G}from"./chunk-
|
|
1
|
+
import{b as G}from"./chunk-7UTCUHQI.js";import{b as v,c as x}from"./chunk-E2QPSDQL.js";import{k as h}from"./chunk-NM7JYFMG.js";import"./chunk-HYKQBZA4.js";import"./chunk-Y7UUDKJL.js";import"./chunk-MVVXRZXV.js";import"./chunk-KM3QNC77.js";import"./chunk-5OI6LO4I.js";import{h as u}from"./chunk-YU7T5WOQ.js";import{D as H,F as y,H as c,n as g,s as b,w as S,z as C}from"./chunk-UGCNPRKC.js";import{b as o,c as l,d as i}from"./chunk-JMBDTNUR.js";var F=h()({section:{marginBottom:24},formControl:{minWidth:200}}),M=[{value:0,label:"None"},{value:1,label:"1 hop"},{value:2,label:"2 hops"}],I=i(function({model:t}){let{classes:n}=F(),a=t.sourceAdapter;return a?.type==="RgfaTabixAdapter"&&!v(a)?l("div",{className:n.section,children:[l(b,{className:n.formControl,children:[o(S,{children:"Graph context"}),o(H,{value:t.subgraphContext,label:"Graph context","data-testid":"graph-context-select",onChange:p=>{t.setSubgraphContext(p.target.value),t.recut()},children:M.map(({value:p,label:e})=>o(C,{value:p,children:e},p))})]}),o(c,{variant:"caption",component:"div",color:"text.secondary",children:"How far the cut follows links out of the region. At none, a detour that leaves the window draws as two stubs. No effect on gfa-to-tabix's default anchored index."})]}):null}),L=I;var N=h()({section:{marginBottom:24}});function P(r){return r.split(/[\s,]+/).filter(t=>t!=="")}var T=i(function({model:t}){let[n,a]=u(t.cutHaplotypes?.join(", ")??""),p=()=>{let e=P(n);e.join(`
|
|
2
2
|
`)===(t.cutHaplotypes??[]).join(`
|
|
3
3
|
`)||(t.setSubgraphHaplotypes(e),t.recut())};return o(y,{fullWidth:!0,label:"Haplotypes",placeholder:"every haplotype",value:n,slotProps:{htmlInput:{"data-testid":"graph-haplotypes-field"}},onChange:e=>{a(e.target.value)},onBlur:()=>{p()},onKeyDown:e=>{e.key==="Enter"&&p()}})}),w=i(function({model:t,names:n}){let[a,p]=u(t.cutHaplotypes??[]),[e,d]=u(!1),m=s=>{s.join(`
|
|
4
4
|
`)!==(t.cutHaplotypes??[]).join(`
|
|
5
5
|
`)&&(t.setSubgraphHaplotypes(s),t.recut())};return o(g,{multiple:!0,freeSolo:!0,disableCloseOnSelect:!0,options:n,value:a,open:e,onOpen:()=>{d(!0)},onClose:()=>{d(!1),m(a)},onChange:(s,f)=>{p(f),e||m(f)},renderInput:s=>o(y,{...s,label:"Haplotypes",placeholder:a.length===0?"every haplotype":void 0,slotProps:{...s.slotProps,htmlInput:{...s.slotProps.htmlInput,"data-testid":"graph-haplotypes-field"}}})})}),A=i(function({model:t}){let{classes:n}=N(),a=t.haplotypeNames,p=t.cutHaplotypes?.join(",")??"",e=t.sourceAdapter;return e&&x(e)?l("div",{className:n.section,children:[a?o(w,{model:t,names:a},p):o(T,{model:t},p),l(c,{variant:"caption",component:"div",color:"text.secondary",children:[a?`Which of the graph's ${a.length.toLocaleString()} haplotypes to cut, or a PanSN prefix (HG002 for both).`:"Which haplotypes to cut, as lane assembly names or PanSN prefixes (HG002#1, or HG002 for both) separated by commas."," ","Empty is every haplotype."]})]}):null}),k=A;function D({model:r,open:t,onClose:n}){return l(G,{model:r,open:t,onClose:n,children:[o(L,{model:r}),o(k,{model:r})]})}export{D as default};
|
|
6
|
-
//# sourceMappingURL=GraphTrackSettingsDialog-
|
|
6
|
+
//# sourceMappingURL=GraphTrackSettingsDialog-ZT7AWO3C.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as v,r as C}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=HighlightColorDialog-
|
|
1
|
+
import{q as v,r as C}from"./chunk-X7LTMIYL.js";import"./chunk-HYKQBZA4.js";import"./chunk-Y7UUDKJL.js";import"./chunk-KM3QNC77.js";import{F as g,H as t,d as u,o as y,q as c,r as d,z as s}from"./chunk-UGCNPRKC.js";import{a as h,b as l,c as p,d as m}from"./chunk-JMBDTNUR.js";var b=m(function({model:o,onClose:r}){return p(u,{open:!0,onClose:r,title:"Color highlighted haplotypes",children:[p(d,{sx:{display:"grid",gridTemplateColumns:"auto 1fr 1fr",alignItems:"center",gap:1.5},children:[l(t,{variant:"subtitle2",children:"Haplotype"}),l(t,{variant:"subtitle2",children:"Color by"}),l(t,{variant:"subtitle2",children:"Palette"}),o.drawnWalks.map(({name:a,encoding:n})=>l(f,{label:o.walkLabel(a),field:n.field,scheme:n.scheme,onField:e=>{o.setWalkColor(a,{field:e})},onScheme:e=>{o.setWalkColor(a,{scheme:e})}},a))]}),l(c,{children:l(y,{variant:"contained",onClick:r,children:"Done"})})]})});function f({label:i,field:o,scheme:r,onField:a,onScheme:n}){return p(h,{children:[l(t,{variant:"body2",children:i}),l(g,{select:!0,size:"small",value:o,slotProps:{select:{SelectDisplayProps:{"aria-label":`Color ${i} by`}}},onChange:e=>{a(e.target.value)},children:v.map(e=>l(s,{value:e.value,children:e.label},e.value))}),l(g,{select:!0,size:"small",value:r,slotProps:{select:{SelectDisplayProps:{"aria-label":`Palette for ${i}`}}},onChange:e=>{n(e.target.value)},children:C.filter(e=>e.value!=="rainbow"||o==="reference").map(e=>l(s,{value:e.value,children:e.label},e.value))})]})}var P=b;export{P as default};
|
|
2
|
+
//# sourceMappingURL=HighlightColorDialog-A3E5WHXH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=LinearGraphDisplay-
|
|
1
|
+
import{a as g}from"./chunk-SP3OUF6G.js";import"./chunk-7UTCUHQI.js";import"./chunk-LP73EZV4.js";import"./chunk-YNTSFMXQ.js";import"./chunk-NM7JYFMG.js";import"./chunk-XO2PD5JO.js";import"./chunk-X7LTMIYL.js";import"./chunk-HYKQBZA4.js";import"./chunk-A7DB4V4C.js";import"./chunk-QJMXLCUM.js";import"./chunk-QKEY7EU7.js";import"./chunk-Y7UUDKJL.js";import"./chunk-HVBY3TGB.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-KM3QNC77.js";import"./chunk-5OI6LO4I.js";import"./chunk-NDRLCGPC.js";import"./chunk-TENPGIPX.js";import{h as y}from"./chunk-YU7T5WOQ.js";import"./chunk-UGCNPRKC.js";import{b as e,c as l,d as T}from"./chunk-JMBDTNUR.js";var s=JBrowseExports["@jbrowse/display-kit/DisplayBackgroundProgress"];var v=s&&s.__esModule?s.default:s;var i=JBrowseExports["@jbrowse/display-kit/DisplayErrorBar"];var h=i&&i.__esModule?i.default:i;var a=JBrowseExports["@jbrowse/display-kit/DisplayLoadingOverlay"];var O=a&&a.__esModule?a.default:a;var n=JBrowseExports["@jbrowse/display-kit/TooLargeMessage"];var f=n&&n.__esModule?n.default:n;var t=JBrowseExports["@jbrowse/display-ui"],p=r=>t!=null&&r in Object(t)?t[r]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+r+"' from '@jbrowse/display-ui' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:r});var w=p("BottomRightCornerContext");var c=p("TrackOverlayPortal");var L=p("useChromeOverlayOverride");var j=t&&t.__esModule?t.default:t;var D={TooLarge:f,ErrorBar:h,Loading:O,BackgroundProgress:v};function d({model:r,phase:o,drawn:u,testid:_,style:C,children:E,...B}){let{TooLarge:G,ErrorBar:S,Loading:b,BackgroundProgress:m}=L()??D,[P,A]=y(null),x={...B,"data-testid":_,"data-display-id":r.configuration.displayId,"data-display-drawn":u,"data-display-phase":o};return o==="tooLarge"?e("div",{style:{display:"contents"},...x,children:e(c,{children:e("div",{style:{pointerEvents:"auto"},children:e(G,{model:r})})})}):l("div",{style:{position:"relative",height:r.height,...C},...x,children:[e(w,{value:P,children:E}),l(c,{children:[e(S,{model:r,visible:o==="error"}),e(b,{model:r,visible:o==="loading"||o==="canceled",immediate:!u}),e("div",{ref:A,style:{position:"absolute",bottom:2,right:2,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none"},children:e(m,{model:r,visible:o==="ready"})})]})]})}var I=T(function({model:o}){return e(d,{model:o,phase:o.displayPhase,drawn:o.painted&&o.geometryPainted,testid:"linear-graph-display","data-layout":o.chosenLayoutMode,"data-cut-tier":o.cutTier,"data-recuts":o.recuts,"data-node-count":o.hasGraph?o.nodeCount:void 0,"data-loading":o.isLoading?"":void 0,style:{width:o.paneWidth,height:o.height,overflow:"hidden"},children:e(g,{model:o,ownChrome:!1})})}),Q=I;export{Q as default};
|
|
2
|
+
//# sourceMappingURL=LinearGraphDisplay-QYPXZEX7.js.map
|
package/dist/chunks/{MinigraphBubbleAdapter-HW7XQMAI.js → MinigraphBubbleAdapter-FNP6DISL.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f,d as c,f as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=MinigraphBubbleAdapter-
|
|
1
|
+
import{a as f,d as c,f as h}from"./chunk-A7DB4V4C.js";import{a as g}from"./chunk-KOB7YIMR.js";import{b,h as m,m as p,n as u}from"./chunk-SQUFY3QO.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-KM3QNC77.js";import"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{a as i,o as l}from"./chunk-TENPGIPX.js";var a=class extends b{constructor(){super(...arguments);this.bubbles=p(this,["bubblesLocation"],["index"]);this.refNames=new u(this.bubbles,this)}static{this.capabilities=["getFeatures","getRefNames"]}async getRefNames(t={}){return this.refNames.assemblyRefNames(t)}async getRegionByteSize(t,s={}){return this.refNames.regionBytes(t,s)}async hasDataForRefName(){return!0}getFeatures(t,s={}){let{signal:n,statusCallback:d}=s;return g(async r=>{let o=await this.refNames.resolve(t,s);o!==void 0&&await l("Downloading bubbles",d,()=>m(this.bubbles,o,t.start,t.end,{signal:n,lineCallback:(N,y)=>{let e=f(N);r.next(new i({uniqueId:`bubble-${y}`,refName:t.refName,start:e.start,end:e.end,name:c(e),description:h(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}))}})),r.complete()},n)}};export{a as default};
|
|
2
|
+
//# sourceMappingURL=MinigraphBubbleAdapter-FNP6DISL.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as F}from"./chunk-
|
|
1
|
+
import{a as F}from"./chunk-QFD5OVPZ.js";import{a as w}from"./chunk-KOB7YIMR.js";import"./chunk-HVBY3TGB.js";import{b as L,h as d,m as p,n as y}from"./chunk-SQUFY3QO.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-KM3QNC77.js";import{b as x}from"./chunk-5OI6LO4I.js";import"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{a as h,o as k}from"./chunk-TENPGIPX.js";function u(s){let n=s.split(" "),t=n.length>=8,a=t?5:0;return{anchored:t,segment:{refName:n[a],start:+n[a+1],end:+n[a+2],id:n[3],rank:+n[4],tags:n[t?8:5]??""}}}function C(s){let n=s.tags.split(" ").find(a=>a.startsWith("SM:Z:"));if(n===void 0)return;let t=n.slice(5).split(",").map(a=>a.trim()).filter(Boolean);return t.length>0?t:void 0}function I(s){return{id:s.slice(0,-1),strand:s.slice(-1)}}function v(s){let n=s.split(" "),t=I(n[3]),a=I(n[4]);return{source:t.id,sourceStrand:t.strand,target:a.id,targetStrand:a.strand,sourceSegment:{id:t.id,refName:n[5],start:+n[6],end:+n[7],rank:+n[8],tags:n[13]??""},targetSegment:{id:a.id,refName:n[9],start:+n[10],end:+n[11],rank:+n[12],tags:n[14]??""}}}function M(s){return`${s.source}${s.sourceStrand}${s.target}${s.targetStrand}`}function S(s,n,t){n.set(M(t),t);let a=[];for(let e of[t.sourceSegment,t.targetSegment])s.has(e.id)||(s.set(e.id,e),a.push(e));return a}function B(s,n,t){let a=i=>i.rank!==0||i.refName!==t.refName?0:i.end<=t.start?-1:i.start>=t.end?1:0,e=new Map(s),r=new Map;for(let i of n)(s.has(i.source)||s.has(i.target)||a(i.sourceSegment)*a(i.targetSegment)===-1)&&S(e,r,i);for(let i of n)e.has(i.source)&&e.has(i.target)&&r.set(M(i),i);return{segments:e,links:r}}function O(s,n,t){let a=e=>e.refName!==t.refName||e.end<=t.start||e.start>=t.end;return[...$(s.filter(e=>e.rank>0),e=>n.has(e.id),t.end-t.start),...$(s.filter(e=>e.rank===0&&a(e)),()=>!0,0)]}function $(s,n,t){let a=[...s].sort((r,i)=>l(r.refName,i.refName)||r.start-i.start),e=[];for(let r of a){let i=e.at(-1);i?.refName===r.refName&&r.start-i.end<=t?(i.needed||=r.start>i.end||n(r),i.end=Math.max(i.end,r.end)):e.push({refName:r.refName,start:r.start,end:r.end,needed:n(r)})}return e.filter(r=>r.needed).map(({refName:r,start:i,end:o})=>({refName:r,start:i,end:o}))}function T(s,n,t){let a=e=>n.has(e.id)||t.some(r=>r.refName===e.refName&&e.start>=r.start&&e.end<=r.end);return s.filter(e=>a(e.sourceSegment)&&a(e.targetSegment))}var P=/^[A-Za-z][A-Za-z0-9]:[AifZJHB]:/;function Z(s){let{id:n,refName:t,start:a,end:e,rank:r,tags:i}=s,o=i.split(" ").filter(f=>P.test(f)),g=o.length===0?"":` ${o.join(" ")}`;return`S ${n} * LN:i:${e-a} SN:Z:${t} SO:i:${a} SR:i:${r}${g}`}function W(s){let{source:n,sourceStrand:t,target:a,targetStrand:e}=s;return`L ${n} ${t} ${a} ${e} 0M`}function l(s,n){return s<n?-1:s>n?1:0}function N(s,n){let t=[...s.values()].sort((e,r)=>l(e.refName,r.refName)||e.start-r.start||l(e.id,r.id)),a=[...n.keys()].sort((e,r)=>l(e,r));return["H VN:Z:1.0",...t.map(e=>Z(e)),...a.map(e=>W(n.get(e)))].join(`
|
|
2
2
|
`)}function A(s){return s.filter(n=>n.rank>0)}async function R(s,n,t){let a=[];return await d(s,n.refName,n.start,n.end,{signal:t,lineCallback:e=>{a.push(v(e))}}),a}async function G(s,n,{hops:t=0,signal:a}={}){let e=new Map,r=new Map,i={anchored:!1};if(await d(s.segments,n.refName,n.start,n.end,{signal:a,lineCallback:f=>{let m=u(f);i.anchored||=m.anchored,e.set(m.segment.id,m.segment)}}),i.anchored){let f=B(e,await R(s.links,n,a),n);return N(f.segments,f.links)}let o=async f=>(await R(s.links,f,a)).flatMap(m=>S(e,r,m)),g=A(await o(n));for(let f=0;f<t;f++){let m=await Promise.all(g.map(o));g=A(m.flat())}if(t>0){let f=O([...e.values()],new Set(g.map(c=>c.id)),n),m=await Promise.all(f.map(c=>R(s.links,c,a)));for(let c of T(m.flat(),e,f))S(e,r,c)}return N(e,r)}var b=class extends L{constructor(){super(...arguments);this.fine=this.openIndex([])}static{this.capabilities=["getFeatures","getRefNames"]}openIndex(t){let a=p(this,[...t,"segmentsLocation"],[...t,"segmentsIndex"]),e=p(this,[...t,"linksLocation"],[...t,"linksIndex"]),r=this.getConf("walksLocation"),i=t.length===0&&x(r)?new F(p(this,["walksLocation"],["walksIndex"]),this):void 0;return{segments:a,links:e,walks:i,refNames:new y(i?.file??a,this)}}async getHaplotypeNames(t={}){return this.fine.walks?.haplotypeNames(t)}index(t="fine"){return t==="fine"?this.fine:(this.coarse??=this.openIndex(["coarse"]),this.coarse)}async getRefNames(t={}){return this.fine.refNames.assemblyRefNames(t)}async getRegionByteSize(t,a={}){let{walks:e,refNames:r}=this.fine;return r.regionBytes(t,a,e&&(i=>e.reader.queryStart(i,a)))}async hasDataForRefName(){return!0}getFeatures(t,a={}){return w(async e=>{let r=await this.fine.refNames.resolve(t,a);if(r!==void 0){let{walks:i}=this.fine,o=g=>{e.next(g)};await(i?this.walkFeatures(i,r,t,a,o):this.segmentFeatures(r,t,a,o))}e.complete()},a.signal)}async walkFeatures(t,a,e,r,i){let o=await k("Downloading walks",r.statusCallback,()=>t.referenceNodes(a,e,r));for(let g of o){let f=String(g.id);i(new h({uniqueId:f,refName:e.refName,start:g.start,end:g.end,name:f,type:"segment",rank:0,stableName:g.refName}))}}async segmentFeatures(t,a,e,r){await k("Downloading segments",e.statusCallback,()=>d(this.fine.segments,t,a.start,a.end,{signal:e.signal,lineCallback:i=>{let{segment:o,anchored:g}=u(i);if(g&&o.refName!==t)return;let f=C(o);r(new h({uniqueId:o.id,refName:a.refName,start:o.start,end:o.end,name:o.id,type:"segment",rank:o.rank,stableName:o.refName,...f&&{samples:f,sampleCount:f.length}}))}}))}async getSubgraph(t,a={}){let{hops:e,signal:r,tier:i}=a,o=this.index(i),g=await o.refNames.resolve(t,{signal:r});if(g===void 0)throw new Error(`${t.assemblyName} ${t.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${t.assemblyName} mapped to its prefix in assemblyNameToPanSN`);return o.walks?o.walks.subgraph(g,t,a):G(o,{refName:g,start:t.start,end:t.end},{hops:e,signal:r})}};export{b as default};
|
|
3
|
-
//# sourceMappingURL=RgfaTabixAdapter-
|
|
3
|
+
//# sourceMappingURL=RgfaTabixAdapter-6NY7XZ6E.js.map
|
package/dist/chunks/{WalkTabixSyntenyAdapter-GH6NYQTF.js → WalkTabixSyntenyAdapter-KRNEQL44.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as G}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=WalkTabixSyntenyAdapter-
|
|
1
|
+
import{a as G}from"./chunk-QFD5OVPZ.js";import{a as z}from"./chunk-PJ43KEV6.js";import{b as j,d as H,e as D,f as E,g as X}from"./chunk-IP3ORVTU.js";import{a as $}from"./chunk-KOB7YIMR.js";import{p as W,q as R,r as I}from"./chunk-T4HOC6O3.js";import"./chunk-HVBY3TGB.js";import{e as q,m as T,n as _}from"./chunk-SQUFY3QO.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import{a as F,c as v,d as S,e as P,f as k,g as x}from"./chunk-KM3QNC77.js";import"./chunk-E7J6SB5P.js";import"./chunk-7WIBGKBU.js";import"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{o as C}from"./chunk-TENPGIPX.js";var ee=50;function te(i){let o=[];for(let e=0;e<i.length;e++){let[t,s]=i[e],[n,a]=i[e+1]??[];s===a&&s<=ee&&(t==="I"&&n==="D"||t==="D"&&n==="I")?(o.push(["X",s]),e++):o.push([t,s])}return o}function M(i){return Array.from(i.ids,(o,e)=>2*o+i.rev[e])}function K(i,o){let e=i.get(o);return e===void 0?0:e.end-e.start}function U(i){let o=new Map,e=n=>{let a=K(i,n),r=o.get(a);return r===void 0&&(r="N".repeat(a),o.set(a,r)),r},t=new Map,s=n=>{let a=t.get(n);return a===void 0&&(a=M(n),t.set(n,a)),a};return(n,a)=>R({query:s(n),target:s(a),sequenceOf:e,bases:!1})}var ae=100;function O(i,o,e){let t=i.at(-1);e>0&&(t?.[0]===o?t[1]+=e:i.push([o,e]))}function J(i){let o=t=>K(i,t>>1),e=t=>{let s=new Float64Array(t.length+1);return t.forEach((n,a)=>{s[a+1]=s[a]+o(n)}),s};return(t,s)=>{let n=M(s),a=M(t),[r,f]=W(a,n,o),[g,y]=W(a.map(u=>u^1).reverse(),n,o),l=y>f,p=l?g:r,N=Math.max(f,y);if(N<ae)return[];let h=e(n),c=e(a),b=u=>l?a.length-1-p[u][0]:p[u][0],m=[];p.forEach(([,u],w)=>{if(w>0){let[Q,V]=[b(w-1),b(w)].sort((Y,Z)=>Y-Z);O(m,"I",c[V]-c[Q+1]),O(m,"D",h[u]-h[p[w-1][1]+1])}O(m,"=",o(n[u]))});let[d,A]=[b(0),b(p.length-1)].sort((u,w)=>u-w);return[{queryStart:c[d],queryEnd:c[A+1],targetStart:h[p[0][1]],targetEnd:h[p.at(-1)[1]+1],strand:l?"-":"+",edits:m,sharedBases:N}]}}function B({chain:i,target:o,query:e,assemblyName:t,refName:s,mateAssemblyName:n}){let a=te(i.edits);return X({target:{name:o.name,assemblyName:t,refName:s,start:o.hapStart+i.targetStart,end:o.hapStart+i.targetEnd},query:{name:e.name,assemblyName:n,refName:S(e.name),start:e.hapStart+i.queryStart,end:e.hapStart+i.queryEnd},strand:i.strand,cigar:I(a),matches:a.reduce((r,[f,g])=>r+(f==="="?g:0),0),columns:a.reduce((r,[,f])=>r+f,0)})}var ne=i=>v(i.name)??i.name,L=class extends j{constructor(){super(...arguments);this.walks=new G(T(this,["walksLocation"],["walksIndex"]),this);this.refNames=new _(this.walks.file,this)}get anchor(){let e=this.getConf("assemblyNames")[0];if(e===void 0)throw new Error("WalkTabixSyntenyAdapter needs assemblyNames: its first entry is the assembly the reference sample is loaded as");return e}async getHaplotypeNames(e={}){return this.walks.haplotypeNames(e)}async getHeader(e={}){let{haplotypes:t}=await this.walks.reader.header(e),{anchor:s}=this,n=k(this,s),a=x(this);return{hasCoarseTier:!1,anchorAssemblyName:s,lanes:t.filter(r=>r!==n&&F(r)!==n).map(r=>({name:E(a,r),label:r,group:F(r)}))}}async getRefNames(e={}){let{assemblyName:t}=e;return t===void 0||t===this.anchor?this.refNames.assemblyRefNames({...e,assemblyName:this.anchor}):[]}async getSubgraph(e,t={}){let s=await this.refNames.resolve(e,{signal:t.signal});if(s===void 0)throw new Error(`${e.assemblyName} ${e.refName} is not in this graph's index; the graph is cut on ${this.anchor}, mapped to its PanSN prefix in assemblyNameToPanSN`);return this.walks.subgraph(s,e,t)}async laneWalks(e,t,s,n,a){return C(a,n.statusCallback,()=>this.walks.reader.cut(e,t,{...this.walks.budgets(),signal:n.signal,keep:q(s,e),links:!1}).catch(r=>{throw z(r)&&r instanceof Error&&(r.message=r.message.replace("to see the graph","to see lanes")),r}))}async anchorFeatures(e,t,s){let n=s.haplotypes?.length?s.haplotypes.map(m=>k(this,m)):void 0,a=k(this,s.targetAssemblyName),r=a===void 0?n:n===void 0||n.some(m=>P(a,m)||P(m,a))?[a]:[];if(r?.length===0)return[];let{start:f,end:g}=t,{graph:y,fragments:l}=await this.laneWalks(e,t,r,s,`Reading walks ${t.refName}:${f.toLocaleString()}-${g.toLocaleString()}`),p=J(y.nodes),N=x(this),h=l.filter(m=>m.name===e),c=m=>r===void 0?0:r.findIndex(d=>P(m.name,d));return l.filter(m=>m.name!==e&&c(m)>=0).sort((m,d)=>c(m)-c(d)).flatMap(m=>h.flatMap(d=>p(m,d).map(A=>B({chain:A,target:d,query:m,assemblyName:t.assemblyName,refName:t.refName,mateAssemblyName:E(N,ne(m))}))))}async pairFeatures(e,t,s,n){let a=s.map(l=>({pair:l,featurePrefix:k(this,l.queryAssemblyName),matePrefix:k(this,l.targetAssemblyName)})),{graph:r,fragments:f}=await this.laneWalks(e,t,a.flatMap(l=>[l.featurePrefix,l.matePrefix]),n,D(s)),g=U(r.nodes),y=l=>f.filter(p=>P(p.name,l));return a.flatMap(({pair:l,featurePrefix:p,matePrefix:N})=>y(p).flatMap(h=>y(N).flatMap(c=>g(c,h).map(b=>B({chain:b,target:h,query:c,assemblyName:l.queryAssemblyName,refName:S(h.name),mateAssemblyName:l.targetAssemblyName})))))}getFeatures(e,t={}){return $(async s=>{let n=e.assemblyName===this.anchor?await this.refNames.resolve(e,t):void 0;if(n!==void 0){let a=H(t),r=a.length>0?await this.pairFeatures(n,e,a,t):await this.anchorFeatures(n,e,t);for(let f of r)s.next(f)}s.complete()},t.signal)}};export{L as default};
|
|
2
|
+
//# sourceMappingURL=WalkTabixSyntenyAdapter-KRNEQL44.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as P,h as A,k as _}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as P,h as A,k as _}from"./chunk-NM7JYFMG.js";import{N as m,T as R}from"./chunk-HYKQBZA4.js";import{e as O}from"./chunk-YU7T5WOQ.js";import{D as G,E,H as g,d as v,o as T,q as I,r as k,s as L,t as w,w as N,y as x,z as D}from"./chunk-UGCNPRKC.js";import{b as t,c as i,d as C}from"./chunk-JMBDTNUR.js";var b=[{value:0,label:"Fastest"},{value:1,label:"Fast"},{value:2,label:"Default"},{value:3,label:"Fine"},{value:4,label:"Best"}];function S({label:o,value:n,options:e,testId:p,size:c,sx:d,disabled:u,title:a,shown:F,onChange:U}){let f=O();return i(L,{size:c,sx:d,disabled:u,title:a,children:[t(N,{id:f,shrink:!0,children:o}),t(G,{labelId:f,value:n,label:o,notched:!0,displayEmpty:!0,"data-testid":p,renderValue:l=>F??e.find(W=>W.value===l)?.label??l,onChange:l=>{U(l.target.value)},children:e.map(l=>t(D,{value:l.value,disabled:l.disabled,title:l.disabled?void 0:l.description,children:t(x,{primary:l.label,secondary:l.disabled?l.description:void 0})},l.value))})]})}var h=_()({section:{marginBottom:24},group:{marginBottom:16},heading:{marginBottom:8}});function r({warn:o=!1,children:n}){return t(g,{variant:"caption",component:"div",color:o?"warning.main":"text.secondary",children:n})}function y({title:o,children:n}){let{classes:e}=h();return i("section",{className:e.group,children:[t(g,{variant:"subtitle1",className:e.heading,children:o}),n]})}function B({label:o,checked:n,onChange:e,children:p}){let{classes:c}=h();return i("div",{className:c.section,children:[t(w,{control:t(E,{checked:n,onChange:d=>{e(d.target.checked)}}),label:o}),p]})}function s({children:o,...n}){let{classes:e}=h();return i("div",{className:e.section,children:[t(S,{sx:{minWidth:200},...n}),o]})}var Q=[5e3,2e4,5e4,1e5];function z(o){return[...new Set([...Q,o])].sort((n,e)=>n-e).map(n=>({value:String(n),label:n.toLocaleString()}))}var M=o=>o.map(({trackId:n,name:e})=>({value:n,label:e})),Y=C(function(n){let{model:e,open:p,onClose:c,children:d}=n,{classes:u}=h();return i(v,{open:p,onClose:c,title:"Graph settings",children:[i(k,{children:[i(y,{title:"Subgraph",children:[d,t(s,{label:"Node limit",value:String(e.maxGraphNodes),options:z(e.maxGraphNodes),testId:"graph-node-limit-select",onChange:a=>{e.setMaxGraphNodes(Number(a))},children:t(r,{children:"The most nodes a layout draws; past it the graph is declined. Walk rows take no limit."})})]}),i(y,{title:"Drawing",children:[e.anchorPaths.length>1?t(s,{label:"Reference path",value:e.activeReferencePath??"",options:e.anchorPaths.map(({name:a})=>({value:a,label:a})),testId:"graph-reference-path-select",onChange:a=>{e.setReferencePath(a),e.recomputeLayout()},children:t(r,{children:"The path the anchored layouts place x along"})}):null,t(s,{label:"Node width",value:e.nodeWidth,options:R,testId:"graph-node-width-select",onChange:a=>{e.setNodeWidth(a)},children:t(r,{children:"Depth as width. In a cut with walks, depth is how many haplotypes carry the node."})}),i(B,{label:"Draw paths",checked:e.drawPaths,onChange:a=>{e.setLayer("paths",a)},children:[t(r,{children:"Color each node by the paths through it, one lane per path"}),e.drawPaths&&!e.effectiveDrawPaths?t(r,{warn:!0,children:e.pathCount>m?`Off: ${e.pathCount.toLocaleString()} paths is past the ${m} this can tell apart`:"Off: this graph states no paths"}):null]}),e.geneTrackChoices.length>1?t(s,{label:"Gene track",value:e.geneTrack?.trackId??"",options:M(e.geneTrackChoices),testId:"graph-gene-track-select",onChange:a=>{e.setGeneTrackId(a)},children:t(r,{children:"Where genes on the backbone come from"})}):null,e.repeatTrackChoices.length>1?t(s,{label:"Repeat track",value:e.repeatTrack?.trackId??"",options:M(e.repeatTrackChoices),testId:"graph-repeat-track-select",onChange:a=>{e.setRepeatTrackId(a)},children:t(r,{children:"The tandem repeat annotation walk rows measure and tile by"})}):null]}),i(y,{title:"Force-directed layout",children:[e.hasGraph&&!e.usesLayoutEngine?t("div",{className:u.section,children:t(r,{warn:!0,children:"No effect on the current layout until Layout is Force-directed"})}):null,t(s,{label:"Engine",value:e.layoutEngine,options:P,testId:"graph-layout-engine-select",onChange:a=>{e.setLayoutEngine(a)},children:t(r,{children:"Stress keeps the reference straight, so a zoom keeps the picture; FMMM lets the whole graph settle."})}),t(s,{label:"Layout quality",value:String(e.layoutQuality),options:b.map(a=>({value:String(a.value),label:a.label})),testId:"graph-layout-quality-select",onChange:a=>{e.setLayoutQuality(Number(a))},children:t(r,{children:"The engine's iteration budget; higher is slower"})}),t(s,{label:"Bubble spread",value:e.bubbleSpread,options:A,testId:"graph-bubble-spread-select",onChange:a=>{e.setBubbleSpread(a)},children:t(r,{children:"How far the layout opens a bubble"})}),e.layoutEngine==="stress"?null:t(B,{label:"Linear layout",checked:e.linearLayout,onChange:a=>{e.setLinearLayout(a)},children:t(r,{children:"Keeps a chain of nodes on one line where it can"})})]})]}),t(I,{children:t(T,{variant:"contained",color:"primary",onClick:c,children:"Close"})})]})}),se=Y;export{S as a,se as b};
|
|
2
|
+
//# sourceMappingURL=chunk-7UTCUHQI.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.7/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-K5SIJGAE.js", "../../src/GraphGenomeView/components/LabelledSelect.tsx", "../../src/GraphGenomeView/components/GraphSettingsDialog.tsx"],
|
|
4
4
|
"sourcesContent": ["// src/layoutQualities.ts\nvar LAYOUT_QUALITIES = [\n { value: 0, label: \"Fastest\" },\n { value: 1, label: \"Fast\" },\n { value: 2, label: \"Default\" },\n { value: 3, label: \"Fine\" },\n { value: 4, label: \"Best\" }\n];\n\nexport {\n LAYOUT_QUALITIES\n};\n", "import { useId } from 'react'\n\nimport {\n FormControl,\n InputLabel,\n ListItemText,\n MenuItem,\n Select,\n} from '@mui/material'\n\nimport type { SxProps } from '@mui/material'\n\ninterface SelectOption<T extends string> {\n value: T\n label: string\n // an option's tooltip, and the reason under a disabled one, whose tooltip\n // cannot open\n description?: string\n disabled?: boolean\n}\n\n// One dropdown with its label tied to it, so a screen reader names the combobox\nexport default function LabelledSelect<T extends string>({\n label,\n value,\n options,\n testId,\n size,\n sx,\n disabled,\n title,\n shown,\n onChange,\n}: {\n label: string\n value: T\n options: readonly SelectOption<T>[]\n testId?: string\n size?: 'small' | 'medium'\n sx?: SxProps\n disabled?: boolean\n title?: string\n // what the closed select reads, when not the picked option's label\n shown?: string\n onChange: (value: T) => void\n}) {\n const labelId = useId()\n return (\n <FormControl size={size} sx={sx} disabled={disabled} title={title}>\n <InputLabel id={labelId} shrink>\n {label}\n </InputLabel>\n <Select\n labelId={labelId}\n value={value}\n label={label}\n notched\n displayEmpty\n data-testid={testId}\n renderValue={picked =>\n shown ?? options.find(o => o.value === picked)?.label ?? picked\n }\n onChange={e => {\n onChange(e.target.value as T)\n }}\n >\n {options.map(o => (\n <MenuItem\n key={o.value}\n value={o.value}\n disabled={o.disabled}\n title={o.disabled ? undefined : o.description}\n >\n <ListItemText\n primary={o.label}\n secondary={o.disabled ? o.description : undefined}\n />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n}\n", "import type { ReactNode } from 'react'\n\nimport { BUBBLE_SPREADS } from '@jbrowse/bandage-core/bubbleSpreads'\nimport { LAYOUT_ENGINES } from '@jbrowse/bandage-core/layoutEngines'\nimport { LAYOUT_QUALITIES } from '@jbrowse/bandage-core/layoutQualities'\nimport { NODE_WIDTHS } from '@jbrowse/bandage-core/nodeWidths'\nimport { MAX_PATH_COLORS } from '@jbrowse/bandage-core/pathColors'\nimport { Dialog } from '@jbrowse/core/ui'\nimport {\n Button,\n DialogActions,\n DialogContent,\n FormControlLabel,\n Switch,\n Typography,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport LabelledSelect from './LabelledSelect'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n section: {\n marginBottom: 24,\n },\n group: {\n marginBottom: 16,\n },\n heading: {\n marginBottom: 8,\n },\n})\n\nfunction Caption({\n warn = false,\n children,\n}: {\n warn?: boolean\n children: ReactNode\n}) {\n return (\n <Typography\n variant=\"caption\"\n component=\"div\"\n color={warn ? 'warning.main' : 'text.secondary'}\n >\n {children}\n </Typography>\n )\n}\n\nfunction Group({ title, children }: { title: string; children: ReactNode }) {\n const { classes } = useStyles()\n return (\n <section className={classes.group}>\n <Typography variant=\"subtitle1\" className={classes.heading}>\n {title}\n </Typography>\n {children}\n </section>\n )\n}\n\nfunction SettingSwitch({\n label,\n checked,\n onChange,\n children,\n}: {\n label: string\n checked: boolean\n onChange: (checked: boolean) => void\n children?: ReactNode\n}) {\n const { classes } = useStyles()\n return (\n <div className={classes.section}>\n <FormControlLabel\n control={\n <Switch\n checked={checked}\n onChange={e => {\n onChange(e.target.checked)\n }}\n />\n }\n label={label}\n />\n {children}\n </div>\n )\n}\n\n// one dropdown setting, at the dialog's width, and its caption\nfunction SettingSelect<T extends string>({\n children,\n ...props\n}: Omit<Parameters<typeof LabelledSelect<T>>[0], 'size' | 'sx'> & {\n children?: ReactNode\n}) {\n const { classes } = useStyles()\n return (\n <div className={classes.section}>\n <LabelledSelect sx={{ minWidth: 200 }} {...props} />\n {children}\n </div>\n )\n}\n\nconst NODE_LIMITS = [5000, 20_000, 50_000, 100_000]\n\n// the presets, with a limit a session states among them\nfunction nodeLimitOptions(current: number) {\n return [...new Set([...NODE_LIMITS, current])]\n .sort((a, b) => a - b)\n .map(limit => ({ value: String(limit), label: limit.toLocaleString() }))\n}\n\nconst trackOptions = (tracks: { trackId: string; name: string }[]) =>\n tracks.map(({ trackId, name }) => ({ value: trackId, label: name }))\n\n// Toggles the menus already offer (halos, genes, color) stay out of here.\n// `children` is the host's own part of the subgraph group.\nconst GraphSettingsDialog = observer(function GraphSettingsDialog(props: {\n model: GraphPaneModel\n open: boolean\n onClose: () => void\n children?: ReactNode\n}) {\n const { model, open, onClose, children } = props\n const { classes } = useStyles()\n\n return (\n <Dialog open={open} onClose={onClose} title=\"Graph settings\">\n <DialogContent>\n <Group title=\"Subgraph\">\n {children}\n <SettingSelect\n label=\"Node limit\"\n value={String(model.maxGraphNodes)}\n options={nodeLimitOptions(model.maxGraphNodes)}\n testId=\"graph-node-limit-select\"\n onChange={limit => {\n model.setMaxGraphNodes(Number(limit))\n }}\n >\n <Caption>\n The most nodes a layout draws; past it the graph is declined. Walk\n rows take no limit.\n </Caption>\n </SettingSelect>\n </Group>\n\n <Group title=\"Drawing\">\n {model.anchorPaths.length > 1 ? (\n <SettingSelect\n label=\"Reference path\"\n value={model.activeReferencePath ?? ''}\n options={model.anchorPaths.map(({ name }) => ({\n value: name,\n label: name,\n }))}\n testId=\"graph-reference-path-select\"\n onChange={name => {\n model.setReferencePath(name)\n void model.recomputeLayout()\n }}\n >\n <Caption>The path the anchored layouts place x along</Caption>\n </SettingSelect>\n ) : null}\n\n <SettingSelect\n label=\"Node width\"\n value={model.nodeWidth}\n options={NODE_WIDTHS}\n testId=\"graph-node-width-select\"\n onChange={width => {\n model.setNodeWidth(width)\n }}\n >\n <Caption>\n Depth as width. In a cut with walks, depth is how many haplotypes\n carry the node.\n </Caption>\n </SettingSelect>\n\n <SettingSwitch\n label=\"Draw paths\"\n checked={model.drawPaths}\n onChange={draw => {\n model.setLayer('paths', draw)\n }}\n >\n <Caption>\n Color each node by the paths through it, one lane per path\n </Caption>\n {model.drawPaths && !model.effectiveDrawPaths ? (\n <Caption warn>\n {model.pathCount > MAX_PATH_COLORS\n ? `Off: ${model.pathCount.toLocaleString()} paths is past the ${MAX_PATH_COLORS} this can tell apart`\n : 'Off: this graph states no paths'}\n </Caption>\n ) : null}\n </SettingSwitch>\n\n {model.geneTrackChoices.length > 1 ? (\n <SettingSelect\n label=\"Gene track\"\n value={model.geneTrack?.trackId ?? ''}\n options={trackOptions(model.geneTrackChoices)}\n testId=\"graph-gene-track-select\"\n onChange={trackId => {\n model.setGeneTrackId(trackId)\n }}\n >\n <Caption>Where genes on the backbone come from</Caption>\n </SettingSelect>\n ) : null}\n\n {model.repeatTrackChoices.length > 1 ? (\n <SettingSelect\n label=\"Repeat track\"\n value={model.repeatTrack?.trackId ?? ''}\n options={trackOptions(model.repeatTrackChoices)}\n testId=\"graph-repeat-track-select\"\n onChange={trackId => {\n model.setRepeatTrackId(trackId)\n }}\n >\n <Caption>\n The tandem repeat annotation walk rows measure and tile by\n </Caption>\n </SettingSelect>\n ) : null}\n </Group>\n\n <Group title=\"Force-directed layout\">\n {model.hasGraph && !model.usesLayoutEngine ? (\n <div className={classes.section}>\n <Caption warn>\n No effect on the current layout until Layout is Force-directed\n </Caption>\n </div>\n ) : null}\n\n <SettingSelect\n label=\"Engine\"\n value={model.layoutEngine}\n options={LAYOUT_ENGINES}\n testId=\"graph-layout-engine-select\"\n onChange={engine => {\n model.setLayoutEngine(engine)\n }}\n >\n <Caption>\n Stress keeps the reference straight, so a zoom keeps the picture;\n FMMM lets the whole graph settle.\n </Caption>\n </SettingSelect>\n\n <SettingSelect\n label=\"Layout quality\"\n value={String(model.layoutQuality)}\n options={LAYOUT_QUALITIES.map(q => ({\n value: String(q.value),\n label: q.label,\n }))}\n testId=\"graph-layout-quality-select\"\n onChange={quality => {\n model.setLayoutQuality(Number(quality))\n }}\n >\n <Caption>\n The engine's iteration budget; higher is slower\n </Caption>\n </SettingSelect>\n\n <SettingSelect\n label=\"Bubble spread\"\n value={model.bubbleSpread}\n options={BUBBLE_SPREADS}\n testId=\"graph-bubble-spread-select\"\n onChange={spread => {\n model.setBubbleSpread(spread)\n }}\n >\n <Caption>How far the layout opens a bubble</Caption>\n </SettingSelect>\n\n {model.layoutEngine === 'stress' ? null : (\n <SettingSwitch\n label=\"Linear layout\"\n checked={model.linearLayout}\n onChange={linear => {\n model.setLinearLayout(linear)\n }}\n >\n <Caption>Keeps a chain of nodes on one line where it can</Caption>\n </SettingSwitch>\n )}\n </Group>\n </DialogContent>\n\n <DialogActions>\n <Button variant=\"contained\" color=\"primary\" onClick={onClose}>\n Close\n </Button>\n </DialogActions>\n </Dialog>\n )\n})\n\nexport default GraphSettingsDialog\n"],
|
|
5
5
|
"mappings": "mTACA,IAAIA,EAAmB,CACrB,CAAE,MAAO,EAAG,MAAO,SAAU,EAC7B,CAAE,MAAO,EAAG,MAAO,MAAO,EAC1B,CAAE,MAAO,EAAG,MAAO,SAAU,EAC7B,CAAE,MAAO,EAAG,MAAO,MAAO,EAC1B,CAAE,MAAO,EAAG,MAAO,MAAO,CAC5B,ECee,SAARC,EAAkD,CACvD,MAAAC,EACA,MAAAC,EACA,QAAAC,EACA,OAAAC,EACA,KAAAC,EACA,GAAAC,EACA,SAAAC,EACA,MAAAC,EACA,MAAAC,EACA,SAAAC,CACF,EAYG,CACD,IAAMC,EAAUC,EAAM,EACtB,OACEC,EAACC,EAAA,CAAY,KAAMT,EAAM,GAAIC,EAAI,SAAUC,EAAU,MAAOC,EAC1D,UAAAO,EAACC,EAAA,CAAW,GAAIL,EAAS,OAAM,GAC5B,SAAAV,EACH,EACAc,EAACE,EAAA,CACC,QAASN,EACT,MAAOT,EACP,MAAOD,EACP,QAAO,GACP,aAAY,GACZ,cAAaG,EACb,YAAac,GACXT,GAASN,EAAQ,KAAKgB,GAAKA,EAAE,QAAUD,CAAM,GAAG,OAASA,EAE3D,SAAUE,GAAK,CACbV,EAASU,EAAE,OAAO,KAAU,CAC9B,EAEC,SAAAjB,EAAQ,IAAIgB,GACXJ,EAACM,EAAA,CAEC,MAAOF,EAAE,MACT,SAAUA,EAAE,SACZ,MAAOA,EAAE,SAAW,OAAYA,EAAE,YAElC,SAAAJ,EAACO,EAAA,CACC,QA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AAO,6BACP,SAAUC,GAAU,CAClBV,EAAM,gBAAgBU,CAAM,CAC9B,EAEA,SAAAtC,EAACH,EAAA,CAAQ,+GAGT,EACF,EAEAG,EAACa,EAAA,CACC,MAAM,iBACN,MAAO,OAAOe,EAAM,aAAa,EACjC,QAASW,EAAiB,IAAIC,IAAM,CAClC,MAAO,OAAOA,EAAE,KAAK,EACrB,MAAOA,EAAE,KACX,EAAE,EACF,OAAO,8BACP,SAAUC,GAAW,CACnBb,EAAM,iBAAiB,OAAOa,CAAO,CAAC,CACxC,EAEA,SAAAzC,EAACH,EAAA,CAAQ,2DAET,EACF,EAEAG,EAACa,EAAA,CACC,MAAM,gBACN,MAAOe,EAAM,aACb,QAASc,EACT,OAAO,6BACP,SAAUC,GAAU,CAClBf,EAAM,gBAAgBe,CAAM,CAC9B,EAEA,SAAA3C,EAACH,EAAA,CAAQ,6CAAiC,EAC5C,EAEC+B,EAAM,eAAiB,SAAW,KACjC5B,EAACM,EAAA,CACC,MAAM,gBACN,QAASsB,EAAM,aACf,SAAUgB,GAAU,CAClBhB,EAAM,gBAAgBgB,CAAM,CAC9B,EAEA,SAAA5C,EAACH,EAAA,CAAQ,2DAA+C,EAC1D,GAEJ,GACF,EAEAG,EAAC6C,EAAA,CACC,SAAA7C,EAAC8C,EAAA,CAAO,QAAQ,YAAY,MAAM,UAAU,QAAShB,EAAS,iBAE9D,EACF,GACF,CAEJ,CAAC,EAEMiB,GAAQrB",
|
|
6
6
|
"names": ["LAYOUT_QUALITIES", "LabelledSelect", "label", "value", "options", "testId", "size", "sx", "disabled", "title", "shown", "onChange", "labelId", "useId", "jsxs", "FormControl", "jsx", "InputLabel", "Select", "picked", "o", "e", "MenuItem", "ListItemText", "useStyles", "makeStyles", "Caption", "warn", "children", "jsx", "Typography", "Group", "title", "classes", "jsxs", "SettingSwitch", "label", "checked", "onChange", "FormControlLabel", "Switch", "e", "SettingSelect", "props", "LabelledSelect", "NODE_LIMITS", "nodeLimitOptions", "current", "a", "b", "limit", "trackOptions", "tracks", "trackId", "name", "GraphSettingsDialog", "observer", "model", "open", "onClose", "Dialog", "DialogContent", "NODE_WIDTHS", "width", "draw", "MAX_PATH_COLORS", "LAYOUT_ENGINES", "engine", "LAYOUT_QUALITIES", "q", "quality", "BUBBLE_SPREADS", "spread", "linear", "DialogActions", "Button", "GraphSettingsDialog_default"]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function o(t){return t===void 0||t==="*"?void 0:t}function s(t){let e=t.split(" ");return{refName:e[0],start:+e[1],end:+e[2],segmentCount:+e[3],pathCount:+e[4],inversion:e[5]==="1",shortestAlleleLength:+e[6],longestAlleleLength:+e[7],segments:e[11],shortestAllele:o(e[12]),longestAllele:o(e[13])}}function u(t,e){return t.key!==void 0||e.key!==void 0?t.key===e.key:t.refName===e.refName&&t.start===e.start&&t.end===e.end}function i(t){return t.key??`${t.refName}:${t.start}-${t.end}`}function b(t){let{shortestAlleleLength:e,longestAlleleLength:n}=t;return e===n?`${n.toLocaleString()} bp`:`${e.toLocaleString()}-${n.toLocaleString()} bp`}var r=2147483647;function a(t){let{pathCount:e,segmentCount:n,inversion:l}=t;return[`${n} segments`,e===r?"more paths than gfatools counts":`up to ${e.toLocaleString()} paths`,...l?["inversion"]:[]].join(", ")}export{s as a,u as b,i as c,b as d,r as e,a as f};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-A7DB4V4C.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.7/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-FX4RDMDN.js"],
|
|
4
4
|
"sourcesContent": ["// src/bubbles/bubbleLine.ts\nfunction sequence(field) {\n return field === void 0 || field === \"*\" ? void 0 : field;\n}\nfunction parseBubbleLine(line) {\n const cols = line.split(\"\t\");\n return {\n refName: cols[0],\n start: +cols[1],\n end: +cols[2],\n segmentCount: +cols[3],\n pathCount: +cols[4],\n inversion: cols[5] === \"1\",\n shortestAlleleLength: +cols[6],\n longestAlleleLength: +cols[7],\n segments: cols[11],\n shortestAllele: sequence(cols[12]),\n longestAllele: sequence(cols[13])\n };\n}\nfunction sameBubble(a, b) {\n return a.key !== void 0 || b.key !== void 0 ? a.key === b.key : a.refName === b.refName && a.start === b.start && a.end === b.end;\n}\nfunction bubbleKey(b) {\n return b.key ?? `${b.refName}:${b.start}-${b.end}`;\n}\nfunction bubbleLabel(bubble) {\n const { shortestAlleleLength: min, longestAlleleLength: max } = bubble;\n return min === max ? `${max.toLocaleString()} bp` : `${min.toLocaleString()}-${max.toLocaleString()} bp`;\n}\nvar SATURATED_PATH_COUNT = 2147483647;\nfunction bubbleDescription(bubble) {\n const { pathCount, segmentCount, inversion } = bubble;\n return [\n `${segmentCount} segments`,\n pathCount === SATURATED_PATH_COUNT ? \"more paths than gfatools counts\" : `up to ${pathCount.toLocaleString()} paths`,\n ...inversion ? [\"inversion\"] : []\n ].join(\", \");\n}\n\nexport {\n parseBubbleLine,\n sameBubble,\n bubbleKey,\n bubbleLabel,\n SATURATED_PATH_COUNT,\n bubbleDescription\n};\n"],
|
|
5
5
|
"mappings": "AACA,SAASA,EAASC,EAAO,CACvB,OAAOA,IAAU,QAAUA,IAAU,IAAM,OAASA,CACtD,CACA,SAASC,EAAgBC,EAAM,CAC7B,IAAMC,EAAOD,EAAK,MAAM,GAAG,EAC3B,MAAO,CACL,QAASC,EAAK,CAAC,EACf,MAAO,CAACA,EAAK,CAAC,EACd,IAAK,CAACA,EAAK,CAAC,EACZ,aAAc,CAACA,EAAK,CAAC,EACrB,UAAW,CAACA,EAAK,CAAC,EAClB,UAAWA,EAAK,CAAC,IAAM,IACvB,qBAAsB,CAACA,EAAK,CAAC,EAC7B,oBAAqB,CAACA,EAAK,CAAC,EAC5B,SAAUA,EAAK,EAAE,EACjB,eAAgBJ,EAASI,EAAK,EAAE,CAAC,EACjC,cAAeJ,EAASI,EAAK,EAAE,CAAC,CAClC,CACF,CACA,SAASC,EAAWC,EAAGC,EAAG,CACxB,OAAOD,EAAE,MAAQ,QAAUC,EAAE,MAAQ,OAASD,EAAE,MAAQC,EAAE,IAAMD,EAAE,UAAYC,EAAE,SAAWD,EAAE,QAAUC,EAAE,OAASD,EAAE,MAAQC,EAAE,GAChI,CACA,SAASC,EAAUD,EAAG,CACpB,OAAOA,EAAE,KAAO,GAAGA,EAAE,OAAO,IAAIA,EAAE,KAAK,IAAIA,EAAE,GAAG,EAClD,CACA,SAASE,EAAYC,EAAQ,CAC3B,GAAM,CAAE,qBAAsBC,EAAK,oBAAqBC,CAAI,EAAIF,EAChE,OAAOC,IAAQC,EAAM,GAAGA,EAAI,eAAe,CAAC,MAAQ,GAAGD,EAAI,eAAe,CAAC,IAAIC,EAAI,eAAe,CAAC,KACrG,CACA,IAAIC,EAAuB,WAC3B,SAASC,EAAkBJ,EAAQ,CACjC,GAAM,CAAE,UAAAK,EAAW,aAAAC,EAAc,UAAAC,CAAU,EAAIP,EAC/C,MAAO,CACL,GAAGM,CAAY,YACfD,IAAcF,EAAuB,kCAAoC,SAASE,EAAU,eAAe,CAAC,SAC5G,GAAGE,EAAY,CAAC,WAAW,EAAI,CAAC,CAClC,EAAE,KAAK,IAAI,CACb",
|
|
6
6
|
"names": ["sequence", "field", "parseBubbleLine", "line", "cols", "sameBubble", "a", "b", "bubbleKey", "bubbleLabel", "bubble", "min", "max", "SATURATED_PATH_COUNT", "bubbleDescription", "pathCount", "segmentCount", "inversion"]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as pe,c as me,d as de}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as pe,c as me,d as de}from"./chunk-KM3QNC77.js";var J=1,be=2,$=4;function We(s,a,c){return c?{...s,walkRowRuns:ke(s,a)}:s}function Re(s){let a=pe(s),c=me(s);return{name:s,sample:a,haplotype:c===void 0?void 0:+c.slice(a.length+1),contig:de(s)}}var K=class{constructor(){this.start=[];this.bp=[];this.referenceStart=[];this.flags=[];this.offsets=[0]}get length(){return this.bp.length}push(a,c,d,R){this.start.push(a),this.bp.push(c),this.flags.push(d),this.referenceStart.push(R)}endRow(){this.offsets.push(this.bp.length)}};function ke({nodes:s,walks:a},c){let d=s.lengths.length,R=e=>e<d?s.lengths[e]:0,S=[];for(let e=0;e<a.names.length;e++)a.offsets[e+1]>a.offsets[e]&&S.push({...Re(a.names[e]),start:a.starts[e],from:a.offsets[e],to:a.offsets[e+1]});let A=S.filter(e=>e.name===S[0]?.name).sort((e,n)=>e.start-n.start),D=A[0],Q=S.filter(e=>e.name!==D?.name);if(!D||Q.length===0)return;let H=new Map;for(let e of Q){let n=H.get(e.name);n?n.push(e):H.set(e.name,[e])}let m=new Float64Array(s.names.length).fill(Number.NaN),F=new Float64Array(s.names.length),X=!1,Y=!1,b=c&&c.end>c.start?c:void 0;for(let e of A){let n=e.start;for(let w=e.from;w<e.to;w++){let g=a.steps[w],o=R(g);Number.isNaN(m[g])&&(m[g]=n,F[g]=n+o,b&&(X||=n+o<=b.start,Y||=n>=b.end)),n+=o}}let he=b===void 0||X&&Y,u=new K,h=new Int32Array(0),k=new Float64Array(0),Z=e=>{let n=e[0],w=[...e].sort((t,r)=>t.start-r.start),g=w.length-1;for(let t of w)g+=t.to-t.from;g>h.length&&(h=new Int32Array(g*2),k=new Float64Array(g*2));let o=0,oe=!1,W;for(let t of w){W!==void 0&&t.start<W&&(oe=!0),W!==void 0&&t.start>W&&(h[o]=-(t.start-W),k[o++]=W);let r=t.start;for(let l=t.from;l<t.to;l++){let f=a.steps[l];h[o]=f,k[o++]=r,r+=f<d?s.lengths[f]:0}W=r}let we=(t,r)=>{let l=t>=0?t:r,f=-1;for(let _=1;f<0&&_<o;_++)for(let j of[l-_,l+_]){let ue=j>=0&&j<o?h[j]:-1;f<0&&ue>=0&&!Number.isNaN(m[ue])&&(f=j)}if(f<0)return;let i=f>l==m[h[f]]>m[h[l]],p=i===(l===t),I=p?o-1:0,y=h[I],B=y>=0&&!Number.isNaN(m[y]);return{stop:{contigEnds:B,shortBp:B?Math.max(0,b.start-F[y],m[y]-b.end):0},lo:p?l+1:0,hi:p?o:l,backward:!i,axisStart:i?p?V(l):k[0]:p?V(o-1):k[l]}},V=t=>{let r=h[t];return k[t]+(r<0?-r:R(r))},O=0,T=o,G=!1,le=!0,P=-1,fe=-1,q,z;if(b&&he){let t=-1,r=-1,l=-1/0,f=1/0;for(let i=0;i<o;i++){let p=h[i];p>=0&&!Number.isNaN(m[p])&&(F[p]<=b.start&&F[p]>l&&(l=F[p],t=i),m[p]>=b.end&&m[p]<f&&(f=m[p],r=i))}if(t<0||r<0){le=!1;let i=t>=0||r>=0?we(t,r):void 0;i&&({lo:O,hi:T,backward:G,axisStart:q,stop:z}=i)}else O=Math.min(t,r)+1,T=Math.max(t,r),G=t>r,P=t,fe=r}let Ne=oe||o===0?void 0:q!==void 0?{contig:n.contig,start:q,reversed:G}:P<0?{contig:n.contig,start:k[0],reversed:!1}:P<fe?{contig:n.contig,start:V(P),reversed:!1}:{contig:n.contig,start:k[P],reversed:!0},v=0,ie=0,ce=0,M=0,N=-1,x=0,U=Number.NaN;for(let t=O;t<T;t++){let r=h[G?T-1-(t-O):t];if(r<0){u.push(v,-r,$,Number.NaN),N=u.length-1,x=$,U=Number.NaN,v+=-r,ce+=-r,M=0;continue}let l=R(r),f=m[r],i=!Number.isNaN(f),p=U,I=N>=0&&!Number.isNaN(p),y=i&&I&&M>=0&&p+(u.bp[N]??0)===f,B=i&&I&&M<=0&&F[r]===p;!i&&N>=0&&!(x&J)&&!(x&$)?u.bp[N]+=l:y||B?(u.bp[N]+=l,y||(U=f,u.referenceStart[N]=f,x|=be,u.flags[N]=x),M=y?1:-1):(x=i?J:0,U=i?f:Number.NaN,u.push(v,l,x,U),N=u.length-1,M=0),v+=l,i||(ie+=l)}return u.endRow(),{name:n.name,label:n.haplotype===void 0?n.sample:`${n.sample}#${n.haplotype}`,sample:n.sample,haplotype:n.haplotype,bp:v,offReferenceBp:ie,gapBp:ce,complete:le,...z?{stop:z}:{},axis:Ne}},ge=Z(A),L=[...H.values()].map(e=>({meta:Z(e),row:u.offsets.length-2}));L.sort((e,n)=>Number(n.meta.complete)-Number(e.meta.complete)||n.meta.bp-e.meta.bp||e.meta.label.localeCompare(n.meta.label));let ee=[0,...L.map(e=>e.row)],C=u.length,te=new Uint32Array(ee.length+1),ne=new Float64Array(C),re=new Float64Array(C),se=new Float64Array(C),ae=new Uint8Array(C),E=0;return ee.forEach((e,n)=>{let w=u.offsets[e],g=u.offsets[e+1];for(let o=w;o<g;o++,E++)ne[E]=u.start[o],re[E]=u.bp[o],se[E]=u.referenceStart[o],ae[E]=u.flags[o];te[n+1]=E}),{origin:b?b.start:D.start,rows:[ge,...L.map(e=>e.meta)],offsets:te,start:ne,bp:re,referenceStart:se,flags:ae}}function ye(s,a){let c=s.flags[a],d={start:s.start[a],bp:s.bp[a],onReference:(c&J)!==0};return c&$?d.gap=!0:d.referenceStart=Number.isNaN(s.referenceStart[a])?void 0:s.referenceStart[a],c&be&&(d.reversed=!0),d}function xe(s,a){let c=s.rows.map((d,R)=>{let S=[];for(let A=s.offsets[R];A<s.offsets[R+1];A++)S.push(ye(s,A));return{...d,runs:S}});return{origin:s.origin,unit:a,reference:c[0],rows:c.slice(1)}}export{We as a,Re as b,ke as c,xe as d};
|
|
2
|
+
//# sourceMappingURL=chunk-HVBY3TGB.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/RgfaTabixAdapter/walkRowRuns.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n panSNContig,\n panSNHaplotype,\n panSNSample,\n} from '@jbrowse/bandage-core/pansn'\n\nimport type { GraphTables } from '@jbrowse/bandage-core/gfa/graphTables'\nimport type {\n WalkAxis,\n WalkRow,\n WalkRows,\n WalkRun,\n WalkStop,\n} from '@jbrowse/bandage-core/layout/walkRows'\n\nconst RUN_ON_REFERENCE = 1\nconst RUN_REVERSED = 2\nconst RUN_GAP = 4\n\ntype WalkRowMeta = Omit<WalkRow, 'runs'>\n\n/**\n * A cut for walk rows: the tables, and the rows' runs over the window, which\n * the main thread draws without a Graph of the walks' steps\n */\nexport type WalkCut = GraphTables & { walkRowRuns?: WalkRowRuns }\n\nexport function walkCutFor(\n tables: GraphTables,\n region: { start: number; end: number },\n walkRows: boolean | undefined,\n): WalkCut {\n return walkRows\n ? { ...tables, walkRowRuns: walkRowRuns(tables, region) }\n : tables\n}\n\n/**\n * bandage-core's `walkRows` over a cut's tables, each row's runs as typed\n * arrays that cross from the worker beside the tables. Row 0 is the\n * reference.\n */\nexport interface WalkRowRuns {\n origin: number\n rows: WalkRowMeta[]\n offsets: Uint32Array\n start: Float64Array\n bp: Float64Array\n referenceStart: Float64Array\n flags: Uint8Array\n}\n\n/**\n * A walk's PanSN fields: `HG002#1#chr1`, or a pggb P-line's `chm13#chr1`,\n * which has no haplotype\n */\nexport function walkPath(name: string) {\n const sample = panSNSample(name)\n const haplotype = panSNHaplotype(name)\n return {\n name,\n sample,\n haplotype:\n haplotype === undefined ? undefined : +haplotype.slice(sample.length + 1),\n contig: panSNContig(name),\n }\n}\n\ntype Path = ReturnType<typeof walkPath> & {\n start: number\n from: number\n to: number\n}\n\nclass RunWriter {\n start: number[] = []\n bp: number[] = []\n referenceStart: number[] = []\n flags: number[] = []\n offsets = [0]\n\n get length() {\n return this.bp.length\n }\n\n push(start: number, bp: number, flags: number, referenceStart: number) {\n this.start.push(start)\n this.bp.push(bp)\n this.flags.push(flags)\n this.referenceStart.push(referenceStart)\n }\n\n endRow() {\n this.offsets.push(this.bp.length)\n }\n}\n\n/**\n * `walkRows(graphFromTables(tables), region)` for a cut whose first walk is\n * the reference, which every walk-file and GBZ cut is, in as many pieces as\n * the cut breaks it into; a step is a node index. A gap between two pieces of\n * one haplotype is a step of `-bp`. Two differences: a walk reaching only one of the region's flanks measures from\n * that flank, where walkRows takes the whole walk the cut holds, so its length\n * is a lower bound that no longer grows with the cut's context; and a row\n * keeps its walk's name whole, where graphFromTables reads a two-part name\n * (`chm13#chr1`) as a haplotype `chr1` with no contig.\n */\nexport function walkRowRuns(\n { nodes: n, walks: w }: GraphTables,\n region?: { start: number; end: number },\n): WalkRowRuns | undefined {\n const declared = n.lengths.length\n const lengthOf = (node: number) => (node < declared ? n.lengths[node]! : 0)\n const paths: Path[] = []\n for (let p = 0; p < w.names.length; p++) {\n if (w.offsets[p + 1]! > w.offsets[p]!) {\n paths.push({\n ...walkPath(w.names[p]!),\n start: w.starts[p]!,\n from: w.offsets[p]!,\n to: w.offsets[p + 1]!,\n })\n }\n }\n const referencePieces = paths\n .filter(p => p.name === paths[0]?.name)\n .sort((a, b) => a.start - b.start)\n const first = referencePieces[0]\n const others = paths.filter(p => p.name !== first?.name)\n if (!first || others.length === 0) {\n return undefined\n }\n const walks = new Map<string, Path[]>()\n for (const path of others) {\n const list = walks.get(path.name)\n if (list) {\n list.push(path)\n } else {\n walks.set(path.name, [path])\n }\n }\n\n const spanStart = new Float64Array(n.names.length).fill(Number.NaN)\n const spanEnd = new Float64Array(n.names.length)\n let flankedBefore = false\n let flankedAfter = false\n const cut = region && region.end > region.start ? region : undefined\n for (const piece of referencePieces) {\n let pos = piece.start\n for (let s = piece.from; s < piece.to; s++) {\n const node = w.steps[s]!\n const len = lengthOf(node)\n if (Number.isNaN(spanStart[node]!)) {\n spanStart[node] = pos\n spanEnd[node] = pos + len\n if (cut) {\n flankedBefore ||= pos + len <= cut.start\n flankedAfter ||= pos >= cut.end\n }\n }\n pos += len\n }\n }\n const flanked = cut === undefined || (flankedBefore && flankedAfter)\n\n const out = new RunWriter()\n let steps = new Int32Array(0)\n let stepStart = new Float64Array(0)\n const rowOf = (pieces: Path[]): WalkRowMeta => {\n const path = pieces[0]!\n const ordered = [...pieces].sort((a, b) => a.start - b.start)\n // the walk's steps, each piece's gap from the last as a step of -bp\n let count = ordered.length - 1\n for (const piece of ordered) {\n count += piece.to - piece.from\n }\n if (count > steps.length) {\n steps = new Int32Array(count * 2)\n stepStart = new Float64Array(count * 2)\n }\n let length = 0\n let overlaps = false\n let end: number | undefined\n for (const piece of ordered) {\n if (end !== undefined && piece.start < end) {\n overlaps = true\n }\n if (end !== undefined && piece.start > end) {\n steps[length] = -(piece.start - end)\n stepStart[length++] = end\n }\n let pos = piece.start\n for (let s = piece.from; s < piece.to; s++) {\n const node = w.steps[s]!\n steps[length] = node\n stepStart[length++] = pos\n pos += node < declared ? n.lengths[node]! : 0\n }\n end = pos\n }\n // A walk with one flank, whose contig ends inside the window: the steps\n // past that flank, read in the reference's direction. Which side is\n // inside follows the walk's direction along the reference at the\n // flank, from the nearest other step on it.\n const partialSide = (i0: number, i1: number) => {\n const flank = i0 >= 0 ? i0 : i1\n let near = -1\n for (let d = 1; near < 0 && d < length; d++) {\n for (const j of [flank - d, flank + d]) {\n const id = j >= 0 && j < length ? steps[j]! : -1\n if (near < 0 && id >= 0 && !Number.isNaN(spanStart[id]!)) {\n near = j\n }\n }\n }\n if (near < 0) {\n return undefined\n }\n const forward =\n near > flank === spanStart[steps[near]!]! > spanStart[steps[flank]!]!\n const after = forward === (flank === i0)\n const end = after ? length - 1 : 0\n const endId = steps[end]!\n const contigEnds = endId >= 0 && !Number.isNaN(spanStart[endId]!)\n const stop: WalkStop = {\n contigEnds,\n shortBp: contigEnds\n ? Math.max(\n 0,\n cut!.start - spanEnd[endId]!,\n spanStart[endId]! - cut!.end,\n )\n : 0,\n }\n return {\n stop,\n lo: after ? flank + 1 : 0,\n hi: after ? length : flank,\n backward: !forward,\n axisStart: forward\n ? after\n ? stepEnd(flank)\n : stepStart[0]!\n : after\n ? stepEnd(length - 1)\n : stepStart[flank]!,\n }\n }\n const stepEnd = (i: number) => {\n const id = steps[i]!\n return stepStart[i]! + (id < 0 ? -id : lengthOf(id))\n }\n\n let lo = 0\n let hi = length\n let backward = false\n let complete = true\n let from = -1\n let to = -1\n let axisStart: number | undefined\n let stop: WalkStop | undefined\n if (cut && flanked) {\n let i0 = -1\n let i1 = -1\n let bestEnd = -Infinity\n let bestStart = Infinity\n for (let i = 0; i < length; i++) {\n const id = steps[i]!\n if (id >= 0 && !Number.isNaN(spanStart[id]!)) {\n if (spanEnd[id]! <= cut.start && spanEnd[id]! > bestEnd) {\n bestEnd = spanEnd[id]!\n i0 = i\n }\n if (spanStart[id]! >= cut.end && spanStart[id]! < bestStart) {\n bestStart = spanStart[id]!\n i1 = i\n }\n }\n }\n if (i0 < 0 || i1 < 0) {\n complete = false\n const inside = i0 >= 0 || i1 >= 0 ? partialSide(i0, i1) : undefined\n if (inside) {\n ;({ lo, hi, backward, axisStart, stop } = inside)\n }\n } else {\n lo = Math.min(i0, i1) + 1\n hi = Math.max(i0, i1)\n backward = i0 > i1\n from = i0\n to = i1\n }\n }\n const axis: WalkAxis | undefined =\n overlaps || length === 0\n ? undefined\n : axisStart !== undefined\n ? { contig: path.contig, start: axisStart, reversed: backward }\n : from < 0\n ? { contig: path.contig, start: stepStart[0]!, reversed: false }\n : from < to\n ? { contig: path.contig, start: stepEnd(from), reversed: false }\n : { contig: path.contig, start: stepStart[from]!, reversed: true }\n\n let bp = 0\n let offReferenceBp = 0\n let gapBp = 0\n let step = 0\n let lastAt = -1\n let lastFlags = 0\n let lastRef = Number.NaN\n for (let k = lo; k < hi; k++) {\n const id = steps[backward ? hi - 1 - (k - lo) : k]!\n if (id < 0) {\n out.push(bp, -id, RUN_GAP, Number.NaN)\n lastAt = out.length - 1\n lastFlags = RUN_GAP\n lastRef = Number.NaN\n bp += -id\n gapBp += -id\n step = 0\n continue\n }\n const len = lengthOf(id)\n const sStart = spanStart[id]!\n const onRef = !Number.isNaN(sStart)\n const at = lastRef\n const hasAt = lastAt >= 0 && !Number.isNaN(at)\n const forward =\n onRef && hasAt && step >= 0 && at + (out.bp[lastAt] ?? 0) === sStart\n const back = onRef && hasAt && step <= 0 && spanEnd[id] === at\n if (\n !onRef &&\n lastAt >= 0 &&\n !(lastFlags & RUN_ON_REFERENCE) &&\n !(lastFlags & RUN_GAP)\n ) {\n out.bp[lastAt]! += len\n } else if (forward || back) {\n out.bp[lastAt]! += len\n if (!forward) {\n lastRef = sStart\n out.referenceStart[lastAt] = sStart\n lastFlags |= RUN_REVERSED\n out.flags[lastAt] = lastFlags\n }\n step = forward ? 1 : -1\n } else {\n lastFlags = onRef ? RUN_ON_REFERENCE : 0\n lastRef = onRef ? sStart : Number.NaN\n out.push(bp, len, lastFlags, lastRef)\n lastAt = out.length - 1\n step = 0\n }\n bp += len\n if (!onRef) {\n offReferenceBp += len\n }\n }\n out.endRow()\n return {\n name: path.name,\n label:\n path.haplotype === undefined\n ? path.sample\n : `${path.sample}#${path.haplotype}`,\n sample: path.sample,\n haplotype: path.haplotype,\n bp,\n offReferenceBp,\n gapBp,\n complete,\n ...(stop ? { stop } : {}),\n axis,\n }\n }\n\n const reference = rowOf(referencePieces)\n const rowList = [...walks.values()].map(pieces => ({\n meta: rowOf(pieces),\n row: out.offsets.length - 2,\n }))\n rowList.sort(\n (a, b) =>\n Number(b.meta.complete) - Number(a.meta.complete) ||\n b.meta.bp - a.meta.bp ||\n a.meta.label.localeCompare(b.meta.label),\n )\n // rows in drawn order: the reference, then the sorted walks\n const order = [0, ...rowList.map(r => r.row)]\n const total = out.length\n const offsets = new Uint32Array(order.length + 1)\n const start = new Float64Array(total)\n const bpOut = new Float64Array(total)\n const referenceStart = new Float64Array(total)\n const flags = new Uint8Array(total)\n let at = 0\n order.forEach((row, i) => {\n const a = out.offsets[row]!\n const b = out.offsets[row + 1]!\n for (let k = a; k < b; k++, at++) {\n start[at] = out.start[k]!\n bpOut[at] = out.bp[k]!\n referenceStart[at] = out.referenceStart[k]!\n flags[at] = out.flags[k]!\n }\n offsets[i + 1] = at\n })\n return {\n origin: cut ? cut.start : first.start,\n rows: [reference, ...rowList.map(r => r.meta)],\n offsets,\n start,\n bp: bpOut,\n referenceStart,\n flags,\n }\n}\n\nfunction runAt(t: WalkRowRuns, k: number): WalkRun {\n const f = t.flags[k]!\n const run: WalkRun = {\n start: t.start[k]!,\n bp: t.bp[k]!,\n onReference: (f & RUN_ON_REFERENCE) !== 0,\n }\n if (f & RUN_GAP) {\n run.gap = true\n } else {\n run.referenceStart = Number.isNaN(t.referenceStart[k]!)\n ? undefined\n : t.referenceStart[k]\n }\n if (f & RUN_REVERSED) {\n run.reversed = true\n }\n return run\n}\n\n/** The rows as bandage-core's `WalkRows`, a run object per run */\nexport function walkRowsOf(t: WalkRowRuns, unit?: number): WalkRows {\n const rows = t.rows.map((meta, i) => {\n const runs: WalkRun[] = []\n for (let k = t.offsets[i]!; k < t.offsets[i + 1]!; k++) {\n runs.push(runAt(t, k))\n }\n return { ...meta, runs }\n })\n return { origin: t.origin, unit, reference: rows[0]!, rows: rows.slice(1) }\n}\n"],
|
|
5
|
-
"mappings": "yDAeA,IAAMA,EAAmB,EACnBC,GAAe,EACfC,EAAU,EAUT,SAASC,GACdC,EACAC,EACAC,EACS,CACT,OAAOA,EACH,CAAE,GAAGF,EAAQ,YAAaG,GAAYH,EAAQC,CAAM,CAAE,EACtDD,CACN,CAqBO,SAASI,GAASC,EAAc,CACrC,IAAMC,EAASC,GAAYF,CAAI,EACzBG,EAAYC,GAAeJ,CAAI,EACrC,MAAO,CACL,KAAAA,EACA,OAAAC,EACA,UACEE,IAAc,OAAY,OAAY,CAACA,EAAU,MAAMF,EAAO,OAAS,CAAC,EAC1E,OAAQI,GAAYL,CAAI,CAC1B,CACF,CAQA,IAAMM,EAAN,KAAgB,CAAhB,cACE,WAAkB,CAAC,EACnB,QAAe,CAAC,EAChB,oBAA2B,CAAC,EAC5B,WAAkB,CAAC,EACnB,aAAU,CAAC,CAAC,EAEZ,IAAI,QAAS,CACX,OAAO,KAAK,GAAG,MACjB,CAEA,KAAKC,EAAeC,EAAYC,EAAeC,EAAwB,CACrE,KAAK,MAAM,KAAKH,CAAK,EACrB,KAAK,GAAG,KAAKC,CAAE,EACf,KAAK,MAAM,KAAKC,CAAK,EACrB,KAAK,eAAe,KAAKC,CAAc,CACzC,CAEA,QAAS,CACP,KAAK,QAAQ,KAAK,KAAK,GAAG,MAAM,CAClC,CACF,
|
|
4
|
+
"sourcesContent": ["import {\n panSNContig,\n panSNHaplotype,\n panSNSample,\n} from '@jbrowse/bandage-core/pansn'\n\nimport type { GraphTables } from '@jbrowse/bandage-core/gfa/graphTables'\nimport type {\n WalkAxis,\n WalkRow,\n WalkRows,\n WalkRun,\n WalkStop,\n} from '@jbrowse/bandage-core/layout/walkRows'\n\nconst RUN_ON_REFERENCE = 1\nconst RUN_REVERSED = 2\nconst RUN_GAP = 4\n\ntype WalkRowMeta = Omit<WalkRow, 'runs'>\n\n/**\n * A cut for walk rows: the tables, and the rows' runs over the window, which\n * the main thread draws without a Graph of the walks' steps\n */\nexport type WalkCut = GraphTables & { walkRowRuns?: WalkRowRuns }\n\nexport function walkCutFor(\n tables: GraphTables,\n region: { start: number; end: number },\n walkRows: boolean | undefined,\n): WalkCut {\n return walkRows\n ? { ...tables, walkRowRuns: walkRowRuns(tables, region) }\n : tables\n}\n\n/**\n * bandage-core's `walkRows` over a cut's tables, each row's runs as typed\n * arrays that cross from the worker beside the tables. Row 0 is the\n * reference.\n */\nexport interface WalkRowRuns {\n origin: number\n rows: WalkRowMeta[]\n offsets: Uint32Array\n start: Float64Array\n bp: Float64Array\n referenceStart: Float64Array\n flags: Uint8Array\n}\n\n/**\n * A walk's PanSN fields: `HG002#1#chr1`, or a pggb P-line's `chm13#chr1`,\n * which has no haplotype\n */\nexport function walkPath(name: string) {\n const sample = panSNSample(name)\n const haplotype = panSNHaplotype(name)\n return {\n name,\n sample,\n haplotype:\n haplotype === undefined ? undefined : +haplotype.slice(sample.length + 1),\n contig: panSNContig(name),\n }\n}\n\ntype Path = ReturnType<typeof walkPath> & {\n start: number\n from: number\n to: number\n}\n\nclass RunWriter {\n start: number[] = []\n bp: number[] = []\n referenceStart: number[] = []\n flags: number[] = []\n offsets = [0]\n\n get length() {\n return this.bp.length\n }\n\n push(start: number, bp: number, flags: number, referenceStart: number) {\n this.start.push(start)\n this.bp.push(bp)\n this.flags.push(flags)\n this.referenceStart.push(referenceStart)\n }\n\n endRow() {\n this.offsets.push(this.bp.length)\n }\n}\n\n/**\n * `walkRows(graphFromTables(tables), region)` for a cut whose first walk is\n * the reference, which every walk-file and GBZ cut is, in as many pieces as\n * the cut breaks it into; a step is a node index. A gap between two pieces of\n * one haplotype is a step of `-bp`. One difference: a walk reaching only one\n * of the region's flanks measures from that flank, where walkRows takes the\n * whole walk the cut holds, so its length is a lower bound that no longer\n * grows with the cut's context.\n */\nexport function walkRowRuns(\n { nodes: n, walks: w }: GraphTables,\n region?: { start: number; end: number },\n): WalkRowRuns | undefined {\n const declared = n.lengths.length\n const lengthOf = (node: number) => (node < declared ? n.lengths[node]! : 0)\n const paths: Path[] = []\n for (let p = 0; p < w.names.length; p++) {\n if (w.offsets[p + 1]! > w.offsets[p]!) {\n paths.push({\n ...walkPath(w.names[p]!),\n start: w.starts[p]!,\n from: w.offsets[p]!,\n to: w.offsets[p + 1]!,\n })\n }\n }\n const referencePieces = paths\n .filter(p => p.name === paths[0]?.name)\n .sort((a, b) => a.start - b.start)\n const first = referencePieces[0]\n const others = paths.filter(p => p.name !== first?.name)\n if (!first || others.length === 0) {\n return undefined\n }\n const walks = new Map<string, Path[]>()\n for (const path of others) {\n const list = walks.get(path.name)\n if (list) {\n list.push(path)\n } else {\n walks.set(path.name, [path])\n }\n }\n\n const spanStart = new Float64Array(n.names.length).fill(Number.NaN)\n const spanEnd = new Float64Array(n.names.length)\n let flankedBefore = false\n let flankedAfter = false\n const cut = region && region.end > region.start ? region : undefined\n for (const piece of referencePieces) {\n let pos = piece.start\n for (let s = piece.from; s < piece.to; s++) {\n const node = w.steps[s]!\n const len = lengthOf(node)\n if (Number.isNaN(spanStart[node]!)) {\n spanStart[node] = pos\n spanEnd[node] = pos + len\n if (cut) {\n flankedBefore ||= pos + len <= cut.start\n flankedAfter ||= pos >= cut.end\n }\n }\n pos += len\n }\n }\n const flanked = cut === undefined || (flankedBefore && flankedAfter)\n\n const out = new RunWriter()\n let steps = new Int32Array(0)\n let stepStart = new Float64Array(0)\n const rowOf = (pieces: Path[]): WalkRowMeta => {\n const path = pieces[0]!\n const ordered = [...pieces].sort((a, b) => a.start - b.start)\n // the walk's steps, each piece's gap from the last as a step of -bp\n let count = ordered.length - 1\n for (const piece of ordered) {\n count += piece.to - piece.from\n }\n if (count > steps.length) {\n steps = new Int32Array(count * 2)\n stepStart = new Float64Array(count * 2)\n }\n let length = 0\n let overlaps = false\n let end: number | undefined\n for (const piece of ordered) {\n if (end !== undefined && piece.start < end) {\n overlaps = true\n }\n if (end !== undefined && piece.start > end) {\n steps[length] = -(piece.start - end)\n stepStart[length++] = end\n }\n let pos = piece.start\n for (let s = piece.from; s < piece.to; s++) {\n const node = w.steps[s]!\n steps[length] = node\n stepStart[length++] = pos\n pos += node < declared ? n.lengths[node]! : 0\n }\n end = pos\n }\n // A walk with one flank, whose contig ends inside the window: the steps\n // past that flank, read in the reference's direction. Which side is\n // inside follows the walk's direction along the reference at the\n // flank, from the nearest other step on it.\n const partialSide = (i0: number, i1: number) => {\n const flank = i0 >= 0 ? i0 : i1\n let near = -1\n for (let d = 1; near < 0 && d < length; d++) {\n for (const j of [flank - d, flank + d]) {\n const id = j >= 0 && j < length ? steps[j]! : -1\n if (near < 0 && id >= 0 && !Number.isNaN(spanStart[id]!)) {\n near = j\n }\n }\n }\n if (near < 0) {\n return undefined\n }\n const forward =\n near > flank === spanStart[steps[near]!]! > spanStart[steps[flank]!]!\n const after = forward === (flank === i0)\n const end = after ? length - 1 : 0\n const endId = steps[end]!\n const contigEnds = endId >= 0 && !Number.isNaN(spanStart[endId]!)\n const stop: WalkStop = {\n contigEnds,\n shortBp: contigEnds\n ? Math.max(\n 0,\n cut!.start - spanEnd[endId]!,\n spanStart[endId]! - cut!.end,\n )\n : 0,\n }\n return {\n stop,\n lo: after ? flank + 1 : 0,\n hi: after ? length : flank,\n backward: !forward,\n axisStart: forward\n ? after\n ? stepEnd(flank)\n : stepStart[0]!\n : after\n ? stepEnd(length - 1)\n : stepStart[flank]!,\n }\n }\n const stepEnd = (i: number) => {\n const id = steps[i]!\n return stepStart[i]! + (id < 0 ? -id : lengthOf(id))\n }\n\n let lo = 0\n let hi = length\n let backward = false\n let complete = true\n let from = -1\n let to = -1\n let axisStart: number | undefined\n let stop: WalkStop | undefined\n if (cut && flanked) {\n let i0 = -1\n let i1 = -1\n let bestEnd = -Infinity\n let bestStart = Infinity\n for (let i = 0; i < length; i++) {\n const id = steps[i]!\n if (id >= 0 && !Number.isNaN(spanStart[id]!)) {\n if (spanEnd[id]! <= cut.start && spanEnd[id]! > bestEnd) {\n bestEnd = spanEnd[id]!\n i0 = i\n }\n if (spanStart[id]! >= cut.end && spanStart[id]! < bestStart) {\n bestStart = spanStart[id]!\n i1 = i\n }\n }\n }\n if (i0 < 0 || i1 < 0) {\n complete = false\n const inside = i0 >= 0 || i1 >= 0 ? partialSide(i0, i1) : undefined\n if (inside) {\n ;({ lo, hi, backward, axisStart, stop } = inside)\n }\n } else {\n lo = Math.min(i0, i1) + 1\n hi = Math.max(i0, i1)\n backward = i0 > i1\n from = i0\n to = i1\n }\n }\n const axis: WalkAxis | undefined =\n overlaps || length === 0\n ? undefined\n : axisStart !== undefined\n ? { contig: path.contig, start: axisStart, reversed: backward }\n : from < 0\n ? { contig: path.contig, start: stepStart[0]!, reversed: false }\n : from < to\n ? { contig: path.contig, start: stepEnd(from), reversed: false }\n : { contig: path.contig, start: stepStart[from]!, reversed: true }\n\n let bp = 0\n let offReferenceBp = 0\n let gapBp = 0\n let step = 0\n let lastAt = -1\n let lastFlags = 0\n let lastRef = Number.NaN\n for (let k = lo; k < hi; k++) {\n const id = steps[backward ? hi - 1 - (k - lo) : k]!\n if (id < 0) {\n out.push(bp, -id, RUN_GAP, Number.NaN)\n lastAt = out.length - 1\n lastFlags = RUN_GAP\n lastRef = Number.NaN\n bp += -id\n gapBp += -id\n step = 0\n continue\n }\n const len = lengthOf(id)\n const sStart = spanStart[id]!\n const onRef = !Number.isNaN(sStart)\n const at = lastRef\n const hasAt = lastAt >= 0 && !Number.isNaN(at)\n const forward =\n onRef && hasAt && step >= 0 && at + (out.bp[lastAt] ?? 0) === sStart\n const back = onRef && hasAt && step <= 0 && spanEnd[id] === at\n if (\n !onRef &&\n lastAt >= 0 &&\n !(lastFlags & RUN_ON_REFERENCE) &&\n !(lastFlags & RUN_GAP)\n ) {\n out.bp[lastAt]! += len\n } else if (forward || back) {\n out.bp[lastAt]! += len\n if (!forward) {\n lastRef = sStart\n out.referenceStart[lastAt] = sStart\n lastFlags |= RUN_REVERSED\n out.flags[lastAt] = lastFlags\n }\n step = forward ? 1 : -1\n } else {\n lastFlags = onRef ? RUN_ON_REFERENCE : 0\n lastRef = onRef ? sStart : Number.NaN\n out.push(bp, len, lastFlags, lastRef)\n lastAt = out.length - 1\n step = 0\n }\n bp += len\n if (!onRef) {\n offReferenceBp += len\n }\n }\n out.endRow()\n return {\n name: path.name,\n label:\n path.haplotype === undefined\n ? path.sample\n : `${path.sample}#${path.haplotype}`,\n sample: path.sample,\n haplotype: path.haplotype,\n bp,\n offReferenceBp,\n gapBp,\n complete,\n ...(stop ? { stop } : {}),\n axis,\n }\n }\n\n const reference = rowOf(referencePieces)\n const rowList = [...walks.values()].map(pieces => ({\n meta: rowOf(pieces),\n row: out.offsets.length - 2,\n }))\n rowList.sort(\n (a, b) =>\n Number(b.meta.complete) - Number(a.meta.complete) ||\n b.meta.bp - a.meta.bp ||\n a.meta.label.localeCompare(b.meta.label),\n )\n // rows in drawn order: the reference, then the sorted walks\n const order = [0, ...rowList.map(r => r.row)]\n const total = out.length\n const offsets = new Uint32Array(order.length + 1)\n const start = new Float64Array(total)\n const bpOut = new Float64Array(total)\n const referenceStart = new Float64Array(total)\n const flags = new Uint8Array(total)\n let at = 0\n order.forEach((row, i) => {\n const a = out.offsets[row]!\n const b = out.offsets[row + 1]!\n for (let k = a; k < b; k++, at++) {\n start[at] = out.start[k]!\n bpOut[at] = out.bp[k]!\n referenceStart[at] = out.referenceStart[k]!\n flags[at] = out.flags[k]!\n }\n offsets[i + 1] = at\n })\n return {\n origin: cut ? cut.start : first.start,\n rows: [reference, ...rowList.map(r => r.meta)],\n offsets,\n start,\n bp: bpOut,\n referenceStart,\n flags,\n }\n}\n\nfunction runAt(t: WalkRowRuns, k: number): WalkRun {\n const f = t.flags[k]!\n const run: WalkRun = {\n start: t.start[k]!,\n bp: t.bp[k]!,\n onReference: (f & RUN_ON_REFERENCE) !== 0,\n }\n if (f & RUN_GAP) {\n run.gap = true\n } else {\n run.referenceStart = Number.isNaN(t.referenceStart[k]!)\n ? undefined\n : t.referenceStart[k]\n }\n if (f & RUN_REVERSED) {\n run.reversed = true\n }\n return run\n}\n\n/** The rows as bandage-core's `WalkRows`, a run object per run */\nexport function walkRowsOf(t: WalkRowRuns, unit?: number): WalkRows {\n const rows = t.rows.map((meta, i) => {\n const runs: WalkRun[] = []\n for (let k = t.offsets[i]!; k < t.offsets[i + 1]!; k++) {\n runs.push(runAt(t, k))\n }\n return { ...meta, runs }\n })\n return { origin: t.origin, unit, reference: rows[0]!, rows: rows.slice(1) }\n}\n"],
|
|
5
|
+
"mappings": "yDAeA,IAAMA,EAAmB,EACnBC,GAAe,EACfC,EAAU,EAUT,SAASC,GACdC,EACAC,EACAC,EACS,CACT,OAAOA,EACH,CAAE,GAAGF,EAAQ,YAAaG,GAAYH,EAAQC,CAAM,CAAE,EACtDD,CACN,CAqBO,SAASI,GAASC,EAAc,CACrC,IAAMC,EAASC,GAAYF,CAAI,EACzBG,EAAYC,GAAeJ,CAAI,EACrC,MAAO,CACL,KAAAA,EACA,OAAAC,EACA,UACEE,IAAc,OAAY,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AWH,EAAgBI,EAAyB,CAClE,IAAMC,EAAOL,EAAE,KAAK,IAAI,CAACM,EAAMxC,IAAM,CACnC,IAAMyC,EAAkB,CAAC,EACzB,QAAStB,EAAIe,EAAE,QAAQlC,CAAC,EAAImB,EAAIe,EAAE,QAAQlC,EAAI,CAAC,EAAImB,IACjDsB,EAAK,KAAKR,GAAMC,EAAGf,CAAC,CAAC,EAEvB,MAAO,CAAE,GAAGqB,EAAM,KAAAC,CAAK,CACzB,CAAC,EACD,MAAO,CAAE,OAAQP,EAAE,OAAQ,KAAAI,EAAM,UAAWC,EAAK,CAAC,EAAI,KAAMA,EAAK,MAAM,CAAC,CAAE,CAC5E",
|
|
6
6
|
"names": ["RUN_ON_REFERENCE", "RUN_REVERSED", "RUN_GAP", "walkCutFor", "tables", "region", "walkRows", "walkRowRuns", "walkPath", "name", "sample", "panSNSample", "haplotype", "panSNHaplotype", "panSNContig", "RunWriter", "start", "bp", "flags", "referenceStart", "n", "w", "declared", "lengthOf", "node", "paths", "p", "referencePieces", "a", "b", "first", "others", "walks", "path", "list", "spanStart", "spanEnd", "flankedBefore", "flankedAfter", "cut", "piece", "pos", "s", "len", "flanked", "out", "steps", "stepStart", "rowOf", "pieces", "ordered", "count", "length", "overlaps", "end", "partialSide", "i0", "i1", "flank", "near", "d", "id", "forward", "after", "endId", "contigEnds", "stepEnd", "i", "lo", "hi", "backward", "complete", "from", "to", "axisStart", "stop", "bestEnd", "bestStart", "inside", "axis", "offReferenceBp", "gapBp", "step", "lastAt", "lastFlags", "lastRef", "k", "sStart", "onRef", "at", "hasAt", "back", "reference", "rowList", "order", "r", "total", "offsets", "bpOut", "row", "runAt", "t", "f", "run", "walkRowsOf", "unit", "rows", "meta", "runs"]
|
|
7
7
|
}
|