jbrowse-plugin-graphgenomeviewer 10.0.3 → 10.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddTrackWorkflow-W7XIQ5F3.js → AddTrackWorkflow-47H3VBK4.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-JMYDJODG.js → GbzBaseSyntenyAdapter-X6AW5IYW.js} +2 -2
- package/dist/chunks/{GraphGenomeView-7KODXFCZ.js → GraphGenomeView-ZTZEYNUY.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-ZAIMEATG.js → LinearGraphDisplay-QWJZ5PSO.js} +2 -2
- package/dist/chunks/{MinigraphBubbleAdapter-N5BOXD7U.js → MinigraphBubbleAdapter-WUTIBCFA.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-FZZ7W2HN.js → RgfaTabixAdapter-VT7TYMNE.js} +2 -2
- package/dist/chunks/{WalkFormsAdapter-TZW5UBRI.js → WalkFormsAdapter-VRJ4FYQB.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-XM7HBNJA.js → WalkTabixSyntenyAdapter-ZYWYXAC7.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-XM7HBNJA.js.map → WalkTabixSyntenyAdapter-ZYWYXAC7.js.map} +2 -2
- package/dist/chunks/{chunk-NLHJYXCS.js → chunk-5FMNLEED.js} +2 -2
- package/dist/chunks/{chunk-TMF6JHCE.js → chunk-MQ43JVZM.js} +2 -2
- package/dist/chunks/{chunk-D7BAG2VJ.js → chunk-P7V5S3V3.js} +2 -2
- package/dist/chunks/{chunk-D7BAG2VJ.js.map → chunk-P7V5S3V3.js.map} +2 -2
- package/dist/chunks/chunk-TDHUAADJ.js +6 -0
- package/dist/chunks/chunk-TDHUAADJ.js.map +7 -0
- package/dist/chunks/{chunk-JLIDLLZG.js → chunk-UPSA4KVF.js} +2 -2
- package/dist/chunks/{chunk-HTVBMX7V.js → chunk-UXBGMTAO.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/RgfaTabixAdapter/walkReader.ts +4 -2
- package/src/WalkTabixSyntenyAdapter/WalkTabixSyntenyAdapter.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-CTQBRAQH.js +0 -6
- package/dist/chunks/chunk-CTQBRAQH.js.map +0 -7
- /package/dist/chunks/{AddTrackWorkflow-W7XIQ5F3.js.map → AddTrackWorkflow-47H3VBK4.js.map} +0 -0
- /package/dist/chunks/{GbzBaseSyntenyAdapter-JMYDJODG.js.map → GbzBaseSyntenyAdapter-X6AW5IYW.js.map} +0 -0
- /package/dist/chunks/{GraphGenomeView-7KODXFCZ.js.map → GraphGenomeView-ZTZEYNUY.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-ZAIMEATG.js.map → LinearGraphDisplay-QWJZ5PSO.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-N5BOXD7U.js.map → MinigraphBubbleAdapter-WUTIBCFA.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-FZZ7W2HN.js.map → RgfaTabixAdapter-VT7TYMNE.js.map} +0 -0
- /package/dist/chunks/{WalkFormsAdapter-TZW5UBRI.js.map → WalkFormsAdapter-VRJ4FYQB.js.map} +0 -0
- /package/dist/chunks/{chunk-NLHJYXCS.js.map → chunk-5FMNLEED.js.map} +0 -0
- /package/dist/chunks/{chunk-TMF6JHCE.js.map → chunk-MQ43JVZM.js.map} +0 -0
- /package/dist/chunks/{chunk-JLIDLLZG.js.map → chunk-UPSA4KVF.js.map} +0 -0
- /package/dist/chunks/{chunk-HTVBMX7V.js.map → chunk-UXBGMTAO.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as o}from"./chunk-ZLQEXXMV.js";import{B as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{i as o}from"./chunk-ZLQEXXMV.js";import{B as e}from"./chunk-TDHUAADJ.js";function d(r,n,t){let a=e(r);return t?{...r,abridged:a,walkRowRuns:o(r,n)}:{...r,abridged:a}}export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-UPSA4KVF.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as Y,g as X,h as De,i as He,j as Ie,k as ce,l as qe,n as $e}from"./chunk-CTQBRAQH.js";import{a as ae,b as Oe}from"./chunk-D6TY2QEG.js";import{e as Fe,j as Le}from"./chunk-EGZZ3ADM.js";import{d as ze,g as ye,h as re}from"./chunk-H5PFNYKH.js";var D=JBrowseExports["@jbrowse/core/data_adapters/BaseAdapter"],Ue=i=>D!=null&&i in Object(D)?D[i]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+i+"' from '@jbrowse/core/data_adapters/BaseAdapter' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:i});var Mt=Ue("BaseFeatureDataAdapter");var je=Ue("cachedSetup");var Bt=D&&D.__esModule?D.default:D;async function Et(i,e,t,n,s){return Ie(e,t,n),i.getLines(e,t,n,s)}async function Ve(i,e,t){for(let{refName:n,start:s,end:o}of e)Ie(n,s,o);return i.bytesForRegions(e,t)}function H(i){if(i?.aborted)throw ke(i)}function ke(i){let e=i.reason;return e===void 0?new DOMException("This operation was aborted","AbortError"):e}function Ge(i){return typeof i?.addEventListener=="function"}var z=class{entries=new Map;total=0;settledCount=0;limit;shared;fill;sizeOf;toCacheKey;idleTimeoutMs;sweepTimer;constructor({fill:e,maxSize:t=1/0,sizeOf:n=()=>1,cacheKey:s=a=>String(a),idleTimeoutMs:o=0,budget:r}={}){this.fill=e,this.limit=t,this.shared=r&&{budget:r,membership:r.register(this)},this.sizeOf=n,this.toCacheKey=s,this.idleTimeoutMs=o>0&&Number.isFinite(o)?o:void 0}get size(){return this.entries.size}get totalSize(){return this.total}get maxSize(){return this.limit}set maxSize(e){this.limit=e,this.evict()}waiterCount(e){return this.entries.get(this.toCacheKey(e))?.pending?.signals.size??0}async get(e,t,n){H(t);let s=this.toCacheKey(e),o=this.entries.get(s);o&&this.isDoomed(o)&&(this.release(s),o=void 0),o?this.touch(s,o):o=this.start(s,e,n),o.pending&&this.join(o.pending,t);try{return await this.settleFor(o,t)}finally{H(t)}}settleFor(e,t){if(!e.pending||!Ge(t))return e.promise;let n,s=new Promise((r,a)=>{n=a}),o=()=>{n(ke(t))};return t.addEventListener("abort",o,{once:!0}),Promise.race([e.promise,s]).finally(()=>{t.removeEventListener("abort",o)})}getIfCached(e){let t=this.toCacheKey(e),n=this.entries.get(t);if(n){if(this.isDoomed(n)){this.release(t);return}return this.touch(t,n),n.promise}}has(e){let t=this.entries.get(this.toCacheKey(e));return t!==void 0&&!this.isDoomed(t)}delete(e){this.release(this.toCacheKey(e))}clear(){this.entries.clear(),this.shared?.budget.charge(this.shared.membership,-this.total),this.total=0,this.settledCount=0,this.stopSweep()}touch(e,t){this.entries.delete(e),this.entries.set(e,t),t.lastTouched=Date.now(),t.seq=this.stamp()}stamp(){return this.shared?.budget.nextSeq()??0}isDoomed(e){return e.pending?.controller.signal.aborted===!0}sweepIdle(){let e=this.idleTimeoutMs;if(e===void 0)return;let t=Date.now()-e;for(let[n,s]of this.entries)!s.pending&&s.lastTouched<=t&&this.release(n);this.settledCount===0&&this.stopSweep()}startSweep(){let e=this.idleTimeoutMs;if(e===void 0||this.sweepTimer!==void 0)return;let t=Math.min(2**31-1,Math.max(1e3,Math.floor(e/4))),n=new WeakRef(this),s=setInterval(()=>{let o=n.deref();o?o.sweepIdle():clearInterval(s)},t);this.sweepTimer=s,s.unref?.()}stopSweep(){this.sweepTimer!==void 0&&(clearInterval(this.sweepTimer),this.sweepTimer=void 0)}start(e,t,n){let s=n??(this.fill&&(h=>this.fill(t,h)));if(!s)throw new Error("SharedReadCache needs a fill, either on the cache or on the get() call");let o={signals:new Map,pinned:!1,controller:new AbortController},r={promise:Promise.resolve(s(o.controller.signal)),pending:o,size:0,lastTouched:Date.now(),seq:this.stamp()};this.entries.set(e,r);let a=()=>this.entries.get(e)===r,l=()=>{for(let[h,c]of o.signals)h.removeEventListener("abort",c);r.pending=void 0};return r.promise.then(h=>{let c=a()?this.weigh(h):void 0,d=a();l(),d&&(c===void 0?this.entries.delete(e):(r.lastTouched=Date.now(),r.size=c,this.settledCount++,this.total+=c,this.shared?.budget.charge(this.shared.membership,c),this.startSweep())),this.evict(),this.shared?.budget.evict()},()=>{a()&&this.release(e),l()}),r}weigh(e){try{let t=this.sizeOf(e);return Number.isFinite(t)&&t>=0?t:void 0}catch{return}}join(e,t){if(!Ge(t))e.pinned=!0;else if(!t.aborted&&!e.signals.has(t)){let n=()=>{e.signals.delete(t),!e.pinned&&e.signals.size===0&&e.controller.abort(t.reason)};e.signals.set(t,n),t.addEventListener("abort",n,{once:!0})}}release(e){let t=this.entries.get(e);t&&(this.entries.delete(e),t.pending||this.settledCount--,this.total-=t.size,this.shared?.budget.charge(this.shared.membership,-t.size))}lruSpare(e=!1){if(!(this.settledCount<=(e?0:1))){for(let[t,n]of this.entries)if(!n.pending)return{cacheKey:t,seq:n.seq,last:this.settledCount===1}}}evict(){if(!(this.total<=this.limit))for(let[e,t]of this.entries){if(this.total<=this.limit||this.settledCount<=1)break;t.pending||this.release(e)}}};var A=class{minv;maxv;bin;endPosition;constructor(e,t,n,s=t.blockPosition+65536){this.minv=e,this.maxv=t,this.bin=n,this.endPosition=s}toString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}fetchedSize(){return this.endPosition-this.minv.blockPosition}};function ve(i,e){if(!(e>0))throw new TypeError(`\`${i}\` must be a number greater than 0`)}var Q=class{#e=new Map;#t=new Map;#n;#s;#o;constructor(e){let t=e.maxAge??Number.POSITIVE_INFINITY;ve("maxSize",e.maxSize),ve("maxAge",t),this.#n=e.maxSize,this.#s=t,this.#o=e.onEviction}#r(e){let t=this.#o;if(t)for(let[n,s]of e)t(n,s.value)}#i(e,t){return t.expiry!==void 0&&t.expiry<=Date.now()?(this.#o?.(e,t.value),this.delete(e),!0):!1}#c(e,t){return this.#i(e,t)?void 0:t.value}#l(e,t){if(this.#t.delete(e),this.#e.set(e,t),this.#e.size>=this.#n){let n=this.#t;this.#t=this.#e,this.#e=new Map,this.#r(n)}}#h(e){this.#t=new Map(e),this.#e=new Map}*#a(){for(let e of[this.#t,this.#e])for(let t of e)this.#i(...t)||(yield t)}get(e){let t=this.#e.get(e);if(t)return this.#c(e,t);let n=this.#t.get(e);if(n&&!this.#i(e,n))return this.#l(e,n),n.value}set(e,t,{maxAge:n=this.#s}={}){let s={value:t,expiry:n===Number.POSITIVE_INFINITY?void 0:Date.now()+n};return this.#e.has(e)?this.#e.set(e,s):this.#l(e,s),this}has(e){let t=this.#e.get(e)??this.#t.get(e);return t!==void 0&&!this.#i(e,t)}peek(e){let t=this.#e.get(e)??this.#t.get(e);return t?this.#c(e,t):void 0}expiresIn(e){let t=this.#e.get(e)??this.#t.get(e);if(t)return t.expiry===void 0?Number.POSITIVE_INFINITY:t.expiry-Date.now()}delete(e){return this.#e.delete(e)||this.#t.delete(e)}clear(){this.#e.clear(),this.#t.clear()}resize(e){ve("maxSize",e);let t=[...this.#a()],n=t.length-e;n<0?(this.#e=new Map(t),this.#t=new Map):(this.#r(t.slice(0,n)),this.#h(t.slice(n))),this.#n=e}evict(e=1){if(!(e>0))return;let t=[...this.#a()],n=Math.trunc(Math.min(e,t.length-1));n>0&&(this.#r(t.slice(0,n)),this.#h(t.slice(n)))}get size(){return Math.min(this.#e.size+this.#t.size,this.#n)}get maxSize(){return this.#n}get maxAge(){return this.#s}*entriesAscending(){for(let[e,t]of this.#a())yield[e,t.value]}*entriesDescending(){for(let e of[this.#e,this.#t])for(let[t,n]of[...e].reverse())this.#i(t,n)||(yield[t,n.value])}entries(){return this.entriesAscending()}[Symbol.iterator](){return this.entriesAscending()}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}forEach(e,t=this){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};function We(i,e=0){let t=i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24;return((i[e+4]|i[e+5]<<8|i[e+6]<<16|i[e+7]<<24)>>>0)*4294967296+(t>>>0)}var G=class{blockPosition;dataPosition;constructor(e,t){this.blockPosition=e,this.dataPosition=t}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}};function O(i,e=0){return new G(i[e+7]*1099511627776+i[e+6]*4294967296+i[e+5]*16777216+i[e+4]*65536+i[e+3]*256+i[e+2],i[e+1]<<8|i[e])}function le(i,e){let t=i.length;if(t===0)return i;let n;if(e){let a=e.blockPosition,l=e.dataPosition;n=[];for(let h=0;h<t;h++){let c=i[h];(c.maxv.blockPosition-a||c.maxv.dataPosition-l)>0&&n.push(c)}if(n.length===0)return n}else n=i;n.sort((a,l)=>{let h=a.minv.blockPosition-l.minv.blockPosition;return h===0?a.minv.dataPosition-l.minv.dataPosition:h});let s=[n[0]],o=n[0].minv.blockPosition,r=n[0].maxv.blockPosition;for(let a=1;a<n.length;a++){let l=n[a],h=l.minv.blockPosition,c=l.maxv.blockPosition;if(h-r<65e3&&c-o<5e6){let d=s.at(-1);(c-r||l.maxv.dataPosition-d.maxv.dataPosition)>0&&(s[s.length-1]=new A(d.minv,l.maxv,d.bin,l.endPosition),r=c)}else s.push(l),o=h,r=c}return at(s)}function at(i){let e=[i[0]];for(let t=1;t<i.length;t++){let n=i[t],s=e.at(-1).maxv;if((n.minv.blockPosition-s.blockPosition||n.minv.dataPosition-s.dataPosition)>=0){e.push(n);continue}(n.maxv.blockPosition-s.blockPosition||n.maxv.dataPosition-s.dataPosition)>0&&e.push(new A(s,n.maxv,n.bin,n.endPosition))}return e}function he(i,e=[]){let t=[...e];for(let n of i)t.push(n.minv.blockPosition,n.maxv.blockPosition);t.sort((n,s)=>n-s);for(let n of i){let s=n.maxv.blockPosition,o=0,r=t.length;for(;o<r;){let a=o+r>>>1;t[a]>s?r=a:o=a+1}o<t.length&&(n.endPosition=Math.min(n.endPosition,t[o]))}}function de(i,e,t,n,s=8){let o=n?n.blockPosition:1/0,r=n?n.dataPosition:0,a=!1;for(let l=0;l<t;l++){let h=e+l*s,c=i[h+7]*1099511627776+i[h+6]*4294967296+i[h+5]*16777216+i[h+4]*65536+i[h+3]*256+i[h+2],d=i[h+1]<<8|i[h];(c<o||c===o&&d<r)&&(o=c,r=d,a=!0)}return a?new G(o,r):n}function ct(i){let e=new TextDecoder("utf-8"),t=[],n={},s=0,o=0;for(;o<i.length;){let r=i.indexOf(0,o);if(r===-1)break;if(r>o){let a=e.decode(i.subarray(o,r));t[s]=a,n[a]=s}o=r+1,s++}return{refNameToId:n,refIdToName:t}}var lt={0:"generic",1:"SAM",2:"VCF",3:"GAF"};function fe(i,e){let t=new DataView(i.buffer,i.byteOffset,i.byteLength),n=t.getInt32(e,!0),s=n&65536?"zero-based-half-open":"1-based-closed",o=lt[n&15];if(!o)throw new Error(`invalid Tabix preset format flags ${n}`);let r={ref:t.getInt32(e+4,!0),start:t.getInt32(e+8,!0),end:t.getInt32(e+12,!0)},a=t.getInt32(e+16,!0),l=a?String.fromCharCode(a):void 0,h=t.getInt32(e+20,!0),c=t.getInt32(e+24,!0),{refIdToName:d,refNameToId:p}=ct(i.subarray(e+28,e+28+c));return{refIdToName:d,refNameToId:p,skipLines:h,metaChar:l,columnNumbers:r,format:o,coordinateType:s}}function ue(i,e){return{lineCount:We(i,e)}}function me(i,e=5){let t=new Q({maxSize:e});return n=>{let s=t.get(n);if(s!==void 0)return s;let o=i(n);return o!==void 0&&t.set(n,o),o}}function Ke(i){let e=0;for(let s of i)e+=s.length;let t=new Uint8Array(e),n=0;for(let s of i)t.set(s,n),n+=s.length;return t}var Je=10;function Se(i,e,t){let n,s=0;for(let o of i){let r=0;if(n){let h=o.indexOf(Je);if(h===-1){n=Ke([n,o]),e+=o.length;continue}if(t(Ke([n,o.subarray(0,h+1)]),s))return!0;r=h+1,n=void 0}let a=o.lastIndexOf(Je);if(a>=r&&t(o.subarray(r,a+1),e+r))return!0;let l=Math.max(r,a+1);l<o.length&&(n=o.slice(l),s=e+l),e+=o.length}return!1}function Ye(i,e,t){let n=[],s=0;for(let o of i){let r=Math.max(e-s,0),a=Math.min(t-s,o.length);r<a&&n.push(o.subarray(r,a)),s+=o.length}return n}function Pe(i,e,t){let n=0,s=i.length-1;for(;n<s;){let r=n+s+1>>>1;i[r]<=t.blockPosition?n=r:s=r-1}return(n===0?0:e[n])-e[0]+t.dataPosition}function ht(i,e,t,n){if(e>2**(t+n*3))return;let s=(8**(n+1)-1)/7,o=(8**n-1)/7+Math.floor((e-1)/2**t)+1;for(o>=s&&(o=0);;){for(;o%8===1;)o=(o-1)/8;if(o===0)return;let r=i[o];if(r?.length){let a=r[0].minv;for(let l=1;l<r.length;l++){let h=r[l].minv;h.compareTo(a)<0&&(a=h)}return a}o++}}function Xe(i,e){return i.format==="GAF"?0:i.refNameToId[e]}var q=class{filehandle;parseCache=new z({});constructor({filehandle:e}){this.filehandle=e}async readIndexBytes(e){let t=await this.filehandle.readFile({signal:e.signal,onProgress:e.onProgress}),n=await ce(t);return{bytes:n,dataView:new DataView(n.buffer,n.byteOffset,n.byteLength)}}async lineCount(e,t={}){let n=await this.parse(t),s=Xe(n,e);return s===void 0?-1:n.indices(s)?.stats?.lineCount??-1}async getMetadata(e={}){let{indices:t,...n}=await this.parse(e);return n}async blocksForRange(e,t,n,s={}){let o=await this.parse(s),r=Xe(o,e);if(r===void 0)return[];let a=o.indices(r);if(!a)return[];o.format==="GAF"&&(t=Math.max(t-1,0));let l=[];for(let[m,f]of this.reg2bins(t,n,o))for(let x=m;x<=f;x++){let b=a.binIndex[x];if(b)for(let v of b)l.push(v)}let h=this.lowestOffset(a,t,o),c=le(l,h),d=ht(a.binIndex,n,o.minShift,o.depth);if(d){let m=c.length;for(;m>0&&c[m-1].minv.compareTo(d)>=0;)m--;c.length=m}let p=c[0];if(p&&h){let m=2**(o.minShift+3),f=this.lowestOffset(a,Math.floor(t/m)*m,o),x=f&&f.compareTo(h)<0?f:h;p.minv.compareTo(x)<0&&(c[0]=new A(x,p.maxv,p.bin,p.endPosition))}return c}parse(e={}){return this.parseCache.get("index",e.signal,t=>this._parse({...e,signal:t}))}async hasRefSeq(e,t={}){return!!(await this.parse(t)).indices(e)?.binIndex}};var dt=21582659,ft=38359875;function Qe(i,e){return i*2**e}function Te(i,e){return Math.floor(i/2**e)}var $=class extends q{async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e),s=n.getUint32(0,!0),o;if(s===dt)o=1;else if(s===ft)o=2;else throw new Error(`Not a CSI file (magic=${s})`);let r=n.getInt32(4,!0),a=n.getInt32(8,!0),l=(8**(a+1)-1)/7,h=2**(r+a*3),c=n.getInt32(12,!0),d=c>=28&&(n.getInt32(16,!0)&15)===3;if(c<30&&!d)throw new Error("CSI index has no tabix header, so it names no references; it may be a BAM or BCF index");let p=fe(t,16),m=n.getInt32(16+c,!0),f=16+c+4,x,b=[];for(let y=0;y<m;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let u=0;u<I;u++){let S=n.getUint32(f,!0);if(f+=4,S>l)f+=44;else{x=de(t,f,1,x),f+=8;let g=n.getInt32(f,!0);f+=4+16*g}}}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C={},w;for(let F=0;F<S;F++){let k=n.getUint32(u,!0);if(u+=4,k>l)w=ue(t,u+28),u+=44;else{C[k]=O(t,u),u+=8;let R=n.getInt32(u,!0);u+=4;let T=Array.from({length:R});for(let _=0;_<R;_++)T[_]=new A(O(t,u),O(t,u+8),k),u+=16;g[k]=T}}return he(Object.values(g).flat()),{binIndex:g,loffsets:C,stats:w}}return{...p,csi:!0,refCount:m,maxBlockSize:65536,firstDataLine:x,csiVersion:o,indices:me(v),minShift:r,depth:a,maxBinNumber:l,maxRefLength:h}}lowestOffset(e,t,{minShift:n,depth:s}){let{loffsets:o}=e,r;if(o){let a=(Qe(1,3*s)-1)/7+Te(Math.max(t,0),n);for(;r===void 0&&a>0;)if(r=o[a],r===void 0){let l=Math.floor((a-1)/8),h=l*8+1;a=a>h?a-1:l}r??=o[0]}return r}reg2bins(e,t,{minShift:n,depth:s,maxBinNumber:o}){e=Math.max(e,0);let r=2**(n+s*3);t>r&&(t=r),t-=1;let a=0,l=0,h=n+s*3,c=[];for(;a<=s;h-=3,l+=Qe(1,a*3),a+=1){let d=l+Te(e,h),p=l+Te(t,h);if(p-d+c.length>o)throw new Error(`query ${e}-${t} is too large for current binning scheme (shift ${n}, depth ${s}), try a smaller query or a coarser index binning scheme`);c.push([d,p])}return c}};var ut=21578324,Ae=5,_e=14,pe=2**(_e+Ae*3);function Ze(i){return Math.min(Math.max(i,0),pe)}var L=class extends q{reg2bins(e,t){e>pe&&console.warn("querying outside of possible tabix range");let n=Ze(e),s=Math.min(t,pe)-1,o=[];return n<=s&&o.push([0,0],[1+(n>>26),1+(s>>26)],[9+(n>>23),9+(s>>23)],[73+(n>>20),73+(s>>20)],[585+(n>>17),585+(s>>17)],[4681+(n>>14),4681+(s>>14)]),o}lowestOffset(e,t){let n=e.linearIndex;return n?.[Math.min(Ze(t)>>_e,n.length-1)]}async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e);if(n.getUint32(0,!0)!==ut)throw new Error("Not a TBI file");let s=n.getUint32(4,!0),o=((1<<(Ae+1)*3)-1)/7,{refNameToId:r,refIdToName:a,coordinateType:l,format:h,columnNumbers:c,metaChar:d,skipLines:p}=fe(t,8),f=36+n.getInt32(32,!0),x,b=[];for(let y=0;y<s;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let S=0;S<I;S++){let g=n.getUint32(f,!0);f+=4;let C=n.getInt32(f,!0);if(f+=4,g>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");g<=o&&(x=de(t,f,C,x,16)),f+=16*C}let u=n.getInt32(f,!0);f+=4+8*u}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C;for(let k=0;k<S;k++){let R=n.getUint32(u,!0);if(u+=4,R>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(R===o+1){let T=n.getInt32(u,!0);u+=4,T===2&&(C=ue(t,u+16)),u+=16*T}else{let T=n.getInt32(u,!0);u+=4;let _=Array.from({length:T});for(let U=0;U<T;U++)_[U]=new A(O(t,u),O(t,u+8),R),u+=16;g[R]=_}}let w=n.getInt32(u,!0);u+=4;let F=Array.from({length:w});for(let k=0;k<w;k++)F[k]=O(t,u),u+=8;return he(Object.values(g).flat(),F.map(k=>k.blockPosition)),{binIndex:g,linearIndex:F,stats:C}}return{indices:me(v),metaChar:d,minShift:_e,depth:Ae,maxBinNumber:o,maxRefLength:pe,skipLines:p,firstDataLine:x,columnNumbers:c,coordinateType:l,format:h,refIdToName:a,refNameToId:r,maxBlockSize:65536}}};var Me=9,xe=10,nt=13,mt=59,pt=60,gt=62,xt=6,wt=1024*2**20,bt=180*1e3;function Ct(i,e,t){if(i)return i;if(e)return new X(e);if(t)return new Y(t);throw new TypeError("must provide either filehandle, path, or url")}function yt({tbiFilehandle:i,csiFilehandle:e,tbiPath:t,csiPath:n,tbiUrl:s,csiUrl:o,path:r,url:a}){if(i)return new L({filehandle:i});if(e)return new $({filehandle:e});if(t)return new L({filehandle:new X(t)});if(n)return new $({filehandle:new X(n)});if(o)return new $({filehandle:new Y(o)});if(s)return new L({filehandle:new Y(s)});if(r)return new L({filehandle:new X(`${r}.tbi`)});if(a)return new L({filehandle:new Y(`${a}.tbi`)});throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl")}function it(i,e,t,n,s){return i[t]*256+(n-e[t])+s+1}function It(i,e,t,n,s,o,r){let a=n-t,l=e+a,h=0;if(i[s]===46)return l;let c=s;for(let d=s;d<=o;d++)if(d===o||i[d]===mt){let p=d-c;if(p>=10&&i[c]===83&&i[c+1]===86&&i[c+2]===84&&i[c+3]===89&&i[c+4]===80&&i[c+5]===69&&i[c+6]===61&&i[c+7]===84&&i[c+8]===82&&i[c+9]===65)return e+1;if(p>=4&&i[c]===69&&i[c+1]===78&&i[c+2]===68&&i[c+3]===61){let m=ge(i,c+4,d);m>e&&(l=m)}else p>=6&&i[c]===83&&i[c+1]===86&&i[c+2]===76&&i[c+3]===69&&i[c+4]===78&&i[c+5]===61&&(h=vt(i,c+6,d,n+1,r));c=d+1}return Math.max(l,e+h)}var et=44;function kt(i,e,t){if(t-e<5||i[e]!==60||i[t-1]!==62)return!1;let n=i[e+4];if(n!==62&&n!==58)return!1;let s=i[e+1],o=i[e+2],r=i[e+3];return s===67&&o===78&&r===86||s===68&&o===69&&r===76||s===68&&o===85&&r===80||s===73&&o===78&&r===86}function vt(i,e,t,n,s){let o=0,r=e,a=n;for(;r<t&&a<s;){let l=i.indexOf(et,r);(l===-1||l>t)&&(l=t);let h=i.indexOf(et,a);if((h===-1||h>s)&&(h=s),kt(i,a,h)){let c=ge(i,i[r]===45?r+1:r,l);c>o&&(o=c)}r=l+1,a=h+1}return o}var st=new TextDecoder;function tt(i,e){let t=-1,n=e.charCodeAt(0);for(let s=0,o=i.length;s<o;s++){let r=i[s];if(s===t+1&&r!==n)break;r===xe&&(t=s)}return i.subarray(0,t+1)}function St(i,e){let t=0;for(let n=0;n<e;n++){let s=i.indexOf(xe,t);if(s===-1){t=i.length;break}t=s+1}return st.decode(i.subarray(0,t)).split(/\r?\n/).slice(0,e)}function ge(i,e,t){let n=0;for(let s=e;s<t;s++){let o=i[s];if(o>=48&&o<=57)n=n*10+(o-48);else break}return n}function Pt(i,e,t,n,s,{start:o,end:r,pathCol:a,metaCharCode:l,decoder:h,callback:c}){let d=0,p=0;for(;d<i.length;){let m=i.indexOf(xe,d);if(m===-1)break;let f=d;d=m+1;let x=f+e+s;for(;p<n.length&&x>=n[p];)p++;if(i[f]===l)continue;let b=f;for(let g=1;g<a;g++){let C=i.indexOf(Me,b);if(C===-1||C>=m){b=m;break}b=C+1}let v=i[b];if(v!==gt&&v!==pt)continue;let y=i.indexOf(Me,b);(y===-1||y>m)&&(y=m);let I=1/0,u=-1,S=b;for(;S<y;){let g=0,C=S+1;for(;C<y;C++){let w=i[C]-48;if(w<0||w>9)break;g=g*10+w}g<I&&(I=g),g>u&&(u=g),S=C}if(I>=r)return!0;if(u>=o){let g=i[m-1]===nt?m-1:m;c(h.decode(i.subarray(f,g)),it(t,n,p,f+e,s),I,u+1)}}return!1}var W=class{filehandle;index;chunkCache;requested=new Map;headerCache=new z({});bgzfWorkerPool;constructor({path:e,filehandle:t,url:n,tbiPath:s,tbiUrl:o,tbiFilehandle:r,csiPath:a,csiUrl:l,csiFilehandle:h,chunkCacheSize:c=wt,chunkCacheIdleTimeoutMs:d=bt,chunkCacheBudget:p,bgzfWorkerPool:m}){this.bgzfWorkerPool=m,this.filehandle=Ct(t,e,n),this.index=yt({tbiFilehandle:r,csiFilehandle:h,tbiPath:s,csiPath:a,tbiUrl:o,csiUrl:l,path:e,url:n}),this.chunkCache=new z({maxSize:c,sizeOf:f=>{let x=0;for(let b of f.segments)x+=b.byteLength;return x},cacheKey:f=>f.toString(),idleTimeoutMs:d,budget:p,fill:(f,x)=>this.readChunk(f,{signal:x})})}clearChunkCache(){this.chunkCache.clear(),this.requested.clear()}withCachedContainers(e){if(this.requested.size>2*this.chunkCache.size)for(let[n,s]of this.requested)this.chunkCache.has(s)||this.requested.delete(n);let t=[];for(let n=0;n<e.length;n++){let s=e[n],o=t[t.length-1],r=e[n+1],a;if(!this.chunkCache.has(s))for(let l of this.requested.values())l.minv.compareTo(s.minv)<=0&&l.maxv.compareTo(s.maxv)>=0&&(!o||l.minv.compareTo(o.maxv)>=0)&&(!r||l.maxv.compareTo(r.minv)<=0)&&(!a||l.fetchedSize()<a.fetchedSize())&&this.chunkCache.has(l)&&(a=l);t.push(a??s)}return t}async bytesForRegions(e,t={}){let n=[];for(let{refName:o,start:r,end:a}of e){let l=await this.index.blocksForRange(o,r,a,t);for(let h of l)n.push(h)}let s=0;for(let o of le(n))s+=o.fetchedSize();return s}async getLines(e,t,n,s){let o,r={},a,l;typeof s=="function"?a=s:(r=s,a=s.lineCallback,o=s.signal,l=s.onProgress);let h=await this.index.getMetadata(r),c=t??0,d=n??h.maxRefLength;if(c>d)throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(c===d)return;let p=await this.index.blocksForRange(e,c,d,r),m=this.withCachedContainers(p),f=h.format==="VCF",x=h.columnNumbers.ref||0,b=h.columnNumbers.start||0,v=f?8:h.columnNumbers.end||0,y=Math.max(x,b,v),I=h.metaChar?.charCodeAt(0),u=h.coordinateType==="1-based-closed"?-1:0,S=new TextEncoder,g=new TextDecoder,C=S.encode(e),w=new Int32Array(y+1),F=h.format==="GAF"?{start:c,end:d,pathCol:b,metaCharCode:I,decoder:g,callback:a}:void 0,k=0;for(let E of m)k+=E.fetchedSize();let R=0;l?.(0,k);let T=1,_=[],U=E=>{for(;_.length<Math.min(E,m.length);){let K=m[_.length];this.requested.set(K.toString(),K);let j=this.chunkCache.get(K,o);j.catch(()=>{}),_.push(j)}};U(1);for(let E=0,K=m.length;E<K;E++){let j=m[E],Be=await _[E],{cpositions:Z,dpositions:V}=Be;R+=j.fetchedSize(),l?.(R,k);let we=j.minv.dataPosition,be=p[E],ee=Be.segments,te=0;if(be!==j){te=Pe(Z,V,be.minv);let P=Pe(Z,V,be.maxv)+1;ee=Ye(ee,te,P)}if(F){if(Se(ee,te,(P,ne)=>Pt(P,ne,Z,V,we,F)))return}else if(Se(ee,te,(P,ne)=>{let M=0,ie=0;for(;M<P.length;){let B=P.indexOf(xe,M);if(B===-1)break;let rt=M+ne+we;for(;ie<V.length&&rt>=V[ie];)ie++;if(I!==void 0&&P[M]===I){M=B+1;continue}w[0]=M-1;for(let N=0;N<y;N++){let oe=w[N],Ce=oe<B?P.indexOf(Me,oe+1):-1;w[N+1]=Ce===-1||Ce>=B?B:Ce}let Ne=w[x-1]+1,Re=w[x]-Ne;if(Re!==C.length){M=B+1;continue}let Ee=!0;for(let N=0;N<Re;N++)if(P[Ne+N]!==C[N]){Ee=!1;break}if(!Ee){M=B+1;continue}let se=ge(P,w[b-1]+1,w[b])+u;if(se>=d)return!0;let J;if(v===0||v===b?J=se+1:f?J=It(P,se,w[3]+1,w[4],w[v-1]+1,w[v],w[5]):J=ge(P,w[v-1]+1,w[v]),J>c){let N=P[B-1]===nt?B-1:B,oe=g.decode(P.subarray(M,N));a(oe,it(Z,V,ie,M+ne,we),se,J)}M=B+1}return!1}))return;T=Math.min(T*2,xt),U(E+1+T)}}async getMetadata(e={}){return this.index.getMetadata(e)}async readHeaderBytes(e){let{firstDataLine:t,maxBlockSize:n}=await this.getMetadata(e);if(t?.blockPosition===0&&t.dataPosition===0)return new Uint8Array(0);let s=(t?.blockPosition??0)+n,o=await this.filehandle.read(s,0,e);return ce(o)}async parseHeader(e){let{metaChar:t,skipLines:n=0}=await this.getMetadata(e),s=await this.readHeaderBytes(e);return{header:st.decode(t?tt(s,t):s),skippedLines:n>0?St(s,n):[]}}getParsedHeader(e={}){return this.headerCache.get("header",e.signal,t=>this.parseHeader({...e,signal:t}))}async getHeaderBuffer(e={}){let{metaChar:t}=await this.getMetadata(e),n=await this.readHeaderBytes(e);return t?tt(n,t):n}async getSkippedLines(e={}){let{skipLines:t=0}=await this.getMetadata(e);return t<=0?[]:(await this.getParsedHeader(e)).skippedLines}async getHeader(e={}){return(await this.getParsedHeader(e)).header}async getHeaderLines(e={}){let{header:t,skippedLines:n}=await this.getParsedHeader(e);return(t?t.split(/\r?\n/):n).filter(Boolean)}async getReferenceSequenceNames(e={}){return(await this.getMetadata(e)).refIdToName}async lineCount(e,t={}){return this.index.lineCount(e,t)}async readChunk(e,t={}){let n=await this.filehandle.read(e.fetchedSize(),e.minv.blockPosition,t);H(t.signal);let s=await this.bgzfWorkerPool;return qe(n,e,s)}};function Mn(i,e,t){let n=i.pluginManager;return new W({filehandle:ae(i.getConf(e),n),...Oe(i.getConf([...t,"location"]),i.getConf([...t,"indexType"]),n)})}function Bn(i){let e=i.getConf("walksIndex");return Tt(i.getConf("walksLocation"),Fe(e)?e:void 0,i.pluginManager)}function Tt(i,e,t){return $e.fromFilehandles({data:ae(i,t),directory:ae(e??Le(i,n=>`${n}.idx`),t)})}function Nn(i){return{names:e=>i.getReferenceSequenceNames(e),bytes:(e,t)=>Ve(i,e,t)}}function At(i){return`${i.assemblyName} ${i.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${i.assemblyName} mapped to its prefix in assemblyNameToPanSN`}var ot=class{constructor(e,t){this.source=e;this.adapter=t;this.lookup=je({setup:async e=>De(await this.source.names(e))})}async assemblyRefNames(e={}){let t=await this.source.names(e),n=re(this.adapter,e.assemblyName),s=t.filter(o=>ye(o,n)).map(o=>ze(o));return s.length>0?[...new Set(s)]:t}async resolve(e,t){let n=await this.lookup(t);return He(n,re(this.adapter,e.assemblyName),e.refName)}async resolveMapped(e,t){let n=await this.resolve(e,t);if(n===void 0&&e.assemblyName){let s=await this.source.names(t),o=re(this.adapter,e.assemblyName);if(s.length>0&&s.every(r=>r.includes("#"))&&!s.some(r=>ye(r,o)))throw new Error(At(e))}return n}async resolveForCut(e,t){let n=await this.resolveMapped(e,t);if(n===void 0)throw new Error(`This graph has nothing on ${e.assemblyName} ${e.refName}`);return n}async regionBytes(e,t={}){let n=[];for(let s of e){let o=await this.resolve(s,t);o!==void 0&&n.push({refName:o,start:s.start,end:s.end})}return this.source.bytes(n,t)}};export{Mt as a,je as b,Et as c,Mn as d,Bn as e,Tt as f,Nn as g,ot as h};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{f as Y,g as X,h as De,i as He,j as Ie,k as ce,l as qe,n as $e}from"./chunk-TDHUAADJ.js";import{a as ae,b as Oe}from"./chunk-D6TY2QEG.js";import{e as Fe,j as Le}from"./chunk-EGZZ3ADM.js";import{d as ze,g as ye,h as re}from"./chunk-H5PFNYKH.js";var D=JBrowseExports["@jbrowse/core/data_adapters/BaseAdapter"],Ue=i=>D!=null&&i in Object(D)?D[i]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+i+"' from '@jbrowse/core/data_adapters/BaseAdapter' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:i});var Mt=Ue("BaseFeatureDataAdapter");var je=Ue("cachedSetup");var Bt=D&&D.__esModule?D.default:D;async function Et(i,e,t,n,s){return Ie(e,t,n),i.getLines(e,t,n,s)}async function Ve(i,e,t){for(let{refName:n,start:s,end:o}of e)Ie(n,s,o);return i.bytesForRegions(e,t)}function H(i){if(i?.aborted)throw ke(i)}function ke(i){let e=i.reason;return e===void 0?new DOMException("This operation was aborted","AbortError"):e}function Ge(i){return typeof i?.addEventListener=="function"}var z=class{entries=new Map;total=0;settledCount=0;limit;shared;fill;sizeOf;toCacheKey;idleTimeoutMs;sweepTimer;constructor({fill:e,maxSize:t=1/0,sizeOf:n=()=>1,cacheKey:s=a=>String(a),idleTimeoutMs:o=0,budget:r}={}){this.fill=e,this.limit=t,this.shared=r&&{budget:r,membership:r.register(this)},this.sizeOf=n,this.toCacheKey=s,this.idleTimeoutMs=o>0&&Number.isFinite(o)?o:void 0}get size(){return this.entries.size}get totalSize(){return this.total}get maxSize(){return this.limit}set maxSize(e){this.limit=e,this.evict()}waiterCount(e){return this.entries.get(this.toCacheKey(e))?.pending?.signals.size??0}async get(e,t,n){H(t);let s=this.toCacheKey(e),o=this.entries.get(s);o&&this.isDoomed(o)&&(this.release(s),o=void 0),o?this.touch(s,o):o=this.start(s,e,n),o.pending&&this.join(o.pending,t);try{return await this.settleFor(o,t)}finally{H(t)}}settleFor(e,t){if(!e.pending||!Ge(t))return e.promise;let n,s=new Promise((r,a)=>{n=a}),o=()=>{n(ke(t))};return t.addEventListener("abort",o,{once:!0}),Promise.race([e.promise,s]).finally(()=>{t.removeEventListener("abort",o)})}getIfCached(e){let t=this.toCacheKey(e),n=this.entries.get(t);if(n){if(this.isDoomed(n)){this.release(t);return}return this.touch(t,n),n.promise}}has(e){let t=this.entries.get(this.toCacheKey(e));return t!==void 0&&!this.isDoomed(t)}delete(e){this.release(this.toCacheKey(e))}clear(){this.entries.clear(),this.shared?.budget.charge(this.shared.membership,-this.total),this.total=0,this.settledCount=0,this.stopSweep()}touch(e,t){this.entries.delete(e),this.entries.set(e,t),t.lastTouched=Date.now(),t.seq=this.stamp()}stamp(){return this.shared?.budget.nextSeq()??0}isDoomed(e){return e.pending?.controller.signal.aborted===!0}sweepIdle(){let e=this.idleTimeoutMs;if(e===void 0)return;let t=Date.now()-e;for(let[n,s]of this.entries)!s.pending&&s.lastTouched<=t&&this.release(n);this.settledCount===0&&this.stopSweep()}startSweep(){let e=this.idleTimeoutMs;if(e===void 0||this.sweepTimer!==void 0)return;let t=Math.min(2**31-1,Math.max(1e3,Math.floor(e/4))),n=new WeakRef(this),s=setInterval(()=>{let o=n.deref();o?o.sweepIdle():clearInterval(s)},t);this.sweepTimer=s,s.unref?.()}stopSweep(){this.sweepTimer!==void 0&&(clearInterval(this.sweepTimer),this.sweepTimer=void 0)}start(e,t,n){let s=n??(this.fill&&(h=>this.fill(t,h)));if(!s)throw new Error("SharedReadCache needs a fill, either on the cache or on the get() call");let o={signals:new Map,pinned:!1,controller:new AbortController},r={promise:Promise.resolve(s(o.controller.signal)),pending:o,size:0,lastTouched:Date.now(),seq:this.stamp()};this.entries.set(e,r);let a=()=>this.entries.get(e)===r,l=()=>{for(let[h,c]of o.signals)h.removeEventListener("abort",c);r.pending=void 0};return r.promise.then(h=>{let c=a()?this.weigh(h):void 0,d=a();l(),d&&(c===void 0?this.entries.delete(e):(r.lastTouched=Date.now(),r.size=c,this.settledCount++,this.total+=c,this.shared?.budget.charge(this.shared.membership,c),this.startSweep())),this.evict(),this.shared?.budget.evict()},()=>{a()&&this.release(e),l()}),r}weigh(e){try{let t=this.sizeOf(e);return Number.isFinite(t)&&t>=0?t:void 0}catch{return}}join(e,t){if(!Ge(t))e.pinned=!0;else if(!t.aborted&&!e.signals.has(t)){let n=()=>{e.signals.delete(t),!e.pinned&&e.signals.size===0&&e.controller.abort(t.reason)};e.signals.set(t,n),t.addEventListener("abort",n,{once:!0})}}release(e){let t=this.entries.get(e);t&&(this.entries.delete(e),t.pending||this.settledCount--,this.total-=t.size,this.shared?.budget.charge(this.shared.membership,-t.size))}lruSpare(e=!1){if(!(this.settledCount<=(e?0:1))){for(let[t,n]of this.entries)if(!n.pending)return{cacheKey:t,seq:n.seq,last:this.settledCount===1}}}evict(){if(!(this.total<=this.limit))for(let[e,t]of this.entries){if(this.total<=this.limit||this.settledCount<=1)break;t.pending||this.release(e)}}};var A=class{minv;maxv;bin;endPosition;constructor(e,t,n,s=t.blockPosition+65536){this.minv=e,this.maxv=t,this.bin=n,this.endPosition=s}toString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}fetchedSize(){return this.endPosition-this.minv.blockPosition}};function ve(i,e){if(!(e>0))throw new TypeError(`\`${i}\` must be a number greater than 0`)}var Q=class{#e=new Map;#t=new Map;#n;#s;#o;constructor(e){let t=e.maxAge??Number.POSITIVE_INFINITY;ve("maxSize",e.maxSize),ve("maxAge",t),this.#n=e.maxSize,this.#s=t,this.#o=e.onEviction}#r(e){let t=this.#o;if(t)for(let[n,s]of e)t(n,s.value)}#i(e,t){return t.expiry!==void 0&&t.expiry<=Date.now()?(this.#o?.(e,t.value),this.delete(e),!0):!1}#c(e,t){return this.#i(e,t)?void 0:t.value}#l(e,t){if(this.#t.delete(e),this.#e.set(e,t),this.#e.size>=this.#n){let n=this.#t;this.#t=this.#e,this.#e=new Map,this.#r(n)}}#h(e){this.#t=new Map(e),this.#e=new Map}*#a(){for(let e of[this.#t,this.#e])for(let t of e)this.#i(...t)||(yield t)}get(e){let t=this.#e.get(e);if(t)return this.#c(e,t);let n=this.#t.get(e);if(n&&!this.#i(e,n))return this.#l(e,n),n.value}set(e,t,{maxAge:n=this.#s}={}){let s={value:t,expiry:n===Number.POSITIVE_INFINITY?void 0:Date.now()+n};return this.#e.has(e)?this.#e.set(e,s):this.#l(e,s),this}has(e){let t=this.#e.get(e)??this.#t.get(e);return t!==void 0&&!this.#i(e,t)}peek(e){let t=this.#e.get(e)??this.#t.get(e);return t?this.#c(e,t):void 0}expiresIn(e){let t=this.#e.get(e)??this.#t.get(e);if(t)return t.expiry===void 0?Number.POSITIVE_INFINITY:t.expiry-Date.now()}delete(e){return this.#e.delete(e)||this.#t.delete(e)}clear(){this.#e.clear(),this.#t.clear()}resize(e){ve("maxSize",e);let t=[...this.#a()],n=t.length-e;n<0?(this.#e=new Map(t),this.#t=new Map):(this.#r(t.slice(0,n)),this.#h(t.slice(n))),this.#n=e}evict(e=1){if(!(e>0))return;let t=[...this.#a()],n=Math.trunc(Math.min(e,t.length-1));n>0&&(this.#r(t.slice(0,n)),this.#h(t.slice(n)))}get size(){return Math.min(this.#e.size+this.#t.size,this.#n)}get maxSize(){return this.#n}get maxAge(){return this.#s}*entriesAscending(){for(let[e,t]of this.#a())yield[e,t.value]}*entriesDescending(){for(let e of[this.#e,this.#t])for(let[t,n]of[...e].reverse())this.#i(t,n)||(yield[t,n.value])}entries(){return this.entriesAscending()}[Symbol.iterator](){return this.entriesAscending()}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}forEach(e,t=this){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};function We(i,e=0){let t=i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24;return((i[e+4]|i[e+5]<<8|i[e+6]<<16|i[e+7]<<24)>>>0)*4294967296+(t>>>0)}var G=class{blockPosition;dataPosition;constructor(e,t){this.blockPosition=e,this.dataPosition=t}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}};function O(i,e=0){return new G(i[e+7]*1099511627776+i[e+6]*4294967296+i[e+5]*16777216+i[e+4]*65536+i[e+3]*256+i[e+2],i[e+1]<<8|i[e])}function le(i,e){let t=i.length;if(t===0)return i;let n;if(e){let a=e.blockPosition,l=e.dataPosition;n=[];for(let h=0;h<t;h++){let c=i[h];(c.maxv.blockPosition-a||c.maxv.dataPosition-l)>0&&n.push(c)}if(n.length===0)return n}else n=i;n.sort((a,l)=>{let h=a.minv.blockPosition-l.minv.blockPosition;return h===0?a.minv.dataPosition-l.minv.dataPosition:h});let s=[n[0]],o=n[0].minv.blockPosition,r=n[0].maxv.blockPosition;for(let a=1;a<n.length;a++){let l=n[a],h=l.minv.blockPosition,c=l.maxv.blockPosition;if(h-r<65e3&&c-o<5e6){let d=s.at(-1);(c-r||l.maxv.dataPosition-d.maxv.dataPosition)>0&&(s[s.length-1]=new A(d.minv,l.maxv,d.bin,l.endPosition),r=c)}else s.push(l),o=h,r=c}return at(s)}function at(i){let e=[i[0]];for(let t=1;t<i.length;t++){let n=i[t],s=e.at(-1).maxv;if((n.minv.blockPosition-s.blockPosition||n.minv.dataPosition-s.dataPosition)>=0){e.push(n);continue}(n.maxv.blockPosition-s.blockPosition||n.maxv.dataPosition-s.dataPosition)>0&&e.push(new A(s,n.maxv,n.bin,n.endPosition))}return e}function he(i,e=[]){let t=[...e];for(let n of i)t.push(n.minv.blockPosition,n.maxv.blockPosition);t.sort((n,s)=>n-s);for(let n of i){let s=n.maxv.blockPosition,o=0,r=t.length;for(;o<r;){let a=o+r>>>1;t[a]>s?r=a:o=a+1}o<t.length&&(n.endPosition=Math.min(n.endPosition,t[o]))}}function de(i,e,t,n,s=8){let o=n?n.blockPosition:1/0,r=n?n.dataPosition:0,a=!1;for(let l=0;l<t;l++){let h=e+l*s,c=i[h+7]*1099511627776+i[h+6]*4294967296+i[h+5]*16777216+i[h+4]*65536+i[h+3]*256+i[h+2],d=i[h+1]<<8|i[h];(c<o||c===o&&d<r)&&(o=c,r=d,a=!0)}return a?new G(o,r):n}function ct(i){let e=new TextDecoder("utf-8"),t=[],n={},s=0,o=0;for(;o<i.length;){let r=i.indexOf(0,o);if(r===-1)break;if(r>o){let a=e.decode(i.subarray(o,r));t[s]=a,n[a]=s}o=r+1,s++}return{refNameToId:n,refIdToName:t}}var lt={0:"generic",1:"SAM",2:"VCF",3:"GAF"};function fe(i,e){let t=new DataView(i.buffer,i.byteOffset,i.byteLength),n=t.getInt32(e,!0),s=n&65536?"zero-based-half-open":"1-based-closed",o=lt[n&15];if(!o)throw new Error(`invalid Tabix preset format flags ${n}`);let r={ref:t.getInt32(e+4,!0),start:t.getInt32(e+8,!0),end:t.getInt32(e+12,!0)},a=t.getInt32(e+16,!0),l=a?String.fromCharCode(a):void 0,h=t.getInt32(e+20,!0),c=t.getInt32(e+24,!0),{refIdToName:d,refNameToId:p}=ct(i.subarray(e+28,e+28+c));return{refIdToName:d,refNameToId:p,skipLines:h,metaChar:l,columnNumbers:r,format:o,coordinateType:s}}function ue(i,e){return{lineCount:We(i,e)}}function me(i,e=5){let t=new Q({maxSize:e});return n=>{let s=t.get(n);if(s!==void 0)return s;let o=i(n);return o!==void 0&&t.set(n,o),o}}function Ke(i){let e=0;for(let s of i)e+=s.length;let t=new Uint8Array(e),n=0;for(let s of i)t.set(s,n),n+=s.length;return t}var Je=10;function Se(i,e,t){let n,s=0;for(let o of i){let r=0;if(n){let h=o.indexOf(Je);if(h===-1){n=Ke([n,o]),e+=o.length;continue}if(t(Ke([n,o.subarray(0,h+1)]),s))return!0;r=h+1,n=void 0}let a=o.lastIndexOf(Je);if(a>=r&&t(o.subarray(r,a+1),e+r))return!0;let l=Math.max(r,a+1);l<o.length&&(n=o.slice(l),s=e+l),e+=o.length}return!1}function Ye(i,e,t){let n=[],s=0;for(let o of i){let r=Math.max(e-s,0),a=Math.min(t-s,o.length);r<a&&n.push(o.subarray(r,a)),s+=o.length}return n}function Pe(i,e,t){let n=0,s=i.length-1;for(;n<s;){let r=n+s+1>>>1;i[r]<=t.blockPosition?n=r:s=r-1}return(n===0?0:e[n])-e[0]+t.dataPosition}function ht(i,e,t,n){if(e>2**(t+n*3))return;let s=(8**(n+1)-1)/7,o=(8**n-1)/7+Math.floor((e-1)/2**t)+1;for(o>=s&&(o=0);;){for(;o%8===1;)o=(o-1)/8;if(o===0)return;let r=i[o];if(r?.length){let a=r[0].minv;for(let l=1;l<r.length;l++){let h=r[l].minv;h.compareTo(a)<0&&(a=h)}return a}o++}}function Xe(i,e){return i.format==="GAF"?0:i.refNameToId[e]}var q=class{filehandle;parseCache=new z({});constructor({filehandle:e}){this.filehandle=e}async readIndexBytes(e){let t=await this.filehandle.readFile({signal:e.signal,onProgress:e.onProgress}),n=await ce(t);return{bytes:n,dataView:new DataView(n.buffer,n.byteOffset,n.byteLength)}}async lineCount(e,t={}){let n=await this.parse(t),s=Xe(n,e);return s===void 0?-1:n.indices(s)?.stats?.lineCount??-1}async getMetadata(e={}){let{indices:t,...n}=await this.parse(e);return n}async blocksForRange(e,t,n,s={}){let o=await this.parse(s),r=Xe(o,e);if(r===void 0)return[];let a=o.indices(r);if(!a)return[];o.format==="GAF"&&(t=Math.max(t-1,0));let l=[];for(let[m,f]of this.reg2bins(t,n,o))for(let x=m;x<=f;x++){let b=a.binIndex[x];if(b)for(let v of b)l.push(v)}let h=this.lowestOffset(a,t,o),c=le(l,h),d=ht(a.binIndex,n,o.minShift,o.depth);if(d){let m=c.length;for(;m>0&&c[m-1].minv.compareTo(d)>=0;)m--;c.length=m}let p=c[0];if(p&&h){let m=2**(o.minShift+3),f=this.lowestOffset(a,Math.floor(t/m)*m,o),x=f&&f.compareTo(h)<0?f:h;p.minv.compareTo(x)<0&&(c[0]=new A(x,p.maxv,p.bin,p.endPosition))}return c}parse(e={}){return this.parseCache.get("index",e.signal,t=>this._parse({...e,signal:t}))}async hasRefSeq(e,t={}){return!!(await this.parse(t)).indices(e)?.binIndex}};var dt=21582659,ft=38359875;function Qe(i,e){return i*2**e}function Te(i,e){return Math.floor(i/2**e)}var $=class extends q{async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e),s=n.getUint32(0,!0),o;if(s===dt)o=1;else if(s===ft)o=2;else throw new Error(`Not a CSI file (magic=${s})`);let r=n.getInt32(4,!0),a=n.getInt32(8,!0),l=(8**(a+1)-1)/7,h=2**(r+a*3),c=n.getInt32(12,!0),d=c>=28&&(n.getInt32(16,!0)&15)===3;if(c<30&&!d)throw new Error("CSI index has no tabix header, so it names no references; it may be a BAM or BCF index");let p=fe(t,16),m=n.getInt32(16+c,!0),f=16+c+4,x,b=[];for(let y=0;y<m;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let u=0;u<I;u++){let S=n.getUint32(f,!0);if(f+=4,S>l)f+=44;else{x=de(t,f,1,x),f+=8;let g=n.getInt32(f,!0);f+=4+16*g}}}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C={},w;for(let F=0;F<S;F++){let k=n.getUint32(u,!0);if(u+=4,k>l)w=ue(t,u+28),u+=44;else{C[k]=O(t,u),u+=8;let R=n.getInt32(u,!0);u+=4;let T=Array.from({length:R});for(let _=0;_<R;_++)T[_]=new A(O(t,u),O(t,u+8),k),u+=16;g[k]=T}}return he(Object.values(g).flat()),{binIndex:g,loffsets:C,stats:w}}return{...p,csi:!0,refCount:m,maxBlockSize:65536,firstDataLine:x,csiVersion:o,indices:me(v),minShift:r,depth:a,maxBinNumber:l,maxRefLength:h}}lowestOffset(e,t,{minShift:n,depth:s}){let{loffsets:o}=e,r;if(o){let a=(Qe(1,3*s)-1)/7+Te(Math.max(t,0),n);for(;r===void 0&&a>0;)if(r=o[a],r===void 0){let l=Math.floor((a-1)/8),h=l*8+1;a=a>h?a-1:l}r??=o[0]}return r}reg2bins(e,t,{minShift:n,depth:s,maxBinNumber:o}){e=Math.max(e,0);let r=2**(n+s*3);t>r&&(t=r),t-=1;let a=0,l=0,h=n+s*3,c=[];for(;a<=s;h-=3,l+=Qe(1,a*3),a+=1){let d=l+Te(e,h),p=l+Te(t,h);if(p-d+c.length>o)throw new Error(`query ${e}-${t} is too large for current binning scheme (shift ${n}, depth ${s}), try a smaller query or a coarser index binning scheme`);c.push([d,p])}return c}};var ut=21578324,Ae=5,_e=14,pe=2**(_e+Ae*3);function Ze(i){return Math.min(Math.max(i,0),pe)}var L=class extends q{reg2bins(e,t){e>pe&&console.warn("querying outside of possible tabix range");let n=Ze(e),s=Math.min(t,pe)-1,o=[];return n<=s&&o.push([0,0],[1+(n>>26),1+(s>>26)],[9+(n>>23),9+(s>>23)],[73+(n>>20),73+(s>>20)],[585+(n>>17),585+(s>>17)],[4681+(n>>14),4681+(s>>14)]),o}lowestOffset(e,t){let n=e.linearIndex;return n?.[Math.min(Ze(t)>>_e,n.length-1)]}async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e);if(n.getUint32(0,!0)!==ut)throw new Error("Not a TBI file");let s=n.getUint32(4,!0),o=((1<<(Ae+1)*3)-1)/7,{refNameToId:r,refIdToName:a,coordinateType:l,format:h,columnNumbers:c,metaChar:d,skipLines:p}=fe(t,8),f=36+n.getInt32(32,!0),x,b=[];for(let y=0;y<s;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let S=0;S<I;S++){let g=n.getUint32(f,!0);f+=4;let C=n.getInt32(f,!0);if(f+=4,g>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");g<=o&&(x=de(t,f,C,x,16)),f+=16*C}let u=n.getInt32(f,!0);f+=4+8*u}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C;for(let k=0;k<S;k++){let R=n.getUint32(u,!0);if(u+=4,R>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(R===o+1){let T=n.getInt32(u,!0);u+=4,T===2&&(C=ue(t,u+16)),u+=16*T}else{let T=n.getInt32(u,!0);u+=4;let _=Array.from({length:T});for(let U=0;U<T;U++)_[U]=new A(O(t,u),O(t,u+8),R),u+=16;g[R]=_}}let w=n.getInt32(u,!0);u+=4;let F=Array.from({length:w});for(let k=0;k<w;k++)F[k]=O(t,u),u+=8;return he(Object.values(g).flat(),F.map(k=>k.blockPosition)),{binIndex:g,linearIndex:F,stats:C}}return{indices:me(v),metaChar:d,minShift:_e,depth:Ae,maxBinNumber:o,maxRefLength:pe,skipLines:p,firstDataLine:x,columnNumbers:c,coordinateType:l,format:h,refIdToName:a,refNameToId:r,maxBlockSize:65536}}};var Me=9,xe=10,nt=13,mt=59,pt=60,gt=62,xt=6,wt=1024*2**20,bt=180*1e3;function Ct(i,e,t){if(i)return i;if(e)return new X(e);if(t)return new Y(t);throw new TypeError("must provide either filehandle, path, or url")}function yt({tbiFilehandle:i,csiFilehandle:e,tbiPath:t,csiPath:n,tbiUrl:s,csiUrl:o,path:r,url:a}){if(i)return new L({filehandle:i});if(e)return new $({filehandle:e});if(t)return new L({filehandle:new X(t)});if(n)return new $({filehandle:new X(n)});if(o)return new $({filehandle:new Y(o)});if(s)return new L({filehandle:new Y(s)});if(r)return new L({filehandle:new X(`${r}.tbi`)});if(a)return new L({filehandle:new Y(`${a}.tbi`)});throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl")}function it(i,e,t,n,s){return i[t]*256+(n-e[t])+s+1}function It(i,e,t,n,s,o,r){let a=n-t,l=e+a,h=0;if(i[s]===46)return l;let c=s;for(let d=s;d<=o;d++)if(d===o||i[d]===mt){let p=d-c;if(p>=10&&i[c]===83&&i[c+1]===86&&i[c+2]===84&&i[c+3]===89&&i[c+4]===80&&i[c+5]===69&&i[c+6]===61&&i[c+7]===84&&i[c+8]===82&&i[c+9]===65)return e+1;if(p>=4&&i[c]===69&&i[c+1]===78&&i[c+2]===68&&i[c+3]===61){let m=ge(i,c+4,d);m>e&&(l=m)}else p>=6&&i[c]===83&&i[c+1]===86&&i[c+2]===76&&i[c+3]===69&&i[c+4]===78&&i[c+5]===61&&(h=vt(i,c+6,d,n+1,r));c=d+1}return Math.max(l,e+h)}var et=44;function kt(i,e,t){if(t-e<5||i[e]!==60||i[t-1]!==62)return!1;let n=i[e+4];if(n!==62&&n!==58)return!1;let s=i[e+1],o=i[e+2],r=i[e+3];return s===67&&o===78&&r===86||s===68&&o===69&&r===76||s===68&&o===85&&r===80||s===73&&o===78&&r===86}function vt(i,e,t,n,s){let o=0,r=e,a=n;for(;r<t&&a<s;){let l=i.indexOf(et,r);(l===-1||l>t)&&(l=t);let h=i.indexOf(et,a);if((h===-1||h>s)&&(h=s),kt(i,a,h)){let c=ge(i,i[r]===45?r+1:r,l);c>o&&(o=c)}r=l+1,a=h+1}return o}var st=new TextDecoder;function tt(i,e){let t=-1,n=e.charCodeAt(0);for(let s=0,o=i.length;s<o;s++){let r=i[s];if(s===t+1&&r!==n)break;r===xe&&(t=s)}return i.subarray(0,t+1)}function St(i,e){let t=0;for(let n=0;n<e;n++){let s=i.indexOf(xe,t);if(s===-1){t=i.length;break}t=s+1}return st.decode(i.subarray(0,t)).split(/\r?\n/).slice(0,e)}function ge(i,e,t){let n=0;for(let s=e;s<t;s++){let o=i[s];if(o>=48&&o<=57)n=n*10+(o-48);else break}return n}function Pt(i,e,t,n,s,{start:o,end:r,pathCol:a,metaCharCode:l,decoder:h,callback:c}){let d=0,p=0;for(;d<i.length;){let m=i.indexOf(xe,d);if(m===-1)break;let f=d;d=m+1;let x=f+e+s;for(;p<n.length&&x>=n[p];)p++;if(i[f]===l)continue;let b=f;for(let g=1;g<a;g++){let C=i.indexOf(Me,b);if(C===-1||C>=m){b=m;break}b=C+1}let v=i[b];if(v!==gt&&v!==pt)continue;let y=i.indexOf(Me,b);(y===-1||y>m)&&(y=m);let I=1/0,u=-1,S=b;for(;S<y;){let g=0,C=S+1;for(;C<y;C++){let w=i[C]-48;if(w<0||w>9)break;g=g*10+w}g<I&&(I=g),g>u&&(u=g),S=C}if(I>=r)return!0;if(u>=o){let g=i[m-1]===nt?m-1:m;c(h.decode(i.subarray(f,g)),it(t,n,p,f+e,s),I,u+1)}}return!1}var W=class{filehandle;index;chunkCache;requested=new Map;headerCache=new z({});bgzfWorkerPool;constructor({path:e,filehandle:t,url:n,tbiPath:s,tbiUrl:o,tbiFilehandle:r,csiPath:a,csiUrl:l,csiFilehandle:h,chunkCacheSize:c=wt,chunkCacheIdleTimeoutMs:d=bt,chunkCacheBudget:p,bgzfWorkerPool:m}){this.bgzfWorkerPool=m,this.filehandle=Ct(t,e,n),this.index=yt({tbiFilehandle:r,csiFilehandle:h,tbiPath:s,csiPath:a,tbiUrl:o,csiUrl:l,path:e,url:n}),this.chunkCache=new z({maxSize:c,sizeOf:f=>{let x=0;for(let b of f.segments)x+=b.byteLength;return x},cacheKey:f=>f.toString(),idleTimeoutMs:d,budget:p,fill:(f,x)=>this.readChunk(f,{signal:x})})}clearChunkCache(){this.chunkCache.clear(),this.requested.clear()}withCachedContainers(e){if(this.requested.size>2*this.chunkCache.size)for(let[n,s]of this.requested)this.chunkCache.has(s)||this.requested.delete(n);let t=[];for(let n=0;n<e.length;n++){let s=e[n],o=t[t.length-1],r=e[n+1],a;if(!this.chunkCache.has(s))for(let l of this.requested.values())l.minv.compareTo(s.minv)<=0&&l.maxv.compareTo(s.maxv)>=0&&(!o||l.minv.compareTo(o.maxv)>=0)&&(!r||l.maxv.compareTo(r.minv)<=0)&&(!a||l.fetchedSize()<a.fetchedSize())&&this.chunkCache.has(l)&&(a=l);t.push(a??s)}return t}async bytesForRegions(e,t={}){let n=[];for(let{refName:o,start:r,end:a}of e){let l=await this.index.blocksForRange(o,r,a,t);for(let h of l)n.push(h)}let s=0;for(let o of le(n))s+=o.fetchedSize();return s}async getLines(e,t,n,s){let o,r={},a,l;typeof s=="function"?a=s:(r=s,a=s.lineCallback,o=s.signal,l=s.onProgress);let h=await this.index.getMetadata(r),c=t??0,d=n??h.maxRefLength;if(c>d)throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(c===d)return;let p=await this.index.blocksForRange(e,c,d,r),m=this.withCachedContainers(p),f=h.format==="VCF",x=h.columnNumbers.ref||0,b=h.columnNumbers.start||0,v=f?8:h.columnNumbers.end||0,y=Math.max(x,b,v),I=h.metaChar?.charCodeAt(0),u=h.coordinateType==="1-based-closed"?-1:0,S=new TextEncoder,g=new TextDecoder,C=S.encode(e),w=new Int32Array(y+1),F=h.format==="GAF"?{start:c,end:d,pathCol:b,metaCharCode:I,decoder:g,callback:a}:void 0,k=0;for(let E of m)k+=E.fetchedSize();let R=0;l?.(0,k);let T=1,_=[],U=E=>{for(;_.length<Math.min(E,m.length);){let K=m[_.length];this.requested.set(K.toString(),K);let j=this.chunkCache.get(K,o);j.catch(()=>{}),_.push(j)}};U(1);for(let E=0,K=m.length;E<K;E++){let j=m[E],Be=await _[E],{cpositions:Z,dpositions:V}=Be;R+=j.fetchedSize(),l?.(R,k);let we=j.minv.dataPosition,be=p[E],ee=Be.segments,te=0;if(be!==j){te=Pe(Z,V,be.minv);let P=Pe(Z,V,be.maxv)+1;ee=Ye(ee,te,P)}if(F){if(Se(ee,te,(P,ne)=>Pt(P,ne,Z,V,we,F)))return}else if(Se(ee,te,(P,ne)=>{let M=0,ie=0;for(;M<P.length;){let B=P.indexOf(xe,M);if(B===-1)break;let rt=M+ne+we;for(;ie<V.length&&rt>=V[ie];)ie++;if(I!==void 0&&P[M]===I){M=B+1;continue}w[0]=M-1;for(let N=0;N<y;N++){let oe=w[N],Ce=oe<B?P.indexOf(Me,oe+1):-1;w[N+1]=Ce===-1||Ce>=B?B:Ce}let Ne=w[x-1]+1,Re=w[x]-Ne;if(Re!==C.length){M=B+1;continue}let Ee=!0;for(let N=0;N<Re;N++)if(P[Ne+N]!==C[N]){Ee=!1;break}if(!Ee){M=B+1;continue}let se=ge(P,w[b-1]+1,w[b])+u;if(se>=d)return!0;let J;if(v===0||v===b?J=se+1:f?J=It(P,se,w[3]+1,w[4],w[v-1]+1,w[v],w[5]):J=ge(P,w[v-1]+1,w[v]),J>c){let N=P[B-1]===nt?B-1:B,oe=g.decode(P.subarray(M,N));a(oe,it(Z,V,ie,M+ne,we),se,J)}M=B+1}return!1}))return;T=Math.min(T*2,xt),U(E+1+T)}}async getMetadata(e={}){return this.index.getMetadata(e)}async readHeaderBytes(e){let{firstDataLine:t,maxBlockSize:n}=await this.getMetadata(e);if(t?.blockPosition===0&&t.dataPosition===0)return new Uint8Array(0);let s=(t?.blockPosition??0)+n,o=await this.filehandle.read(s,0,e);return ce(o)}async parseHeader(e){let{metaChar:t,skipLines:n=0}=await this.getMetadata(e),s=await this.readHeaderBytes(e);return{header:st.decode(t?tt(s,t):s),skippedLines:n>0?St(s,n):[]}}getParsedHeader(e={}){return this.headerCache.get("header",e.signal,t=>this.parseHeader({...e,signal:t}))}async getHeaderBuffer(e={}){let{metaChar:t}=await this.getMetadata(e),n=await this.readHeaderBytes(e);return t?tt(n,t):n}async getSkippedLines(e={}){let{skipLines:t=0}=await this.getMetadata(e);return t<=0?[]:(await this.getParsedHeader(e)).skippedLines}async getHeader(e={}){return(await this.getParsedHeader(e)).header}async getHeaderLines(e={}){let{header:t,skippedLines:n}=await this.getParsedHeader(e);return(t?t.split(/\r?\n/):n).filter(Boolean)}async getReferenceSequenceNames(e={}){return(await this.getMetadata(e)).refIdToName}async lineCount(e,t={}){return this.index.lineCount(e,t)}async readChunk(e,t={}){let n=await this.filehandle.read(e.fetchedSize(),e.minv.blockPosition,t);H(t.signal);let s=await this.bgzfWorkerPool;return qe(n,e,s)}};function Mn(i,e,t){let n=i.pluginManager;return new W({filehandle:ae(i.getConf(e),n),...Oe(i.getConf([...t,"location"]),i.getConf([...t,"indexType"]),n)})}function Bn(i){let e=i.getConf("walksIndex");return Tt(i.getConf("walksLocation"),Fe(e)?e:void 0,i.pluginManager)}function Tt(i,e,t){return $e.fromFilehandles({data:ae(i,t),directory:ae(e??Le(i,n=>`${n}.idx`),t)})}function Nn(i){return{names:e=>i.getReferenceSequenceNames(e),bytes:(e,t)=>Ve(i,e,t)}}function At(i){return`${i.assemblyName} ${i.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${i.assemblyName} mapped to its prefix in assemblyNameToPanSN`}var ot=class{constructor(e,t){this.source=e;this.adapter=t;this.lookup=je({setup:async e=>De(await this.source.names(e))})}async assemblyRefNames(e={}){let t=await this.source.names(e),n=re(this.adapter,e.assemblyName),s=t.filter(o=>ye(o,n)).map(o=>ze(o));return s.length>0?[...new Set(s)]:t}async resolve(e,t){let n=await this.lookup(t);return He(n,re(this.adapter,e.assemblyName),e.refName)}async resolveMapped(e,t){let n=await this.resolve(e,t);if(n===void 0&&e.assemblyName){let s=await this.source.names(t),o=re(this.adapter,e.assemblyName);if(s.length>0&&s.every(r=>r.includes("#"))&&!s.some(r=>ye(r,o)))throw new Error(At(e))}return n}async resolveForCut(e,t){let n=await this.resolveMapped(e,t);if(n===void 0)throw new Error(`This graph has nothing on ${e.assemblyName} ${e.refName}`);return n}async regionBytes(e,t={}){let n=[];for(let s of e){let o=await this.resolve(s,t);o!==void 0&&n.push({refName:o,start:s.start,end:s.end})}return this.source.bytes(n,t)}};export{Mt as a,je as b,Et as c,Mn as d,Bn as e,Tt as f,Nn as g,ot as h};
|
|
2
|
+
//# sourceMappingURL=chunk-UXBGMTAO.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Te,b as Pe,c as j,d as $e,e as Ye,f as Xe}from"./chunks/chunk-VV5LVNCP.js";import"./chunks/chunk-IK5G3JHR.js";import{B as Oe,O as Je,P as Ue,d as N,h as We,i as _e,t as m,v as De,y as X}from"./chunks/chunk-4MTS65XF.js";import"./chunks/chunk-G6DZANDH.js";import{b as d,g as V,h as ve,q as Ke}from"./chunks/chunk-OP2PTYDR.js";import{$a as E,Ca as K,Da as He,_a as Y,g as Me,hb as ze,i as M,j as R,k as Le,l as Fe,m as Ce,n as Ie,p as Be}from"./chunks/chunk-TP6OXTXD.js";import"./chunks/chunk-JWIFJIPZ.js";import"./chunks/chunk-MYJVR2OX.js";import"./chunks/chunk-4RZCYOCW.js";import"./chunks/chunk-NTXLYTF6.js";import{a as x,b as P,c as Ae,d as q,e as qe,f as v,g as Ze}from"./chunks/chunk-ZVMXECJA.js";import"./chunks/chunk-JM4W4PKP.js";import"./chunks/chunk-3GK5ZBUB.js";import"./chunks/chunk-LRBNBP2K.js";import"./chunks/chunk-YBLNN5FU.js";import"./chunks/chunk-ZLQEXXMV.js";import"./chunks/chunk-6TXZQA6S.js";import"./chunks/chunk-RQSCKHNS.js";import{b as Re,g as Ve}from"./chunks/chunk-YROUE32O.js";import{a as Ne,c as Ee,h as je}from"./chunks/chunk-D3QZGLZ3.js";import{d as O,e as a}from"./chunks/chunk-WKD7ALOU.js";import{a as Ge}from"./chunks/chunk-TMM73K4C.js";import"./chunks/chunk-D6TY2QEG.js";import"./chunks/chunk-YBLNN5FU.js";import{b as J,c as T,d as xe,g as I,h as U,i as Se}from"./chunks/chunk-EGZZ3ADM.js";import"./chunks/chunk-H5PFNYKH.js";import{f as he,g as ye,j as g,k as be,m as we}from"./chunks/chunk-5L276I7O.js";import{c as S}from"./chunks/chunk-J2PN6CG3.js";import{J as B}from"./chunks/chunk-H42TSPVA.js";import{a as ke,b as k,d as $}from"./chunks/chunk-DUU6T2I5.js";var H=JBrowseExports["@jbrowse/core/Plugin"];var Qe=H&&H.__esModule?H.default:H;var z=JBrowseExports["@jbrowse/core/pluggableElementTypes/AdapterType"];var u=z&&z.__esModule?z.default:z;var p=e=>({type:"fileLocation",defaultValue:{uri:e,locationType:"UriLocation"}}),l=(e,o="")=>d(e,{indexType:{model:a.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:p(o)});function A(e,o,t){return{indexType:t?"CSI":"TBI",location:{uri:`${e}.${t?"csi":"tbi"}`,baseUri:o}}}function G(e){let{walksUri:o,baseUri:t}=e;if(typeof o!="string")return e;let r=`${o}${T}`;return{...e,walksLocation:{uri:r,baseUri:t},walksIndex:{uri:`${r}.idx`,baseUri:t}}}var Lo=d("GbzBaseSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},gbzDbLocation:p("/path/to/graph.gbz.db"),haplotypeIndexLocation:p(""),readsLocation:p(""),readsIndex:l("GbzBaseReadsIndex"),samplesTsvLocation:p(""),subgraphSnarls:{type:"stringEnum",model:a.enumeration("SnarlOutput",["none","contained","overlapping"]),defaultValue:P.snarls},referenceSample:{type:"string",defaultValue:""},assemblyNameToPanSN:{type:"frozen",defaultValue:{}},context:{type:"number",defaultValue:P.context,advanced:!0},nodeLimit:{type:"number",defaultValue:P.limit,advanced:!0}},{explicitlyTyped:!0,preProcessSnapshot:e=>{let{uri:o,baseUri:t,reads:r}=e;return{...e,...o?{gbzDbLocation:{uri:o,baseUri:t}}:{},...typeof r=="string"?{readsLocation:{uri:r,baseUri:t},...Fo(r,t)}:{}}}});function Fo(e,o){let{name:t,query:r}=I(e);return t.endsWith(".gz")?{readsIndex:{location:{uri:`${t}.tbi${r}`,baseUri:o}}}:{}}var eo=Lo;function Z(e){e.addAdapterType(()=>new u({name:"GbzBaseSyntenyAdapter",displayName:"gbz-base pangenome adapter",configSchema:eo,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/GbzBaseSyntenyAdapter-JMYDJODG.js").then(o=>o.default)}))}var L=class extends R{constructor(){super(...arguments);this.name="GetGraphHaplotypes"}async execute(t){let{adapter:r}=await Ie(this.pluginManager,t,"getHaplotypeNames");return r?.getHaplotypeNames({signal:t.signal})}};var Co=S(()=>import("./chunks/AddTrackWorkflow-W7XIQ5F3.js"));function Q(e){e.addAddTrackWorkflowType(()=>new Me({name:"Pangenome graph track",displayName:"Add pangenome graph track",ReactComponent:Co,stateModel:a.model({})}))}var F=class extends R{constructor(){super(...arguments);this.name="GraphComputeLayout"}async execute(t){let{graph:r,options:n,signal:s,statusCallback:i}=t;return await new Promise(c=>setTimeout(c,0)),s?.throwIfAborted(),i?.("Computing layout"),ve({graph:r,options:n})}};var W=JBrowseExports["@jbrowse/core/pluggableElementTypes/ViewType"];var oo=W&&W.__esModule?W.default:W;var f=JBrowseExports["@jbrowse/core/util/withLaunchInput"],Io=e=>f!=null&&e in Object(f)?f[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/util/withLaunchInput' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),to=Io("defineLaunchKeys");var Bt=f&&f.__esModule?f.default:f;var h=JBrowseExports["@jbrowse/core/pluggableElementTypes/models"],Po=e=>h!=null&&e in Object(h)?h[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/pluggableElementTypes/models' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var ro=Po("BaseViewModel");var Vt=h&&h.__esModule?h.default:h;function ee(){return a.compose("GraphGenomeView",ro,$e,a.model({type:a.literal("GraphGenomeView"),gfaLocation:a.maybe(a.frozen()),loadedRegion:a.maybe(a.frozen()),loadedTrackId:a.optional(a.string,""),layoutMode:K(N),layoutEngine:He(V,"fmmm"),color:a.maybe(a.frozen()),size:a.maybe(a.frozen()),layers:a.maybe(a.frozen()),facet:a.maybe(a.frozen()),rows:a.maybe(a.frozen()),hover:K(j)})).views(e=>({get grammar(){return{layoutMode:e.layoutMode,layoutEngine:e.layoutEngine,encoding:{color:e.color},size:e.size,layers:e.layers,facet:e.facet,rows:e.rows,hover:e.hover}}})).actions(e=>({writeGrammar({encoding:o,...t}){Object.assign(e,o?{...t,color:o.color}:t)}})).volatile(()=>({widthMeasured:!1})).actions(e=>{let o=e.setWidth;return{setWidth(t){o(t),e.widthMeasured=!0}}}).views(e=>({get rpcSessionId(){return e.id},get paneWidth(){return e.width},get paneMeasured(){return e.widthMeasured},get sourceTrack(){return e.loadedTrackId?e.sessionTrack(e.loadedTrackId):void 0},get graphTracks(){return Xe(g(e).tracks)},get canRetryLoad(){return e.gfaLocation!==void 0||e.loadedTrackId!==""&&e.loadedRegion!==void 0}})).views(e=>({get hasPendingSource(){return e.canRetryLoad&&!e.graph&&!e.loadCanceled},menuItems(){return[...e.exportMenuItems(),...e.launchMenuItems()]}})).actions(e=>{let o=e.clearGraph;function t(r){if(e.gfaLocation)return e.displayName||e.setDisplayName(E(e.gfaLocation)),e.loadGFAFromLocation(e.gfaLocation,r);if(!e.loadedTrackId||!r)return;let n=e.sourceAdapter,s=r.end-r.start,i=e.offReference(r);if(!n)e.setError(new Error(`The track this graph was cut from, "${e.loadedTrackId}", is not in this session`));else if(i)e.setError(new Error(i));else if(s>e.maxRegionBp)e.setError(new Error(`Region too large (${Y(s)}) \u2014 zoom in to view graph (max ${Y(e.maxRegionBp)})`));else return e.markCut(),e.cutSubgraph(n,r,e.cutOptions)}return{clearGraph(){o(),e.gfaLocation&&e.displayName===E(e.gfaLocation)&&(e.displayName=void 0),e.gfaLocation=void 0,e.loadedRegion=void 0,e.loadedTrackId=""},load(){let r=e.loadedRegion,n=g(e),{assemblyManager:s}=n,i=r&&s.has(r.assemblyName)?s.get(r.assemblyName):void 0;return r&&i?.initialized===!1?s.waitForAssembly(r.assemblyName).catch(()=>{}).then(()=>O(e)&&e.loadedRegion===r?t(X(n,r)):void 0):t(r&&X(n,r))}}}).actions(e=>({retryLoad(){e.load()},setGfaLocation(o){e.gfaLocation=o},relayoutFrom(o){return e.loadedTrackId&&e.cutStale?e.load():e.recomputeLayout()},async openGfaLocation(o){await e.loadGFAFromLocation(o),O(e)&&e.hasGraph&&(this.setGfaLocation(o),e.displayName||e.setDisplayName(E(o)))},showTrackInLinearView(o,t,r){let n=g(e);Oe({session:n,trackId:o,assembly:t,loc:r}),we(n)&&n.removeView(e)},afterAttach(){e.graph||e.load()}}))}var Bo=to()({});function oe(e){e.addViewType(()=>new oo({name:"GraphGenomeView",displayName:"Graph genome view",stateModel:ee(),launchKeys:Bo,ReactComponent:S(()=>import("./chunks/GraphGenomeView-7KODXFCZ.js"))}))}var te=["MultiWaySyntenyDisplay","LinearSyntenyDisplay","DotplotDisplay","ChordSyntenyDisplay"];function Ro(e){let o=e.getElementTypesInGroup("display"),t=n=>o.find(s=>s.name===n),r=(n,s)=>s&&Object.assign(Object.create(s),{adapterCapabilities:[n]});return[t("LinearGraphDisplay"),r("referenceSegments",t("LinearBasicDisplay")),...te.map(n=>r("headerLanes",t(n)))].filter(n=>n!==void 0)}function re(e){e.addTrackType(()=>{let o=d("GraphTrack",{},{baseConfiguration:Fe(e),explicitIdentifier:"trackId"}),t=new Le({name:"GraphTrack",displayName:"Pangenome graph track",configSchema:o,stateModel:Ce(e,"GraphTrack",o)});for(let r of Ro(e))t.addDisplayType(r);return t})}function ne(e){e.addToExtensionPoint("LaunchView-GraphGenomeView",o=>{let{session:t,...r}=o;return t.addView("GraphGenomeView",r),o})}var _=JBrowseExports["@jbrowse/core/pluggableElementTypes/DisplayType"];var no=_&&_.__esModule?_.default:_;var y=JBrowseExports["@jbrowse/display-kit/heightModeConfigSchemaFields"],Vo=e=>y!=null&&e in Object(y)?y[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/heightModeConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),ao=Vo("heightModeConfigSchemaFields"),rr=y&&y.__esModule?y.default:y;var b=JBrowseExports["@jbrowse/display-kit/trackHeightConfigSchemaFields"],No=e=>b!=null&&e in Object(b)?b[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/trackHeightConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),io=No("trackHeightConfigSchemaFields"),ar=b&&b.__esModule?b.default:b;var w=JBrowseExports["@jbrowse/display-kit/facetConfigSchema"],Eo=e=>w!=null&&e in Object(w)?w[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/facetConfigSchema' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),so=Eo("facetConfigSchema");var sr=w&&w.__esModule?w.default:w;var po=d("GraphFacet",{columns:{type:"maybeNumber",description:"panels per row of a node layout's grid; unset fits them"}},{baseConfiguration:so});function co(){return d("LinearGraphDisplay",{layoutMode:{type:"stringEnum",model:a.enumeration("LayoutMode",N),defaultValue:"force"},layoutEngine:{type:"stringEnum",model:a.enumeration("LayoutEngine",V),defaultValue:"fmmm"},encoding:{type:"frozen",defaultValue:{},plot:!0},size:{type:"frozen",defaultValue:{field:"depth",value:6},plot:!0},layers:{type:"frozen",defaultValue:{},plot:!0},facet:po,rows:{type:"frozen",defaultValue:{},plot:!0},hover:{type:"stringEnum",model:a.enumeration("HoverHighlight",j),defaultValue:"nodes"},...io({defaultHeight:300,height:"the height of the track the graph is drawn in"}),...ao({heightMode:"how a force drawing the view's window places meets the track's height: `fit` shrinks the whole cut to the track's height; `fixed` draws it at the window's scale, so a zoom magnifies it, lowered only as far as keeps the reference the window shows inside the track, which it holds whole, and marks where what hangs off that reference runs past the top or bottom; `grow` does the same in a track grown to hold the cut, up to `growMaxHeight`",growMaxHeight:"the tallest `grow` makes the track, in px",defaultHeightMode:ze})},{explicitlyTyped:!0,explicitIdentifier:"displayId"})}function ae(e){e.addDisplayType(()=>{let o=co();return Object.assign(new no({name:"LinearGraphDisplay",displayName:"Graph",configSchema:o,stateModel:Ye(o),trackType:"GraphTrack",viewType:"LinearGenomeView",ReactComponent:S(()=>import("./chunks/LinearGraphDisplay-ZAIMEATG.js"))}),{adapterCapabilities:["getSubgraph"]})})}function jo(e){let{uri:o,baseUri:t,csi:r}=e;return typeof o=="string"?{...e,bubblesLocation:{uri:o,baseUri:t},index:A(o,t,r)}:e}var vo=d("MinigraphBubbleAdapter",{bubblesLocation:p("/path/to/graph.bb.bed.gz"),index:l("MinigraphBubbleIndex","/path/to/graph.bb.bed.gz.tbi"),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:jo}),mo=vo;function ie(e){e.addAdapterType(()=>new u({name:"MinigraphBubbleAdapter",displayName:"Minigraph bubble BED adapter",configSchema:mo,adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/MinigraphBubbleAdapter-N5BOXD7U.js").then(o=>o.default)}))}function lo(e){let{uri:o,baseUri:t,csi:r,format:n}=e;return typeof o!="string"?e:n===2?{...e,graphLocation:{uri:`${o}${J}`,baseUri:t},graphIndex:A(`${o}${J}`,t,r)}:{...e,segmentsLocation:{uri:`${o}.segs.bed.gz`,baseUri:t},segmentsIndex:A(`${o}.segs.bed.gz`,t,r),linksLocation:{uri:`${o}.links.bed.gz`,baseUri:t},linksIndex:A(`${o}.links.bed.gz`,t,r)}}function Ho(e){let{coarse:o,baseUri:t,csi:r}=e;return G(lo(typeof o=="object"&&o!==null?{...e,coarse:lo({baseUri:t,csi:r,...o})}:e))}var zo=d("RgfaTabixCoarseTier",{uri:{type:"maybeString"},format:{type:"maybeNumber"},aboveBpPerPx:{type:"maybeNumber"},foldBelowBp:{type:"maybeNumber"},segmentsLocation:p("/path/to/graph.tier.segs.bed.gz"),segmentsIndex:l("RgfaCoarseSegmentsIndex","/path/to/graph.tier.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.tier.links.bed.gz"),linksIndex:l("RgfaCoarseLinksIndex","/path/to/graph.tier.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaCoarseGraphIndex")}),Wo=d("RgfaTabixAdapter",{segmentsLocation:p("/path/to/graph.segs.bed.gz"),segmentsIndex:l("RgfaSegmentsIndex","/path/to/graph.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.links.bed.gz"),linksIndex:l("RgfaLinksIndex","/path/to/graph.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaGraphIndex"),walksLocation:p(""),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},assemblyNameToPanSN:{type:"frozen",defaultValue:{}},coarse:zo},{explicitlyTyped:!0,preProcessSnapshot:Ho}),uo=Wo;function se(e){e.addAdapterType(()=>new u({name:"RgfaTabixAdapter",displayName:"Indexed rGFA adapter",configSchema:uo,adapterCapabilities:["getSubgraph","referenceSegments"],adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/RgfaTabixAdapter-FZZ7W2HN.js").then(o=>o.default)}))}function go(e){return e.viewType==="LinearGenomeView"&&[e.trackType].flat().includes("VariantTrack")}var _o=[{label:"Auto",value:"auto"},{label:"50 bp",value:50},{label:"1 kb",value:1e3},{label:"10 kb",value:1e4}];function Do(e,o){return e?`Pinned to ${v(e)}${o===void 0?"":` \xB7 ${o} form${o===1?"":"s"}`}`:"Not pinned"}function Oo(e,o){let t=g(e),r=o.flatMap(n=>n?[Ze(n)]:[]);for(let{message:n}of[...t.snackbarMessages??[]])r.some(s=>n.startsWith(s))&&t.removeSnackbarMessage?.(n)}function Jo(e){return e.props({formsPinned:a.maybe(a.frozen()),formsFloorBp:a.maybe(a.frozen())}).views(o=>({get configuredAdapter(){return je(o.parentTrack.configuration)},get walkForms(){return this.configuredAdapter.type==="WalkFormsAdapter"}})).views(o=>({get pinnedAliases(){let t=q(o.formsPinned??o.configuredAdapter.pinned),[r]=Ge(o.parentTrack.configuration),n=t&&r?g(o).assemblyManager.get(r):void 0;return t&&n?n.getAliasesForRefName(t.refName):[]}})).views(o=>({get adapterConfig(){let t=o.configuredAdapter;return o.walkForms?{...t,...o.formsPinned?{pinned:o.formsPinned}:{},...o.pinnedAliases.length>0?{pinnedAliases:o.pinnedAliases}:{},...o.formsFloorBp===void 0?{}:{floorBp:o.formsFloorBp}}:t},get formsWindow(){return q(this.adapterConfig.pinned)},get formsFloor(){return qe(this.adapterConfig.floorBp)},get formsCount(){return o.sourcesBase?.reduce((t,r)=>t+(Number(r.forms)||1),0)},get visibleWindow(){let t=ye(o),r=We(t)?_e(t):void 0;return r&&r.end>r.start?{refName:r.refName,start:Math.max(0,Math.floor(r.start)),end:Math.ceil(r.end)}:void 0}})).volatile(()=>({warnedWindow:void 0})).actions(o=>{let{setSources:t}=o,r=()=>{Oo(o,[o.warnedWindow,o.formsWindow])};return{setFormsPinned(n){r(),o.formsPinned=n},setFormsFloorBp(n){r(),o.formsFloorBp=n},setSources(n,s){o.walkForms&&(r(),o.warnedWindow=o.formsWindow),t?.(n,s)}}}).views(o=>{let{trackMenuItems:t}=o;return{formsMenuItems(){let r=o.formsWindow,n=o.visibleWindow;return[{label:Do(r,o.formsCount),disabled:!0,onClick:()=>{}},{label:"Re-pin to visible region",helpText:"Cut the forms from the region the view shows. Panning and zooming leave the forms alone",disabled:!n||r!==void 0&&v(n)===v(r),onClick:()=>{n&&o.setFormsPinned(n)}},{label:"Hide changes under",subMenu:_o.map(({label:s,value:i})=>({label:s,type:"radio",checked:o.formsFloor===i,onClick:()=>{o.setFormsFloorBp(i)}}))}]},trackMenuItems(){return o.walkForms?[...t(),...this.formsMenuItems()]:t()}}})}function pe(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof M&&go(o)&&o.extendStateModel(Jo),o))}function fo(e){e.getElementTypesInGroup("display").some(t=>t instanceof M&&go(t))||console.warn("jbrowse-plugin-graphgenomeviewer: no linear VariantTrack display is registered, so WalkFormsAdapter tracks get no pin or floor menu")}var Uo=d("WalkFormsAdapter",{walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),pinned:{type:"frozen",defaultValue:{}},pinnedAliases:{type:"stringArray",defaultValue:[]},floorBp:{type:"frozen",defaultValue:"auto"},exclude:{type:"stringArray",defaultValue:[]},maxForms:{type:"integer",defaultValue:Ae},walkByteBudget:{type:"integer",defaultValue:15e5}},{explicitlyTyped:!0,preProcessSnapshot:G}),ho=Uo;function de(e){e.addAdapterType(()=>new u({name:"WalkFormsAdapter",displayName:"Walk-file structural forms adapter",configSchema:ho,adapterMetadata:{category:"Variant adapters"},getAdapterClass:()=>import("./chunks/WalkFormsAdapter-TZW5UBRI.js").then(o=>o.default)}))}var $o=d("WalkTabixSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:G}),yo=$o;function ce(e){e.addAdapterType(()=>new u({name:"WalkTabixSyntenyAdapter",displayName:"Walk-indexed graph adapter",configSchema:yo,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/WalkTabixSyntenyAdapter-XM7HBNJA.js").then(o=>o.default)}))}var Ko=".bubbles.bed.gz";function Yo(e){return U(e).toLowerCase().endsWith(".gbz.db")}function Xo(e,o,t){let r=U(e),n=i=>!t||t===i,s=o!==void 0||Se(e);return Yo(e)?n("GbzBaseSyntenyAdapter")?"GbzBaseSyntenyAdapter":void 0:Re(e)?n("RgfaTabixAdapter")?"RgfaTabixAdapter":void 0:s?r.endsWith(T)?t==="RgfaTabixAdapter"?"RgfaTabixWalks":n("WalkTabixSyntenyAdapter")?"WalkTabixSyntenyAdapter":void 0:n("MinigraphBubbleAdapter")&&(r.endsWith(Ko)||t!==void 0)?"MinigraphBubbleAdapter":void 0:void 0}function bo(e,o,t){let r=Xo(e,o,t);return r?Ve({choice:r,loc:e,indexLoc:o,assembly:"",sample:""}):void 0}function qo(e){let o=e.adapter;return o?.type!==void 0&&Je.has(o.type)&&!o.assemblyNames?.length&&Array.isArray(e.assemblyNames)&&e.assemblyNames.length>0?{...e,adapter:{...o,assemblyNames:e.assemblyNames}}:e}function Zo({walksUri:e,walksLocation:o}){let{uri:t,localPath:r,name:n}=m(o)?o:{};return typeof e=="string"&&e!==""?`${e}${T}`:typeof t=="string"?I(t).name:typeof r=="string"?r:typeof n=="string"?n:void 0}function Qo(e){let o=m(e.adapter)?e.adapter:void 0,[t]=Array.isArray(e.assemblyNames)?e.assemblyNames:[],r=o&&Ee(o)?Zo(o):void 0,n=r?xe(r):void 0;return o&&t&&n&&n!==t&&o.assemblyNameToPanSN===void 0?{...e,adapter:{...o,assemblyNameToPanSN:{[t]:n}}}:e}function me(e){e.addToExtensionPoint("Core-preProcessTrackConfig",qo),e.addToExtensionPoint("Core-preProcessTrackConfig",Qo),e.addToExtensionPoint("Core-guessAdapterForLocation",o=>(t,r,n)=>bo(t,r,n)??o(t,r,n)),e.addToExtensionPoint("Core-guessTrackTypeForLocation",o=>(t,r)=>Ne.has(t)?"GraphTrack":t==="MinigraphBubbleAdapter"?"FeatureTrack":o(t,r))}function le(e){let o;if(m(e)){let{refName:t,start:r,end:n,assemblyName:s}=e;typeof t=="string"&&typeof r=="number"&&typeof n=="number"&&(o={refName:t,start:r,end:n,assemblyName:typeof s=="string"?s:void 0})}return o}function et(e,o,t){let r=e.connectedViewId;return r===void 0||r===o||!t.has(r)}function wo(e,o){return e.assemblyName===void 0||o===void 0||o.includes(e.assemblyName)}function ko(e){return(Array.isArray(e.tracks)?e.tracks:[]).flatMap(t=>m(t)&&Array.isArray(t.displays)?t.displays.filter(r=>m(r)&&r.type==="LinearGraphDisplay"):[])}function To(e,o,t){let r=[],n=De(e),s=new Set(n.map(i=>m(i)?i.id:void 0));for(let i of n){if(m(i)&&i.id===o)for(let c of ko(i)){let C=le(c.hoverHighlight);C&&wo(C,t)&&r.push({key:typeof c.id=="string"?c.id:"graph-track",region:C})}for(let c of m(i)?[...ko(i),...i.type==="GraphGenomeView"?[i]:[]]:[])(Array.isArray(c.assemblyHoverHighlights)?c.assemblyHoverHighlights:[]).forEach((Go,Mo)=>{let D=le(Go);D?.assemblyName!==void 0&&t?.includes(D.assemblyName)&&r.push({key:`${typeof c.id=="string"?c.id:"graph"}-${Mo}`,region:D})});if(m(i)&&i.type==="GraphGenomeView"&&et(i,o,s)){let c=le(i.hoverHighlight);c&&wo(c,t)&&r.push({key:typeof i.id=="string"?i.id:"graph",region:c})}}return r}var ot=Ke()(e=>({highlight:{height:"100%",position:"absolute",background:B(e.palette.primary.main,.08),borderLeft:`1px solid ${B(e.palette.primary.main,.4)}`,borderRight:`1px solid ${B(e.palette.primary.main,.4)}`,pointerEvents:"none",zIndex:10}})),tt=$(function({model:o,region:t}){let{classes:r}=ot(),n=o.getHighlightCoords(t);return n?k("div",{"data-testid":"graph-node-highlight",className:r.highlight,style:{left:n.left,width:n.width}}):null}),rt=$(function({model:o}){let{views:t}=g(o);return k(ke,{children:To([...t],o.id,o.assemblyNames).map(({key:r,region:n})=>k(tt,{model:o,region:n},`graph-hover-${r}`))})}),xo=rt;var nt="LinearGenomeView-TracksContainerComponent";function ue(e){e.contributeToExtensionPoint(nt,({model:o})=>k(xo,{model:o},"graphgenomeview-hover-highlight"))}function at(e){return e.views(o=>({get adapterConfig(){return Ue(o,he(o).configuration)}}))}function ge(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof M&&te.includes(o.name)&&o.extendStateModel(at),o))}var So="GraphGenomeView";var Ao="10.0.3";var fe=class extends Qe{constructor(){super(...arguments);this.name=So;this.version=Ao}install(t){oe(t),ae(t),re(t),ne(t),ue(t),se(t),ie(t),Z(t),ce(t),de(t),pe(t),Q(t),me(t),ge(t),t.addRpcMethod(()=>new F(t)),t.addRpcMethod(()=>new Be(t)),t.addRpcMethod(()=>new Pe(t)),t.addRpcMethod(()=>new L(t))}configure(t){fo(t);try{be(t.rootModel)&&t.rootModel.appendToSubMenu(["Add"],{label:"Graph genome view",icon:Te,onClick:r=>{r.addView("GraphGenomeView",{})}})}catch(r){console.warn("[GraphGenomeView] could not add the Add menu entry",r)}}};export{fe as default};
|
|
1
|
+
import{a as Te,b as Pe,c as j,d as $e,e as Ye,f as Xe}from"./chunks/chunk-VV5LVNCP.js";import"./chunks/chunk-IK5G3JHR.js";import{B as Oe,O as Je,P as Ue,d as N,h as We,i as _e,t as m,v as De,y as X}from"./chunks/chunk-4MTS65XF.js";import"./chunks/chunk-G6DZANDH.js";import{b as d,g as V,h as ve,q as Ke}from"./chunks/chunk-OP2PTYDR.js";import{$a as E,Ca as K,Da as He,_a as Y,g as Me,hb as ze,i as M,j as R,k as Le,l as Fe,m as Ce,n as Ie,p as Be}from"./chunks/chunk-TP6OXTXD.js";import"./chunks/chunk-JWIFJIPZ.js";import"./chunks/chunk-MYJVR2OX.js";import"./chunks/chunk-4RZCYOCW.js";import"./chunks/chunk-NTXLYTF6.js";import{a as x,b as P,c as Ae,d as q,e as qe,f as v,g as Ze}from"./chunks/chunk-ZVMXECJA.js";import"./chunks/chunk-JM4W4PKP.js";import"./chunks/chunk-3GK5ZBUB.js";import"./chunks/chunk-LRBNBP2K.js";import"./chunks/chunk-YBLNN5FU.js";import"./chunks/chunk-ZLQEXXMV.js";import"./chunks/chunk-6TXZQA6S.js";import"./chunks/chunk-RQSCKHNS.js";import{b as Re,g as Ve}from"./chunks/chunk-YROUE32O.js";import{a as Ne,c as Ee,h as je}from"./chunks/chunk-D3QZGLZ3.js";import{d as O,e as a}from"./chunks/chunk-WKD7ALOU.js";import{a as Ge}from"./chunks/chunk-TMM73K4C.js";import"./chunks/chunk-D6TY2QEG.js";import"./chunks/chunk-YBLNN5FU.js";import{b as J,c as T,d as xe,g as I,h as U,i as Se}from"./chunks/chunk-EGZZ3ADM.js";import"./chunks/chunk-H5PFNYKH.js";import{f as he,g as ye,j as g,k as be,m as we}from"./chunks/chunk-5L276I7O.js";import{c as S}from"./chunks/chunk-J2PN6CG3.js";import{J as B}from"./chunks/chunk-H42TSPVA.js";import{a as ke,b as k,d as $}from"./chunks/chunk-DUU6T2I5.js";var H=JBrowseExports["@jbrowse/core/Plugin"];var Qe=H&&H.__esModule?H.default:H;var z=JBrowseExports["@jbrowse/core/pluggableElementTypes/AdapterType"];var u=z&&z.__esModule?z.default:z;var p=e=>({type:"fileLocation",defaultValue:{uri:e,locationType:"UriLocation"}}),l=(e,o="")=>d(e,{indexType:{model:a.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:p(o)});function A(e,o,t){return{indexType:t?"CSI":"TBI",location:{uri:`${e}.${t?"csi":"tbi"}`,baseUri:o}}}function G(e){let{walksUri:o,baseUri:t}=e;if(typeof o!="string")return e;let r=`${o}${T}`;return{...e,walksLocation:{uri:r,baseUri:t},walksIndex:{uri:`${r}.idx`,baseUri:t}}}var Lo=d("GbzBaseSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},gbzDbLocation:p("/path/to/graph.gbz.db"),haplotypeIndexLocation:p(""),readsLocation:p(""),readsIndex:l("GbzBaseReadsIndex"),samplesTsvLocation:p(""),subgraphSnarls:{type:"stringEnum",model:a.enumeration("SnarlOutput",["none","contained","overlapping"]),defaultValue:P.snarls},referenceSample:{type:"string",defaultValue:""},assemblyNameToPanSN:{type:"frozen",defaultValue:{}},context:{type:"number",defaultValue:P.context,advanced:!0},nodeLimit:{type:"number",defaultValue:P.limit,advanced:!0}},{explicitlyTyped:!0,preProcessSnapshot:e=>{let{uri:o,baseUri:t,reads:r}=e;return{...e,...o?{gbzDbLocation:{uri:o,baseUri:t}}:{},...typeof r=="string"?{readsLocation:{uri:r,baseUri:t},...Fo(r,t)}:{}}}});function Fo(e,o){let{name:t,query:r}=I(e);return t.endsWith(".gz")?{readsIndex:{location:{uri:`${t}.tbi${r}`,baseUri:o}}}:{}}var eo=Lo;function Z(e){e.addAdapterType(()=>new u({name:"GbzBaseSyntenyAdapter",displayName:"gbz-base pangenome adapter",configSchema:eo,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/GbzBaseSyntenyAdapter-X6AW5IYW.js").then(o=>o.default)}))}var L=class extends R{constructor(){super(...arguments);this.name="GetGraphHaplotypes"}async execute(t){let{adapter:r}=await Ie(this.pluginManager,t,"getHaplotypeNames");return r?.getHaplotypeNames({signal:t.signal})}};var Co=S(()=>import("./chunks/AddTrackWorkflow-47H3VBK4.js"));function Q(e){e.addAddTrackWorkflowType(()=>new Me({name:"Pangenome graph track",displayName:"Add pangenome graph track",ReactComponent:Co,stateModel:a.model({})}))}var F=class extends R{constructor(){super(...arguments);this.name="GraphComputeLayout"}async execute(t){let{graph:r,options:n,signal:s,statusCallback:i}=t;return await new Promise(c=>setTimeout(c,0)),s?.throwIfAborted(),i?.("Computing layout"),ve({graph:r,options:n})}};var W=JBrowseExports["@jbrowse/core/pluggableElementTypes/ViewType"];var oo=W&&W.__esModule?W.default:W;var f=JBrowseExports["@jbrowse/core/util/withLaunchInput"],Io=e=>f!=null&&e in Object(f)?f[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/util/withLaunchInput' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),to=Io("defineLaunchKeys");var Bt=f&&f.__esModule?f.default:f;var h=JBrowseExports["@jbrowse/core/pluggableElementTypes/models"],Po=e=>h!=null&&e in Object(h)?h[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/pluggableElementTypes/models' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var ro=Po("BaseViewModel");var Vt=h&&h.__esModule?h.default:h;function ee(){return a.compose("GraphGenomeView",ro,$e,a.model({type:a.literal("GraphGenomeView"),gfaLocation:a.maybe(a.frozen()),loadedRegion:a.maybe(a.frozen()),loadedTrackId:a.optional(a.string,""),layoutMode:K(N),layoutEngine:He(V,"fmmm"),color:a.maybe(a.frozen()),size:a.maybe(a.frozen()),layers:a.maybe(a.frozen()),facet:a.maybe(a.frozen()),rows:a.maybe(a.frozen()),hover:K(j)})).views(e=>({get grammar(){return{layoutMode:e.layoutMode,layoutEngine:e.layoutEngine,encoding:{color:e.color},size:e.size,layers:e.layers,facet:e.facet,rows:e.rows,hover:e.hover}}})).actions(e=>({writeGrammar({encoding:o,...t}){Object.assign(e,o?{...t,color:o.color}:t)}})).volatile(()=>({widthMeasured:!1})).actions(e=>{let o=e.setWidth;return{setWidth(t){o(t),e.widthMeasured=!0}}}).views(e=>({get rpcSessionId(){return e.id},get paneWidth(){return e.width},get paneMeasured(){return e.widthMeasured},get sourceTrack(){return e.loadedTrackId?e.sessionTrack(e.loadedTrackId):void 0},get graphTracks(){return Xe(g(e).tracks)},get canRetryLoad(){return e.gfaLocation!==void 0||e.loadedTrackId!==""&&e.loadedRegion!==void 0}})).views(e=>({get hasPendingSource(){return e.canRetryLoad&&!e.graph&&!e.loadCanceled},menuItems(){return[...e.exportMenuItems(),...e.launchMenuItems()]}})).actions(e=>{let o=e.clearGraph;function t(r){if(e.gfaLocation)return e.displayName||e.setDisplayName(E(e.gfaLocation)),e.loadGFAFromLocation(e.gfaLocation,r);if(!e.loadedTrackId||!r)return;let n=e.sourceAdapter,s=r.end-r.start,i=e.offReference(r);if(!n)e.setError(new Error(`The track this graph was cut from, "${e.loadedTrackId}", is not in this session`));else if(i)e.setError(new Error(i));else if(s>e.maxRegionBp)e.setError(new Error(`Region too large (${Y(s)}) \u2014 zoom in to view graph (max ${Y(e.maxRegionBp)})`));else return e.markCut(),e.cutSubgraph(n,r,e.cutOptions)}return{clearGraph(){o(),e.gfaLocation&&e.displayName===E(e.gfaLocation)&&(e.displayName=void 0),e.gfaLocation=void 0,e.loadedRegion=void 0,e.loadedTrackId=""},load(){let r=e.loadedRegion,n=g(e),{assemblyManager:s}=n,i=r&&s.has(r.assemblyName)?s.get(r.assemblyName):void 0;return r&&i?.initialized===!1?s.waitForAssembly(r.assemblyName).catch(()=>{}).then(()=>O(e)&&e.loadedRegion===r?t(X(n,r)):void 0):t(r&&X(n,r))}}}).actions(e=>({retryLoad(){e.load()},setGfaLocation(o){e.gfaLocation=o},relayoutFrom(o){return e.loadedTrackId&&e.cutStale?e.load():e.recomputeLayout()},async openGfaLocation(o){await e.loadGFAFromLocation(o),O(e)&&e.hasGraph&&(this.setGfaLocation(o),e.displayName||e.setDisplayName(E(o)))},showTrackInLinearView(o,t,r){let n=g(e);Oe({session:n,trackId:o,assembly:t,loc:r}),we(n)&&n.removeView(e)},afterAttach(){e.graph||e.load()}}))}var Bo=to()({});function oe(e){e.addViewType(()=>new oo({name:"GraphGenomeView",displayName:"Graph genome view",stateModel:ee(),launchKeys:Bo,ReactComponent:S(()=>import("./chunks/GraphGenomeView-ZTZEYNUY.js"))}))}var te=["MultiWaySyntenyDisplay","LinearSyntenyDisplay","DotplotDisplay","ChordSyntenyDisplay"];function Ro(e){let o=e.getElementTypesInGroup("display"),t=n=>o.find(s=>s.name===n),r=(n,s)=>s&&Object.assign(Object.create(s),{adapterCapabilities:[n]});return[t("LinearGraphDisplay"),r("referenceSegments",t("LinearBasicDisplay")),...te.map(n=>r("headerLanes",t(n)))].filter(n=>n!==void 0)}function re(e){e.addTrackType(()=>{let o=d("GraphTrack",{},{baseConfiguration:Fe(e),explicitIdentifier:"trackId"}),t=new Le({name:"GraphTrack",displayName:"Pangenome graph track",configSchema:o,stateModel:Ce(e,"GraphTrack",o)});for(let r of Ro(e))t.addDisplayType(r);return t})}function ne(e){e.addToExtensionPoint("LaunchView-GraphGenomeView",o=>{let{session:t,...r}=o;return t.addView("GraphGenomeView",r),o})}var _=JBrowseExports["@jbrowse/core/pluggableElementTypes/DisplayType"];var no=_&&_.__esModule?_.default:_;var y=JBrowseExports["@jbrowse/display-kit/heightModeConfigSchemaFields"],Vo=e=>y!=null&&e in Object(y)?y[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/heightModeConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),ao=Vo("heightModeConfigSchemaFields"),rr=y&&y.__esModule?y.default:y;var b=JBrowseExports["@jbrowse/display-kit/trackHeightConfigSchemaFields"],No=e=>b!=null&&e in Object(b)?b[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/trackHeightConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),io=No("trackHeightConfigSchemaFields"),ar=b&&b.__esModule?b.default:b;var w=JBrowseExports["@jbrowse/display-kit/facetConfigSchema"],Eo=e=>w!=null&&e in Object(w)?w[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/facetConfigSchema' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),so=Eo("facetConfigSchema");var sr=w&&w.__esModule?w.default:w;var po=d("GraphFacet",{columns:{type:"maybeNumber",description:"panels per row of a node layout's grid; unset fits them"}},{baseConfiguration:so});function co(){return d("LinearGraphDisplay",{layoutMode:{type:"stringEnum",model:a.enumeration("LayoutMode",N),defaultValue:"force"},layoutEngine:{type:"stringEnum",model:a.enumeration("LayoutEngine",V),defaultValue:"fmmm"},encoding:{type:"frozen",defaultValue:{},plot:!0},size:{type:"frozen",defaultValue:{field:"depth",value:6},plot:!0},layers:{type:"frozen",defaultValue:{},plot:!0},facet:po,rows:{type:"frozen",defaultValue:{},plot:!0},hover:{type:"stringEnum",model:a.enumeration("HoverHighlight",j),defaultValue:"nodes"},...io({defaultHeight:300,height:"the height of the track the graph is drawn in"}),...ao({heightMode:"how a force drawing the view's window places meets the track's height: `fit` shrinks the whole cut to the track's height; `fixed` draws it at the window's scale, so a zoom magnifies it, lowered only as far as keeps the reference the window shows inside the track, which it holds whole, and marks where what hangs off that reference runs past the top or bottom; `grow` does the same in a track grown to hold the cut, up to `growMaxHeight`",growMaxHeight:"the tallest `grow` makes the track, in px",defaultHeightMode:ze})},{explicitlyTyped:!0,explicitIdentifier:"displayId"})}function ae(e){e.addDisplayType(()=>{let o=co();return Object.assign(new no({name:"LinearGraphDisplay",displayName:"Graph",configSchema:o,stateModel:Ye(o),trackType:"GraphTrack",viewType:"LinearGenomeView",ReactComponent:S(()=>import("./chunks/LinearGraphDisplay-QWJZ5PSO.js"))}),{adapterCapabilities:["getSubgraph"]})})}function jo(e){let{uri:o,baseUri:t,csi:r}=e;return typeof o=="string"?{...e,bubblesLocation:{uri:o,baseUri:t},index:A(o,t,r)}:e}var vo=d("MinigraphBubbleAdapter",{bubblesLocation:p("/path/to/graph.bb.bed.gz"),index:l("MinigraphBubbleIndex","/path/to/graph.bb.bed.gz.tbi"),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:jo}),mo=vo;function ie(e){e.addAdapterType(()=>new u({name:"MinigraphBubbleAdapter",displayName:"Minigraph bubble BED adapter",configSchema:mo,adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/MinigraphBubbleAdapter-WUTIBCFA.js").then(o=>o.default)}))}function lo(e){let{uri:o,baseUri:t,csi:r,format:n}=e;return typeof o!="string"?e:n===2?{...e,graphLocation:{uri:`${o}${J}`,baseUri:t},graphIndex:A(`${o}${J}`,t,r)}:{...e,segmentsLocation:{uri:`${o}.segs.bed.gz`,baseUri:t},segmentsIndex:A(`${o}.segs.bed.gz`,t,r),linksLocation:{uri:`${o}.links.bed.gz`,baseUri:t},linksIndex:A(`${o}.links.bed.gz`,t,r)}}function Ho(e){let{coarse:o,baseUri:t,csi:r}=e;return G(lo(typeof o=="object"&&o!==null?{...e,coarse:lo({baseUri:t,csi:r,...o})}:e))}var zo=d("RgfaTabixCoarseTier",{uri:{type:"maybeString"},format:{type:"maybeNumber"},aboveBpPerPx:{type:"maybeNumber"},foldBelowBp:{type:"maybeNumber"},segmentsLocation:p("/path/to/graph.tier.segs.bed.gz"),segmentsIndex:l("RgfaCoarseSegmentsIndex","/path/to/graph.tier.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.tier.links.bed.gz"),linksIndex:l("RgfaCoarseLinksIndex","/path/to/graph.tier.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaCoarseGraphIndex")}),Wo=d("RgfaTabixAdapter",{segmentsLocation:p("/path/to/graph.segs.bed.gz"),segmentsIndex:l("RgfaSegmentsIndex","/path/to/graph.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.links.bed.gz"),linksIndex:l("RgfaLinksIndex","/path/to/graph.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaGraphIndex"),walksLocation:p(""),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},assemblyNameToPanSN:{type:"frozen",defaultValue:{}},coarse:zo},{explicitlyTyped:!0,preProcessSnapshot:Ho}),uo=Wo;function se(e){e.addAdapterType(()=>new u({name:"RgfaTabixAdapter",displayName:"Indexed rGFA adapter",configSchema:uo,adapterCapabilities:["getSubgraph","referenceSegments"],adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/RgfaTabixAdapter-VT7TYMNE.js").then(o=>o.default)}))}function go(e){return e.viewType==="LinearGenomeView"&&[e.trackType].flat().includes("VariantTrack")}var _o=[{label:"Auto",value:"auto"},{label:"50 bp",value:50},{label:"1 kb",value:1e3},{label:"10 kb",value:1e4}];function Do(e,o){return e?`Pinned to ${v(e)}${o===void 0?"":` \xB7 ${o} form${o===1?"":"s"}`}`:"Not pinned"}function Oo(e,o){let t=g(e),r=o.flatMap(n=>n?[Ze(n)]:[]);for(let{message:n}of[...t.snackbarMessages??[]])r.some(s=>n.startsWith(s))&&t.removeSnackbarMessage?.(n)}function Jo(e){return e.props({formsPinned:a.maybe(a.frozen()),formsFloorBp:a.maybe(a.frozen())}).views(o=>({get configuredAdapter(){return je(o.parentTrack.configuration)},get walkForms(){return this.configuredAdapter.type==="WalkFormsAdapter"}})).views(o=>({get pinnedAliases(){let t=q(o.formsPinned??o.configuredAdapter.pinned),[r]=Ge(o.parentTrack.configuration),n=t&&r?g(o).assemblyManager.get(r):void 0;return t&&n?n.getAliasesForRefName(t.refName):[]}})).views(o=>({get adapterConfig(){let t=o.configuredAdapter;return o.walkForms?{...t,...o.formsPinned?{pinned:o.formsPinned}:{},...o.pinnedAliases.length>0?{pinnedAliases:o.pinnedAliases}:{},...o.formsFloorBp===void 0?{}:{floorBp:o.formsFloorBp}}:t},get formsWindow(){return q(this.adapterConfig.pinned)},get formsFloor(){return qe(this.adapterConfig.floorBp)},get formsCount(){return o.sourcesBase?.reduce((t,r)=>t+(Number(r.forms)||1),0)},get visibleWindow(){let t=ye(o),r=We(t)?_e(t):void 0;return r&&r.end>r.start?{refName:r.refName,start:Math.max(0,Math.floor(r.start)),end:Math.ceil(r.end)}:void 0}})).volatile(()=>({warnedWindow:void 0})).actions(o=>{let{setSources:t}=o,r=()=>{Oo(o,[o.warnedWindow,o.formsWindow])};return{setFormsPinned(n){r(),o.formsPinned=n},setFormsFloorBp(n){r(),o.formsFloorBp=n},setSources(n,s){o.walkForms&&(r(),o.warnedWindow=o.formsWindow),t?.(n,s)}}}).views(o=>{let{trackMenuItems:t}=o;return{formsMenuItems(){let r=o.formsWindow,n=o.visibleWindow;return[{label:Do(r,o.formsCount),disabled:!0,onClick:()=>{}},{label:"Re-pin to visible region",helpText:"Cut the forms from the region the view shows. Panning and zooming leave the forms alone",disabled:!n||r!==void 0&&v(n)===v(r),onClick:()=>{n&&o.setFormsPinned(n)}},{label:"Hide changes under",subMenu:_o.map(({label:s,value:i})=>({label:s,type:"radio",checked:o.formsFloor===i,onClick:()=>{o.setFormsFloorBp(i)}}))}]},trackMenuItems(){return o.walkForms?[...t(),...this.formsMenuItems()]:t()}}})}function pe(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof M&&go(o)&&o.extendStateModel(Jo),o))}function fo(e){e.getElementTypesInGroup("display").some(t=>t instanceof M&&go(t))||console.warn("jbrowse-plugin-graphgenomeviewer: no linear VariantTrack display is registered, so WalkFormsAdapter tracks get no pin or floor menu")}var Uo=d("WalkFormsAdapter",{walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),pinned:{type:"frozen",defaultValue:{}},pinnedAliases:{type:"stringArray",defaultValue:[]},floorBp:{type:"frozen",defaultValue:"auto"},exclude:{type:"stringArray",defaultValue:[]},maxForms:{type:"integer",defaultValue:Ae},walkByteBudget:{type:"integer",defaultValue:15e5}},{explicitlyTyped:!0,preProcessSnapshot:G}),ho=Uo;function de(e){e.addAdapterType(()=>new u({name:"WalkFormsAdapter",displayName:"Walk-file structural forms adapter",configSchema:ho,adapterMetadata:{category:"Variant adapters"},getAdapterClass:()=>import("./chunks/WalkFormsAdapter-VRJ4FYQB.js").then(o=>o.default)}))}var $o=d("WalkTabixSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:G}),yo=$o;function ce(e){e.addAdapterType(()=>new u({name:"WalkTabixSyntenyAdapter",displayName:"Walk-indexed graph adapter",configSchema:yo,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/WalkTabixSyntenyAdapter-ZYWYXAC7.js").then(o=>o.default)}))}var Ko=".bubbles.bed.gz";function Yo(e){return U(e).toLowerCase().endsWith(".gbz.db")}function Xo(e,o,t){let r=U(e),n=i=>!t||t===i,s=o!==void 0||Se(e);return Yo(e)?n("GbzBaseSyntenyAdapter")?"GbzBaseSyntenyAdapter":void 0:Re(e)?n("RgfaTabixAdapter")?"RgfaTabixAdapter":void 0:s?r.endsWith(T)?t==="RgfaTabixAdapter"?"RgfaTabixWalks":n("WalkTabixSyntenyAdapter")?"WalkTabixSyntenyAdapter":void 0:n("MinigraphBubbleAdapter")&&(r.endsWith(Ko)||t!==void 0)?"MinigraphBubbleAdapter":void 0:void 0}function bo(e,o,t){let r=Xo(e,o,t);return r?Ve({choice:r,loc:e,indexLoc:o,assembly:"",sample:""}):void 0}function qo(e){let o=e.adapter;return o?.type!==void 0&&Je.has(o.type)&&!o.assemblyNames?.length&&Array.isArray(e.assemblyNames)&&e.assemblyNames.length>0?{...e,adapter:{...o,assemblyNames:e.assemblyNames}}:e}function Zo({walksUri:e,walksLocation:o}){let{uri:t,localPath:r,name:n}=m(o)?o:{};return typeof e=="string"&&e!==""?`${e}${T}`:typeof t=="string"?I(t).name:typeof r=="string"?r:typeof n=="string"?n:void 0}function Qo(e){let o=m(e.adapter)?e.adapter:void 0,[t]=Array.isArray(e.assemblyNames)?e.assemblyNames:[],r=o&&Ee(o)?Zo(o):void 0,n=r?xe(r):void 0;return o&&t&&n&&n!==t&&o.assemblyNameToPanSN===void 0?{...e,adapter:{...o,assemblyNameToPanSN:{[t]:n}}}:e}function me(e){e.addToExtensionPoint("Core-preProcessTrackConfig",qo),e.addToExtensionPoint("Core-preProcessTrackConfig",Qo),e.addToExtensionPoint("Core-guessAdapterForLocation",o=>(t,r,n)=>bo(t,r,n)??o(t,r,n)),e.addToExtensionPoint("Core-guessTrackTypeForLocation",o=>(t,r)=>Ne.has(t)?"GraphTrack":t==="MinigraphBubbleAdapter"?"FeatureTrack":o(t,r))}function le(e){let o;if(m(e)){let{refName:t,start:r,end:n,assemblyName:s}=e;typeof t=="string"&&typeof r=="number"&&typeof n=="number"&&(o={refName:t,start:r,end:n,assemblyName:typeof s=="string"?s:void 0})}return o}function et(e,o,t){let r=e.connectedViewId;return r===void 0||r===o||!t.has(r)}function wo(e,o){return e.assemblyName===void 0||o===void 0||o.includes(e.assemblyName)}function ko(e){return(Array.isArray(e.tracks)?e.tracks:[]).flatMap(t=>m(t)&&Array.isArray(t.displays)?t.displays.filter(r=>m(r)&&r.type==="LinearGraphDisplay"):[])}function To(e,o,t){let r=[],n=De(e),s=new Set(n.map(i=>m(i)?i.id:void 0));for(let i of n){if(m(i)&&i.id===o)for(let c of ko(i)){let C=le(c.hoverHighlight);C&&wo(C,t)&&r.push({key:typeof c.id=="string"?c.id:"graph-track",region:C})}for(let c of m(i)?[...ko(i),...i.type==="GraphGenomeView"?[i]:[]]:[])(Array.isArray(c.assemblyHoverHighlights)?c.assemblyHoverHighlights:[]).forEach((Go,Mo)=>{let D=le(Go);D?.assemblyName!==void 0&&t?.includes(D.assemblyName)&&r.push({key:`${typeof c.id=="string"?c.id:"graph"}-${Mo}`,region:D})});if(m(i)&&i.type==="GraphGenomeView"&&et(i,o,s)){let c=le(i.hoverHighlight);c&&wo(c,t)&&r.push({key:typeof i.id=="string"?i.id:"graph",region:c})}}return r}var ot=Ke()(e=>({highlight:{height:"100%",position:"absolute",background:B(e.palette.primary.main,.08),borderLeft:`1px solid ${B(e.palette.primary.main,.4)}`,borderRight:`1px solid ${B(e.palette.primary.main,.4)}`,pointerEvents:"none",zIndex:10}})),tt=$(function({model:o,region:t}){let{classes:r}=ot(),n=o.getHighlightCoords(t);return n?k("div",{"data-testid":"graph-node-highlight",className:r.highlight,style:{left:n.left,width:n.width}}):null}),rt=$(function({model:o}){let{views:t}=g(o);return k(ke,{children:To([...t],o.id,o.assemblyNames).map(({key:r,region:n})=>k(tt,{model:o,region:n},`graph-hover-${r}`))})}),xo=rt;var nt="LinearGenomeView-TracksContainerComponent";function ue(e){e.contributeToExtensionPoint(nt,({model:o})=>k(xo,{model:o},"graphgenomeview-hover-highlight"))}function at(e){return e.views(o=>({get adapterConfig(){return Ue(o,he(o).configuration)}}))}function ge(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof M&&te.includes(o.name)&&o.extendStateModel(at),o))}var So="GraphGenomeView";var Ao="10.0.4";var fe=class extends Qe{constructor(){super(...arguments);this.name=So;this.version=Ao}install(t){oe(t),ae(t),re(t),ne(t),ue(t),se(t),ie(t),Z(t),ce(t),de(t),pe(t),Q(t),me(t),ge(t),t.addRpcMethod(()=>new F(t)),t.addRpcMethod(()=>new Be(t)),t.addRpcMethod(()=>new Pe(t)),t.addRpcMethod(()=>new L(t))}configure(t){fo(t);try{be(t.rootModel)&&t.rootModel.appendToSubMenu(["Add"],{label:"Graph genome view",icon:Te,onClick:r=>{r.addView("GraphGenomeView",{})}})}catch(r){console.warn("[GraphGenomeView] could not add the Add menu entry",r)}}};export{fe as default};
|
|
2
2
|
//# sourceMappingURL=jbrowse-plugin-graphgenomeviewer.esm.js.map
|