@jbrowse/plugin-linear-comparative-view 2.16.0 → 2.16.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/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +2 -1
- package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +4 -2
- package/dist/LGVSyntenyDisplay/components/util.d.ts +4 -1
- package/dist/LGVSyntenyDisplay/components/util.js +7 -15
- package/dist/LGVSyntenyDisplay/model.d.ts +26 -14
- package/dist/LGVSyntenyDisplay/model.js +23 -1
- package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +28 -5
- package/dist/LinearComparativeDisplay/stateModelFactory.js +14 -3
- package/dist/LinearSyntenyDisplay/afterAttach.js +2 -3
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +22 -15
- package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +2 -4
- package/dist/LinearSyntenyDisplay/components/util.d.ts +5 -1
- package/dist/LinearSyntenyDisplay/components/util.js +7 -9
- package/dist/LinearSyntenyDisplay/drawSynteny.js +7 -9
- package/dist/LinearSyntenyDisplay/model.d.ts +48 -11
- package/dist/LinearSyntenyDisplay/model.js +38 -22
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +14 -0
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +100 -0
- package/dist/SyntenyFeatureDetail/index.d.ts +2 -0
- package/dist/SyntenyFeatureDetail/index.js +56 -0
- package/dist/index.js +2 -0
- package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +2 -1
- package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +4 -2
- package/esm/LGVSyntenyDisplay/components/util.d.ts +4 -1
- package/esm/LGVSyntenyDisplay/components/util.js +8 -16
- package/esm/LGVSyntenyDisplay/model.d.ts +26 -14
- package/esm/LGVSyntenyDisplay/model.js +25 -3
- package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +28 -5
- package/esm/LinearComparativeDisplay/stateModelFactory.js +14 -3
- package/esm/LinearSyntenyDisplay/afterAttach.js +3 -4
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +22 -15
- package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.js +2 -4
- package/esm/LinearSyntenyDisplay/components/util.d.ts +5 -1
- package/esm/LinearSyntenyDisplay/components/util.js +7 -9
- package/esm/LinearSyntenyDisplay/drawSynteny.js +7 -9
- package/esm/LinearSyntenyDisplay/model.d.ts +48 -11
- package/esm/LinearSyntenyDisplay/model.js +39 -23
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +14 -0
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +72 -0
- package/esm/SyntenyFeatureDetail/index.d.ts +2 -0
- package/esm/SyntenyFeatureDetail/index.js +27 -0
- package/esm/index.js +2 -0
- package/package.json +3 -3
|
@@ -68,9 +68,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
68
68
|
rendererTypeName: string;
|
|
69
69
|
error: unknown;
|
|
70
70
|
message: string | undefined;
|
|
71
|
-
} & import("mobx-state-tree"
|
|
72
|
-
* #action
|
|
73
|
-
*/).IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
71
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
74
72
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
75
73
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
76
74
|
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
@@ -98,6 +96,8 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
98
96
|
features: Feature[] | undefined;
|
|
99
97
|
message: string | undefined;
|
|
100
98
|
} & {
|
|
99
|
+
readonly level: number;
|
|
100
|
+
readonly height: number;
|
|
101
101
|
renderProps(): {
|
|
102
102
|
rpcDriverName: string | undefined;
|
|
103
103
|
displayModel: {
|
|
@@ -113,7 +113,12 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
113
113
|
setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
|
|
114
114
|
[x: string]: any;
|
|
115
115
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
|
|
116
|
-
} & import("mobx-state-tree"
|
|
116
|
+
} & import("mobx-state-tree" /**
|
|
117
|
+
* #volatile
|
|
118
|
+
* canvas for drawing mouseover shading this is separate from the other
|
|
119
|
+
* code for speed: don't have to redraw entire canvas to do a feature's
|
|
120
|
+
* mouseover shading
|
|
121
|
+
*/).IStateTreeNode<AnyConfigurationSchemaType>);
|
|
117
122
|
} & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>;
|
|
118
123
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
119
124
|
rendererTypeName: string;
|
|
@@ -150,9 +155,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
150
155
|
rendererTypeName: string;
|
|
151
156
|
error: unknown;
|
|
152
157
|
message: string | undefined;
|
|
153
|
-
} & import("mobx-state-tree"
|
|
154
|
-
* #action
|
|
155
|
-
*/).IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
158
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
156
159
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
157
160
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
158
161
|
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
@@ -261,13 +264,51 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
261
264
|
} & {
|
|
262
265
|
afterAttach(): void;
|
|
263
266
|
} & {
|
|
267
|
+
/**
|
|
268
|
+
* #volatile
|
|
269
|
+
* canvas used for drawing visible screen
|
|
270
|
+
*/
|
|
264
271
|
mainCanvas: HTMLCanvasElement | null;
|
|
272
|
+
/**
|
|
273
|
+
* #volatile
|
|
274
|
+
* canvas used for drawing click map with feature ids this renders a
|
|
275
|
+
* unique color per alignment, so that it can be re-traced after a
|
|
276
|
+
* feature click with getImageData at that pixel
|
|
277
|
+
*/
|
|
265
278
|
clickMapCanvas: HTMLCanvasElement | null;
|
|
279
|
+
/**
|
|
280
|
+
* #volatile
|
|
281
|
+
* canvas used for drawing click map with cigar data this can show if you
|
|
282
|
+
* are mousing over a insertion/deletion. it is similar in purpose to the
|
|
283
|
+
* clickMapRef but was not feasible to pack this into the clickMapRef
|
|
284
|
+
*/
|
|
266
285
|
cigarClickMapCanvas: HTMLCanvasElement | null;
|
|
286
|
+
/**
|
|
287
|
+
* #volatile
|
|
288
|
+
* canvas for drawing mouseover shading this is separate from the other
|
|
289
|
+
* code for speed: don't have to redraw entire canvas to do a feature's
|
|
290
|
+
* mouseover shading
|
|
291
|
+
*/
|
|
267
292
|
mouseoverCanvas: HTMLCanvasElement | null;
|
|
293
|
+
/**
|
|
294
|
+
* #volatile
|
|
295
|
+
* assigned by reaction
|
|
296
|
+
*/
|
|
268
297
|
featPositions: FeatPos[];
|
|
298
|
+
/**
|
|
299
|
+
* #volatile
|
|
300
|
+
* currently mouse'd over feature
|
|
301
|
+
*/
|
|
269
302
|
mouseoverId: string | undefined;
|
|
303
|
+
/**
|
|
304
|
+
* #volatile
|
|
305
|
+
* currently click'd over feature
|
|
306
|
+
*/
|
|
270
307
|
clickId: string | undefined;
|
|
308
|
+
/**
|
|
309
|
+
* #volatile
|
|
310
|
+
* currently mouseover'd CIGAR subfeature
|
|
311
|
+
*/
|
|
271
312
|
cigarMouseoverId: number;
|
|
272
313
|
} & {
|
|
273
314
|
/**
|
|
@@ -311,10 +352,6 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
311
352
|
* #getter
|
|
312
353
|
*/
|
|
313
354
|
readonly trackIds: string[];
|
|
314
|
-
/**
|
|
315
|
-
* #getter
|
|
316
|
-
*/
|
|
317
|
-
readonly height: number;
|
|
318
355
|
/**
|
|
319
356
|
* #getter
|
|
320
357
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { types
|
|
1
|
+
import { types } from 'mobx-state-tree';
|
|
2
2
|
import { getConf, ConfigurationReference, } from '@jbrowse/core/configuration';
|
|
3
3
|
// locals
|
|
4
4
|
import baseModelFactory from '../LinearComparativeDisplay/stateModelFactory';
|
|
@@ -20,28 +20,51 @@ function stateModelFactory(configSchema) {
|
|
|
20
20
|
configuration: ConfigurationReference(configSchema),
|
|
21
21
|
}))
|
|
22
22
|
.volatile(() => ({
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* #volatile
|
|
25
|
+
* canvas used for drawing visible screen
|
|
26
|
+
*/
|
|
24
27
|
mainCanvas: null,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
/**
|
|
29
|
+
* #volatile
|
|
30
|
+
* canvas used for drawing click map with feature ids this renders a
|
|
31
|
+
* unique color per alignment, so that it can be re-traced after a
|
|
32
|
+
* feature click with getImageData at that pixel
|
|
33
|
+
*/
|
|
28
34
|
clickMapCanvas: null,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
/**
|
|
36
|
+
* #volatile
|
|
37
|
+
* canvas used for drawing click map with cigar data this can show if you
|
|
38
|
+
* are mousing over a insertion/deletion. it is similar in purpose to the
|
|
39
|
+
* clickMapRef but was not feasible to pack this into the clickMapRef
|
|
40
|
+
*/
|
|
33
41
|
cigarClickMapCanvas: null,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
/**
|
|
43
|
+
* #volatile
|
|
44
|
+
* canvas for drawing mouseover shading this is separate from the other
|
|
45
|
+
* code for speed: don't have to redraw entire canvas to do a feature's
|
|
46
|
+
* mouseover shading
|
|
47
|
+
*/
|
|
37
48
|
mouseoverCanvas: null,
|
|
38
|
-
|
|
49
|
+
/**
|
|
50
|
+
* #volatile
|
|
51
|
+
* assigned by reaction
|
|
52
|
+
*/
|
|
39
53
|
featPositions: [],
|
|
40
|
-
|
|
54
|
+
/**
|
|
55
|
+
* #volatile
|
|
56
|
+
* currently mouse'd over feature
|
|
57
|
+
*/
|
|
41
58
|
mouseoverId: undefined,
|
|
42
|
-
|
|
59
|
+
/**
|
|
60
|
+
* #volatile
|
|
61
|
+
* currently click'd over feature
|
|
62
|
+
*/
|
|
43
63
|
clickId: undefined,
|
|
44
|
-
|
|
64
|
+
/**
|
|
65
|
+
* #volatile
|
|
66
|
+
* currently mouseover'd CIGAR subfeature
|
|
67
|
+
*/
|
|
45
68
|
cigarMouseoverId: -1,
|
|
46
69
|
}))
|
|
47
70
|
.actions(self => ({
|
|
@@ -111,13 +134,6 @@ function stateModelFactory(configSchema) {
|
|
|
111
134
|
get trackIds() {
|
|
112
135
|
return getConf(self, 'trackIds');
|
|
113
136
|
},
|
|
114
|
-
/**
|
|
115
|
-
* #getter
|
|
116
|
-
*/
|
|
117
|
-
get height() {
|
|
118
|
-
// @ts-expect-error
|
|
119
|
-
return getParent(self, 4).height;
|
|
120
|
-
},
|
|
121
137
|
/**
|
|
122
138
|
* #getter
|
|
123
139
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SimpleFeatureSerialized } from '@jbrowse/core/util';
|
|
3
|
+
interface SyntenyFeatureDetailModel {
|
|
4
|
+
trackId: string;
|
|
5
|
+
featureData: SimpleFeatureSerialized;
|
|
6
|
+
level?: number;
|
|
7
|
+
view: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
declare const SyntenyFeatureDetail: ({ model, }: {
|
|
12
|
+
model: SyntenyFeatureDetailModel;
|
|
13
|
+
}) => React.JSX.Element;
|
|
14
|
+
export default SyntenyFeatureDetail;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React, { lazy } from 'react';
|
|
2
|
+
import { Link, Paper } from '@mui/material';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
// locals
|
|
5
|
+
import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard';
|
|
6
|
+
import BaseFeatureDetail from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
|
|
7
|
+
import { assembleLocString, getSession, SimpleFeature, } from '@jbrowse/core/util';
|
|
8
|
+
// lazies
|
|
9
|
+
const LaunchSyntenyViewDialog = lazy(() => import('../LGVSyntenyDisplay/components/LaunchSyntenyViewDialog'));
|
|
10
|
+
const CustomLinker = observer(function ({ model, }) {
|
|
11
|
+
const { featureData, view, level, trackId } = model;
|
|
12
|
+
return (React.createElement("ul", null,
|
|
13
|
+
view.type === 'LinearSyntenyView' ? (React.createElement("li", null,
|
|
14
|
+
React.createElement(Link, { href: "#", onClick: event => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
const { views } = view;
|
|
18
|
+
if (level !== undefined) {
|
|
19
|
+
// level is "pre-known", and stored in the SyntenyFeatureWidget
|
|
20
|
+
// model state e.g. when clicking on a feature from a
|
|
21
|
+
// LinearSyntenyRendering
|
|
22
|
+
(_a = views[level]) === null || _a === void 0 ? void 0 : _a.navTo(featureData);
|
|
23
|
+
(_b = views[level + 1]) === null || _b === void 0 ? void 0 : _b.navTo(featureData.mate);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// best effort to find the right level. this is triggered for
|
|
27
|
+
// example if a user clicks on a feature in a LGVSyntenyDisplay
|
|
28
|
+
// in an existing LinearSyntenyView, there is no real proper
|
|
29
|
+
// level "pre-known" to this situation
|
|
30
|
+
const f1 = featureData;
|
|
31
|
+
const f2 = featureData.mate;
|
|
32
|
+
const r1 = f1.assemblyName;
|
|
33
|
+
const r2 = f2.assemblyName;
|
|
34
|
+
const v1 = views.find(view => view.assemblyNames[0] === r1);
|
|
35
|
+
const v2 = views.find(view => view.assemblyNames[0] === r2);
|
|
36
|
+
if (!v1 || !v2) {
|
|
37
|
+
getSession(model).notify([
|
|
38
|
+
v1
|
|
39
|
+
? `Unable to find ${assembleLocString(f1)} in synteny view`
|
|
40
|
+
: '',
|
|
41
|
+
v2
|
|
42
|
+
? `Unable to find ${assembleLocString(f2)} in synteny view`
|
|
43
|
+
: '',
|
|
44
|
+
].join(' ... '));
|
|
45
|
+
}
|
|
46
|
+
v1 === null || v1 === void 0 ? void 0 : v1.navTo(f1);
|
|
47
|
+
v2 === null || v2 === void 0 ? void 0 : v2.navTo(f2);
|
|
48
|
+
}
|
|
49
|
+
} }, "Center view on this feature"))) : null,
|
|
50
|
+
React.createElement("li", null,
|
|
51
|
+
React.createElement(Link, { href: "#", onClick: event => {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
const session = getSession(model);
|
|
54
|
+
const feature = new SimpleFeature(featureData);
|
|
55
|
+
session.queueDialog(handleClose => [
|
|
56
|
+
LaunchSyntenyViewDialog,
|
|
57
|
+
{
|
|
58
|
+
model,
|
|
59
|
+
feature,
|
|
60
|
+
trackId,
|
|
61
|
+
handleClose,
|
|
62
|
+
},
|
|
63
|
+
]);
|
|
64
|
+
} }, "Launch new linear synteny view on this feature"))));
|
|
65
|
+
});
|
|
66
|
+
const SyntenyFeatureDetail = observer(function ({ model, }) {
|
|
67
|
+
return (React.createElement(Paper, { "data-testid": "alignment-side-drawer" },
|
|
68
|
+
React.createElement(BaseFeatureDetail, { title: "Feature", model: model }),
|
|
69
|
+
React.createElement(BaseCard, { title: "Link to view" },
|
|
70
|
+
React.createElement(CustomLinker, { model: model }))));
|
|
71
|
+
});
|
|
72
|
+
export default SyntenyFeatureDetail;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
3
|
+
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
4
|
+
import { types } from 'mobx-state-tree';
|
|
5
|
+
import { stateModelFactory as BaseFeatureWidgetStateModelF } from '@jbrowse/core/BaseFeatureWidget';
|
|
6
|
+
const configSchema = ConfigurationSchema('SyntenyFeatureWidget', {});
|
|
7
|
+
function stateModelF(pluginManager) {
|
|
8
|
+
return types.compose(BaseFeatureWidgetStateModelF(pluginManager), types.model('SyntenyFeatureWidget', {
|
|
9
|
+
/**
|
|
10
|
+
* #property
|
|
11
|
+
*/
|
|
12
|
+
type: types.literal('SyntenyFeatureWidget'),
|
|
13
|
+
/**
|
|
14
|
+
* #property
|
|
15
|
+
*/
|
|
16
|
+
level: types.maybe(types.number),
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
export default function SyntenyFeatureWidgetF(pluginManager) {
|
|
20
|
+
pluginManager.addWidgetType(() => new WidgetType({
|
|
21
|
+
name: 'SyntenyFeatureWidget',
|
|
22
|
+
heading: 'Synteny feature details',
|
|
23
|
+
configSchema,
|
|
24
|
+
stateModel: stateModelF(pluginManager),
|
|
25
|
+
ReactComponent: lazy(() => import('./SyntenyFeatureDetail')),
|
|
26
|
+
}));
|
|
27
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import LinearSyntenyViewHelperF from './LinearSyntenyViewHelper';
|
|
|
10
10
|
import LaunchLinearSyntenyViewF from './LaunchLinearSyntenyView';
|
|
11
11
|
import SyntenyTrackF from './SyntenyTrack';
|
|
12
12
|
import LinearReadVsRefMenuItemF from './LinearReadVsRef';
|
|
13
|
+
import SyntenyFeatureWidgetF from './SyntenyFeatureDetail';
|
|
13
14
|
export default class LinearComparativeViewPlugin extends Plugin {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
@@ -21,6 +22,7 @@ export default class LinearComparativeViewPlugin extends Plugin {
|
|
|
21
22
|
LinearSyntenyViewF(pluginManager);
|
|
22
23
|
LinearComparativeDisplayF(pluginManager);
|
|
23
24
|
LinearSyntenyDisplayF(pluginManager);
|
|
25
|
+
SyntenyFeatureWidgetF(pluginManager);
|
|
24
26
|
LGVSyntenyDisplayF(pluginManager);
|
|
25
27
|
LaunchLinearSyntenyViewF(pluginManager);
|
|
26
28
|
SyntenyTrackF(pluginManager);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-linear-comparative-view",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.1",
|
|
4
4
|
"description": "JBrowse 2 linear comparative view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"author": "JBrowse Team",
|
|
18
18
|
"distMain": "dist/index.js",
|
|
19
|
-
"srcMain": "src/index.
|
|
19
|
+
"srcMain": "src/index.ts",
|
|
20
20
|
"main": "dist/index.js",
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "c6a658d2344989895543f0456b1cf7dd3b937769"
|
|
65
65
|
}
|