"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[3167],{23167:(e,t,n)=>{n.r(t),n.d(t,{default:()=>l});var s=n(46377),a=n(66885),r=n(99834),i=n(68120),c=n(78054),o=n(72147);class l extends s.BaseFeatureDataAdapter{static capabilities=["getFeatures","getRefNames"];constructor(e,t,n){super(e,t,n);const s=this.getConf("pifGzLocation"),a=this.getConf(["index","indexType"]),c=this.getConf(["index","location"]),o=this.pluginManager;this.pif=new i.wD({filehandle:(0,r.openLocation)(s,o),csiFilehandle:"CSI"===a?(0,r.openLocation)(c,o):void 0,tbiFilehandle:"CSI"!==a?(0,r.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 n=this.getAssemblyNames().indexOf(t),s=await this.pif.getReferenceSequenceNames(e);return 0===n?s.filter((e=>e.startsWith("q"))).map((e=>e.slice(1))):1===n?s.filter((e=>e.startsWith("t"))).map((e=>e.slice(1))):[]}getFeatures(e,t={}){return(0,a.ObservableCreate)((async n=>{const{assemblyName:s}=e,a=this.getAssemblyNames(),r=0===a.indexOf(s),i=r?"q":"t";await this.pif.getLines(i+e.refName,e.start,e.end,{lineCallback:(e,t)=>{const i=(0,c.xI)(e),l=i.qname.slice(1),u=i.qstart,m=i.qend,d=i.tname,f=i.tstart,h=i.tend,{extra:p,strand:g}=i,{numMatches:b=0,blockLen:y=1,cg:w,...x}=p;n.next(new o.A({uniqueId:t+s,assemblyName:s,start:u,end:m,type:"match",refName:l,strand:g,...x,CIGAR:p.cg,syntenyId:t,identity:b/y,numMatches:b,blockLen:y,mate:{start:f,end:h,refName:d,assemblyName:a[+r]}}))},signal:t.signal}),n.complete()}))}freeResources(){}}},72147:(e,t,n)=>{n.d(t,{A:()=>i});var s=n(99546),a=n(82727);const{getMismatches:r}=a.aF;class i extends s.SimpleFeature{get(e){return"mismatches"===e?r(this.get("CIGAR")):super.get(e)}}},78054:(e,t,n)=>{n.d(t,{PX:()=>l,TA:()=>i,fY:()=>r,gJ:()=>d,qm:()=>m,xI:()=>u,yU:()=>c});var s=n(7706),a=n(99546);function r(e){return new Map(e.split(/\n|\r\n|\r/).filter((e=>!!e||e.startsWith("#"))).map((e=>{const[t,n,s,a,r,i]=e.split("\t");return[a,{refName:t,start:+n,end:+s,score:+r,name:a,strand:"-"===i?-1:1}]})))}async function i(e,t){const n=await e.readFile(t);return new TextDecoder("utf8",{fatal:!0}).decode((0,a.isGzip)(n)?await(0,s.unzip)(n):n)}function c(e,t){return e.map(((e,n)=>[e,t[n]]))}const o="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function l(e,t){let n=0;const s=[];for(;n<e.length;){const a=e.indexOf("\n",n);if(-1===a)break;const r=e.subarray(n,a),i=(o?.decode(r)||r.toString()).trim();i&&s.push(t(i)),n=a+1}return s}function u(e){const[t,,n,s,a,r,,i,c,o,l,u,...m]=e.split("\t");return{tname:r,tstart:+i,tend:+c,qname:t,qstart:+n,qend:+s,strand:"-"===a?-1:1,extra:{numMatches:+o,blockLen:+l,mappingQual:+u,...Object.fromEntries(m.map((e=>{const t=e.indexOf(":");return[e.slice(0,t),e.slice(t+3)]})))}}}function m(e){const t=[];for(let n=e.length-2;n>=0;n-=2){t.push(e[n]);const s=e[n+1];"D"===s?t.push("I"):"I"===s?t.push("D"):t.push(s)}return t}function d(e){return e.replaceAll("D","K").replaceAll("I","D").replaceAll("K","I")}}}]);
//# sourceMappingURL=3167.312d0953.chunk.js.map