"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[8965],{28965:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var s=n(46377),a=n(99834),r=n(99546),o=n(66885),c=n(78054);class i 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("mcscanAnchorsLocation"),n),[i,u,l]=await Promise.all([s,r,o].map((t=>(0,c.TA)(t,e)))),f=(0,c.fY)(i),p=(0,c.fY)(u);return{assemblyNames:t,feats:l.split(/\n|\r\n|\r/).filter((e=>!!e&&"###"!==e)).map(((e,t)=>{const[n,s,a]=e.split("\t"),r=f.get(n),o=p.get(s);if(!r||!o)throw new Error(`feature not found, ${n} ${s} ${r} ${o}`);return[r,o,+a,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[c,i,u,l]=a,[f,p]=t?[c,i]:[i,c];f.refName===e.refName&&(0,r.doesIntersect2)(e.start,e.end,f.start,f.end)&&n.next(new r.SimpleFeature({...f,uniqueId:`${o}-${l}`,syntenyId:l,strand:f.strand*p.strand,assemblyName:s[+!t],score:u,mate:{...p,assemblyName:s[+t]}}))}))}n.complete()}))}freeResources(){}}},78054:(e,t,n)=>{n.d(t,{PX:()=>u,TA:()=>o,bf:()=>a,fY:()=>r,gJ:()=>p,qm:()=>f,xI:()=>l,yU:()=>c});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 c(e,t){return e.map(((e,n)=>[e,t[n]]))}const i="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=(i?.decode(r)||r.toString()).trim();o&&s.push(t(o)),n=a+1}return s}function l(e){const[t,,n,s,a,r,,o,c,i,u,l,...f]=e.split("\t");return{tname:r,tstart:+o,tend:+c,qname:t,qstart:+n,qend:+s,strand:"-"===a?-1:1,extra:{numMatches:+i,blockLen:+u,mappingQual:+l,...Object.fromEntries(f.map((e=>{const t=e.indexOf(":");return[e.slice(0,t),e.slice(t+3)]})))}}}function f(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 p(e){return e.replaceAll("D","K").replaceAll("I","D").replaceAll("K","I")}}}]);
//# sourceMappingURL=8965.677fcab9.chunk.js.map