@jbrowse/core 2.13.1 → 2.15.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/ArrayValue.js +2 -2
- package/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +3 -1
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +23 -51
- package/BaseFeatureWidget/BaseFeatureDetail/util.js +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +11 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.d.ts +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +11 -7
- package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.js +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.js +6 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.js +11 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.js +15 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.js +4 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.js +15 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/hooks.js +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.js +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.js +5 -3
- package/BaseFeatureWidget/stateModelFactory.js +0 -2
- package/PluginLoader.d.ts +1 -2
- package/PluginLoader.js +16 -6
- package/PluginManager.d.ts +13 -13
- package/PluginManager.js +7 -2
- package/ReExports/modules.js +2 -11
- package/assemblyManager/assembly.d.ts +18 -12
- package/assemblyManager/assembly.js +75 -52
- package/assemblyManager/assemblyConfigSchema.d.ts +9 -7
- package/assemblyManager/assemblyConfigSchema.js +15 -16
- package/assemblyManager/assemblyManager.d.ts +109 -81
- package/assemblyManager/assemblyManager.js +3 -6
- package/configuration/configurationSchema.d.ts +1 -1
- package/configuration/configurationSchema.js +1 -2
- package/configuration/configurationSlot.js +7 -8
- package/configuration/util.js +0 -7
- package/data_adapters/BaseAdapter/BaseAdapter.d.ts +2 -1
- package/data_adapters/BaseAdapter/BaseAdapter.js +2 -1
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +6 -6
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +6 -6
- package/data_adapters/BaseAdapter/BaseRefNameAliasAdapter.d.ts +1 -0
- package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +0 -1
- package/data_adapters/CytobandAdapter/CytobandAdapter.js +4 -8
- package/data_adapters/dataAdapterCache.d.ts +9 -6
- package/data_adapters/dataAdapterCache.js +16 -22
- package/package.json +5 -5
- package/pluggableElementTypes/AddTrackWorkflowType.js +0 -6
- package/pluggableElementTypes/ConnectionType.js +0 -6
- package/pluggableElementTypes/DisplayType.js +0 -20
- package/pluggableElementTypes/InternetAccountType.js +0 -11
- package/pluggableElementTypes/RpcMethodType.d.ts +1 -1
- package/pluggableElementTypes/TextSearchAdapterType.js +0 -3
- package/pluggableElementTypes/TrackType.js +0 -11
- package/pluggableElementTypes/ViewType.js +0 -6
- package/pluggableElementTypes/WidgetType.js +0 -6
- package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +4 -3
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +1 -3
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +4 -5
- package/pluggableElementTypes/models/BaseDisplayModel.js +6 -14
- package/pluggableElementTypes/models/BaseTrackModel.js +8 -5
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +1 -1
- package/pluggableElementTypes/models/InternetAccountModel.js +19 -13
- package/pluggableElementTypes/models/baseTrackConfig.js +2 -5
- package/pluggableElementTypes/renderers/BoxRendererType.d.ts +10 -4
- package/pluggableElementTypes/renderers/BoxRendererType.js +10 -26
- package/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +9 -12
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +12 -19
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +5 -5
- package/pluggableElementTypes/renderers/FeatureRendererType.js +6 -13
- package/pluggableElementTypes/renderers/RendererType.js +0 -10
- package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.d.ts +1 -1
- package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.js +11 -9
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +14 -14
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +4 -4
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +7 -5
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +0 -1
- package/rpc/BaseRpcDriver.d.ts +1 -1
- package/rpc/BaseRpcDriver.js +12 -11
- package/rpc/MainThreadRpcDriver.d.ts +2 -2
- package/rpc/MainThreadRpcDriver.js +3 -0
- package/rpc/RpcManager.d.ts +1 -1
- package/rpc/RpcManager.js +11 -8
- package/rpc/configSchema.js +0 -1
- package/rpc/methods/CoreFreeResources.d.ts +2 -2
- package/rpc/methods/CoreGetFeatureDensityStats.d.ts +2 -2
- package/rpc/methods/CoreGetFeatureDetails.d.ts +1 -1
- package/rpc/methods/CoreGetFeatureDetails.js +3 -3
- package/rpc/methods/CoreGetFeatures.d.ts +1 -1
- package/rpc/methods/CoreGetFileInfo.d.ts +1 -1
- package/rpc/methods/CoreGetMetadata.d.ts +1 -1
- package/rpc/methods/CoreGetRefNames.d.ts +1 -1
- package/rpc/methods/util.d.ts +2 -2
- package/rpc/methods/util.js +0 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AssemblySelector.js +3 -1
- package/ui/CascadingMenu.js +2 -1
- package/ui/CascadingMenuButton.js +3 -1
- package/ui/ColorPicker.js +14 -4
- package/ui/DropDownMenu.js +3 -1
- package/ui/EditableTypography.js +6 -2
- package/ui/ErrorMessage.d.ts +2 -2
- package/ui/ErrorMessage.js +37 -20
- package/ui/ErrorMessageStackTraceDialog.js +11 -9
- package/ui/FactoryResetDialog.d.ts +1 -1
- package/ui/FactoryResetDialog.js +9 -3
- package/ui/FatalErrorDialog.js +9 -3
- package/ui/FileSelector/FileSelector.js +8 -4
- package/ui/FileSelector/LocalFileChooser.js +7 -6
- package/ui/LoadingEllipses.js +1 -1
- package/ui/Menu.d.ts +4 -4
- package/ui/Menu.js +6 -4
- package/ui/MenuButton.js +6 -2
- package/ui/PrerenderedCanvas.js +8 -5
- package/ui/RedErrorMessageBox.js +13 -8
- package/ui/ResizeHandle.d.ts +1 -1
- package/ui/ReturnToImportFormDialog.js +3 -1
- package/ui/SanitizedHTML.js +1 -3
- package/ui/SnackbarModel.d.ts +12 -1
- package/ui/SnackbarModel.js +19 -3
- package/ui/theme.js +10 -7
- package/util/Base1DViewModel.js +3 -1
- package/util/QuickLRU.js +8 -8
- package/util/TimeTraveller.js +12 -4
- package/util/aborting.js +1 -1
- package/util/analytics.js +0 -1
- package/util/blockTypes.js +5 -9
- package/util/calculateStaticBlocks.d.ts +1 -1
- package/util/compositeMap.js +2 -2
- package/util/idMaker.js +0 -1
- package/util/index.d.ts +9 -8
- package/util/index.js +92 -51
- package/util/io/RemoteFileWithRangeCache.js +1 -3
- package/util/io/index.js +3 -5
- package/util/jexlStrings.js +5 -8
- package/util/layouts/GranularRectLayout.js +1 -4
- package/util/layouts/SceneGraph.d.ts +1 -1
- package/util/layouts/SceneGraph.js +2 -6
- package/util/map-obj.js +15 -7
- package/util/mst-reflection.js +1 -2
- package/util/nanoid.js +9 -8
- package/util/offscreenCanvasPonyfill.d.ts +1 -1
- package/util/offscreenCanvasPonyfill.js +7 -10
- package/util/offscreenCanvasUtils.d.ts +1 -1
- package/util/offscreenCanvasUtils.js +1 -3
- package/util/rxjs.js +5 -5
- package/util/simpleFeature.d.ts +2 -3
- package/util/simpleFeature.js +9 -12
- package/util/stats.js +3 -1
- package/util/tracks.d.ts +4 -2
- package/util/tracks.js +10 -11
- package/util/types/index.d.ts +5 -5
- package/util/types/index.js +8 -1
- package/util/types/mst.js +1 -0
- package/util/when.js +7 -2
package/PluginManager.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
|
|
6
7
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
7
8
|
const RendererType_1 = __importDefault(require("./pluggableElementTypes/renderers/RendererType"));
|
|
8
9
|
const AdapterType_1 = __importDefault(require("./pluggableElementTypes/AdapterType"));
|
|
@@ -105,6 +106,7 @@ class PluginManager {
|
|
|
105
106
|
this.jbrequire = (lib) => {
|
|
106
107
|
if (typeof lib === 'string') {
|
|
107
108
|
const pack = this.lib[lib];
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
108
110
|
if (!pack) {
|
|
109
111
|
throw new TypeError(`No jbrequire re-export defined for package '${lib}'. If this package must be shared between plugins, add it to ReExports.js. If it does not need to be shared, just import it normally.`);
|
|
110
112
|
}
|
|
@@ -113,6 +115,7 @@ class PluginManager {
|
|
|
113
115
|
if (typeof lib === 'function') {
|
|
114
116
|
return this.load(lib);
|
|
115
117
|
}
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
116
119
|
if (lib.default) {
|
|
117
120
|
return this.jbrequire(lib.default);
|
|
118
121
|
}
|
|
@@ -170,7 +173,7 @@ class PluginManager {
|
|
|
170
173
|
// see elementCreationSchedule above for the creation order
|
|
171
174
|
if (this.elementCreationSchedule) {
|
|
172
175
|
this.elementCreationSchedule.run();
|
|
173
|
-
|
|
176
|
+
this.elementCreationSchedule = undefined;
|
|
174
177
|
}
|
|
175
178
|
return this;
|
|
176
179
|
}
|
|
@@ -181,7 +184,9 @@ class PluginManager {
|
|
|
181
184
|
if (this.configured) {
|
|
182
185
|
throw new Error('already configured');
|
|
183
186
|
}
|
|
184
|
-
this.plugins.forEach(plugin =>
|
|
187
|
+
this.plugins.forEach(plugin => {
|
|
188
|
+
plugin.configure(this);
|
|
189
|
+
});
|
|
185
190
|
this.configured = true;
|
|
186
191
|
return this;
|
|
187
192
|
}
|
package/ReExports/modules.js
CHANGED
|
@@ -178,24 +178,22 @@ const Entries = {
|
|
|
178
178
|
Typography: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('@mui/material/Typography')))),
|
|
179
179
|
};
|
|
180
180
|
const LazyMUICore = Object.fromEntries(Object.entries(Entries).map(([key, ReactComponent]) => {
|
|
181
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
182
181
|
const Component = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(react_1.Suspense, { fallback: null },
|
|
183
182
|
react_1.default.createElement(ReactComponent, { ...props, ref: ref }))));
|
|
184
183
|
Component.displayName = key;
|
|
185
184
|
return [key, Component];
|
|
186
185
|
}));
|
|
187
186
|
const MaterialPrefixMUI = Object.fromEntries(Object.entries(LazyMUICore).map(([key, value]) => [
|
|
188
|
-
|
|
187
|
+
`@material-ui/core/${key}`,
|
|
189
188
|
value,
|
|
190
189
|
]));
|
|
191
190
|
const MuiPrefixMUI = Object.fromEntries(Object.entries(LazyMUICore).map(([key, value]) => [
|
|
192
|
-
|
|
191
|
+
`@mui/material/${key}`,
|
|
193
192
|
value,
|
|
194
193
|
]));
|
|
195
194
|
const Attributes = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./Attributes'))));
|
|
196
195
|
const FeatureDetails = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./FeatureDetails'))));
|
|
197
196
|
const BaseCard = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./BaseCard'))));
|
|
198
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
199
197
|
const DataGridEntries = {
|
|
200
198
|
DataGrid: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('@mui/x-data-grid'))).then(module => ({ default: module.DataGrid }))),
|
|
201
199
|
GridActionsCellItem: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('@mui/x-data-grid'))).then(module => ({
|
|
@@ -348,21 +346,17 @@ const DataGridEntries = {
|
|
|
348
346
|
}))),
|
|
349
347
|
};
|
|
350
348
|
const LazyDataGridComponents = Object.fromEntries(Object.entries(DataGridEntries).map(([key, ReactComponent]) => {
|
|
351
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
352
349
|
const Component = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(react_1.Suspense, { fallback: null },
|
|
353
350
|
react_1.default.createElement(ReactComponent, { ...props, ref: ref }))));
|
|
354
351
|
Component.displayName = key;
|
|
355
352
|
return [key, Component];
|
|
356
353
|
}));
|
|
357
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
358
354
|
const LazyAttributes = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(react_1.Suspense, { fallback: null },
|
|
359
355
|
react_1.default.createElement(Attributes, { ...props, ref: ref }))));
|
|
360
356
|
LazyAttributes.displayName = 'Attributes';
|
|
361
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
362
357
|
const LazyFeatureDetails = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(react_1.Suspense, { fallback: null },
|
|
363
358
|
react_1.default.createElement(FeatureDetails, { ...props, ref: ref }))));
|
|
364
359
|
LazyFeatureDetails.displayName = 'FeatureDetails';
|
|
365
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
366
360
|
const LazyBaseCard = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(react_1.Suspense, { fallback: null },
|
|
367
361
|
react_1.default.createElement(BaseCard, { ...props, ref: ref }))));
|
|
368
362
|
LazyBaseCard.displayName = 'BaseCard';
|
|
@@ -387,7 +381,6 @@ const libs = {
|
|
|
387
381
|
...LazyMUICore,
|
|
388
382
|
useTheme: material_1.useTheme,
|
|
389
383
|
alpha: MUIStyles.alpha,
|
|
390
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
391
384
|
makeStyles: (args) => {
|
|
392
385
|
const useStyles = (0, mui_1.makeStyles)()(args);
|
|
393
386
|
return () => useStyles().classes;
|
|
@@ -402,7 +395,6 @@ const libs = {
|
|
|
402
395
|
// material-ui subcomponents, should get rid of these
|
|
403
396
|
'@mui/material/styles': {
|
|
404
397
|
MUIStyles,
|
|
405
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
406
398
|
makeStyles: (args) => {
|
|
407
399
|
const useStyles = (0, mui_1.makeStyles)()(args);
|
|
408
400
|
return () => useStyles().classes;
|
|
@@ -410,7 +402,6 @@ const libs = {
|
|
|
410
402
|
},
|
|
411
403
|
'@material-ui/core/styles': {
|
|
412
404
|
MUIStyles,
|
|
413
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
414
405
|
makeStyles: (args) => {
|
|
415
406
|
const useStyles = (0, mui_1.makeStyles)()(args);
|
|
416
407
|
return () => useStyles().classes;
|
|
@@ -4,7 +4,7 @@ import PluginManager from '../PluginManager';
|
|
|
4
4
|
import { Region, Feature } from '../util';
|
|
5
5
|
import RpcManager from '../rpc/RpcManager';
|
|
6
6
|
type AdapterConf = Record<string, unknown>;
|
|
7
|
-
type RefNameAliases = Record<string, string
|
|
7
|
+
type RefNameAliases = Record<string, string>;
|
|
8
8
|
export interface RefNameMap {
|
|
9
9
|
forwardMap: RefNameAliases;
|
|
10
10
|
reverseMap: RefNameAliases;
|
|
@@ -15,29 +15,31 @@ export interface BasicRegion {
|
|
|
15
15
|
refName: string;
|
|
16
16
|
assemblyName: string;
|
|
17
17
|
}
|
|
18
|
-
export interface Loading {
|
|
19
|
-
adapterRegionsWithAssembly: Region[];
|
|
20
|
-
refNameAliases: RefNameAliases;
|
|
21
|
-
lowerCaseRefNameAliases: RefNameAliases;
|
|
22
|
-
cytobands: Feature[];
|
|
23
|
-
}
|
|
24
18
|
/**
|
|
25
19
|
* #stateModel Assembly
|
|
26
20
|
*/
|
|
27
|
-
export default function assemblyFactory(assemblyConfigType: IAnyType,
|
|
21
|
+
export default function assemblyFactory(assemblyConfigType: IAnyType, pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
28
22
|
/**
|
|
29
23
|
* #property
|
|
30
24
|
*/
|
|
31
25
|
configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<IAnyType>>;
|
|
32
26
|
}, {
|
|
33
27
|
error: unknown;
|
|
34
|
-
loaded: boolean;
|
|
35
28
|
loadingP: Promise<void> | undefined;
|
|
36
29
|
volatileRegions: BasicRegion[] | undefined;
|
|
37
30
|
refNameAliases: RefNameAliases | undefined;
|
|
38
|
-
lowerCaseRefNameAliases: RefNameAliases | undefined;
|
|
39
31
|
cytobands: Feature[] | undefined;
|
|
40
32
|
} & {
|
|
33
|
+
/**
|
|
34
|
+
* #getter
|
|
35
|
+
*/
|
|
36
|
+
readonly lowerCaseRefNameAliases: {
|
|
37
|
+
[k: string]: string;
|
|
38
|
+
} | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
/**
|
|
41
|
+
* #method
|
|
42
|
+
*/
|
|
41
43
|
getConf(arg: string): any;
|
|
42
44
|
} & {
|
|
43
45
|
/**
|
|
@@ -113,7 +115,11 @@ export default function assemblyFactory(assemblyConfigType: IAnyType, pm: Plugin
|
|
|
113
115
|
/**
|
|
114
116
|
* #action
|
|
115
117
|
*/
|
|
116
|
-
setLoaded({
|
|
118
|
+
setLoaded({ regions, refNameAliases, cytobands, }: {
|
|
119
|
+
regions: Region[];
|
|
120
|
+
refNameAliases: RefNameAliases;
|
|
121
|
+
cytobands: Feature[];
|
|
122
|
+
}): void;
|
|
117
123
|
/**
|
|
118
124
|
* #action
|
|
119
125
|
*/
|
|
@@ -125,7 +131,7 @@ export default function assemblyFactory(assemblyConfigType: IAnyType, pm: Plugin
|
|
|
125
131
|
/**
|
|
126
132
|
* #action
|
|
127
133
|
*/
|
|
128
|
-
setRefNameAliases(aliases: RefNameAliases
|
|
134
|
+
setRefNameAliases(aliases: RefNameAliases): void;
|
|
129
135
|
/**
|
|
130
136
|
* #action
|
|
131
137
|
*/
|
|
@@ -11,6 +11,7 @@ const configuration_1 = require("../configuration");
|
|
|
11
11
|
const util_1 = require("../util");
|
|
12
12
|
const QuickLRU_1 = __importDefault(require("../util/QuickLRU"));
|
|
13
13
|
const dataAdapterCache_1 = require("../data_adapters/dataAdapterCache");
|
|
14
|
+
/* biome-ignore lint/complexity/useRegexLiterals: */
|
|
14
15
|
const refNameRegex = new RegExp('[0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*');
|
|
15
16
|
// Based on the UCSC Genome Browser chromosome color palette:
|
|
16
17
|
// https://github.com/ucscGenomeBrowser/kent/blob/a50ed53aff81d6fb3e34e6913ce18578292bc24e/src/hg/inc/chromColors.h
|
|
@@ -63,14 +64,12 @@ async function loadRefNameMap(assembly, adapterConfig, options, signal) {
|
|
|
63
64
|
checkRefName(name);
|
|
64
65
|
return [assembly.getCanonicalRefName(name), name];
|
|
65
66
|
}));
|
|
66
|
-
// make the reversed map too
|
|
67
|
-
const reversed = Object.fromEntries(Object.entries(refNameMap).map(([canonicalName, adapterName]) => [
|
|
68
|
-
adapterName,
|
|
69
|
-
canonicalName,
|
|
70
|
-
]));
|
|
71
67
|
return {
|
|
72
68
|
forwardMap: refNameMap,
|
|
73
|
-
reverseMap:
|
|
69
|
+
reverseMap: Object.fromEntries(Object.entries(refNameMap).map(([canonicalName, adapterName]) => [
|
|
70
|
+
adapterName,
|
|
71
|
+
canonicalName,
|
|
72
|
+
])),
|
|
74
73
|
};
|
|
75
74
|
}
|
|
76
75
|
// Valid refName pattern from https://samtools.github.io/hts-specs/SAMv1.pdf
|
|
@@ -82,7 +81,7 @@ function checkRefName(refName) {
|
|
|
82
81
|
/**
|
|
83
82
|
* #stateModel Assembly
|
|
84
83
|
*/
|
|
85
|
-
function assemblyFactory(assemblyConfigType,
|
|
84
|
+
function assemblyFactory(assemblyConfigType, pluginManager) {
|
|
86
85
|
const adapterLoads = new abortable_promise_cache_1.default({
|
|
87
86
|
cache: new QuickLRU_1.default({ maxSize: 1000 }),
|
|
88
87
|
// @ts-expect-error
|
|
@@ -100,14 +99,28 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
100
99
|
})
|
|
101
100
|
.volatile(() => ({
|
|
102
101
|
error: undefined,
|
|
103
|
-
loaded: false,
|
|
104
102
|
loadingP: undefined,
|
|
105
103
|
volatileRegions: undefined,
|
|
106
104
|
refNameAliases: undefined,
|
|
107
|
-
lowerCaseRefNameAliases: undefined,
|
|
108
105
|
cytobands: undefined,
|
|
109
106
|
}))
|
|
110
107
|
.views(self => ({
|
|
108
|
+
/**
|
|
109
|
+
* #getter
|
|
110
|
+
*/
|
|
111
|
+
get lowerCaseRefNameAliases() {
|
|
112
|
+
return self.refNameAliases
|
|
113
|
+
? Object.fromEntries(Object.entries(self.refNameAliases).map(([key, val]) => [
|
|
114
|
+
key.toLowerCase(),
|
|
115
|
+
val,
|
|
116
|
+
]))
|
|
117
|
+
: undefined;
|
|
118
|
+
},
|
|
119
|
+
}))
|
|
120
|
+
.views(self => ({
|
|
121
|
+
/**
|
|
122
|
+
* #method
|
|
123
|
+
*/
|
|
111
124
|
getConf(arg) {
|
|
112
125
|
return self.configuration ? (0, configuration_1.getConf)(self, arg) : undefined;
|
|
113
126
|
},
|
|
@@ -176,7 +189,7 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
176
189
|
get lowerCaseRefNames() {
|
|
177
190
|
return !self.lowerCaseRefNameAliases
|
|
178
191
|
? undefined
|
|
179
|
-
: Object.keys(self.lowerCaseRefNameAliases
|
|
192
|
+
: Object.keys(self.lowerCaseRefNameAliases);
|
|
180
193
|
},
|
|
181
194
|
/**
|
|
182
195
|
* #getter
|
|
@@ -190,7 +203,6 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
190
203
|
* #getter
|
|
191
204
|
*/
|
|
192
205
|
get rpcManager() {
|
|
193
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
206
|
return (0, mobx_state_tree_1.getParent)(self, 2).rpcManager;
|
|
195
207
|
},
|
|
196
208
|
/**
|
|
@@ -228,10 +240,9 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
228
240
|
return undefined;
|
|
229
241
|
}
|
|
230
242
|
const idx = self.refNames.indexOf(refName);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return self.refNameColors[idx % self.refNameColors.length];
|
|
243
|
+
return idx === -1
|
|
244
|
+
? undefined
|
|
245
|
+
: self.refNameColors[idx % self.refNameColors.length];
|
|
235
246
|
},
|
|
236
247
|
/**
|
|
237
248
|
* #method
|
|
@@ -247,17 +258,15 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
247
258
|
/**
|
|
248
259
|
* #action
|
|
249
260
|
*/
|
|
250
|
-
setLoaded({
|
|
251
|
-
|
|
252
|
-
this.
|
|
253
|
-
this.setRefNameAliases(refNameAliases, lowerCaseRefNameAliases);
|
|
261
|
+
setLoaded({ regions, refNameAliases, cytobands, }) {
|
|
262
|
+
this.setRegions(regions);
|
|
263
|
+
this.setRefNameAliases(refNameAliases);
|
|
254
264
|
this.setCytobands(cytobands);
|
|
255
265
|
},
|
|
256
266
|
/**
|
|
257
267
|
* #action
|
|
258
268
|
*/
|
|
259
269
|
setError(e) {
|
|
260
|
-
console.error(e);
|
|
261
270
|
self.error = e;
|
|
262
271
|
},
|
|
263
272
|
/**
|
|
@@ -269,9 +278,8 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
269
278
|
/**
|
|
270
279
|
* #action
|
|
271
280
|
*/
|
|
272
|
-
setRefNameAliases(aliases
|
|
281
|
+
setRefNameAliases(aliases) {
|
|
273
282
|
self.refNameAliases = aliases;
|
|
274
|
-
self.lowerCaseRefNameAliases = lcAliases;
|
|
275
283
|
},
|
|
276
284
|
/**
|
|
277
285
|
* #action
|
|
@@ -290,7 +298,7 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
290
298
|
*/
|
|
291
299
|
load() {
|
|
292
300
|
if (!self.loadingP) {
|
|
293
|
-
self.loadingP = this.loadPre().catch(e => {
|
|
301
|
+
self.loadingP = this.loadPre().catch((e) => {
|
|
294
302
|
this.setLoadingP(undefined);
|
|
295
303
|
this.setError(e);
|
|
296
304
|
});
|
|
@@ -302,38 +310,53 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
302
310
|
*/
|
|
303
311
|
async loadPre() {
|
|
304
312
|
var _a, _b;
|
|
313
|
+
var _c;
|
|
305
314
|
const conf = self.configuration;
|
|
306
315
|
const refNameAliasesAdapterConf = (_a = conf === null || conf === void 0 ? void 0 : conf.refNameAliases) === null || _a === void 0 ? void 0 : _a.adapter;
|
|
307
316
|
const cytobandAdapterConf = (_b = conf === null || conf === void 0 ? void 0 : conf.cytobands) === null || _b === void 0 ? void 0 : _b.adapter;
|
|
308
317
|
const sequenceAdapterConf = conf === null || conf === void 0 ? void 0 : conf.sequence.adapter;
|
|
309
318
|
const assemblyName = self.name;
|
|
310
|
-
const regions = await getAssemblyRegions(
|
|
319
|
+
const regions = await getAssemblyRegions({
|
|
320
|
+
config: sequenceAdapterConf,
|
|
321
|
+
pluginManager,
|
|
322
|
+
});
|
|
311
323
|
const adapterRegionsWithAssembly = regions.map(r => {
|
|
312
324
|
checkRefName(r.refName);
|
|
313
325
|
return { ...r, assemblyName };
|
|
314
326
|
});
|
|
315
327
|
const refNameAliases = {};
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
aliases.forEach(a => {
|
|
320
|
-
checkRefName(a);
|
|
321
|
-
refNameAliases[a] = refName;
|
|
322
|
-
});
|
|
328
|
+
const refNameAliasCollection = await getRefNameAliases({
|
|
329
|
+
config: refNameAliasesAdapterConf,
|
|
330
|
+
pluginManager,
|
|
323
331
|
});
|
|
332
|
+
for (const { refName, aliases, override } of refNameAliasCollection) {
|
|
333
|
+
for (const alias of aliases) {
|
|
334
|
+
checkRefName(alias);
|
|
335
|
+
refNameAliases[alias] = refName;
|
|
336
|
+
}
|
|
337
|
+
// the override field is supplied by a RefNameAliasAdapter to make
|
|
338
|
+
// the refName field returned by the adapter to be used as the
|
|
339
|
+
// primary names for this assembly
|
|
340
|
+
if (override) {
|
|
341
|
+
refNameAliases[refName] = refName;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
324
344
|
// add identity to the refNameAliases list
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
val,
|
|
331
|
-
]));
|
|
345
|
+
for (const region of adapterRegionsWithAssembly) {
|
|
346
|
+
// this ||= means that if the refNameAliasAdapter already set a
|
|
347
|
+
// mapping for the primary region to be an alias
|
|
348
|
+
refNameAliases[_c = region.refName] || (refNameAliases[_c] = region.refName);
|
|
349
|
+
}
|
|
332
350
|
this.setLoaded({
|
|
333
|
-
adapterRegionsWithAssembly,
|
|
334
351
|
refNameAliases,
|
|
335
|
-
|
|
336
|
-
|
|
352
|
+
regions: adapterRegionsWithAssembly.map(r => ({
|
|
353
|
+
...r,
|
|
354
|
+
refName: refNameAliases[r.refName] || r.refName,
|
|
355
|
+
})),
|
|
356
|
+
cytobands: await getCytobands({
|
|
357
|
+
config: cytobandAdapterConf,
|
|
358
|
+
pluginManager,
|
|
359
|
+
}),
|
|
337
360
|
});
|
|
338
361
|
},
|
|
339
362
|
}))
|
|
@@ -348,7 +371,7 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
348
371
|
}
|
|
349
372
|
return adapterLoads.get((0, dataAdapterCache_1.adapterConfigCacheKey)(adapterConf), {
|
|
350
373
|
adapterConf,
|
|
351
|
-
self
|
|
374
|
+
self,
|
|
352
375
|
options: rest,
|
|
353
376
|
},
|
|
354
377
|
// signal intentionally not passed here, fixes issues like #2221.
|
|
@@ -360,7 +383,7 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
360
383
|
* get Map of `canonical-name -> adapter-specific-name`
|
|
361
384
|
*/
|
|
362
385
|
async getRefNameMapForAdapter(adapterConf, opts) {
|
|
363
|
-
if (!
|
|
386
|
+
if (!opts.sessionId) {
|
|
364
387
|
throw new Error('sessionId is required');
|
|
365
388
|
}
|
|
366
389
|
const map = await this.getAdapterMapEntry(adapterConf, opts);
|
|
@@ -376,22 +399,22 @@ function assemblyFactory(assemblyConfigType, pm) {
|
|
|
376
399
|
},
|
|
377
400
|
}));
|
|
378
401
|
}
|
|
379
|
-
async function getRefNameAliases(config,
|
|
380
|
-
const type =
|
|
402
|
+
async function getRefNameAliases({ config, pluginManager, signal, }) {
|
|
403
|
+
const type = pluginManager.getAdapterType(config.type);
|
|
381
404
|
const CLASS = await type.getAdapterClass();
|
|
382
|
-
const adapter = new CLASS(config, undefined,
|
|
405
|
+
const adapter = new CLASS(config, undefined, pluginManager);
|
|
383
406
|
return adapter.getRefNameAliases({ signal });
|
|
384
407
|
}
|
|
385
|
-
async function getCytobands(config,
|
|
386
|
-
const type =
|
|
408
|
+
async function getCytobands({ config, pluginManager, }) {
|
|
409
|
+
const type = pluginManager.getAdapterType(config.type);
|
|
387
410
|
const CLASS = await type.getAdapterClass();
|
|
388
|
-
const adapter = new CLASS(config, undefined,
|
|
411
|
+
const adapter = new CLASS(config, undefined, pluginManager);
|
|
389
412
|
// @ts-expect-error
|
|
390
413
|
return adapter.getData();
|
|
391
414
|
}
|
|
392
|
-
async function getAssemblyRegions(config,
|
|
393
|
-
const type =
|
|
415
|
+
async function getAssemblyRegions({ config, pluginManager, signal, }) {
|
|
416
|
+
const type = pluginManager.getAdapterType(config.type);
|
|
394
417
|
const CLASS = await type.getAdapterClass();
|
|
395
|
-
const adapter = new CLASS(config, undefined,
|
|
418
|
+
const adapter = new CLASS(config, undefined, pluginManager);
|
|
396
419
|
return adapter.getRegions({ signal });
|
|
397
420
|
}
|
|
@@ -7,7 +7,8 @@ import PluginManager from '../PluginManager';
|
|
|
7
7
|
declare function assemblyConfigSchema(pluginManager: PluginManager): import("../configuration/configurationSchema").ConfigurationSchemaType<{
|
|
8
8
|
/**
|
|
9
9
|
* #slot
|
|
10
|
-
* aliases are "reference name aliases" e.g. aliases for hg38 might be
|
|
10
|
+
* aliases are "reference name aliases" e.g. aliases for hg38 might be
|
|
11
|
+
* "GRCh38"
|
|
11
12
|
*/
|
|
12
13
|
aliases: {
|
|
13
14
|
type: string;
|
|
@@ -16,8 +17,9 @@ declare function assemblyConfigSchema(pluginManager: PluginManager): import("../
|
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* #slot
|
|
19
|
-
* sequence refers to a reference sequence track that has an adapter
|
|
20
|
-
* importantly, a sequence adapter such as
|
|
20
|
+
* sequence refers to a reference sequence track that has an adapter
|
|
21
|
+
* containing, importantly, a sequence adapter such as
|
|
22
|
+
* IndexedFastaAdapter
|
|
21
23
|
*/
|
|
22
24
|
sequence: import("../configuration").AnyConfigurationSchemaType;
|
|
23
25
|
/**
|
|
@@ -31,8 +33,8 @@ declare function assemblyConfigSchema(pluginManager: PluginManager): import("../
|
|
|
31
33
|
refNameAliases: import("../configuration/configurationSchema").ConfigurationSchemaType<{
|
|
32
34
|
/**
|
|
33
35
|
* #slot refNameAliases.adapter
|
|
34
|
-
* refNameAliases help resolve e.g. chr1 and 1 as the same entity
|
|
35
|
-
*
|
|
36
|
+
* refNameAliases help resolve e.g. chr1 and 1 as the same entity the
|
|
37
|
+
* data for refNameAliases are fetched from an adapter, that is
|
|
36
38
|
* commonly a tsv like chromAliases.txt from UCSC or similar
|
|
37
39
|
*/
|
|
38
40
|
adapter: import("mobx-state-tree").IAnyModelType;
|
|
@@ -40,8 +42,8 @@ declare function assemblyConfigSchema(pluginManager: PluginManager): import("../
|
|
|
40
42
|
cytobands: import("../configuration/configurationSchema").ConfigurationSchemaType<{
|
|
41
43
|
/**
|
|
42
44
|
* #slot cytobands.adapter
|
|
43
|
-
* cytoband data is fetched from an adapter, and can be displayed by
|
|
44
|
-
* view type as ideograms
|
|
45
|
+
* cytoband data is fetched from an adapter, and can be displayed by
|
|
46
|
+
* a view type as ideograms
|
|
45
47
|
*/
|
|
46
48
|
adapter: import("mobx-state-tree").IAnyModelType;
|
|
47
49
|
}, import("../configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
@@ -10,7 +10,8 @@ function assemblyConfigSchema(pluginManager) {
|
|
|
10
10
|
return (0, configuration_1.ConfigurationSchema)('BaseAssembly', {
|
|
11
11
|
/**
|
|
12
12
|
* #slot
|
|
13
|
-
* aliases are "reference name aliases" e.g. aliases for hg38 might be
|
|
13
|
+
* aliases are "reference name aliases" e.g. aliases for hg38 might be
|
|
14
|
+
* "GRCh38"
|
|
14
15
|
*/
|
|
15
16
|
aliases: {
|
|
16
17
|
type: 'stringArray',
|
|
@@ -19,8 +20,9 @@ function assemblyConfigSchema(pluginManager) {
|
|
|
19
20
|
},
|
|
20
21
|
/**
|
|
21
22
|
* #slot
|
|
22
|
-
* sequence refers to a reference sequence track that has an adapter
|
|
23
|
-
* importantly, a sequence adapter such as
|
|
23
|
+
* sequence refers to a reference sequence track that has an adapter
|
|
24
|
+
* containing, importantly, a sequence adapter such as
|
|
25
|
+
* IndexedFastaAdapter
|
|
24
26
|
*/
|
|
25
27
|
sequence: pluginManager.getTrackType('ReferenceSequenceTrack')
|
|
26
28
|
.configSchema,
|
|
@@ -35,15 +37,14 @@ function assemblyConfigSchema(pluginManager) {
|
|
|
35
37
|
refNameAliases: (0, configuration_1.ConfigurationSchema)('RefNameAliases', {
|
|
36
38
|
/**
|
|
37
39
|
* #slot refNameAliases.adapter
|
|
38
|
-
* refNameAliases help resolve e.g. chr1 and 1 as the same entity
|
|
39
|
-
*
|
|
40
|
+
* refNameAliases help resolve e.g. chr1 and 1 as the same entity the
|
|
41
|
+
* data for refNameAliases are fetched from an adapter, that is
|
|
40
42
|
* commonly a tsv like chromAliases.txt from UCSC or similar
|
|
41
43
|
*/
|
|
42
44
|
adapter: pluginManager.pluggableConfigSchemaType('adapter'),
|
|
43
45
|
}, {
|
|
44
46
|
preProcessSnapshot: snap => {
|
|
45
47
|
// allow refNameAliases to be unspecified
|
|
46
|
-
// @ts-expect-error
|
|
47
48
|
if (!snap.adapter) {
|
|
48
49
|
return { adapter: { type: 'RefNameAliasAdapter' } };
|
|
49
50
|
}
|
|
@@ -53,18 +54,16 @@ function assemblyConfigSchema(pluginManager) {
|
|
|
53
54
|
cytobands: (0, configuration_1.ConfigurationSchema)('Cytoband', {
|
|
54
55
|
/**
|
|
55
56
|
* #slot cytobands.adapter
|
|
56
|
-
* cytoband data is fetched from an adapter, and can be displayed by
|
|
57
|
-
* view type as ideograms
|
|
57
|
+
* cytoband data is fetched from an adapter, and can be displayed by
|
|
58
|
+
* a view type as ideograms
|
|
58
59
|
*/
|
|
59
60
|
adapter: pluginManager.pluggableConfigSchemaType('adapter'),
|
|
60
61
|
}, {
|
|
61
62
|
preProcessSnapshot: snap => {
|
|
62
63
|
// allow cytoBand to be unspecified
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
return snap;
|
|
64
|
+
return !snap.adapter
|
|
65
|
+
? { adapter: { type: 'CytobandAdapter' } }
|
|
66
|
+
: snap;
|
|
68
67
|
},
|
|
69
68
|
}),
|
|
70
69
|
/**
|
|
@@ -78,9 +77,9 @@ function assemblyConfigSchema(pluginManager) {
|
|
|
78
77
|
}, {
|
|
79
78
|
/**
|
|
80
79
|
* #identifier name
|
|
81
|
-
* the name acts as a unique identifier in the config, so it cannot be
|
|
82
|
-
* it usually a short human readable "id" like hg38, but you
|
|
83
|
-
* customize the assembly "displayName" config slot
|
|
80
|
+
* the name acts as a unique identifier in the config, so it cannot be
|
|
81
|
+
* duplicated. it usually a short human readable "id" like hg38, but you
|
|
82
|
+
* can also optionally customize the assembly "displayName" config slot
|
|
84
83
|
*/
|
|
85
84
|
explicitIdentifier: 'name',
|
|
86
85
|
});
|