jbrowse-plugin-graphgenomeviewer 7.1.9 → 7.1.11
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-2MA3I6BM.js +2 -0
- package/dist/chunks/GbzBaseSyntenyAdapter-2MA3I6BM.js.map +7 -0
- package/dist/chunks/GraphGenomeView-4O5F5I37.js +10 -0
- package/dist/chunks/{GraphGenomeView-Q2IW7AND.js.map → GraphGenomeView-4O5F5I37.js.map} +1 -1
- package/dist/chunks/{GraphTrackSettingsDialog-5UX65OSM.js → GraphTrackSettingsDialog-WZEJAF7F.js} +2 -2
- package/dist/chunks/{HighlightColorDialog-A3E5WHXH.js → HighlightColorDialog-SRT2FPXP.js} +2 -2
- package/dist/chunks/LinearGraphDisplay-Z33PVCJL.js +2 -0
- package/dist/chunks/{LinearGraphDisplay-JXPE3DGS.js.map → LinearGraphDisplay-Z33PVCJL.js.map} +3 -3
- package/dist/chunks/{MinigraphBubbleAdapter-BK35LCJR.js → MinigraphBubbleAdapter-HDLUZ6YF.js} +2 -2
- package/dist/chunks/RgfaTabixAdapter-XZRTWQMZ.js +3 -0
- package/dist/chunks/{RgfaTabixAdapter-ODT4JA6Y.js.map → RgfaTabixAdapter-XZRTWQMZ.js.map} +1 -1
- package/dist/chunks/{TrackWarningsDialog-TRYBOIHX.js → TrackWarningsDialog-CPAYIP6K.js} +1 -1
- package/dist/chunks/{TrackWarningsDialog-TRYBOIHX.js.map → TrackWarningsDialog-CPAYIP6K.js.map} +1 -1
- package/dist/chunks/WalkTabixSyntenyAdapter-AIC3W7FL.js +2 -0
- package/dist/chunks/{WalkTabixSyntenyAdapter-A5OPAELK.js.map → WalkTabixSyntenyAdapter-AIC3W7FL.js.map} +1 -1
- package/dist/chunks/chunk-44HZPYGC.js +2 -0
- package/dist/chunks/{chunk-RBQDYK3S.js.map → chunk-44HZPYGC.js.map} +2 -2
- package/dist/chunks/{chunk-A7DB4V4C.js → chunk-6WA6WF6A.js} +1 -1
- package/dist/chunks/{chunk-A7DB4V4C.js.map → chunk-6WA6WF6A.js.map} +1 -1
- package/dist/chunks/chunk-BWP3XYKD.js +2 -0
- package/dist/chunks/chunk-BWP3XYKD.js.map +7 -0
- package/dist/chunks/{chunk-IPMAQCYX.js → chunk-CWNJR5XB.js} +1 -1
- package/dist/chunks/{chunk-IPMAQCYX.js.map → chunk-CWNJR5XB.js.map} +2 -2
- package/dist/chunks/chunk-EDSIYH4H.js +2 -0
- package/dist/chunks/chunk-EDSIYH4H.js.map +7 -0
- package/dist/chunks/{chunk-3CIJSKCN.js → chunk-FME624X3.js} +2 -2
- package/dist/chunks/{chunk-3CIJSKCN.js.map → chunk-FME624X3.js.map} +1 -1
- package/dist/chunks/chunk-GUXZESDR.js +2 -0
- package/dist/chunks/chunk-GUXZESDR.js.map +7 -0
- package/dist/chunks/{chunk-RROZDQ35.js → chunk-HLKZCTQ3.js} +2 -2
- package/dist/chunks/{chunk-RROZDQ35.js.map → chunk-HLKZCTQ3.js.map} +1 -1
- package/dist/chunks/chunk-III4GT4G.js +2 -0
- package/dist/chunks/chunk-III4GT4G.js.map +7 -0
- package/dist/chunks/chunk-N4WBX2OS.js +4 -0
- package/dist/chunks/chunk-N4WBX2OS.js.map +7 -0
- package/dist/chunks/chunk-N5GYTUIL.js +3 -0
- package/dist/chunks/chunk-N5GYTUIL.js.map +7 -0
- package/dist/chunks/chunk-O7Y7LYN6.js +2 -0
- package/dist/chunks/chunk-O7Y7LYN6.js.map +7 -0
- package/dist/chunks/chunk-OBQFV4NL.js +9 -0
- package/dist/chunks/{chunk-IT7HZNZO.js.map → chunk-OBQFV4NL.js.map} +4 -4
- package/dist/chunks/chunk-PA4HKAUJ.js +2 -0
- package/dist/chunks/chunk-PA4HKAUJ.js.map +7 -0
- package/dist/chunks/chunk-PFAHNHMM.js +2 -0
- package/dist/chunks/chunk-PFAHNHMM.js.map +7 -0
- package/dist/chunks/{chunk-E7J6SB5P.js → chunk-T4R3ZVEM.js} +1 -1
- package/dist/chunks/{chunk-E7J6SB5P.js.map → chunk-T4R3ZVEM.js.map} +1 -1
- package/dist/chunks/{chunk-KVIIZV7R.js → chunk-U4U5ZOCH.js} +2 -2
- package/dist/chunks/{chunk-KVIIZV7R.js.map → chunk-U4U5ZOCH.js.map} +1 -1
- package/dist/chunks/chunk-UFQTIWSN.js +4 -0
- package/dist/chunks/chunk-UFQTIWSN.js.map +7 -0
- package/dist/chunks/chunk-VDHDEEMF.js +2 -0
- package/dist/chunks/chunk-VDHDEEMF.js.map +7 -0
- package/dist/chunks/chunk-WGVATZLM.js +3 -0
- package/dist/chunks/chunk-WGVATZLM.js.map +7 -0
- package/dist/chunks/{chunk-QZTHUDL4.js → chunk-ZNT7TQLN.js} +2 -2
- package/dist/chunks/{executeDiagonalize-JKESYBXN.js → executeDiagonalize-SGJDSTYC.js} +2 -2
- package/dist/chunks/{executeDiagonalize-JKESYBXN.js.map → executeDiagonalize-SGJDSTYC.js.map} +1 -1
- package/dist/chunks/renderSvg-RRWCAEGF.js +2 -0
- package/dist/chunks/{renderSvg-GK2MSYWH.js.map → renderSvg-RRWCAEGF.js.map} +1 -1
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +4 -4
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +11 -11
- package/src/GraphGenomeView/components/WalkRowsOverlay.tsx +4 -11
- package/src/GraphGenomeView/legendSections.ts +2 -3
- package/src/GraphGenomeView/walkRowSpans.ts +16 -3
- package/src/LinearGraphDisplay/components/GraphStatusChrome.test.tsx +82 -1
- package/src/LinearGraphDisplay/components/GraphStatusChrome.tsx +63 -5
- package/src/RgfaTabixAdapter/configSchema.ts +3 -3
- package/src/RgfaTabixAdapter/test_data/walks3_follow.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_follow.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_header.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_header.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_maxnode.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_maxnode.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_rejoin.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks3_rejoin.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/{walks2_twopart.GRCh38.walks.bed.gz → walks3_twopart.GRCh38.walks.bed.gz} +0 -0
- package/src/RgfaTabixAdapter/walkFiles.test.ts +10 -10
- package/src/RgfaTabixAdapter/walkRowRuns.test.ts +38 -0
- package/src/RgfaTabixAdapter/walkRowRuns.ts +76 -5
- package/src/WalkTabixSyntenyAdapter/WalkTabixSyntenyAdapter.test.ts +5 -2
- package/src/WalkTabixSyntenyAdapter/configSchema.ts +2 -2
- package/src/WalkTabixSyntenyAdapter/gbzParity.test.ts +2 -2
- package/src/panSNAliases/panSNAliases.test.ts +2 -2
- package/src/version.ts +1 -1
- package/dist/chunks/GbzBaseSyntenyAdapter-J55EZLSA.js +0 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-J55EZLSA.js.map +0 -7
- package/dist/chunks/GraphGenomeView-Q2IW7AND.js +0 -10
- package/dist/chunks/LinearGraphDisplay-JXPE3DGS.js +0 -2
- package/dist/chunks/RgfaTabixAdapter-ODT4JA6Y.js +0 -3
- package/dist/chunks/WalkTabixSyntenyAdapter-A5OPAELK.js +0 -2
- package/dist/chunks/chunk-37IAMKOU.js +0 -3
- package/dist/chunks/chunk-37IAMKOU.js.map +0 -7
- package/dist/chunks/chunk-4OUZ2RST.js +0 -3
- package/dist/chunks/chunk-4OUZ2RST.js.map +0 -7
- package/dist/chunks/chunk-HAEBQS53.js +0 -4
- package/dist/chunks/chunk-HAEBQS53.js.map +0 -7
- package/dist/chunks/chunk-HVBY3TGB.js +0 -2
- package/dist/chunks/chunk-HVBY3TGB.js.map +0 -7
- package/dist/chunks/chunk-HYKQBZA4.js +0 -2
- package/dist/chunks/chunk-HYKQBZA4.js.map +0 -7
- package/dist/chunks/chunk-IT7HZNZO.js +0 -9
- package/dist/chunks/chunk-JOPQA7GP.js +0 -2
- package/dist/chunks/chunk-JOPQA7GP.js.map +0 -7
- package/dist/chunks/chunk-KM3QNC77.js +0 -2
- package/dist/chunks/chunk-KM3QNC77.js.map +0 -7
- package/dist/chunks/chunk-RBQDYK3S.js +0 -2
- package/dist/chunks/chunk-TFPHVH5H.js +0 -2
- package/dist/chunks/chunk-TFPHVH5H.js.map +0 -7
- package/dist/chunks/chunk-TVFR5KBQ.js +0 -4
- package/dist/chunks/chunk-TVFR5KBQ.js.map +0 -7
- package/dist/chunks/chunk-X7LTMIYL.js +0 -2
- package/dist/chunks/chunk-X7LTMIYL.js.map +0 -7
- package/dist/chunks/chunk-Y7UUDKJL.js +0 -2
- package/dist/chunks/chunk-Y7UUDKJL.js.map +0 -7
- package/dist/chunks/renderSvg-GK2MSYWH.js +0 -2
- package/src/RgfaTabixAdapter/test_data/walks2_follow.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_follow.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_header.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_header.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_maxnode.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_maxnode.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_rejoin.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_rejoin.GRCh38.walks.bed.gz.tbi +0 -0
- /package/dist/chunks/{GraphTrackSettingsDialog-5UX65OSM.js.map → GraphTrackSettingsDialog-WZEJAF7F.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-A3E5WHXH.js.map → HighlightColorDialog-SRT2FPXP.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-BK35LCJR.js.map → MinigraphBubbleAdapter-HDLUZ6YF.js.map} +0 -0
- /package/dist/chunks/{chunk-QZTHUDL4.js.map → chunk-ZNT7TQLN.js.map} +0 -0
- /package/src/RgfaTabixAdapter/test_data/{walks2_twopart.GRCh38.walks.bed.gz.tbi → walks3_twopart.GRCh38.walks.bed.gz.tbi} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as ae,b as re,c as de,d as oe,e as ie,f as H,g as se}from"./chunk-U4U5ZOCH.js";import{a as te}from"./chunk-KOB7YIMR.js";import{a as j,b as W,c as Z,d as u,e as M,f as $,g as U,h as k,i as z,k as X}from"./chunk-OBQFV4NL.js";import"./chunk-O7Y7LYN6.js";import{b as E,c as O}from"./chunk-N4WBX2OS.js";import"./chunk-BWP3XYKD.js";import"./chunk-T4HOC6O3.js";import{a as ne}from"./chunk-PFAHNHMM.js";import"./chunk-VDHDEEMF.js";import{a as V,c as L,m as ee}from"./chunk-EDSIYH4H.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import{g as F,h as P,i as C}from"./chunk-GUXZESDR.js";import"./chunk-T4R3ZVEM.js";import{d as G,g as Y,h as J,i as K}from"./chunk-IKJZPPOA.js";import"./chunk-7WIBGKBU.js";import{a as N}from"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{e as D,o as I}from"./chunk-TENPGIPX.js";function A(n){let i=/\.gbz\.db$/i;return i.test(n)?n.replace(i,".haplotype-index.db"):void 0}function he(n){return J(n)&&A(Y(n))?K(n,i=>A(i)):void 0}function ue(n){return n instanceof Error&&(/\bHTTP 40[34]\b/.test(n.message)||n.code==="ENOENT")}async function ce(n,i){let t=he(n);if(!t)return{};try{return await N(t,i).stat(),{location:t}}catch(e){return ue(e)?{}:{unreadable:String(e)}}}var ge=5e3,ye=50*2**20,q=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,i){if(n.length<=i)return n;let t=n.length/i;return Array.from({length:i},(e,a)=>n[Math.floor(a*t)])}var pe=(n,i)=>n.path.some(t=>i.has(t.name)),v=class{constructor(i,t){this.file=i;this.tabix=t;this.whole=L({setup:async({signal:i})=>{let{size:t}=await this.file.stat();if(t>ye)throw new q(t);let e=await this.file.readFile({signal:i}),a=new TextDecoder().decode(e[0]===31&&e[1]===139?await V(e):e);return O(a)}})}async readIndexed(i,t,e){let a=1/0,r=-1/0;for(let s of t){let c=Number(s);Number.isInteger(c)&&(a=Math.min(a,c),r=Math.max(r,c))}let o=[];return a<=r&&await i.getLines("{node}",a,r+1,{signal:e,lineCallback:s=>{let c=E(s);c&&pe(c,t)&&o.push(c)}}),o}async readsOver(i,{signal:t}={}){let e=this.tabix?await this.readIndexed(this.tabix,i,t):(await this.whole({signal:t})).filter(a=>pe(a,i));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"}},_=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,i){return`${u(n)}#${n.contig}@${i.start.node}.${i.start.offset}`}function xe({alignment:n,assemblyName:i,refName:t,lane:e}){let{refStart:a,refEnd:r,strand:o,cigar:s}=n;if(!(r<=a)){let{name:c,hapStart:p,hapEnd:l}=n,d=we(c,n),g={uniqueId:d,assemblyName:i,refName:t,start:a,end:r,type:"match",strand:o==="-"?-1:1,CIGAR:s,syntenyId:d,mate:{refName:c.contig,start:p,end:l,assemblyName:e}};return new ae(g)}}function Se({pair:n,lane:i,mateLane:t}){return se({target:{name:`${u(n.target)}#${n.target.contig}`,assemblyName:i,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,i){let t=new Map;for(let a of n)for(let{name:r,start:o,end:s}of a.walkSpans()){let c=u(r);if(i.has(c)){let p=`${c}#${r.contig}`,l=t.get(p);l?l.push([o,s]):t.set(p,[[o,s]])}}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 T(n,i){return n instanceof Z&&(n.message=`Zoom in to about ${D(n.fitsBp)} to see ${i}`),n}var le=n=>({...n,start:Math.floor(n.start),end:Math.ceil(n.end)}),Q=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 W.open({source:N(t,this.pluginManager),haplotypeIndex:r?N(r,this.pluginManager):void 0}),s=this.getConf("assemblyNames")[0];if(s===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=U({configured:this.getConf("referenceSample"),anchorPrefix:P(this,s),referenceSamples:c});return{db:o,anchor:s,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 k(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 s=u(o.name),c=r.get(s);c?c.contigs.includes(o.name.contig)||c.contigs.push(o.name.contig):r.set(s,{prefix:s,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 s of await this.getHaplotypes(t))s.sample!==a&&o.push({name:H(r,s.prefix),label:s.prefix,group:s.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,s=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),s)).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:s,unreadableIndex:c}=await this.graph({signal:a}),{assemblyName:p,refName:l,start:d,end:g}=le(t);if(p!==o)throw new _(p,o);let y=await this.referenceQuery(l,{signal:a});if(!y)throw new Error(`${s} 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 T(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:s,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}:${s.toLocaleString()}-${c.toLocaleString()}`,e.statusCallback,()=>a.getAlignments({path:g,start:s,end:c,context:this.getConf("context"),haplotypes:"all",limit:y,signal:e.signal,keep:d}).catch(f=>{throw T(z(f,y,c-s)??f,"lanes")})):[]).flatMap(f=>{let x=f.resolved?xe({alignment:f,assemblyName:r,refName:o,lane:H(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:s,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:s,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 T(z(b,y,c-s)??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 j)return h;throw b}):h};return(g&&l.length>0?await I(ie(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:s,unreadableIndex:c}=await this.graph(e);if(!o.hasHaplotypeIndex)throw new B(c);if(a.assemblyName===s){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,Q as default,Ne as widestWalkGap};
|
|
2
|
+
//# sourceMappingURL=GbzBaseSyntenyAdapter-2MA3I6BM.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@11.0.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-TUQKGAK3.js", "../../src/GbzBaseSyntenyAdapter/companion.ts", "../../src/gaf/gafFile.ts", "../../src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n GBZ_CUT_DEFAULTS,\n NoReferenceSampleError,\n aliasedSample,\n cutWindowGFA,\n haplotypeWanted,\n referencePathQuery,\n referenceSamplesOf\n} from \"./chunk-NMWQUFPF.js\";\nimport {\n panSNSample\n} from \"./chunk-4XWZNPQ2.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 gbzLocations({ db, index }) {\n return db === \"hprc\" ? { db: HPRC_GBZ.db, index: index ?? HPRC_GBZ.index } : { db, index };\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 if (ref) {\n return aliasedSample(panSNSample(ref), samples) ?? ref;\n }\n const first = samples[0];\n if (first === void 0) {\n throw new NoReferenceSampleError(\"\", samples);\n }\n return first;\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 gbzLocations,\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
|
+
"mappings": "6zBAsBA,SAASA,EAAqBC,EAAI,CAChC,IAAMC,EAAS,cACf,OAAOA,EAAO,KAAKD,CAAE,EAAIA,EAAG,QAAQC,EAAQ,qBAAqB,EAAI,MACvE,CCjBO,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,GAAI,CAACU,EACH,MAAO,CAAC,EAEV,GAAI,CACF,aAAMC,EAAaD,EAAWD,CAAa,EAAE,KAAK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B4C,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
|
+
"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"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{a as C}from"./chunk-44HZPYGC.js";import"./chunk-FME624X3.js";import"./chunk-UFQTIWSN.js";import"./chunk-N5GYTUIL.js";import{n as d}from"./chunk-HLKZCTQ3.js";import"./chunk-WGVATZLM.js";import"./chunk-III4GT4G.js";import"./chunk-CWNJR5XB.js";import"./chunk-PA4HKAUJ.js";import"./chunk-6WA6WF6A.js";import"./chunk-O7Y7LYN6.js";import"./chunk-N4WBX2OS.js";import"./chunk-BWP3XYKD.js";import"./chunk-PFAHNHMM.js";import"./chunk-VDHDEEMF.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-GUXZESDR.js";import"./chunk-IKJZPPOA.js";import"./chunk-NDRLCGPC.js";import"./chunk-TENPGIPX.js";import{h as L}from"./chunk-YU7T5WOQ.js";import{A as l,F as G,H as p,e as s,j as v,o as n,x as y}from"./chunk-UGCNPRKC.js";import{a as h,b as e,c as r,d as i}from"./chunk-JMBDTNUR.js";var N=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}}),S=i(function({model:a}){let{classes:t}=N();return!a.error&&!a.loadCanceled?r(l,{className:t.paper,"data-testid":"graph-genome-loading",children:[r("div",{className:t.row,children:[e(v,{variant:"h6",message:a.statusMessage||void 0}),a.canCancelLoad?e(n,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{a.cancelLoad()},children:"Cancel"}):null]}),e(y,{variant:"indeterminate"})]}):a.error?e(l,{className:t.paper,children:e(s,{error:a.error,onReset:()=>{a.retryLoad()}})}):e(l,{className:t.paper,"data-testid":"graph-genome-load-canceled",children:r("div",{className:t.row,children:[e(p,{variant:"h6",children:"Loading canceled"}),e(n,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{a.retryLoad()},children:"Retry"})]})})}),f=S;var T=`H VN:Z:1.0
|
|
2
|
+
S 1 ACGT
|
|
3
|
+
S 2 GGCC
|
|
4
|
+
S 3 TTAA
|
|
5
|
+
S 4 CCGG
|
|
6
|
+
L 1 + 2 + 0M
|
|
7
|
+
L 1 + 3 + 0M
|
|
8
|
+
L 2 + 4 + 0M
|
|
9
|
+
L 3 + 4 + 0M`,E=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"}}),F=i(function({model:a}){let{classes:t}=E(),[m,w]=L("");function u(){let o=m.trim();o&&a.openGfaLocation({uri:o,locationType:"UriLocation"})}function M(o){let c=o.target.files?.[0];o.target.value="",c&&a.loadGFAFile(c,c.name)}return r(l,{className:t.paper,children:[e("div",{className:t.header,children:e(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",e("input",{type:"file",accept:".gfa,.gfa1,.gfa2,.gz",hidden:!0,onChange:o=>{M(o)}})]}),e(p,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),r("div",{className:t.rowEnd,children:[e(G,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:m,onChange:o=>{w(o.target.value)},onKeyDown:o=>{o.key==="Enter"&&u()},className:t.flex1}),e(n,{variant:"contained",onClick:()=>{u()},disabled:!m.trim(),children:"Open"})]})]}),e("div",{className:t.footer,children:e(n,{size:"small",onClick:()=>{a.loadGFA(T,"Example graph")},children:"Load 4-node example"})}),a.error?e(s,{error:a.error}):null]})}),x=F;var B=i(function({model:a}){return a.hasGraph?e(C,{model:a}):a.canRetryLoad?e(f,{model:a}):r(h,{children:[a.isLoading?e(f,{model:a}):null,e("div",{hidden:a.isLoading,children:e(x,{model:a})})]})}),q=B;export{q as default};
|
|
10
|
+
//# sourceMappingURL=GraphGenomeView-4O5F5I37.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/GraphGenomeView/components/GraphLoadStatus.tsx", "../../src/GraphGenomeView/components/ImportForm.tsx", "../../src/GraphGenomeView/components/GraphGenomeView.tsx"],
|
|
4
4
|
"sourcesContent": ["import { ErrorBanner, LoadingEllipses } from '@jbrowse/core/ui'\nimport { Button, LinearProgress, Paper, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n paper: {\n padding: 16,\n margin: 8,\n maxWidth: 560,\n marginInline: 'auto',\n display: 'flex',\n flexDirection: 'column',\n gap: 12,\n },\n row: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 8,\n },\n})\n\n// What a view with no graph on screen shows while its load runs or waits on\n// its assembly, and after a load of a source it can retry was canceled or\n// failed.\nconst GraphLoadStatus = observer(function GraphLoadStatus({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n if (!model.error && !model.loadCanceled) {\n return (\n <Paper className={classes.paper} data-testid=\"graph-genome-loading\">\n <div className={classes.row}>\n <LoadingEllipses\n variant=\"h6\"\n message={model.statusMessage || undefined}\n />\n {model.canCancelLoad ? (\n <Button\n size=\"small\"\n data-testid=\"graph-genome-cancel\"\n onClick={() => {\n model.cancelLoad()\n }}\n >\n Cancel\n </Button>\n ) : null}\n </div>\n <LinearProgress variant=\"indeterminate\" />\n </Paper>\n )\n }\n if (model.error) {\n return (\n <Paper className={classes.paper}>\n <ErrorBanner\n error={model.error}\n onReset={() => {\n model.retryLoad()\n }}\n />\n </Paper>\n )\n }\n return (\n <Paper className={classes.paper} data-testid=\"graph-genome-load-canceled\">\n <div className={classes.row}>\n <Typography variant=\"h6\">Loading canceled</Typography>\n <Button\n variant=\"contained\"\n size=\"small\"\n data-testid=\"graph-genome-retry\"\n onClick={() => {\n model.retryLoad()\n }}\n >\n Retry\n </Button>\n </div>\n </Paper>\n )\n})\n\nexport default GraphLoadStatus\n", "import { useState } from 'react'\n\nimport { ErrorBanner } from '@jbrowse/core/ui'\nimport { Button, Paper, TextField, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphGenomeViewModel } from '../viewModel'\n\nconst EXAMPLE_GFA = `H\\tVN:Z:1.0\nS\\t1\\tACGT\nS\\t2\\tGGCC\nS\\t3\\tTTAA\nS\\t4\\tCCGG\nL\\t1\\t+\\t2\\t+\\t0M\nL\\t1\\t+\\t3\\t+\\t0M\nL\\t2\\t+\\t4\\t+\\t0M\nL\\t3\\t+\\t4\\t+\\t0M`\n\nconst useStyles = makeStyles()({\n column: { display: 'flex', flexDirection: 'column', gap: 8 },\n rowEnd: { display: 'flex', gap: 8, alignItems: 'flex-end' },\n rowCenter: { display: 'flex', gap: 8, alignItems: 'center' },\n flex1: { flex: 1 },\n paper: { padding: 16, margin: 8, maxWidth: 560, marginInline: 'auto' },\n header: { marginBottom: 12 },\n footer: { marginTop: 12, display: 'flex', justifyContent: 'flex-end' },\n})\n\nconst ImportForm = observer(function ImportForm({\n model,\n}: {\n model: GraphGenomeViewModel\n}) {\n const { classes } = useStyles()\n const [url, setUrl] = useState('')\n\n function handleUrlLoad() {\n const uri = url.trim()\n if (uri) {\n void model.openGfaLocation({ uri, locationType: 'UriLocation' })\n }\n }\n\n function handleFileUpload(event: React.ChangeEvent<HTMLInputElement>) {\n const file = event.target.files?.[0]\n // or picking the same file again fires no change\n event.target.value = ''\n if (file) {\n void model.loadGFAFile(file, file.name)\n }\n }\n\n return (\n <Paper className={classes.paper}>\n <div className={classes.header}>\n <Typography variant=\"h6\">Load a GFA graph</Typography>\n </div>\n\n <div className={classes.column}>\n <div className={classes.rowCenter}>\n <Button variant=\"outlined\" component=\"label\" size=\"small\">\n Choose file\n <input\n type=\"file\"\n accept=\".gfa,.gfa1,.gfa2,.gz\"\n hidden\n onChange={event => {\n handleFileUpload(event)\n }}\n />\n </Button>\n <Typography variant=\"caption\" color=\"text.secondary\">\n Whole-file GFA; best for small/medium graphs.\n </Typography>\n </div>\n\n <div className={classes.rowEnd}>\n <TextField\n size=\"small\"\n label=\"URL\"\n placeholder=\"https://example.com/graph.gfa\"\n value={url}\n onChange={e => {\n setUrl(e.target.value)\n }}\n onKeyDown={e => {\n if (e.key === 'Enter') {\n handleUrlLoad()\n }\n }}\n className={classes.flex1}\n />\n <Button\n variant=\"contained\"\n onClick={() => {\n handleUrlLoad()\n }}\n disabled={!url.trim()}\n >\n Open\n </Button>\n </div>\n </div>\n\n <div className={classes.footer}>\n <Button\n size=\"small\"\n onClick={() => {\n void model.loadGFA(EXAMPLE_GFA, 'Example graph')\n }}\n >\n Load 4-node example\n </Button>\n </div>\n\n {model.error ? <ErrorBanner error={model.error} /> : null}\n </Paper>\n )\n})\n\nexport default ImportForm\n", "import { observer } from 'mobx-react'\n\nimport GraphCanvas from './GraphCanvas'\nimport GraphLoadStatus from './GraphLoadStatus'\nimport ImportForm from './ImportForm'\n\nimport type { GraphGenomeViewModel } from '../viewModel'\n\nconst GraphGenomeView = observer(function GraphGenomeView({\n model,\n}: {\n model: GraphGenomeViewModel\n}) {\n if (model.hasGraph) {\n return <GraphCanvas model={model} />\n }\n // A launched or restored view has a source of its own, so the import form\n // has nothing to offer it, including while its assembly loads\n if (model.canRetryLoad) {\n return <GraphLoadStatus model={model} />\n }\n // Hidden rather than unmounted, so a typed URL survives a failed load\n return (\n <>\n {model.isLoading ? <GraphLoadStatus model={model} /> : null}\n <div hidden={model.isLoading}>\n <ImportForm model={model} />\n </div>\n </>\n )\n})\n\nexport default GraphGenomeView\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "2xBAOA,IAAMA,EAAYC,EAAW,EAAE,CAC7B,MAAO,CACL,QAAS,GACT,OAAQ,EACR,SAAU,IACV,aAAc,OACd,QAAS,OACT,cAAe,SACf,IAAK,EACP,EACA,IAAK,CACH,QAAS,OACT,WAAY,SACZ,eAAgB,gBAChB,IAAK,CACP,CACF,CAAC,EAKKC,EAAkBC,EAAS,SAAyB,CACxD,MAAAC,CACF,EAEG,CACD,GAAM,CAAE,QAAAC,CAAQ,EAAIL,EAAU,EAC9B,MAAI,CAACI,EAAM,OAAS,CAACA,EAAM,aAEvBE,EAACC,EAAA,CAAM,UAAWF,EAAQ,MAAO,cAAY,uBAC3C,UAAAC,EAAC,OAAI,UAAWD,EAAQ,IACtB,UAAAG,EAACC,EAAA,CACC,QAAQ,KACR,QAASL,EAAM,eAAiB,OAClC,EACCA,EAAM,cACLI,EAACE,EAAA,CACC,KAAK,QACL,cAAY,sBACZ,QAAS,IAAM,CACbN,EAAM,WAAW,CACnB,EACD,kBAED,EACE,MACN,EACAI,EAACG,EAAA,CAAe,QAAQ,gBAAgB,GAC1C,EAGAP,EAAM,MAENI,EAACD,EAAA,CAAM,UAAWF,EAAQ,MACxB,SAAAG,EAACI,EAAA,CACC,MAAOR,EAAM,MACb,QAAS,IAAM,CACbA,EAAM,UAAU,CAClB,EACF,EACF,EAIFI,EAACD,EAAA,CAAM,UAAWF,EAAQ,MAAO,cAAY,6BAC3C,SAAAC,EAAC,OAAI,UAAWD,EAAQ,IACtB,UAAAG,EAACK,EAAA,CAAW,QAAQ,KAAK,4BAAgB,EACzCL,EAACE,EAAA,CACC,QAAQ,YACR,KAAK,QACL,cAAY,qBACZ,QAAS,IAAM,CACbN,EAAM,UAAU,CAClB,E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F,EAAC,SACC,KAAK,OACL,OAAO,uBACP,OAAM,GACN,SAAUJ,GAAS,CACjBD,EAAiBC,CAAK,CACxB,EACF,GACF,EACAI,EAACC,EAAA,CAAW,QAAQ,UAAU,MAAM,iBAAiB,yDAErD,GACF,EAEAH,EAAC,OAAI,UAAWT,EAAQ,OACtB,UAAAW,EAACG,EAAA,CACC,KAAK,QACL,MAAM,MACN,YAAY,gCACZ,MAAOb,EACP,SAAUc,GAAK,CACbb,EAAOa,EAAE,OAAO,KAAK,CACvB,EACA,UAAWA,GAAK,CACVA,EAAE,MAAQ,SACZX,EAAc,CAElB,EACA,UAAWJ,EAAQ,MACrB,EACAW,EAACE,EAAA,CACC,QAAQ,YACR,QAAS,IAAM,CACbT,EAAc,CAChB,EACA,SAAU,CAACH,EAAI,KAAK,EACrB,gBAED,GACF,GACF,EAEAU,EAAC,OAAI,UAAWX,EAAQ,OACtB,SAAAW,EAACE,EAAA,CACC,KAAK,QACL,QAAS,IAAM,CACRd,EAAM,QAAQL,EAAa,eAAe,CACjD,EACD,+BAED,EACF,EAECK,EAAM,MAAQY,EAACK,EAAA,CAAY,MAAOjB,EAAM,MAAO,EAAK,MACvD,CAEJ,CAAC,EAEMkB,EAAQpB,ECjHf,IAAMqB,EAAkBC,EAAS,SAAyB,CACxD,MAAAC,CACF,EAEG,CACD,OAAIA,EAAM,SACDC,EAACC,EAAA,CAAY,MAAOF,EAAO,EAIhCA,EAAM,aACDC,EAACE,EAAA,CAAgB,MAAOH,EAAO,EAItCI,EAAAC,EAAA,CACG,UAAAL,EAAM,UAAYC,EAACE,EAAA,CAAgB,MAAOH,EAAO,EAAK,KACvDC,EAAC,OAAI,OAAQD,EAAM,UACjB,SAAAC,EAACK,EAAA,CAAW,MAAON,EAAO,EAC5B,GACF,CAEJ,CAAC,EAEMO,EAAQT",
|
|
6
6
|
"names": ["useStyles", "makeStyles", "GraphLoadStatus", "observer", "model", "classes", "jsxs", "Paper", "jsx", "LoadingEllipses", "Button", "LinearProgress", "ErrorBanner", "Typography", "GraphLoadStatus_default", "EXAMPLE_GFA", "useStyles", "makeStyles", "ImportForm", "observer", "model", "classes", "url", "setUrl", "useState", "handleUrlLoad", "uri", "handleFileUpload", "event", "file", "jsxs", "Paper", "jsx", "Typography", "Button", "TextField", "e", "ErrorBanner", "ImportForm_default", "GraphGenomeView", "observer", "model", "jsx", "GraphCanvas_default", "GraphLoadStatus_default", "jsxs", "Fragment", "ImportForm_default", "GraphGenomeView_default"]
|
|
7
7
|
}
|
package/dist/chunks/{GraphTrackSettingsDialog-5UX65OSM.js → GraphTrackSettingsDialog-WZEJAF7F.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as G,b as L}from"./chunk-
|
|
1
|
+
import{a as G,b as L}from"./chunk-FME624X3.js";import{b as v,c as x,n as d}from"./chunk-HLKZCTQ3.js";import"./chunk-CWNJR5XB.js";import"./chunk-PA4HKAUJ.js";import"./chunk-BWP3XYKD.js";import"./chunk-MVVXRZXV.js";import"./chunk-GUXZESDR.js";import"./chunk-IKJZPPOA.js";import{g,h}from"./chunk-YU7T5WOQ.js";import{F as m,H as u,n as C}from"./chunk-UGCNPRKC.js";import{b as r,c as i,d as c}from"./chunk-JMBDTNUR.js";var P=d()({section:{marginBottom:24}}),T=[{value:"0",label:"None"},{value:"1",label:"1 hop"},{value:"2",label:"2 hops"}],w=c(function({model:t}){let{classes:l}=P(),o=t.sourceAdapter;return o?.type==="RgfaTabixAdapter"&&!v(o)?i("div",{className:l.section,children:[r(G,{label:"Graph context",sx:{minWidth:200},value:String(t.subgraphContext),options:T,testId:"graph-context-select",onChange:a=>{t.setSubgraphContext(Number(a)),t.recut()}}),r(u,{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}),k=w;var F=d()({section:{marginBottom:24}});function M(n){return n.split(/[\s,]+/).filter(t=>t!=="")}var I=c(function({model:t}){let[l,o]=h(t.cutHaplotypes?.join(", ")??""),a=()=>{let e=M(l);e.join(`
|
|
2
2
|
`)===(t.cutHaplotypes??[]).join(`
|
|
3
3
|
`)||(t.setSubgraphHaplotypes(e),t.recut())};return r(m,{fullWidth:!0,label:"Haplotypes",placeholder:"every haplotype",value:l,slotProps:{htmlInput:{"data-testid":"graph-haplotypes-field"}},onChange:e=>{o(e.target.value)},onBlur:()=>{a()},onKeyDown:e=>{e.key==="Enter"&&a()}})}),A=c(function({model:t,names:l}){let[o,a]=h(t.cutHaplotypes??[]),e=g(o),f=g(""),[b,S]=h(!1),H=p=>{p.join(`
|
|
4
4
|
`)!==(t.cutHaplotypes??[]).join(`
|
|
5
5
|
`)&&(t.setSubgraphHaplotypes(p),t.recut())};return r(C,{multiple:!0,freeSolo:!0,disableCloseOnSelect:!0,options:l,value:o,open:b,onOpen:()=>{S(!0)},onInputChange:(p,s)=>{f.current=s},onClose:(p,s)=>{S(!1);let y=f.current.trim();s==="blur"&&y&&!e.current.includes(y)&&(e.current=[...e.current,y],a(e.current)),H(e.current)},onChange:(p,s)=>{e.current=s,a(s),b||H(s)},renderInput:p=>r(m,{...p,label:"Haplotypes",placeholder:o.length===0?"every haplotype":void 0,slotProps:{...p.slotProps,htmlInput:{...p.slotProps.htmlInput,"data-testid":"graph-haplotypes-field"}}})})}),D=c(function({model:t}){let{classes:l}=F(),o=t.haplotypeNames,a=t.cutHaplotypes?.join(",")??"",e=t.sourceAdapter;return e&&x(e)?i("div",{className:l.section,children:[o?r(A,{model:t,names:o},a):r(I,{model:t},a),i(u,{variant:"caption",component:"div",color:"text.secondary",children:[o?`Which of the graph's ${o.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}),N=D;function B({model:n,onClose:t}){return i(L,{model:n,onClose:t,children:[r(k,{model:n}),r(N,{model:n})]})}export{B as default};
|
|
6
|
-
//# sourceMappingURL=GraphTrackSettingsDialog-
|
|
6
|
+
//# sourceMappingURL=GraphTrackSettingsDialog-WZEJAF7F.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=HighlightColorDialog-
|
|
1
|
+
import{t as v,u as C}from"./chunk-III4GT4G.js";import"./chunk-PA4HKAUJ.js";import"./chunk-BWP3XYKD.js";import"./chunk-GUXZESDR.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-SRT2FPXP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as h}from"./chunk-44HZPYGC.js";import"./chunk-FME624X3.js";import"./chunk-UFQTIWSN.js";import"./chunk-N5GYTUIL.js";import"./chunk-HLKZCTQ3.js";import"./chunk-WGVATZLM.js";import"./chunk-III4GT4G.js";import"./chunk-CWNJR5XB.js";import"./chunk-PA4HKAUJ.js";import"./chunk-6WA6WF6A.js";import"./chunk-O7Y7LYN6.js";import"./chunk-N4WBX2OS.js";import"./chunk-BWP3XYKD.js";import"./chunk-PFAHNHMM.js";import"./chunk-VDHDEEMF.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-GUXZESDR.js";import"./chunk-IKJZPPOA.js";import"./chunk-NDRLCGPC.js";import"./chunk-TENPGIPX.js";import{h as T}from"./chunk-YU7T5WOQ.js";import"./chunk-UGCNPRKC.js";import{b as e,c as d,d as i}from"./chunk-JMBDTNUR.js";var n=JBrowseExports["@jbrowse/display-kit/DisplayBackgroundProgress"];var f=n&&n.__esModule?n.default:n;var l=JBrowseExports["@jbrowse/display-kit/DisplayErrorBar"];var v=l&&l.__esModule?l.default:l;var p=JBrowseExports["@jbrowse/display-kit/DisplayLoadingOverlay"];var O=p&&p.__esModule?p.default:p;var c=JBrowseExports["@jbrowse/display-kit/TooLargeMessage"];var L=c&&c.__esModule?c.default:c;var s=JBrowseExports["@jbrowse/display-ui"],u=r=>s!=null&&r in Object(s)?s[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=u("BottomRightCornerContext");var g=u("TrackOverlayPortal");var C=u("useChromeOverlayOverride");var U=s&&s.__esModule?s.default:s;var k={TooLarge:L,ErrorBar:v,Loading:O,BackgroundProgress:f},m="Zoom in to see features, or force load this track for the rest of the session (may be slow)",M="Force load this track for the rest of the session (may be slow)";function H(r){let o=r.error??r.renderError,t=o instanceof Error&&o.regionTooLarge===!0;return{error:{error:o,onRetry:t?void 0:()=>{r.reload()}},tooLarge:{message:[r.regionTooLargeReason,r.zoomCanReleaseGate?m:M].filter(Boolean).join(". "),onForceLoad:()=>{r.forceLoad()}},loading:{message:r.statusMessage,progress:r.statusProgress,canceled:r.fetchCanceled,onCancel:()=>{r.cancelFetchByUser()},onRetry:()=>{r.reload()}},background:{message:r.statusMessage,progress:r.statusProgress}}}var _=i(function({model:o,phase:t,drawn:x,testid:E,style:B,children:G,...S}){let{TooLarge:b,ErrorBar:P,Loading:A,BackgroundProgress:D}=C()??k,[R,I]=T(null),a=H(o),y={...S,"data-testid":E,"data-display-id":o.configuration.displayId,"data-display-drawn":x,"data-display-phase":t};return t==="tooLarge"?e("div",{style:{display:"contents"},...y,children:e(g,{children:e("div",{style:{pointerEvents:"auto"},children:e(b,{model:o,...a.tooLarge})})})}):d("div",{style:{position:"relative",height:o.height,...B},...y,children:[e(w,{value:R,children:G}),d(g,{children:[t==="error"?e(P,{model:o,visible:!0,...a.error}):null,e(A,{model:o,...a.loading,visible:t==="loading"||t==="canceled",immediate:!x}),e("div",{ref:I,style:{position:"absolute",bottom:2,right:2,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none"},children:t==="ready"&&o.statusMessage?e(D,{model:o,visible:!0,...a.background}):null})]})]})});var j=i(function({model:o}){return e(_,{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(h,{model:o,ownChrome:!1})})}),so=j;export{so as default};
|
|
2
|
+
//# sourceMappingURL=LinearGraphDisplay-Z33PVCJL.js.map
|
package/dist/chunks/{LinearGraphDisplay-JXPE3DGS.js.map → LinearGraphDisplay-Z33PVCJL.js.map}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["host:@jbrowse/display-kit/DisplayBackgroundProgress", "host:@jbrowse/display-kit/DisplayErrorBar", "host:@jbrowse/display-kit/DisplayLoadingOverlay", "host:@jbrowse/display-kit/TooLargeMessage", "host:@jbrowse/display-ui", "../../src/LinearGraphDisplay/components/GraphStatusChrome.tsx", "../../src/LinearGraphDisplay/components/LinearGraphDisplay.tsx"],
|
|
4
|
-
"sourcesContent": ["const host = JBrowseExports[\"@jbrowse/display-kit/DisplayBackgroundProgress\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-kit/DisplayBackgroundProgress\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport default host && host.__esModule ? host.default : host", "const host = JBrowseExports[\"@jbrowse/display-kit/DisplayErrorBar\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-kit/DisplayErrorBar\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport default host && host.__esModule ? host.default : host", "const host = JBrowseExports[\"@jbrowse/display-kit/DisplayLoadingOverlay\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-kit/DisplayLoadingOverlay\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport default host && host.__esModule ? host.default : host", "const host = JBrowseExports[\"@jbrowse/display-kit/TooLargeMessage\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-kit/TooLargeMessage\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport default host && host.__esModule ? host.default : host", "const host = JBrowseExports[\"@jbrowse/display-ui\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-ui\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport const AXIS_GUTTER_WIDTH_PX = /* @__PURE__ */ read(\"AXIS_GUTTER_WIDTH_PX\")\nexport const AXIS_RIGHT_INSET_PX = /* @__PURE__ */ read(\"AXIS_RIGHT_INSET_PX\")\nexport const AxisCaption = /* @__PURE__ */ read(\"AxisCaption\")\nexport const AxisCaptionOverlay = /* @__PURE__ */ read(\"AxisCaptionOverlay\")\nexport const AxisGutter = /* @__PURE__ */ read(\"AxisGutter\")\nexport const BOTTOM_RIGHT_CONTROLS_ORDER = /* @__PURE__ */ read(\"BOTTOM_RIGHT_CONTROLS_ORDER\")\nexport const BottomRightCornerContext = /* @__PURE__ */ read(\"BottomRightCornerContext\")\nexport const COMPACT_AXIS_HEIGHT = /* @__PURE__ */ read(\"COMPACT_AXIS_HEIGHT\")\nexport const CrossHatchLines = /* @__PURE__ */ read(\"CrossHatchLines\")\nexport const CrossHatches = /* @__PURE__ */ read(\"CrossHatches\")\nexport const DEFAULT_RULE_COLOR = /* @__PURE__ */ read(\"DEFAULT_RULE_COLOR\")\nexport const DisplayChromeOverlayProvider = /* @__PURE__ */ read(\"DisplayChromeOverlayProvider\")\nexport const DisplayUIProvider = /* @__PURE__ */ read(\"DisplayUIProvider\")\nexport const FLOATING_LEGEND_RIGHT_PX = /* @__PURE__ */ read(\"FLOATING_LEGEND_RIGHT_PX\")\nexport const FLOATING_LEGEND_TOP_PX = /* @__PURE__ */ read(\"FLOATING_LEGEND_TOP_PX\")\nexport const FloatingLegend = /* @__PURE__ */ read(\"FloatingLegend\")\nexport const FloatingSvgOverlay = /* @__PURE__ */ read(\"FloatingSvgOverlay\")\nexport const FloatingText = /* @__PURE__ */ read(\"FloatingText\")\nexport const PointerLayer = /* @__PURE__ */ read(\"PointerLayer\")\nexport const SCORE_CAPTION_HEIGHT = /* @__PURE__ */ read(\"SCORE_CAPTION_HEIGHT\")\nexport const ScoreDomainCaption = /* @__PURE__ */ read(\"ScoreDomainCaption\")\nexport const ScoreRuleLines = /* @__PURE__ */ read(\"ScoreRuleLines\")\nexport const ScoreRules = /* @__PURE__ */ read(\"ScoreRules\")\nexport const SvgHaloText = /* @__PURE__ */ read(\"SvgHaloText\")\nexport const TEXT_BASELINE_RATIO = /* @__PURE__ */ read(\"TEXT_BASELINE_RATIO\")\nexport const Tooltip = /* @__PURE__ */ read(\"Tooltip\")\nexport const TrackControlProvider = /* @__PURE__ */ read(\"TrackControlProvider\")\nexport const TrackOverlayContext = /* @__PURE__ */ read(\"TrackOverlayContext\")\nexport const TrackOverlayPortal = /* @__PURE__ */ read(\"TrackOverlayPortal\")\nexport const TrackOverlaySlot = /* @__PURE__ */ read(\"TrackOverlaySlot\")\nexport const YSCALEBAR_LABEL_OFFSET = /* @__PURE__ */ read(\"YSCALEBAR_LABEL_OFFSET\")\nexport const YScaleBar = /* @__PURE__ */ read(\"YScaleBar\")\nexport const YScaleBarOverlay = /* @__PURE__ */ read(\"YScaleBarOverlay\")\nexport const axisDrawn = /* @__PURE__ */ read(\"axisDrawn\")\nexport const axisGutterLeft = /* @__PURE__ */ read(\"axisGutterLeft\")\nexport const axisGutterWidth = /* @__PURE__ */ read(\"axisGutterWidth\")\nexport const axisPlotBox = /* @__PURE__ */ read(\"axisPlotBox\")\nexport const clampStrokeInsideAxis = /* @__PURE__ */ read(\"clampStrokeInsideAxis\")\nexport const cullOverlappingLabels = /* @__PURE__ */ read(\"cullOverlappingLabels\")\nexport const formatScore = /* @__PURE__ */ read(\"formatScore\")\nexport const isLiveModel = /* @__PURE__ */ read(\"isLiveModel\")\nexport const leftAxisGutterWidth = /* @__PURE__ */ read(\"leftAxisGutterWidth\")\nexport const plainChromeOverlays = /* @__PURE__ */ read(\"plainChromeOverlays\")\nexport const plainTrackControl = /* @__PURE__ */ read(\"plainTrackControl\")\nexport const resolveOverlays = /* @__PURE__ */ read(\"resolveOverlays\")\nexport const scoreToAxisY = /* @__PURE__ */ read(\"scoreToAxisY\")\nexport const textHalo = /* @__PURE__ */ read(\"textHalo\")\nexport const tooLargeBannerText = /* @__PURE__ */ read(\"tooLargeBannerText\")\nexport const useChromeOverlayOverride = /* @__PURE__ */ read(\"useChromeOverlayOverride\")\nexport const useTooltip = /* @__PURE__ */ read(\"useTooltip\")\nexport const useTrackControlMenu = /* @__PURE__ */ read(\"useTrackControlMenu\")\nexport const useTrackControlOverride = /* @__PURE__ */ read(\"useTrackControlOverride\")\nexport default host && host.__esModule ? host.default : host", "import { useState } from 'react'\nimport type { CSSProperties, ReactNode } from 'react'\n\nimport DisplayBackgroundProgress from '@jbrowse/display-kit/DisplayBackgroundProgress'\nimport DisplayErrorBar from '@jbrowse/display-kit/DisplayErrorBar'\nimport DisplayLoadingOverlay from '@jbrowse/display-kit/DisplayLoadingOverlay'\nimport TooLargeMessage from '@jbrowse/display-kit/TooLargeMessage'\nimport {\n BottomRightCornerContext,\n TrackOverlayPortal,\n useChromeOverlayOverride,\n} from '@jbrowse/display-ui'\n\nimport type { LinearGraphDisplayModel } from '../model'\nimport type { DisplayStatusPhase } from '@jbrowse/render-core/displayPhase'\n\nconst muiOverlays = {\n TooLarge: TooLargeMessage,\n ErrorBar: DisplayErrorBar,\n Loading: DisplayLoadingOverlay,\n BackgroundProgress: DisplayBackgroundProgress,\n}\n\n/**\n * The status chrome of a display that owns its canvas: the zoom-in notice in\n * place of the display, and the error bar, loading overlay and progress chip\n * over it in the track's overlay layer. Core's `DisplayStatusChrome` drew this\n * until jbrowse-web main removed it on 2026-10-08 (d8db736896), and its named\n * import came back undefined there, failing the track with React error #130.\n * Built here from the overlays every host from 5.0.0-beta.11 serves.\n */\nexport default function GraphStatusChrome({\n model,\n phase,\n drawn,\n testid,\n style,\n children,\n ...dataProps\n}: {\n model: LinearGraphDisplayModel\n phase: DisplayStatusPhase\n drawn: boolean\n testid: string\n style?: CSSProperties\n children: ReactNode\n} & Record<`data-${string}`, unknown>) {\n const { TooLarge, ErrorBar, Loading, BackgroundProgress } =\n useChromeOverlayOverride() ?? muiOverlays\n const [corner, setCorner] = useState<HTMLDivElement | null>(null)\n const attributes = {\n ...dataProps,\n 'data-testid': testid,\n 'data-display-id': model.configuration.displayId,\n 'data-display-drawn': drawn,\n 'data-display-phase': phase,\n }\n if (phase === 'tooLarge') {\n return (\n <div style={{ display: 'contents' }} {...attributes}>\n <TrackOverlayPortal>\n <div style={{ pointerEvents: 'auto' }}>\n <TooLarge model={model} />\n </div>\n </TrackOverlayPortal>\n </div>\n )\n }\n return (\n <div\n style={{ position: 'relative', height: model.height, ...style }}\n {...attributes}\n >\n <BottomRightCornerContext value={corner}>\n {children}\n </BottomRightCornerContext>\n <TrackOverlayPortal>\n <ErrorBar model={model} visible={phase === 'error'} />\n <Loading\n model={model}\n visible={phase === 'loading' || phase === 'canceled'}\n immediate={!drawn}\n />\n <div\n ref={setCorner}\n style={{\n position: 'absolute',\n bottom: 2,\n right: 2,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-end',\n gap: 4,\n pointerEvents: 'none',\n }}\n >\n <BackgroundProgress model={model} visible={phase === 'ready'} />\n </div>\n </TrackOverlayPortal>\n </div>\n )\n}\n", "import { observer } from 'mobx-react'\n\nimport GraphStatusChrome from './GraphStatusChrome'\nimport GraphCanvas from '../../GraphGenomeView/components/GraphCanvas'\n\nimport type { LinearGraphDisplayModel } from '../model'\n\nconst LinearGraphDisplay = observer(function LinearGraphDisplay({\n model,\n}: {\n model: LinearGraphDisplayModel\n}) {\n return (\n <GraphStatusChrome\n model={model}\n phase={model.displayPhase}\n drawn={model.painted && model.geometryPainted}\n testid=\"linear-graph-display\"\n data-layout={model.chosenLayoutMode}\n data-cut-tier={model.cutTier}\n data-recuts={model.recuts}\n data-node-count={model.hasGraph ? model.nodeCount : undefined}\n data-loading={model.isLoading ? '' : undefined}\n style={{\n width: model.paneWidth,\n height: model.height,\n overflow: 'hidden',\n }}\n >\n <GraphCanvas model={model} ownChrome={false} />\n </GraphStatusChrome>\n )\n})\n\nexport default LinearGraphDisplay\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["host", "DisplayBackgroundProgress_default", "host", "host", "DisplayErrorBar_default", "host", "host", "DisplayLoadingOverlay_default", "host", "host", "TooLargeMessage_default", "host", "host", "read", "name", "BottomRightCornerContext", "read", "TrackOverlayPortal", "read", "useChromeOverlayOverride", "read", "display_ui_default", "host", "muiOverlays", "TooLargeMessage_default", "DisplayErrorBar_default", "DisplayLoadingOverlay_default", "DisplayBackgroundProgress_default", "
|
|
4
|
+
"sourcesContent": ["const host = JBrowseExports[\"@jbrowse/display-kit/DisplayBackgroundProgress\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-kit/DisplayBackgroundProgress\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport default host && host.__esModule ? host.default : host", "const host = JBrowseExports[\"@jbrowse/display-kit/DisplayErrorBar\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-kit/DisplayErrorBar\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport default host && host.__esModule ? host.default : host", "const host = JBrowseExports[\"@jbrowse/display-kit/DisplayLoadingOverlay\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-kit/DisplayLoadingOverlay\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport default host && host.__esModule ? host.default : host", "const host = JBrowseExports[\"@jbrowse/display-kit/TooLargeMessage\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-kit/TooLargeMessage\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport default host && host.__esModule ? host.default : host", "const host = JBrowseExports[\"@jbrowse/display-ui\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/display-ui\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport const AXIS_GUTTER_WIDTH_PX = /* @__PURE__ */ read(\"AXIS_GUTTER_WIDTH_PX\")\nexport const AXIS_RIGHT_INSET_PX = /* @__PURE__ */ read(\"AXIS_RIGHT_INSET_PX\")\nexport const AxisCaption = /* @__PURE__ */ read(\"AxisCaption\")\nexport const AxisCaptionOverlay = /* @__PURE__ */ read(\"AxisCaptionOverlay\")\nexport const AxisGutter = /* @__PURE__ */ read(\"AxisGutter\")\nexport const BOTTOM_RIGHT_CONTROLS_ORDER = /* @__PURE__ */ read(\"BOTTOM_RIGHT_CONTROLS_ORDER\")\nexport const BottomRightCornerContext = /* @__PURE__ */ read(\"BottomRightCornerContext\")\nexport const COMPACT_AXIS_HEIGHT = /* @__PURE__ */ read(\"COMPACT_AXIS_HEIGHT\")\nexport const CrossHatchLines = /* @__PURE__ */ read(\"CrossHatchLines\")\nexport const CrossHatches = /* @__PURE__ */ read(\"CrossHatches\")\nexport const DEFAULT_RULE_COLOR = /* @__PURE__ */ read(\"DEFAULT_RULE_COLOR\")\nexport const DisplayChromeOverlayProvider = /* @__PURE__ */ read(\"DisplayChromeOverlayProvider\")\nexport const DisplayUIProvider = /* @__PURE__ */ read(\"DisplayUIProvider\")\nexport const FLOATING_LEGEND_RIGHT_PX = /* @__PURE__ */ read(\"FLOATING_LEGEND_RIGHT_PX\")\nexport const FLOATING_LEGEND_TOP_PX = /* @__PURE__ */ read(\"FLOATING_LEGEND_TOP_PX\")\nexport const FloatingLegend = /* @__PURE__ */ read(\"FloatingLegend\")\nexport const FloatingSvgOverlay = /* @__PURE__ */ read(\"FloatingSvgOverlay\")\nexport const FloatingText = /* @__PURE__ */ read(\"FloatingText\")\nexport const PointerLayer = /* @__PURE__ */ read(\"PointerLayer\")\nexport const SCORE_CAPTION_HEIGHT = /* @__PURE__ */ read(\"SCORE_CAPTION_HEIGHT\")\nexport const ScoreDomainCaption = /* @__PURE__ */ read(\"ScoreDomainCaption\")\nexport const ScoreRuleLines = /* @__PURE__ */ read(\"ScoreRuleLines\")\nexport const ScoreRules = /* @__PURE__ */ read(\"ScoreRules\")\nexport const SvgHaloText = /* @__PURE__ */ read(\"SvgHaloText\")\nexport const TEXT_BASELINE_RATIO = /* @__PURE__ */ read(\"TEXT_BASELINE_RATIO\")\nexport const Tooltip = /* @__PURE__ */ read(\"Tooltip\")\nexport const TrackControlProvider = /* @__PURE__ */ read(\"TrackControlProvider\")\nexport const TrackOverlayContext = /* @__PURE__ */ read(\"TrackOverlayContext\")\nexport const TrackOverlayPortal = /* @__PURE__ */ read(\"TrackOverlayPortal\")\nexport const TrackOverlaySlot = /* @__PURE__ */ read(\"TrackOverlaySlot\")\nexport const YSCALEBAR_LABEL_OFFSET = /* @__PURE__ */ read(\"YSCALEBAR_LABEL_OFFSET\")\nexport const YScaleBar = /* @__PURE__ */ read(\"YScaleBar\")\nexport const YScaleBarOverlay = /* @__PURE__ */ read(\"YScaleBarOverlay\")\nexport const axisDrawn = /* @__PURE__ */ read(\"axisDrawn\")\nexport const axisGutterLeft = /* @__PURE__ */ read(\"axisGutterLeft\")\nexport const axisGutterWidth = /* @__PURE__ */ read(\"axisGutterWidth\")\nexport const axisPlotBox = /* @__PURE__ */ read(\"axisPlotBox\")\nexport const clampStrokeInsideAxis = /* @__PURE__ */ read(\"clampStrokeInsideAxis\")\nexport const cullOverlappingLabels = /* @__PURE__ */ read(\"cullOverlappingLabels\")\nexport const formatScore = /* @__PURE__ */ read(\"formatScore\")\nexport const isLiveModel = /* @__PURE__ */ read(\"isLiveModel\")\nexport const leftAxisGutterWidth = /* @__PURE__ */ read(\"leftAxisGutterWidth\")\nexport const plainChromeOverlays = /* @__PURE__ */ read(\"plainChromeOverlays\")\nexport const plainTrackControl = /* @__PURE__ */ read(\"plainTrackControl\")\nexport const resolveOverlays = /* @__PURE__ */ read(\"resolveOverlays\")\nexport const scoreToAxisY = /* @__PURE__ */ read(\"scoreToAxisY\")\nexport const textHalo = /* @__PURE__ */ read(\"textHalo\")\nexport const tooLargeBannerText = /* @__PURE__ */ read(\"tooLargeBannerText\")\nexport const useChromeOverlayOverride = /* @__PURE__ */ read(\"useChromeOverlayOverride\")\nexport const useTooltip = /* @__PURE__ */ read(\"useTooltip\")\nexport const useTrackControlMenu = /* @__PURE__ */ read(\"useTrackControlMenu\")\nexport const useTrackControlOverride = /* @__PURE__ */ read(\"useTrackControlOverride\")\nexport default host && host.__esModule ? host.default : host", "import { useState } from 'react'\nimport type { CSSProperties, ReactNode } from 'react'\n\nimport DisplayBackgroundProgress from '@jbrowse/display-kit/DisplayBackgroundProgress'\nimport DisplayErrorBar from '@jbrowse/display-kit/DisplayErrorBar'\nimport DisplayLoadingOverlay from '@jbrowse/display-kit/DisplayLoadingOverlay'\nimport TooLargeMessage from '@jbrowse/display-kit/TooLargeMessage'\nimport {\n BottomRightCornerContext,\n TrackOverlayPortal,\n useChromeOverlayOverride,\n} from '@jbrowse/display-ui'\nimport { observer } from 'mobx-react'\n\nimport type { LinearGraphDisplayModel } from '../model'\nimport type { DisplayStatusPhase } from '@jbrowse/render-core/displayPhase'\n\nconst muiOverlays = {\n TooLarge: TooLargeMessage,\n ErrorBar: DisplayErrorBar,\n Loading: DisplayLoadingOverlay,\n BackgroundProgress: DisplayBackgroundProgress,\n}\n\nconst ZOOM_IN_ADVICE =\n 'Zoom in to see features, or force load this track for the rest of the session (may be slow)'\nconst FORCE_LOAD_ADVICE =\n 'Force load this track for the rest of the session (may be slow)'\n\n// Hosts before the plain-props overlay change (jbrowse-components 3a5393f5a6)\n// read `model` and `visible`; later hosts read values and callbacks. Each\n// overlay gets both, so one build runs on either.\nfunction overlayProps(model: LinearGraphDisplayModel) {\n const error = model.error ?? model.renderError\n const regionTooLarge =\n error instanceof Error &&\n (error as { regionTooLarge?: unknown }).regionTooLarge === true\n return {\n error: {\n error,\n onRetry: regionTooLarge\n ? undefined\n : () => {\n model.reload()\n },\n },\n tooLarge: {\n message: [\n model.regionTooLargeReason,\n model.zoomCanReleaseGate ? ZOOM_IN_ADVICE : FORCE_LOAD_ADVICE,\n ]\n .filter(Boolean)\n .join('. '),\n onForceLoad: () => {\n model.forceLoad()\n },\n },\n loading: {\n message: model.statusMessage,\n progress: model.statusProgress,\n canceled: model.fetchCanceled,\n onCancel: () => {\n model.cancelFetchByUser()\n },\n onRetry: () => {\n model.reload()\n },\n },\n background: {\n message: model.statusMessage,\n progress: model.statusProgress,\n },\n }\n}\n\n/**\n * The status chrome of a display that owns its canvas: the zoom-in notice in\n * place of the display, and the error bar, loading overlay and progress chip\n * over it in the track's overlay layer. Core's `DisplayStatusChrome` drew this\n * until jbrowse-web main removed it on 2026-10-08 (d8db736896), and its named\n * import came back undefined there, failing the track with React error #130.\n * Built here from the overlays every host from 5.0.0-beta.11 serves.\n */\nexport default observer(function GraphStatusChrome({\n model,\n phase,\n drawn,\n testid,\n style,\n children,\n ...dataProps\n}: {\n model: LinearGraphDisplayModel\n phase: DisplayStatusPhase\n drawn: boolean\n testid: string\n style?: CSSProperties\n children: ReactNode\n} & Record<`data-${string}`, unknown>) {\n const { TooLarge, ErrorBar, Loading, BackgroundProgress } =\n useChromeOverlayOverride() ?? muiOverlays\n const [corner, setCorner] = useState<HTMLDivElement | null>(null)\n const props = overlayProps(model)\n const attributes = {\n ...dataProps,\n 'data-testid': testid,\n 'data-display-id': model.configuration.displayId,\n 'data-display-drawn': drawn,\n 'data-display-phase': phase,\n }\n if (phase === 'tooLarge') {\n return (\n <div style={{ display: 'contents' }} {...attributes}>\n <TrackOverlayPortal>\n <div style={{ pointerEvents: 'auto' }}>\n <TooLarge model={model} {...props.tooLarge} />\n </div>\n </TrackOverlayPortal>\n </div>\n )\n }\n return (\n <div\n style={{ position: 'relative', height: model.height, ...style }}\n {...attributes}\n >\n <BottomRightCornerContext value={corner}>\n {children}\n </BottomRightCornerContext>\n <TrackOverlayPortal>\n {phase === 'error' ? (\n <ErrorBar model={model} visible {...props.error} />\n ) : null}\n <Loading\n model={model}\n {...props.loading}\n visible={phase === 'loading' || phase === 'canceled'}\n immediate={!drawn}\n />\n <div\n ref={setCorner}\n style={{\n position: 'absolute',\n bottom: 2,\n right: 2,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-end',\n gap: 4,\n pointerEvents: 'none',\n }}\n >\n {phase === 'ready' && model.statusMessage ? (\n <BackgroundProgress model={model} visible {...props.background} />\n ) : null}\n </div>\n </TrackOverlayPortal>\n </div>\n )\n})\n", "import { observer } from 'mobx-react'\n\nimport GraphStatusChrome from './GraphStatusChrome'\nimport GraphCanvas from '../../GraphGenomeView/components/GraphCanvas'\n\nimport type { LinearGraphDisplayModel } from '../model'\n\nconst LinearGraphDisplay = observer(function LinearGraphDisplay({\n model,\n}: {\n model: LinearGraphDisplayModel\n}) {\n return (\n <GraphStatusChrome\n model={model}\n phase={model.displayPhase}\n drawn={model.painted && model.geometryPainted}\n testid=\"linear-graph-display\"\n data-layout={model.chosenLayoutMode}\n data-cut-tier={model.cutTier}\n data-recuts={model.recuts}\n data-node-count={model.hasGraph ? model.nodeCount : undefined}\n data-loading={model.isLoading ? '' : undefined}\n style={{\n width: model.paneWidth,\n height: model.height,\n overflow: 'hidden',\n }}\n >\n <GraphCanvas model={model} ownChrome={false} />\n </GraphStatusChrome>\n )\n})\n\nexport default LinearGraphDisplay\n"],
|
|
5
|
+
"mappings": "ktBAAA,IAAMA,EAAO,eAAe,gDAAgD,EAY5E,IAAOC,EAAQC,GAAQA,EAAK,WAAaA,EAAK,QAAUA,ECZxD,IAAMC,EAAO,eAAe,sCAAsC,EAYlE,IAAOC,EAAQC,GAAQA,EAAK,WAAaA,EAAK,QAAUA,ECZxD,IAAMC,EAAO,eAAe,4CAA4C,EAYxE,IAAOC,EAAQC,GAAQA,EAAK,WAAaA,EAAK,QAAUA,ECZxD,IAAMC,EAAO,eAAe,sCAAsC,EAYlE,IAAOC,EAAQC,GAAQA,EAAK,WAAaA,EAAK,QAAUA,ECZxD,IAAMC,EAAO,eAAe,qBAAqB,EAC3CC,EAAOC,GACXF,GAAQ,MAAQE,KAAQ,OAAOF,CAAI,EAC/BA,EAAKE,CAAI,EACT,OAAO,OACL,UAAY,CACV,MAAM,IAAI,MACR,kCAAoCA,EAAO,qIAC7C,CACF,EACA,CAAE,mBAAoBA,CAAK,CAC7B,EAOC,IAAMC,EAA2CC,EAAK,0BAA0B,EAsBhF,IAAMC,EAAqCC,EAAK,oBAAoB,EAoBpE,IAAMC,EAA2CC,EAAK,0BAA0B,EAIvF,IAAOC,EAAQC,GAAQA,EAAK,WAAaA,EAAK,QAAUA,EC/CxD,IAAMC,EAAc,CAClB,SAAUC,EACV,SAAUC,EACV,QAASC,EACT,mBA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AAU,EAC9C,EACF,EACF,EAIFI,EAAC,OACC,MAAO,CAAE,SAAU,WAAY,OAAQvB,EAAM,OAAQ,GAAGQ,CAAM,EAC7D,GAAGY,EAEJ,UAAAC,EAACG,EAAA,CAAyB,MAAOR,EAC9B,SAAAP,EACH,EACAc,EAACD,EAAA,CACE,UAAAjB,IAAU,QACTgB,EAACT,EAAA,CAAS,MAAOZ,EAAO,QAAO,GAAE,GAAGmB,EAAM,MAAO,EAC/C,KACJE,EAACR,EAAA,CACC,MAAOb,EACN,GAAGmB,EAAM,QACV,QAASd,IAAU,WAAaA,IAAU,WAC1C,UAAW,CAACC,EACd,EACAe,EAAC,OACC,IAAKJ,EACL,MAAO,CACL,SAAU,WACV,OAAQ,EACR,MAAO,EACP,QAAS,OACT,cAAe,SACf,WAAY,WACZ,IAAK,EACL,cAAe,MACjB,EAEC,SAAAZ,IAAU,SAAWL,EAAM,cAC1BqB,EAACP,EAAA,CAAmB,MAAOd,EAAO,QAAO,GAAE,GAAGmB,EAAM,WAAY,EAC9D,KACN,GACF,GACF,CAEJ,CAAC,ECxJD,IAAMM,EAAqBC,EAAS,SAA4B,CAC9D,MAAAC,CACF,EAEG,CACD,OACEC,EAACC,EAAA,CACC,MAAOF,EACP,MAAOA,EAAM,aACb,MAAOA,EAAM,SAAWA,EAAM,gBAC9B,OAAO,uBACP,cAAaA,EAAM,iBACnB,gBAAeA,EAAM,QACrB,cAAaA,EAAM,OACnB,kBAAiBA,EAAM,SAAWA,EAAM,UAAY,OACpD,eAAcA,EAAM,UAAY,GAAK,OACrC,MAAO,CACL,MAAOA,EAAM,UACb,OAAQA,EAAM,OACd,SAAU,QACZ,EAEA,SAAAC,EAACE,EAAA,CAAY,MAAOH,EAAO,UAAW,GAAO,EAC/C,CAEJ,CAAC,EAEMI,GAAQN",
|
|
6
|
+
"names": ["host", "DisplayBackgroundProgress_default", "host", "host", "DisplayErrorBar_default", "host", "host", "DisplayLoadingOverlay_default", "host", "host", "TooLargeMessage_default", "host", "host", "read", "name", "BottomRightCornerContext", "read", "TrackOverlayPortal", "read", "useChromeOverlayOverride", "read", "display_ui_default", "host", "muiOverlays", "TooLargeMessage_default", "DisplayErrorBar_default", "DisplayLoadingOverlay_default", "DisplayBackgroundProgress_default", "ZOOM_IN_ADVICE", "FORCE_LOAD_ADVICE", "overlayProps", "model", "error", "regionTooLarge", "GraphStatusChrome_default", "observer", "phase", "drawn", "testid", "style", "children", "dataProps", "TooLarge", "ErrorBar", "Loading", "BackgroundProgress", "useChromeOverlayOverride", "corner", "setCorner", "useState", "props", "attributes", "jsx", "TrackOverlayPortal", "jsxs", "BottomRightCornerContext", "LinearGraphDisplay", "observer", "model", "jsx", "GraphStatusChrome_default", "GraphCanvas_default", "LinearGraphDisplay_default"]
|
|
7
7
|
}
|
package/dist/chunks/{MinigraphBubbleAdapter-BK35LCJR.js → MinigraphBubbleAdapter-HDLUZ6YF.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f,d as c,f as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=MinigraphBubbleAdapter-
|
|
1
|
+
import{a as f,d as c,f as d}from"./chunk-6WA6WF6A.js";import{a as g}from"./chunk-KOB7YIMR.js";import{b,h as m,m as p,o as u}from"./chunk-EDSIYH4H.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-GUXZESDR.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:h}=s;return g(async r=>{let o=await this.refNames.resolveMapped(t,s);o!==void 0&&await l("Downloading bubbles",h,()=>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:d(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-HDLUZ6YF.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as I}from"./chunk-ZNT7TQLN.js";import{a as w}from"./chunk-KOB7YIMR.js";import"./chunk-PFAHNHMM.js";import"./chunk-VDHDEEMF.js";import{b as L,h as d,m as p,n as y,o as F}from"./chunk-EDSIYH4H.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import"./chunk-GUXZESDR.js";import{d as N}from"./chunk-IKJZPPOA.js";import"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{a as k,o as h}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 v(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 M(s){return{id:s.slice(0,-1),strand:s.slice(-1)}}function $(s){let n=s.split(" "),t=M(n[3]),a=M(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 B(s){return`${s.source}${s.sourceStrand}${s.target}${s.targetStrand}`}function S(s,n,t){n.set(B(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 O(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(B(i),i);return{segments:e,links:r}}function A(s,n,t){let a=e=>e.refName!==t.refName||e.end<=t.start||e.start>=t.end;return[...C(s.filter(e=>e.rank>0),e=>n.has(e.id),t.end-t.start),...C(s.filter(e=>e.rank===0&&a(e)),()=>!0,0)]}function C(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 W=/^[A-Za-z][A-Za-z0-9]:[AifZJHB]:/;function j(s){let{id:n,refName:t,start:a,end:e,rank:r,tags:i}=s,o=i.split(" ").filter(f=>W.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 P(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 R(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=>j(e)),...a.map(e=>P(n.get(e)))].join(`
|
|
2
|
+
`)}function Z(s){return s.filter(n=>n.rank>0)}async function x(s,n,t){let a=[];return await d(s,n.refName,n.start,n.end,{signal:t,lineCallback:e=>{a.push($(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=O(e,await x(s.links,n,a),n);return R(f.segments,f.links)}let o=async f=>(await x(s.links,f,a)).flatMap(m=>S(e,r,m)),g=Z(await o(n));for(let f=0;f<t;f++){let m=await Promise.all(g.map(o));g=Z(m.flat())}if(t>0){let f=A([...e.values()],new Set(g.map(c=>c.id)),n),m=await Promise.all(f.map(c=>x(s.links,c,a)));for(let c of T(m.flat(),e,f))S(e,r,c)}return R(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&&N(r)?new I(p(this,["walksLocation"],["walksIndex"]),this):void 0;return{segments:a,links:e,walks:i,refNames:new F(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.resolveMapped(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 h("Downloading walks",r.statusCallback,()=>t.referenceNodes(a,e,r));for(let g of o){let f=String(g.id);i(new k({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 h("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=v(o);r(new k({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(y(t));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-XZRTWQMZ.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/RgfaTabixAdapter/rgfaBed.ts", "../../src/RgfaTabixAdapter/rgfaCut.ts", "../../src/RgfaTabixAdapter/RgfaTabixAdapter.ts"],
|
|
4
4
|
"sourcesContent": ["// A segment as it appears in segs.bed.gz, and as it is repeated inside every\n// links.bed.gz row: `stableName start end segmentId rank [tags]`. The first\n// five are the SN/SO/SR tags rGFA already carries, projected to BED by\n// `gfatools gfa2bed -m`.\n//\n// `tags` is a space-separated list of GFA tags, written verbatim onto the\n// S-line formatSegment synthesizes, where the GFA parser reads them into\n// `GraphNode.tags` with no work here. It is the extension point for everything\n// the five columns cannot say: carriage on a path-derived graph (`SM:Z:`), the\n// collapse summary on a level-of-detail tier (`ct:Z:`, `cn:i:`, ...), a\n// precomputed layout position later. rGFA files have no sixth column at all,\n// so this is empty for them and nothing changes.\nexport interface RgfaSegment {\n refName: string\n start: number\n end: number\n id: string\n rank: number\n tags: string\n}\n\nexport interface RgfaLink {\n source: string\n sourceStrand: string\n target: string\n targetStrand: string\n sourceSegment: RgfaSegment\n targetSegment: RgfaSegment\n}\n\nexport function parseSegmentLine(line: string): RgfaSegment {\n return parseSegmentRow(line).segment\n}\n\n// gfa-to-tabix's anchored layout files a segment under the reference interval\n// its bubble hangs from and states the segment's own coordinate after the rank:\n// `anchorName anchorStart anchorEnd segmentId rank stableName start end [tags]`.\n// One query over a region then returns every segment of every bubble under it,\n// and `anchored` tells a cut it has nothing left to follow.\nexport function parseSegmentRow(line: string) {\n const cols = line.split('\\t')\n const anchored = cols.length >= 8\n const own = anchored ? 5 : 0\n return {\n anchored,\n segment: {\n refName: cols[own]!,\n start: +cols[own + 1]!,\n end: +cols[own + 2]!,\n id: cols[3]!,\n rank: +cols[4]!,\n tags: cols[anchored ? 8 : 5] ?? '',\n } satisfies RgfaSegment,\n }\n}\n\n// Carriage as an ordinary feature attribute, for the linear track rather than\n// the graph. The tag column reaches the graph view through the synthesized\n// S-line (formatSegment below, then gfaConverter reads SM into\n// `GraphNode.samples`), and that route ends at the graph: `getFeatures` builds\n// its own features and had no way to say who carries a segment, so a lane\n// colored by carriage was not expressible.\n//\n// `SM:Z:` is its own grammar check here. build_pggb_tabix.sh wrote a bare\n// comma-separated list in this column before the tag column existed, and those\n// files are still hosted; a bare list has no prefix to match, so it is dropped\n// rather than read as one sample named `K12,Sakai,CFT073`.\n//\n// Undefined rather than [] when the tag is absent, matching gfaConverter: an\n// rGFA has no sixth column at all, so a segment that says nothing about\n// carriage stays distinguishable from one carried by nobody.\nexport function segmentSamples(segment: RgfaSegment) {\n const tag = segment.tags.split(' ').find(t => t.startsWith('SM:Z:'))\n if (tag === undefined) {\n return undefined\n }\n const samples = tag\n .slice('SM:Z:'.length)\n .split(',')\n .map(s => s.trim())\n .filter(Boolean)\n return samples.length > 0 ? samples : undefined\n}\n\n// `s322+` \u2014 the L-line's segment id with its orientation appended, mirroring\n// the GFA record it came from.\nfunction parseEndpoint(field: string) {\n return { id: field.slice(0, -1), strand: field.slice(-1) }\n}\n\nexport function parseLinkLine(line: string): RgfaLink {\n const cols = line.split('\\t')\n const source = parseEndpoint(cols[3]!)\n const target = parseEndpoint(cols[4]!)\n return {\n source: source.id,\n sourceStrand: source.strand,\n target: target.id,\n targetStrand: target.strand,\n sourceSegment: {\n id: source.id,\n refName: cols[5]!,\n start: +cols[6]!,\n end: +cols[7]!,\n rank: +cols[8]!,\n tags: cols[13] ?? '',\n },\n targetSegment: {\n id: target.id,\n refName: cols[9]!,\n start: +cols[10]!,\n end: +cols[11]!,\n rank: +cols[12]!,\n tags: cols[14] ?? '',\n },\n }\n}\n\nexport function linkKey(link: RgfaLink) {\n return `${link.source}${link.sourceStrand}${link.target}${link.targetStrand}`\n}\n\n// gfa-to-tabix writes both endpoints of a link into every row and files the\n// link under each endpoint's stable sequence, so a read covering both returns\n// it twice; linkKey dedupes it. Returns the endpoints the cut lacked.\nexport function addLink(\n segments: Map<string, RgfaSegment>,\n links: Map<string, RgfaLink>,\n link: RgfaLink,\n) {\n links.set(linkKey(link), link)\n const added: RgfaSegment[] = []\n for (const segment of [link.sourceSegment, link.targetSegment]) {\n if (!segments.has(segment.id)) {\n segments.set(segment.id, segment)\n added.push(segment)\n }\n }\n return added\n}\n\n// The cut an anchored index gives: `under` is what the segment file returned\n// for the window, every segment of every bubble under it, and `found` is what\n// the link file returned. gfa-to-tabix files a link widely enough that `found`\n// holds every link touching a segment in `under` and every link between the\n// segments those lead to, plus links of neither kind, which are dropped here.\n// A backbone link that jumps the whole window, as a deletion or inversion\n// spanning it does, touches nothing in `under` and is kept by its own rule.\nexport function anchoredCut(\n under: Map<string, RgfaSegment>,\n found: RgfaLink[],\n window: StableSpan,\n) {\n const side = (segment: RgfaSegment) =>\n segment.rank !== 0 || segment.refName !== window.refName\n ? 0\n : segment.end <= window.start\n ? -1\n : segment.start >= window.end\n ? 1\n : 0\n const segments = new Map(under)\n const links = new Map<string, RgfaLink>()\n for (const link of found) {\n if (\n under.has(link.source) ||\n under.has(link.target) ||\n side(link.sourceSegment) * side(link.targetSegment) === -1\n ) {\n addLink(segments, links, link)\n }\n }\n for (const link of found) {\n if (segments.has(link.source) && segments.has(link.target)) {\n links.set(linkKey(link), link)\n }\n }\n return { segments, links }\n}\n\nexport interface StableSpan {\n refName: string\n start: number\n end: number\n}\n\n// Where a cut reads links once more to close itself. A hop reads the links of\n// the segments the round before it reached, so a link between two segments of\n// the last round is never read and an allele reached from both ends draws as\n// two stubs. rGFA lays an allele out as one stretch of the stable sequence that\n// introduced it, so pieces of one sequence within the window's length of each\n// other merge into a span, and reading it brings the pieces between too.\n// Backbone reached past the window is unread for the same reason; its spans\n// join only abutting pieces, since the reference past the window is not the\n// cut's to fill. A span whose segments were all read and abut is skipped.\nexport function closingSpans(\n held: RgfaSegment[],\n unread: Set<string>,\n window: StableSpan,\n) {\n const outside = (segment: RgfaSegment) =>\n segment.refName !== window.refName ||\n segment.end <= window.start ||\n segment.start >= window.end\n return [\n ...mergedSpans(\n held.filter(segment => segment.rank > 0),\n segment => unread.has(segment.id),\n window.end - window.start,\n ),\n ...mergedSpans(\n held.filter(segment => segment.rank === 0 && outside(segment)),\n () => true,\n 0,\n ),\n ]\n}\n\nfunction mergedSpans(\n segments: RgfaSegment[],\n isUnread: (segment: RgfaSegment) => boolean,\n maxGap: number,\n) {\n const sorted = [...segments].sort(\n (a, b) => compare(a.refName, b.refName) || a.start - b.start,\n )\n const spans: (StableSpan & { needed: boolean })[] = []\n for (const segment of sorted) {\n const span = spans.at(-1)\n if (\n span?.refName === segment.refName &&\n segment.start - span.end <= maxGap\n ) {\n span.needed ||= segment.start > span.end || isUnread(segment)\n span.end = Math.max(span.end, segment.end)\n } else {\n spans.push({\n refName: segment.refName,\n start: segment.start,\n end: segment.end,\n needed: isUnread(segment),\n })\n }\n }\n return spans\n .filter(span => span.needed)\n .map(({ refName, start, end }): StableSpan => ({ refName, start, end }))\n}\n\n// The links a closing read keeps: each end is a segment the cut holds or one\n// lying inside a span. Following anything else is what another hop is for.\nexport function closingLinks(\n found: RgfaLink[],\n held: Map<string, RgfaSegment>,\n spans: StableSpan[],\n) {\n const inside = (segment: RgfaSegment) =>\n held.has(segment.id) ||\n spans.some(\n span =>\n span.refName === segment.refName &&\n segment.start >= span.start &&\n segment.end <= span.end,\n )\n return found.filter(\n link => inside(link.sourceSegment) && inside(link.targetSegment),\n )\n}\n\n// Segments carry no sequence here \u2014 the BED records only their span \u2014 so every\n// S-line is written with `*` and an LN tag, which is what the GFA spec asks for\n// and what packages/graph-core's parser reads back as the node length.\n// `NM:i:0`, `SM:Z:HG002.1,HG002.2` \u2014 the GFA tag grammar, checked rather than\n// trusted. Files built before the tag column existed put a bare comma-separated\n// sample list here, and passing that through would put a field that is not a\n// tag on an S-line, which is a malformed GFA rather than a missing annotation.\n// Dropping it degrades to the pre-tag behaviour instead.\nconst GFA_TAG = /^[A-Za-z][A-Za-z0-9]:[AifZJHB]:/\n\nfunction formatSegment(segment: RgfaSegment) {\n const { id, refName, start, end, rank, tags } = segment\n const valid = tags.split(' ').filter(t => GFA_TAG.test(t))\n const extra = valid.length === 0 ? '' : `\\t${valid.join('\\t')}`\n return `S\\t${id}\\t*\\tLN:i:${end - start}\\tSN:Z:${refName}\\tSO:i:${start}\\tSR:i:${rank}${extra}`\n}\n\nfunction formatLink(link: RgfaLink) {\n const { source, sourceStrand, target, targetStrand } = link\n return `L\\t${source}\\t${sourceStrand}\\t${target}\\t${targetStrand}\\t0M`\n}\n\n// Codepoint order, not localeCompare: the byte-identical-output guarantee below\n// has to hold across locales.\nfunction compare(a: string, b: string) {\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n// Deterministic ordering: the same region always produces byte-identical GFA,\n// so a layout computed from it is reproducible.\nexport function formatSubgraph(\n segments: Map<string, RgfaSegment>,\n links: Map<string, RgfaLink>,\n) {\n const sortedSegments = [...segments.values()].sort(\n (a, b) =>\n compare(a.refName, b.refName) || a.start - b.start || compare(a.id, b.id),\n )\n const sortedLinks = [...links.keys()].sort((a, b) => compare(a, b))\n return [\n 'H\\tVN:Z:1.0',\n ...sortedSegments.map(s => formatSegment(s)),\n ...sortedLinks.map(k => formatLink(links.get(k)!)),\n ].join('\\n')\n}\n", "import {\n addLink,\n anchoredCut,\n closingLinks,\n closingSpans,\n formatSubgraph,\n parseLinkLine,\n parseSegmentRow,\n} from './rgfaBed.ts'\nimport { getLines } from '../tabixRange.ts'\n\nimport type { RgfaLink, RgfaSegment, StableSpan } from './rgfaBed.ts'\nimport type { TabixIndexedFile } from '@gmod/tabix'\n\n// What a hop follows: alleles, never the backbone. A rank-0 segment reached\n// through a link is flanking backbone, usually outside the window, so querying\n// its links walks the reference away from the region, brings back more backbone,\n// and closes nothing. Every segment that closes a bubble is an allele interior,\n// and an allele interior is rank > 0 in both index formats (rGFA's SR tag, and\n// pggb's rank 0-or-1 against the anchor path). Reached backbone still becomes a\n// node and its edge still draws; it is only not walked through.\n//\n// This is gfabase's rule, arrived at from the other end. `gfabase sub` expands\n// from a seed either to the whole connected component (`--connected`, which its\n// own README calls overkill) or with `--cutpoints 1`, which takes the biconnected\n// component by *stopping at cutpoints*, the segments every end-to-end walk of\n// the chromosome must traverse. In a reference-anchored pangenome the cutpoints\n// are the backbone, and rank is what the index already states about it, so\n// `rank > 0` is that stopping rule without a connectivity index to build. The\n// third tool is the same shape again: `gfatools view -R` maps the region onto its\n// precomputed bubble decomposition and returns whole overlapping bubbles\n// (gfa_query_by_reg), which is complete for the same reason. Bandage's own\n// `--distance` is a node-step radius, but Bandage holds the entire graph in\n// memory, so its scope is a drawing filter rather than a fetch strategy.\n//\n// Measured with this rule: the E. coli paa window converges at one hop (17\n// segments at 1 and at 2), so the cut closes and stays closed. HPRC's amylase\n// window keeps growing (63 at 0, 78 at 1, 92 at 2) because its alleles have\n// alleles, and wall-clock is flat across all three, since a hop's queries go out\n// together and the remote index dominates.\n//\n// The exact version, when a graph ships a bubble index beside its segments:\n// gfatools' bubble rows carry the member segment ids of every bubble, so the\n// bubbles overlapping the region state which segments a complete cut must\n// contain. That turns the hop count into a termination condition rather than a\n// setting, and MinigraphBubbleAdapter already parses those rows.\nfunction offReference(segments: RgfaSegment[]) {\n return segments.filter(segment => segment.rank > 0)\n}\n\nexport interface RgfaFiles {\n segments: TabixIndexedFile\n links: TabixIndexedFile\n}\n\nasync function linksOver(\n file: TabixIndexedFile,\n span: StableSpan,\n signal?: AbortSignal,\n) {\n const found: RgfaLink[] = []\n await getLines(file, span.refName, span.start, span.end, {\n signal,\n lineCallback: line => {\n found.push(parseLinkLine(line))\n },\n })\n return found\n}\n\n/**\n * The graph around a window of one stable sequence, as GFA text. The window's\n * own segments come from the segment file; the link file supplies the edges\n * incident to them *and* the coordinates of the segments on the other end,\n * which typically sit on a different stable sequence (a rank>0 bubble) and so\n * are not reachable by any coordinate query on this window.\n *\n * `hops` is extra rounds of link-following past the window's own segments and\n * their immediate neighbours, each costing one tabix query per off-reference\n * segment newly reached. After the last round, one more read per stretch of\n * stable sequence the cut holds closes it (closingSpans), so an allele reached\n * from both ends draws whole. The view asks for one hop; a hopless cut stays\n * as cheap as it was. `signal` goes to every one of those queries, so a cut\n * the view has replaced stops.\n */\nexport async function rgfaCut(\n files: RgfaFiles,\n window: StableSpan,\n { hops = 0, signal }: { hops?: number; signal?: AbortSignal } = {},\n) {\n const segments = new Map<string, RgfaSegment>()\n const links = new Map<string, RgfaLink>()\n const layout = { anchored: false }\n await getLines(files.segments, window.refName, window.start, window.end, {\n signal,\n lineCallback: line => {\n const row = parseSegmentRow(line)\n layout.anchored ||= row.anchored\n segments.set(row.segment.id, row.segment)\n },\n })\n // An anchored index files every allele and every link under the reference\n // interval its bubble hangs from, so one read of each file holds the whole\n // graph under the window and there is nothing to hop to or close.\n if (layout.anchored) {\n const cut = anchoredCut(\n segments,\n await linksOver(files.links, window, signal),\n window,\n )\n return formatSubgraph(cut.segments, cut.links)\n }\n const addLinksOver = async (span: StableSpan) =>\n (await linksOver(files.links, span, signal)).flatMap(link =>\n addLink(segments, links, link),\n )\n let frontier = offReference(await addLinksOver(window))\n for (let hop = 0; hop < hops; hop++) {\n // One hop's queries are independent of each other, so they go out\n // together rather than one round-trip at a time, and the output is sorted\n // at the end regardless of the order they arrive in.\n const reached = await Promise.all(frontier.map(addLinksOver))\n frontier = offReference(reached.flat())\n }\n if (hops > 0) {\n const spans = closingSpans(\n [...segments.values()],\n new Set(frontier.map(segment => segment.id)),\n window,\n )\n const found = await Promise.all(\n spans.map(span => linksOver(files.links, span, signal)),\n )\n for (const link of closingLinks(found.flat(), segments, spans)) {\n addLink(segments, links, link)\n }\n }\n return formatSubgraph(segments, links)\n}\n", "import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { SimpleFeature, updateStatus } from '@jbrowse/core/util'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\n\nimport { locationIsSet } from '../locationName.ts'\nimport {\n PanSNRefNames,\n openTabixSlot,\n unmappedRegionMessage,\n} from '../panSNTabix.ts'\nimport { getLines } from '../tabixRange.ts'\nimport { parseSegmentRow, segmentSamples } from './rgfaBed.ts'\nimport { rgfaCut } from './rgfaCut.ts'\nimport { WalkIndex } from './walkReader.ts'\n\nimport type { RgfaTabixAdapterConfig } from './configSchema.ts'\nimport type { SubgraphAdapterOptions, SubgraphTier } from '../GetSubgraph.ts'\nimport type { WalkCut } from './walkRowRuns.ts'\nimport type { TabixIndexedFile } from '@gmod/tabix'\nimport type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { Feature } from '@jbrowse/core/util'\nimport type { FileLocation, Region } from '@jbrowse/core/util/types'\n\ninterface GraphIndex {\n segments: TabixIndexedFile\n links: TabixIndexedFile\n walks?: WalkIndex\n refNames: PanSNRefNames\n}\n\nexport default class RgfaTabixAdapter extends BaseFeatureDataAdapter<RgfaTabixAdapterConfig> {\n public static capabilities = ['getFeatures', 'getRefNames']\n\n private readonly fine = this.openIndex([])\n private coarse: GraphIndex | undefined\n\n // refNames off the SEGMENT index: it is the one that names every stable\n // sequence the graph is anchored to, where the link index only names those a\n // link touches. A walk-indexed graph's walk file names the same sequences,\n // and it has no segment file.\n private openIndex(under: string[]): GraphIndex {\n const segments = openTabixSlot(\n this,\n [...under, 'segmentsLocation'],\n [...under, 'segmentsIndex'],\n )\n const links = openTabixSlot(\n this,\n [...under, 'linksLocation'],\n [...under, 'linksIndex'],\n )\n const walksLocation: FileLocation = this.getConf('walksLocation')\n const walks =\n under.length === 0 && locationIsSet(walksLocation)\n ? new WalkIndex(\n openTabixSlot(this, ['walksLocation'], ['walksIndex']),\n this,\n )\n : undefined\n return {\n segments,\n links,\n walks,\n refNames: new PanSNRefNames(walks?.file ?? segments, this),\n }\n }\n\n /**\n * The haplotypes a walk-indexed graph's header names, `sample#haplotype`\n * in byte order, or undefined when it names none\n */\n async getHaplotypeNames(opts: BaseOptions = {}) {\n return this.fine.walks?.haplotypeNames(opts)\n }\n\n private index(tier: SubgraphTier = 'fine') {\n if (tier === 'fine') {\n return this.fine\n }\n this.coarse ??= this.openIndex(['coarse'])\n return this.coarse\n }\n\n async getRefNames(opts: BaseOptions = {}) {\n return this.fine.refNames.assemblyRefNames(opts)\n }\n\n // getFeatures reads a walk file from the chunk before the window\n async getRegionByteSize(regions: Region[], opts: BaseOptions = {}) {\n const { walks, refNames } = this.fine\n return refNames.regionBytes(\n regions,\n opts,\n walks && (start => walks.reader.queryStart(start, opts)),\n )\n }\n\n public async hasDataForRefName() {\n return true\n }\n\n getFeatures(query: Region, opts: BaseOptions = {}) {\n return ObservableCreate<Feature>(async observer => {\n const tabixRefName = await this.fine.refNames.resolveMapped(query, opts)\n if (tabixRefName !== undefined) {\n const { walks } = this.fine\n const emit = (feature: Feature) => {\n observer.next(feature)\n }\n await (walks\n ? this.walkFeatures(walks, tabixRefName, query, opts, emit)\n : this.segmentFeatures(tabixRefName, query, opts, emit))\n }\n observer.complete()\n }, opts.signal)\n }\n\n // A walk-indexed graph's reference nodes are its ref rows' steps\n private async walkFeatures(\n walks: WalkIndex,\n tabixRefName: string,\n query: Region,\n opts: BaseOptions,\n emit: (feature: Feature) => void,\n ) {\n const nodes = await updateStatus(\n 'Downloading walks',\n opts.statusCallback,\n () => walks.referenceNodes(tabixRefName, query, opts),\n )\n for (const node of nodes) {\n const id = String(node.id)\n emit(\n new SimpleFeature({\n uniqueId: id,\n refName: query.refName,\n start: node.start,\n end: node.end,\n name: id,\n type: 'segment',\n rank: 0,\n stableName: node.refName,\n }),\n )\n }\n }\n\n private async segmentFeatures(\n tabixRefName: string,\n query: Region,\n opts: BaseOptions,\n emit: (feature: Feature) => void,\n ) {\n await updateStatus('Downloading segments', opts.statusCallback, () =>\n getLines(this.fine.segments, tabixRefName, query.start, query.end, {\n signal: opts.signal,\n lineCallback: line => {\n const { segment, anchored } = parseSegmentRow(line)\n // An anchored index also returns the alleles under the region,\n // which lie on other stable sequences and have no place on this one\n if (anchored && segment.refName !== tabixRefName) {\n return\n }\n // `samples` lists the haplotypes whose paths visit the segment and\n // `sampleCount` counts them. A lane's color reads the count, and\n // a count in jexl would otherwise rely on `.length` resolving\n // through a member access on an array.\n const samples = segmentSamples(segment)\n emit(\n new SimpleFeature({\n uniqueId: segment.id,\n refName: query.refName,\n start: segment.start,\n end: segment.end,\n name: segment.id,\n type: 'segment',\n rank: segment.rank,\n stableName: segment.refName,\n ...(samples && { samples, sampleCount: samples.length }),\n }),\n )\n },\n }),\n )\n }\n\n // The graph around a region for GraphGenomeView: GFA text (rgfaCut), or a\n // walk-indexed graph's tables (WalkIndex.subgraph). `tier: 'coarse'` reads\n // the `coarse` pair instead, the same way.\n async getSubgraph(\n region: Region,\n opts: SubgraphAdapterOptions = {},\n ): Promise<string | WalkCut> {\n const { hops, signal, tier } = opts\n const index = this.index(tier)\n const tabixRefName = await index.refNames.resolve(region, { signal })\n if (tabixRefName === undefined) {\n throw new Error(unmappedRegionMessage(region))\n }\n if (index.walks) {\n return index.walks.subgraph(tabixRefName, region, opts)\n }\n return rgfaCut(\n index,\n { refName: tabixRefName, start: region.start, end: region.end },\n { hops, signal },\n )\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "+aAuCO,SAASA,EAAgBC,EAAc,CAC5C,IAAMC,EAAOD,EAAK,MAAM,GAAI,EACtBE,EAAWD,EAAK,QAAU,EAC1BE,EAAMD,EAAW,EAAI,EAC3B,MAAO,CACL,SAAAA,EACA,QAAS,CACP,QAASD,EAAKE,CAAG,EACjB,MAAO,CAACF,EAAKE,EAAM,CAAC,EACpB,IAAK,CAACF,EAAKE,EAAM,CAAC,EAClB,GAAIF,EAAK,CAAC,EACV,KAAM,CAACA,EAAK,CAAC,EACb,KAAMA,EAAKC,EAAW,EAAI,CAAC,GAAK,EAClC,CACF,CACF,CAiBO,SAASE,EAAeC,EAAsB,CACnD,IAAMC,EAAMD,EAAQ,KAAK,MAAM,GAAG,EAAE,KAAKE,GAAKA,EAAE,WAAW,OAAO,CAAC,EACnE,GAAID,IAAQ,OACV,OAEF,IAAME,EAAUF,EACb,MAAM,CAAc,EACpB,MAAM,GAAG,EACT,IAAIG,GAAKA,EAAE,KAAK,CAAC,EACjB,OAAO,OAAO,EACjB,OAAOD,EAAQ,OAAS,EAAIA,EAAU,MACxC,CAIA,SAASE,EAAcC,EAAe,CACpC,MAAO,CAAE,GAAIA,EAAM,MAAM,EAAG,EAAE,EAAG,OAAQA,EAAM,MAAM,EAAE,CAAE,CAC3D,CAEO,SAASC,EAAcZ,EAAwB,CACpD,IAAMC,EAAOD,EAAK,MAAM,GAAI,EACtBa,EAASH,EAAcT,EAAK,CAAC,CAAE,EAC/Ba,EAASJ,EAAcT,EAAK,CAAC,CAAE,EACrC,MAAO,CACL,OAAQY,EAAO,GACf,aAAcA,EAAO,OACrB,OAAQC,EAAO,GACf,aAAcA,EAAO,OACrB,c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D4B,EACLF,EACA,CAAE,QAASlB,EAAc,MAAOe,EAAO,MAAO,IAAKA,EAAO,GAAI,EAC9D,CAAE,KAAAC,EAAM,OAAAC,CAAO,CACjB,CACF,CACF",
|
|
6
6
|
"names": ["parseSegmentRow", "line", "cols", "anchored", "own", "segmentSamples", "segment", "tag", "t", "samples", "s", "parseEndpoint", "field", "parseLinkLine", "source", "target", "linkKey", "link", "addLink", "segments", "links", "added", "anchoredCut", "under", "found", "window", "side", "closingSpans", "held", "unread", "outside", "mergedSpans", "isUnread", "maxGap", "sorted", "a", "b", "compare", "spans", "span", "refName", "start", "end", "closingLinks", "inside", "GFA_TAG", "formatSegment", "id", "rank", "tags", "valid", "extra", "formatLink", "sourceStrand", "targetStrand", "formatSubgraph", "sortedSegments", "sortedLinks", "k", "offReference", "segments", "segment", "linksOver", "file", "span", "signal", "found", "getLines", "line", "parseLinkLine", "rgfaCut", "files", "window", "hops", "links", "layout", "row", "parseSegmentRow", "cut", "anchoredCut", "formatSubgraph", "addLinksOver", "link", "addLink", "frontier", "hop", "reached", "spans", "closingSpans", "closingLinks", "RgfaTabixAdapter", "BaseFeatureDataAdapter", "under", "segments", "openTabixSlot", "links", "walksLocation", "walks", "locationIsSet", "WalkIndex", "PanSNRefNames", "opts", "tier", "regions", "refNames", "start", "query", "ObservableCreate", "observer", "tabixRefName", "emit", "feature", "nodes", "updateStatus", "node", "id", "SimpleFeature", "getLines", "line", "segment", "anchored", "parseSegmentRow", "samples", "segmentSamples", "region", "hops", "signal", "index", "unmappedRegionMessage", "rgfaCut"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{H as i,h as o,m as a}from"./chunk-UGCNPRKC.js";import{c as r,d as e}from"./chunk-JMBDTNUR.js";var u=e(function({model:n,title:s,children:l,handleClose:m}){return r(o,{open:!0,title:s,onClose:()=>{m()},children:[l,n.trackWarnings.flatMap(({name:f,warnings:g},p)=>g.map((t,c)=>r(a,{severity:"warning",style:{marginBottom:8},children:[r(i,{variant:"subtitle2",children:[f,": ",t.message]}),t.effect]},`${p}_${c}`)))]})}),x=u;export{x as default};
|
|
2
|
-
//# sourceMappingURL=TrackWarningsDialog-
|
|
2
|
+
//# sourceMappingURL=TrackWarningsDialog-CPAYIP6K.js.map
|
package/dist/chunks/{TrackWarningsDialog-TRYBOIHX.js.map → TrackWarningsDialog-CPAYIP6K.js.map}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+synteny-core@5.0.0-beta.11_@emotion+react@11.14.0_@types+react@19.3.0_react@
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+synteny-core@5.0.0-beta.11_@emotion+react@11.14.0_@types+react@19.3.0_react@19_6b83ce7782285603d64e48e3d7c0913c/node_modules/@jbrowse/synteny-core/esm/TrackWarningsDialog.js"],
|
|
4
4
|
"sourcesContent": ["import { jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { InfoDialog } from '@jbrowse/core/ui';\nimport { Alert, Typography } from '@mui/material';\nimport { observer } from 'mobx-react';\n/**\n * The render-warnings report both comparative views open, over the rows\n * `collectTrackWarnings` builds for them. Reads them off the view rather than\n * taking a copy, so a refetch that raises or clears a warning while the dialog\n * is open shows in it.\n *\n * Grouped by track, with the track name leading each row: a stacked view's\n * levels raise the same swapped-assemblies warning verbatim, and so does every\n * overlaid track that hits it, so an ungrouped list repeated one sentence N\n * times without ever naming the file to go fix.\n *\n * Keyed by position \u2014 the message is not an identity, and neither is the track\n * name once one track raises two warnings.\n */\nconst TrackWarningsDialog = observer(function TrackWarningsDialog({ model, title, children, handleClose, }) {\n return (_jsxs(InfoDialog, { open: true, title: title, onClose: () => {\n handleClose();\n }, children: [children, model.trackWarnings.flatMap(({ name, warnings }, i) => warnings.map((w, j) => (_jsxs(Alert\n // eslint-disable-next-line @eslint-react/no-array-index-key -- see above\n , { severity: \"warning\", style: { marginBottom: 8 }, children: [_jsxs(Typography, { variant: \"subtitle2\", children: [name, \": \", w.message] }), w.effect] }, `${i}_${j}`))))] }));\n});\nexport default TrackWarningsDialog;\n"],
|
|
5
5
|
"mappings": "qGAkBA,IAAMA,EAAsBC,EAAS,SAA6B,CAAE,MAAAC,EAAO,MAAAC,EAAO,SAAAC,EAAU,YAAAC,CAAa,EAAG,CACxG,OAAQC,EAAMC,EAAY,CAAE,KAAM,GAAM,MAAOJ,EAAO,QAAS,IAAM,CAC7DE,EAAY,CAChB,EAAG,SAAU,CAACD,EAAUF,EAAM,cAAc,QAAQ,CAAC,CAAE,KAAAM,EAAM,SAAAC,CAAS,EAAGC,IAAMD,EAAS,IAAI,CAACE,EAAGC,IAAON,EAAMO,EAEvG,CAAE,SAAU,UAAW,MAAO,CAAE,aAAc,CAAE,EAAG,SAAU,CAACP,EAAMQ,EAAY,CAAE,QAAS,YAAa,SAAU,CAACN,EAAM,KAAMG,EAAE,OAAO,CAAE,CAAC,EAAGA,EAAE,MAAM,CAAE,EAAG,GAAGD,CAAC,IAAIE,CAAC,EAAE,CAAE,CAAC,CAAC,CAAE,CAAC,CAC3L,CAAC,EACMG,EAAQf",
|
|
6
6
|
"names": ["TrackWarningsDialog", "observer", "model", "title", "children", "handleClose", "jsxs", "InfoDialog", "name", "warnings", "i", "w", "j", "Alert", "Typography", "TrackWarningsDialog_default"]
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as G}from"./chunk-ZNT7TQLN.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-U4U5ZOCH.js";import{a as $}from"./chunk-KOB7YIMR.js";import{p as W,q as R,r as I}from"./chunk-T4HOC6O3.js";import"./chunk-PFAHNHMM.js";import"./chunk-VDHDEEMF.js";import{e as q,m as T,o as _}from"./chunk-EDSIYH4H.js";import"./chunk-YBLNN5FU.js";import"./chunk-MVVXRZXV.js";import{a as F,c as v,d as S,g as P,h as k,i as x}from"./chunk-GUXZESDR.js";import"./chunk-T4R3ZVEM.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-AIC3W7FL.js.map
|