"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(35505),a=s(46377),r=s(99546),i=s(99834),c=s(66885),o=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"]),c=this.getConf(["index","location"]),o=this.pluginManager;this.pif=new n.wD({filehandle:(0,i.openLocation)(a,o),csiFilehandle:"CSI"===r?(0,i.openLocation)(c,o):void 0,tbiFilehandle:"CSI"!==r?(0,i.openLocation)(c,o):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,c.ObservableCreate)((async n=>{const{assemblyName:a}=e,i=this.getAssemblyNames(),c=0===i.indexOf(a),u=c?"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,h=s.tstart,d=s.tend,{extra:p,strand:g}=s,{numMatches:b=0,blockLen:y=1,cg:C,...w}=p;n.next(new o.A({uniqueId:t+a,assemblyName:a,start:u,end:m,type:"match",refName:r,strand:g,...w,CIGAR:p.cg,syntenyId:t,identity:b/y,numMatches:b,blockLen:y,mate:{start:h,end:d,refName:f,assemblyName:i[+c]}}))},stopToken:t.stopToken}))),n.complete()}))}freeResources(){}}},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:()=>c,TA:()=>r,fY:()=>a,gJ:()=>u,qm:()=>l,xI:()=>o,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 c(e,t,s){const{statusCallback:a=()=>{}}=s||{};let r=0;const i=[],c=new TextDecoder("utf8");let o=0;for(;r<e.length;){const s=e.indexOf(10,r);if(-1===s)break;const l=e.subarray(r,s),u=c.decode(l).trim();if(u){const e=t(u);e&&i.push(e)}o++%1e4==0&&a(`Loading ${(0,n.getProgressDisplayStr)(r,e.length)}`),r=s+1}return i}function o(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.decede5b.chunk.js.map