@jbrowse/core 2.0.1 → 2.1.0
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/BaseFeatureWidget/BaseFeatureDetail.d.ts +6 -0
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -592
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -479
- package/BaseFeatureWidget/index.js +88 -126
- package/BaseFeatureWidget/types.js +1 -4
- package/BaseFeatureWidget/util.js +40 -75
- package/CorePlugin.js +55 -94
- package/Plugin.js +9 -34
- package/PluginLoader.js +153 -422
- package/PluginManager.d.ts +17 -14
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.js +3 -10
- package/ReExports/BaseCard.js +3 -10
- package/ReExports/DataGrid.js +5 -12
- package/ReExports/FeatureDetails.js +3 -10
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.js +15 -16
- package/ReExports/modules.d.ts +0 -1
- package/ReExports/modules.js +453 -798
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -555
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.js +126 -272
- package/assemblyManager/index.js +9 -22
- package/configuration/configurationSchema.js +167 -203
- package/configuration/configurationSlot.js +248 -326
- package/configuration/index.js +19 -35
- package/configuration/util.js +131 -173
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/BaseAdapter.js +132 -521
- package/data_adapters/CytobandAdapter.js +40 -126
- package/data_adapters/dataAdapterCache.js +77 -158
- package/package.json +4 -5
- package/pluggableElementTypes/AdapterType.js +24 -79
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +17 -0
- package/pluggableElementTypes/AddTrackWorkflowType.js +20 -0
- package/pluggableElementTypes/ConnectionType.js +22 -65
- package/pluggableElementTypes/DisplayType.js +35 -82
- package/pluggableElementTypes/InternetAccountType.js +23 -64
- package/pluggableElementTypes/PluggableElementBase.js +8 -20
- package/pluggableElementTypes/RpcMethodType.js +85 -427
- package/pluggableElementTypes/TextSearchAdapterType.js +16 -55
- package/pluggableElementTypes/TrackType.js +26 -70
- package/pluggableElementTypes/ViewType.js +21 -63
- package/pluggableElementTypes/WidgetType.js +21 -64
- package/pluggableElementTypes/index.d.ts +4 -3
- package/pluggableElementTypes/index.js +42 -125
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +28 -43
- package/pluggableElementTypes/models/BaseDisplayModel.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -199
- package/pluggableElementTypes/models/BaseViewModel.js +24 -40
- package/pluggableElementTypes/models/InternetAccountModel.js +116 -263
- package/pluggableElementTypes/models/baseConnectionConfig.js +14 -25
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +29 -38
- package/pluggableElementTypes/models/baseTrackConfig.js +106 -133
- package/pluggableElementTypes/models/index.js +21 -70
- package/pluggableElementTypes/renderers/BoxRendererType.js +132 -291
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +8 -38
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +60 -192
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +0 -2
- package/pluggableElementTypes/renderers/FeatureRendererType.js +89 -264
- package/pluggableElementTypes/renderers/RendererType.js +31 -105
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +61 -72
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +112 -265
- package/pluggableElementTypes/renderers/index.js +19 -62
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +27 -65
- package/rpc/BaseRpcDriver.js +169 -405
- package/rpc/MainThreadRpcDriver.js +27 -150
- package/rpc/RpcManager.js +58 -159
- package/rpc/WebWorkerRpcDriver.js +54 -171
- package/rpc/configSchema.js +25 -49
- package/rpc/coreRpcMethods.js +221 -959
- package/rpc/remoteAbortSignals.js +46 -70
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +106 -162
- package/ui/App.js +157 -242
- package/ui/AssemblySelector.js +59 -120
- package/ui/CascadingMenu.js +101 -196
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -61
- package/ui/DrawerWidget.js +108 -202
- package/ui/DropDownMenu.js +60 -91
- package/ui/EditableTypography.js +87 -149
- package/ui/ErrorMessage.js +41 -56
- package/ui/FactoryResetDialog.js +24 -57
- package/ui/FatalErrorDialog.js +59 -91
- package/ui/FileSelector/FileSelector.js +123 -189
- package/ui/FileSelector/LocalFileChooser.js +44 -75
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.js +232 -354
- package/ui/PrerenderedCanvas.js +63 -87
- package/ui/ResizeHandle.js +87 -116
- package/ui/ReturnToImportFormDialog.js +32 -63
- package/ui/SanitizedHTML.js +64 -47
- package/ui/Snackbar.js +74 -101
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.js +49 -76
- package/ui/ViewContainer.js +113 -196
- package/ui/colors.d.ts +10 -0
- package/ui/colors.js +78 -0
- package/ui/index.js +51 -181
- package/ui/react-colorful.d.ts +17 -0
- package/ui/react-colorful.js +455 -0
- package/ui/theme.js +199 -247
- package/util/Base1DUtils.js +163 -202
- package/util/Base1DViewModel.js +121 -168
- package/util/QuickLRU.js +84 -332
- package/util/TimeTraveller.d.ts +19 -0
- package/util/TimeTraveller.js +86 -0
- package/util/aborting.js +49 -127
- package/util/analytics.js +91 -154
- package/util/blockTypes.js +106 -240
- package/util/calculateDynamicBlocks.js +98 -128
- package/util/calculateStaticBlocks.js +105 -125
- package/util/color/cssColorsLevel4.js +156 -160
- package/util/color/index.js +33 -55
- package/util/compositeMap.js +49 -333
- package/util/formatFastaStrings.js +9 -14
- package/util/idMaker.js +18 -31
- package/util/index.d.ts +7 -20
- package/util/index.js +742 -1188
- package/util/io/RemoteFileWithRangeCache.js +88 -257
- package/util/io/index.js +95 -169
- package/util/jexl.js +60 -115
- package/util/jexlStrings.js +24 -29
- package/util/layouts/BaseLayout.js +1 -4
- package/util/layouts/GranularRectLayout.js +388 -555
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -112
- package/util/layouts/PrecomputedMultiLayout.js +22 -59
- package/util/layouts/SceneGraph.js +127 -197
- package/util/layouts/index.js +29 -66
- package/util/mst-reflection.js +55 -71
- package/util/offscreenCanvasPonyfill.js +66 -134
- package/util/offscreenCanvasUtils.d.ts +2 -7
- package/util/offscreenCanvasUtils.js +49 -146
- package/util/range.js +29 -40
- package/util/rxjs.js +20 -27
- package/util/simpleFeature.js +88 -152
- package/util/stats.js +91 -151
- package/util/tracks.js +130 -173
- package/util/types/index.js +110 -179
- package/util/types/mst.js +91 -146
- package/util/types/util.js +1 -4
- package/util/when.js +54 -101
- package/BaseFeatureWidget/SequenceFeatureDetails.test.js +0 -122
- package/BaseFeatureWidget/index.test.js +0 -69
- package/TextSearch/BaseResults.test.js +0 -42
- package/configuration/configurationSchema.test.js +0 -266
- package/configuration/configurationSlot.test.js +0 -69
- package/configuration/util.test.js +0 -39
- package/data_adapters/BaseAdapter.test.js +0 -200
- package/declare.d.js +0 -1
- package/pluggableElementTypes/RpcMethodType.test.js +0 -118
- package/pluggableElementTypes/renderers/declare.d.js +0 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.test.js +0 -20
- package/rpc/BaseRpcDriver.test.js +0 -540
- package/rpc/declaration.d.js +0 -1
- package/ui/FatalErrorDialog.test.js +0 -82
- package/ui/SanitizedHTML.test.js +0 -36
- package/ui/theme.test.js +0 -92
- package/util/Base1DViewModel.test.js +0 -130
- package/util/calculateDynamicBlocks.test.js +0 -74
- package/util/calculateStaticBlocks.test.js +0 -297
- package/util/declare.d.js +0 -1
- package/util/formatFastaStrings.test.js +0 -40
- package/util/index.test.js +0 -213
- package/util/jexlStrings.test.js +0 -48
- package/util/layouts/GranularRectLayout.test.js +0 -99
- package/util/range.test.js +0 -64
- package/util/simpleFeature.test.js +0 -34
- package/util/stats.test.js +0 -172
|
@@ -1,122 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var _operators = require("rxjs/operators");
|
|
36
|
-
|
|
37
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
38
|
-
|
|
39
|
-
var _rxjs2 = require("../util/rxjs");
|
|
40
|
-
|
|
41
|
-
var _util = require("../util");
|
|
42
|
-
|
|
43
|
-
var _configuration = require("../configuration");
|
|
44
|
-
|
|
45
|
-
var _stats = require("../util/stats");
|
|
46
|
-
|
|
47
|
-
var _idMaker = _interopRequireDefault(require("../util/idMaker"));
|
|
48
|
-
|
|
49
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
50
|
-
|
|
51
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
52
|
-
|
|
53
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
54
|
-
|
|
55
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
56
|
-
|
|
57
|
-
var BaseAdapter = /*#__PURE__*/(0, _createClass2.default)(function BaseAdapter() {
|
|
58
|
-
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _configuration.ConfigurationSchema)('empty', {}).create();
|
|
59
|
-
var getSubAdapter = arguments.length > 1 ? arguments[1] : undefined;
|
|
60
|
-
var pluginManager = arguments.length > 2 ? arguments[2] : undefined;
|
|
61
|
-
(0, _classCallCheck2.default)(this, BaseAdapter);
|
|
62
|
-
this.config = config;
|
|
63
|
-
this.getSubAdapter = getSubAdapter;
|
|
64
|
-
this.pluginManager = pluginManager;
|
|
65
|
-
(0, _defineProperty2.default)(this, "id", void 0);
|
|
66
|
-
|
|
67
|
-
// note: we use switch on jest here for more simple feature IDs
|
|
68
|
-
// in test environment
|
|
69
|
-
if (typeof jest === 'undefined') {
|
|
70
|
-
var data = (0, _mobxStateTree.isStateTreeNode)(config) ? (0, _mobxStateTree.getSnapshot)(config) : config;
|
|
71
|
-
this.id = "".concat((0, _idMaker.default)(data));
|
|
72
|
-
} else {
|
|
73
|
-
this.id = 'test';
|
|
74
|
-
}
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isTextSearchAdapter = exports.isRefNameAliasAdapter = exports.isFeatureAdapter = exports.isRegionsAdapter = exports.isSequenceAdapter = exports.BaseSequenceAdapter = exports.BaseFeatureDataAdapter = exports.BaseAdapter = void 0;
|
|
7
|
+
const rxjs_1 = require("rxjs");
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
9
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
10
|
+
const rxjs_2 = require("../util/rxjs");
|
|
11
|
+
const util_1 = require("../util");
|
|
12
|
+
const configuration_1 = require("../configuration");
|
|
13
|
+
const stats_1 = require("../util/stats");
|
|
14
|
+
const idMaker_1 = __importDefault(require("../util/idMaker"));
|
|
15
|
+
const EmptyConfig = (0, configuration_1.ConfigurationSchema)('empty', {});
|
|
16
|
+
class BaseAdapter {
|
|
17
|
+
constructor(config = EmptyConfig.create(), getSubAdapter, pluginManager) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.getSubAdapter = getSubAdapter;
|
|
20
|
+
this.pluginManager = pluginManager;
|
|
21
|
+
// note: we use switch on jest here for more simple feature IDs
|
|
22
|
+
// in test environment
|
|
23
|
+
if (typeof jest === 'undefined') {
|
|
24
|
+
const data = (0, mobx_state_tree_1.isStateTreeNode)(config) ? (0, mobx_state_tree_1.getSnapshot)(config) : config;
|
|
25
|
+
this.id = `${(0, idMaker_1.default)(data)}`;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this.id = 'test';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
getConf(arg) {
|
|
32
|
+
return (0, configuration_1.readConfObject)(this.config, arg);
|
|
33
|
+
}
|
|
75
34
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Called to provide a hint that data tied to a certain region will not be
|
|
78
|
-
* needed for the forseeable future and can be purged from caches, etc
|
|
79
|
-
* @param region - Region
|
|
80
|
-
*/
|
|
81
|
-
);
|
|
82
35
|
exports.BaseAdapter = BaseAdapter;
|
|
83
|
-
|
|
84
|
-
|
|
36
|
+
BaseAdapter.capabilities = [];
|
|
85
37
|
/**
|
|
86
38
|
* Base class for feature adapters to extend. Defines some methods that
|
|
87
39
|
* subclasses must implement.
|
|
88
40
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var _super = _createSuper(BaseFeatureDataAdapter);
|
|
93
|
-
|
|
94
|
-
function BaseFeatureDataAdapter() {
|
|
95
|
-
(0, _classCallCheck2.default)(this, BaseFeatureDataAdapter);
|
|
96
|
-
return _super.apply(this, arguments);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
(0, _createClass2.default)(BaseFeatureDataAdapter, [{
|
|
100
|
-
key: "getConf",
|
|
101
|
-
value: // public abstract async getRefNames(opts?: BaseOptions): Promise<string[]>
|
|
102
|
-
// await this.setup()
|
|
103
|
-
// const { refNames } = this.metadata
|
|
104
|
-
// return refNames
|
|
105
|
-
// }
|
|
106
|
-
//
|
|
107
|
-
function getConf(arg) {
|
|
108
|
-
return (0, _configuration.readConfObject)(this.config, arg);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Get features from the data source that overlap a region
|
|
112
|
-
* @param region - Region
|
|
113
|
-
* @param options - Feature adapter options
|
|
114
|
-
* @returns Observable of Feature objects in the region
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
}, {
|
|
118
|
-
key: "getHeader",
|
|
119
|
-
value: // public abstract getFeatures(
|
|
41
|
+
class BaseFeatureDataAdapter extends BaseAdapter {
|
|
42
|
+
// public abstract getFeatures(
|
|
120
43
|
// region: Region,
|
|
121
44
|
// opts: BaseOptions,
|
|
122
45
|
// ): Observable<Feature> {
|
|
@@ -128,7 +51,6 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
|
|
|
128
51
|
// observer.complete()
|
|
129
52
|
// })
|
|
130
53
|
// }
|
|
131
|
-
|
|
132
54
|
/**
|
|
133
55
|
* Return "header info" that is fetched from the data file, or other info
|
|
134
56
|
* that would not simply be in the config of the file. The return value can
|
|
@@ -136,100 +58,31 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
|
|
|
136
58
|
* is how VCF,BAM,CRAM return values for getInfo or it can be a nested JSON
|
|
137
59
|
* object
|
|
138
60
|
*/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
while (1) {
|
|
143
|
-
switch (_context.prev = _context.next) {
|
|
144
|
-
case 0:
|
|
145
|
-
return _context.abrupt("return", null);
|
|
146
|
-
|
|
147
|
-
case 1:
|
|
148
|
-
case "end":
|
|
149
|
-
return _context.stop();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}, _callee);
|
|
153
|
-
}));
|
|
154
|
-
|
|
155
|
-
function getHeader(_x) {
|
|
156
|
-
return _getHeader.apply(this, arguments);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return getHeader;
|
|
160
|
-
}()
|
|
61
|
+
async getHeader(_opts) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
161
64
|
/**
|
|
162
65
|
* Return info that is primarily used for interpreting the data that is there,
|
|
163
66
|
* primarily in reference to being used for augmenting feature details panels
|
|
164
67
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
value: function () {
|
|
169
|
-
var _getMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_opts) {
|
|
170
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
171
|
-
while (1) {
|
|
172
|
-
switch (_context2.prev = _context2.next) {
|
|
173
|
-
case 0:
|
|
174
|
-
return _context2.abrupt("return", null);
|
|
175
|
-
|
|
176
|
-
case 1:
|
|
177
|
-
case "end":
|
|
178
|
-
return _context2.stop();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}, _callee2);
|
|
182
|
-
}));
|
|
183
|
-
|
|
184
|
-
function getMetadata(_x2) {
|
|
185
|
-
return _getMetadata.apply(this, arguments);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return getMetadata;
|
|
189
|
-
}()
|
|
68
|
+
async getMetadata(_opts) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
190
71
|
/**
|
|
191
72
|
* Checks if the store has data for the given assembly and reference
|
|
192
73
|
* sequence, and then gets the features in the region if it does.
|
|
193
74
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
201
|
-
return (0, _rxjs2.ObservableCreate)( /*#__PURE__*/function () {
|
|
202
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(observer) {
|
|
203
|
-
var hasData;
|
|
204
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
205
|
-
while (1) {
|
|
206
|
-
switch (_context3.prev = _context3.next) {
|
|
207
|
-
case 0:
|
|
208
|
-
_context3.next = 2;
|
|
209
|
-
return _this.hasDataForRefName(region.refName, opts);
|
|
210
|
-
|
|
211
|
-
case 2:
|
|
212
|
-
hasData = _context3.sent;
|
|
213
|
-
(0, _util.checkAbortSignal)(opts.signal);
|
|
214
|
-
|
|
215
|
-
if (!hasData) {
|
|
216
|
-
observer.complete();
|
|
217
|
-
} else {
|
|
218
|
-
_this.getFeatures(region, opts).subscribe(observer);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
case 5:
|
|
222
|
-
case "end":
|
|
223
|
-
return _context3.stop();
|
|
224
|
-
}
|
|
75
|
+
getFeaturesInRegion(region, opts = {}) {
|
|
76
|
+
return (0, rxjs_2.ObservableCreate)(async (observer) => {
|
|
77
|
+
const hasData = await this.hasDataForRefName(region.refName, opts);
|
|
78
|
+
(0, util_1.checkAbortSignal)(opts.signal);
|
|
79
|
+
if (!hasData) {
|
|
80
|
+
observer.complete();
|
|
225
81
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
return _ref.apply(this, arguments);
|
|
231
|
-
};
|
|
232
|
-
}());
|
|
82
|
+
else {
|
|
83
|
+
this.getFeatures(region, opts).subscribe(observer);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
233
86
|
}
|
|
234
87
|
/**
|
|
235
88
|
* Checks if the store has data for the given assembly and reference
|
|
@@ -246,348 +99,106 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
|
|
|
246
99
|
* @param opts - Feature adapter options
|
|
247
100
|
* @returns Observable of Feature objects in the regions
|
|
248
101
|
*/
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var _this2 = this;
|
|
254
|
-
|
|
255
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
256
|
-
return _rxjs.merge.apply(void 0, (0, _toConsumableArray2.default)(regions.map(function (region) {
|
|
257
|
-
return _this2.getFeaturesInRegion(region, opts);
|
|
258
|
-
})));
|
|
102
|
+
getFeaturesInMultipleRegions(regions, opts = {}) {
|
|
103
|
+
return (0, rxjs_1.merge)(...regions.map(region => {
|
|
104
|
+
return this.getFeaturesInRegion(region, opts);
|
|
105
|
+
}));
|
|
259
106
|
}
|
|
260
107
|
/**
|
|
261
108
|
* Check if the store has data for the given reference name.
|
|
262
109
|
* @param refName - Name of the reference sequence
|
|
263
110
|
* @returns Whether data source has data for the given reference name
|
|
264
111
|
*/
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
case 5:
|
|
286
|
-
case "end":
|
|
287
|
-
return _context4.stop();
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}, _callee4, this);
|
|
291
|
-
}));
|
|
292
|
-
|
|
293
|
-
function hasDataForRefName(_x4) {
|
|
294
|
-
return _hasDataForRefName.apply(this, arguments);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return hasDataForRefName;
|
|
298
|
-
}()
|
|
299
|
-
}, {
|
|
300
|
-
key: "getRegionStats",
|
|
301
|
-
value: function () {
|
|
302
|
-
var _getRegionStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(region, opts) {
|
|
303
|
-
var feats;
|
|
304
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
305
|
-
while (1) {
|
|
306
|
-
switch (_context5.prev = _context5.next) {
|
|
307
|
-
case 0:
|
|
308
|
-
feats = this.getFeatures(region, opts);
|
|
309
|
-
return _context5.abrupt("return", (0, _stats.scoresToStats)(region, feats));
|
|
310
|
-
|
|
311
|
-
case 2:
|
|
312
|
-
case "end":
|
|
313
|
-
return _context5.stop();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}, _callee5, this);
|
|
317
|
-
}));
|
|
318
|
-
|
|
319
|
-
function getRegionStats(_x5, _x6) {
|
|
320
|
-
return _getRegionStats.apply(this, arguments);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
return getRegionStats;
|
|
324
|
-
}()
|
|
325
|
-
}, {
|
|
326
|
-
key: "getMultiRegionStats",
|
|
327
|
-
value: function () {
|
|
328
|
-
var _getMultiRegionStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
329
|
-
var _this3 = this;
|
|
330
|
-
|
|
331
|
-
var regions,
|
|
332
|
-
opts,
|
|
333
|
-
feats,
|
|
334
|
-
scoreMax,
|
|
112
|
+
async hasDataForRefName(refName, opts = {}) {
|
|
113
|
+
const refNames = await this.getRefNames(opts);
|
|
114
|
+
return refNames.includes(refName);
|
|
115
|
+
}
|
|
116
|
+
async getRegionStats(region, opts) {
|
|
117
|
+
const feats = this.getFeatures(region, opts);
|
|
118
|
+
return (0, stats_1.scoresToStats)(region, feats);
|
|
119
|
+
}
|
|
120
|
+
async getMultiRegionStats(regions = [], opts) {
|
|
121
|
+
if (!regions.length) {
|
|
122
|
+
return (0, stats_1.blankStats)();
|
|
123
|
+
}
|
|
124
|
+
const feats = await Promise.all(regions.map(region => this.getRegionStats(region, opts)));
|
|
125
|
+
const scoreMax = feats.map(a => a.scoreMax).reduce((a, b) => Math.max(a, b));
|
|
126
|
+
const scoreMin = feats.map(a => a.scoreMin).reduce((a, b) => Math.min(a, b));
|
|
127
|
+
const scoreSum = feats.reduce((a, b) => a + b.scoreSum, 0);
|
|
128
|
+
const scoreSumSquares = feats.reduce((a, b) => a + b.scoreSumSquares, 0);
|
|
129
|
+
const featureCount = feats.reduce((a, b) => a + b.featureCount, 0);
|
|
130
|
+
const basesCovered = feats.reduce((a, b) => a + b.basesCovered, 0);
|
|
131
|
+
return (0, stats_1.rectifyStats)({
|
|
335
132
|
scoreMin,
|
|
336
|
-
|
|
337
|
-
scoreSumSquares,
|
|
133
|
+
scoreMax,
|
|
338
134
|
featureCount,
|
|
339
135
|
basesCovered,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
});
|
|
368
|
-
scoreMin = feats.map(function (a) {
|
|
369
|
-
return a.scoreMin;
|
|
370
|
-
}).reduce(function (a, b) {
|
|
371
|
-
return Math.min(a, b);
|
|
372
|
-
});
|
|
373
|
-
scoreSum = feats.reduce(function (a, b) {
|
|
374
|
-
return a + b.scoreSum;
|
|
375
|
-
}, 0);
|
|
376
|
-
scoreSumSquares = feats.reduce(function (a, b) {
|
|
377
|
-
return a + b.scoreSumSquares;
|
|
378
|
-
}, 0);
|
|
379
|
-
featureCount = feats.reduce(function (a, b) {
|
|
380
|
-
return a + b.featureCount;
|
|
381
|
-
}, 0);
|
|
382
|
-
basesCovered = feats.reduce(function (a, b) {
|
|
383
|
-
return a + b.basesCovered;
|
|
384
|
-
}, 0);
|
|
385
|
-
return _context6.abrupt("return", (0, _stats.rectifyStats)({
|
|
386
|
-
scoreMin: scoreMin,
|
|
387
|
-
scoreMax: scoreMax,
|
|
388
|
-
featureCount: featureCount,
|
|
389
|
-
basesCovered: basesCovered,
|
|
390
|
-
scoreSumSquares: scoreSumSquares,
|
|
391
|
-
scoreSum: scoreSum
|
|
392
|
-
}));
|
|
393
|
-
|
|
394
|
-
case 14:
|
|
395
|
-
case "end":
|
|
396
|
-
return _context6.stop();
|
|
136
|
+
scoreSumSquares,
|
|
137
|
+
scoreSum,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
async estimateRegionsStats(regions, opts) {
|
|
141
|
+
if (!regions.length) {
|
|
142
|
+
throw new Error('No regions to estimate stats for');
|
|
143
|
+
}
|
|
144
|
+
const region = regions[0];
|
|
145
|
+
let lastTime = +Date.now();
|
|
146
|
+
const statsFromInterval = async (length, expansionTime) => {
|
|
147
|
+
const { start, end } = region;
|
|
148
|
+
const sampleCenter = start * 0.75 + end * 0.25;
|
|
149
|
+
const query = {
|
|
150
|
+
...region,
|
|
151
|
+
start: Math.max(0, Math.round(sampleCenter - length / 2)),
|
|
152
|
+
end: Math.min(Math.round(sampleCenter + length / 2), end),
|
|
153
|
+
};
|
|
154
|
+
const features = await this.getFeatures(query, opts)
|
|
155
|
+
.pipe((0, operators_1.toArray)())
|
|
156
|
+
.toPromise();
|
|
157
|
+
return maybeRecordStats(length, { featureDensity: features.length / length }, features.length, expansionTime);
|
|
158
|
+
};
|
|
159
|
+
const maybeRecordStats = async (interval, stats, statsSampleFeatures, expansionTime) => {
|
|
160
|
+
const refLen = region.end - region.start;
|
|
161
|
+
if (statsSampleFeatures >= 70 || interval * 2 > refLen) {
|
|
162
|
+
return stats;
|
|
397
163
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
return _getMultiRegionStats.apply(this, arguments);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
return getMultiRegionStats;
|
|
407
|
-
}()
|
|
408
|
-
}, {
|
|
409
|
-
key: "estimateRegionsStats",
|
|
410
|
-
value: function () {
|
|
411
|
-
var _estimateRegionsStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(regions, opts) {
|
|
412
|
-
var _this4 = this;
|
|
413
|
-
|
|
414
|
-
var region, lastTime, statsFromInterval, maybeRecordStats;
|
|
415
|
-
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
416
|
-
while (1) {
|
|
417
|
-
switch (_context9.prev = _context9.next) {
|
|
418
|
-
case 0:
|
|
419
|
-
if (regions.length) {
|
|
420
|
-
_context9.next = 2;
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
throw new Error('No regions to estimate stats for');
|
|
425
|
-
|
|
426
|
-
case 2:
|
|
427
|
-
region = regions[0];
|
|
428
|
-
lastTime = +Date.now();
|
|
429
|
-
|
|
430
|
-
statsFromInterval = /*#__PURE__*/function () {
|
|
431
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(length, expansionTime) {
|
|
432
|
-
var start, end, sampleCenter, query, features;
|
|
433
|
-
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
434
|
-
while (1) {
|
|
435
|
-
switch (_context7.prev = _context7.next) {
|
|
436
|
-
case 0:
|
|
437
|
-
start = region.start, end = region.end;
|
|
438
|
-
sampleCenter = start * 0.75 + end * 0.25;
|
|
439
|
-
query = _objectSpread(_objectSpread({}, region), {}, {
|
|
440
|
-
start: Math.max(0, Math.round(sampleCenter - length / 2)),
|
|
441
|
-
end: Math.min(Math.round(sampleCenter + length / 2), end)
|
|
442
|
-
});
|
|
443
|
-
_context7.next = 5;
|
|
444
|
-
return _this4.getFeatures(query, opts).pipe((0, _operators.toArray)()).toPromise();
|
|
445
|
-
|
|
446
|
-
case 5:
|
|
447
|
-
features = _context7.sent;
|
|
448
|
-
return _context7.abrupt("return", maybeRecordStats(length, {
|
|
449
|
-
featureDensity: features.length / length
|
|
450
|
-
}, features.length, expansionTime));
|
|
451
|
-
|
|
452
|
-
case 7:
|
|
453
|
-
case "end":
|
|
454
|
-
return _context7.stop();
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}, _callee7);
|
|
458
|
-
}));
|
|
459
|
-
|
|
460
|
-
return function statsFromInterval(_x9, _x10) {
|
|
461
|
-
return _ref2.apply(this, arguments);
|
|
462
|
-
};
|
|
463
|
-
}();
|
|
464
|
-
|
|
465
|
-
maybeRecordStats = /*#__PURE__*/function () {
|
|
466
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(interval, stats, statsSampleFeatures, expansionTime) {
|
|
467
|
-
var refLen, currTime;
|
|
468
|
-
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
469
|
-
while (1) {
|
|
470
|
-
switch (_context8.prev = _context8.next) {
|
|
471
|
-
case 0:
|
|
472
|
-
refLen = region.end - region.start;
|
|
473
|
-
|
|
474
|
-
if (!(statsSampleFeatures >= 70 || interval * 2 > refLen)) {
|
|
475
|
-
_context8.next = 5;
|
|
476
|
-
break;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
return _context8.abrupt("return", stats);
|
|
480
|
-
|
|
481
|
-
case 5:
|
|
482
|
-
if (!(expansionTime <= 5000)) {
|
|
483
|
-
_context8.next = 12;
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
currTime = +Date.now();
|
|
488
|
-
expansionTime += currTime - lastTime;
|
|
489
|
-
lastTime = currTime;
|
|
490
|
-
return _context8.abrupt("return", statsFromInterval(interval * 2, expansionTime));
|
|
491
|
-
|
|
492
|
-
case 12:
|
|
493
|
-
console.warn("Stats estimation reached timeout, or didn't get enough features");
|
|
494
|
-
return _context8.abrupt("return", {
|
|
495
|
-
featureDensity: Infinity
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
case 14:
|
|
499
|
-
case "end":
|
|
500
|
-
return _context8.stop();
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}, _callee8);
|
|
504
|
-
}));
|
|
505
|
-
|
|
506
|
-
return function maybeRecordStats(_x11, _x12, _x13, _x14) {
|
|
507
|
-
return _ref3.apply(this, arguments);
|
|
508
|
-
};
|
|
509
|
-
}();
|
|
510
|
-
|
|
511
|
-
return _context9.abrupt("return", statsFromInterval(1000, 0));
|
|
512
|
-
|
|
513
|
-
case 7:
|
|
514
|
-
case "end":
|
|
515
|
-
return _context9.stop();
|
|
164
|
+
else if (expansionTime <= 5000) {
|
|
165
|
+
const currTime = +Date.now();
|
|
166
|
+
expansionTime += currTime - lastTime;
|
|
167
|
+
lastTime = currTime;
|
|
168
|
+
return statsFromInterval(interval * 2, expansionTime);
|
|
516
169
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
function estimateRegionsStats(_x7, _x8) {
|
|
522
|
-
return _estimateRegionsStats.apply(this, arguments);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
return estimateRegionsStats;
|
|
526
|
-
}()
|
|
527
|
-
}]);
|
|
528
|
-
return BaseFeatureDataAdapter;
|
|
529
|
-
}(BaseAdapter);
|
|
530
|
-
|
|
531
|
-
exports.BaseFeatureDataAdapter = BaseFeatureDataAdapter;
|
|
532
|
-
|
|
533
|
-
var BaseSequenceAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
534
|
-
(0, _inherits2.default)(BaseSequenceAdapter, _BaseFeatureDataAdapt);
|
|
535
|
-
|
|
536
|
-
var _super2 = _createSuper(BaseSequenceAdapter);
|
|
537
|
-
|
|
538
|
-
function BaseSequenceAdapter() {
|
|
539
|
-
(0, _classCallCheck2.default)(this, BaseSequenceAdapter);
|
|
540
|
-
return _super2.apply(this, arguments);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
(0, _createClass2.default)(BaseSequenceAdapter, [{
|
|
544
|
-
key: "estimateRegionsStats",
|
|
545
|
-
value: function () {
|
|
546
|
-
var _estimateRegionsStats2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
547
|
-
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
548
|
-
while (1) {
|
|
549
|
-
switch (_context10.prev = _context10.next) {
|
|
550
|
-
case 0:
|
|
551
|
-
return _context10.abrupt("return", {
|
|
552
|
-
featureDensity: 0
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
case 1:
|
|
556
|
-
case "end":
|
|
557
|
-
return _context10.stop();
|
|
170
|
+
else {
|
|
171
|
+
console.warn("Stats estimation reached timeout, or didn't get enough features");
|
|
172
|
+
return { featureDensity: Infinity };
|
|
558
173
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}]);
|
|
570
|
-
return BaseSequenceAdapter;
|
|
571
|
-
}(BaseFeatureDataAdapter);
|
|
572
|
-
|
|
174
|
+
};
|
|
175
|
+
return statsFromInterval(1000, 0);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.BaseFeatureDataAdapter = BaseFeatureDataAdapter;
|
|
179
|
+
class BaseSequenceAdapter extends BaseFeatureDataAdapter {
|
|
180
|
+
async estimateRegionsStats() {
|
|
181
|
+
return { featureDensity: 0 };
|
|
182
|
+
}
|
|
183
|
+
}
|
|
573
184
|
exports.BaseSequenceAdapter = BaseSequenceAdapter;
|
|
574
|
-
|
|
575
185
|
function isSequenceAdapter(thing) {
|
|
576
|
-
|
|
186
|
+
return 'getRegions' in thing && 'getFeatures' in thing;
|
|
577
187
|
}
|
|
578
|
-
|
|
188
|
+
exports.isSequenceAdapter = isSequenceAdapter;
|
|
579
189
|
function isRegionsAdapter(thing) {
|
|
580
|
-
|
|
190
|
+
return 'getRegions' in thing;
|
|
581
191
|
}
|
|
582
|
-
|
|
192
|
+
exports.isRegionsAdapter = isRegionsAdapter;
|
|
583
193
|
function isFeatureAdapter(thing) {
|
|
584
|
-
|
|
194
|
+
return 'getFeatures' in thing;
|
|
585
195
|
}
|
|
586
|
-
|
|
196
|
+
exports.isFeatureAdapter = isFeatureAdapter;
|
|
587
197
|
function isRefNameAliasAdapter(thing) {
|
|
588
|
-
|
|
198
|
+
return 'getRefNameAliases' in thing;
|
|
589
199
|
}
|
|
590
|
-
|
|
200
|
+
exports.isRefNameAliasAdapter = isRefNameAliasAdapter;
|
|
591
201
|
function isTextSearchAdapter(thing) {
|
|
592
|
-
|
|
593
|
-
}
|
|
202
|
+
return 'searchIndex' in thing;
|
|
203
|
+
}
|
|
204
|
+
exports.isTextSearchAdapter = isTextSearchAdapter;
|