(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[4731],{67072:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>h});var a=s(56798),n=s(19881),r=s(59062),i=s(16979),d=s(85291),o=s(40441),l=s(46922),c=s(43800);const h=class extends a.BaseFeatureDataAdapter{constructor(e,t,s){super(e,t,s),this.gff=void 0,this.dontRedispatch=void 0;const a=(0,c.readConfObject)(e,"gffGzLocation"),n=(0,c.readConfObject)(e,["index","indexType"]),i=(0,c.readConfObject)(e,["index","location"]),d=(0,c.readConfObject)(e,"dontRedispatch");this.dontRedispatch=d||["chromosome","contig","region"],this.gff=new o.pC({filehandle:(0,r.openLocation)(a,this.pluginManager),csiFilehandle:"CSI"===n?(0,r.openLocation)(i,this.pluginManager):void 0,tbiFilehandle:"CSI"!==n?(0,r.openLocation)(i,this.pluginManager):void 0,chunkCacheSize:52428800,renameRefSeqs:e=>e})}async getRefNames(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.gff.getReferenceSequenceNames(e)}async getHeader(){return this.gff.getHeader()}getFeatures(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,i.ObservableCreate)((async s=>{const a=await this.gff.getMetadata();await this.getFeaturesHelper(e,t,a,s,!0)}),t.signal)}async getFeaturesHelper(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e;try{const d=[];if(await this.gff.getLines(e.refName,e.start,e.end,((e,t)=>{d.push(this.parseLine(s.columnNumbers,e,t))})),r&&d.length){let n=1/0,r=-1/0;if(d.forEach((e=>{const t=e.fields[2];if(!this.dontRedispatch.includes(t)){const t=e.start-1;t<n&&(n=t),e.end>r&&(r=e.end)}})),r>e.end||n<e.start)return void await this.getFeaturesHelper({...e,start:n,end:r},t,s,a,!1,e)}const o=d.map((e=>(e.fields[8]&&"."!==e.fields[8]?e.fields[8].includes("_lineHash")||(e.fields[8]+=";_lineHash=".concat(e.lineHash)):e.fields[8]="_lineHash=".concat(e.lineHash),e.fields.join("\t")))).join("\n");l.Z.parseStringSync(o,{parseFeatures:!0,parseComments:!1,parseDirectives:!1,parseSequences:!1,disableDerivesFromReferences:!0}).forEach((e=>this.formatFeatures(e).forEach((e=>{(0,n.qY)(e.get("start"),e.get("end"),i.start,i.end)&&a.next(e)})))),a.complete()}catch(d){a.error(d)}}parseLine(e,t,s){const a=t.split("\t");return{start:+a[e.start-1],end:+a[e.end-1],lineHash:s,fields:a}}formatFeatures(e){return e.map((e=>new d.Z({data:this.featureData(e),id:"".concat(this.id,"-offset-").concat(e.attributes._lineHash[0])})))}featureData(e){const t={...e};t.start-=1,"+"===e.strand?t.strand=1:"-"===e.strand?t.strand=-1:"."===e.strand?t.strand=0:t.strand=void 0,t.phase=Number(e.phase),t.refName=e.seq_id,null===e.score&&delete t.score,null===e.phase&&delete t.score;const s=new Set(["start","end","seq_id","score","type","source","phase","strand"]),a=e.attributes||{};for(const n of Object.keys(a)){let e=n.toLowerCase();if(s.has(e)&&(e+="2"),null!==a[n]){let s=a[n];Array.isArray(s)&&1===s.length&&([s]=s),t[e]=s}}return t.refName=t.seq_id,e.child_features&&e.child_features.length>0&&(t.subfeatures=e.child_features.flatMap((e=>e.map((e=>this.featureData(e)))))),delete t.child_features,delete t.data,delete t._linehash,delete t.attributes,delete t.seq_id,t}freeResources(){}}},74854:()=>{},66602:()=>{}}]);
//# sourceMappingURL=4731.388fbb96.chunk.js.map