(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[1025],{58268:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return w}});var r=n(96234),a=n(33028),s=n(34795),i=n(9249),u=n(87371),c=n(45754),o=n(86906),f=n(77162),d=n.n(f),l=n(29598),h=n(37654),p=n(33528),v=n(26131),g=n(14956),b=n(44061),m=n(64526),k=n(9077),w=function(e){(0,c.Z)(n,e);var t=(0,o.Z)(n);function n(e,r,a){var s;(0,i.Z)(this,n),(s=t.call(this,e,r,a)).gff=void 0,s.dontRedispatch=void 0;var u=(0,k.readConfObject)(e,"gffGzLocation"),c=(0,k.readConfObject)(e,["index","indexType"]),o=(0,k.readConfObject)(e,["index","location"]),f=(0,k.readConfObject)(e,"dontRedispatch");return s.dontRedispatch=f||["chromosome","contig","region"],s.gff=new b.TabixIndexedFile({filehandle:(0,p.openLocation)(u,s.pluginManager),csiFilehandle:"CSI"===c?(0,p.openLocation)(o,s.pluginManager):void 0,tbiFilehandle:"CSI"!==c?(0,p.openLocation)(o,s.pluginManager):void 0,chunkCacheSize:50*Math.pow(2,20),renameRefSeqs:function(e){return e}}),s}return(0,u.Z)(n,[{key:"getRefNames",value:function(){var e=(0,s.Z)(d().mark((function e(){var t,n=arguments;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:{},e.abrupt("return",this.gff.getReferenceSequenceNames(t));case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getHeader",value:function(){var e=(0,s.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.gff.getHeader());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getFeatures",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,v.ObservableCreate)(function(){var r=(0,s.Z)(d().mark((function r(a){var s;return d().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.gff.getMetadata();case 2:s=r.sent,t.getFeaturesHelper(e,n,s,a,!0);case 4:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),n.signal)}},{key:"getFeaturesHelper",value:function(){var e=(0,s.Z)(d().mark((function e(t){var n,r,s,i,u,c,o,f,l,p=this,v=arguments;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=v.length>1&&void 0!==v[1]?v[1]:{},r=v.length>2?v[2]:void 0,s=v.length>3?v[3]:void 0,i=v.length>4?v[4]:void 0,u=v.length>5&&void 0!==v[5]?v[5]:t,e.prev=5,c=[],e.next=9,this.gff.getLines(t.refName,t.start,t.end,(function(e,t){c.push(p.parseLine(r.columnNumbers,e,t))}));case 9:if(!i||!c.length){e.next=16;break}if(o=1/0,f=-1/0,c.forEach((function(e){var t=e.fields[2];if(!p.dontRedispatch.includes(t)){var n=e.start-1;n<o&&(o=n),e.end>f&&(f=e.end)}})),!(f>t.end||o<t.start)){e.next=16;break}return this.getFeaturesHelper((0,a.Z)((0,a.Z)({},t),{},{start:o,end:f}),n,r,s,!1,t),e.abrupt("return");case 16:l=c.map((function(e){return 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"),m.Z.parseStringSync(l,{parseFeatures:!0,parseComments:!1,parseDirectives:!1,parseSequences:!1}).forEach((function(e){return p.formatFeatures(e).forEach((function(e){(0,h.qY)(e.get("start"),e.get("end"),u.start,u.end)&&s.next(e)}))})),s.complete(),e.next=25;break;case 22:e.prev=22,e.t0=e.catch(5),s.error(e.t0);case 25:case"end":return e.stop()}}),e,this,[[5,22]])})));return function(t){return e.apply(this,arguments)}}()},{key:"parseLine",value:function(e,t,n){var r=t.split("\t");return{start:+r[e.start-1],end:+r[e.end-1],lineHash:n,fields:r}}},{key:"formatFeatures",value:function(e){var t=this;return e.map((function(e){return new g.Z({data:t.featureData(e),id:"".concat(t.id,"-offset-").concat(e.attributes._lineHash[0])})}))}},{key:"featureData",value:function(e){var t=this,n=(0,a.Z)({},e);n.start-=1,"+"===e.strand?n.strand=1:"-"===e.strand?n.strand=-1:"."===e.strand?n.strand=0:n.strand=void 0,n.phase=Number(e.phase),n.refName=e.seq_id,null===e.score&&delete n.score,null===e.phase&&delete n.score;var s=["start","end","seq_id","score","type","source","phase","strand"],i=e.attributes||{};return Object.keys(i).forEach((function(e){var t=e.toLowerCase();if(s.includes(t)&&(t+="2"),null!==i[e]){var a=i[e];if(Array.isArray(a)&&1===a.length){var u=a;a=(0,r.Z)(u,1)[0]}n[t]=a}})),n.refName=n.seq_id,e.child_features&&e.child_features.length&&(n.subfeatures=e.child_features.map((function(e){return e.map((function(e){return t.featureData(e)}))})).flat()),delete n.child_features,delete n.data,delete n.derived_features,delete n._linehash,delete n.attributes,delete n.seq_id,n}},{key:"freeResources",value:function(){}}]),n}(l.BaseFeatureDataAdapter)},57267:function(){},48732:function(){}}]);
//# sourceMappingURL=1025.cbc9c7c7.chunk.js.map