@jbrowse/plugin-linear-genome-view 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -3
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +8 -43
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
- package/dist/BaseLinearDisplay/components/TooLargeMessage.d.ts +2 -2
- package/dist/BaseLinearDisplay/components/TooLargeMessage.js +4 -8
- package/dist/BaseLinearDisplay/components/TooLargeMessage.js.map +1 -1
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +13 -28
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +93 -137
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/dist/BaseLinearDisplay/models/util.d.ts +4 -0
- package/dist/BaseLinearDisplay/models/util.js +33 -1
- package/dist/BaseLinearDisplay/models/util.js.map +1 -1
- package/dist/LinearBareDisplay/index.js +1 -0
- package/dist/LinearBareDisplay/index.js.map +1 -1
- package/dist/LinearBareDisplay/model.d.ts +11 -19
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +2 -5
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
- package/dist/LinearBasicDisplay/index.js +1 -1
- package/dist/LinearBasicDisplay/model.d.ts +14 -35
- package/dist/LinearBasicDisplay/model.js.map +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +11 -17
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/dist/index.d.ts +33 -57
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -3
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +8 -20
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
- package/esm/BaseLinearDisplay/components/TooLargeMessage.d.ts +2 -2
- package/esm/BaseLinearDisplay/components/TooLargeMessage.js +4 -8
- package/esm/BaseLinearDisplay/components/TooLargeMessage.js.map +1 -1
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +13 -28
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +92 -136
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/esm/BaseLinearDisplay/models/util.d.ts +4 -0
- package/esm/BaseLinearDisplay/models/util.js +30 -0
- package/esm/BaseLinearDisplay/models/util.js.map +1 -1
- package/esm/LinearBareDisplay/index.js +1 -0
- package/esm/LinearBareDisplay/index.js.map +1 -1
- package/esm/LinearBareDisplay/model.d.ts +11 -19
- package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -1
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js +2 -5
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
- package/esm/LinearBasicDisplay/index.js +1 -1
- package/esm/LinearBasicDisplay/model.d.ts +14 -35
- package/esm/LinearBasicDisplay/model.js.map +1 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +11 -17
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/esm/index.d.ts +33 -57
- package/package.json +2 -2
- package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +8 -28
- package/src/BaseLinearDisplay/components/TooLargeMessage.tsx +8 -10
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +130 -189
- package/src/BaseLinearDisplay/models/util.ts +37 -0
- package/src/LinearBareDisplay/index.ts +1 -0
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +3 -7
- package/src/LinearBasicDisplay/index.ts +1 -1
- package/src/LinearBasicDisplay/model.ts +1 -1
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +16 -18
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseLinearDisplayModel } from '../models/BaseLinearDisplayModel';
|
|
3
3
|
declare const useStyles: (params: void, styleOverrides?: {
|
|
4
|
-
props:
|
|
5
|
-
classes?: Record<string, string> | undefined;
|
|
6
|
-
} & Record<string, unknown>;
|
|
4
|
+
props: any;
|
|
7
5
|
ownerState?: Record<string, unknown> | undefined;
|
|
8
6
|
} | undefined) => {
|
|
9
7
|
classes: Record<"linearBlocks" | "heightOverflowed", string>;
|
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 =
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
30
7
|
const mui_1 = require("tss-react/mui");
|
|
31
8
|
const mobx_react_1 = require("mobx-react");
|
|
32
9
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
@@ -48,40 +25,28 @@ const useStyles = (0, mui_1.makeStyles)()(theme => {
|
|
|
48
25
|
});
|
|
49
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
27
|
const LoadingMessage = (0, mobx_react_1.observer)(({ model }) => {
|
|
51
|
-
// only show the loading message after 300ms to prevent excessive flickering
|
|
52
|
-
const [shown, setShown] = (0, react_1.useState)(false);
|
|
53
28
|
const { classes } = useStyles();
|
|
54
|
-
(0, react_1.useEffect)(() => {
|
|
55
|
-
let killed = false;
|
|
56
|
-
const timeout = setTimeout(() => {
|
|
57
|
-
if (!killed) {
|
|
58
|
-
setShown(true);
|
|
59
|
-
}
|
|
60
|
-
}, 300);
|
|
61
|
-
return () => {
|
|
62
|
-
clearTimeout(timeout);
|
|
63
|
-
killed = true;
|
|
64
|
-
};
|
|
65
|
-
}, []);
|
|
66
29
|
const { status: blockStatus } = model;
|
|
67
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
31
|
const { message: displayStatus } = (0, mobx_state_tree_1.getParent)(model, 2);
|
|
69
32
|
const status = displayStatus || blockStatus;
|
|
70
|
-
return (react_1.default.createElement(
|
|
71
|
-
react_1.default.createElement(ui_1.LoadingEllipses, { message: status })))
|
|
33
|
+
return (react_1.default.createElement("div", { className: classes.loading },
|
|
34
|
+
react_1.default.createElement(ui_1.LoadingEllipses, { message: status })));
|
|
72
35
|
});
|
|
73
36
|
const ServerSideRenderedBlockContent = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
74
37
|
if (model.error) {
|
|
75
38
|
return (react_1.default.createElement(BlockMsg_1.default, { message: `${model.error}`, severity: "error", buttonText: "reload", icon: react_1.default.createElement(Refresh_1.default, null), action: model.reload }));
|
|
76
39
|
}
|
|
77
|
-
if (model.message) {
|
|
40
|
+
else if (model.message) {
|
|
78
41
|
// the message can be a fully rendered react component, e.g. the region too large message
|
|
79
42
|
return react_1.default.isValidElement(model.message) ? (model.message) : (react_1.default.createElement(BlockMsg_1.default, { message: `${model.message}`, severity: "info" }));
|
|
80
43
|
}
|
|
81
|
-
if (!model.filled) {
|
|
44
|
+
else if (!model.filled) {
|
|
82
45
|
return react_1.default.createElement(LoadingMessage, { model: model });
|
|
83
46
|
}
|
|
84
|
-
|
|
47
|
+
else {
|
|
48
|
+
return model.reactElement;
|
|
49
|
+
}
|
|
85
50
|
});
|
|
86
51
|
exports.default = ServerSideRenderedBlockContent;
|
|
87
52
|
//# sourceMappingURL=ServerSideRenderedBlockContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerSideRenderedBlockContent.js","sourceRoot":"","sources":["../../../src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerSideRenderedBlockContent.js","sourceRoot":"","sources":["../../../src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,uCAA0C;AAC1C,2CAAqC;AACrC,qDAA2C;AAC3C,yCAAkD;AAElD,QAAQ;AACR,0EAAqD;AAErD,SAAS;AACT,0DAAiC;AAEjC,MAAM,SAAS,GAAG,IAAA,gBAAU,GAAE,CAAC,KAAK,CAAC,EAAE;IACrC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAA;IAClD,OAAO;QACL,OAAO,EAAE;YACP,WAAW,EAAE,OAAO;YACpB,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO;YACjD,eAAe,EAAE,kEAAkE,EAAE,SAAS,EAAE,QAAQ;YACxG,SAAS,EAAE,QAAQ;SACpB;KACF,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,8DAA8D;AAC9D,MAAM,cAAc,GAAG,IAAA,qBAAQ,EAAC,CAAC,EAAE,KAAK,EAAkB,EAAE,EAAE;IAC5D,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAA;IACrC,8DAA8D;IAC9D,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,IAAA,2BAAS,EAAM,KAAK,EAAE,CAAC,CAAC,CAAA;IAC3D,MAAM,MAAM,GAAG,aAAa,IAAI,WAAW,CAAA;IAC3C,OAAO,CACL,uCAAK,SAAS,EAAE,OAAO,CAAC,OAAO;QAC7B,8BAAC,oBAAe,IAAC,OAAO,EAAE,MAAM,GAAI,CAChC,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,8BAA8B,GAAG,IAAA,qBAAQ,EAAC,UAAU,EACxD,KAAK,GAIN;IACC,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,CACL,8BAAC,kBAAQ,IACP,OAAO,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,EACzB,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,QAAQ,EACnB,IAAI,EAAE,8BAAC,iBAAW,OAAG,EACrB,MAAM,EAAE,KAAK,CAAC,MAAM,GACpB,CACH,CAAA;KACF;SAAM,IAAI,KAAK,CAAC,OAAO,EAAE;QACxB,yFAAyF;QACzF,OAAO,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAC3C,KAAK,CAAC,OAAO,CACd,CAAC,CAAC,CAAC,CACF,8BAAC,kBAAQ,IAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAC,MAAM,GAAG,CAC1D,CAAA;KACF;SAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QACxB,OAAO,8BAAC,cAAc,IAAC,KAAK,EAAE,KAAK,GAAI,CAAA;KACxC;SAAM;QACL,OAAO,KAAK,CAAC,YAAY,CAAA;KAC1B;AACH,CAAC,CAAC,CAAA;AAEF,kBAAe,8BAA8B,CAAA"}
|
|
@@ -3,8 +3,8 @@ import { Stats } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
|
3
3
|
declare function TooLargeMessage({ model, }: {
|
|
4
4
|
model: {
|
|
5
5
|
regionTooLargeReason: string;
|
|
6
|
-
|
|
7
|
-
updateStatsLimit: (s
|
|
6
|
+
estimatedRegionsStats?: Stats;
|
|
7
|
+
updateStatsLimit: (s?: Stats) => void;
|
|
8
8
|
reload: () => void;
|
|
9
9
|
};
|
|
10
10
|
}): JSX.Element;
|
|
@@ -4,18 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
+
// locals
|
|
7
8
|
const BlockMsg_1 = __importDefault(require("../components/BlockMsg"));
|
|
8
9
|
function TooLargeMessage({ model, }) {
|
|
9
10
|
const { regionTooLargeReason } = model;
|
|
10
11
|
return (react_1.default.createElement(BlockMsg_1.default, { severity: "warning", action: () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
else {
|
|
15
|
-
model.updateStatsLimit(model.estimatedRegionStats);
|
|
16
|
-
model.reload();
|
|
17
|
-
}
|
|
18
|
-
}, buttonText: "Force load", message: `${regionTooLargeReason ? regionTooLargeReason + '. ' : ''}
|
|
12
|
+
model.updateStatsLimit(model.estimatedRegionsStats);
|
|
13
|
+
model.reload();
|
|
14
|
+
}, buttonText: "Force load", message: `${regionTooLargeReason ? `${regionTooLargeReason}. ` : ''}
|
|
19
15
|
Zoom in to see features or force load (may be slow).` }));
|
|
20
16
|
}
|
|
21
17
|
exports.default = TooLargeMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooLargeMessage.js","sourceRoot":"","sources":["../../../src/BaseLinearDisplay/components/TooLargeMessage.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;
|
|
1
|
+
{"version":3,"file":"TooLargeMessage.js","sourceRoot":"","sources":["../../../src/BaseLinearDisplay/components/TooLargeMessage.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAGzB,SAAS;AACT,sEAA6C;AAE7C,SAAS,eAAe,CAAC,EACvB,KAAK,GAQN;IACC,MAAM,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAA;IACtC,OAAO,CACL,8BAAC,kBAAQ,IACP,QAAQ,EAAC,SAAS,EAClB,MAAM,EAAE,GAAG,EAAE;YACX,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;YACnD,KAAK,CAAC,MAAM,EAAE,CAAA;QAChB,CAAC,EACD,UAAU,EAAC,YAAY,EACvB,OAAO,EAAE,GAAG,oBAAoB,CAAC,CAAC,CAAC,GAAG,oBAAoB,IAAI,CAAC,CAAC,CAAC,EAAE;2DACd,GACrD,CACH,CAAA;AACH,CAAC;AAED,kBAAe,eAAe,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ThemeOptions } from '@mui/material';
|
|
2
3
|
import { MenuItem } from '@jbrowse/core/ui';
|
|
3
4
|
import { Feature } from '@jbrowse/core/util';
|
|
4
5
|
import { Stats } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
@@ -7,7 +8,6 @@ import { Region } from '@jbrowse/core/util/types';
|
|
|
7
8
|
import CompositeMap from '@jbrowse/core/util/compositeMap';
|
|
8
9
|
import { Instance } from 'mobx-state-tree';
|
|
9
10
|
import { ExportSvgOptions } from '../../LinearGenomeView';
|
|
10
|
-
import { ThemeOptions } from '@mui/material';
|
|
11
11
|
export interface Layout {
|
|
12
12
|
minX: number;
|
|
13
13
|
minY: number;
|
|
@@ -117,9 +117,7 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
117
117
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
118
118
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
119
119
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
120
|
-
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
121
|
-
* #property
|
|
122
|
-
*/
|
|
120
|
+
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
123
121
|
}, {
|
|
124
122
|
rendererTypeName: string;
|
|
125
123
|
error: unknown;
|
|
@@ -136,11 +134,6 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
136
134
|
} & {
|
|
137
135
|
setError(error?: unknown): void;
|
|
138
136
|
setRpcDriverName(rpcDriverName: string): void;
|
|
139
|
-
/**
|
|
140
|
-
* #getter
|
|
141
|
-
* returns a string feature ID if the globally-selected object
|
|
142
|
-
* is probably a feature
|
|
143
|
-
*/
|
|
144
137
|
reload(): void;
|
|
145
138
|
} & {
|
|
146
139
|
currBpPerPx: number;
|
|
@@ -148,8 +141,8 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
148
141
|
message: string;
|
|
149
142
|
featureIdUnderMouse: string | undefined;
|
|
150
143
|
contextMenuFeature: Feature | undefined;
|
|
151
|
-
|
|
152
|
-
|
|
144
|
+
estimatedRegionsStatsP: Promise<Stats> | undefined;
|
|
145
|
+
estimatedRegionsStats: Stats | undefined;
|
|
153
146
|
} & {
|
|
154
147
|
readonly height: number;
|
|
155
148
|
/**
|
|
@@ -197,7 +190,7 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
197
190
|
/**
|
|
198
191
|
* #getter
|
|
199
192
|
*/
|
|
200
|
-
getFeatureOverlapping(blockKey: string, x: number, y: number):
|
|
193
|
+
getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
|
|
201
194
|
/**
|
|
202
195
|
* #getter
|
|
203
196
|
*/
|
|
@@ -231,27 +224,24 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
231
224
|
* #action
|
|
232
225
|
*/
|
|
233
226
|
setMessage(message: string): void;
|
|
227
|
+
} & {
|
|
234
228
|
afterAttach(): void;
|
|
235
229
|
/**
|
|
236
230
|
* #action
|
|
237
231
|
*/
|
|
238
|
-
estimateRegionsStats(
|
|
239
|
-
headers?: Record<string, string>;
|
|
240
|
-
signal?: AbortSignal;
|
|
241
|
-
filters?: string[];
|
|
242
|
-
}): Promise<{}>;
|
|
232
|
+
estimateRegionsStats(): Promise<Stats>;
|
|
243
233
|
/**
|
|
244
234
|
* #action
|
|
245
235
|
*/
|
|
246
|
-
|
|
236
|
+
setRegionsStatsP(arg: any): void;
|
|
247
237
|
/**
|
|
248
238
|
* #action
|
|
249
239
|
*/
|
|
250
|
-
|
|
240
|
+
setRegionsStats(estimatedRegionsStats?: Stats): void;
|
|
251
241
|
/**
|
|
252
242
|
* #action
|
|
253
243
|
*/
|
|
254
|
-
|
|
244
|
+
clearRegionsStats(): void;
|
|
255
245
|
/**
|
|
256
246
|
* #action
|
|
257
247
|
*/
|
|
@@ -267,7 +257,7 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
267
257
|
/**
|
|
268
258
|
* #action
|
|
269
259
|
*/
|
|
270
|
-
updateStatsLimit(stats
|
|
260
|
+
updateStatsLimit(stats?: Stats): void;
|
|
271
261
|
/**
|
|
272
262
|
* #action
|
|
273
263
|
*/
|
|
@@ -320,6 +310,7 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
320
310
|
* #action
|
|
321
311
|
*/
|
|
322
312
|
reload(): Promise<void>;
|
|
313
|
+
} & {
|
|
323
314
|
afterAttach(): void;
|
|
324
315
|
} & {
|
|
325
316
|
/**
|
|
@@ -342,13 +333,7 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
342
333
|
/**
|
|
343
334
|
* #method
|
|
344
335
|
*/
|
|
345
|
-
contextMenuItems():
|
|
346
|
-
label: string;
|
|
347
|
-
icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
348
|
-
muiName: string;
|
|
349
|
-
};
|
|
350
|
-
onClick: () => void;
|
|
351
|
-
}[];
|
|
336
|
+
contextMenuItems(): MenuItem[];
|
|
352
337
|
/**
|
|
353
338
|
* #method
|
|
354
339
|
*/
|
|
@@ -41,24 +41,7 @@ const MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
|
|
|
41
41
|
const BaseLinearDisplay_1 = require("../components/BaseLinearDisplay");
|
|
42
42
|
const TooLargeMessage_1 = __importDefault(require("../components/TooLargeMessage"));
|
|
43
43
|
const serverSideRenderedBlock_1 = __importStar(require("./serverSideRenderedBlock"));
|
|
44
|
-
|
|
45
|
-
function getId(id, index) {
|
|
46
|
-
const isJest = typeof jest === 'undefined';
|
|
47
|
-
return `clip-${isJest ? id : 'jest'}-${index}`;
|
|
48
|
-
}
|
|
49
|
-
function getDisplayStr(totalBytes) {
|
|
50
|
-
let displayBp;
|
|
51
|
-
if (Math.floor(totalBytes / 1000000) > 0) {
|
|
52
|
-
displayBp = `${Number.parseFloat((totalBytes / 1000000).toPrecision(3))} Mb`;
|
|
53
|
-
}
|
|
54
|
-
else if (Math.floor(totalBytes / 1000) > 0) {
|
|
55
|
-
displayBp = `${Number.parseFloat((totalBytes / 1000).toPrecision(3))} Kb`;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
displayBp = `${Math.floor(totalBytes)} bytes`;
|
|
59
|
-
}
|
|
60
|
-
return displayBp;
|
|
61
|
-
}
|
|
44
|
+
const util_2 = require("./util");
|
|
62
45
|
const minDisplayHeight = 20;
|
|
63
46
|
/**
|
|
64
47
|
* #stateModel BaseLinearDisplay
|
|
@@ -91,8 +74,8 @@ function stateModelFactory() {
|
|
|
91
74
|
message: '',
|
|
92
75
|
featureIdUnderMouse: undefined,
|
|
93
76
|
contextMenuFeature: undefined,
|
|
94
|
-
|
|
95
|
-
|
|
77
|
+
estimatedRegionsStatsP: undefined,
|
|
78
|
+
estimatedRegionsStats: undefined,
|
|
96
79
|
}))
|
|
97
80
|
.views(self => ({
|
|
98
81
|
get height() {
|
|
@@ -165,7 +148,7 @@ function stateModelFactory() {
|
|
|
165
148
|
get features() {
|
|
166
149
|
const featureMaps = [];
|
|
167
150
|
for (const block of self.blockState.values()) {
|
|
168
|
-
if (block
|
|
151
|
+
if (block === null || block === void 0 ? void 0 : block.features) {
|
|
169
152
|
featureMaps.push(block.features);
|
|
170
153
|
}
|
|
171
154
|
}
|
|
@@ -211,7 +194,7 @@ function stateModelFactory() {
|
|
|
211
194
|
*/
|
|
212
195
|
get currentBytesRequested() {
|
|
213
196
|
var _a;
|
|
214
|
-
return ((_a = self.
|
|
197
|
+
return ((_a = self.estimatedRegionsStats) === null || _a === void 0 ? void 0 : _a.bytes) || 0;
|
|
215
198
|
},
|
|
216
199
|
/**
|
|
217
200
|
* #getter
|
|
@@ -219,7 +202,7 @@ function stateModelFactory() {
|
|
|
219
202
|
get currentFeatureScreenDensity() {
|
|
220
203
|
var _a;
|
|
221
204
|
const view = (0, util_1.getContainingView)(self);
|
|
222
|
-
return (((_a = self.
|
|
205
|
+
return (((_a = self.estimatedRegionsStats) === null || _a === void 0 ? void 0 : _a.featureDensity) || 0) * view.bpPerPx;
|
|
223
206
|
},
|
|
224
207
|
/**
|
|
225
208
|
* #getter
|
|
@@ -231,7 +214,7 @@ function stateModelFactory() {
|
|
|
231
214
|
* #getter
|
|
232
215
|
*/
|
|
233
216
|
get estimatedStatsReady() {
|
|
234
|
-
return !!self.
|
|
217
|
+
return !!self.estimatedRegionsStats || !!self.userBpPerPxLimit;
|
|
235
218
|
},
|
|
236
219
|
/**
|
|
237
220
|
* #getter
|
|
@@ -239,7 +222,7 @@ function stateModelFactory() {
|
|
|
239
222
|
get maxAllowableBytes() {
|
|
240
223
|
var _a;
|
|
241
224
|
return (self.userByteSizeLimit ||
|
|
242
|
-
((_a = self.
|
|
225
|
+
((_a = self.estimatedRegionsStats) === null || _a === void 0 ? void 0 : _a.fetchSizeLimit) ||
|
|
243
226
|
(0, configuration_1.getConf)(self, 'fetchSizeLimit'));
|
|
244
227
|
},
|
|
245
228
|
}))
|
|
@@ -250,11 +233,13 @@ function stateModelFactory() {
|
|
|
250
233
|
setMessage(message) {
|
|
251
234
|
self.message = message;
|
|
252
235
|
},
|
|
236
|
+
}))
|
|
237
|
+
.actions(self => ({
|
|
253
238
|
afterAttach() {
|
|
254
239
|
// watch the parent's blocks to update our block state when they change,
|
|
255
240
|
// then we recreate the blocks on our own model (creating and deleting to
|
|
256
241
|
// match the parent blocks)
|
|
257
|
-
|
|
242
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
258
243
|
const blocksPresent = {};
|
|
259
244
|
const view = (0, util_1.getContainingView)(self);
|
|
260
245
|
if (view.initialized) {
|
|
@@ -270,61 +255,38 @@ function stateModelFactory() {
|
|
|
270
255
|
}
|
|
271
256
|
});
|
|
272
257
|
}
|
|
273
|
-
});
|
|
274
|
-
(0, mobx_state_tree_1.addDisposer)(self, blockWatchDisposer);
|
|
258
|
+
}));
|
|
275
259
|
},
|
|
276
260
|
/**
|
|
277
261
|
* #action
|
|
278
262
|
*/
|
|
279
|
-
estimateRegionsStats(
|
|
280
|
-
if (self.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (!adapterConfig) {
|
|
286
|
-
// A track extending the base track might not have an adapter config
|
|
287
|
-
// e.g. Apollo tracks don't use adapters
|
|
288
|
-
return Promise.resolve({});
|
|
263
|
+
async estimateRegionsStats() {
|
|
264
|
+
if (!self.estimatedRegionsStatsP) {
|
|
265
|
+
self.estimatedRegionsStatsP = (0, util_2.estimateRegionsStatsPre)(self).catch(e => {
|
|
266
|
+
this.setRegionsStatsP(undefined);
|
|
267
|
+
throw e;
|
|
268
|
+
});
|
|
289
269
|
}
|
|
290
|
-
|
|
291
|
-
const params = {
|
|
292
|
-
sessionId,
|
|
293
|
-
regions,
|
|
294
|
-
adapterConfig,
|
|
295
|
-
statusCallback: (message) => {
|
|
296
|
-
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
297
|
-
this.setMessage(message);
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
...opts,
|
|
301
|
-
};
|
|
302
|
-
self.estimatedRegionStatsP = rpcManager
|
|
303
|
-
.call(sessionId, 'CoreEstimateRegionStats', params)
|
|
304
|
-
.catch(e => {
|
|
305
|
-
this.setRegionStatsP(undefined);
|
|
306
|
-
throw e;
|
|
307
|
-
});
|
|
308
|
-
return self.estimatedRegionStatsP;
|
|
270
|
+
return self.estimatedRegionsStatsP;
|
|
309
271
|
},
|
|
310
272
|
/**
|
|
311
273
|
* #action
|
|
312
274
|
*/
|
|
313
|
-
|
|
314
|
-
self.
|
|
275
|
+
setRegionsStatsP(arg) {
|
|
276
|
+
self.estimatedRegionsStatsP = arg;
|
|
315
277
|
},
|
|
316
278
|
/**
|
|
317
279
|
* #action
|
|
318
280
|
*/
|
|
319
|
-
|
|
320
|
-
self.
|
|
281
|
+
setRegionsStats(estimatedRegionsStats) {
|
|
282
|
+
self.estimatedRegionsStats = estimatedRegionsStats;
|
|
321
283
|
},
|
|
322
284
|
/**
|
|
323
285
|
* #action
|
|
324
286
|
*/
|
|
325
|
-
|
|
326
|
-
self.
|
|
327
|
-
self.
|
|
287
|
+
clearRegionsStats() {
|
|
288
|
+
self.estimatedRegionsStatsP = undefined;
|
|
289
|
+
self.estimatedRegionsStats = undefined;
|
|
328
290
|
},
|
|
329
291
|
/**
|
|
330
292
|
* #action
|
|
@@ -353,7 +315,7 @@ function stateModelFactory() {
|
|
|
353
315
|
*/
|
|
354
316
|
updateStatsLimit(stats) {
|
|
355
317
|
const view = (0, util_1.getContainingView)(self);
|
|
356
|
-
if (stats.bytes) {
|
|
318
|
+
if (stats === null || stats === void 0 ? void 0 : stats.bytes) {
|
|
357
319
|
self.userByteSizeLimit = stats.bytes;
|
|
358
320
|
}
|
|
359
321
|
else {
|
|
@@ -438,11 +400,10 @@ function stateModelFactory() {
|
|
|
438
400
|
if (!self.estimatedStatsReady || view.dynamicBlocks.totalBp < 20000) {
|
|
439
401
|
return false;
|
|
440
402
|
}
|
|
441
|
-
const bpLimitOrDensity = self.userBpPerPxLimit
|
|
442
|
-
? view.bpPerPx > self.userBpPerPxLimit
|
|
443
|
-
: self.currentFeatureScreenDensity > self.maxFeatureScreenDensity;
|
|
444
403
|
return (self.currentBytesRequested > self.maxAllowableBytes ||
|
|
445
|
-
|
|
404
|
+
(self.userBpPerPxLimit
|
|
405
|
+
? view.bpPerPx > self.userBpPerPxLimit
|
|
406
|
+
: self.currentFeatureScreenDensity > self.maxFeatureScreenDensity));
|
|
446
407
|
},
|
|
447
408
|
/**
|
|
448
409
|
* #getter
|
|
@@ -453,7 +414,7 @@ function stateModelFactory() {
|
|
|
453
414
|
const req = self.currentBytesRequested;
|
|
454
415
|
const max = self.maxAllowableBytes;
|
|
455
416
|
return req && req > max
|
|
456
|
-
? `Requested too much data (${getDisplayStr(req)})`
|
|
417
|
+
? `Requested too much data (${(0, util_2.getDisplayStr)(req)})`
|
|
457
418
|
: '';
|
|
458
419
|
},
|
|
459
420
|
}))
|
|
@@ -465,7 +426,6 @@ function stateModelFactory() {
|
|
|
465
426
|
*/
|
|
466
427
|
async reload() {
|
|
467
428
|
self.setError();
|
|
468
|
-
const aborter = new AbortController();
|
|
469
429
|
const view = (0, util_1.getContainingView)(self);
|
|
470
430
|
// extra check for contentBlocks.length
|
|
471
431
|
// https://github.com/GMOD/jbrowse-components/issues/2694
|
|
@@ -473,68 +433,63 @@ function stateModelFactory() {
|
|
|
473
433
|
return;
|
|
474
434
|
}
|
|
475
435
|
try {
|
|
476
|
-
|
|
477
|
-
const estimatedRegionStats = await self.estimatedRegionStatsP;
|
|
436
|
+
const estimatedRegionsStats = await self.estimateRegionsStats();
|
|
478
437
|
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
479
|
-
self.
|
|
438
|
+
self.setRegionsStats(estimatedRegionsStats);
|
|
480
439
|
superReload();
|
|
481
440
|
}
|
|
482
|
-
else {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
441
|
}
|
|
486
442
|
catch (e) {
|
|
487
443
|
console.error(e);
|
|
488
444
|
self.setError(e);
|
|
489
445
|
}
|
|
490
446
|
},
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
// we estimate stats once at a given zoom level
|
|
516
|
-
if (view.bpPerPx === self.currBpPerPx) {
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
self.clearRegionStats();
|
|
447
|
+
};
|
|
448
|
+
})
|
|
449
|
+
.actions(self => ({
|
|
450
|
+
afterAttach() {
|
|
451
|
+
// this autorun performs stats estimation
|
|
452
|
+
//
|
|
453
|
+
// the chain of events calls estimateRegionsStats against the data
|
|
454
|
+
// adapter which by default uses featureDensity, but can also respond
|
|
455
|
+
// with a byte size estimate and fetch size limit (data adapter can
|
|
456
|
+
// define what is too much data)
|
|
457
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
|
|
458
|
+
var _a;
|
|
459
|
+
try {
|
|
460
|
+
const view = (0, util_1.getContainingView)(self);
|
|
461
|
+
// extra check for contentBlocks.length
|
|
462
|
+
// https://github.com/GMOD/jbrowse-components/issues/2694
|
|
463
|
+
if (!view.initialized ||
|
|
464
|
+
!view.staticBlocks.contentBlocks.length) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
// don't re-estimate featureDensity even if zoom level changes,
|
|
468
|
+
// jbrowse1-style assume it's sort of representative
|
|
469
|
+
if (((_a = self.estimatedRegionsStats) === null || _a === void 0 ? void 0 : _a.featureDensity) !== undefined) {
|
|
520
470
|
self.setCurrBpPerPx(view.bpPerPx);
|
|
521
|
-
|
|
522
|
-
self.setRegionStatsP(statsP);
|
|
523
|
-
const estimatedRegionStats = await statsP;
|
|
524
|
-
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
525
|
-
self.setRegionStats(estimatedRegionStats);
|
|
526
|
-
}
|
|
471
|
+
return;
|
|
527
472
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
self.setError(e);
|
|
532
|
-
}
|
|
473
|
+
// we estimate stats once at a given zoom level
|
|
474
|
+
if (view.bpPerPx === self.currBpPerPx) {
|
|
475
|
+
return;
|
|
533
476
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
477
|
+
self.clearRegionsStats();
|
|
478
|
+
self.setCurrBpPerPx(view.bpPerPx);
|
|
479
|
+
const estimatedRegionsStats = await self.estimateRegionsStats();
|
|
480
|
+
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
481
|
+
self.setRegionsStats(estimatedRegionsStats);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
catch (e) {
|
|
485
|
+
if (!(0, util_1.isAbortException)(e) && (0, mobx_state_tree_1.isAlive)(self)) {
|
|
486
|
+
console.error(e);
|
|
487
|
+
self.setError(e);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}));
|
|
491
|
+
},
|
|
492
|
+
}))
|
|
538
493
|
.views(self => ({
|
|
539
494
|
/**
|
|
540
495
|
* #method
|
|
@@ -551,8 +506,7 @@ function stateModelFactory() {
|
|
|
551
506
|
* react node allows user to force load at current setting
|
|
552
507
|
*/
|
|
553
508
|
regionCannotBeRendered(_region) {
|
|
554
|
-
|
|
555
|
-
return regionTooLarge ? react_1.default.createElement(TooLargeMessage_1.default, { model: self }) : null;
|
|
509
|
+
return self.regionTooLarge ? react_1.default.createElement(TooLargeMessage_1.default, { model: self }) : null;
|
|
556
510
|
},
|
|
557
511
|
/**
|
|
558
512
|
* #method
|
|
@@ -564,19 +518,21 @@ function stateModelFactory() {
|
|
|
564
518
|
* #method
|
|
565
519
|
*/
|
|
566
520
|
contextMenuItems() {
|
|
567
|
-
return
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
521
|
+
return [
|
|
522
|
+
...(self.contextMenuFeature
|
|
523
|
+
? [
|
|
524
|
+
{
|
|
525
|
+
label: 'Open feature details',
|
|
526
|
+
icon: MenuOpen_1.default,
|
|
527
|
+
onClick: () => {
|
|
528
|
+
if (self.contextMenuFeature) {
|
|
529
|
+
self.selectFeature(self.contextMenuFeature);
|
|
530
|
+
}
|
|
531
|
+
},
|
|
576
532
|
},
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
533
|
+
]
|
|
534
|
+
: []),
|
|
535
|
+
];
|
|
580
536
|
},
|
|
581
537
|
/**
|
|
582
538
|
* #method
|
|
@@ -585,7 +541,7 @@ function stateModelFactory() {
|
|
|
585
541
|
const view = (0, util_1.getContainingView)(self);
|
|
586
542
|
return {
|
|
587
543
|
...(0, tracks_1.getParentRenderProps)(self),
|
|
588
|
-
notReady: self.currBpPerPx !== view.bpPerPx || !self.
|
|
544
|
+
notReady: self.currBpPerPx !== view.bpPerPx || !self.estimatedRegionsStats,
|
|
589
545
|
rpcDriverName: self.rpcDriverName,
|
|
590
546
|
displayModel: self,
|
|
591
547
|
onFeatureClick(_, featureId) {
|
|
@@ -670,7 +626,7 @@ function stateModelFactory() {
|
|
|
670
626
|
return (react_1.default.createElement(react_1.default.Fragment, null, renderings.map(([block, rendering], index) => {
|
|
671
627
|
const { offsetPx, widthPx } = block;
|
|
672
628
|
const offset = offsetPx - viewOffsetPx;
|
|
673
|
-
const clipid = getId(id, index);
|
|
629
|
+
const clipid = (0, util_2.getId)(id, index);
|
|
674
630
|
return (react_1.default.createElement(react_1.default.Fragment, { key: `frag-${index}` },
|
|
675
631
|
react_1.default.createElement("defs", null,
|
|
676
632
|
react_1.default.createElement("clipPath", { id: clipid },
|