@jbrowse/plugin-sequence 1.6.9 → 1.7.3
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.
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +7 -7
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.js +70 -0
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.test.js +64 -0
- package/dist/BgzipFastaAdapter/configSchema.d.ts +2 -2
- package/dist/BgzipFastaAdapter/configSchema.js +36 -0
- package/dist/BgzipFastaAdapter/index.d.ts +1 -1
- package/dist/BgzipFastaAdapter/index.js +15 -0
- package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +19 -19
- package/dist/ChromSizesAdapter/ChromSizesAdapter.js +170 -0
- package/dist/ChromSizesAdapter/ChromSizesAdapter.test.js +46 -0
- package/dist/ChromSizesAdapter/configSchema.d.ts +2 -2
- package/dist/ChromSizesAdapter/configSchema.js +22 -0
- package/dist/ChromSizesAdapter/index.d.ts +1 -1
- package/dist/ChromSizesAdapter/index.js +15 -0
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +21 -21
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +239 -0
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.test.js +245 -0
- package/dist/DivSequenceRenderer/configSchema.d.ts +2 -2
- package/dist/DivSequenceRenderer/configSchema.js +20 -0
- package/dist/DivSequenceRenderer/index.d.ts +2 -2
- package/dist/DivSequenceRenderer/index.js +23 -0
- package/dist/GCContentAdapter/GCContentAdapter.d.ts +23 -23
- package/dist/GCContentAdapter/GCContentAdapter.js +261 -0
- package/dist/GCContentAdapter/configSchema.d.ts +3 -3
- package/dist/GCContentAdapter/configSchema.js +18 -0
- package/dist/GCContentAdapter/index.d.ts +6 -6
- package/dist/GCContentAdapter/index.js +31 -0
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +25 -25
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +228 -0
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.test.js +71 -0
- package/dist/IndexedFastaAdapter/configSchema.d.ts +2 -2
- package/dist/IndexedFastaAdapter/configSchema.js +29 -0
- package/dist/IndexedFastaAdapter/index.d.ts +1 -1
- package/dist/IndexedFastaAdapter/index.js +15 -0
- package/dist/LinearReferenceSequenceDisplay/configSchema.d.ts +1 -1
- package/dist/LinearReferenceSequenceDisplay/configSchema.js +18 -0
- package/dist/LinearReferenceSequenceDisplay/index.d.ts +2 -2
- package/dist/LinearReferenceSequenceDisplay/index.js +21 -0
- package/dist/LinearReferenceSequenceDisplay/model.d.ts +208 -208
- package/dist/LinearReferenceSequenceDisplay/model.js +102 -0
- package/dist/TwoBitAdapter/TwoBitAdapter.d.ts +26 -26
- package/dist/TwoBitAdapter/TwoBitAdapter.js +289 -0
- package/dist/TwoBitAdapter/TwoBitAdapter.test.js +94 -0
- package/dist/TwoBitAdapter/configSchema.d.ts +2 -2
- package/dist/TwoBitAdapter/configSchema.js +30 -0
- package/dist/TwoBitAdapter/index.d.ts +1 -1
- package/dist/TwoBitAdapter/index.js +15 -0
- package/dist/declare.d.js +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +325 -6
- package/dist/index.test.js +29 -0
- package/dist/referenceSeqTrackConfig.d.ts +2 -2
- package/dist/referenceSeqTrackConfig.js +88 -0
- package/package.json +5 -7
- package/src/index.ts +7 -8
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.test.d.ts +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin-sequence.cjs.development.js +0 -2567
- package/dist/plugin-sequence.cjs.development.js.map +0 -1
- package/dist/plugin-sequence.cjs.production.min.js +0 -2
- package/dist/plugin-sequence.cjs.production.min.js.map +0 -1
- package/dist/plugin-sequence.esm.js +0 -2561
- package/dist/plugin-sequence.esm.js.map +0 -1
|
@@ -1,2561 +0,0 @@
|
|
|
1
|
-
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
|
-
import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
|
-
import FeatureRendererType from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
|
|
4
|
-
import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType';
|
|
5
|
-
import Plugin from '@jbrowse/core/Plugin';
|
|
6
|
-
import { BaseLinearDisplay, BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
7
|
-
import { getFileName, makeIndex } from '@jbrowse/core/util/tracks';
|
|
8
|
-
import { ConfigurationSchema, ConfigurationReference, readConfObject } from '@jbrowse/core/configuration';
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { contrastingTextColor } from '@jbrowse/core/util/color';
|
|
11
|
-
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
12
|
-
import { observer } from 'mobx-react';
|
|
13
|
-
import { generateCodonTable, defaultCodonTable, complement, revcom, defaultStarts, defaultStops, bpSpanPx, getContainingView } from '@jbrowse/core/util';
|
|
14
|
-
import { types } from 'mobx-state-tree';
|
|
15
|
-
import { BaseFeatureDataAdapter, BaseSequenceAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
16
|
-
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
17
|
-
import SimpleFeature from '@jbrowse/core/util/simpleFeature';
|
|
18
|
-
import { toArray } from 'rxjs/operators';
|
|
19
|
-
import { openLocation } from '@jbrowse/core/util/io';
|
|
20
|
-
import { TwoBitFile } from '@gmod/twobit';
|
|
21
|
-
import { IndexedFasta, BgzipIndexedFasta } from '@gmod/indexedfasta';
|
|
22
|
-
import AbortablePromiseCache from 'abortable-promise-cache';
|
|
23
|
-
import LRU from '@jbrowse/core/util/QuickLRU';
|
|
24
|
-
|
|
25
|
-
function ownKeys(object, enumerableOnly) {
|
|
26
|
-
var keys = Object.keys(object);
|
|
27
|
-
|
|
28
|
-
if (Object.getOwnPropertySymbols) {
|
|
29
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
30
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
31
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
32
|
-
})), keys.push.apply(keys, symbols);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return keys;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _objectSpread2(target) {
|
|
39
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
40
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
41
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
42
|
-
_defineProperty(target, key, source[key]);
|
|
43
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
44
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return target;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
52
|
-
try {
|
|
53
|
-
var info = gen[key](arg);
|
|
54
|
-
var value = info.value;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
reject(error);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (info.done) {
|
|
61
|
-
resolve(value);
|
|
62
|
-
} else {
|
|
63
|
-
Promise.resolve(value).then(_next, _throw);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function _asyncToGenerator(fn) {
|
|
68
|
-
return function () {
|
|
69
|
-
var self = this,
|
|
70
|
-
args = arguments;
|
|
71
|
-
return new Promise(function (resolve, reject) {
|
|
72
|
-
var gen = fn.apply(self, args);
|
|
73
|
-
|
|
74
|
-
function _next(value) {
|
|
75
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _throw(err) {
|
|
79
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
_next(undefined);
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function _classCallCheck(instance, Constructor) {
|
|
88
|
-
if (!(instance instanceof Constructor)) {
|
|
89
|
-
throw new TypeError("Cannot call a class as a function");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function _defineProperties(target, props) {
|
|
94
|
-
for (var i = 0; i < props.length; i++) {
|
|
95
|
-
var descriptor = props[i];
|
|
96
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
97
|
-
descriptor.configurable = true;
|
|
98
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
99
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
104
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
105
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
106
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
107
|
-
writable: false
|
|
108
|
-
});
|
|
109
|
-
return Constructor;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function _defineProperty(obj, key, value) {
|
|
113
|
-
if (key in obj) {
|
|
114
|
-
Object.defineProperty(obj, key, {
|
|
115
|
-
value: value,
|
|
116
|
-
enumerable: true,
|
|
117
|
-
configurable: true,
|
|
118
|
-
writable: true
|
|
119
|
-
});
|
|
120
|
-
} else {
|
|
121
|
-
obj[key] = value;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return obj;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function _inherits(subClass, superClass) {
|
|
128
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
129
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
133
|
-
constructor: {
|
|
134
|
-
value: subClass,
|
|
135
|
-
writable: true,
|
|
136
|
-
configurable: true
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
Object.defineProperty(subClass, "prototype", {
|
|
140
|
-
writable: false
|
|
141
|
-
});
|
|
142
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function _getPrototypeOf(o) {
|
|
146
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
147
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
148
|
-
};
|
|
149
|
-
return _getPrototypeOf(o);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function _setPrototypeOf(o, p) {
|
|
153
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
154
|
-
o.__proto__ = p;
|
|
155
|
-
return o;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
return _setPrototypeOf(o, p);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function _isNativeReflectConstruct() {
|
|
162
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
163
|
-
if (Reflect.construct.sham) return false;
|
|
164
|
-
if (typeof Proxy === "function") return true;
|
|
165
|
-
|
|
166
|
-
try {
|
|
167
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
168
|
-
return true;
|
|
169
|
-
} catch (e) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function _assertThisInitialized(self) {
|
|
175
|
-
if (self === void 0) {
|
|
176
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return self;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function _possibleConstructorReturn(self, call) {
|
|
183
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
184
|
-
return call;
|
|
185
|
-
} else if (call !== void 0) {
|
|
186
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return _assertThisInitialized(self);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function _createSuper(Derived) {
|
|
193
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
194
|
-
|
|
195
|
-
return function _createSuperInternal() {
|
|
196
|
-
var Super = _getPrototypeOf(Derived),
|
|
197
|
-
result;
|
|
198
|
-
|
|
199
|
-
if (hasNativeReflectConstruct) {
|
|
200
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
201
|
-
|
|
202
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
203
|
-
} else {
|
|
204
|
-
result = Super.apply(this, arguments);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return _possibleConstructorReturn(this, result);
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function _slicedToArray(arr, i) {
|
|
212
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function _toConsumableArray(arr) {
|
|
216
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function _arrayWithoutHoles(arr) {
|
|
220
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function _arrayWithHoles(arr) {
|
|
224
|
-
if (Array.isArray(arr)) return arr;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function _iterableToArray(iter) {
|
|
228
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function _iterableToArrayLimit(arr, i) {
|
|
232
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
233
|
-
|
|
234
|
-
if (_i == null) return;
|
|
235
|
-
var _arr = [];
|
|
236
|
-
var _n = true;
|
|
237
|
-
var _d = false;
|
|
238
|
-
|
|
239
|
-
var _s, _e;
|
|
240
|
-
|
|
241
|
-
try {
|
|
242
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
243
|
-
_arr.push(_s.value);
|
|
244
|
-
|
|
245
|
-
if (i && _arr.length === i) break;
|
|
246
|
-
}
|
|
247
|
-
} catch (err) {
|
|
248
|
-
_d = true;
|
|
249
|
-
_e = err;
|
|
250
|
-
} finally {
|
|
251
|
-
try {
|
|
252
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
253
|
-
} finally {
|
|
254
|
-
if (_d) throw _e;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return _arr;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
262
|
-
if (!o) return;
|
|
263
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
264
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
265
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
266
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
267
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function _arrayLikeToArray(arr, len) {
|
|
271
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
272
|
-
|
|
273
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
274
|
-
|
|
275
|
-
return arr2;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function _nonIterableSpread() {
|
|
279
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
function _nonIterableRest() {
|
|
283
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
var bgzipFastaAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('BgzipFastaAdapter', {
|
|
287
|
-
fastaLocation: {
|
|
288
|
-
type: 'fileLocation',
|
|
289
|
-
defaultValue: {
|
|
290
|
-
uri: '/path/to/seq.fa.gz',
|
|
291
|
-
locationType: 'UriLocation'
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
faiLocation: {
|
|
295
|
-
type: 'fileLocation',
|
|
296
|
-
defaultValue: {
|
|
297
|
-
uri: '/path/to/seq.fa.gz.fai',
|
|
298
|
-
locationType: 'UriLocation'
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
gziLocation: {
|
|
302
|
-
type: 'fileLocation',
|
|
303
|
-
defaultValue: {
|
|
304
|
-
uri: '/path/to/seq.fa.gz.gzi',
|
|
305
|
-
locationType: 'UriLocation'
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}, {
|
|
309
|
-
explicitlyTyped: true
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
var chromSizesAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('ChromSizesAdapter', {
|
|
313
|
-
chromSizesLocation: {
|
|
314
|
-
type: 'fileLocation',
|
|
315
|
-
defaultValue: {
|
|
316
|
-
uri: '/path/to/species.chrom.sizes',
|
|
317
|
-
locationType: 'UriLocation'
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}, {
|
|
321
|
-
explicitlyTyped: true
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
function Translation(props) {
|
|
325
|
-
var codonTable = props.codonTable,
|
|
326
|
-
seq = props.seq,
|
|
327
|
-
frame = props.frame,
|
|
328
|
-
bpPerPx = props.bpPerPx,
|
|
329
|
-
region = props.region,
|
|
330
|
-
height = props.height,
|
|
331
|
-
y = props.y,
|
|
332
|
-
_props$reverse = props.reverse,
|
|
333
|
-
reverse = _props$reverse === void 0 ? false : _props$reverse,
|
|
334
|
-
theme = props.theme;
|
|
335
|
-
var scale = bpPerPx; // the tilt variable normalizes the frame to where we are starting from,
|
|
336
|
-
// which increases consistency across blocks
|
|
337
|
-
|
|
338
|
-
var tilt = 3 - region.start % 3; // the effectiveFrame incorporates tilt and the frame to say what the
|
|
339
|
-
// effective frame that is plotted. The +3 is for when frame is -2 and this
|
|
340
|
-
// can otherwise result in effectiveFrame -1
|
|
341
|
-
|
|
342
|
-
var effectiveFrame = (frame + tilt + 3) % 3;
|
|
343
|
-
var seqSliced = seq.slice(effectiveFrame);
|
|
344
|
-
var translated = [];
|
|
345
|
-
|
|
346
|
-
for (var i = 0; i < seqSliced.length; i += 3) {
|
|
347
|
-
var codon = seqSliced.slice(i, i + 3);
|
|
348
|
-
var normalizedCodon = reverse ? revcom(codon) : codon;
|
|
349
|
-
var aminoAcid = codonTable[normalizedCodon] || '';
|
|
350
|
-
translated.push({
|
|
351
|
-
letter: aminoAcid,
|
|
352
|
-
codon: normalizedCodon.toUpperCase()
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
var w = 1 / scale * 3;
|
|
357
|
-
var drop = region.start === 0 ? 0 : w;
|
|
358
|
-
var render = 1 / bpPerPx >= 12;
|
|
359
|
-
var width = (region.end - region.start) / bpPerPx;
|
|
360
|
-
var map = ['#d8d8d8', '#adadad', '#8f8f8f'].reverse();
|
|
361
|
-
return React.createElement(React.Fragment, null, translated.map(function (element, index) {
|
|
362
|
-
var x = region.reversed ? width - (w * (index + 1) + effectiveFrame / scale - drop) : w * index + effectiveFrame / scale - drop;
|
|
363
|
-
var letter = element.letter,
|
|
364
|
-
codon = element.codon;
|
|
365
|
-
return React.createElement(React.Fragment, {
|
|
366
|
-
key: "".concat(index, "-").concat(letter)
|
|
367
|
-
}, React.createElement("rect", {
|
|
368
|
-
x: x,
|
|
369
|
-
y: y,
|
|
370
|
-
width: render ? w : w + 0.7
|
|
371
|
-
/* small fudge factor when zoomed out*/
|
|
372
|
-
,
|
|
373
|
-
height: height,
|
|
374
|
-
stroke: render ? '#555' : 'none',
|
|
375
|
-
fill: defaultStarts.includes(codon) ? theme.palette.startCodon : defaultStops.includes(codon) ? theme.palette.stopCodon : map[Math.abs(frame)]
|
|
376
|
-
}), render ? React.createElement("text", {
|
|
377
|
-
x: x + w / 2,
|
|
378
|
-
y: y + height / 2,
|
|
379
|
-
dominantBaseline: "middle",
|
|
380
|
-
textAnchor: "middle"
|
|
381
|
-
}, letter) : null);
|
|
382
|
-
}));
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
function DNA(props) {
|
|
386
|
-
var bpPerPx = props.bpPerPx,
|
|
387
|
-
region = props.region,
|
|
388
|
-
feature = props.feature,
|
|
389
|
-
theme = props.theme,
|
|
390
|
-
height = props.height,
|
|
391
|
-
seq = props.seq,
|
|
392
|
-
y = props.y;
|
|
393
|
-
var render = 1 / bpPerPx >= 12;
|
|
394
|
-
|
|
395
|
-
var _bpSpanPx = bpSpanPx(feature.get('start'), feature.get('end'), region, bpPerPx),
|
|
396
|
-
_bpSpanPx2 = _slicedToArray(_bpSpanPx, 2),
|
|
397
|
-
leftPx = _bpSpanPx2[0],
|
|
398
|
-
rightPx = _bpSpanPx2[1];
|
|
399
|
-
|
|
400
|
-
var reverse = region.reversed;
|
|
401
|
-
var len = feature.get('end') - feature.get('start');
|
|
402
|
-
var w = Math.max((rightPx - leftPx) / len, 0.8);
|
|
403
|
-
return React.createElement(React.Fragment, null, seq.split('').map(function (letter, index) {
|
|
404
|
-
var color = theme.palette.bases[letter.toUpperCase()];
|
|
405
|
-
var x = reverse ? rightPx - (index + 1) * w : leftPx + index * w;
|
|
406
|
-
return React.createElement(React.Fragment, {
|
|
407
|
-
key: index
|
|
408
|
-
}, React.createElement("rect", {
|
|
409
|
-
x: x,
|
|
410
|
-
y: y,
|
|
411
|
-
width: w,
|
|
412
|
-
height: height,
|
|
413
|
-
fill: color ? color.main : '#aaa',
|
|
414
|
-
stroke: render ? '#555' : 'none'
|
|
415
|
-
}), render ? React.createElement("text", {
|
|
416
|
-
x: x + w / 2,
|
|
417
|
-
y: y + height / 2,
|
|
418
|
-
dominantBaseline: "middle",
|
|
419
|
-
textAnchor: "middle",
|
|
420
|
-
fill: color ? contrastingTextColor(color.main) : 'black'
|
|
421
|
-
}, letter) : null);
|
|
422
|
-
}));
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
var SequenceSVG = function SequenceSVG(_ref) {
|
|
426
|
-
var regions = _ref.regions,
|
|
427
|
-
configTheme = _ref.theme,
|
|
428
|
-
_ref$features = _ref.features,
|
|
429
|
-
features = _ref$features === void 0 ? new Map() : _ref$features,
|
|
430
|
-
showReverse = _ref.showReverse,
|
|
431
|
-
showForward = _ref.showForward,
|
|
432
|
-
showTranslation = _ref.showTranslation,
|
|
433
|
-
bpPerPx = _ref.bpPerPx;
|
|
434
|
-
|
|
435
|
-
var _regions = _slicedToArray(regions, 1),
|
|
436
|
-
region = _regions[0];
|
|
437
|
-
|
|
438
|
-
var theme = createJBrowseTheme(configTheme);
|
|
439
|
-
var codonTable = generateCodonTable(defaultCodonTable);
|
|
440
|
-
var height = 20;
|
|
441
|
-
|
|
442
|
-
var _ref2 = _toConsumableArray(features.values()),
|
|
443
|
-
feature = _ref2[0];
|
|
444
|
-
|
|
445
|
-
if (!feature) {
|
|
446
|
-
return null;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
var seq = feature.get('seq');
|
|
450
|
-
|
|
451
|
-
if (!seq) {
|
|
452
|
-
return null;
|
|
453
|
-
} // incrementer for the y-position of the current sequence being rendered
|
|
454
|
-
// (applies to both translation rows and dna rows)
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
var currY = -20;
|
|
458
|
-
return React.createElement(React.Fragment, null, showTranslation && (region.reversed ? showReverse : showForward) ? [2, 1, 0].map(function (index) {
|
|
459
|
-
return React.createElement(Translation, {
|
|
460
|
-
key: "translation-".concat(index),
|
|
461
|
-
seq: seq,
|
|
462
|
-
y: currY += 20,
|
|
463
|
-
codonTable: codonTable,
|
|
464
|
-
frame: index,
|
|
465
|
-
bpPerPx: bpPerPx,
|
|
466
|
-
region: region,
|
|
467
|
-
theme: theme,
|
|
468
|
-
height: height,
|
|
469
|
-
reverse: region.reversed
|
|
470
|
-
});
|
|
471
|
-
}) : null, showForward ? React.createElement(DNA, {
|
|
472
|
-
height: height,
|
|
473
|
-
y: currY += 20,
|
|
474
|
-
feature: feature,
|
|
475
|
-
region: region,
|
|
476
|
-
seq: region.reversed ? complement(seq) : seq,
|
|
477
|
-
bpPerPx: bpPerPx,
|
|
478
|
-
theme: theme
|
|
479
|
-
}) : null, showReverse ? React.createElement(DNA, {
|
|
480
|
-
height: height,
|
|
481
|
-
y: currY += 20,
|
|
482
|
-
feature: feature,
|
|
483
|
-
region: region,
|
|
484
|
-
seq: region.reversed ? seq : complement(seq),
|
|
485
|
-
bpPerPx: bpPerPx,
|
|
486
|
-
theme: theme
|
|
487
|
-
}) : null, showTranslation && (region.reversed ? showForward : showReverse) ? [0, -1, -2].map(function (index) {
|
|
488
|
-
return React.createElement(Translation, {
|
|
489
|
-
key: "rev-translation-".concat(index),
|
|
490
|
-
seq: seq,
|
|
491
|
-
y: currY += 20,
|
|
492
|
-
codonTable: codonTable,
|
|
493
|
-
frame: index,
|
|
494
|
-
bpPerPx: bpPerPx,
|
|
495
|
-
region: region,
|
|
496
|
-
theme: theme,
|
|
497
|
-
height: height,
|
|
498
|
-
reverse: !region.reversed
|
|
499
|
-
});
|
|
500
|
-
}) : null);
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
var Wrapper = function Wrapper(_ref3) {
|
|
504
|
-
var exportSVG = _ref3.exportSVG,
|
|
505
|
-
width = _ref3.width,
|
|
506
|
-
totalHeight = _ref3.totalHeight,
|
|
507
|
-
children = _ref3.children;
|
|
508
|
-
return exportSVG ? React.createElement(React.Fragment, null, children) : React.createElement("svg", {
|
|
509
|
-
"data-testid": "sequence_track",
|
|
510
|
-
width: width,
|
|
511
|
-
height: totalHeight,
|
|
512
|
-
style: {
|
|
513
|
-
width: width,
|
|
514
|
-
height: totalHeight
|
|
515
|
-
}
|
|
516
|
-
}, children);
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
function Sequence(props) {
|
|
520
|
-
var regions = props.regions,
|
|
521
|
-
bpPerPx = props.bpPerPx;
|
|
522
|
-
|
|
523
|
-
var _regions2 = _slicedToArray(regions, 1),
|
|
524
|
-
region = _regions2[0];
|
|
525
|
-
|
|
526
|
-
var width = (region.end - region.start) / bpPerPx;
|
|
527
|
-
var totalHeight = 200;
|
|
528
|
-
return React.createElement(Wrapper, Object.assign({}, props, {
|
|
529
|
-
totalHeight: totalHeight,
|
|
530
|
-
width: width
|
|
531
|
-
}), React.createElement(SequenceSVG, Object.assign({}, props)));
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
var DivSequenceRendererReactComponent = /*#__PURE__*/observer(Sequence);
|
|
535
|
-
|
|
536
|
-
var divSequenceRendererConfigSchema = /*#__PURE__*/ConfigurationSchema('DivSequenceRenderer', {
|
|
537
|
-
height: {
|
|
538
|
-
type: 'number',
|
|
539
|
-
description: 'height in pixels of each line of sequence',
|
|
540
|
-
defaultValue: 16
|
|
541
|
-
}
|
|
542
|
-
}, {
|
|
543
|
-
explicitlyTyped: true
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
var indexedFastaAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('IndexedFastaAdapter', {
|
|
547
|
-
fastaLocation: {
|
|
548
|
-
type: 'fileLocation',
|
|
549
|
-
defaultValue: {
|
|
550
|
-
uri: '/path/to/seq.fa',
|
|
551
|
-
locationType: 'UriLocation'
|
|
552
|
-
}
|
|
553
|
-
},
|
|
554
|
-
faiLocation: {
|
|
555
|
-
type: 'fileLocation',
|
|
556
|
-
defaultValue: {
|
|
557
|
-
uri: '/path/to/seq.fa.fai',
|
|
558
|
-
locationType: 'UriLocation'
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}, {
|
|
562
|
-
explicitlyTyped: true
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
var configSchema = /*#__PURE__*/ConfigurationSchema('LinearReferenceSequenceDisplay', {
|
|
566
|
-
renderer: divSequenceRendererConfigSchema
|
|
567
|
-
}, {
|
|
568
|
-
explicitIdentifier: 'displayId',
|
|
569
|
-
explicitlyTyped: true
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
function modelFactory(configSchema) {
|
|
573
|
-
return types.compose('LinearReferenceSequenceDisplay', BaseLinearDisplay, types.model({
|
|
574
|
-
type: types.literal('LinearReferenceSequenceDisplay'),
|
|
575
|
-
configuration: ConfigurationReference(configSchema),
|
|
576
|
-
showForward: types.optional(types["boolean"], true),
|
|
577
|
-
showReverse: types.optional(types["boolean"], true),
|
|
578
|
-
showTranslation: types.optional(types["boolean"], true),
|
|
579
|
-
height: 180
|
|
580
|
-
})).views(function (self) {
|
|
581
|
-
var superRenderProps = self.renderProps;
|
|
582
|
-
return {
|
|
583
|
-
renderProps: function renderProps() {
|
|
584
|
-
var showForward = self.showForward,
|
|
585
|
-
showReverse = self.showReverse,
|
|
586
|
-
showTranslation = self.showTranslation;
|
|
587
|
-
return _objectSpread2(_objectSpread2({}, superRenderProps()), {}, {
|
|
588
|
-
rpcDriverName: self.rpcDriverName,
|
|
589
|
-
config: self.configuration.renderer,
|
|
590
|
-
showForward: showForward,
|
|
591
|
-
showReverse: showReverse,
|
|
592
|
-
showTranslation: showTranslation
|
|
593
|
-
});
|
|
594
|
-
},
|
|
595
|
-
regionCannotBeRendered: function regionCannotBeRendered() {
|
|
596
|
-
var view = getContainingView(self);
|
|
597
|
-
|
|
598
|
-
if (view && view.bpPerPx >= 1) {
|
|
599
|
-
return 'Zoom in to see sequence';
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
return undefined;
|
|
603
|
-
},
|
|
604
|
-
|
|
605
|
-
get rendererTypeName() {
|
|
606
|
-
return self.configuration.renderer.type;
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
};
|
|
610
|
-
}).actions(function (self) {
|
|
611
|
-
return {
|
|
612
|
-
toggleShowForward: function toggleShowForward() {
|
|
613
|
-
self.showForward = !self.showForward;
|
|
614
|
-
},
|
|
615
|
-
toggleShowReverse: function toggleShowReverse() {
|
|
616
|
-
self.showReverse = !self.showReverse;
|
|
617
|
-
},
|
|
618
|
-
toggleShowTranslation: function toggleShowTranslation() {
|
|
619
|
-
self.showTranslation = !self.showTranslation;
|
|
620
|
-
}
|
|
621
|
-
};
|
|
622
|
-
}).views(function (self) {
|
|
623
|
-
return {
|
|
624
|
-
trackMenuItems: function trackMenuItems() {
|
|
625
|
-
return [{
|
|
626
|
-
label: 'Show forward',
|
|
627
|
-
type: 'checkbox',
|
|
628
|
-
checked: self.showForward,
|
|
629
|
-
onClick: function onClick() {
|
|
630
|
-
self.toggleShowForward();
|
|
631
|
-
}
|
|
632
|
-
}, {
|
|
633
|
-
label: 'Show reverse',
|
|
634
|
-
type: 'checkbox',
|
|
635
|
-
checked: self.showReverse,
|
|
636
|
-
onClick: function onClick() {
|
|
637
|
-
self.toggleShowReverse();
|
|
638
|
-
}
|
|
639
|
-
}, {
|
|
640
|
-
label: 'Show translation',
|
|
641
|
-
type: 'checkbox',
|
|
642
|
-
checked: self.showTranslation,
|
|
643
|
-
onClick: function onClick() {
|
|
644
|
-
self.toggleShowTranslation();
|
|
645
|
-
}
|
|
646
|
-
}];
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
var twoBitAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('TwoBitAdapter', {
|
|
653
|
-
twoBitLocation: {
|
|
654
|
-
type: 'fileLocation',
|
|
655
|
-
defaultValue: {
|
|
656
|
-
uri: '/path/to/my.2bit',
|
|
657
|
-
locationType: 'UriLocation'
|
|
658
|
-
}
|
|
659
|
-
},
|
|
660
|
-
chromSizesLocation: {
|
|
661
|
-
type: 'fileLocation',
|
|
662
|
-
defaultValue: {
|
|
663
|
-
uri: '/path/to/default.chrom.sizes',
|
|
664
|
-
locationType: 'UriLocation'
|
|
665
|
-
},
|
|
666
|
-
description: 'An optional chrom.sizes file can be supplied to speed up loading since parsing the twobit file can take time'
|
|
667
|
-
}
|
|
668
|
-
}, {
|
|
669
|
-
explicitlyTyped: true
|
|
670
|
-
});
|
|
671
|
-
|
|
672
|
-
var configSchemaF = (function (pluginManager) {
|
|
673
|
-
return ConfigurationSchema('GCContentAdapter', {
|
|
674
|
-
sequenceAdapter: pluginManager.pluggableConfigSchemaType('adapter')
|
|
675
|
-
}, {
|
|
676
|
-
explicitlyTyped: true
|
|
677
|
-
});
|
|
678
|
-
});
|
|
679
|
-
|
|
680
|
-
var GCContentAdapterF = (function (pluginManager) {
|
|
681
|
-
return {
|
|
682
|
-
configSchema: pluginManager.load(configSchemaF),
|
|
683
|
-
getAdapterClass: function getAdapterClass() {
|
|
684
|
-
return Promise.resolve().then(function () { return GCContentAdapter; }).then(function (r) {
|
|
685
|
-
return r["default"];
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
};
|
|
689
|
-
});
|
|
690
|
-
|
|
691
|
-
/*
|
|
692
|
-
Note: this is primarily a copy of createBaseTrackConfig, except with a subset
|
|
693
|
-
of the config slots, to avoid including fields that don't make sense for the
|
|
694
|
-
ReferenceSequenceTrack
|
|
695
|
-
*/
|
|
696
|
-
|
|
697
|
-
function createReferenceSeqTrackConfig(pluginManager) {
|
|
698
|
-
return ConfigurationSchema('ReferenceSequenceTrack', {
|
|
699
|
-
adapter: pluginManager.pluggableConfigSchemaType('adapter'),
|
|
700
|
-
displays: types.array(pluginManager.pluggableConfigSchemaType('display')),
|
|
701
|
-
metadata: {
|
|
702
|
-
type: 'frozen',
|
|
703
|
-
description: 'anything to add about this track',
|
|
704
|
-
defaultValue: {}
|
|
705
|
-
}
|
|
706
|
-
}, {
|
|
707
|
-
preProcessSnapshot: function preProcessSnapshot(s) {
|
|
708
|
-
var snap = JSON.parse(JSON.stringify(s));
|
|
709
|
-
var displayTypes = new Set();
|
|
710
|
-
var _snap$displays = snap.displays,
|
|
711
|
-
displays = _snap$displays === void 0 ? [] : _snap$displays;
|
|
712
|
-
|
|
713
|
-
if (snap.trackId !== 'placeholderId') {
|
|
714
|
-
// Gets the displays on the track snapshot and the possible displays
|
|
715
|
-
// from the track type and adds any missing possible displays to the
|
|
716
|
-
// snapshot
|
|
717
|
-
displays.forEach(function (d) {
|
|
718
|
-
return d && displayTypes.add(d.type);
|
|
719
|
-
});
|
|
720
|
-
var trackType = pluginManager.getTrackType(snap.type);
|
|
721
|
-
trackType.displayTypes.forEach(function (displayType) {
|
|
722
|
-
if (!displayTypes.has(displayType.name)) {
|
|
723
|
-
displays.push({
|
|
724
|
-
displayId: "".concat(snap.trackId, "-").concat(displayType.name),
|
|
725
|
-
type: displayType.name
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
return _objectSpread2(_objectSpread2({}, snap), {}, {
|
|
732
|
-
displays: displays
|
|
733
|
-
});
|
|
734
|
-
},
|
|
735
|
-
explicitIdentifier: 'trackId',
|
|
736
|
-
explicitlyTyped: true,
|
|
737
|
-
actions: function actions(self) {
|
|
738
|
-
return {
|
|
739
|
-
addDisplayConf: function addDisplayConf(displayConf) {
|
|
740
|
-
var type = displayConf.type;
|
|
741
|
-
|
|
742
|
-
if (!type) {
|
|
743
|
-
throw new Error("unknown display type ".concat(type));
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
var display = self.displays.find(function (d) {
|
|
747
|
-
return d && d.displayId === displayConf.displayId;
|
|
748
|
-
});
|
|
749
|
-
|
|
750
|
-
if (display) {
|
|
751
|
-
return display;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
var length = self.displays.push(displayConf);
|
|
755
|
-
return self.displays[length - 1];
|
|
756
|
-
}
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
/* adjust in both directions */
|
|
763
|
-
|
|
764
|
-
var DivSequenceRenderer = /*#__PURE__*/function (_FeatureRendererType) {
|
|
765
|
-
_inherits(DivSequenceRenderer, _FeatureRendererType);
|
|
766
|
-
|
|
767
|
-
var _super = /*#__PURE__*/_createSuper(DivSequenceRenderer);
|
|
768
|
-
|
|
769
|
-
function DivSequenceRenderer() {
|
|
770
|
-
var _this;
|
|
771
|
-
|
|
772
|
-
_classCallCheck(this, DivSequenceRenderer);
|
|
773
|
-
|
|
774
|
-
_this = _super.apply(this, arguments);
|
|
775
|
-
_this.supportsSVG = true;
|
|
776
|
-
return _this;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
_createClass(DivSequenceRenderer, [{
|
|
780
|
-
key: "getExpandedRegion",
|
|
781
|
-
value: function getExpandedRegion(region) {
|
|
782
|
-
return _objectSpread2(_objectSpread2({}, region), {}, {
|
|
783
|
-
start: Math.max(region.start - 3, 0),
|
|
784
|
-
end: region.end + 3
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
|
-
}]);
|
|
788
|
-
|
|
789
|
-
return DivSequenceRenderer;
|
|
790
|
-
}(FeatureRendererType);
|
|
791
|
-
|
|
792
|
-
var SequencePlugin = /*#__PURE__*/function (_Plugin) {
|
|
793
|
-
_inherits(SequencePlugin, _Plugin);
|
|
794
|
-
|
|
795
|
-
var _super2 = /*#__PURE__*/_createSuper(SequencePlugin);
|
|
796
|
-
|
|
797
|
-
function SequencePlugin() {
|
|
798
|
-
var _this2;
|
|
799
|
-
|
|
800
|
-
_classCallCheck(this, SequencePlugin);
|
|
801
|
-
|
|
802
|
-
_this2 = _super2.apply(this, arguments);
|
|
803
|
-
_this2.name = 'SequencePlugin';
|
|
804
|
-
return _this2;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
_createClass(SequencePlugin, [{
|
|
808
|
-
key: "install",
|
|
809
|
-
value: function install(pluginManager) {
|
|
810
|
-
pluginManager.addAdapterType(function () {
|
|
811
|
-
return new AdapterType({
|
|
812
|
-
name: 'TwoBitAdapter',
|
|
813
|
-
configSchema: twoBitAdapterConfigSchema,
|
|
814
|
-
adapterMetadata: {
|
|
815
|
-
category: null,
|
|
816
|
-
hiddenFromGUI: true,
|
|
817
|
-
displayName: null,
|
|
818
|
-
description: null
|
|
819
|
-
},
|
|
820
|
-
getAdapterClass: function getAdapterClass() {
|
|
821
|
-
return Promise.resolve().then(function () { return TwoBitAdapter$1; }).then(function (r) {
|
|
822
|
-
return r["default"];
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
});
|
|
827
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
828
|
-
return function (file, index, adapterHint) {
|
|
829
|
-
var regexGuess = /\.2bit$/i;
|
|
830
|
-
var adapterName = 'TwoBitAdapter';
|
|
831
|
-
var fileName = getFileName(file);
|
|
832
|
-
var obj = {
|
|
833
|
-
type: adapterName,
|
|
834
|
-
twoBitLocation: file
|
|
835
|
-
};
|
|
836
|
-
|
|
837
|
-
if (regexGuess.test(fileName) && !adapterHint) {
|
|
838
|
-
return obj;
|
|
839
|
-
} else if (adapterHint === adapterName) {
|
|
840
|
-
return obj;
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
return adapterGuesser(file, index, adapterHint);
|
|
844
|
-
};
|
|
845
|
-
});
|
|
846
|
-
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', function (trackTypeGuesser) {
|
|
847
|
-
return function (adapterName) {
|
|
848
|
-
if (adapterName === 'TwoBitAdapter') {
|
|
849
|
-
return 'ReferenceSequenceTrack';
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
return trackTypeGuesser(adapterName);
|
|
853
|
-
};
|
|
854
|
-
});
|
|
855
|
-
pluginManager.addAdapterType(function () {
|
|
856
|
-
return new AdapterType({
|
|
857
|
-
name: 'ChromSizesAdapter',
|
|
858
|
-
configSchema: chromSizesAdapterConfigSchema,
|
|
859
|
-
adapterMetadata: {
|
|
860
|
-
category: null,
|
|
861
|
-
hiddenFromGUI: true,
|
|
862
|
-
displayName: null,
|
|
863
|
-
description: null
|
|
864
|
-
},
|
|
865
|
-
getAdapterClass: function getAdapterClass() {
|
|
866
|
-
return Promise.resolve().then(function () { return ChromSizesAdapter; }).then(function (r) {
|
|
867
|
-
return r["default"];
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
});
|
|
871
|
-
});
|
|
872
|
-
pluginManager.addAdapterType(function () {
|
|
873
|
-
return new AdapterType({
|
|
874
|
-
name: 'IndexedFastaAdapter',
|
|
875
|
-
configSchema: indexedFastaAdapterConfigSchema,
|
|
876
|
-
adapterMetadata: {
|
|
877
|
-
category: null,
|
|
878
|
-
hiddenFromGUI: true,
|
|
879
|
-
displayName: null,
|
|
880
|
-
description: null
|
|
881
|
-
},
|
|
882
|
-
getAdapterClass: function getAdapterClass() {
|
|
883
|
-
return Promise.resolve().then(function () { return IndexedFastaAdapter; }).then(function (r) {
|
|
884
|
-
return r["default"];
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
});
|
|
888
|
-
});
|
|
889
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
890
|
-
return function (file, index, adapterHint) {
|
|
891
|
-
var regexGuess = /\.(fa|fasta|fas|fna|mfa)$/i;
|
|
892
|
-
var adapterName = 'IndexedFastaAdapter';
|
|
893
|
-
var fileName = getFileName(file);
|
|
894
|
-
var obj = {
|
|
895
|
-
type: adapterName,
|
|
896
|
-
fastaLocation: file,
|
|
897
|
-
faiLocation: index || makeIndex(file, '.fai')
|
|
898
|
-
};
|
|
899
|
-
|
|
900
|
-
if (regexGuess.test(fileName) && !adapterHint) {
|
|
901
|
-
return obj;
|
|
902
|
-
} else if (adapterHint === adapterName) {
|
|
903
|
-
return obj;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
return adapterGuesser(file, index, adapterHint);
|
|
907
|
-
};
|
|
908
|
-
});
|
|
909
|
-
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', function (trackTypeGuesser) {
|
|
910
|
-
return function (adapterName) {
|
|
911
|
-
if (adapterName === 'IndexedFastaAdapter') {
|
|
912
|
-
return 'ReferenceSequenceTrack';
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
return trackTypeGuesser(adapterName);
|
|
916
|
-
};
|
|
917
|
-
});
|
|
918
|
-
pluginManager.addAdapterType(function () {
|
|
919
|
-
return new AdapterType({
|
|
920
|
-
name: 'BgzipFastaAdapter',
|
|
921
|
-
configSchema: bgzipFastaAdapterConfigSchema,
|
|
922
|
-
adapterMetadata: {
|
|
923
|
-
category: null,
|
|
924
|
-
hiddenFromGUI: true,
|
|
925
|
-
displayName: null,
|
|
926
|
-
description: null
|
|
927
|
-
},
|
|
928
|
-
getAdapterClass: function getAdapterClass() {
|
|
929
|
-
return Promise.resolve().then(function () { return BgzipFastaAdapter; }).then(function (r) {
|
|
930
|
-
return r["default"];
|
|
931
|
-
});
|
|
932
|
-
}
|
|
933
|
-
});
|
|
934
|
-
});
|
|
935
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
936
|
-
return function (file, index, adapterHint) {
|
|
937
|
-
var regexGuess = /\.(fa|fasta|fas|fna|mfa)\.b?gz$/i;
|
|
938
|
-
var adapterName = 'BgzipFastaAdapter';
|
|
939
|
-
var fileName = getFileName(file);
|
|
940
|
-
var obj = {
|
|
941
|
-
type: adapterName,
|
|
942
|
-
faiLocation: makeIndex(file, '.fai'),
|
|
943
|
-
gziLocation: makeIndex(file, '.gzi')
|
|
944
|
-
};
|
|
945
|
-
|
|
946
|
-
if (regexGuess.test(fileName) && !adapterHint) {
|
|
947
|
-
return obj;
|
|
948
|
-
} else if (adapterHint === adapterName) {
|
|
949
|
-
return obj;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
return adapterGuesser(file, index, adapterHint);
|
|
953
|
-
};
|
|
954
|
-
});
|
|
955
|
-
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', function (trackTypeGuesser) {
|
|
956
|
-
return function (adapterName) {
|
|
957
|
-
if (adapterName === 'BgzipFastaAdapter') {
|
|
958
|
-
return 'ReferenceSequenceTrack';
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
return trackTypeGuesser(adapterName);
|
|
962
|
-
};
|
|
963
|
-
});
|
|
964
|
-
pluginManager.addAdapterType(function () {
|
|
965
|
-
return new AdapterType(_objectSpread2({
|
|
966
|
-
name: 'GCContentAdapter',
|
|
967
|
-
adapterMetadata: {
|
|
968
|
-
category: null,
|
|
969
|
-
hiddenFromGUI: true,
|
|
970
|
-
displayName: null,
|
|
971
|
-
description: null
|
|
972
|
-
}
|
|
973
|
-
}, pluginManager.load(GCContentAdapterF)));
|
|
974
|
-
});
|
|
975
|
-
pluginManager.addTrackType(function () {
|
|
976
|
-
var configSchema = createReferenceSeqTrackConfig(pluginManager);
|
|
977
|
-
return new TrackType({
|
|
978
|
-
name: 'ReferenceSequenceTrack',
|
|
979
|
-
configSchema: configSchema,
|
|
980
|
-
stateModel: createBaseTrackModel(pluginManager, 'ReferenceSequenceTrack', configSchema)
|
|
981
|
-
});
|
|
982
|
-
});
|
|
983
|
-
pluginManager.addDisplayType(function () {
|
|
984
|
-
var stateModel = modelFactory(configSchema);
|
|
985
|
-
return {
|
|
986
|
-
name: 'LinearReferenceSequenceDisplay',
|
|
987
|
-
configSchema: configSchema,
|
|
988
|
-
stateModel: stateModel,
|
|
989
|
-
trackType: 'ReferenceSequenceTrack',
|
|
990
|
-
viewType: 'LinearGenomeView',
|
|
991
|
-
ReactComponent: BaseLinearDisplayComponent
|
|
992
|
-
};
|
|
993
|
-
});
|
|
994
|
-
pluginManager.addRendererType(function () {
|
|
995
|
-
return new DivSequenceRenderer({
|
|
996
|
-
name: 'DivSequenceRenderer',
|
|
997
|
-
ReactComponent: DivSequenceRendererReactComponent,
|
|
998
|
-
configSchema: divSequenceRendererConfigSchema,
|
|
999
|
-
pluginManager: pluginManager
|
|
1000
|
-
});
|
|
1001
|
-
});
|
|
1002
|
-
}
|
|
1003
|
-
}]);
|
|
1004
|
-
|
|
1005
|
-
return SequencePlugin;
|
|
1006
|
-
}(Plugin);
|
|
1007
|
-
|
|
1008
|
-
function createCommonjsModule(fn, module) {
|
|
1009
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
1013
|
-
/**
|
|
1014
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
1015
|
-
*
|
|
1016
|
-
* This source code is licensed under the MIT license found in the
|
|
1017
|
-
* LICENSE file in the root directory of this source tree.
|
|
1018
|
-
*/
|
|
1019
|
-
var runtime = function (exports) {
|
|
1020
|
-
|
|
1021
|
-
var Op = Object.prototype;
|
|
1022
|
-
var hasOwn = Op.hasOwnProperty;
|
|
1023
|
-
var undefined$1; // More compressible than void 0.
|
|
1024
|
-
|
|
1025
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
1026
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
1027
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
1028
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1029
|
-
|
|
1030
|
-
function define(obj, key, value) {
|
|
1031
|
-
Object.defineProperty(obj, key, {
|
|
1032
|
-
value: value,
|
|
1033
|
-
enumerable: true,
|
|
1034
|
-
configurable: true,
|
|
1035
|
-
writable: true
|
|
1036
|
-
});
|
|
1037
|
-
return obj[key];
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
try {
|
|
1041
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
1042
|
-
define({}, "");
|
|
1043
|
-
} catch (err) {
|
|
1044
|
-
define = function define(obj, key, value) {
|
|
1045
|
-
return obj[key] = value;
|
|
1046
|
-
};
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1050
|
-
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
1051
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
1052
|
-
var generator = Object.create(protoGenerator.prototype);
|
|
1053
|
-
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
|
|
1054
|
-
// .throw, and .return methods.
|
|
1055
|
-
|
|
1056
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
1057
|
-
return generator;
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
|
|
1061
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
1062
|
-
// have been (and was previously) designed to take a closure to be
|
|
1063
|
-
// invoked without arguments, but in all the cases we care about we
|
|
1064
|
-
// already have an existing method we want to call, so there's no need
|
|
1065
|
-
// to create a new function object. We can even get away with assuming
|
|
1066
|
-
// the method takes exactly one argument, since that happens to be true
|
|
1067
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
1068
|
-
// only additional allocation required is the completion record, which
|
|
1069
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
1070
|
-
|
|
1071
|
-
function tryCatch(fn, obj, arg) {
|
|
1072
|
-
try {
|
|
1073
|
-
return {
|
|
1074
|
-
type: "normal",
|
|
1075
|
-
arg: fn.call(obj, arg)
|
|
1076
|
-
};
|
|
1077
|
-
} catch (err) {
|
|
1078
|
-
return {
|
|
1079
|
-
type: "throw",
|
|
1080
|
-
arg: err
|
|
1081
|
-
};
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
var GenStateSuspendedStart = "suspendedStart";
|
|
1086
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
1087
|
-
var GenStateExecuting = "executing";
|
|
1088
|
-
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
|
|
1089
|
-
// breaking out of the dispatch switch statement.
|
|
1090
|
-
|
|
1091
|
-
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
|
|
1092
|
-
// .constructor.prototype properties for functions that return Generator
|
|
1093
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
1094
|
-
// minifier not to mangle the names of these two functions.
|
|
1095
|
-
|
|
1096
|
-
function Generator() {}
|
|
1097
|
-
|
|
1098
|
-
function GeneratorFunction() {}
|
|
1099
|
-
|
|
1100
|
-
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
|
|
1101
|
-
// don't natively support it.
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
var IteratorPrototype = {};
|
|
1105
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1106
|
-
return this;
|
|
1107
|
-
});
|
|
1108
|
-
var getProto = Object.getPrototypeOf;
|
|
1109
|
-
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1110
|
-
|
|
1111
|
-
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
1112
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
1113
|
-
// of the polyfill.
|
|
1114
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1118
|
-
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
1119
|
-
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
1120
|
-
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
1121
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
1122
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
1123
|
-
|
|
1124
|
-
function defineIteratorMethods(prototype) {
|
|
1125
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
1126
|
-
define(prototype, method, function (arg) {
|
|
1127
|
-
return this._invoke(method, arg);
|
|
1128
|
-
});
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
exports.isGeneratorFunction = function (genFun) {
|
|
1133
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
1134
|
-
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
1135
|
-
// do is to check its .name property.
|
|
1136
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
|
-
exports.mark = function (genFun) {
|
|
1140
|
-
if (Object.setPrototypeOf) {
|
|
1141
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
1142
|
-
} else {
|
|
1143
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
1144
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
genFun.prototype = Object.create(Gp);
|
|
1148
|
-
return genFun;
|
|
1149
|
-
}; // Within the body of any async function, `await x` is transformed to
|
|
1150
|
-
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
1151
|
-
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
1152
|
-
// meant to be awaited.
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
exports.awrap = function (arg) {
|
|
1156
|
-
return {
|
|
1157
|
-
__await: arg
|
|
1158
|
-
};
|
|
1159
|
-
};
|
|
1160
|
-
|
|
1161
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
1162
|
-
function invoke(method, arg, resolve, reject) {
|
|
1163
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
1164
|
-
|
|
1165
|
-
if (record.type === "throw") {
|
|
1166
|
-
reject(record.arg);
|
|
1167
|
-
} else {
|
|
1168
|
-
var result = record.arg;
|
|
1169
|
-
var value = result.value;
|
|
1170
|
-
|
|
1171
|
-
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
1172
|
-
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1173
|
-
invoke("next", value, resolve, reject);
|
|
1174
|
-
}, function (err) {
|
|
1175
|
-
invoke("throw", err, resolve, reject);
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
1180
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
1181
|
-
// the .value of the Promise<{value,done}> result for the
|
|
1182
|
-
// current iteration.
|
|
1183
|
-
result.value = unwrapped;
|
|
1184
|
-
resolve(result);
|
|
1185
|
-
}, function (error) {
|
|
1186
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
1187
|
-
// into the async generator function so it can be handled there.
|
|
1188
|
-
return invoke("throw", error, resolve, reject);
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
var previousPromise;
|
|
1194
|
-
|
|
1195
|
-
function enqueue(method, arg) {
|
|
1196
|
-
function callInvokeWithMethodAndArg() {
|
|
1197
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
1198
|
-
invoke(method, arg, resolve, reject);
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
1203
|
-
// all previous Promises have been resolved before calling invoke,
|
|
1204
|
-
// so that results are always delivered in the correct order. If
|
|
1205
|
-
// enqueue has not been called before, then it is important to
|
|
1206
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
1207
|
-
// so that the async generator function has the opportunity to do
|
|
1208
|
-
// any necessary setup in a predictable way. This predictability
|
|
1209
|
-
// is why the Promise constructor synchronously invokes its
|
|
1210
|
-
// executor callback, and why async functions synchronously
|
|
1211
|
-
// execute code before the first await. Since we implement simple
|
|
1212
|
-
// async functions in terms of async generators, it is especially
|
|
1213
|
-
// important to get this right, even though it requires care.
|
|
1214
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
1215
|
-
// invocations of the iterator.
|
|
1216
|
-
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1217
|
-
} // Define the unified helper method that is used to implement .next,
|
|
1218
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
this._invoke = enqueue;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
defineIteratorMethods(AsyncIterator.prototype);
|
|
1225
|
-
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
1226
|
-
return this;
|
|
1227
|
-
});
|
|
1228
|
-
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
1229
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
1230
|
-
// the final result produced by the iterator.
|
|
1231
|
-
|
|
1232
|
-
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1233
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
1234
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
1235
|
-
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
1236
|
-
: iter.next().then(function (result) {
|
|
1237
|
-
return result.done ? result.value : iter.next();
|
|
1238
|
-
});
|
|
1239
|
-
};
|
|
1240
|
-
|
|
1241
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
1242
|
-
var state = GenStateSuspendedStart;
|
|
1243
|
-
return function invoke(method, arg) {
|
|
1244
|
-
if (state === GenStateExecuting) {
|
|
1245
|
-
throw new Error("Generator is already running");
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
if (state === GenStateCompleted) {
|
|
1249
|
-
if (method === "throw") {
|
|
1250
|
-
throw arg;
|
|
1251
|
-
} // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
1252
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
return doneResult();
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
context.method = method;
|
|
1259
|
-
context.arg = arg;
|
|
1260
|
-
|
|
1261
|
-
while (true) {
|
|
1262
|
-
var delegate = context.delegate;
|
|
1263
|
-
|
|
1264
|
-
if (delegate) {
|
|
1265
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1266
|
-
|
|
1267
|
-
if (delegateResult) {
|
|
1268
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
1269
|
-
return delegateResult;
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
if (context.method === "next") {
|
|
1274
|
-
// Setting context._sent for legacy support of Babel's
|
|
1275
|
-
// function.sent implementation.
|
|
1276
|
-
context.sent = context._sent = context.arg;
|
|
1277
|
-
} else if (context.method === "throw") {
|
|
1278
|
-
if (state === GenStateSuspendedStart) {
|
|
1279
|
-
state = GenStateCompleted;
|
|
1280
|
-
throw context.arg;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
context.dispatchException(context.arg);
|
|
1284
|
-
} else if (context.method === "return") {
|
|
1285
|
-
context.abrupt("return", context.arg);
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
state = GenStateExecuting;
|
|
1289
|
-
var record = tryCatch(innerFn, self, context);
|
|
1290
|
-
|
|
1291
|
-
if (record.type === "normal") {
|
|
1292
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
1293
|
-
// GenStateExecuting and loop back for another invocation.
|
|
1294
|
-
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
1295
|
-
|
|
1296
|
-
if (record.arg === ContinueSentinel) {
|
|
1297
|
-
continue;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
return {
|
|
1301
|
-
value: record.arg,
|
|
1302
|
-
done: context.done
|
|
1303
|
-
};
|
|
1304
|
-
} else if (record.type === "throw") {
|
|
1305
|
-
state = GenStateCompleted; // Dispatch the exception by looping back around to the
|
|
1306
|
-
// context.dispatchException(context.arg) call above.
|
|
1307
|
-
|
|
1308
|
-
context.method = "throw";
|
|
1309
|
-
context.arg = record.arg;
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
};
|
|
1313
|
-
} // Call delegate.iterator[context.method](context.arg) and handle the
|
|
1314
|
-
// result, either by returning a { value, done } result from the
|
|
1315
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
1316
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
1320
|
-
var method = delegate.iterator[context.method];
|
|
1321
|
-
|
|
1322
|
-
if (method === undefined$1) {
|
|
1323
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
1324
|
-
// method always terminates the yield* loop.
|
|
1325
|
-
context.delegate = null;
|
|
1326
|
-
|
|
1327
|
-
if (context.method === "throw") {
|
|
1328
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
1329
|
-
if (delegate.iterator["return"]) {
|
|
1330
|
-
// If the delegate iterator has a return method, give it a
|
|
1331
|
-
// chance to clean up.
|
|
1332
|
-
context.method = "return";
|
|
1333
|
-
context.arg = undefined$1;
|
|
1334
|
-
maybeInvokeDelegate(delegate, context);
|
|
1335
|
-
|
|
1336
|
-
if (context.method === "throw") {
|
|
1337
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
1338
|
-
// "return" to "throw", let that override the TypeError below.
|
|
1339
|
-
return ContinueSentinel;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
context.method = "throw";
|
|
1344
|
-
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
return ContinueSentinel;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1351
|
-
|
|
1352
|
-
if (record.type === "throw") {
|
|
1353
|
-
context.method = "throw";
|
|
1354
|
-
context.arg = record.arg;
|
|
1355
|
-
context.delegate = null;
|
|
1356
|
-
return ContinueSentinel;
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
var info = record.arg;
|
|
1360
|
-
|
|
1361
|
-
if (!info) {
|
|
1362
|
-
context.method = "throw";
|
|
1363
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
1364
|
-
context.delegate = null;
|
|
1365
|
-
return ContinueSentinel;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
if (info.done) {
|
|
1369
|
-
// Assign the result of the finished delegate to the temporary
|
|
1370
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
1371
|
-
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
|
|
1372
|
-
|
|
1373
|
-
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
|
|
1374
|
-
// exception, let the outer generator proceed normally. If
|
|
1375
|
-
// context.method was "next", forget context.arg since it has been
|
|
1376
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
1377
|
-
// "return", allow the original .return call to continue in the
|
|
1378
|
-
// outer generator.
|
|
1379
|
-
|
|
1380
|
-
if (context.method !== "return") {
|
|
1381
|
-
context.method = "next";
|
|
1382
|
-
context.arg = undefined$1;
|
|
1383
|
-
}
|
|
1384
|
-
} else {
|
|
1385
|
-
// Re-yield the result returned by the delegate method.
|
|
1386
|
-
return info;
|
|
1387
|
-
} // The delegate iterator is finished, so forget it and continue with
|
|
1388
|
-
// the outer generator.
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
context.delegate = null;
|
|
1392
|
-
return ContinueSentinel;
|
|
1393
|
-
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
1394
|
-
// unified ._invoke helper method.
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
defineIteratorMethods(Gp);
|
|
1398
|
-
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
|
|
1399
|
-
// @@iterator function is called on it. Some browsers' implementations of the
|
|
1400
|
-
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
1401
|
-
// object to not be returned from this call. This ensures that doesn't happen.
|
|
1402
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
1403
|
-
|
|
1404
|
-
define(Gp, iteratorSymbol, function () {
|
|
1405
|
-
return this;
|
|
1406
|
-
});
|
|
1407
|
-
define(Gp, "toString", function () {
|
|
1408
|
-
return "[object Generator]";
|
|
1409
|
-
});
|
|
1410
|
-
|
|
1411
|
-
function pushTryEntry(locs) {
|
|
1412
|
-
var entry = {
|
|
1413
|
-
tryLoc: locs[0]
|
|
1414
|
-
};
|
|
1415
|
-
|
|
1416
|
-
if (1 in locs) {
|
|
1417
|
-
entry.catchLoc = locs[1];
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
if (2 in locs) {
|
|
1421
|
-
entry.finallyLoc = locs[2];
|
|
1422
|
-
entry.afterLoc = locs[3];
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
this.tryEntries.push(entry);
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
function resetTryEntry(entry) {
|
|
1429
|
-
var record = entry.completion || {};
|
|
1430
|
-
record.type = "normal";
|
|
1431
|
-
delete record.arg;
|
|
1432
|
-
entry.completion = record;
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
function Context(tryLocsList) {
|
|
1436
|
-
// The root entry object (effectively a try statement without a catch
|
|
1437
|
-
// or a finally block) gives us a place to store values thrown from
|
|
1438
|
-
// locations where there is no enclosing try statement.
|
|
1439
|
-
this.tryEntries = [{
|
|
1440
|
-
tryLoc: "root"
|
|
1441
|
-
}];
|
|
1442
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
1443
|
-
this.reset(true);
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
exports.keys = function (object) {
|
|
1447
|
-
var keys = [];
|
|
1448
|
-
|
|
1449
|
-
for (var key in object) {
|
|
1450
|
-
keys.push(key);
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
1454
|
-
// things simple and return the next function itself.
|
|
1455
|
-
|
|
1456
|
-
return function next() {
|
|
1457
|
-
while (keys.length) {
|
|
1458
|
-
var key = keys.pop();
|
|
1459
|
-
|
|
1460
|
-
if (key in object) {
|
|
1461
|
-
next.value = key;
|
|
1462
|
-
next.done = false;
|
|
1463
|
-
return next;
|
|
1464
|
-
}
|
|
1465
|
-
} // To avoid creating an additional object, we just hang the .value
|
|
1466
|
-
// and .done properties off the next function object itself. This
|
|
1467
|
-
// also ensures that the minifier will not anonymize the function.
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
next.done = true;
|
|
1471
|
-
return next;
|
|
1472
|
-
};
|
|
1473
|
-
};
|
|
1474
|
-
|
|
1475
|
-
function values(iterable) {
|
|
1476
|
-
if (iterable) {
|
|
1477
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
1478
|
-
|
|
1479
|
-
if (iteratorMethod) {
|
|
1480
|
-
return iteratorMethod.call(iterable);
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
if (typeof iterable.next === "function") {
|
|
1484
|
-
return iterable;
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
if (!isNaN(iterable.length)) {
|
|
1488
|
-
var i = -1,
|
|
1489
|
-
next = function next() {
|
|
1490
|
-
while (++i < iterable.length) {
|
|
1491
|
-
if (hasOwn.call(iterable, i)) {
|
|
1492
|
-
next.value = iterable[i];
|
|
1493
|
-
next.done = false;
|
|
1494
|
-
return next;
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
|
|
1498
|
-
next.value = undefined$1;
|
|
1499
|
-
next.done = true;
|
|
1500
|
-
return next;
|
|
1501
|
-
};
|
|
1502
|
-
|
|
1503
|
-
return next.next = next;
|
|
1504
|
-
}
|
|
1505
|
-
} // Return an iterator with no values.
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
return {
|
|
1509
|
-
next: doneResult
|
|
1510
|
-
};
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
exports.values = values;
|
|
1514
|
-
|
|
1515
|
-
function doneResult() {
|
|
1516
|
-
return {
|
|
1517
|
-
value: undefined$1,
|
|
1518
|
-
done: true
|
|
1519
|
-
};
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
Context.prototype = {
|
|
1523
|
-
constructor: Context,
|
|
1524
|
-
reset: function reset(skipTempReset) {
|
|
1525
|
-
this.prev = 0;
|
|
1526
|
-
this.next = 0; // Resetting context._sent for legacy support of Babel's
|
|
1527
|
-
// function.sent implementation.
|
|
1528
|
-
|
|
1529
|
-
this.sent = this._sent = undefined$1;
|
|
1530
|
-
this.done = false;
|
|
1531
|
-
this.delegate = null;
|
|
1532
|
-
this.method = "next";
|
|
1533
|
-
this.arg = undefined$1;
|
|
1534
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
1535
|
-
|
|
1536
|
-
if (!skipTempReset) {
|
|
1537
|
-
for (var name in this) {
|
|
1538
|
-
// Not sure about the optimal order of these conditions:
|
|
1539
|
-
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
1540
|
-
this[name] = undefined$1;
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
},
|
|
1545
|
-
stop: function stop() {
|
|
1546
|
-
this.done = true;
|
|
1547
|
-
var rootEntry = this.tryEntries[0];
|
|
1548
|
-
var rootRecord = rootEntry.completion;
|
|
1549
|
-
|
|
1550
|
-
if (rootRecord.type === "throw") {
|
|
1551
|
-
throw rootRecord.arg;
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
return this.rval;
|
|
1555
|
-
},
|
|
1556
|
-
dispatchException: function dispatchException(exception) {
|
|
1557
|
-
if (this.done) {
|
|
1558
|
-
throw exception;
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
var context = this;
|
|
1562
|
-
|
|
1563
|
-
function handle(loc, caught) {
|
|
1564
|
-
record.type = "throw";
|
|
1565
|
-
record.arg = exception;
|
|
1566
|
-
context.next = loc;
|
|
1567
|
-
|
|
1568
|
-
if (caught) {
|
|
1569
|
-
// If the dispatched exception was caught by a catch block,
|
|
1570
|
-
// then let that catch block handle the exception normally.
|
|
1571
|
-
context.method = "next";
|
|
1572
|
-
context.arg = undefined$1;
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
return !!caught;
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1579
|
-
var entry = this.tryEntries[i];
|
|
1580
|
-
var record = entry.completion;
|
|
1581
|
-
|
|
1582
|
-
if (entry.tryLoc === "root") {
|
|
1583
|
-
// Exception thrown outside of any try block that could handle
|
|
1584
|
-
// it, so set the completion value of the entire function to
|
|
1585
|
-
// throw the exception.
|
|
1586
|
-
return handle("end");
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
if (entry.tryLoc <= this.prev) {
|
|
1590
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
1591
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1592
|
-
|
|
1593
|
-
if (hasCatch && hasFinally) {
|
|
1594
|
-
if (this.prev < entry.catchLoc) {
|
|
1595
|
-
return handle(entry.catchLoc, true);
|
|
1596
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
1597
|
-
return handle(entry.finallyLoc);
|
|
1598
|
-
}
|
|
1599
|
-
} else if (hasCatch) {
|
|
1600
|
-
if (this.prev < entry.catchLoc) {
|
|
1601
|
-
return handle(entry.catchLoc, true);
|
|
1602
|
-
}
|
|
1603
|
-
} else if (hasFinally) {
|
|
1604
|
-
if (this.prev < entry.finallyLoc) {
|
|
1605
|
-
return handle(entry.finallyLoc);
|
|
1606
|
-
}
|
|
1607
|
-
} else {
|
|
1608
|
-
throw new Error("try statement without catch or finally");
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
},
|
|
1613
|
-
abrupt: function abrupt(type, arg) {
|
|
1614
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1615
|
-
var entry = this.tryEntries[i];
|
|
1616
|
-
|
|
1617
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1618
|
-
var finallyEntry = entry;
|
|
1619
|
-
break;
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
1624
|
-
// Ignore the finally entry if control is not jumping to a
|
|
1625
|
-
// location outside the try/catch block.
|
|
1626
|
-
finallyEntry = null;
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1630
|
-
record.type = type;
|
|
1631
|
-
record.arg = arg;
|
|
1632
|
-
|
|
1633
|
-
if (finallyEntry) {
|
|
1634
|
-
this.method = "next";
|
|
1635
|
-
this.next = finallyEntry.finallyLoc;
|
|
1636
|
-
return ContinueSentinel;
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
return this.complete(record);
|
|
1640
|
-
},
|
|
1641
|
-
complete: function complete(record, afterLoc) {
|
|
1642
|
-
if (record.type === "throw") {
|
|
1643
|
-
throw record.arg;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
if (record.type === "break" || record.type === "continue") {
|
|
1647
|
-
this.next = record.arg;
|
|
1648
|
-
} else if (record.type === "return") {
|
|
1649
|
-
this.rval = this.arg = record.arg;
|
|
1650
|
-
this.method = "return";
|
|
1651
|
-
this.next = "end";
|
|
1652
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
1653
|
-
this.next = afterLoc;
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
return ContinueSentinel;
|
|
1657
|
-
},
|
|
1658
|
-
finish: function finish(finallyLoc) {
|
|
1659
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1660
|
-
var entry = this.tryEntries[i];
|
|
1661
|
-
|
|
1662
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
1663
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
1664
|
-
resetTryEntry(entry);
|
|
1665
|
-
return ContinueSentinel;
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
},
|
|
1669
|
-
"catch": function _catch(tryLoc) {
|
|
1670
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1671
|
-
var entry = this.tryEntries[i];
|
|
1672
|
-
|
|
1673
|
-
if (entry.tryLoc === tryLoc) {
|
|
1674
|
-
var record = entry.completion;
|
|
1675
|
-
|
|
1676
|
-
if (record.type === "throw") {
|
|
1677
|
-
var thrown = record.arg;
|
|
1678
|
-
resetTryEntry(entry);
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
return thrown;
|
|
1682
|
-
}
|
|
1683
|
-
} // The context.catch method must only be called with a location
|
|
1684
|
-
// argument that corresponds to a known catch block.
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
throw new Error("illegal catch attempt");
|
|
1688
|
-
},
|
|
1689
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
1690
|
-
this.delegate = {
|
|
1691
|
-
iterator: values(iterable),
|
|
1692
|
-
resultName: resultName,
|
|
1693
|
-
nextLoc: nextLoc
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
if (this.method === "next") {
|
|
1697
|
-
// Deliberately forget the last sent value so that we don't
|
|
1698
|
-
// accidentally pass it on to the delegate.
|
|
1699
|
-
this.arg = undefined$1;
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
return ContinueSentinel;
|
|
1703
|
-
}
|
|
1704
|
-
}; // Regardless of whether this script is executing as a CommonJS module
|
|
1705
|
-
// or not, return the runtime object so that we can declare the variable
|
|
1706
|
-
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
1707
|
-
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
1708
|
-
|
|
1709
|
-
return exports;
|
|
1710
|
-
}( // If this script is executing as a CommonJS module, use module.exports
|
|
1711
|
-
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
1712
|
-
// object. Either way, the resulting object will be used to initialize
|
|
1713
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
1714
|
-
module.exports );
|
|
1715
|
-
|
|
1716
|
-
try {
|
|
1717
|
-
regeneratorRuntime = runtime;
|
|
1718
|
-
} catch (accidentalStrictMode) {
|
|
1719
|
-
// This module should not be running in strict mode, so the above
|
|
1720
|
-
// assignment should always work unless something is misconfigured. Just
|
|
1721
|
-
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
1722
|
-
// we can explicitly access globalThis. In older engines we can escape
|
|
1723
|
-
// strict mode using a global Function call. This could conceivably fail
|
|
1724
|
-
// if a Content Security Policy forbids using Function, but in that case
|
|
1725
|
-
// the proper solution is to fix the accidental strict mode problem. If
|
|
1726
|
-
// you've misconfigured your bundler to force strict mode and applied a
|
|
1727
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1728
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
1729
|
-
if (typeof globalThis === "object") {
|
|
1730
|
-
globalThis.regeneratorRuntime = runtime;
|
|
1731
|
-
} else {
|
|
1732
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
});
|
|
1736
|
-
|
|
1737
|
-
var default_1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
1738
|
-
_inherits(default_1, _BaseFeatureDataAdapt);
|
|
1739
|
-
|
|
1740
|
-
var _super = /*#__PURE__*/_createSuper(default_1);
|
|
1741
|
-
|
|
1742
|
-
function default_1() {
|
|
1743
|
-
var _this;
|
|
1744
|
-
|
|
1745
|
-
_classCallCheck(this, default_1);
|
|
1746
|
-
|
|
1747
|
-
_this = _super.apply(this, arguments);
|
|
1748
|
-
_this.windowSize = 1000;
|
|
1749
|
-
_this.windowDelta = 1000;
|
|
1750
|
-
_this.gcMode = 'content';
|
|
1751
|
-
return _this;
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
_createClass(default_1, [{
|
|
1755
|
-
key: "configure",
|
|
1756
|
-
value: function () {
|
|
1757
|
-
var _configure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1758
|
-
var _this$getSubAdapter;
|
|
1759
|
-
|
|
1760
|
-
var sequenceAdapter, dataAdapter;
|
|
1761
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1762
|
-
while (1) {
|
|
1763
|
-
switch (_context.prev = _context.next) {
|
|
1764
|
-
case 0:
|
|
1765
|
-
// instantiate the sequence adapter
|
|
1766
|
-
sequenceAdapter = readConfObject(this.config, 'sequenceAdapter');
|
|
1767
|
-
_context.next = 3;
|
|
1768
|
-
return (_this$getSubAdapter = this.getSubAdapter) === null || _this$getSubAdapter === void 0 ? void 0 : _this$getSubAdapter.call(this, sequenceAdapter);
|
|
1769
|
-
|
|
1770
|
-
case 3:
|
|
1771
|
-
dataAdapter = _context.sent;
|
|
1772
|
-
|
|
1773
|
-
if (dataAdapter) {
|
|
1774
|
-
_context.next = 6;
|
|
1775
|
-
break;
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
|
-
throw new Error('Error getting subadapter');
|
|
1779
|
-
|
|
1780
|
-
case 6:
|
|
1781
|
-
return _context.abrupt("return", dataAdapter.dataAdapter);
|
|
1782
|
-
|
|
1783
|
-
case 7:
|
|
1784
|
-
case "end":
|
|
1785
|
-
return _context.stop();
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
}, _callee, this);
|
|
1789
|
-
}));
|
|
1790
|
-
|
|
1791
|
-
function configure() {
|
|
1792
|
-
return _configure.apply(this, arguments);
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
|
-
return configure;
|
|
1796
|
-
}()
|
|
1797
|
-
}, {
|
|
1798
|
-
key: "getRefNames",
|
|
1799
|
-
value: function () {
|
|
1800
|
-
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1801
|
-
var sequenceAdapter;
|
|
1802
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1803
|
-
while (1) {
|
|
1804
|
-
switch (_context2.prev = _context2.next) {
|
|
1805
|
-
case 0:
|
|
1806
|
-
_context2.next = 2;
|
|
1807
|
-
return this.configure();
|
|
1808
|
-
|
|
1809
|
-
case 2:
|
|
1810
|
-
sequenceAdapter = _context2.sent;
|
|
1811
|
-
return _context2.abrupt("return", sequenceAdapter.getRefNames());
|
|
1812
|
-
|
|
1813
|
-
case 4:
|
|
1814
|
-
case "end":
|
|
1815
|
-
return _context2.stop();
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
}, _callee2, this);
|
|
1819
|
-
}));
|
|
1820
|
-
|
|
1821
|
-
function getRefNames() {
|
|
1822
|
-
return _getRefNames.apply(this, arguments);
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
return getRefNames;
|
|
1826
|
-
}()
|
|
1827
|
-
/**
|
|
1828
|
-
* Fetch features for a certain region
|
|
1829
|
-
* @param param -
|
|
1830
|
-
* @returns Observable of Feature objects in the region
|
|
1831
|
-
*/
|
|
1832
|
-
|
|
1833
|
-
}, {
|
|
1834
|
-
key: "getFeatures",
|
|
1835
|
-
value: function getFeatures(query, opts) {
|
|
1836
|
-
var _this2 = this;
|
|
1837
|
-
|
|
1838
|
-
this.windowSize = 1000;
|
|
1839
|
-
this.windowDelta = 1000;
|
|
1840
|
-
this.gcMode = 'content';
|
|
1841
|
-
return ObservableCreate( /*#__PURE__*/function () {
|
|
1842
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(observer) {
|
|
1843
|
-
var _feats$;
|
|
1844
|
-
|
|
1845
|
-
var sequenceAdapter, hw, f, queryStart, queryEnd, ret, feats, residues, i, r, nc, ng, len, j, pos, score;
|
|
1846
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1847
|
-
while (1) {
|
|
1848
|
-
switch (_context3.prev = _context3.next) {
|
|
1849
|
-
case 0:
|
|
1850
|
-
_context3.next = 2;
|
|
1851
|
-
return _this2.configure();
|
|
1852
|
-
|
|
1853
|
-
case 2:
|
|
1854
|
-
sequenceAdapter = _context3.sent;
|
|
1855
|
-
hw = _this2.windowSize === 1 ? 1 : _this2.windowSize / 2; // Half the window size
|
|
1856
|
-
|
|
1857
|
-
f = _this2.windowSize === 1;
|
|
1858
|
-
queryStart = query.start, queryEnd = query.end;
|
|
1859
|
-
queryStart = Math.max(0, queryStart - hw);
|
|
1860
|
-
queryEnd += hw;
|
|
1861
|
-
|
|
1862
|
-
if (!(queryEnd < 0 || queryStart > queryEnd)) {
|
|
1863
|
-
_context3.next = 11;
|
|
1864
|
-
break;
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
observer.complete();
|
|
1868
|
-
return _context3.abrupt("return");
|
|
1869
|
-
|
|
1870
|
-
case 11:
|
|
1871
|
-
ret = sequenceAdapter.getFeatures(_objectSpread2(_objectSpread2({}, query), {}, {
|
|
1872
|
-
start: queryStart,
|
|
1873
|
-
end: queryEnd
|
|
1874
|
-
}));
|
|
1875
|
-
_context3.next = 14;
|
|
1876
|
-
return ret.pipe(toArray()).toPromise();
|
|
1877
|
-
|
|
1878
|
-
case 14:
|
|
1879
|
-
feats = _context3.sent;
|
|
1880
|
-
residues = ((_feats$ = feats[0]) === null || _feats$ === void 0 ? void 0 : _feats$.get('seq')) || '';
|
|
1881
|
-
|
|
1882
|
-
for (i = hw; i < residues.length - hw; i += _this2.windowDelta) {
|
|
1883
|
-
r = f ? residues[i] : residues.slice(i - hw, i + hw);
|
|
1884
|
-
nc = 0;
|
|
1885
|
-
ng = 0;
|
|
1886
|
-
len = 0;
|
|
1887
|
-
|
|
1888
|
-
for (j = 0; j < r.length; j++) {
|
|
1889
|
-
if (r[j] === 'c' || r[j] === 'C') {
|
|
1890
|
-
nc++;
|
|
1891
|
-
} else if (r[j] === 'g' || r[j] === 'G') {
|
|
1892
|
-
ng++;
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
if (r[j] !== 'N') {
|
|
1896
|
-
len++;
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
|
-
pos = queryStart;
|
|
1901
|
-
score = void 0;
|
|
1902
|
-
|
|
1903
|
-
if (_this2.gcMode === 'content') {
|
|
1904
|
-
score = (ng + nc) / (len || 1);
|
|
1905
|
-
} else if (_this2.gcMode === 'skew') {
|
|
1906
|
-
score = (ng - nc) / (ng + nc || 1);
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
observer.next(new SimpleFeature({
|
|
1910
|
-
uniqueId: "".concat(_this2.id, "_").concat(pos + i),
|
|
1911
|
-
start: pos + i,
|
|
1912
|
-
end: pos + i + _this2.windowDelta,
|
|
1913
|
-
score: score
|
|
1914
|
-
}));
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
observer.complete();
|
|
1918
|
-
|
|
1919
|
-
case 18:
|
|
1920
|
-
case "end":
|
|
1921
|
-
return _context3.stop();
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
}, _callee3);
|
|
1925
|
-
}));
|
|
1926
|
-
|
|
1927
|
-
return function (_x) {
|
|
1928
|
-
return _ref.apply(this, arguments);
|
|
1929
|
-
};
|
|
1930
|
-
}());
|
|
1931
|
-
}
|
|
1932
|
-
/**
|
|
1933
|
-
* called to provide a hint that data tied to a certain region
|
|
1934
|
-
* will not be needed for the forseeable future and can be purged
|
|
1935
|
-
* from caches, etc
|
|
1936
|
-
*/
|
|
1937
|
-
|
|
1938
|
-
}, {
|
|
1939
|
-
key: "freeResources",
|
|
1940
|
-
value: function
|
|
1941
|
-
/* { region } */
|
|
1942
|
-
freeResources() {}
|
|
1943
|
-
}]);
|
|
1944
|
-
|
|
1945
|
-
return default_1;
|
|
1946
|
-
}(BaseFeatureDataAdapter);
|
|
1947
|
-
default_1.capabilities = ['hasLocalStats'];
|
|
1948
|
-
|
|
1949
|
-
var GCContentAdapter = {
|
|
1950
|
-
__proto__: null,
|
|
1951
|
-
'default': default_1
|
|
1952
|
-
};
|
|
1953
|
-
|
|
1954
|
-
var TwoBitAdapter = /*#__PURE__*/function (_BaseSequenceAdapter) {
|
|
1955
|
-
_inherits(TwoBitAdapter, _BaseSequenceAdapter);
|
|
1956
|
-
|
|
1957
|
-
var _super = /*#__PURE__*/_createSuper(TwoBitAdapter);
|
|
1958
|
-
|
|
1959
|
-
function TwoBitAdapter(config, getSubAdapter, pluginManager) {
|
|
1960
|
-
var _this;
|
|
1961
|
-
|
|
1962
|
-
_classCallCheck(this, TwoBitAdapter);
|
|
1963
|
-
|
|
1964
|
-
_this = _super.call(this, config, getSubAdapter, pluginManager);
|
|
1965
|
-
_this.chromSizesData = _this.initChromSizes();
|
|
1966
|
-
_this.twobit = new TwoBitFile({
|
|
1967
|
-
filehandle: openLocation(readConfObject(config, 'twoBitLocation'), _this.pluginManager)
|
|
1968
|
-
});
|
|
1969
|
-
return _this;
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
|
-
_createClass(TwoBitAdapter, [{
|
|
1973
|
-
key: "initChromSizes",
|
|
1974
|
-
value: function () {
|
|
1975
|
-
var _initChromSizes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1976
|
-
var conf, file, data;
|
|
1977
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1978
|
-
while (1) {
|
|
1979
|
-
switch (_context.prev = _context.next) {
|
|
1980
|
-
case 0:
|
|
1981
|
-
conf = readConfObject(this.config, 'chromSizesLocation'); // check against default and empty in case someone makes the field blank in
|
|
1982
|
-
// config editor, may want better way to check "optional config slots" in
|
|
1983
|
-
// future
|
|
1984
|
-
|
|
1985
|
-
if (!(conf.uri !== '/path/to/default.chrom.sizes' && conf.uri !== '')) {
|
|
1986
|
-
_context.next = 7;
|
|
1987
|
-
break;
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
file = openLocation(conf, this.pluginManager);
|
|
1991
|
-
_context.next = 5;
|
|
1992
|
-
return file.readFile('utf8');
|
|
1993
|
-
|
|
1994
|
-
case 5:
|
|
1995
|
-
data = _context.sent;
|
|
1996
|
-
return _context.abrupt("return", Object.fromEntries(data === null || data === void 0 ? void 0 : data.split('\n').filter(function (line) {
|
|
1997
|
-
return !!line.trim();
|
|
1998
|
-
}).map(function (line) {
|
|
1999
|
-
var _line$split = line.split('\t'),
|
|
2000
|
-
_line$split2 = _slicedToArray(_line$split, 2),
|
|
2001
|
-
name = _line$split2[0],
|
|
2002
|
-
length = _line$split2[1];
|
|
2003
|
-
|
|
2004
|
-
return [name, +length];
|
|
2005
|
-
})));
|
|
2006
|
-
|
|
2007
|
-
case 7:
|
|
2008
|
-
return _context.abrupt("return", undefined);
|
|
2009
|
-
|
|
2010
|
-
case 8:
|
|
2011
|
-
case "end":
|
|
2012
|
-
return _context.stop();
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
}, _callee, this);
|
|
2016
|
-
}));
|
|
2017
|
-
|
|
2018
|
-
function initChromSizes() {
|
|
2019
|
-
return _initChromSizes.apply(this, arguments);
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
return initChromSizes;
|
|
2023
|
-
}()
|
|
2024
|
-
}, {
|
|
2025
|
-
key: "getRefNames",
|
|
2026
|
-
value: function () {
|
|
2027
|
-
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
2028
|
-
var chromSizesData;
|
|
2029
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2030
|
-
while (1) {
|
|
2031
|
-
switch (_context2.prev = _context2.next) {
|
|
2032
|
-
case 0:
|
|
2033
|
-
_context2.next = 2;
|
|
2034
|
-
return this.chromSizesData;
|
|
2035
|
-
|
|
2036
|
-
case 2:
|
|
2037
|
-
chromSizesData = _context2.sent;
|
|
2038
|
-
|
|
2039
|
-
if (!chromSizesData) {
|
|
2040
|
-
_context2.next = 5;
|
|
2041
|
-
break;
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
return _context2.abrupt("return", Object.keys(chromSizesData));
|
|
2045
|
-
|
|
2046
|
-
case 5:
|
|
2047
|
-
return _context2.abrupt("return", this.twobit.getSequenceNames());
|
|
2048
|
-
|
|
2049
|
-
case 6:
|
|
2050
|
-
case "end":
|
|
2051
|
-
return _context2.stop();
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
}, _callee2, this);
|
|
2055
|
-
}));
|
|
2056
|
-
|
|
2057
|
-
function getRefNames() {
|
|
2058
|
-
return _getRefNames.apply(this, arguments);
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
return getRefNames;
|
|
2062
|
-
}()
|
|
2063
|
-
}, {
|
|
2064
|
-
key: "getRegions",
|
|
2065
|
-
value: function () {
|
|
2066
|
-
var _getRegions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
2067
|
-
var chromSizesData, refSizes;
|
|
2068
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2069
|
-
while (1) {
|
|
2070
|
-
switch (_context3.prev = _context3.next) {
|
|
2071
|
-
case 0:
|
|
2072
|
-
_context3.next = 2;
|
|
2073
|
-
return this.chromSizesData;
|
|
2074
|
-
|
|
2075
|
-
case 2:
|
|
2076
|
-
chromSizesData = _context3.sent;
|
|
2077
|
-
|
|
2078
|
-
if (!chromSizesData) {
|
|
2079
|
-
_context3.next = 5;
|
|
2080
|
-
break;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
return _context3.abrupt("return", Object.keys(chromSizesData).map(function (refName) {
|
|
2084
|
-
return {
|
|
2085
|
-
refName: refName,
|
|
2086
|
-
start: 0,
|
|
2087
|
-
end: chromSizesData[refName]
|
|
2088
|
-
};
|
|
2089
|
-
}));
|
|
2090
|
-
|
|
2091
|
-
case 5:
|
|
2092
|
-
_context3.next = 7;
|
|
2093
|
-
return this.twobit.getSequenceSizes();
|
|
2094
|
-
|
|
2095
|
-
case 7:
|
|
2096
|
-
refSizes = _context3.sent;
|
|
2097
|
-
return _context3.abrupt("return", Object.keys(refSizes).map(function (refName) {
|
|
2098
|
-
return {
|
|
2099
|
-
refName: refName,
|
|
2100
|
-
start: 0,
|
|
2101
|
-
end: refSizes[refName]
|
|
2102
|
-
};
|
|
2103
|
-
}));
|
|
2104
|
-
|
|
2105
|
-
case 9:
|
|
2106
|
-
case "end":
|
|
2107
|
-
return _context3.stop();
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
}, _callee3, this);
|
|
2111
|
-
}));
|
|
2112
|
-
|
|
2113
|
-
function getRegions() {
|
|
2114
|
-
return _getRegions.apply(this, arguments);
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
return getRegions;
|
|
2118
|
-
}()
|
|
2119
|
-
/**
|
|
2120
|
-
* Fetch features for a certain region
|
|
2121
|
-
* @param param -
|
|
2122
|
-
* @returns Observable of Feature objects in the region
|
|
2123
|
-
*/
|
|
2124
|
-
|
|
2125
|
-
}, {
|
|
2126
|
-
key: "getFeatures",
|
|
2127
|
-
value: function getFeatures(_ref) {
|
|
2128
|
-
var _this2 = this;
|
|
2129
|
-
|
|
2130
|
-
var refName = _ref.refName,
|
|
2131
|
-
start = _ref.start,
|
|
2132
|
-
end = _ref.end;
|
|
2133
|
-
return ObservableCreate( /*#__PURE__*/function () {
|
|
2134
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(observer) {
|
|
2135
|
-
var size, regionEnd, seq;
|
|
2136
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2137
|
-
while (1) {
|
|
2138
|
-
switch (_context4.prev = _context4.next) {
|
|
2139
|
-
case 0:
|
|
2140
|
-
_context4.next = 2;
|
|
2141
|
-
return _this2.twobit.getSequenceSize(refName);
|
|
2142
|
-
|
|
2143
|
-
case 2:
|
|
2144
|
-
size = _context4.sent;
|
|
2145
|
-
regionEnd = size !== undefined ? Math.min(size, end) : end;
|
|
2146
|
-
_context4.next = 6;
|
|
2147
|
-
return _this2.twobit.getSequence(refName, start, regionEnd);
|
|
2148
|
-
|
|
2149
|
-
case 6:
|
|
2150
|
-
seq = _context4.sent;
|
|
2151
|
-
|
|
2152
|
-
if (seq) {
|
|
2153
|
-
observer.next(new SimpleFeature({
|
|
2154
|
-
id: "".concat(refName, " ").concat(start, "-").concat(regionEnd),
|
|
2155
|
-
data: {
|
|
2156
|
-
refName: refName,
|
|
2157
|
-
start: start,
|
|
2158
|
-
end: regionEnd,
|
|
2159
|
-
seq: seq
|
|
2160
|
-
}
|
|
2161
|
-
}));
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
observer.complete();
|
|
2165
|
-
|
|
2166
|
-
case 9:
|
|
2167
|
-
case "end":
|
|
2168
|
-
return _context4.stop();
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
}, _callee4);
|
|
2172
|
-
}));
|
|
2173
|
-
|
|
2174
|
-
return function (_x) {
|
|
2175
|
-
return _ref2.apply(this, arguments);
|
|
2176
|
-
};
|
|
2177
|
-
}());
|
|
2178
|
-
}
|
|
2179
|
-
/**
|
|
2180
|
-
* called to provide a hint that data tied to a certain region
|
|
2181
|
-
* will not be needed for the forseeable future and can be purged
|
|
2182
|
-
* from caches, etc
|
|
2183
|
-
*/
|
|
2184
|
-
|
|
2185
|
-
}, {
|
|
2186
|
-
key: "freeResources",
|
|
2187
|
-
value: function
|
|
2188
|
-
/* { region } */
|
|
2189
|
-
freeResources() {}
|
|
2190
|
-
}]);
|
|
2191
|
-
|
|
2192
|
-
return TwoBitAdapter;
|
|
2193
|
-
}(BaseSequenceAdapter);
|
|
2194
|
-
|
|
2195
|
-
var TwoBitAdapter$1 = {
|
|
2196
|
-
__proto__: null,
|
|
2197
|
-
'default': TwoBitAdapter
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
var _default = /*#__PURE__*/function (_BaseAdapter) {
|
|
2201
|
-
_inherits(_default, _BaseAdapter);
|
|
2202
|
-
|
|
2203
|
-
var _super = /*#__PURE__*/_createSuper(_default);
|
|
2204
|
-
|
|
2205
|
-
function _default(config, getSubAdapter, pluginManager) {
|
|
2206
|
-
var _this;
|
|
2207
|
-
|
|
2208
|
-
_classCallCheck(this, _default);
|
|
2209
|
-
|
|
2210
|
-
_this = _super.call(this, config, getSubAdapter, pluginManager);
|
|
2211
|
-
var chromSizesLocation = readConfObject(config, 'chromSizesLocation');
|
|
2212
|
-
|
|
2213
|
-
if (!chromSizesLocation) {
|
|
2214
|
-
throw new Error('must provide chromSizesLocation');
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
var file = openLocation(chromSizesLocation, _this.pluginManager);
|
|
2218
|
-
_this.source = file.toString();
|
|
2219
|
-
_this.refSeqs = _this.init(file);
|
|
2220
|
-
return _this;
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
_createClass(_default, [{
|
|
2224
|
-
key: "init",
|
|
2225
|
-
value: function () {
|
|
2226
|
-
var _init = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(file) {
|
|
2227
|
-
var data, refSeqs;
|
|
2228
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
2229
|
-
while (1) {
|
|
2230
|
-
switch (_context.prev = _context.next) {
|
|
2231
|
-
case 0:
|
|
2232
|
-
_context.next = 2;
|
|
2233
|
-
return file.readFile('utf8');
|
|
2234
|
-
|
|
2235
|
-
case 2:
|
|
2236
|
-
data = _context.sent;
|
|
2237
|
-
refSeqs = {};
|
|
2238
|
-
|
|
2239
|
-
if (data.length) {
|
|
2240
|
-
_context.next = 6;
|
|
2241
|
-
break;
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
|
-
throw new Error("Could not read file ".concat(file.toString()));
|
|
2245
|
-
|
|
2246
|
-
case 6:
|
|
2247
|
-
data.split('\n').forEach(function (line) {
|
|
2248
|
-
if (line.length) {
|
|
2249
|
-
var _line$split = line.split('\t'),
|
|
2250
|
-
_line$split2 = _slicedToArray(_line$split, 2),
|
|
2251
|
-
name = _line$split2[0],
|
|
2252
|
-
length = _line$split2[1];
|
|
2253
|
-
|
|
2254
|
-
refSeqs[name] = +length;
|
|
2255
|
-
}
|
|
2256
|
-
});
|
|
2257
|
-
return _context.abrupt("return", refSeqs);
|
|
2258
|
-
|
|
2259
|
-
case 8:
|
|
2260
|
-
case "end":
|
|
2261
|
-
return _context.stop();
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
}, _callee);
|
|
2265
|
-
}));
|
|
2266
|
-
|
|
2267
|
-
function init(_x) {
|
|
2268
|
-
return _init.apply(this, arguments);
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
return init;
|
|
2272
|
-
}()
|
|
2273
|
-
}, {
|
|
2274
|
-
key: "getRegions",
|
|
2275
|
-
value: function () {
|
|
2276
|
-
var _getRegions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
2277
|
-
var refSeqs;
|
|
2278
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2279
|
-
while (1) {
|
|
2280
|
-
switch (_context2.prev = _context2.next) {
|
|
2281
|
-
case 0:
|
|
2282
|
-
_context2.next = 2;
|
|
2283
|
-
return this.refSeqs;
|
|
2284
|
-
|
|
2285
|
-
case 2:
|
|
2286
|
-
refSeqs = _context2.sent;
|
|
2287
|
-
return _context2.abrupt("return", Object.keys(refSeqs).map(function (refName) {
|
|
2288
|
-
return {
|
|
2289
|
-
refName: refName,
|
|
2290
|
-
start: 0,
|
|
2291
|
-
end: refSeqs[refName]
|
|
2292
|
-
};
|
|
2293
|
-
}));
|
|
2294
|
-
|
|
2295
|
-
case 4:
|
|
2296
|
-
case "end":
|
|
2297
|
-
return _context2.stop();
|
|
2298
|
-
}
|
|
2299
|
-
}
|
|
2300
|
-
}, _callee2, this);
|
|
2301
|
-
}));
|
|
2302
|
-
|
|
2303
|
-
function getRegions() {
|
|
2304
|
-
return _getRegions.apply(this, arguments);
|
|
2305
|
-
}
|
|
2306
|
-
|
|
2307
|
-
return getRegions;
|
|
2308
|
-
}()
|
|
2309
|
-
}, {
|
|
2310
|
-
key: "getFeatures",
|
|
2311
|
-
value: function getFeatures() {
|
|
2312
|
-
throw new Error('sequence not available');
|
|
2313
|
-
}
|
|
2314
|
-
}, {
|
|
2315
|
-
key: "getHeader",
|
|
2316
|
-
value: function getHeader() {
|
|
2317
|
-
return {};
|
|
2318
|
-
}
|
|
2319
|
-
}, {
|
|
2320
|
-
key: "freeResources",
|
|
2321
|
-
value: function
|
|
2322
|
-
/* { region } */
|
|
2323
|
-
freeResources() {}
|
|
2324
|
-
}]);
|
|
2325
|
-
|
|
2326
|
-
return _default;
|
|
2327
|
-
}(BaseAdapter);
|
|
2328
|
-
|
|
2329
|
-
var ChromSizesAdapter = {
|
|
2330
|
-
__proto__: null,
|
|
2331
|
-
'default': _default
|
|
2332
|
-
};
|
|
2333
|
-
|
|
2334
|
-
var _default$1 = /*#__PURE__*/function (_BaseSequenceAdapter) {
|
|
2335
|
-
_inherits(_default, _BaseSequenceAdapter);
|
|
2336
|
-
|
|
2337
|
-
var _super = /*#__PURE__*/_createSuper(_default);
|
|
2338
|
-
|
|
2339
|
-
function _default(config, getSubAdapter, pluginManager) {
|
|
2340
|
-
var _this;
|
|
2341
|
-
|
|
2342
|
-
_classCallCheck(this, _default);
|
|
2343
|
-
|
|
2344
|
-
_this = _super.call(this, config, getSubAdapter, pluginManager);
|
|
2345
|
-
_this.seqCache = new AbortablePromiseCache({
|
|
2346
|
-
cache: new LRU({
|
|
2347
|
-
maxSize: 200
|
|
2348
|
-
}),
|
|
2349
|
-
fill: function () {
|
|
2350
|
-
var _fill = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(args, signal) {
|
|
2351
|
-
var refName, start, end;
|
|
2352
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
2353
|
-
while (1) {
|
|
2354
|
-
switch (_context.prev = _context.next) {
|
|
2355
|
-
case 0:
|
|
2356
|
-
refName = args.refName, start = args.start, end = args.end;
|
|
2357
|
-
return _context.abrupt("return", _this.fasta.getSequence(refName, start, end, _objectSpread2(_objectSpread2({}, args), {}, {
|
|
2358
|
-
signal: signal
|
|
2359
|
-
})));
|
|
2360
|
-
|
|
2361
|
-
case 2:
|
|
2362
|
-
case "end":
|
|
2363
|
-
return _context.stop();
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
}, _callee);
|
|
2367
|
-
}));
|
|
2368
|
-
|
|
2369
|
-
function fill(_x, _x2) {
|
|
2370
|
-
return _fill.apply(this, arguments);
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
return fill;
|
|
2374
|
-
}()
|
|
2375
|
-
});
|
|
2376
|
-
var fastaLocation = readConfObject(config, 'fastaLocation');
|
|
2377
|
-
var faiLocation = readConfObject(config, 'faiLocation');
|
|
2378
|
-
var fastaOpts = {
|
|
2379
|
-
fasta: openLocation(fastaLocation, _this.pluginManager),
|
|
2380
|
-
fai: openLocation(faiLocation, _this.pluginManager)
|
|
2381
|
-
};
|
|
2382
|
-
_this.fasta = new IndexedFasta(fastaOpts);
|
|
2383
|
-
return _this;
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
_createClass(_default, [{
|
|
2387
|
-
key: "getRefNames",
|
|
2388
|
-
value: function getRefNames(opts) {
|
|
2389
|
-
return this.fasta.getSequenceNames(opts);
|
|
2390
|
-
}
|
|
2391
|
-
}, {
|
|
2392
|
-
key: "getRegions",
|
|
2393
|
-
value: function () {
|
|
2394
|
-
var _getRegions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(opts) {
|
|
2395
|
-
var seqSizes;
|
|
2396
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2397
|
-
while (1) {
|
|
2398
|
-
switch (_context2.prev = _context2.next) {
|
|
2399
|
-
case 0:
|
|
2400
|
-
_context2.next = 2;
|
|
2401
|
-
return this.fasta.getSequenceSizes(opts);
|
|
2402
|
-
|
|
2403
|
-
case 2:
|
|
2404
|
-
seqSizes = _context2.sent;
|
|
2405
|
-
return _context2.abrupt("return", Object.keys(seqSizes).map(function (refName) {
|
|
2406
|
-
return {
|
|
2407
|
-
refName: refName,
|
|
2408
|
-
start: 0,
|
|
2409
|
-
end: seqSizes[refName]
|
|
2410
|
-
};
|
|
2411
|
-
}));
|
|
2412
|
-
|
|
2413
|
-
case 4:
|
|
2414
|
-
case "end":
|
|
2415
|
-
return _context2.stop();
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
}, _callee2, this);
|
|
2419
|
-
}));
|
|
2420
|
-
|
|
2421
|
-
function getRegions(_x3) {
|
|
2422
|
-
return _getRegions.apply(this, arguments);
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
return getRegions;
|
|
2426
|
-
}()
|
|
2427
|
-
}, {
|
|
2428
|
-
key: "getFeatures",
|
|
2429
|
-
value: function getFeatures(region, opts) {
|
|
2430
|
-
var _this2 = this;
|
|
2431
|
-
|
|
2432
|
-
var refName = region.refName,
|
|
2433
|
-
start = region.start,
|
|
2434
|
-
end = region.end;
|
|
2435
|
-
return ObservableCreate( /*#__PURE__*/function () {
|
|
2436
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(observer) {
|
|
2437
|
-
var size, regionEnd, chunks, chunkSize, s, e, chunkStart, r, seq;
|
|
2438
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2439
|
-
while (1) {
|
|
2440
|
-
switch (_context3.prev = _context3.next) {
|
|
2441
|
-
case 0:
|
|
2442
|
-
_context3.next = 2;
|
|
2443
|
-
return _this2.fasta.getSequenceSize(refName, opts);
|
|
2444
|
-
|
|
2445
|
-
case 2:
|
|
2446
|
-
size = _context3.sent;
|
|
2447
|
-
regionEnd = size !== undefined ? Math.min(size, end) : end;
|
|
2448
|
-
chunks = [];
|
|
2449
|
-
chunkSize = 128000;
|
|
2450
|
-
s = start - start % chunkSize;
|
|
2451
|
-
e = end + (chunkSize - end % chunkSize);
|
|
2452
|
-
|
|
2453
|
-
for (chunkStart = s; chunkStart < e; chunkStart += chunkSize) {
|
|
2454
|
-
r = {
|
|
2455
|
-
refName: refName,
|
|
2456
|
-
start: chunkStart,
|
|
2457
|
-
end: chunkStart + chunkSize
|
|
2458
|
-
};
|
|
2459
|
-
chunks.push(_this2.seqCache.get(JSON.stringify(r), r, opts === null || opts === void 0 ? void 0 : opts.signal));
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
_context3.next = 11;
|
|
2463
|
-
return Promise.all(chunks);
|
|
2464
|
-
|
|
2465
|
-
case 11:
|
|
2466
|
-
seq = _context3.sent.join('').slice(start - s).slice(0, end - start);
|
|
2467
|
-
|
|
2468
|
-
if (seq) {
|
|
2469
|
-
observer.next(new SimpleFeature({
|
|
2470
|
-
id: "".concat(refName, " ").concat(start, "-").concat(regionEnd),
|
|
2471
|
-
data: {
|
|
2472
|
-
refName: refName,
|
|
2473
|
-
start: start,
|
|
2474
|
-
end: regionEnd,
|
|
2475
|
-
seq: seq
|
|
2476
|
-
}
|
|
2477
|
-
}));
|
|
2478
|
-
}
|
|
2479
|
-
|
|
2480
|
-
observer.complete();
|
|
2481
|
-
|
|
2482
|
-
case 14:
|
|
2483
|
-
case "end":
|
|
2484
|
-
return _context3.stop();
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
}, _callee3);
|
|
2488
|
-
}));
|
|
2489
|
-
|
|
2490
|
-
return function (_x4) {
|
|
2491
|
-
return _ref.apply(this, arguments);
|
|
2492
|
-
};
|
|
2493
|
-
}());
|
|
2494
|
-
}
|
|
2495
|
-
/**
|
|
2496
|
-
* called to provide a hint that data tied to a certain region
|
|
2497
|
-
* will not be needed for the forseeable future and can be purged
|
|
2498
|
-
* from caches, etc
|
|
2499
|
-
*/
|
|
2500
|
-
|
|
2501
|
-
}, {
|
|
2502
|
-
key: "freeResources",
|
|
2503
|
-
value: function
|
|
2504
|
-
/* { region } */
|
|
2505
|
-
freeResources() {}
|
|
2506
|
-
}]);
|
|
2507
|
-
|
|
2508
|
-
return _default;
|
|
2509
|
-
}(BaseSequenceAdapter);
|
|
2510
|
-
|
|
2511
|
-
var IndexedFastaAdapter = {
|
|
2512
|
-
__proto__: null,
|
|
2513
|
-
'default': _default$1
|
|
2514
|
-
};
|
|
2515
|
-
|
|
2516
|
-
var _default$2 = /*#__PURE__*/function (_IndexedFasta) {
|
|
2517
|
-
_inherits(_default, _IndexedFasta);
|
|
2518
|
-
|
|
2519
|
-
var _super = /*#__PURE__*/_createSuper(_default);
|
|
2520
|
-
|
|
2521
|
-
function _default(config, getSubAdapter, pluginManager) {
|
|
2522
|
-
var _this;
|
|
2523
|
-
|
|
2524
|
-
_classCallCheck(this, _default);
|
|
2525
|
-
|
|
2526
|
-
_this = _super.call(this, config, getSubAdapter, pluginManager);
|
|
2527
|
-
var fastaLocation = readConfObject(config, 'fastaLocation');
|
|
2528
|
-
var faiLocation = readConfObject(config, 'faiLocation');
|
|
2529
|
-
var gziLocation = readConfObject(config, 'gziLocation');
|
|
2530
|
-
|
|
2531
|
-
if (!fastaLocation) {
|
|
2532
|
-
throw new Error('must provide fastaLocation');
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
if (!faiLocation) {
|
|
2536
|
-
throw new Error('must provide faiLocation');
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
if (!gziLocation) {
|
|
2540
|
-
throw new Error('must provide gziLocation');
|
|
2541
|
-
}
|
|
2542
|
-
|
|
2543
|
-
var fastaOpts = {
|
|
2544
|
-
fasta: openLocation(fastaLocation, _this.pluginManager),
|
|
2545
|
-
fai: openLocation(faiLocation, _this.pluginManager),
|
|
2546
|
-
gzi: openLocation(gziLocation, _this.pluginManager)
|
|
2547
|
-
};
|
|
2548
|
-
_this.fasta = new BgzipIndexedFasta(fastaOpts);
|
|
2549
|
-
return _this;
|
|
2550
|
-
}
|
|
2551
|
-
|
|
2552
|
-
return _createClass(_default);
|
|
2553
|
-
}(_default$1);
|
|
2554
|
-
|
|
2555
|
-
var BgzipFastaAdapter = {
|
|
2556
|
-
__proto__: null,
|
|
2557
|
-
'default': _default$2
|
|
2558
|
-
};
|
|
2559
|
-
|
|
2560
|
-
export default SequencePlugin;
|
|
2561
|
-
//# sourceMappingURL=plugin-sequence.esm.js.map
|