"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7439],{18340:(e,t,s)=>{s.d(t,{P:()=>r});var n=s(99546);function r(e,t,s=()=>{}){const r=new TextDecoder("utf8");let a=0,i=0;for(;a<e.length;){const o=e.indexOf(10,a),d=-1===o?e.length:o,c=e.subarray(a,d),l=r.decode(c).trim();if(l&&!1===t(l,i))break;i++%1e4==0&&s(`Loading ${(0,n.getProgressDisplayStr)(a,e.length)}`),a=d+1}}},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(18340),d=s(66885),c=s(72147);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"),s=[],r=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 d=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"),c=t[s],l=t[n],u=t[r],m=t[a],f=t[i],h=t[o];if(!(c&&l&&u&&m&&f&&h))return console.warn("Invalid BLAST line"),void console.warn(e);const g={qseqid:c,sseqid:l,qstart:Number.parseInt(u),qend:Number.parseInt(m),sstart:Number.parseInt(f),send:Number.parseInt(h)};for(const[e,s]of d.entries()){const n=t[s];n&&(g[e]=n)}return g}}(t);return(0,o.P)(await(0,a.fetchAndMaybeUnzip)((0,i.openLocation)((0,n.readConfObject)(this.config,"blastTableLocation"),this.pluginManager),e),e=>{const t=r(e);return t&&s.push(t),!0},e?.statusCallback),s}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,d.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 m,f,h,g,q,b,w,p;const{qseqid:y,sseqid:N,qstart:x,qend:A,sstart:O,send:C,...M}=t;d===r?(m=x,f=A,h=y,g=r,q=O,b=C,w=N,p=i):(m=O,f=C,h=N,g=i,q=x,b=A,w=y,p=r);let I=1,v=1;m>f&&([m,f]=[f,m],I=-1),q>b&&([q,b]=[b,q],v=-1),h===o&&(0,a.doesIntersect2)(l,u,m,f)&&s.next(new c.A({uniqueId:e+d,assemblyName:g,start:m,end:f,type:"match",refName:h,strand:I*v,syntenyId:e,...M,mate:{start:q,end:b,refName:w,assemblyName:p}}))}s.complete()})}}},72147:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(99546),r=s(55689);const{getMismatches:a}=r.aF;class i extends n.SimpleFeature{get(e){return"mismatches"===e?a(this.get("CIGAR")):super.get(e)}}}}]);
//# sourceMappingURL=7439.58d2edfc.chunk.js.map