@jbrowse/plugin-sequence 1.6.4 → 1.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@jbrowse/core/pluggableElementTypes/AdapterType")),r=require("@jbrowse/core/pluggableElementTypes/models"),n=e(require("@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType")),o=e(require("@jbrowse/core/pluggableElementTypes/TrackType")),a=e(require("@jbrowse/core/Plugin")),i=require("@jbrowse/plugin-linear-genome-view"),c=require("@jbrowse/core/util/tracks"),u=require("@jbrowse/core/configuration"),s=e(require("react")),l=require("@jbrowse/core/util/color"),f=require("@jbrowse/core/ui"),p=require("mobx-react"),d=require("@jbrowse/core/util"),h=require("mobx-state-tree"),y=require("@jbrowse/core/data_adapters/BaseAdapter"),g=require("@jbrowse/core/util/rxjs"),m=e(require("@jbrowse/core/util/simpleFeature")),v=require("rxjs/operators"),w=require("@jbrowse/core/util/io"),b=require("@gmod/twobit"),x=require("@gmod/indexedfasta"),S=e(require("abortable-promise-cache")),k=e(require("@jbrowse/core/util/QuickLRU"));function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){P(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function j(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function q(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){j(a,n,o,i,c,"next",e)}function c(e){j(a,n,o,i,c,"throw",e)}i(void 0)}))}}function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t&&O(e.prototype,t),r&&O(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function P(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=A(e);if(t){var o=A(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return R(this,r)}}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(e,t)||N(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t){if(e){if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var M=u.ConfigurationSchema("BgzipFastaAdapter",{fastaLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz",locationType:"UriLocation"}},faiLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz.fai",locationType:"UriLocation"}},gziLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz.gzi",locationType:"UriLocation"}}},{explicitlyTyped:!0}),B=u.ConfigurationSchema("ChromSizesAdapter",{chromSizesLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/species.chrom.sizes",locationType:"UriLocation"}}},{explicitlyTyped:!0});function D(e){for(var t=e.codonTable,r=e.frame,n=e.bpPerPx,o=e.region,a=e.height,i=e.y,c=e.reverse,u=void 0!==c&&c,l=e.theme,f=n,p=(r+(3-o.start%3)+3)%3,h=e.seq.slice(p),y=[],g=0;g<h.length;g+=3){var m=h.slice(g,g+3),v=u?d.revcom(m):m;y.push({letter:t[v]||"",codon:v.toUpperCase()})}var w=1/f*3,b=0===o.start?0:w,x=1/n>=12,S=(o.end-o.start)/n,k=["#d8d8d8","#adadad","#8f8f8f"].reverse();return s.createElement(s.Fragment,null,y.map((function(e,t){var n=o.reversed?S-(w*(t+1)+p/f-b):w*t+p/f-b,c=e.letter,u=e.codon;return s.createElement(s.Fragment,{key:"".concat(t,"-").concat(c)},s.createElement("rect",{x:n,y:i,width:x?w:w+.7,height:a,stroke:x?"#555":"none",fill:d.defaultStarts.includes(u)?l.palette.startCodon:d.defaultStops.includes(u)?l.palette.stopCodon:k[Math.abs(r)]}),x?s.createElement("text",{x:n+w/2,y:i+a/2,dominantBaseline:"middle",textAnchor:"middle"},c):null)})))}function G(e){var t=e.bpPerPx,r=e.region,n=e.feature,o=e.theme,a=e.height,i=e.seq,c=e.y,u=1/t>=12,f=z(d.bpSpanPx(n.get("start"),n.get("end"),r,t),2),p=f[0],h=f[1],y=r.reversed,g=n.get("end")-n.get("start"),m=Math.max((h-p)/g,.8);return s.createElement(s.Fragment,null,i.split("").map((function(e,t){var r=o.palette.bases[e.toUpperCase()],n=y?h-(t+1)*m:p+t*m;return s.createElement(s.Fragment,{key:t},s.createElement("rect",{x:n,y:c,width:m,height:a,fill:r?r.main:"#aaa",stroke:u?"#555":"none"}),u?s.createElement("text",{x:n+m/2,y:c+a/2,dominantBaseline:"middle",textAnchor:"middle",fill:r?l.contrastingTextColor(r.main):"black"},e):null)})))}var U=function(e){var t,r=e.regions,n=e.theme,o=e.features,a=void 0===o?new Map:o,i=e.showReverse,c=e.showForward,u=e.showTranslation,l=e.bpPerPx,p=z(r,1)[0],h=f.createJBrowseTheme(n),y=d.generateCodonTable(d.defaultCodonTable),g=(t=a.values(),function(e){if(Array.isArray(e))return I(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||N(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];if(!g)return null;var m=g.get("seq");if(!m)return null;var v=-20;return s.createElement(s.Fragment,null,u&&(p.reversed?i:c)?[2,1,0].map((function(e){return s.createElement(D,{key:"translation-".concat(e),seq:m,y:v+=20,codonTable:y,frame:e,bpPerPx:l,region:p,theme:h,height:20,reverse:p.reversed})})):null,c?s.createElement(G,{height:20,y:v+=20,feature:g,region:p,seq:p.reversed?d.complement(m):m,bpPerPx:l,theme:h}):null,i?s.createElement(G,{height:20,y:v+=20,feature:g,region:p,seq:p.reversed?m:d.complement(m),bpPerPx:l,theme:h}):null,u&&(p.reversed?c:i)?[0,-1,-2].map((function(e){return s.createElement(D,{key:"rev-translation-".concat(e),seq:m,y:v+=20,codonTable:y,frame:e,bpPerPx:l,region:p,theme:h,height:20,reverse:!p.reversed})})):null)},V=function(e){var t=e.width,r=e.totalHeight,n=e.children;return e.exportSVG?s.createElement(s.Fragment,null,n):s.createElement("svg",{"data-testid":"sequence_track",width:t,height:r,style:{width:t,height:r}},n)};function J(e){var t=e.bpPerPx,r=z(e.regions,1)[0];return s.createElement(V,Object.assign({},e,{totalHeight:200,width:(r.end-r.start)/t}),s.createElement(U,Object.assign({},e)))}var $=p.observer(J),H=u.ConfigurationSchema("DivSequenceRenderer",{height:{type:"number",description:"height in pixels of each line of sequence",defaultValue:16}},{explicitlyTyped:!0}),Y=u.ConfigurationSchema("IndexedFastaAdapter",{fastaLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa",locationType:"UriLocation"}},faiLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.fai",locationType:"UriLocation"}}},{explicitlyTyped:!0}),Q=u.ConfigurationSchema("LinearReferenceSequenceDisplay",{renderer:H},{explicitIdentifier:"displayId",explicitlyTyped:!0}),Z=u.ConfigurationSchema("TwoBitAdapter",{twoBitLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.2bit",locationType:"UriLocation"}},chromSizesLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/default.chrom.sizes",locationType:"UriLocation"},description:"An optional chrom.sizes file can be supplied to speed up loading since parsing the twobit file can take time"}},{explicitlyTyped:!0}),K=function(e){return u.ConfigurationSchema("GCContentAdapter",{sequenceAdapter:e.pluggableConfigSchemaType("adapter")},{explicitlyTyped:!0})},W=function(e){return{configSchema:e.load(K),getAdapterClass:function(){return Promise.resolve().then((function(){return oe})).then((function(e){return e.default}))}}},X=function(e){F(r,n);var t=_(r);function r(){var e;return E(this,r),(e=t.apply(this,arguments)).supportsSVG=!0,e}return C(r,[{key:"getExpandedRegion",value:function(e){return L(L({},e),{},{start:Math.max(e.start-3,0),end:e.end+3})}}]),r}(),ee=function(e){F(s,a);var n=_(s);function s(){var e;return E(this,s),(e=n.apply(this,arguments)).name="SequencePlugin",e}return C(s,[{key:"install",value:function(e){e.addAdapterType((function(){return new t({name:"TwoBitAdapter",configSchema:Z,adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null},getAdapterClass:function(){return Promise.resolve().then((function(){return ae})).then((function(e){return e.default}))}})})),e.addToExtensionPoint("Core-guessAdapterForLocation",(function(e){return function(t,r,n){var o=c.getFileName(t),a={type:"TwoBitAdapter",twoBitLocation:t};return/\.2bit$/i.test(o)&&!n||"TwoBitAdapter"===n?a:e(t,r,n)}})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(function(e){return function(t){return"TwoBitAdapter"===t?"ReferenceSequenceTrack":e(t)}})),e.addAdapterType((function(){return new t({name:"ChromSizesAdapter",configSchema:B,adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null},getAdapterClass:function(){return Promise.resolve().then((function(){return ie})).then((function(e){return e.default}))}})})),e.addAdapterType((function(){return new t({name:"IndexedFastaAdapter",configSchema:Y,adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null},getAdapterClass:function(){return Promise.resolve().then((function(){return ue})).then((function(e){return e.default}))}})})),e.addToExtensionPoint("Core-guessAdapterForLocation",(function(e){return function(t,r,n){var o=c.getFileName(t),a={type:"IndexedFastaAdapter",fastaLocation:t,faiLocation:r||c.makeIndex(t,".fai")};return/\.(fa|fasta|fas|fna|mfa)$/i.test(o)&&!n||"IndexedFastaAdapter"===n?a:e(t,r,n)}})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(function(e){return function(t){return"IndexedFastaAdapter"===t?"ReferenceSequenceTrack":e(t)}})),e.addAdapterType((function(){return new t({name:"BgzipFastaAdapter",configSchema:M,adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null},getAdapterClass:function(){return Promise.resolve().then((function(){return se})).then((function(e){return e.default}))}})})),e.addToExtensionPoint("Core-guessAdapterForLocation",(function(e){return function(t,r,n){var o=c.getFileName(t),a={type:"BgzipFastaAdapter",faiLocation:c.makeIndex(t,".fai"),gziLocation:c.makeIndex(t,".gzi")};return/\.(fa|fasta|fas|fna|mfa)\.b?gz$/i.test(o)&&!n||"BgzipFastaAdapter"===n?a:e(t,r,n)}})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(function(e){return function(t){return"BgzipFastaAdapter"===t?"ReferenceSequenceTrack":e(t)}})),e.addAdapterType((function(){return new t(L({name:"GCContentAdapter",adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null}},e.load(W)))})),e.addTrackType((function(){var t=function(e){return u.ConfigurationSchema("ReferenceSequenceTrack",{adapter:e.pluggableConfigSchemaType("adapter"),displays:h.types.array(e.pluggableConfigSchemaType("display")),metadata:{type:"frozen",description:"anything to add about this track",defaultValue:{}}},{preProcessSnapshot:function(t){var r=JSON.parse(JSON.stringify(t)),n=new Set,o=r.displays,a=void 0===o?[]:o;return"placeholderId"!==r.trackId&&(a.forEach((function(e){return e&&n.add(e.type)})),e.getTrackType(r.type).displayTypes.forEach((function(e){n.has(e.name)||a.push({displayId:"".concat(r.trackId,"-").concat(e.name),type:e.name})}))),L(L({},r),{},{displays:a})},explicitIdentifier:"trackId",explicitlyTyped:!0,actions:function(e){return{addDisplayConf:function(t){var r=t.type;if(!r)throw new Error("unknown display type ".concat(r));var n=e.displays.find((function(e){return e&&e.displayId===t.displayId}));if(n)return n;var o=e.displays.push(t);return e.displays[o-1]}}}})}(e);return new o({name:"ReferenceSequenceTrack",configSchema:t,stateModel:r.createBaseTrackModel(e,"ReferenceSequenceTrack",t)})})),e.addDisplayType((function(){var e=function(e){return h.types.compose("LinearReferenceSequenceDisplay",i.BaseLinearDisplay,h.types.model({type:h.types.literal("LinearReferenceSequenceDisplay"),configuration:u.ConfigurationReference(e),showForward:h.types.optional(h.types.boolean,!0),showReverse:h.types.optional(h.types.boolean,!0),showTranslation:h.types.optional(h.types.boolean,!0),height:180})).views((function(e){var t=e.renderProps;return{renderProps:function(){var r=e.showForward,n=e.showReverse,o=e.showTranslation;return L(L({},t()),{},{rpcDriverName:e.rpcDriverName,config:e.configuration.renderer,showForward:r,showReverse:n,showTranslation:o})},regionCannotBeRendered:function(){var t=d.getContainingView(e);if(t&&t.bpPerPx>=1)return"Zoom in to see sequence"},get rendererTypeName(){return e.configuration.renderer.type}}})).actions((function(e){return{toggleShowForward:function(){e.showForward=!e.showForward},toggleShowReverse:function(){e.showReverse=!e.showReverse},toggleShowTranslation:function(){e.showTranslation=!e.showTranslation}}})).views((function(e){return{trackMenuItems:function(){return[{label:"Show forward",type:"checkbox",checked:e.showForward,onClick:function(){e.toggleShowForward()}},{label:"Show reverse",type:"checkbox",checked:e.showReverse,onClick:function(){e.toggleShowReverse()}},{label:"Show translation",type:"checkbox",checked:e.showTranslation,onClick:function(){e.toggleShowTranslation()}}]}}}))}(Q);return{name:"LinearReferenceSequenceDisplay",configSchema:Q,stateModel:e,trackType:"ReferenceSequenceTrack",viewType:"LinearGenomeView",ReactComponent:i.BaseLinearDisplayComponent}})),e.addRendererType((function(){return new X({name:"DivSequenceRenderer",ReactComponent:$,configSchema:H,pluginManager:e})}))}}]),s}();function te(e,t){return e(t={exports:{}},t.exports),t.exports}var re=te((function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),a=new k(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=b(i,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,a),o}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function p(){}function d(){}var h={};c(h,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(T([])));g&&g!==t&&r.call(g,o)&&(h=g);var m=d.prototype=f.prototype=Object.create(h);function v(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,c){var u=s(e[o],e,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(f).then((function(e){l.value=e,i(l)}),(function(e){return n("throw",e,i,c)}))}c(u.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function T(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,c(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(w.prototype),c(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(u(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},v(m),c(m,i,"Generator"),c(m,o,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=T,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})),ne=function(e){F(o,y.BaseFeatureDataAdapter);var t,r,n=_(o);function o(){var e;return E(this,o),(e=n.apply(this,arguments)).windowSize=1e3,e.windowDelta=1e3,e.gcMode="content",e}return C(o,[{key:"configure",value:(r=q(re.mark((function e(){var t,r,n;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.readConfObject(this.config,"sequenceAdapter"),e.next=3,null===(t=this.getSubAdapter)||void 0===t?void 0:t.call(this,r);case 3:if(n=e.sent){e.next=6;break}throw new Error("Error getting subadapter");case 6:return e.abrupt("return",n.dataAdapter);case 7:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getRefNames",value:(t=q(re.mark((function e(){return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.configure();case 2:return e.abrupt("return",e.sent.getRefNames());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getFeatures",value:function(e,t){var r=this;return this.windowSize=1e3,this.windowDelta=1e3,this.gcMode="content",g.ObservableCreate(function(){var t=q(re.mark((function t(n){var o,a,i,c,u,s,l,f,p,d,h,y,g,w,b,x;return re.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.configure();case 2:if(a=t.sent,i=1===r.windowSize?1:r.windowSize/2,c=1===r.windowSize,u=e.start,s=e.end,u=Math.max(0,u-i),!((s+=i)<0||u>s)){t.next=11;break}return n.complete(),t.abrupt("return");case 11:return l=a.getFeatures(L(L({},e),{},{start:u,end:s})),t.next=14,l.pipe(v.toArray()).toPromise();case 14:for(f=(null===(o=t.sent[0])||void 0===o?void 0:o.get("seq"))||"",p=i;p<f.length-i;p+=r.windowDelta){for(d=c?f[p]:f.slice(p-i,p+i),h=0,y=0,g=0,w=0;w<d.length;w++)"c"===d[w]||"C"===d[w]?h++:"g"!==d[w]&&"G"!==d[w]||y++,"N"!==d[w]&&g++;b=u,x=void 0,"content"===r.gcMode?x=(y+h)/(g||1):"skew"===r.gcMode&&(x=(y-h)/(y+h||1)),n.next(new m({uniqueId:"".concat(r.id,"_").concat(b+p),start:b+p,end:b+p+r.windowDelta,score:x}))}n.complete();case 18:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"freeResources",value:function(){}}]),o}();ne.capabilities=["hasLocalStats"];var oe={__proto__:null,default:ne},ae={__proto__:null,default:function(e){F(a,y.BaseSequenceAdapter);var t,r,n,o=_(a);function a(e,t,r){var n;return E(this,a),(n=o.call(this,e,t,r)).chromSizesData=n.initChromSizes(),n.twobit=new b.TwoBitFile({filehandle:w.openLocation(u.readConfObject(e,"twoBitLocation"),n.pluginManager)}),n}return C(a,[{key:"initChromSizes",value:(n=q(re.mark((function e(){var t,r,n;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("/path/to/default.chrom.sizes"===(t=u.readConfObject(this.config,"chromSizesLocation")).uri||""===t.uri){e.next=7;break}return r=w.openLocation(t,this.pluginManager),e.next=5,r.readFile("utf8");case 5:return n=e.sent,e.abrupt("return",Object.fromEntries(null==n?void 0:n.split("\n").filter((function(e){return!!e.trim()})).map((function(e){var t=z(e.split("\t"),2);return[t[0],+t[1]]}))));case 7:return e.abrupt("return",void 0);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getRefNames",value:(r=q(re.mark((function e(){var t;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.chromSizesData;case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",Object.keys(t));case 5:return e.abrupt("return",this.twobit.getSequenceNames());case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getRegions",value:(t=q(re.mark((function e(){var t,r;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.chromSizesData;case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",Object.keys(t).map((function(e){return{refName:e,start:0,end:t[e]}})));case 5:return e.next=7,this.twobit.getSequenceSizes();case 7:return r=e.sent,e.abrupt("return",Object.keys(r).map((function(e){return{refName:e,start:0,end:r[e]}})));case 9:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getFeatures",value:function(e){var t=this,r=e.refName,n=e.start,o=e.end;return g.ObservableCreate(function(){var e=q(re.mark((function e(a){var i,c,u;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.twobit.getSequenceSize(r);case 2:return c=void 0!==(i=e.sent)?Math.min(i,o):o,e.next=6,t.twobit.getSequence(r,n,c);case 6:(u=e.sent)&&a.next(new m({id:"".concat(r," ").concat(n,"-").concat(c),data:{refName:r,start:n,end:c,seq:u}})),a.complete();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},{key:"freeResources",value:function(){}}]),a}()},ie={__proto__:null,default:function(e){F(o,y.BaseAdapter);var t,r,n=_(o);function o(e,t,r){var a;E(this,o),a=n.call(this,e,t,r);var i=u.readConfObject(e,"chromSizesLocation");if(!i)throw new Error("must provide chromSizesLocation");var c=w.openLocation(i,a.pluginManager);return a.source=c.toString(),a.refSeqs=a.init(c),a}return C(o,[{key:"init",value:(r=q(re.mark((function e(t){var r,n;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.readFile("utf8");case 2:if(n={},(r=e.sent).length){e.next=6;break}throw new Error("Could not read file ".concat(t.toString()));case 6:return r.split("\n").forEach((function(e){if(e.length){var t=z(e.split("\t"),2);n[t[0]]=+t[1]}})),e.abrupt("return",n);case 8:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getRegions",value:(t=q(re.mark((function e(){var t;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.refSeqs;case 2:return t=e.sent,e.abrupt("return",Object.keys(t).map((function(e){return{refName:e,start:0,end:t[e]}})));case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getFeatures",value:function(){throw new Error("sequence not available")}},{key:"freeResources",value:function(){}}]),o}()},ce=function(e){F(n,y.BaseSequenceAdapter);var t,r=_(n);function n(e,t,o){var a,i;E(this,n),(a=r.call(this,e,t,o)).seqCache=new S({cache:new k({maxSize:200}),fill:(i=q(re.mark((function e(t,r){return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a.fasta.getSequence(t.refName,t.start,t.end,L(L({},t),{},{signal:r})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return i.apply(this,arguments)})});var c=u.readConfObject(e,"fastaLocation"),s=u.readConfObject(e,"faiLocation"),l={fasta:w.openLocation(c,a.pluginManager),fai:w.openLocation(s,a.pluginManager)};return a.fasta=new x.IndexedFasta(l),a}return C(n,[{key:"getRefNames",value:function(e){return this.fasta.getSequenceNames(e)}},{key:"getRegions",value:(t=q(re.mark((function e(t){var r;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fasta.getSequenceSizes(t);case 2:return r=e.sent,e.abrupt("return",Object.keys(r).map((function(e){return{refName:e,start:0,end:r[e]}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getFeatures",value:function(e,t){var r=this,n=e.refName,o=e.start,a=e.end;return g.ObservableCreate(function(){var e=q(re.mark((function e(i){var c,u,s,l,f,p,d,h;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.fasta.getSequenceSize(n,t);case 2:for(u=void 0!==(c=e.sent)?Math.min(c,a):a,s=[],f=a+(128e3-a%128e3),p=l=o-o%128e3;p<f;p+=128e3)d={refName:n,start:p,end:p+128e3},s.push(r.seqCache.get(JSON.stringify(d),d,null==t?void 0:t.signal));return e.next=11,Promise.all(s);case 11:(h=e.sent.join("").slice(o-l).slice(0,a-o))&&i.next(new m({id:"".concat(n," ").concat(o,"-").concat(u),data:{refName:n,start:o,end:u,seq:h}})),i.complete();case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},{key:"freeResources",value:function(){}}]),n}(),ue={__proto__:null,default:ce},se={__proto__:null,default:function(e){F(r,ce);var t=_(r);function r(e,n,o){var a;E(this,r),a=t.call(this,e,n,o);var i=u.readConfObject(e,"fastaLocation"),c=u.readConfObject(e,"faiLocation"),s=u.readConfObject(e,"gziLocation");if(!i)throw new Error("must provide fastaLocation");if(!c)throw new Error("must provide faiLocation");if(!s)throw new Error("must provide gziLocation");var l={fasta:w.openLocation(i,a.pluginManager),fai:w.openLocation(c,a.pluginManager),gzi:w.openLocation(s,a.pluginManager)};return a.fasta=new x.BgzipIndexedFasta(l),a}return C(r)}()};exports.default=ee;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@jbrowse/core/pluggableElementTypes/AdapterType")),r=require("@jbrowse/core/pluggableElementTypes/models"),n=e(require("@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType")),o=e(require("@jbrowse/core/pluggableElementTypes/TrackType")),a=e(require("@jbrowse/core/Plugin")),i=require("@jbrowse/plugin-linear-genome-view"),c=require("@jbrowse/core/util/tracks"),u=require("@jbrowse/core/configuration"),s=e(require("react")),l=require("@jbrowse/core/util/color"),f=require("@jbrowse/core/ui"),p=require("mobx-react"),d=require("@jbrowse/core/util"),h=require("mobx-state-tree"),y=require("@jbrowse/core/data_adapters/BaseAdapter"),g=require("@jbrowse/core/util/rxjs"),m=e(require("@jbrowse/core/util/simpleFeature")),v=require("rxjs/operators"),w=require("@jbrowse/core/util/io"),b=require("@gmod/twobit"),x=require("@gmod/indexedfasta"),S=e(require("abortable-promise-cache")),k=e(require("@jbrowse/core/util/QuickLRU"));function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){P(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function j(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function q(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){j(a,n,o,i,c,"next",e)}function c(e){j(a,n,o,i,c,"throw",e)}i(void 0)}))}}function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t&&O(e.prototype,t),r&&O(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function P(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=A(e);if(t){var o=A(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return R(this,r)}}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(e,t)||N(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t){if(e){if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var M=u.ConfigurationSchema("BgzipFastaAdapter",{fastaLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz",locationType:"UriLocation"}},faiLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz.fai",locationType:"UriLocation"}},gziLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz.gzi",locationType:"UriLocation"}}},{explicitlyTyped:!0}),B=u.ConfigurationSchema("ChromSizesAdapter",{chromSizesLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/species.chrom.sizes",locationType:"UriLocation"}}},{explicitlyTyped:!0});function D(e){for(var t=e.codonTable,r=e.frame,n=e.bpPerPx,o=e.region,a=e.height,i=e.y,c=e.reverse,u=void 0!==c&&c,l=e.theme,f=n,p=(r+(3-o.start%3)+3)%3,h=e.seq.slice(p),y=[],g=0;g<h.length;g+=3){var m=h.slice(g,g+3),v=u?d.revcom(m):m;y.push({letter:t[v]||"",codon:v.toUpperCase()})}var w=1/f*3,b=0===o.start?0:w,x=1/n>=12,S=(o.end-o.start)/n,k=["#d8d8d8","#adadad","#8f8f8f"].reverse();return s.createElement(s.Fragment,null,y.map((function(e,t){var n=o.reversed?S-(w*(t+1)+p/f-b):w*t+p/f-b,c=e.letter,u=e.codon;return s.createElement(s.Fragment,{key:"".concat(t,"-").concat(c)},s.createElement("rect",{x:n,y:i,width:x?w:w+.7,height:a,stroke:x?"#555":"none",fill:d.defaultStarts.includes(u)?l.palette.startCodon:d.defaultStops.includes(u)?l.palette.stopCodon:k[Math.abs(r)]}),x?s.createElement("text",{x:n+w/2,y:i+a/2,dominantBaseline:"middle",textAnchor:"middle"},c):null)})))}function G(e){var t=e.bpPerPx,r=e.region,n=e.feature,o=e.theme,a=e.height,i=e.seq,c=e.y,u=1/t>=12,f=z(d.bpSpanPx(n.get("start"),n.get("end"),r,t),2),p=f[0],h=f[1],y=r.reversed,g=n.get("end")-n.get("start"),m=Math.max((h-p)/g,.8);return s.createElement(s.Fragment,null,i.split("").map((function(e,t){var r=o.palette.bases[e.toUpperCase()],n=y?h-(t+1)*m:p+t*m;return s.createElement(s.Fragment,{key:t},s.createElement("rect",{x:n,y:c,width:m,height:a,fill:r?r.main:"#aaa",stroke:u?"#555":"none"}),u?s.createElement("text",{x:n+m/2,y:c+a/2,dominantBaseline:"middle",textAnchor:"middle",fill:r?l.contrastingTextColor(r.main):"black"},e):null)})))}var U=function(e){var t,r=e.regions,n=e.theme,o=e.features,a=void 0===o?new Map:o,i=e.showReverse,c=e.showForward,u=e.showTranslation,l=e.bpPerPx,p=z(r,1)[0],h=f.createJBrowseTheme(n),y=d.generateCodonTable(d.defaultCodonTable),g=(t=a.values(),function(e){if(Array.isArray(e))return I(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||N(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];if(!g)return null;var m=g.get("seq");if(!m)return null;var v=-20;return s.createElement(s.Fragment,null,u&&(p.reversed?i:c)?[2,1,0].map((function(e){return s.createElement(D,{key:"translation-".concat(e),seq:m,y:v+=20,codonTable:y,frame:e,bpPerPx:l,region:p,theme:h,height:20,reverse:p.reversed})})):null,c?s.createElement(G,{height:20,y:v+=20,feature:g,region:p,seq:p.reversed?d.complement(m):m,bpPerPx:l,theme:h}):null,i?s.createElement(G,{height:20,y:v+=20,feature:g,region:p,seq:p.reversed?m:d.complement(m),bpPerPx:l,theme:h}):null,u&&(p.reversed?c:i)?[0,-1,-2].map((function(e){return s.createElement(D,{key:"rev-translation-".concat(e),seq:m,y:v+=20,codonTable:y,frame:e,bpPerPx:l,region:p,theme:h,height:20,reverse:!p.reversed})})):null)},V=function(e){var t=e.width,r=e.totalHeight,n=e.children;return e.exportSVG?s.createElement(s.Fragment,null,n):s.createElement("svg",{"data-testid":"sequence_track",width:t,height:r,style:{width:t,height:r}},n)};function J(e){var t=e.bpPerPx,r=z(e.regions,1)[0];return s.createElement(V,Object.assign({},e,{totalHeight:200,width:(r.end-r.start)/t}),s.createElement(U,Object.assign({},e)))}var $=p.observer(J),H=u.ConfigurationSchema("DivSequenceRenderer",{height:{type:"number",description:"height in pixels of each line of sequence",defaultValue:16}},{explicitlyTyped:!0}),Y=u.ConfigurationSchema("IndexedFastaAdapter",{fastaLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa",locationType:"UriLocation"}},faiLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.fai",locationType:"UriLocation"}}},{explicitlyTyped:!0}),Q=u.ConfigurationSchema("LinearReferenceSequenceDisplay",{renderer:H},{explicitIdentifier:"displayId",explicitlyTyped:!0}),Z=u.ConfigurationSchema("TwoBitAdapter",{twoBitLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.2bit",locationType:"UriLocation"}},chromSizesLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/default.chrom.sizes",locationType:"UriLocation"},description:"An optional chrom.sizes file can be supplied to speed up loading since parsing the twobit file can take time"}},{explicitlyTyped:!0}),K=function(e){return u.ConfigurationSchema("GCContentAdapter",{sequenceAdapter:e.pluggableConfigSchemaType("adapter")},{explicitlyTyped:!0})},W=function(e){return{configSchema:e.load(K),getAdapterClass:function(){return Promise.resolve().then((function(){return oe})).then((function(e){return e.default}))}}},X=function(e){F(r,n);var t=_(r);function r(){var e;return E(this,r),(e=t.apply(this,arguments)).supportsSVG=!0,e}return C(r,[{key:"getExpandedRegion",value:function(e){return L(L({},e),{},{start:Math.max(e.start-3,0),end:e.end+3})}}]),r}(),ee=function(e){F(s,a);var n=_(s);function s(){var e;return E(this,s),(e=n.apply(this,arguments)).name="SequencePlugin",e}return C(s,[{key:"install",value:function(e){e.addAdapterType((function(){return new t({name:"TwoBitAdapter",configSchema:Z,adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null},getAdapterClass:function(){return Promise.resolve().then((function(){return ae})).then((function(e){return e.default}))}})})),e.addToExtensionPoint("Core-guessAdapterForLocation",(function(e){return function(t,r,n){var o=c.getFileName(t),a={type:"TwoBitAdapter",twoBitLocation:t};return/\.2bit$/i.test(o)&&!n||"TwoBitAdapter"===n?a:e(t,r,n)}})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(function(e){return function(t){return"TwoBitAdapter"===t?"ReferenceSequenceTrack":e(t)}})),e.addAdapterType((function(){return new t({name:"ChromSizesAdapter",configSchema:B,adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null},getAdapterClass:function(){return Promise.resolve().then((function(){return ie})).then((function(e){return e.default}))}})})),e.addAdapterType((function(){return new t({name:"IndexedFastaAdapter",configSchema:Y,adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null},getAdapterClass:function(){return Promise.resolve().then((function(){return ue})).then((function(e){return e.default}))}})})),e.addToExtensionPoint("Core-guessAdapterForLocation",(function(e){return function(t,r,n){var o=c.getFileName(t),a={type:"IndexedFastaAdapter",fastaLocation:t,faiLocation:r||c.makeIndex(t,".fai")};return/\.(fa|fasta|fas|fna|mfa)$/i.test(o)&&!n||"IndexedFastaAdapter"===n?a:e(t,r,n)}})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(function(e){return function(t){return"IndexedFastaAdapter"===t?"ReferenceSequenceTrack":e(t)}})),e.addAdapterType((function(){return new t({name:"BgzipFastaAdapter",configSchema:M,adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null},getAdapterClass:function(){return Promise.resolve().then((function(){return se})).then((function(e){return e.default}))}})})),e.addToExtensionPoint("Core-guessAdapterForLocation",(function(e){return function(t,r,n){var o=c.getFileName(t),a={type:"BgzipFastaAdapter",faiLocation:c.makeIndex(t,".fai"),gziLocation:c.makeIndex(t,".gzi")};return/\.(fa|fasta|fas|fna|mfa)\.b?gz$/i.test(o)&&!n||"BgzipFastaAdapter"===n?a:e(t,r,n)}})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(function(e){return function(t){return"BgzipFastaAdapter"===t?"ReferenceSequenceTrack":e(t)}})),e.addAdapterType((function(){return new t(L({name:"GCContentAdapter",adapterMetadata:{category:null,hiddenFromGUI:!0,displayName:null,description:null}},e.load(W)))})),e.addTrackType((function(){var t=function(e){return u.ConfigurationSchema("ReferenceSequenceTrack",{adapter:e.pluggableConfigSchemaType("adapter"),displays:h.types.array(e.pluggableConfigSchemaType("display")),metadata:{type:"frozen",description:"anything to add about this track",defaultValue:{}}},{preProcessSnapshot:function(t){var r=JSON.parse(JSON.stringify(t)),n=new Set,o=r.displays,a=void 0===o?[]:o;return"placeholderId"!==r.trackId&&(a.forEach((function(e){return e&&n.add(e.type)})),e.getTrackType(r.type).displayTypes.forEach((function(e){n.has(e.name)||a.push({displayId:"".concat(r.trackId,"-").concat(e.name),type:e.name})}))),L(L({},r),{},{displays:a})},explicitIdentifier:"trackId",explicitlyTyped:!0,actions:function(e){return{addDisplayConf:function(t){var r=t.type;if(!r)throw new Error("unknown display type ".concat(r));var n=e.displays.find((function(e){return e&&e.displayId===t.displayId}));if(n)return n;var o=e.displays.push(t);return e.displays[o-1]}}}})}(e);return new o({name:"ReferenceSequenceTrack",configSchema:t,stateModel:r.createBaseTrackModel(e,"ReferenceSequenceTrack",t)})})),e.addDisplayType((function(){var e=function(e){return h.types.compose("LinearReferenceSequenceDisplay",i.BaseLinearDisplay,h.types.model({type:h.types.literal("LinearReferenceSequenceDisplay"),configuration:u.ConfigurationReference(e),showForward:h.types.optional(h.types.boolean,!0),showReverse:h.types.optional(h.types.boolean,!0),showTranslation:h.types.optional(h.types.boolean,!0),height:180})).views((function(e){var t=e.renderProps;return{renderProps:function(){var r=e.showForward,n=e.showReverse,o=e.showTranslation;return L(L({},t()),{},{rpcDriverName:e.rpcDriverName,config:e.configuration.renderer,showForward:r,showReverse:n,showTranslation:o})},regionCannotBeRendered:function(){var t=d.getContainingView(e);if(t&&t.bpPerPx>=1)return"Zoom in to see sequence"},get rendererTypeName(){return e.configuration.renderer.type}}})).actions((function(e){return{toggleShowForward:function(){e.showForward=!e.showForward},toggleShowReverse:function(){e.showReverse=!e.showReverse},toggleShowTranslation:function(){e.showTranslation=!e.showTranslation}}})).views((function(e){return{trackMenuItems:function(){return[{label:"Show forward",type:"checkbox",checked:e.showForward,onClick:function(){e.toggleShowForward()}},{label:"Show reverse",type:"checkbox",checked:e.showReverse,onClick:function(){e.toggleShowReverse()}},{label:"Show translation",type:"checkbox",checked:e.showTranslation,onClick:function(){e.toggleShowTranslation()}}]}}}))}(Q);return{name:"LinearReferenceSequenceDisplay",configSchema:Q,stateModel:e,trackType:"ReferenceSequenceTrack",viewType:"LinearGenomeView",ReactComponent:i.BaseLinearDisplayComponent}})),e.addRendererType((function(){return new X({name:"DivSequenceRenderer",ReactComponent:$,configSchema:H,pluginManager:e})}))}}]),s}();function te(e,t){return e(t={exports:{}},t.exports),t.exports}var re=te((function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),a=new k(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=b(i,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,a),o}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function p(){}function d(){}var h={};c(h,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(T([])));g&&g!==t&&r.call(g,o)&&(h=g);var m=d.prototype=f.prototype=Object.create(h);function v(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,c){var u=s(e[o],e,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(f).then((function(e){l.value=e,i(l)}),(function(e){return n("throw",e,i,c)}))}c(u.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function T(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,c(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(w.prototype),c(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(u(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},v(m),c(m,i,"Generator"),c(m,o,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=T,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})),ne=function(e){F(o,y.BaseFeatureDataAdapter);var t,r,n=_(o);function o(){var e;return E(this,o),(e=n.apply(this,arguments)).windowSize=1e3,e.windowDelta=1e3,e.gcMode="content",e}return C(o,[{key:"configure",value:(r=q(re.mark((function e(){var t,r,n;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.readConfObject(this.config,"sequenceAdapter"),e.next=3,null===(t=this.getSubAdapter)||void 0===t?void 0:t.call(this,r);case 3:if(n=e.sent){e.next=6;break}throw new Error("Error getting subadapter");case 6:return e.abrupt("return",n.dataAdapter);case 7:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getRefNames",value:(t=q(re.mark((function e(){return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.configure();case 2:return e.abrupt("return",e.sent.getRefNames());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getFeatures",value:function(e,t){var r=this;return this.windowSize=1e3,this.windowDelta=1e3,this.gcMode="content",g.ObservableCreate(function(){var t=q(re.mark((function t(n){var o,a,i,c,u,s,l,f,p,d,h,y,g,w,b,x;return re.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.configure();case 2:if(a=t.sent,i=1===r.windowSize?1:r.windowSize/2,c=1===r.windowSize,u=e.start,s=e.end,u=Math.max(0,u-i),!((s+=i)<0||u>s)){t.next=11;break}return n.complete(),t.abrupt("return");case 11:return l=a.getFeatures(L(L({},e),{},{start:u,end:s})),t.next=14,l.pipe(v.toArray()).toPromise();case 14:for(f=(null===(o=t.sent[0])||void 0===o?void 0:o.get("seq"))||"",p=i;p<f.length-i;p+=r.windowDelta){for(d=c?f[p]:f.slice(p-i,p+i),h=0,y=0,g=0,w=0;w<d.length;w++)"c"===d[w]||"C"===d[w]?h++:"g"!==d[w]&&"G"!==d[w]||y++,"N"!==d[w]&&g++;b=u,x=void 0,"content"===r.gcMode?x=(y+h)/(g||1):"skew"===r.gcMode&&(x=(y-h)/(y+h||1)),n.next(new m({uniqueId:"".concat(r.id,"_").concat(b+p),start:b+p,end:b+p+r.windowDelta,score:x}))}n.complete();case 18:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"freeResources",value:function(){}}]),o}();ne.capabilities=["hasLocalStats"];var oe={__proto__:null,default:ne},ae={__proto__:null,default:function(e){F(a,y.BaseSequenceAdapter);var t,r,n,o=_(a);function a(e,t,r){var n;return E(this,a),(n=o.call(this,e,t,r)).chromSizesData=n.initChromSizes(),n.twobit=new b.TwoBitFile({filehandle:w.openLocation(u.readConfObject(e,"twoBitLocation"),n.pluginManager)}),n}return C(a,[{key:"initChromSizes",value:(n=q(re.mark((function e(){var t,r,n;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("/path/to/default.chrom.sizes"===(t=u.readConfObject(this.config,"chromSizesLocation")).uri||""===t.uri){e.next=7;break}return r=w.openLocation(t,this.pluginManager),e.next=5,r.readFile("utf8");case 5:return n=e.sent,e.abrupt("return",Object.fromEntries(null==n?void 0:n.split("\n").filter((function(e){return!!e.trim()})).map((function(e){var t=z(e.split("\t"),2);return[t[0],+t[1]]}))));case 7:return e.abrupt("return",void 0);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getRefNames",value:(r=q(re.mark((function e(){var t;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.chromSizesData;case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",Object.keys(t));case 5:return e.abrupt("return",this.twobit.getSequenceNames());case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getRegions",value:(t=q(re.mark((function e(){var t,r;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.chromSizesData;case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",Object.keys(t).map((function(e){return{refName:e,start:0,end:t[e]}})));case 5:return e.next=7,this.twobit.getSequenceSizes();case 7:return r=e.sent,e.abrupt("return",Object.keys(r).map((function(e){return{refName:e,start:0,end:r[e]}})));case 9:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getFeatures",value:function(e){var t=this,r=e.refName,n=e.start,o=e.end;return g.ObservableCreate(function(){var e=q(re.mark((function e(a){var i,c,u;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.twobit.getSequenceSize(r);case 2:return c=void 0!==(i=e.sent)?Math.min(i,o):o,e.next=6,t.twobit.getSequence(r,n,c);case 6:(u=e.sent)&&a.next(new m({id:"".concat(r," ").concat(n,"-").concat(c),data:{refName:r,start:n,end:c,seq:u}})),a.complete();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},{key:"freeResources",value:function(){}}]),a}()},ie={__proto__:null,default:function(e){F(o,y.BaseAdapter);var t,r,n=_(o);function o(e,t,r){var a;E(this,o),a=n.call(this,e,t,r);var i=u.readConfObject(e,"chromSizesLocation");if(!i)throw new Error("must provide chromSizesLocation");var c=w.openLocation(i,a.pluginManager);return a.source=c.toString(),a.refSeqs=a.init(c),a}return C(o,[{key:"init",value:(r=q(re.mark((function e(t){var r,n;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.readFile("utf8");case 2:if(n={},(r=e.sent).length){e.next=6;break}throw new Error("Could not read file ".concat(t.toString()));case 6:return r.split("\n").forEach((function(e){if(e.length){var t=z(e.split("\t"),2);n[t[0]]=+t[1]}})),e.abrupt("return",n);case 8:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getRegions",value:(t=q(re.mark((function e(){var t;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.refSeqs;case 2:return t=e.sent,e.abrupt("return",Object.keys(t).map((function(e){return{refName:e,start:0,end:t[e]}})));case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getFeatures",value:function(){throw new Error("sequence not available")}},{key:"getHeader",value:function(){return{}}},{key:"freeResources",value:function(){}}]),o}()},ce=function(e){F(n,y.BaseSequenceAdapter);var t,r=_(n);function n(e,t,o){var a,i;E(this,n),(a=r.call(this,e,t,o)).seqCache=new S({cache:new k({maxSize:200}),fill:(i=q(re.mark((function e(t,r){return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a.fasta.getSequence(t.refName,t.start,t.end,L(L({},t),{},{signal:r})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return i.apply(this,arguments)})});var c=u.readConfObject(e,"fastaLocation"),s=u.readConfObject(e,"faiLocation"),l={fasta:w.openLocation(c,a.pluginManager),fai:w.openLocation(s,a.pluginManager)};return a.fasta=new x.IndexedFasta(l),a}return C(n,[{key:"getRefNames",value:function(e){return this.fasta.getSequenceNames(e)}},{key:"getRegions",value:(t=q(re.mark((function e(t){var r;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fasta.getSequenceSizes(t);case 2:return r=e.sent,e.abrupt("return",Object.keys(r).map((function(e){return{refName:e,start:0,end:r[e]}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getFeatures",value:function(e,t){var r=this,n=e.refName,o=e.start,a=e.end;return g.ObservableCreate(function(){var e=q(re.mark((function e(i){var c,u,s,l,f,p,d,h;return re.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.fasta.getSequenceSize(n,t);case 2:for(u=void 0!==(c=e.sent)?Math.min(c,a):a,s=[],f=a+(128e3-a%128e3),p=l=o-o%128e3;p<f;p+=128e3)d={refName:n,start:p,end:p+128e3},s.push(r.seqCache.get(JSON.stringify(d),d,null==t?void 0:t.signal));return e.next=11,Promise.all(s);case 11:(h=e.sent.join("").slice(o-l).slice(0,a-o))&&i.next(new m({id:"".concat(n," ").concat(o,"-").concat(u),data:{refName:n,start:o,end:u,seq:h}})),i.complete();case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},{key:"freeResources",value:function(){}}]),n}(),ue={__proto__:null,default:ce},se={__proto__:null,default:function(e){F(r,ce);var t=_(r);function r(e,n,o){var a;E(this,r),a=t.call(this,e,n,o);var i=u.readConfObject(e,"fastaLocation"),c=u.readConfObject(e,"faiLocation"),s=u.readConfObject(e,"gziLocation");if(!i)throw new Error("must provide fastaLocation");if(!c)throw new Error("must provide faiLocation");if(!s)throw new Error("must provide gziLocation");var l={fasta:w.openLocation(i,a.pluginManager),fai:w.openLocation(c,a.pluginManager),gzi:w.openLocation(s,a.pluginManager)};return a.fasta=new x.BgzipIndexedFasta(l),a}return C(r)}()};exports.default=ee;
2
2
  //# sourceMappingURL=plugin-sequence.cjs.production.min.js.map