"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 s=n(46377),a=n(99834),r=n(99546),o=n(66885),i=n(6434),c=n(78054);class u extends s.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,s=(0,a.openLocation)(this.getConf("bed1Location"),n),r=(0,a.openLocation)(this.getConf("bed2Location"),n),o=(0,a.openLocation)(this.getConf("mcscanSimpleAnchorsLocation"),n),[i,u,f]=await Promise.all([s,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,s,a,r,o,i]=e.split("\t"),c=l.get(n),u=l.get(s),f=m.get(a),p=m.get(r);if(!(c&&u&&f&&p))throw new Error(`feature not found, ${n} ${s} ${a} ${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:s,feats:a}=await this.setup(t),o=s.indexOf(e.assemblyName);if(-1!==o){const t=0===o;a.forEach((a=>{const[o,c,u,f,l,m,p]=a;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:s[+!t],score:l,strand:m,mate:{...h,assemblyName:s[+t]}}))}))}n.complete()}))}freeResources(){}}},78054:(e,t,n)=>{n.d(t,{PX:()=>u,TA:()=>o,bf:()=>a,fY:()=>r,gJ:()=>m,qm:()=>l,xI:()=>f,yU:()=>i});var s=n(7706);function a(e){return 31===e[0]&&139===e[1]&&8===e[2]}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,o]=e.split("\t");return[a,{refName:t,start:+n,end:+s,score:+r,name:a,strand:"-"===o?-1:1}]})))}async function o(e,t){const n=await e.readFile(t);return new TextDecoder("utf8",{fatal:!0}).decode(a(n)?await(0,s.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 s=[];for(;n<e.length;){const a=e.indexOf("\n",n);if(-1===a)break;const r=e.slice(n,a),o=(c?.decode(r)||r.toString()).trim();o&&s.push(t(o)),n=a+1}return s}function f(e){const[t,,n,s,a,r,,o,i,c,u,f,...l]=e.split("\t");return{tname:r,tstart:+o,tend:+i,qname:t,qstart:+n,qend:+s,strand:"-"===a?-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 s=e[n+1];"D"===s?t.push("I"):"I"===s?t.push("D"):t.push(s)}return t}function m(e){return e.replaceAll("D","K").replaceAll("I","D").replaceAll("K","I")}}}]);
//# sourceMappingURL=9409.1fc2453a.chunk.js.map