"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6214],{86214:(e,t,s)=>{s.r(t),s.d(t,{default:()=>d});var r=s(60972),a=s(46377),n=s(99834),i=s(66885),o=s(68120),c=s(4101);class d 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"]),d=this.getConf("autoSql"),l=this.pluginManager;this.bed=new o.wD({filehandle:(0,n.openLocation)(a,l),csiFilehandle:"CSI"===i?(0,n.openLocation)(c,l):void 0,tbiFilehandle:"CSI"!==i?(0,n.openLocation)(c,l):void 0,chunkCacheSize:52428800}),this.columnNames=this.getConf("columnNames"),this.scoreColumn=this.getConf("scoreColumn"),this.parser=new r.A({autoSql:d})}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,d=await this.getNames();await this.bed.getLines(e.refName,e.start,e.end,{lineCallback:(e,t)=>{s.next((0,c.d)(e,n,i,o,this.scoreColumn,this.parser,`${this.id}-${t}`,d))},signal:t.signal}),s.complete()}),t.signal)}freeResources(){}}},4101:(e,t,s)=>{s.d(t,{B:()=>a,d:()=>n});var r=s(99546);function a(e){const t=e.children(),s=e.get("thickStart"),a=e.get("thickEnd"),n=e.get("refName");if(!s&&!a)return e;const i=t?t.filter((e=>"block"===e.get("type"))).sort(((e,t)=>e.get("start")-t.get("start"))):[],o=[];i.forEach((t=>{const r=t.get("start"),i=t.get("end");if(s>=i){const t=e.get("strand")>0?"five":"three";o.push({type:`${t}_prime_UTR`,start:r,end:i,refName:n})}else if(s>r&&s<i&&a>=i){const t=e.get("strand")>0?"five":"three";o.push({type:`${t}_prime_UTR`,start:r,end:s,refName:n},{type:"CDS",start:s,end:i,refName:n})}else if(s<=r&&a>=i)o.push({type:"CDS",start:r,end:i,refName:n});else if(s>r&&s<i&&a<i){const t=e.get("strand")>0?"five":"three",c=e.get("strand")>0?"three":"five";o.push({type:`${t}_prime_UTR`,start:r,end:s,refName:n},{type:"CDS",start:s,end:a,refName:n},{type:`${c}_prime_UTR`,start:a,end:i,refName:n})}else if(s<=r&&a>r&&a<i){const t=e.get("strand")>0?"three":"five";o.push({type:"CDS",start:r,end:a,refName:n},{type:`${t}_prime_UTR`,start:a,end:i,refName:n})}else if(a<=r){const t=e.get("strand")>0?"three":"five";o.push({type:`${t}_prime_UTR`,start:r,end:i,refName:n})}}));const c=Object.fromEntries(e.tags().map((t=>[t,e.get(t)])));return c.subfeatures=o,c.type="mRNA",c.uniqueId=e.id(),delete c.chromStarts,delete c.chromStart,delete c.chromEnd,delete c.chrom,delete c.blockStarts,delete c.blockSizes,delete c.blockCount,delete c.thickStart,delete c.thickEnd,new r.SimpleFeature({data:c,id:e.id()})}function n(e,t,s,n,i,o,c,d){const l=e.split("\t"),u=l[t],h=+l[s],m=s===n?1:0,f=+l[n]+m,p=d?function(e,t){return Object.fromEntries(t.split("\t").map(((t,s)=>[e[s],t])))}(d,e):o.parseLine(e,{uniqueId:c}),{blockCount:g,blockSizes:b,blockStarts:N,chromStarts:S}=p;if(g){const e=S||N||[],t=b,s=h;p.subfeatures=[];for(let r=0;r<g;r+=1){const a=(e[r]||0)+s,n=a+(t[r]||0);p.subfeatures.push({uniqueId:`${c}-${r}`,start:a,end:n,refName:u,type:"block"})}}i&&(p.score=+p[i]),delete p.chrom,delete p.chromStart,delete p.chromEnd;const C=new r.SimpleFeature({...p,start:h,end:f,refName:u,uniqueId:c});return C.get("thickStart")?a(C):C}}}]);
//# sourceMappingURL=6214.a77ca84f.chunk.js.map