@jbrowse/core 1.7.11 → 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 +20 -4
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -558
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -473
- package/BaseFeatureWidget/index.d.ts +2 -2
- package/BaseFeatureWidget/index.js +88 -124
- package/BaseFeatureWidget/types.d.ts +1 -0
- 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 +84 -117
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.d.ts +2 -0
- package/ReExports/Attributes.js +5 -0
- package/ReExports/BaseCard.d.ts +2 -0
- package/ReExports/BaseCard.js +5 -0
- package/ReExports/DataGrid.d.ts +2 -0
- package/ReExports/DataGrid.js +6 -0
- package/ReExports/FeatureDetails.d.ts +2 -0
- package/ReExports/FeatureDetails.js +5 -0
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.d.ts +1 -19
- package/ReExports/material-ui-colors.js +16 -158
- package/ReExports/modules.d.ts +68 -109
- package/ReExports/modules.js +455 -244
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.d.ts +3 -1
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -554
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.d.ts +12 -10
- package/assemblyManager/assemblyManager.js +126 -270
- 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.d.ts +1 -1
- 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 +16 -18
- 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.d.ts +10 -10
- package/pluggableElementTypes/models/BaseDisplayModel.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +1 -1
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -200
- 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 -255
- package/pluggableElementTypes/renderers/RendererType.js +31 -105
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +61 -72
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +2 -2
- 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.d.ts +1 -3
- package/rpc/coreRpcMethods.js +221 -959
- package/rpc/remoteAbortSignals.js +46 -70
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +107 -158
- package/ui/App.js +157 -261
- package/ui/AssemblySelector.d.ts +1 -1
- package/ui/AssemblySelector.js +59 -115
- package/ui/CascadingMenu.js +100 -199
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -58
- package/ui/DrawerWidget.js +109 -209
- package/ui/DropDownMenu.d.ts +0 -8
- package/ui/DropDownMenu.js +60 -97
- package/ui/EditableTypography.d.ts +1 -1
- package/ui/EditableTypography.js +87 -155
- package/ui/ErrorMessage.js +41 -66
- 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 -71
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.d.ts +1 -1
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.d.ts +1 -1
- package/ui/Menu.js +232 -355
- package/ui/PrerenderedCanvas.js +63 -78
- package/ui/ResizeHandle.js +87 -114
- package/ui/ReturnToImportFormDialog.js +32 -59
- package/ui/SanitizedHTML.js +63 -52
- package/ui/Snackbar.js +74 -99
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.d.ts +3 -1
- package/ui/Tooltip.js +49 -74
- package/ui/ViewContainer.js +113 -183
- 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.d.ts +279 -131
- package/ui/theme.js +197 -225
- package/util/Base1DUtils.d.ts +32 -0
- package/util/Base1DUtils.js +174 -0
- package/util/Base1DViewModel.d.ts +16 -37
- package/util/Base1DViewModel.js +116 -295
- 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 +18 -39
- package/util/index.js +743 -1236
- 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 -557
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -114
- 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 -171
- package/util/types/index.d.ts +3 -3
- package/util/types/index.js +110 -179
- package/util/types/mst.d.ts +3 -3
- package/util/types/mst.js +91 -142
- 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 -51
- 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 -111
- 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,126 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
36
|
-
(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.renderingComponent = args.renderingComponent;
|
|
44
|
-
this.displayString = args.displayString;
|
|
45
|
-
this.matchedAttribute = args.matchedAttribute;
|
|
46
|
-
this.matchedObject = args.matchedObject;
|
|
47
|
-
this.textSearchAdapter = args.textSearchAdapter;
|
|
48
|
-
this.relevance = args.relevance;
|
|
49
|
-
this.trackId = args.trackId;
|
|
50
|
-
this.score = args.score || 1;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
(0, _createClass2.default)(BaseResult, [{
|
|
54
|
-
key: "getLabel",
|
|
55
|
-
value: function getLabel() {
|
|
56
|
-
return this.label;
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "getDisplayString",
|
|
60
|
-
value: function getDisplayString() {
|
|
61
|
-
return this.displayString || this.label;
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "getRenderingComponent",
|
|
65
|
-
value: function getRenderingComponent() {
|
|
66
|
-
return this.renderingComponent;
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "getTrackId",
|
|
70
|
-
value: function getTrackId() {
|
|
71
|
-
return this.trackId;
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "getScore",
|
|
75
|
-
value: function getScore() {
|
|
76
|
-
return this.score;
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "updateScore",
|
|
80
|
-
value: function updateScore(newScore) {
|
|
81
|
-
this.score = newScore;
|
|
82
|
-
return this.score;
|
|
83
|
-
}
|
|
84
|
-
}, {
|
|
85
|
-
key: "getId",
|
|
86
|
-
value: function getId() {
|
|
87
|
-
return "".concat(this.getLabel(), "-").concat(this.getLocation(), "-").concat(this.getTrackId());
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
key: "getLocation",
|
|
91
|
-
value: function getLocation() {
|
|
92
|
-
return this.locString || this.label;
|
|
93
|
-
}
|
|
94
|
-
}]);
|
|
95
|
-
return BaseResult;
|
|
96
|
-
}();
|
|
97
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RefSequenceResult = void 0;
|
|
4
|
+
class BaseResult {
|
|
5
|
+
constructor(args) {
|
|
6
|
+
this.label = args.label;
|
|
7
|
+
this.locString = args.locString;
|
|
8
|
+
this.renderingComponent = args.renderingComponent;
|
|
9
|
+
this.displayString = args.displayString;
|
|
10
|
+
this.matchedAttribute = args.matchedAttribute;
|
|
11
|
+
this.matchedObject = args.matchedObject;
|
|
12
|
+
this.textSearchAdapter = args.textSearchAdapter;
|
|
13
|
+
this.relevance = args.relevance;
|
|
14
|
+
this.trackId = args.trackId;
|
|
15
|
+
this.score = args.score || 1;
|
|
16
|
+
}
|
|
17
|
+
getLabel() {
|
|
18
|
+
return this.label;
|
|
19
|
+
}
|
|
20
|
+
getDisplayString() {
|
|
21
|
+
return this.displayString || this.label;
|
|
22
|
+
}
|
|
23
|
+
getRenderingComponent() {
|
|
24
|
+
return this.renderingComponent;
|
|
25
|
+
}
|
|
26
|
+
getTrackId() {
|
|
27
|
+
return this.trackId;
|
|
28
|
+
}
|
|
29
|
+
getScore() {
|
|
30
|
+
return this.score;
|
|
31
|
+
}
|
|
32
|
+
updateScore(newScore) {
|
|
33
|
+
this.score = newScore;
|
|
34
|
+
return this.score;
|
|
35
|
+
}
|
|
36
|
+
getId() {
|
|
37
|
+
return `${this.getLabel()}-${this.getLocation()}-${this.getTrackId()}`;
|
|
38
|
+
}
|
|
39
|
+
getLocation() {
|
|
40
|
+
return this.locString || this.label;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
98
43
|
exports.default = BaseResult;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var _this;
|
|
109
|
-
|
|
110
|
-
(0, _classCallCheck2.default)(this, RefSequenceResult);
|
|
111
|
-
_this = _super.call(this, args);
|
|
112
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "refName", void 0);
|
|
113
|
-
_this.refName = (_args$refName = args.refName) !== null && _args$refName !== void 0 ? _args$refName : '';
|
|
114
|
-
return _this;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
(0, _createClass2.default)(RefSequenceResult, [{
|
|
118
|
-
key: "getLocation",
|
|
119
|
-
value: function getLocation() {
|
|
120
|
-
return this.refName;
|
|
44
|
+
class RefSequenceResult extends BaseResult {
|
|
45
|
+
constructor(args) {
|
|
46
|
+
var _a;
|
|
47
|
+
super(args);
|
|
48
|
+
this.refName = (_a = args.refName) !== null && _a !== void 0 ? _a : '';
|
|
49
|
+
}
|
|
50
|
+
getLocation() {
|
|
51
|
+
return this.refName;
|
|
121
52
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}(BaseResult);
|
|
125
|
-
|
|
126
|
-
exports.RefSequenceResult = RefSequenceResult;
|
|
53
|
+
}
|
|
54
|
+
exports.RefSequenceResult = RefSequenceResult;
|
|
@@ -28,7 +28,9 @@ export default class TextSearchManager {
|
|
|
28
28
|
* @param args - search options/arguments include: search query
|
|
29
29
|
*/
|
|
30
30
|
relevantAdapters(searchScope: SearchScope): any[];
|
|
31
|
-
getAdaptersWithAssembly(asmName: string, adapterConfs: AnyConfigurationModel[]): (
|
|
31
|
+
getAdaptersWithAssembly(asmName: string, adapterConfs: AnyConfigurationModel[]): ({
|
|
32
|
+
[x: string]: any;
|
|
33
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
32
34
|
setSubschema(slotName: string, data: unknown): any;
|
|
33
35
|
} & import("mobx-state-tree").IStateTreeNode<import("../configuration").AnyConfigurationSchemaType>)[];
|
|
34
36
|
getTrackAdaptersWithAssembly(asmName: string, adapterConfs: AnyConfigurationModel[]): any[];
|
|
@@ -1,165 +1,87 @@
|
|
|
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
|
-
(0, _defineProperty2.default)(this, "adapterCache", void 0);
|
|
32
|
-
this.adapterCache = new _QuickLRU.default({
|
|
33
|
-
maxSize: 15
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Instantiate/initialize list of relevant adapters
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(0, _createClass2.default)(TextSearchManager, [{
|
|
42
|
-
key: "loadTextSearchAdapters",
|
|
43
|
-
value: function loadTextSearchAdapters(searchScope) {
|
|
44
|
-
var _this = this;
|
|
45
|
-
|
|
46
|
-
return this.relevantAdapters(searchScope).map(function (adapterConfig) {
|
|
47
|
-
var adapterId = (0, _configuration.readConfObject)(adapterConfig, 'textSearchAdapterId');
|
|
48
|
-
|
|
49
|
-
if (_this.adapterCache.has(adapterId)) {
|
|
50
|
-
return _this.adapterCache.get(adapterId);
|
|
51
|
-
} else {
|
|
52
|
-
var _this$pluginManager$g = _this.pluginManager.getTextSearchAdapterType(adapterConfig.type),
|
|
53
|
-
AdapterClass = _this$pluginManager$g.AdapterClass;
|
|
54
|
-
|
|
55
|
-
var adapter = new AdapterClass(adapterConfig, undefined, _this.pluginManager);
|
|
56
|
-
|
|
57
|
-
_this.adapterCache.set(adapterId, adapter);
|
|
58
|
-
|
|
59
|
-
return adapter;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
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
|
+
const QuickLRU_1 = __importDefault(require("../util/QuickLRU"));
|
|
7
|
+
const configuration_1 = require("../configuration");
|
|
8
|
+
class TextSearchManager {
|
|
9
|
+
constructor(pluginManager) {
|
|
10
|
+
this.pluginManager = pluginManager;
|
|
11
|
+
this.adapterCache = new QuickLRU_1.default({
|
|
12
|
+
maxSize: 15,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Instantiate/initialize list of relevant adapters
|
|
17
|
+
*/
|
|
18
|
+
loadTextSearchAdapters(searchScope) {
|
|
19
|
+
return this.relevantAdapters(searchScope).map(adapterConfig => {
|
|
20
|
+
const adapterId = (0, configuration_1.readConfObject)(adapterConfig, 'textSearchAdapterId');
|
|
21
|
+
if (this.adapterCache.has(adapterId)) {
|
|
22
|
+
return this.adapterCache.get(adapterId);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const { AdapterClass } = this.pluginManager.getTextSearchAdapterType(adapterConfig.type);
|
|
26
|
+
const adapter = new AdapterClass(adapterConfig, undefined, this.pluginManager);
|
|
27
|
+
this.adapterCache.set(adapterId, adapter);
|
|
28
|
+
return adapter;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
62
31
|
}
|
|
63
32
|
/**
|
|
64
33
|
* Returns list of relevant text search adapters to use
|
|
65
34
|
* @param args - search options/arguments include: search query
|
|
66
35
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var assemblyName = searchScope.assemblyName;
|
|
78
|
-
var relevant = [].concat((0, _toConsumableArray2.default)(this.getAdaptersWithAssembly(assemblyName, aggregateTextSearchAdapters)), (0, _toConsumableArray2.default)(this.getTrackAdaptersWithAssembly(assemblyName, tracks)));
|
|
79
|
-
return relevant;
|
|
36
|
+
relevantAdapters(searchScope) {
|
|
37
|
+
var _a;
|
|
38
|
+
const { aggregateTextSearchAdapters, tracks } = (_a = this.pluginManager.rootModel) === null || _a === void 0 ? void 0 : _a.jbrowse;
|
|
39
|
+
const { assemblyName } = searchScope;
|
|
40
|
+
const relevant = [
|
|
41
|
+
...this.getAdaptersWithAssembly(assemblyName, aggregateTextSearchAdapters),
|
|
42
|
+
...this.getTrackAdaptersWithAssembly(assemblyName, tracks),
|
|
43
|
+
];
|
|
44
|
+
return relevant;
|
|
80
45
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
value: function getAdaptersWithAssembly(asmName, adapterConfs) {
|
|
84
|
-
return adapterConfs.filter(function (conf) {
|
|
85
|
-
var _readConfObject;
|
|
86
|
-
|
|
87
|
-
return (_readConfObject = (0, _configuration.readConfObject)(conf, 'assemblyNames')) === null || _readConfObject === void 0 ? void 0 : _readConfObject.includes(asmName);
|
|
88
|
-
});
|
|
46
|
+
getAdaptersWithAssembly(asmName, adapterConfs) {
|
|
47
|
+
return adapterConfs.filter(conf => { var _a; return (_a = (0, configuration_1.readConfObject)(conf, 'assemblyNames')) === null || _a === void 0 ? void 0 : _a.includes(asmName); });
|
|
89
48
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
49
|
+
getTrackAdaptersWithAssembly(asmName, adapterConfs) {
|
|
50
|
+
const tracksConfs = adapterConfs.filter(conf => {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = (0, configuration_1.readConfObject)(conf, [
|
|
53
|
+
'textSearching',
|
|
54
|
+
'textSearchAdapter',
|
|
55
|
+
'assemblyNames',
|
|
56
|
+
])) === null || _a === void 0 ? void 0 : _a.includes(asmName);
|
|
57
|
+
});
|
|
58
|
+
const trackAdapters = tracksConfs.map(trackConf => {
|
|
59
|
+
const { textSearching } = trackConf;
|
|
60
|
+
const { textSearchAdapter } = textSearching;
|
|
61
|
+
return textSearchAdapter;
|
|
62
|
+
});
|
|
63
|
+
return trackAdapters;
|
|
104
64
|
}
|
|
105
65
|
/**
|
|
106
66
|
* Returns list of relevant results given a search query and options
|
|
107
67
|
* @param args - search options/arguments include: search query
|
|
108
68
|
* limit of results to return, searchType...prefix | full | exact", etc.
|
|
109
69
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
while (1) {
|
|
118
|
-
switch (_context.prev = _context.next) {
|
|
119
|
-
case 0:
|
|
120
|
-
// determine list of relevant adapters based on scope
|
|
121
|
-
textSearchAdapters = this.loadTextSearchAdapters(searchScope);
|
|
122
|
-
_context.next = 3;
|
|
123
|
-
return Promise.all(textSearchAdapters.map(function (adapter) {
|
|
124
|
-
return adapter.searchIndex(args);
|
|
125
|
-
}));
|
|
126
|
-
|
|
127
|
-
case 3:
|
|
128
|
-
results = _context.sent;
|
|
129
|
-
return _context.abrupt("return", this.sortResults(results.flat(), rankFn));
|
|
130
|
-
|
|
131
|
-
case 5:
|
|
132
|
-
case "end":
|
|
133
|
-
return _context.stop();
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}, _callee, this);
|
|
137
|
-
}));
|
|
138
|
-
|
|
139
|
-
function search(_x, _x2, _x3) {
|
|
140
|
-
return _search.apply(this, arguments);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return search;
|
|
144
|
-
}()
|
|
70
|
+
async search(args, searchScope, rankFn) {
|
|
71
|
+
// determine list of relevant adapters based on scope
|
|
72
|
+
const textSearchAdapters = this.loadTextSearchAdapters(searchScope);
|
|
73
|
+
const results = await Promise.all(textSearchAdapters.map(adapter => adapter.searchIndex(args)));
|
|
74
|
+
// aggregate and return relevant results
|
|
75
|
+
return this.sortResults(results.flat(), rankFn);
|
|
76
|
+
}
|
|
145
77
|
/**
|
|
146
78
|
* Returns array of revelevant and sorted results
|
|
147
79
|
* @param results - array of results from all text search adapters
|
|
148
80
|
* @param rankFn - function that updates results scores
|
|
149
81
|
* based on more relevance
|
|
150
82
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
key: "sortResults",
|
|
154
|
-
value: function sortResults(results, rankFn) {
|
|
155
|
-
return rankFn(results.sort(function (a, b) {
|
|
156
|
-
return -b.getLabel().localeCompare(a.getLabel());
|
|
157
|
-
})).sort(function (result1, result2) {
|
|
158
|
-
return result1.getScore() - result2.getScore();
|
|
159
|
-
});
|
|
83
|
+
sortResults(results, rankFn) {
|
|
84
|
+
return rankFn(results.sort((a, b) => -b.getLabel().localeCompare(a.getLabel()))).sort((result1, result2) => result1.getScore() - result2.getScore());
|
|
160
85
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}();
|
|
164
|
-
|
|
165
|
-
exports.default = TextSearchManager;
|
|
86
|
+
}
|
|
87
|
+
exports.default = TextSearchManager;
|