"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[3167],{23167:(e,t,s)=>{s.r(t),s.d(t,{default:()=>u});var n=s(75466),a=s(46377),r=s(99546),i=s(99834),o=s(66885),c=s(72147),l=s(78054);class u extends a.BaseFeatureDataAdapter{static capabilities=["getFeatures","getRefNames"];constructor(e,t,s){super(e,t,s);const a=this.getConf("pifGzLocation"),r=this.getConf(["index","indexType"]),o=this.getConf(["index","location"]),c=this.pluginManager;this.pif=new n.wD({filehandle:(0,i.openLocation)(a,c),csiFilehandle:"CSI"===r?(0,i.openLocation)(o,c):void 0,tbiFilehandle:"CSI"!==r?(0,i.openLocation)(o,c):void 0,chunkCacheSize:52428800})}async getHeader(){return this.pif.getHeader()}getAssemblyNames(){const e=this.getConf("assemblyNames");return 0===e.length?[this.getConf("queryAssembly"),this.getConf("targetAssembly")]:e}async hasDataForRefName(){return!0}async getRefNames(e={}){const t=e.regions?.[0]?.assemblyName;if(!t)throw new Error("no assembly name provided");const s=this.getAssemblyNames().indexOf(t),n=await this.pif.getReferenceSequenceNames(e);return 0===s?n.filter((e=>e.startsWith("q"))).map((e=>e.slice(1))):1===s?n.filter((e=>e.startsWith("t"))).map((e=>e.slice(1))):[]}getFeatures(e,t={}){const{statusCallback:s=()=>{}}=t;return(0,o.ObservableCreate)((async n=>{const{assemblyName:a}=e,i=this.getAssemblyNames(),o=0===i.indexOf(a),u=o?"q":"t";await(0,r.updateStatus)("Downloading features",s,(()=>this.pif.getLines(u+e.refName,e.start,e.end,{lineCallback:(e,t)=>{const s=(0,l.xI)(e),r=s.qname.slice(1),u=s.qstart,m=s.qend,f=s.tname,p=s.tstart,h=s.tend,{extra:d,strand:g}=s,{numMatches:b=0,blockLen:y=1,cg:w,...C}=d;n.next(new c.A({uniqueId:t+a,assemblyName:a,start:u,end:m,type:"match",refName:r,strand:g,...C,CIGAR:d.cg,syntenyId:t,identity:b/y,numMatches:b,blockLen:y,mate:{start:p,end:h,refName:f,assemblyName:i[+o]}}))},stopToken:t.stopToken}))),n.complete()}))}}},72147:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(99546),a=s(27087);const{getMismatches:r}=a.aF;class i extends n.SimpleFeature{get(e){return"mismatches"===e?r(this.get("CIGAR")):super.get(e)}}},78054:(e,t,s)=>{s.d(t,{PX:()=>o,TA:()=>r,fY:()=>a,gJ:()=>u,qm:()=>l,xI:()=>c,yU:()=>i});var n=s(99546);function a(e){return new Map(e.split(/\n|\r\n|\r/).filter((e=>!!e||e.startsWith("#"))).map((e=>{const[t,s,n,a,r,i]=e.split("\t");return[a,{refName:t,start:+s,end:+n,score:+r,name:a,strand:"-"===i?-1:1}]})))}async function r(e,t){return(0,n.fetchAndMaybeUnzipText)(e,t)}function i(e,t){return e.map(((e,s)=>[e,t[s]]))}function o(e,t,s){const{statusCallback:a=()=>{}}=s||{};let r=0;const i=[],o=new TextDecoder("utf8");let c=0,l=performance.now();for(;r<e.length;){const s=e.indexOf(10,r);if(-1===s)break;const u=e.subarray(r,s),m=o.decode(u).trim();if(m){const e=t(m);e&&i.push(e)}c++%1e4==0&&performance.now()-l>50&&(a(`Loading ${(0,n.getProgressDisplayStr)(r,e.length)}`),l=performance.now()),r=s+1}return a(""),i}function c(e){const t=e.split("\t"),s=t.slice(12),n={numMatches:+t[9],blockLen:+t[10],mappingQual:+t[11]};if(s.length)for(const e of s){const t=e.indexOf(":");n[e.slice(0,t)]=e.slice(t+3)}return{tname:t[5],tstart:+t[7],tend:+t[8],qname:t[0],qstart:+t[2],qend:+t[3],strand:"-"===t[4]?-1:1,extra:n}}function l(e){const t=[];for(let s=e.length-2;s>=0;s-=2){t.push(e[s]);const n=e[s+1];"D"===n?t.push("I"):"I"===n?t.push("D"):t.push(n)}return t}function u(e){return e.replaceAll("D","K").replaceAll("I","D").replaceAll("K","I")}}}]);
//# sourceMappingURL=3167.35d0903c.chunk.js.map