(this["webpackJsonp@jbrowse/web"]=this["webpackJsonp@jbrowse/web"]||[]).push([[67],{1720:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return m}));var a=n(29),r=n(86),s=n(82),i=n(81),c=n(11),u=n(88),o=n(89),f=n(80),d=n.n(f),l=n(116),h=n(229),p=n(104),v=n(125),b=n(119),g=n(636),j=n(945),O=n(79),m=function(e){Object(u.a)(n,e);var t=Object(o.a)(n);function n(e,a,r){var s;Object(i.a)(this,n),(s=t.call(this,e,a,r)).gff=void 0,s.dontRedispatch=void 0;var c=Object(O.readConfObject)(e,"gffGzLocation"),u=Object(O.readConfObject)(e,["index","indexType"]),o=Object(O.readConfObject)(e,["index","location"]),f=Object(O.readConfObject)(e,"dontRedispatch");return s.dontRedispatch=f||["chromosome","contig","region"],s.gff=new g.TabixIndexedFile({filehandle:Object(p.openLocation)(c,s.pluginManager),csiFilehandle:"CSI"===u?Object(p.openLocation)(o,s.pluginManager):void 0,tbiFilehandle:"CSI"!==u?Object(p.openLocation)(o,s.pluginManager):void 0,chunkCacheSize:50*Math.pow(2,20),renameRefSeqs:function(e){return e}}),s}return Object(c.a)(n,[{key:"getRefNames",value:function(){var e=Object(s.a)(d.a.mark((function e(){var t,n=arguments;return d.a.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=Object(s.a)(d.a.mark((function e(){return d.a.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 Object(v.ObservableCreate)(function(){var a=Object(s.a)(d.a.mark((function a(r){var s;return d.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.gff.getMetadata();case 2:s=a.sent,t.getFeaturesHelper(e,n,s,r,!0);case 4:case"end":return a.stop()}}),a)})));return function(e){return a.apply(this,arguments)}}(),n.signal)}},{key:"getFeaturesHelper",value:function(){var e=Object(s.a)(d.a.mark((function e(t){var n,a,s,i,c,u,o,f,l,p=this,v=arguments;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=v.length>1&&void 0!==v[1]?v[1]:{},a=v.length>2?v[2]:void 0,s=v.length>3?v[3]:void 0,i=v.length>4?v[4]:void 0,c=v.length>5&&void 0!==v[5]?v[5]:t,e.prev=5,u=[],e.next=9,this.gff.getLines(t.refName,t.start,t.end,(function(e,t){u.push(p.parseLine(a.columnNumbers,e,t))}));case 9:if(!i||!u.length){e.next=16;break}if(o=1/0,f=-1/0,u.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(Object(r.a)(Object(r.a)({},t),{},{start:o,end:f}),n,a,s,!1,t),e.abrupt("return");case 16:l=u.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"),j.a.parseStringSync(l,{parseFeatures:!0,parseComments:!1,parseDirectives:!1,parseSequences:!1}).forEach((function(e){return p.formatFeatures(e).forEach((function(e){Object(h.a)(e.get("start"),e.get("end"),c.start,c.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 a=t.split("\t");return{start:+a[e.start-1],end:+a[e.end-1],lineHash:n,fields:a}}},{key:"formatFeatures",value:function(e){var t=this;return e.map((function(e){return new b.a({data:t.featureData(e),id:"".concat(t.id,"-offset-").concat(e.attributes._lineHash[0])})}))}},{key:"featureData",value:function(e){var t=this,n=Object(r.a)({},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 r=i[e];if(Array.isArray(r)&&1===r.length){var c=r;r=Object(a.a)(c,1)[0]}n[t]=r}})),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)}}]);
//# sourceMappingURL=67.34d0fd86.chunk.js.map