"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[9409],{69409:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var a=n(46377),s=n(99834),r=n(99546),o=n(66885),i=n(6434),c=n(78054);class u extends a.BaseFeatureDataAdapter{static capabilities=["getFeatures","getRefNames"];async setup(e){return this.setupP||(this.setupP=this.setupPre(e).catch((e=>{throw this.setupP=void 0,e}))),this.setupP}async setupPre(e){const t=this.getConf("assemblyNames"),n=this.pluginManager,a=(0,s.openLocation)(this.getConf("bed1Location"),n),r=(0,s.openLocation)(this.getConf("bed2Location"),n),o=(0,s.openLocation)(this.getConf("mcscanSimpleAnchorsLocation"),n),[i,u,f]=await Promise.all([a,r,o].map((t=>(0,c.TA)(t,e)))),l=(0,c.fY)(i),m=(0,c.fY)(u);return{assemblyNames:t,feats:f.split(/\n|\r\n|\r/).filter((e=>!!e&&"###"!==e)).map(((e,t)=>{const[n,a,s,r,o,i]=e.split("\t"),c=l.get(n),u=l.get(a),f=m.get(s),p=m.get(r);if(!(c&&u&&f&&p))throw new Error(`feature not found, ${n} ${a} ${s} ${r} ${c} ${u} ${f} ${p}`);return[c,u,f,p,+o,"-"===i?-1:1,t]}))}}async hasDataForRefName(){return!0}async getRefNames(){return[]}getFeatures(e,t={}){return(0,o.ObservableCreate)((async n=>{const{assemblyNames:a,feats:s}=await this.setup(t),o=a.indexOf(e.assemblyName);if(-1!==o){const t=0===o;s.forEach((s=>{const[o,c,u,f,l,m,p]=s;let d={refName:o.refName,start:Math.min(o.start,c.start),end:Math.max(o.end,c.end)},h={refName:u.refName,start:Math.min(u.start,f.start),end:Math.max(u.end,f.end)};t||([h,d]=[d,h]),d.refName===e.refName&&(0,r.doesIntersect2)(d.start,d.end,e.start,e.end)&&n.next(new i.A({...d,uniqueId:`${p}`,syntenyId:p,assemblyName:a[+!t],score:l,strand:m,mate:{...h,assemblyName:a[+t]}}))}))}n.complete()}))}freeResources(){}}},78054:(e,t,n)=>{n.d(t,{PX:()=>u,TA:()=>o,fY:()=>r,gJ:()=>m,qm:()=>l,xI:()=>f,yU:()=>i});var a=n(7706),s=n(99546);function r(e){return new Map(e.split(/\n|\r\n|\r/).filter((e=>!!e||e.startsWith("#"))).map((e=>{const[t,n,a,s,r,o]=e.split("\t");return[s,{refName:t,start:+n,end:+a,score:+r,name:s,strand:"-"===o?-1:1}]})))}async function o(e,t){const n=await e.readFile(t);return new TextDecoder("utf8",{fatal:!0}).decode((0,s.isGzip)(n)?await(0,a.unzip)(n):n)}function i(e,t){return e.map(((e,n)=>[e,t[n]]))}const c="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function u(e,t){let n=0;const a=[];for(;n<e.length;){const s=e.indexOf("\n",n);if(-1===s)break;const r=e.subarray(n,s),o=(c?.decode(r)||r.toString()).trim();o&&a.push(t(o)),n=s+1}return a}function f(e){const[t,,n,a,s,r,,o,i,c,u,f,...l]=e.split("\t");return{tname:r,tstart:+o,tend:+i,qname:t,qstart:+n,qend:+a,strand:"-"===s?-1:1,extra:{numMatches:+c,blockLen:+u,mappingQual:+f,...Object.fromEntries(l.map((e=>{const t=e.indexOf(":");return[e.slice(0,t),e.slice(t+3)]})))}}}function l(e){const t=[];for(let n=e.length-2;n>=0;n-=2){t.push(e[n]);const a=e[n+1];"D"===a?t.push("I"):"I"===a?t.push("D"):t.push(a)}return t}function m(e){return e.replaceAll("D","K").replaceAll("I","D").replaceAll("K","I")}}}]);
//# sourceMappingURL=9409.b1123788.chunk.js.map