"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[9409],{69409:(e,t,s)=>{s.r(t),s.d(t,{default:()=>f});var a=s(46377),n=s(99546),r=s(99834),o=s(66885),i=s(6434),c=s(78054);class f 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"),s=this.pluginManager,a=(0,r.openLocation)(this.getConf("bed1Location"),s),n=(0,r.openLocation)(this.getConf("bed2Location"),s),o=(0,r.openLocation)(this.getConf("mcscanSimpleAnchorsLocation"),s),[i,f,l]=await Promise.all([a,n,o].map((t=>(0,c.TA)(t,e)))),u=(0,c.fY)(i),m=(0,c.fY)(f);return{assemblyNames:t,feats:l.split(/\n|\r\n|\r/).filter((e=>!!e&&"###"!==e)).map(((e,t)=>{const[s,a,n,r,o,i]=e.split("\t"),c=u.get(s),f=u.get(a),l=m.get(n),d=m.get(r);if(!(c&&f&&l&&d))throw new Error(`feature not found, ${s} ${a} ${n} ${r} ${c} ${f} ${l} ${d}`);return[c,f,l,d,+o,"-"===i?-1:1,t]}))}}async hasDataForRefName(){return!0}getAssemblyNames(){return this.getConf("assemblyNames")}async getRefNames(e={}){const t=e.regions?.[0].assemblyName,{feats:s}=await this.setup(e),a=this.getAssemblyNames().indexOf(t);if(-1!==a){const e=new Set;for(const t of s)0===a?(e.add(t[0].refName),e.add(t[1].refName)):(e.add(t[2].refName),e.add(t[3].refName));return[...e]}return console.warn("Unable to do ref renaming on adapter"),[]}getFeatures(e,t={}){return(0,o.ObservableCreate)((async s=>{const{assemblyNames:a,feats:r}=await this.setup(t),o=a.indexOf(e.assemblyName);if(-1!==o){const t=0===o;for(const o of r){const[r,c,f,l,u,m,d]=o;let p={refName:r.refName,start:Math.min(r.start,c.start),end:Math.max(r.end,c.end)},h={refName:f.refName,start:Math.min(f.start,l.start),end:Math.max(f.end,l.end)};t||([h,p]=[p,h]),p.refName===e.refName&&(0,n.doesIntersect2)(p.start,p.end,e.start,e.end)&&s.next(new i.A({...p,uniqueId:`${d}`,syntenyId:d,assemblyName:a[+!t],score:u,strand:m,mate:{...h,assemblyName:a[+t]}}))}}s.complete()}))}freeResources(){}}},78054:(e,t,s)=>{s.d(t,{PX:()=>i,TA:()=>r,fY:()=>n,gJ:()=>l,qm:()=>f,xI:()=>c,yU:()=>o});var a=s(99546);function n(e){return new Map(e.split(/\n|\r\n|\r/).filter((e=>!!e||e.startsWith("#"))).map((e=>{const[t,s,a,n,r,o]=e.split("\t");return[n,{refName:t,start:+s,end:+a,score:+r,name:n,strand:"-"===o?-1:1}]})))}async function r(e,t){return(0,a.fetchAndMaybeUnzipText)(e,t)}function o(e,t){return e.map(((e,s)=>[e,t[s]]))}function i(e,t,s){const{statusCallback:n=()=>{}}=s||{};let r=0;const o=[],i=new TextDecoder("utf8");let c=0;for(;r<e.length;){const s=e.indexOf(10,r);if(-1===s)break;const f=e.subarray(r,s),l=i.decode(f).trim();if(l){const e=t(l);e&&o.push(e)}c++%1e4==0&&n(`Loading ${(0,a.getProgressDisplayStr)(r,e.length)}`),r=s+1}return o}function c(e){const t=e.split("\t"),s=t.slice(12),a={numMatches:+t[9],blockLen:+t[10],mappingQual:+t[11]};if(s.length)for(const e of s){const t=e.indexOf(":");a[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:a}}function f(e){const t=[];for(let s=e.length-2;s>=0;s-=2){t.push(e[s]);const a=e[s+1];"D"===a?t.push("I"):"I"===a?t.push("D"):t.push(a)}return t}function l(e){return e.replaceAll("D","K").replaceAll("I","D").replaceAll("K","I")}}}]);
//# sourceMappingURL=9409.466d7a22.chunk.js.map