"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,Vl:()=>o,dE:()=>i,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 d=e.split("\t"),m=d[t],f=+d[s],p=s===i?1:0,b=+d[i]+p,k=h?function(e,t){const s=Object.fromEntries(t.split("\t").map(((t,s)=>[e[s],t]))),{blockStarts:r,blockCount:a,chromStarts:n,thickEnd:i,thickStart:o,blockSizes:c,...l}=s;return{...l,blockStarts:r?.split(",").map((e=>+e)),chromStarts:n?.split(",").map((e=>+e)),blockSizes:c?.split(",").map((e=>+e)),thickStart:o?+o:void 0,thickEnd:i?+i:void 0,blockCount:a?+a:void 0}}(h,e):l.parseLine(e,{uniqueId:u}),{blockCount:S,blockSizes:C,blockStarts:N,chromStarts:g,thickStart:y,thickEnd:_,type:v,score:w,chrom:R,chromStart:z,chromEnd:E,...$}=k,T=S?n({start:f,uniqueId:u,refName:m,chromStarts:g,blockCount:S,blockSizes:C,blockStarts:N}):[],q={...$,type:v,score:c?+k[c]:w,start:f,end:b,refName:m,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.0ed0ac32.chunk.js.map