"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7439],{67439:(e,t,s)=>{s.r(t),s.d(t,{default:()=>l});var n=s(68584),r=s(46377),a=s(99546),i=s(99834),o=s(66885),c=s(72147),d=s(78054);class l extends r.BaseFeatureDataAdapter{static capabilities=["getFeatures","getRefNames"];getData(e){return this.data||(this.data=this.setup(e).catch((e=>{throw this.data=void 0,e}))),this.data}async setup(e){const t=(0,n.readConfObject)(this.config,"columns");return(0,d.PX)(await(0,a.fetchAndMaybeUnzip)((0,i.openLocation)((0,n.readConfObject)(this.config,"blastTableLocation"),this.pluginManager),e),function(e){const t=e.trim().split(" "),s=t.indexOf("qseqid");if(-1===s)throw new Error('Missing required column "qseqid"');const n=t.indexOf("sseqid");if(-1===n)throw new Error('Missing required column "sseqid"');const r=t.indexOf("qstart");if(-1===r)throw new Error('Missing required column "qstart"');const a=t.indexOf("qend");if(-1===a)throw new Error('Missing required column "qend"');const i=t.indexOf("sstart");if(-1===i)throw new Error('Missing required column "sstart"');const o=t.indexOf("send");if(-1===o)throw new Error('Missing required column "send"');const c=new Map(t.map(((e,t)=>[e,t])).filter((e=>!["qseqid","sseqid","qstart","qend","sstart","send"].includes(e[0]))));return e=>{if(e.startsWith("#"))return;const t=e.split("\t"),d=t[s],l=t[n],u=t[r],f=t[a],m=t[i],h=t[o];if(!(d&&l&&u&&f&&m&&h))return console.warn("Invalid BLAST line"),void console.warn(e);const p={qseqid:d,sseqid:l,qstart:Number.parseInt(u),qend:Number.parseInt(f),sstart:Number.parseInt(m),send:Number.parseInt(h)};for(const[e,s]of c.entries()){const n=t[s];n&&(p[e]=n)}return p}}(t),e)}async hasDataForRefName(){return!0}getAssemblyNames(){const e=this.getConf("assemblyNames");return 0===e.length?[this.getConf("queryAssembly"),this.getConf("targetAssembly")]:e}async getRefNames(e={}){const t=e.regions?.[0].assemblyName,s=await this.getData(e),n=this.getAssemblyNames().indexOf(t);if(-1!==n){const e=new Set;for(const t of s)e.add(0===n?t.qseqid:t.sseqid);return[...e]}return console.warn("Unable to do ref renaming on adapter"),[]}getFeatures(e,t={}){return(0,o.ObservableCreate)((async s=>{const n=await this.getData(t),[r,i]=this.getAssemblyNames(),{refName:o,assemblyName:d,start:l,end:u}=e;if(d!==i&&d!==r)return console.warn(`${d} not found in this adapter`),void s.complete();for(let e=0;e<n.length;e++){const t=n[e];let f,m,h,p,g,q,b,w;const{qseqid:y,sseqid:N,qstart:x,qend:A,sstart:I,send:M,...O}=t;d===r?(f=x,m=A,h=y,p=r,g=I,q=M,b=N,w=i):(f=I,m=M,h=N,p=i,g=x,q=A,b=y,w=r);let D=1,C=1;f>m&&([f,m]=[m,f],D=-1),g>q&&([g,q]=[q,g],C=-1),h===o&&(0,a.doesIntersect2)(l,u,f,m)&&s.next(new c.A({uniqueId:e+d,assemblyName:p,start:f,end:m,type:"match",refName:h,strand:D*C,syntenyId:e,...O,mate:{start:g,end:q,refName:b,assemblyName:w}}))}s.complete()}))}}},72147:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(99546),r=s(27087);const{getMismatches:a}=r.aF;class i extends n.SimpleFeature{get(e){return"mismatches"===e?a(this.get("CIGAR")):super.get(e)}}},78054:(e,t,s)=>{s.d(t,{PX:()=>o,TA:()=>a,fY:()=>r,gJ:()=>l,qm:()=>d,xI:()=>c,yU:()=>i});var n=s(99546);function r(e){return new Map(e.split(/\n|\r\n|\r/).filter((e=>!!e||e.startsWith("#"))).map((e=>{const[t,s,n,r,a,i]=e.split("\t");return[r,{refName:t,start:+s,end:+n,score:+a,name:r,strand:"-"===i?-1:1}]})))}async function a(e,t){return(0,n.fetchAndMaybeUnzipText)(e,t)}function i(e,t){return e.map(((e,s)=>[e,t[s]]))}function o(e,t,s){const{statusCallback:r=()=>{}}=s||{};let a=0;const i=[],o=new TextDecoder("utf8");let c=0,d=performance.now();for(;a<e.length;){const s=e.indexOf(10,a);if(-1===s)break;const l=e.subarray(a,s),u=o.decode(l).trim();if(u){const e=t(u);e&&i.push(e)}c++%1e4==0&&performance.now()-d>50&&(r(`Loading ${(0,n.getProgressDisplayStr)(a,e.length)}`),d=performance.now()),a=s+1}return r(""),i}function c(e){const t=e.split("\t"),s=t.slice(12),n={numMatches:+t[9],blockLen:+t[10],mappingQual:+t[11]};if(s.length)for(const e of s){const t=e.indexOf(":");n[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:n}}function d(e){const t=[];for(let s=e.length-2;s>=0;s-=2){t.push(e[s]);const n=e[s+1];"D"===n?t.push("I"):"I"===n?t.push("D"):t.push(n)}return t}function l(e){return e.replaceAll("D","K").replaceAll("I","D").replaceAll("K","I")}}}]);
//# sourceMappingURL=7439.65b3d611.chunk.js.map