"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6214],{86214:(e,t,s)=>{s.r(t),s.d(t,{default:()=>l});var r=s(60972),a=s(46377),n=s(99834),i=s(66885),o=s(68120),c=s(4101);class l extends a.BaseFeatureDataAdapter{static capabilities=["getFeatures","getRefNames"];constructor(e,t,s){super(e,t,s);const a=this.getConf("bedGzLocation"),i=this.getConf(["index","indexType"]),c=this.getConf(["index","location"]),l=this.getConf("autoSql"),u=this.pluginManager;this.bed=new o.wD({filehandle:(0,n.openLocation)(a,u),csiFilehandle:"CSI"===i?(0,n.openLocation)(c,u):void 0,tbiFilehandle:"CSI"!==i?(0,n.openLocation)(c,u):void 0,chunkCacheSize:52428800}),this.columnNames=this.getConf("columnNames"),this.scoreColumn=this.getConf("scoreColumn"),this.parser=new r.A({autoSql:l})}async getRefNames(e={}){return this.bed.getReferenceSequenceNames(e)}async getHeader(){return this.bed.getHeader()}async getNames(){if(this.columnNames.length)return this.columnNames;const e=(await this.bed.getHeader()).split(/\n|\r\n|\r/).filter((e=>!!e)).at(-1);return e?.includes("\t")?e.slice(1).split("\t").map((e=>e.trim())):void 0}getFeatures(e,t={}){return(0,i.ObservableCreate)((async s=>{const r=await this.bed.getMetadata(),{columnNumbers:a}=r,n=a.ref-1,i=a.start-1,o=a.end-1,l=await this.getNames();await this.bed.getLines(e.refName,e.start,e.end,{lineCallback:(e,t)=>{s.next((0,c.dE)(e,n,i,o,this.scoreColumn,this.parser,`${this.id}-${t}`,l))},signal:t.signal}),s.complete()}),t.signal)}freeResources(){}}},4101:(e,t,s)=>{s.d(t,{BX:()=>a,dE:()=>i,xD:()=>o,zZ:()=>n});var r=s(99546);function a(e){const{subfeatures:t,thickStart:s,thickEnd:r,blockCount:a,blockSizes:n,chromStarts:i,refName:o,strand:c=0,...l}=e;if(!s||!r||!c)return e;const u=[];return t.filter((e=>"block"===e.type)).sort(((e,t)=>e.start-t.start))?.forEach((e=>{const t=e.start,a=e.end;if(s>=a){const e=c>0?"five":"three";u.push({type:`${e}_prime_UTR`,start:t,end:a,refName:o})}else if(s>t&&s<a&&r>=a){const e=c>0?"five":"three";u.push({type:`${e}_prime_UTR`,start:t,end:s,refName:o},{type:"CDS",start:s,end:a,refName:o})}else if(s<=t&&r>=a)u.push({type:"CDS",start:t,end:a,refName:o});else if(s>t&&s<a&&r<a){const e=c>0?"five":"three",n=c>0?"three":"five";u.push({type:`${e}_prime_UTR`,start:t,end:s,refName:o},{type:"CDS",start:s,end:r,refName:o},{type:`${n}_prime_UTR`,start:r,end:a,refName:o})}else if(s<=t&&r>t&&r<a){const e=c>0?"three":"five";u.push({type:"CDS",start:t,end:r,refName:o},{type:`${e}_prime_UTR`,start:r,end:a,refName:o})}else if(r<=t){const e=c>0?"three":"five";u.push({type:`${e}_prime_UTR`,start:t,end:a,refName:o})}})),{...l,strand:c,type:"mRNA",refName:o,subfeatures:u}}function n({start:e,uniqueId:t,refName:s,chromStarts:r,blockCount:a,blockSizes:n,blockStarts:i}){const o=[],c=r||i||[];for(let r=0;r<a;r++){const a=(c[r]||0)+e,i=a+(n?.[r]||0);o.push({uniqueId:`${t}-${r}`,start:a,end:i,refName:s,type:"block"})}return o}function i(e,t,s,i,c,l,u,h){const m=e.split("\t"),d=m[t],f=+m[s],p=s===i?1:0,b=+m[i]+p,k=h?function(e,t){const{blockStarts:s,blockCount:r,chromStarts:a,thickEnd:n,thickStart:i,blockSizes:o,...c}=Object.fromEntries(t.split("\t").map(((t,s)=>[e[s],t])));return{...c,blockStarts:s?.split(",").map((e=>+e)),chromStarts:a?.split(",").map((e=>+e)),blockSizes:o?.split(",").map((e=>+e)),thickStart:+i,thickEnd:+n,blockCount:+r}}(h,e):l.parseLine(e,{uniqueId:u}),{blockCount:S,blockSizes:C,blockStarts:N,chromStarts:g,thickStart:y,thickEnd:_,type:w,score:v,chrom:R,chromStart:z,chromEnd:E,...$}=k,T=S?n({start:f,uniqueId:u,refName:d,chromStarts:g,blockCount:S,blockSizes:C,blockStarts:N}):[],q={...$,type:w,score:c?+k[c]:v,start:f,end:b,refName:d,uniqueId:u,subfeatures:T};return new r.SimpleFeature({id:u,data:o(k)?a({thickStart:y,thickEnd:_,blockCount:S,blockSizes:C,chromStarts:g,...q}):q})}function o(e){return e.thickStart&&e.blockCount&&0!==e.strand}}}]);
//# sourceMappingURL=6214.f865dd70.chunk.js.map