@jbrowse/core 2.1.7 → 2.2.1
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 +3 -2
- package/BaseFeatureWidget/BaseFeatureDetail.js +43 -28
- package/BaseFeatureWidget/SequenceBox.js +4 -8
- package/BaseFeatureWidget/SequenceFeatureDetails.js +2 -1
- package/Plugin.d.ts +1 -1
- package/PluginLoader.d.ts +2 -2
- package/PluginManager.d.ts +6 -6
- package/ReExports/modules.d.ts +3 -3
- package/assemblyManager/assembly.d.ts +23 -17
- package/assemblyManager/assembly.js +75 -76
- package/assemblyManager/assemblyConfigSchema.d.ts +6 -2
- package/assemblyManager/assemblyConfigSchema.js +39 -2
- package/assemblyManager/assemblyManager.d.ts +76 -214
- package/assemblyManager/assemblyManager.js +17 -39
- package/configuration/configurationSchema.d.ts +2 -2
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/CytobandAdapter.js +7 -0
- package/data_adapters/dataAdapterCache.d.ts +1 -1
- package/package.json +2 -2
- package/pluggableElementTypes/AdapterType.d.ts +1 -1
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
- package/pluggableElementTypes/RpcMethodType.d.ts +1 -1
- package/pluggableElementTypes/ViewType.d.ts +2 -2
- package/pluggableElementTypes/index.d.ts +2 -2
- package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +23 -2
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +24 -2
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +62 -3
- package/pluggableElementTypes/models/BaseDisplayModel.js +138 -92
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +49 -4
- package/pluggableElementTypes/models/BaseTrackModel.js +77 -26
- package/pluggableElementTypes/models/BaseViewModel.d.ts +22 -0
- package/pluggableElementTypes/models/BaseViewModel.js +41 -2
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +53 -6
- package/pluggableElementTypes/models/InternetAccountModel.js +57 -6
- package/pluggableElementTypes/models/baseConnectionConfig.js +17 -1
- package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +2 -2
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +27 -1
- package/pluggableElementTypes/models/baseTrackConfig.d.ts +5 -2
- package/pluggableElementTypes/models/baseTrackConfig.js +52 -1
- package/pluggableElementTypes/renderers/BoxRendererType.d.ts +2 -2
- package/pluggableElementTypes/renderers/BoxRendererType.js +2 -0
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/RendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.d.ts +2 -2
- package/rpc/MainThreadRpcDriver.d.ts +1 -1
- package/rpc/MainThreadRpcDriver.js +2 -2
- package/rpc/RpcManager.d.ts +2 -2
- package/rpc/WebWorkerRpcDriver.d.ts +5 -4
- package/rpc/WebWorkerRpcDriver.js +2 -2
- package/rpc/baseRpcConfig.d.ts +2 -0
- package/rpc/baseRpcConfig.js +18 -0
- package/rpc/configSchema.js +16 -10
- package/rpc/coreRpcMethods.d.ts +14 -14
- package/rpc/coreRpcMethods.js +60 -63
- package/rpc/mainThreadRpcConfig.d.ts +2 -0
- package/rpc/mainThreadRpcConfig.js +19 -0
- package/rpc/remoteAbortSignals.d.ts +1 -1
- package/rpc/webWorkerRpcConfig.d.ts +2 -0
- package/rpc/webWorkerRpcConfig.js +19 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +2 -1
- package/ui/App.d.ts +2 -2
- package/ui/App.js +11 -10
- package/ui/AssemblySelector.d.ts +1 -1
- package/ui/AssemblySelector.js +12 -10
- package/ui/DrawerWidget.js +2 -1
- package/ui/EditableTypography.d.ts +4 -4
- package/ui/EditableTypography.js +7 -11
- package/ui/LoadingEllipses.d.ts +7 -0
- package/ui/LoadingEllipses.js +38 -0
- package/ui/Logo.d.ts +1 -1
- package/ui/Menu.d.ts +2 -2
- package/ui/Snackbar.d.ts +1 -1
- package/ui/ViewContainer.d.ts +2 -1
- package/ui/ViewContainer.js +34 -22
- package/ui/index.d.ts +1 -0
- package/ui/index.js +3 -1
- package/util/Base1DUtils.js +9 -3
- package/util/Base1DViewModel.d.ts +72 -2
- package/util/Base1DViewModel.js +94 -3
- package/util/blockTypes.d.ts +1 -1
- package/util/calculateDynamicBlocks.js +1 -1
- package/util/calculateStaticBlocks.js +1 -1
- package/util/index.d.ts +3 -1
- package/util/index.js +19 -9
- package/util/io/RemoteFileWithRangeCache.d.ts +1 -2
- package/util/io/RemoteFileWithRangeCache.js +2 -2
- package/util/io/index.js +3 -3
- package/util/jexl.d.ts +1 -1
- package/util/layouts/BaseLayout.d.ts +1 -1
- package/util/layouts/GranularRectLayout.d.ts +7 -2
- package/util/layouts/GranularRectLayout.js +29 -45
- package/util/layouts/MultiLayout.d.ts +2 -2
- package/util/layouts/MultiLayout.js +4 -6
- package/util/offscreenCanvasPonyfill.d.ts +2 -2
- package/util/offscreenCanvasUtils.d.ts +1 -1
- package/util/simpleFeature.d.ts +3 -0
- package/util/stats.d.ts +26 -0
- package/util/stats.js +9 -9
- package/util/tracks.d.ts +2 -2
- package/util/types/index.d.ts +15 -8
- package/util/types/index.js +8 -1
- package/util/types/util.d.ts +5 -5
package/util/Base1DViewModel.js
CHANGED
|
@@ -9,13 +9,37 @@ const mst_1 = require("./types/mst");
|
|
|
9
9
|
const calculateDynamicBlocks_1 = __importDefault(require("./calculateDynamicBlocks"));
|
|
10
10
|
const calculateStaticBlocks_1 = __importDefault(require("./calculateStaticBlocks"));
|
|
11
11
|
const Base1DUtils_1 = require("./Base1DUtils");
|
|
12
|
+
/**
|
|
13
|
+
* #stateModel Base1DView
|
|
14
|
+
* used in non-lgv view representations of a 1d view e.g. the two axes of the
|
|
15
|
+
* dotplot use this
|
|
16
|
+
*/
|
|
17
|
+
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
12
18
|
const Base1DView = mobx_state_tree_1.types
|
|
13
19
|
.model('Base1DView', {
|
|
20
|
+
/**
|
|
21
|
+
* #property
|
|
22
|
+
*/
|
|
14
23
|
id: mst_1.ElementId,
|
|
24
|
+
/**
|
|
25
|
+
* #property
|
|
26
|
+
*/
|
|
15
27
|
displayedRegions: mobx_state_tree_1.types.array(mst_1.Region),
|
|
28
|
+
/**
|
|
29
|
+
* #property
|
|
30
|
+
*/
|
|
16
31
|
bpPerPx: 0,
|
|
32
|
+
/**
|
|
33
|
+
* #property
|
|
34
|
+
*/
|
|
17
35
|
offsetPx: 0,
|
|
36
|
+
/**
|
|
37
|
+
* #property
|
|
38
|
+
*/
|
|
18
39
|
interRegionPaddingWidth: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
|
|
40
|
+
/**
|
|
41
|
+
* #property
|
|
42
|
+
*/
|
|
19
43
|
minimumBlockWidth: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
|
|
20
44
|
})
|
|
21
45
|
.volatile(() => ({
|
|
@@ -23,38 +47,65 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
23
47
|
volatileWidth: 0,
|
|
24
48
|
}))
|
|
25
49
|
.actions(self => ({
|
|
50
|
+
/**
|
|
51
|
+
* #action
|
|
52
|
+
*/
|
|
26
53
|
setDisplayedRegions(regions) {
|
|
27
54
|
self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
|
|
28
55
|
},
|
|
56
|
+
/**
|
|
57
|
+
* #action
|
|
58
|
+
*/
|
|
29
59
|
setBpPerPx(val) {
|
|
30
60
|
self.bpPerPx = val;
|
|
31
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* #action
|
|
64
|
+
*/
|
|
32
65
|
setVolatileWidth(width) {
|
|
33
66
|
self.volatileWidth = width;
|
|
34
67
|
},
|
|
35
68
|
}))
|
|
36
69
|
.views(self => ({
|
|
70
|
+
/**
|
|
71
|
+
* #getter
|
|
72
|
+
*/
|
|
37
73
|
get width() {
|
|
38
74
|
return self.volatileWidth;
|
|
39
75
|
},
|
|
76
|
+
/**
|
|
77
|
+
* #getter
|
|
78
|
+
*/
|
|
40
79
|
get assemblyNames() {
|
|
41
80
|
return [
|
|
42
81
|
...new Set(self.displayedRegions.map(region => region.assemblyName)),
|
|
43
82
|
];
|
|
44
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* #getter
|
|
86
|
+
*/
|
|
45
87
|
get displayedRegionsTotalPx() {
|
|
46
88
|
return this.totalBp / self.bpPerPx;
|
|
47
89
|
},
|
|
90
|
+
/**
|
|
91
|
+
* #getter
|
|
92
|
+
*/
|
|
48
93
|
get maxOffset() {
|
|
49
94
|
// objectively determined to keep the linear genome on the main screen
|
|
50
95
|
const leftPadding = 10;
|
|
51
96
|
return this.displayedRegionsTotalPx - leftPadding;
|
|
52
97
|
},
|
|
98
|
+
/**
|
|
99
|
+
* #getter
|
|
100
|
+
*/
|
|
53
101
|
get minOffset() {
|
|
54
102
|
// objectively determined to keep the linear genome on the main screen
|
|
55
103
|
const rightPadding = 30;
|
|
56
104
|
return -this.width + rightPadding;
|
|
57
105
|
},
|
|
106
|
+
/**
|
|
107
|
+
* #getter
|
|
108
|
+
*/
|
|
58
109
|
get totalBp() {
|
|
59
110
|
return self.displayedRegions
|
|
60
111
|
.map(a => a.end - a.start)
|
|
@@ -62,12 +113,21 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
62
113
|
},
|
|
63
114
|
}))
|
|
64
115
|
.views(self => ({
|
|
116
|
+
/**
|
|
117
|
+
* #getter
|
|
118
|
+
*/
|
|
65
119
|
get dynamicBlocks() {
|
|
66
120
|
return (0, calculateDynamicBlocks_1.default)(self);
|
|
67
121
|
},
|
|
122
|
+
/**
|
|
123
|
+
* #getter
|
|
124
|
+
*/
|
|
68
125
|
get staticBlocks() {
|
|
69
126
|
return (0, calculateStaticBlocks_1.default)(self);
|
|
70
127
|
},
|
|
128
|
+
/**
|
|
129
|
+
* #getter
|
|
130
|
+
*/
|
|
71
131
|
get currBp() {
|
|
72
132
|
return this.dynamicBlocks
|
|
73
133
|
.map(a => a.end - a.start)
|
|
@@ -75,30 +135,51 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
75
135
|
},
|
|
76
136
|
}))
|
|
77
137
|
.views(self => ({
|
|
138
|
+
/**
|
|
139
|
+
* #method
|
|
140
|
+
*/
|
|
78
141
|
pxToBp(px) {
|
|
79
142
|
return (0, Base1DUtils_1.pxToBp)(self, px);
|
|
80
143
|
},
|
|
144
|
+
/**
|
|
145
|
+
* #method
|
|
146
|
+
*/
|
|
81
147
|
bpToPx({ refName, coord, regionNumber, }) {
|
|
82
148
|
var _a;
|
|
83
149
|
return (_a = (0, Base1DUtils_1.bpToPx)({ refName, coord, regionNumber, self })) === null || _a === void 0 ? void 0 : _a.offsetPx;
|
|
84
150
|
},
|
|
85
151
|
}))
|
|
86
152
|
.actions(self => ({
|
|
153
|
+
/**
|
|
154
|
+
* #action
|
|
155
|
+
*/
|
|
87
156
|
setFeatures(features) {
|
|
88
157
|
self.features = features;
|
|
89
158
|
},
|
|
90
|
-
|
|
91
|
-
|
|
159
|
+
/**
|
|
160
|
+
* #action
|
|
161
|
+
* this makes a zoomed out view that shows all displayedRegions that makes
|
|
162
|
+
* the overview bar square with the scale bar
|
|
163
|
+
*/
|
|
92
164
|
showAllRegions() {
|
|
93
165
|
self.bpPerPx = self.totalBp / self.width;
|
|
94
166
|
self.offsetPx = 0;
|
|
95
167
|
},
|
|
168
|
+
/**
|
|
169
|
+
* #action
|
|
170
|
+
*/
|
|
96
171
|
zoomOut() {
|
|
97
172
|
this.zoomTo(self.bpPerPx * 2);
|
|
98
173
|
},
|
|
174
|
+
/**
|
|
175
|
+
* #action
|
|
176
|
+
*/
|
|
99
177
|
zoomIn() {
|
|
100
178
|
this.zoomTo(self.bpPerPx / 2);
|
|
101
179
|
},
|
|
180
|
+
/**
|
|
181
|
+
* #action
|
|
182
|
+
*/
|
|
102
183
|
zoomTo(newBpPerPx, offset = self.width / 2) {
|
|
103
184
|
const bpPerPx = newBpPerPx;
|
|
104
185
|
if (bpPerPx === self.bpPerPx) {
|
|
@@ -110,11 +191,17 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
110
191
|
self.offsetPx = (0, index_1.clamp)(Math.round(((self.offsetPx + offset) * oldBpPerPx) / bpPerPx - offset), self.minOffset, self.maxOffset);
|
|
111
192
|
return self.bpPerPx;
|
|
112
193
|
},
|
|
194
|
+
/**
|
|
195
|
+
* #action
|
|
196
|
+
*/
|
|
113
197
|
scrollTo(offsetPx) {
|
|
114
198
|
const newOffsetPx = (0, index_1.clamp)(offsetPx, self.minOffset, self.maxOffset);
|
|
115
199
|
self.offsetPx = newOffsetPx;
|
|
116
200
|
return newOffsetPx;
|
|
117
201
|
},
|
|
202
|
+
/**
|
|
203
|
+
* #action
|
|
204
|
+
*/
|
|
118
205
|
centerAt(coord, refName, regionNumber) {
|
|
119
206
|
if (!refName) {
|
|
120
207
|
return;
|
|
@@ -128,9 +215,12 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
128
215
|
this.scrollTo(Math.round(centerPx - self.width / 2));
|
|
129
216
|
}
|
|
130
217
|
},
|
|
218
|
+
/**
|
|
219
|
+
* #action
|
|
220
|
+
* note: the scroll is clamped to keep the view on the main screen
|
|
221
|
+
*/
|
|
131
222
|
scroll(distance) {
|
|
132
223
|
const oldOffsetPx = self.offsetPx;
|
|
133
|
-
// the scroll is clamped to keep the linear genome on the main screen
|
|
134
224
|
const newOffsetPx = (0, index_1.clamp)(self.offsetPx + distance, self.minOffset, self.maxOffset);
|
|
135
225
|
self.offsetPx = newOffsetPx;
|
|
136
226
|
return newOffsetPx - oldOffsetPx;
|
|
@@ -138,6 +228,7 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
138
228
|
}))
|
|
139
229
|
.actions(self => ({
|
|
140
230
|
/**
|
|
231
|
+
* #action
|
|
141
232
|
* offset is the base-pair-offset in the displayed region, index is the index of the
|
|
142
233
|
* displayed region in the linear genome view
|
|
143
234
|
*
|
package/util/blockTypes.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ function calculateDynamicBlocks(model, padding = true, elision = true) {
|
|
|
75
75
|
isRightEndOfDisplayedRegion,
|
|
76
76
|
key: '',
|
|
77
77
|
};
|
|
78
|
-
blockData.key = `${(0, _1.
|
|
78
|
+
blockData.key = `${(0, _1.assembleLocStringFast)(blockData)}-${regionNumber}${reversed ? '-reversed' : ''}`;
|
|
79
79
|
if (padding && blocks.length === 0 && isLeftEndOfDisplayedRegion) {
|
|
80
80
|
blocks.push(new blockTypes_1.InterRegionPaddingBlock({
|
|
81
81
|
key: `${blockData.key}-beforeFirstRegion`,
|
|
@@ -59,7 +59,7 @@ function calculateStaticBlocks(model, padding = true, elision = true, extra = 0,
|
|
|
59
59
|
isRightEndOfDisplayedRegion,
|
|
60
60
|
key: '',
|
|
61
61
|
};
|
|
62
|
-
blockData.key = `${(0, _1.
|
|
62
|
+
blockData.key = `${(0, _1.assembleLocStringFast)(blockData)}-${regionNumber}${reversed ? '-reversed' : ''}`;
|
|
63
63
|
if (padding && regionNumber === 0 && blockNum === 0) {
|
|
64
64
|
blocks.push(new blockTypes_1.InterRegionPaddingBlock({
|
|
65
65
|
key: `${blockData.key}-beforeFirstRegion`,
|
package/util/index.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export declare function getContainingDisplay(node: IAnyStateTreeNode): import(".
|
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
65
|
export declare function assembleLocString(region: ParsedLocString): string;
|
|
66
|
+
export declare function assembleLocStringFast(region: ParsedLocString, cb?: (n: number) => string | number): string;
|
|
66
67
|
export interface ParsedLocString {
|
|
67
68
|
assemblyName?: string;
|
|
68
69
|
refName: string;
|
|
@@ -196,6 +197,7 @@ export declare function renameRegionsIfNeeded<ARGTYPE extends {
|
|
|
196
197
|
})[];
|
|
197
198
|
}>;
|
|
198
199
|
export declare function minmax(a: number, b: number): number[];
|
|
200
|
+
export declare function shorten(name: string, max?: number, short?: number): string;
|
|
199
201
|
export declare function stringify({ refName, coord, oob, }: {
|
|
200
202
|
coord: number;
|
|
201
203
|
refName?: string;
|
|
@@ -296,7 +298,7 @@ interface Block {
|
|
|
296
298
|
export declare function bytesForRegions(regions: Region[], index: {
|
|
297
299
|
blocksForRange: (ref: string, start: number, end: number) => Promise<Block[]>;
|
|
298
300
|
}): Promise<number>;
|
|
299
|
-
export
|
|
301
|
+
export type ViewSnap = {
|
|
300
302
|
bpPerPx: number;
|
|
301
303
|
interRegionPaddingWidth: number;
|
|
302
304
|
minimumBlockWidth: number;
|
package/util/index.js
CHANGED
|
@@ -29,8 +29,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.
|
|
33
|
-
exports.getEnv = exports.measureGridWidth = exports.getStr = exports.getUriLink = exports.useLocalStorage = exports.getLayoutId = exports.getViewParams = exports.getTickDisplayStr = exports.toLocale = void 0;
|
|
32
|
+
exports.bytesForRegions = exports.objectHash = exports.hashCode = exports.updateStatus = exports.generateCodonTable = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.measureText = exports.rIC = exports.blobToDataURL = exports.complement = exports.reverse = exports.revcom = exports.isElectron = exports.stringify = exports.shorten = exports.minmax = exports.renameRegionsIfNeeded = exports.renameRegionIfNeeded = exports.makeAbortableReaction = exports.findLastIndex = exports.iterMap = exports.bpSpanPx = exports.featureSpanPx = exports.cartesianToPolar = exports.polarToCartesian = exports.degToRad = exports.radToDeg = exports.bpToPx = exports.clamp = exports.compareLocStrings = exports.compareLocs = exports.parseLocString = exports.parseLocStringOneBased = exports.assembleLocStringFast = exports.assembleLocString = exports.getContainingDisplay = exports.getContainingTrack = exports.getContainingView = exports.getSession = exports.findParentThatIs = exports.springAnimate = exports.findParentThat = exports.useDebouncedCallback = exports.useDebounce = exports.inProduction = exports.inDevelopment = exports.isFeature = exports.SimpleFeature = void 0;
|
|
33
|
+
exports.getEnv = exports.measureGridWidth = exports.getStr = exports.getUriLink = exports.useLocalStorage = exports.getLayoutId = exports.getViewParams = exports.getTickDisplayStr = exports.toLocale = exports.getBpDisplayStr = exports.supportedIndexingAdapters = void 0;
|
|
34
34
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
35
35
|
const react_1 = require("react");
|
|
36
36
|
const is_object_1 = __importDefault(require("is-object"));
|
|
@@ -237,11 +237,18 @@ exports.getContainingDisplay = getContainingDisplay;
|
|
|
237
237
|
* ```
|
|
238
238
|
*/
|
|
239
239
|
function assembleLocString(region) {
|
|
240
|
+
return assembleLocStringFast(region, toLocale);
|
|
241
|
+
}
|
|
242
|
+
exports.assembleLocString = assembleLocString;
|
|
243
|
+
// same as assembleLocString above, but does not perform toLocaleString which
|
|
244
|
+
// can slow down the speed of block calculations which use assembleLocString
|
|
245
|
+
// for block.key
|
|
246
|
+
function assembleLocStringFast(region, cb = (n) => n) {
|
|
240
247
|
const { assemblyName, refName, start, end, reversed } = region;
|
|
241
248
|
const assemblyNameString = assemblyName ? `{${assemblyName}}` : '';
|
|
242
249
|
let startString;
|
|
243
250
|
if (start !== undefined) {
|
|
244
|
-
startString = `:${(start + 1)
|
|
251
|
+
startString = `:${cb(start + 1)}`;
|
|
245
252
|
}
|
|
246
253
|
else if (end !== undefined) {
|
|
247
254
|
startString = ':1';
|
|
@@ -251,10 +258,7 @@ function assembleLocString(region) {
|
|
|
251
258
|
}
|
|
252
259
|
let endString;
|
|
253
260
|
if (end !== undefined) {
|
|
254
|
-
endString =
|
|
255
|
-
start !== undefined && start + 1 === end
|
|
256
|
-
? ''
|
|
257
|
-
: `..${end.toLocaleString('en-US')}`;
|
|
261
|
+
endString = start !== undefined && start + 1 === end ? '' : `..${cb(end)}`;
|
|
258
262
|
}
|
|
259
263
|
else {
|
|
260
264
|
endString = start !== undefined ? '..' : '';
|
|
@@ -265,7 +269,7 @@ function assembleLocString(region) {
|
|
|
265
269
|
}
|
|
266
270
|
return `${assemblyNameString}${refName}${startString}${endString}${rev}`;
|
|
267
271
|
}
|
|
268
|
-
exports.
|
|
272
|
+
exports.assembleLocStringFast = assembleLocStringFast;
|
|
269
273
|
function parseLocStringOneBased(locString, isValidRefName) {
|
|
270
274
|
if (!locString) {
|
|
271
275
|
throw new Error('no location string provided, could not parse');
|
|
@@ -647,9 +651,15 @@ function minmax(a, b) {
|
|
|
647
651
|
return [Math.min(a, b), Math.max(a, b)];
|
|
648
652
|
}
|
|
649
653
|
exports.minmax = minmax;
|
|
654
|
+
function shorten(name, max = 70, short = 30) {
|
|
655
|
+
return name.length > max
|
|
656
|
+
? name.slice(0, short) + '...' + name.slice(-short)
|
|
657
|
+
: name;
|
|
658
|
+
}
|
|
659
|
+
exports.shorten = shorten;
|
|
650
660
|
function stringify({ refName, coord, oob, }) {
|
|
651
661
|
return refName
|
|
652
|
-
? `${refName}:${coord
|
|
662
|
+
? `${shorten(refName)}:${toLocale(coord)}${oob ? ' (out of bounds)' : ''}`
|
|
653
663
|
: '';
|
|
654
664
|
}
|
|
655
665
|
exports.stringify = stringify;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { RemoteFile, PolyfilledResponse } from 'generic-filehandle';
|
|
3
|
-
interface BinaryRangeResponse {
|
|
3
|
+
export interface BinaryRangeResponse {
|
|
4
4
|
headers: Record<string, string>;
|
|
5
5
|
requestDate: Date;
|
|
6
6
|
responseDate: Date;
|
|
@@ -14,4 +14,3 @@ export declare class RemoteFileWithRangeCache extends RemoteFile {
|
|
|
14
14
|
signal?: AbortSignal;
|
|
15
15
|
}): Promise<BinaryRangeResponse>;
|
|
16
16
|
}
|
|
17
|
-
export {};
|
|
@@ -52,9 +52,9 @@ class RemoteFileWithRangeCache extends generic_filehandle_1.RemoteFile {
|
|
|
52
52
|
const [, start, end] = rangeParse;
|
|
53
53
|
const s = parseInt(start, 10);
|
|
54
54
|
const e = parseInt(end, 10);
|
|
55
|
-
const response = await globalRangeCache.getRange(url, s, e - s + 1, {
|
|
55
|
+
const response = (await globalRangeCache.getRange(url, s, e - s + 1, {
|
|
56
56
|
signal: init && init.signal,
|
|
57
|
-
});
|
|
57
|
+
}));
|
|
58
58
|
const { headers } = response;
|
|
59
59
|
return new Response(response.buffer, { status: 206, headers });
|
|
60
60
|
}
|
package/util/io/index.js
CHANGED
|
@@ -82,7 +82,7 @@ exports.getFetcher = getFetcher;
|
|
|
82
82
|
function getInternetAccount(location, pluginManager) {
|
|
83
83
|
const { rootModel } = pluginManager;
|
|
84
84
|
// If there is an appRootModel, use it to find the internetAccount
|
|
85
|
-
if (rootModel && (0, types_1.
|
|
85
|
+
if (rootModel && (0, types_1.isRootModelWithInternetAccounts)(rootModel)) {
|
|
86
86
|
return rootModel.findAppropriateInternetAccount(location);
|
|
87
87
|
}
|
|
88
88
|
// If there is no appRootModel, but there is pre-auth, create a temporary
|
|
@@ -103,10 +103,10 @@ function getInternetAccount(location, pluginManager) {
|
|
|
103
103
|
// "WWW-Authenticate: Basic" header. This is so downstream code can retry if
|
|
104
104
|
// needed with HTTP Basic authentication included
|
|
105
105
|
async function checkAuthNeededFetch(url, opts) {
|
|
106
|
+
var _a;
|
|
106
107
|
const response = await fetch(url, opts);
|
|
107
108
|
if (response.status === 401) {
|
|
108
|
-
|
|
109
|
-
if (authHeaders && authHeaders.includes('Basic')) {
|
|
109
|
+
if ((_a = response.headers.get('WWW-Authenticate')) === null || _a === void 0 ? void 0 : _a.includes('Basic')) {
|
|
110
110
|
throw new types_1.AuthNeededError('Accessing HTTPBasic resource without authentication', url.toString());
|
|
111
111
|
}
|
|
112
112
|
}
|
package/util/jexl.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export default class GranularRectLayout<T> implements BaseLayout<T> {
|
|
|
9
9
|
private maxHeight;
|
|
10
10
|
private displayMode;
|
|
11
11
|
private pTotalHeight;
|
|
12
|
+
/**
|
|
13
|
+
* pitchX - layout grid pitch in the X direction
|
|
14
|
+
* pitchY - layout grid pitch in the Y direction
|
|
15
|
+
* maxHeight - maximum layout height, default Infinity (no max)
|
|
16
|
+
*/
|
|
12
17
|
constructor({ pitchX, pitchY, maxHeight, hardRowLimit, displayMode, }?: {
|
|
13
18
|
pitchX?: number;
|
|
14
19
|
pitchY?: number;
|
|
@@ -33,9 +38,9 @@ export default class GranularRectLayout<T> implements BaseLayout<T> {
|
|
|
33
38
|
*/
|
|
34
39
|
discardRange(left: number, right: number): void;
|
|
35
40
|
hasSeen(id: string): boolean;
|
|
36
|
-
getByCoord(x: number, y: number): Record<string, T> |
|
|
41
|
+
getByCoord(x: number, y: number): string | Record<string, T> | undefined;
|
|
37
42
|
getByID(id: string): RectTuple | undefined;
|
|
38
|
-
getDataByID(id: string):
|
|
43
|
+
getDataByID(id: string): T | undefined;
|
|
39
44
|
cleanup(): void;
|
|
40
45
|
getTotalHeight(): number;
|
|
41
46
|
get totalHeight(): number;
|
|
@@ -18,66 +18,47 @@ class LayoutRow {
|
|
|
18
18
|
constructor() {
|
|
19
19
|
this.padding = 1;
|
|
20
20
|
this.widthLimit = 1000000;
|
|
21
|
-
// this.rowState.offset is the offset of the bits array relative to the genomic coordinates
|
|
22
|
-
// (modified by pitchX, but we don't know that in this class)
|
|
23
|
-
// this.rowState.bits is the array of items in the layout row, indexed by (x - this.offset)
|
|
24
|
-
// this.rowState.min is the leftmost edge of all the rectangles we have in the layout
|
|
25
|
-
// this.rowState.max is the rightmost edge of all the rectangles we have in the layout
|
|
26
21
|
}
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
22
|
+
// this.rowState.bits is the array of items in the layout row, indexed by (x - this.offset)
|
|
23
|
+
// this.rowState.min is the leftmost edge of all the rectangles we have in the layout
|
|
24
|
+
// this.rowState.max is the rightmost edge of all the rectangles we have in the layout
|
|
25
|
+
// this.rowState.offset is the offset of the bits array relative to the genomic coordinates
|
|
26
|
+
// (modified by pitchX, but we don't know that in this class)
|
|
32
27
|
setAllFilled(data) {
|
|
33
28
|
this.allFilled = data;
|
|
34
29
|
}
|
|
35
30
|
getItemAt(x) {
|
|
31
|
+
var _a;
|
|
36
32
|
if (this.allFilled) {
|
|
37
33
|
return this.allFilled;
|
|
38
34
|
}
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (this.rowState.min === undefined) {
|
|
35
|
+
if (((_a = this.rowState) === null || _a === void 0 ? void 0 : _a.min) === undefined ||
|
|
36
|
+
x < this.rowState.min ||
|
|
37
|
+
x >= this.rowState.max) {
|
|
43
38
|
return undefined;
|
|
44
39
|
}
|
|
45
|
-
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
if (x >= this.rowState.max) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
const offset = x - this.rowState.offset;
|
|
52
|
-
// if (offset < 0)
|
|
53
|
-
// debugger
|
|
54
|
-
// if (offset >= this.rowState.bits.length)
|
|
55
|
-
// debugger
|
|
56
|
-
return this.rowState.bits[offset];
|
|
40
|
+
return this.rowState.bits[x - this.rowState.offset];
|
|
57
41
|
}
|
|
58
42
|
isRangeClear(left, right) {
|
|
59
43
|
if (this.allFilled) {
|
|
60
44
|
return false;
|
|
61
45
|
}
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const { min, max } = this.rowState;
|
|
66
|
-
if (right <= min || left >= max) {
|
|
46
|
+
if (this.rowState === undefined ||
|
|
47
|
+
right <= this.rowState.min ||
|
|
48
|
+
left >= this.rowState.max) {
|
|
67
49
|
return true;
|
|
68
50
|
}
|
|
69
|
-
|
|
70
|
-
const maxX = Math.min(max, right);
|
|
71
|
-
let
|
|
72
|
-
for (
|
|
73
|
-
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
51
|
+
const { min, max, offset, bits } = this.rowState;
|
|
52
|
+
const maxX = Math.min(max, right) - offset;
|
|
53
|
+
let flag = true;
|
|
54
|
+
for (let x = Math.max(min, left) - offset; x < maxX && flag; x++) {
|
|
55
|
+
flag = bits[x] === undefined;
|
|
76
56
|
}
|
|
77
|
-
return
|
|
57
|
+
return flag;
|
|
78
58
|
}
|
|
59
|
+
// NOTE: this.rowState.min, this.rowState.max, and this.rowState.offset are
|
|
60
|
+
// interbase coordinates
|
|
79
61
|
initialize(left, right) {
|
|
80
|
-
// NOTE: this.rowState.min, this.rowState.max, and this.rowState.offset are interbase coordinates
|
|
81
62
|
const rectWidth = right - left;
|
|
82
63
|
return {
|
|
83
64
|
offset: left - rectWidth,
|
|
@@ -85,7 +66,6 @@ class LayoutRow {
|
|
|
85
66
|
max: right,
|
|
86
67
|
bits: new Array(3 * rectWidth),
|
|
87
68
|
};
|
|
88
|
-
// this.log(`initialize ${this.rowState.min} - ${this.rowState.max} (${this.rowState.bits.length})`)
|
|
89
69
|
}
|
|
90
70
|
addRect(rect, data) {
|
|
91
71
|
const left = rect.l;
|
|
@@ -220,8 +200,7 @@ class LayoutRow {
|
|
|
220
200
|
}
|
|
221
201
|
}
|
|
222
202
|
class GranularRectLayout {
|
|
223
|
-
|
|
224
|
-
*
|
|
203
|
+
/**
|
|
225
204
|
* pitchX - layout grid pitch in the X direction
|
|
226
205
|
* pitchY - layout grid pitch in the Y direction
|
|
227
206
|
* maxHeight - maximum layout height, default Infinity (no max)
|
|
@@ -296,7 +275,7 @@ class GranularRectLayout {
|
|
|
296
275
|
const maxY = top + rect.h;
|
|
297
276
|
for (let y = top; y < maxY; y += 1) {
|
|
298
277
|
const row = bitmap[y];
|
|
299
|
-
if (row && !row.isRangeClear(rect.l, rect.r)) {
|
|
278
|
+
if (row !== undefined && !row.isRangeClear(rect.l, rect.r)) {
|
|
300
279
|
return true;
|
|
301
280
|
}
|
|
302
281
|
}
|
|
@@ -370,7 +349,12 @@ class GranularRectLayout {
|
|
|
370
349
|
const r = this.rectangles.get(id);
|
|
371
350
|
if (r) {
|
|
372
351
|
const t = r.top * this.pitchY;
|
|
373
|
-
return [
|
|
352
|
+
return [
|
|
353
|
+
r.l * this.pitchX,
|
|
354
|
+
t,
|
|
355
|
+
r.r * this.pitchX,
|
|
356
|
+
t + r.originalHeight,
|
|
357
|
+
];
|
|
374
358
|
}
|
|
375
359
|
return undefined;
|
|
376
360
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BaseLayout, SerializedLayout } from './BaseLayout';
|
|
2
2
|
export default class MultiLayout<SUB_LAYOUT_CLASS extends BaseLayout<T>, T> {
|
|
3
3
|
SubLayoutClass: new (...args: any[]) => SUB_LAYOUT_CLASS;
|
|
4
|
-
subLayouts: Map<string, SUB_LAYOUT_CLASS>;
|
|
5
4
|
subLayoutConstructorArgs: Record<string, any>;
|
|
5
|
+
subLayouts: Map<string, SUB_LAYOUT_CLASS>;
|
|
6
6
|
/**
|
|
7
7
|
* layout class that just keeps a number of named sub-layouts.
|
|
8
8
|
* basically just a fancier
|
|
9
9
|
* `{ layout1: new GranularRectLayout(), layout2: new GranularRectLayout() ...}`
|
|
10
10
|
*/
|
|
11
|
-
constructor(SubLayoutClass: new (...args: any[]) => SUB_LAYOUT_CLASS,
|
|
11
|
+
constructor(SubLayoutClass: new (...args: any[]) => SUB_LAYOUT_CLASS, subLayoutConstructorArgs?: Record<string, any>);
|
|
12
12
|
getDataByID(id: string): unknown;
|
|
13
13
|
getSublayout(layoutName: string): SUB_LAYOUT_CLASS;
|
|
14
14
|
addRect(layoutName: string, id: string, left: number, right: number, height: number, data?: Record<string, T>): number | null;
|
|
@@ -6,12 +6,10 @@ class MultiLayout {
|
|
|
6
6
|
* basically just a fancier
|
|
7
7
|
* `{ layout1: new GranularRectLayout(), layout2: new GranularRectLayout() ...}`
|
|
8
8
|
*/
|
|
9
|
-
constructor(SubLayoutClass,
|
|
9
|
+
constructor(SubLayoutClass, subLayoutConstructorArgs = {}) {
|
|
10
10
|
this.SubLayoutClass = SubLayoutClass;
|
|
11
|
+
this.subLayoutConstructorArgs = subLayoutConstructorArgs;
|
|
11
12
|
this.subLayouts = new Map();
|
|
12
|
-
this.subLayoutConstructorArgs = {};
|
|
13
|
-
this.subLayouts = new Map();
|
|
14
|
-
this.subLayoutConstructorArgs = layoutArgs;
|
|
15
13
|
}
|
|
16
14
|
getDataByID(id) {
|
|
17
15
|
for (const layout of this.subLayouts.values()) {
|
|
@@ -36,8 +34,8 @@ class MultiLayout {
|
|
|
36
34
|
return this.getSublayout(layoutName).addRect(id, left, right, height, data);
|
|
37
35
|
}
|
|
38
36
|
discardRange(layoutName, left, right) {
|
|
39
|
-
|
|
40
|
-
return
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = this.subLayouts.get(layoutName)) === null || _a === void 0 ? void 0 : _a.discardRange(left, right);
|
|
41
39
|
}
|
|
42
40
|
toJSON() {
|
|
43
41
|
const data = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type AbstractCanvas = any;
|
|
2
|
+
type AbstractImageBitmap = any;
|
|
3
3
|
export declare let createCanvas: (width: number, height: number) => AbstractCanvas;
|
|
4
4
|
export declare let createImageBitmap: (canvas: AbstractCanvas) => Promise<AbstractImageBitmap>;
|
|
5
5
|
/** the JS class (constructor) for offscreen-generated image bitmap data */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export type RenderReturn = Record<string, unknown>;
|
|
3
3
|
export declare function renderToAbstractCanvas(width: number, height: number, opts: {
|
|
4
4
|
exportSVG?: {
|
|
5
5
|
rasterizeLayers?: boolean;
|
package/util/simpleFeature.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ export interface Feature {
|
|
|
31
31
|
* Get an array of child features, or undefined if none.
|
|
32
32
|
*/
|
|
33
33
|
children(): Feature[] | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Convert to JSON
|
|
36
|
+
*/
|
|
34
37
|
toJSON(): SimpleFeatureSerialized;
|
|
35
38
|
}
|
|
36
39
|
export declare function isFeature(thing: unknown): thing is Feature;
|
package/util/stats.d.ts
CHANGED
|
@@ -14,8 +14,34 @@ export interface FeatureStats extends UnrectifiedFeatureStats {
|
|
|
14
14
|
scoreMean: number;
|
|
15
15
|
scoreStdDev: number;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* calculate standard deviation using the 'shortcut method' that accepts
|
|
19
|
+
* the sum and the sum squares of the elements
|
|
20
|
+
*
|
|
21
|
+
* @param sum - sum(i, 1..n)
|
|
22
|
+
* @param sumSquares - sum(i^2, 1..n)
|
|
23
|
+
* @param n - number of elements
|
|
24
|
+
* @param population - boolean: use population instead of sample correction
|
|
25
|
+
* @returns - the estimated std deviation
|
|
26
|
+
*/
|
|
17
27
|
export declare function calcStdFromSums(sum: number, sumSquares: number, n: number, population?: boolean): number;
|
|
28
|
+
/**
|
|
29
|
+
* @param stats - a summary stats object with scoreSum, featureCount, scoreSumSquares, and basesCovered
|
|
30
|
+
* @returns - a summary stats object with scoreMean, scoreStdDev, and featureDensity added
|
|
31
|
+
*/
|
|
18
32
|
export declare function rectifyStats(s: UnrectifiedFeatureStats): FeatureStats;
|
|
33
|
+
/**
|
|
34
|
+
* calculates per-base scores for variable width features over a region
|
|
35
|
+
* @param region - object contains start, end
|
|
36
|
+
* @param features - list of features with start, end, score
|
|
37
|
+
* @returns array of numeric scores
|
|
38
|
+
*/
|
|
19
39
|
export declare function calcPerBaseStats(region: NoAssemblyRegion, features: Feature[]): number[];
|
|
40
|
+
/**
|
|
41
|
+
* transform a list of scores to summary statistics
|
|
42
|
+
* @param region - object with start, end
|
|
43
|
+
* @param features - array of features which are possibly summary features
|
|
44
|
+
* @returns - object with scoreMax, scoreMin, scoreSum, scoreSumSquares, etc
|
|
45
|
+
*/
|
|
20
46
|
export declare function scoresToStats(region: NoAssemblyRegion, features: Observable<Feature>): Promise<FeatureStats>;
|
|
21
47
|
export declare function blankStats(): FeatureStats;
|