@jbrowse/plugin-linear-comparative-view 2.16.1 → 2.18.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/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +1 -1
- package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +0 -2
- package/dist/LGVSyntenyDisplay/components/util.d.ts +3 -3
- package/dist/LGVSyntenyDisplay/components/util.js +0 -1
- package/dist/LGVSyntenyDisplay/configSchemaF.d.ts +19 -10
- package/dist/LGVSyntenyDisplay/configSchemaF.js +12 -9
- package/dist/LGVSyntenyDisplay/index.d.ts +1 -1
- package/dist/LGVSyntenyDisplay/index.js +1 -1
- package/dist/LGVSyntenyDisplay/model.d.ts +104 -81
- package/dist/LGVSyntenyDisplay/model.js +1 -29
- package/dist/LaunchLinearSyntenyView.d.ts +1 -1
- package/dist/LaunchLinearSyntenyView.js +1 -3
- package/dist/LinearComparativeDisplay/configSchemaF.d.ts +0 -3
- package/dist/LinearComparativeDisplay/configSchemaF.js +0 -6
- package/dist/LinearComparativeDisplay/index.d.ts +1 -1
- package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +12 -69
- package/dist/LinearComparativeDisplay/stateModelFactory.js +13 -57
- package/dist/LinearComparativeView/components/Header.d.ts +1 -1
- package/dist/LinearComparativeView/components/Header.js +4 -5
- package/dist/LinearComparativeView/components/HeaderSearchBoxes.d.ts +1 -1
- package/dist/LinearComparativeView/components/HeaderSearchBoxes.js +3 -4
- package/dist/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +1 -1
- package/dist/LinearComparativeView/components/LinearComparativeRenderArea.js +8 -15
- package/dist/LinearComparativeView/components/LinearComparativeView.d.ts +1 -1
- package/dist/LinearComparativeView/components/LinearComparativeView.js +2 -4
- package/dist/LinearComparativeView/components/Rubberband.d.ts +1 -1
- package/dist/LinearComparativeView/components/Rubberband.js +17 -19
- package/dist/LinearComparativeView/components/VerticalGuide.d.ts +1 -1
- package/dist/LinearComparativeView/components/VerticalGuide.js +1 -1
- package/dist/LinearComparativeView/index.d.ts +1 -1
- package/dist/LinearComparativeView/model.d.ts +6 -62
- package/dist/LinearComparativeView/model.js +3 -99
- package/dist/LinearReadVsRef/LinearReadVsRef.d.ts +1 -1
- package/dist/LinearReadVsRef/LinearReadVsRef.js +5 -19
- package/dist/LinearReadVsRef/index.d.ts +1 -1
- package/dist/LinearReadVsRef/index.js +0 -2
- package/dist/LinearSyntenyDisplay/afterAttach.d.ts +1 -1
- package/dist/LinearSyntenyDisplay/afterAttach.js +2 -9
- package/dist/LinearSyntenyDisplay/components/Component.d.ts +1 -1
- package/dist/LinearSyntenyDisplay/components/Component.js +2 -4
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.d.ts +1 -1
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +6 -23
- package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.d.ts +2 -2
- package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +1 -1
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +1 -1
- package/dist/LinearSyntenyDisplay/components/util.d.ts +3 -3
- package/dist/LinearSyntenyDisplay/components/util.js +0 -9
- package/dist/LinearSyntenyDisplay/configSchemaF.d.ts +1 -12
- package/dist/LinearSyntenyDisplay/configSchemaF.js +0 -15
- package/dist/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
- package/dist/LinearSyntenyDisplay/drawSynteny.js +1 -23
- package/dist/LinearSyntenyDisplay/index.d.ts +1 -1
- package/dist/LinearSyntenyDisplay/index.js +1 -2
- package/dist/LinearSyntenyDisplay/model.d.ts +8 -102
- package/dist/LinearSyntenyDisplay/model.js +1 -92
- package/dist/LinearSyntenyView/components/ExportSvgDialog.d.ts +1 -1
- package/dist/LinearSyntenyView/components/ExportSvgDialog.js +2 -4
- package/dist/LinearSyntenyView/components/Icons.d.ts +1 -1
- package/dist/LinearSyntenyView/components/ImportForm/AddCustomTrack.d.ts +2 -2
- package/dist/LinearSyntenyView/components/ImportForm/AddCustomTrack.js +1 -1
- package/dist/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.d.ts +1 -1
- package/dist/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +6 -8
- package/dist/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +1 -1
- package/dist/LinearSyntenyView/components/ImportForm/TrackSelector.js +3 -5
- package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +3 -3
- package/dist/LinearSyntenyView/components/ImportForm/util.js +1 -3
- package/dist/LinearSyntenyView/components/LinearSyntenyView.d.ts +1 -1
- package/dist/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
- package/dist/LinearSyntenyView/index.d.ts +1 -1
- package/dist/LinearSyntenyView/model.d.ts +5 -28
- package/dist/LinearSyntenyView/model.js +4 -41
- package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +1 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +1 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +1 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +5 -10
- package/dist/LinearSyntenyViewHelper/index.d.ts +1 -1
- package/dist/LinearSyntenyViewHelper/stateModelFactory.d.ts +2 -14
- package/dist/LinearSyntenyViewHelper/stateModelFactory.js +2 -29
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +1 -1
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +4 -13
- package/dist/SyntenyFeatureDetail/index.d.ts +1 -1
- package/dist/SyntenyFeatureDetail/index.js +1 -7
- package/dist/SyntenyTrack/configSchema.d.ts +1 -1
- package/dist/SyntenyTrack/configSchema.js +1 -9
- package/dist/SyntenyTrack/index.d.ts +1 -1
- package/dist/SyntenyTrack/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/util.d.ts +2 -2
- package/dist/util.js +1 -11
- package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +1 -1
- package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +0 -2
- package/esm/LGVSyntenyDisplay/components/util.d.ts +3 -3
- package/esm/LGVSyntenyDisplay/components/util.js +0 -1
- package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +19 -10
- package/esm/LGVSyntenyDisplay/configSchemaF.js +12 -9
- package/esm/LGVSyntenyDisplay/index.d.ts +1 -1
- package/esm/LGVSyntenyDisplay/index.js +1 -1
- package/esm/LGVSyntenyDisplay/model.d.ts +104 -81
- package/esm/LGVSyntenyDisplay/model.js +2 -30
- package/esm/LaunchLinearSyntenyView.d.ts +1 -1
- package/esm/LaunchLinearSyntenyView.js +1 -3
- package/esm/LinearComparativeDisplay/configSchemaF.d.ts +0 -3
- package/esm/LinearComparativeDisplay/configSchemaF.js +0 -6
- package/esm/LinearComparativeDisplay/index.d.ts +1 -1
- package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +12 -69
- package/esm/LinearComparativeDisplay/stateModelFactory.js +14 -58
- package/esm/LinearComparativeView/components/Header.d.ts +1 -1
- package/esm/LinearComparativeView/components/Header.js +4 -5
- package/esm/LinearComparativeView/components/HeaderSearchBoxes.d.ts +1 -1
- package/esm/LinearComparativeView/components/HeaderSearchBoxes.js +3 -4
- package/esm/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +1 -1
- package/esm/LinearComparativeView/components/LinearComparativeRenderArea.js +8 -15
- package/esm/LinearComparativeView/components/LinearComparativeView.d.ts +1 -1
- package/esm/LinearComparativeView/components/LinearComparativeView.js +2 -4
- package/esm/LinearComparativeView/components/Rubberband.d.ts +1 -1
- package/esm/LinearComparativeView/components/Rubberband.js +18 -20
- package/esm/LinearComparativeView/components/VerticalGuide.d.ts +1 -1
- package/esm/LinearComparativeView/components/VerticalGuide.js +1 -1
- package/esm/LinearComparativeView/index.d.ts +1 -1
- package/esm/LinearComparativeView/model.d.ts +6 -62
- package/esm/LinearComparativeView/model.js +4 -100
- package/esm/LinearReadVsRef/LinearReadVsRef.d.ts +1 -1
- package/esm/LinearReadVsRef/LinearReadVsRef.js +5 -19
- package/esm/LinearReadVsRef/index.d.ts +1 -1
- package/esm/LinearReadVsRef/index.js +1 -3
- package/esm/LinearSyntenyDisplay/afterAttach.d.ts +1 -1
- package/esm/LinearSyntenyDisplay/afterAttach.js +2 -9
- package/esm/LinearSyntenyDisplay/components/Component.d.ts +1 -1
- package/esm/LinearSyntenyDisplay/components/Component.js +2 -4
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.d.ts +1 -1
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +8 -25
- package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.d.ts +2 -2
- package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.js +1 -1
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +1 -1
- package/esm/LinearSyntenyDisplay/components/util.d.ts +3 -3
- package/esm/LinearSyntenyDisplay/components/util.js +2 -11
- package/esm/LinearSyntenyDisplay/configSchemaF.d.ts +1 -12
- package/esm/LinearSyntenyDisplay/configSchemaF.js +0 -15
- package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
- package/esm/LinearSyntenyDisplay/drawSynteny.js +1 -23
- package/esm/LinearSyntenyDisplay/index.d.ts +1 -1
- package/esm/LinearSyntenyDisplay/index.js +1 -2
- package/esm/LinearSyntenyDisplay/model.d.ts +8 -102
- package/esm/LinearSyntenyDisplay/model.js +1 -92
- package/esm/LinearSyntenyView/components/ExportSvgDialog.d.ts +1 -1
- package/esm/LinearSyntenyView/components/ExportSvgDialog.js +2 -4
- package/esm/LinearSyntenyView/components/Icons.d.ts +1 -1
- package/esm/LinearSyntenyView/components/ImportForm/AddCustomTrack.d.ts +2 -2
- package/esm/LinearSyntenyView/components/ImportForm/AddCustomTrack.js +2 -2
- package/esm/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.d.ts +1 -1
- package/esm/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +6 -8
- package/esm/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +1 -1
- package/esm/LinearSyntenyView/components/ImportForm/TrackSelector.js +4 -6
- package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +3 -3
- package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +1 -1
- package/esm/LinearSyntenyView/components/ImportForm/util.js +1 -3
- package/esm/LinearSyntenyView/components/LinearSyntenyView.d.ts +1 -1
- package/esm/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
- package/esm/LinearSyntenyView/index.d.ts +1 -1
- package/esm/LinearSyntenyView/model.d.ts +5 -28
- package/esm/LinearSyntenyView/model.js +4 -41
- package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js +1 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +1 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +2 -2
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +6 -11
- package/esm/LinearSyntenyViewHelper/index.d.ts +1 -1
- package/esm/LinearSyntenyViewHelper/stateModelFactory.d.ts +2 -14
- package/esm/LinearSyntenyViewHelper/stateModelFactory.js +2 -29
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +1 -1
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +4 -13
- package/esm/SyntenyFeatureDetail/index.d.ts +1 -1
- package/esm/SyntenyFeatureDetail/index.js +1 -7
- package/esm/SyntenyTrack/configSchema.d.ts +1 -1
- package/esm/SyntenyTrack/configSchema.js +1 -9
- package/esm/SyntenyTrack/index.d.ts +1 -1
- package/esm/SyntenyTrack/index.js +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +4 -4
- package/esm/util.d.ts +2 -2
- package/esm/util.js +1 -11
- package/package.json +2 -4
|
@@ -1,97 +1,45 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import { addDisposer, cast, getPath, types, } from 'mobx-state-tree';
|
|
3
|
-
import { autorun } from 'mobx';
|
|
4
|
-
// jbrowse
|
|
5
2
|
import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel';
|
|
6
|
-
import { getSession, isSessionModelWithWidgets
|
|
3
|
+
import { avg, getSession, isSessionModelWithWidgets } from '@jbrowse/core/util';
|
|
7
4
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
8
|
-
// icons
|
|
9
5
|
import FolderOpenIcon from '@mui/icons-material/FolderOpen';
|
|
10
|
-
|
|
6
|
+
import { autorun } from 'mobx';
|
|
7
|
+
import { addDisposer, cast, getPath, types } from 'mobx-state-tree';
|
|
11
8
|
const ReturnToImportFormDialog = lazy(() => import('@jbrowse/core/ui/ReturnToImportFormDialog'));
|
|
12
|
-
/**
|
|
13
|
-
* #stateModel LinearComparativeView
|
|
14
|
-
* extends
|
|
15
|
-
* - [BaseViewModel](../baseviewmodel)
|
|
16
|
-
*/
|
|
17
9
|
function stateModelFactory(pluginManager) {
|
|
18
10
|
var _a;
|
|
19
11
|
const LinearSyntenyViewHelper = (_a = pluginManager.getViewType('LinearSyntenyViewHelper')) === null || _a === void 0 ? void 0 : _a.stateModel;
|
|
20
12
|
return types
|
|
21
13
|
.compose('LinearComparativeView', BaseViewModel, types.model({
|
|
22
|
-
/**
|
|
23
|
-
* #property
|
|
24
|
-
*/
|
|
25
14
|
id: ElementId,
|
|
26
|
-
/**
|
|
27
|
-
* #property
|
|
28
|
-
*/
|
|
29
15
|
type: types.literal('LinearComparativeView'),
|
|
30
|
-
/**
|
|
31
|
-
* #property
|
|
32
|
-
*/
|
|
33
16
|
trackSelectorType: 'hierarchical',
|
|
34
|
-
/**
|
|
35
|
-
* #property
|
|
36
|
-
*/
|
|
37
17
|
showIntraviewLinks: true,
|
|
38
|
-
/**
|
|
39
|
-
* #property
|
|
40
|
-
*/
|
|
41
18
|
interactToggled: false,
|
|
42
|
-
/**
|
|
43
|
-
* #property
|
|
44
|
-
*/
|
|
45
19
|
levels: types.array(LinearSyntenyViewHelper),
|
|
46
|
-
/**
|
|
47
|
-
* #property
|
|
48
|
-
* currently this is limited to an array of two
|
|
49
|
-
*/
|
|
50
20
|
views: types.array(pluginManager.getViewType('LinearGenomeView')
|
|
51
21
|
.stateModel),
|
|
52
|
-
/**
|
|
53
|
-
* #property
|
|
54
|
-
* this represents tracks specific to this view specifically used for
|
|
55
|
-
* read vs ref dotplots where this track would not really apply
|
|
56
|
-
* elsewhere
|
|
57
|
-
*/
|
|
58
22
|
viewTrackConfigs: types.array(pluginManager.pluggableConfigSchemaType('track')),
|
|
59
23
|
}))
|
|
60
24
|
.volatile(() => ({
|
|
61
|
-
/**
|
|
62
|
-
* #volatile
|
|
63
|
-
*/
|
|
64
25
|
width: undefined,
|
|
65
26
|
}))
|
|
66
27
|
.views(self => ({
|
|
67
|
-
/**
|
|
68
|
-
* #getter
|
|
69
|
-
*/
|
|
70
28
|
get initialized() {
|
|
71
|
-
return (
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
73
|
-
self.width !== undefined &&
|
|
29
|
+
return (self.width !== undefined &&
|
|
74
30
|
self.views.length > 0 &&
|
|
75
31
|
self.views.every(view => view.initialized));
|
|
76
32
|
},
|
|
77
|
-
/**
|
|
78
|
-
* #getter
|
|
79
|
-
*/
|
|
80
33
|
get refNames() {
|
|
81
34
|
return self.views.map(v => [
|
|
82
35
|
...new Set(v.staticBlocks.map(m => m.refName)),
|
|
83
36
|
]);
|
|
84
37
|
},
|
|
85
|
-
/**
|
|
86
|
-
* #getter
|
|
87
|
-
*/
|
|
88
38
|
get assemblyNames() {
|
|
89
39
|
return [...new Set(self.views.flatMap(v => v.assemblyNames))];
|
|
90
40
|
},
|
|
91
41
|
}))
|
|
92
42
|
.actions(self => ({
|
|
93
|
-
// automatically removes session assemblies associated with this view
|
|
94
|
-
// e.g. read vs ref
|
|
95
43
|
beforeDestroy() {
|
|
96
44
|
var _a;
|
|
97
45
|
const session = getSession(self);
|
|
@@ -103,40 +51,24 @@ function stateModelFactory(pluginManager) {
|
|
|
103
51
|
self.views.forEach(view => {
|
|
104
52
|
const ret = getPath(view);
|
|
105
53
|
if (!ret.endsWith(path)) {
|
|
106
|
-
// @ts-expect-error
|
|
107
54
|
view[actionName](args === null || args === void 0 ? void 0 : args[0]);
|
|
108
55
|
}
|
|
109
56
|
});
|
|
110
57
|
},
|
|
111
|
-
/**
|
|
112
|
-
* #action
|
|
113
|
-
*/
|
|
114
58
|
setWidth(newWidth) {
|
|
115
59
|
self.width = newWidth;
|
|
116
60
|
},
|
|
117
|
-
/**
|
|
118
|
-
* #action
|
|
119
|
-
*/
|
|
120
61
|
setViews(views) {
|
|
121
62
|
self.views = cast(views);
|
|
122
63
|
},
|
|
123
|
-
/**
|
|
124
|
-
* #action
|
|
125
|
-
*/
|
|
126
64
|
removeView(view) {
|
|
127
65
|
self.views.remove(view);
|
|
128
66
|
},
|
|
129
|
-
/**
|
|
130
|
-
* #action
|
|
131
|
-
*/
|
|
132
67
|
setLevelHeight(newHeight, level = 0) {
|
|
133
68
|
const l = self.levels[level];
|
|
134
69
|
l.setHeight(newHeight);
|
|
135
70
|
return l.height;
|
|
136
71
|
},
|
|
137
|
-
/**
|
|
138
|
-
* #action
|
|
139
|
-
*/
|
|
140
72
|
activateTrackSelector(level) {
|
|
141
73
|
if (self.trackSelectorType === 'hierarchical') {
|
|
142
74
|
const session = getSession(self);
|
|
@@ -150,32 +82,20 @@ function stateModelFactory(pluginManager) {
|
|
|
150
82
|
}
|
|
151
83
|
throw new Error(`invalid track selector type ${self.trackSelectorType}`);
|
|
152
84
|
},
|
|
153
|
-
/**
|
|
154
|
-
* #action
|
|
155
|
-
*/
|
|
156
85
|
toggleTrack(trackId, level = 0) {
|
|
157
86
|
var _a;
|
|
158
87
|
(_a = self.levels[level]) === null || _a === void 0 ? void 0 : _a.toggleTrack(trackId);
|
|
159
88
|
},
|
|
160
|
-
/**
|
|
161
|
-
* #action
|
|
162
|
-
*/
|
|
163
89
|
showTrack(trackId, level = 0, initialSnapshot = {}) {
|
|
164
90
|
if (!self.levels[level]) {
|
|
165
91
|
self.levels[level] = cast({ level });
|
|
166
92
|
}
|
|
167
93
|
self.levels[level].showTrack(trackId, initialSnapshot);
|
|
168
94
|
},
|
|
169
|
-
/**
|
|
170
|
-
* #action
|
|
171
|
-
*/
|
|
172
95
|
hideTrack(trackId, level = 0) {
|
|
173
96
|
var _a;
|
|
174
97
|
(_a = self.levels[level]) === null || _a === void 0 ? void 0 : _a.hideTrack(trackId);
|
|
175
98
|
},
|
|
176
|
-
/**
|
|
177
|
-
* #action
|
|
178
|
-
*/
|
|
179
99
|
squareView() {
|
|
180
100
|
const average = avg(self.views.map(v => v.bpPerPx));
|
|
181
101
|
for (const view of self.views) {
|
|
@@ -186,28 +106,17 @@ function stateModelFactory(pluginManager) {
|
|
|
186
106
|
}
|
|
187
107
|
}
|
|
188
108
|
},
|
|
189
|
-
/**
|
|
190
|
-
* #action
|
|
191
|
-
*/
|
|
192
109
|
clearView() {
|
|
193
110
|
self.views = cast([]);
|
|
194
111
|
self.levels = cast([]);
|
|
195
112
|
},
|
|
196
113
|
}))
|
|
197
114
|
.views(() => ({
|
|
198
|
-
/**
|
|
199
|
-
* #method
|
|
200
|
-
* includes a subset of view menu options because the full list is a
|
|
201
|
-
* little overwhelming. overridden by subclasses
|
|
202
|
-
*/
|
|
203
115
|
headerMenuItems() {
|
|
204
116
|
return [];
|
|
205
117
|
},
|
|
206
118
|
}))
|
|
207
119
|
.views(self => ({
|
|
208
|
-
/**
|
|
209
|
-
* #method
|
|
210
|
-
*/
|
|
211
120
|
menuItems() {
|
|
212
121
|
return [
|
|
213
122
|
{
|
|
@@ -225,9 +134,6 @@ function stateModelFactory(pluginManager) {
|
|
|
225
134
|
},
|
|
226
135
|
];
|
|
227
136
|
},
|
|
228
|
-
/**
|
|
229
|
-
* #method
|
|
230
|
-
*/
|
|
231
137
|
rubberBandMenuItems() {
|
|
232
138
|
return [
|
|
233
139
|
{
|
|
@@ -256,8 +162,6 @@ function stateModelFactory(pluginManager) {
|
|
|
256
162
|
},
|
|
257
163
|
}))
|
|
258
164
|
.preProcessSnapshot(snap => {
|
|
259
|
-
// @ts-expect-error
|
|
260
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
261
165
|
const { tracks, levels = [{ tracks, level: 0 }], ...rest } = snap || {};
|
|
262
166
|
return {
|
|
263
167
|
...rest,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Button, CircularProgress, DialogActions, DialogContent, TextField, Typography, } from '@mui/material';
|
|
3
|
-
import { Dialog } from '@jbrowse/core/ui';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
2
|
import { getConf } from '@jbrowse/core/configuration';
|
|
3
|
+
import { Dialog } from '@jbrowse/core/ui';
|
|
4
|
+
import { gatherOverlaps, getContainingView, getSession, } from '@jbrowse/core/util';
|
|
6
5
|
import { getRpcSessionId } from '@jbrowse/core/util/tracks';
|
|
7
|
-
import { getSession, getContainingView, gatherOverlaps, } from '@jbrowse/core/util';
|
|
8
|
-
// locals
|
|
9
6
|
import { MismatchParser } from '@jbrowse/plugin-alignments';
|
|
7
|
+
import { Button, CircularProgress, DialogActions, DialogContent, TextField, Typography, } from '@mui/material';
|
|
8
|
+
import { makeStyles } from 'tss-react/mui';
|
|
10
9
|
const { featurizeSA, getClip, getLength, getLengthSansClipping, getTag } = MismatchParser;
|
|
11
10
|
const useStyles = makeStyles()({
|
|
12
11
|
root: {
|
|
@@ -15,16 +14,11 @@ const useStyles = makeStyles()({
|
|
|
15
14
|
});
|
|
16
15
|
export default function ReadVsRefDialog({ track, feature: preFeature, handleClose, }) {
|
|
17
16
|
const { classes } = useStyles();
|
|
18
|
-
// window size stored as string, because it corresponds to a textfield which
|
|
19
|
-
// is parsed as number on submit
|
|
20
17
|
const [windowSizeText, setWindowSize] = useState('0');
|
|
21
18
|
const [error, setError] = useState();
|
|
22
19
|
const [primaryFeature, setPrimaryFeature] = useState();
|
|
23
20
|
const windowSize = +windowSizeText;
|
|
24
|
-
// we need to fetch the primary alignment if the selected feature is 2048.
|
|
25
|
-
// this should be the first in the list of the SA tag
|
|
26
21
|
useEffect(() => {
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
28
22
|
;
|
|
29
23
|
(async () => {
|
|
30
24
|
setError(undefined);
|
|
@@ -87,9 +81,6 @@ export default function ReadVsRefDialog({ track, feature: preFeature, handleClos
|
|
|
87
81
|
const assemblyNames = [trackAssembly, readAssembly];
|
|
88
82
|
const trackId = `track-${Date.now()}`;
|
|
89
83
|
const trackName = `${readName}_vs_${trackAssembly}`;
|
|
90
|
-
// get the canonical refname for the read because if the
|
|
91
|
-
// read.get('refName') is chr1 and the actual fasta refName is 1 then no
|
|
92
|
-
// tracks can be opened on the top panel of the linear read vs ref
|
|
93
84
|
const { assemblyManager } = session;
|
|
94
85
|
const assembly = assemblyManager.get(trackAssembly);
|
|
95
86
|
if (!assembly) {
|
|
@@ -104,9 +95,6 @@ export default function ReadVsRefDialog({ track, feature: preFeature, handleClos
|
|
|
104
95
|
start: clipPos,
|
|
105
96
|
end: clipPos + getLengthSansClipping(cigar),
|
|
106
97
|
};
|
|
107
|
-
// if secondary alignment or supplementary, calculate length from SA[0]'s
|
|
108
|
-
// CIGAR which is the primary alignments. otherwise it is the primary
|
|
109
|
-
// alignment just use seq.length if primary alignment
|
|
110
98
|
const totalLength = flags & 2048 ? getLength(suppAlns[0].CIGAR) : getLength(cigar);
|
|
111
99
|
const features = [feat, ...suppAlns];
|
|
112
100
|
features.forEach((f, idx) => {
|
|
@@ -117,8 +105,6 @@ export default function ReadVsRefDialog({ track, feature: preFeature, handleClos
|
|
|
117
105
|
});
|
|
118
106
|
features.sort((a, b) => a.clipPos - b.clipPos);
|
|
119
107
|
const featSeq = feature.get('seq');
|
|
120
|
-
// the config feature store includes synthetic mate features
|
|
121
|
-
// mapped to the read assembly
|
|
122
108
|
const configFeatureStore = [...features, ...features.map(f => f.mate)];
|
|
123
109
|
const expand = 2 * windowSize;
|
|
124
110
|
const refLen = features.reduce((a, f) => a + f.end - f.start + expand, 0);
|
|
@@ -144,7 +130,7 @@ export default function ReadVsRefDialog({ track, feature: preFeature, handleClos
|
|
|
144
130
|
{
|
|
145
131
|
start: 0,
|
|
146
132
|
end: totalLength,
|
|
147
|
-
seq: featSeq || '',
|
|
133
|
+
seq: featSeq || '',
|
|
148
134
|
refName: readName,
|
|
149
135
|
uniqueId: `${Math.random()}`,
|
|
150
136
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function LinearReadVsRefMenuItemF(pm: PluginManager): void;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
// icons
|
|
2
|
+
import { getContainingTrack, getSession } from '@jbrowse/core/util';
|
|
4
3
|
import AddIcon from '@mui/icons-material/Add';
|
|
5
|
-
// locals
|
|
6
4
|
const ReadVsRefDialog = lazy(() => import('./LinearReadVsRef'));
|
|
7
5
|
function isDisplay(elt) {
|
|
8
6
|
return elt.name === 'LinearPileupDisplay';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LinearSyntenyDisplayModel } from './model';
|
|
1
|
+
import type { LinearSyntenyDisplayModel } from './model';
|
|
2
2
|
export declare function doAfterAttach(self: LinearSyntenyDisplayModel): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { reaction, autorun } from 'mobx';
|
|
2
|
-
import { addDisposer, getSnapshot } from 'mobx-state-tree';
|
|
3
1
|
import { getContainingView, getSession } from '@jbrowse/core/util';
|
|
4
2
|
import { bpToPx } from '@jbrowse/core/util/Base1DUtils';
|
|
5
3
|
import { MismatchParser } from '@jbrowse/plugin-alignments';
|
|
4
|
+
import { autorun, reaction } from 'mobx';
|
|
5
|
+
import { addDisposer, getSnapshot } from 'mobx-state-tree';
|
|
6
6
|
import { drawMouseoverSynteny, drawRef } from './drawSynteny';
|
|
7
7
|
export function doAfterAttach(self) {
|
|
8
8
|
addDisposer(self, autorun(() => {
|
|
@@ -29,17 +29,10 @@ export function doAfterAttach(self) {
|
|
|
29
29
|
}
|
|
30
30
|
drawMouseoverSynteny(self);
|
|
31
31
|
}));
|
|
32
|
-
// this attempts to reduce recalculation of feature positions drawn by
|
|
33
|
-
// the synteny view
|
|
34
|
-
//
|
|
35
|
-
// uses a reaction to say "we know the positions don't change in any
|
|
36
|
-
// relevant way unless bpPerPx changes or displayedRegions changes"
|
|
37
32
|
addDisposer(self, reaction(() => {
|
|
38
33
|
const view = getContainingView(self);
|
|
39
34
|
return {
|
|
40
35
|
bpPerPx: view.views.map(v => v.bpPerPx),
|
|
41
|
-
// stringifying 'deeply' accesses the displayed regions, see
|
|
42
|
-
// issue #3456
|
|
43
36
|
displayedRegions: JSON.stringify(view.views.map(v => v.displayedRegions)),
|
|
44
37
|
features: self.features,
|
|
45
38
|
initialized: view.initialized,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { makeStyles } from 'tss-react/mui';
|
|
3
|
-
import { observer } from 'mobx-react';
|
|
4
2
|
import { LoadingEllipses } from '@jbrowse/core/ui';
|
|
5
|
-
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
import { makeStyles } from 'tss-react/mui';
|
|
6
5
|
import LinearSyntenyRendering from './LinearSyntenyRendering';
|
|
7
6
|
const useStyles = makeStyles()(theme => {
|
|
8
7
|
const bg = theme.palette.action.disabledBackground;
|
|
@@ -25,7 +24,6 @@ const useStyles = makeStyles()(theme => {
|
|
|
25
24
|
};
|
|
26
25
|
});
|
|
27
26
|
function LoadingMessage() {
|
|
28
|
-
// only show the loading message after 300ms to prevent excessive flickering
|
|
29
27
|
const [shown, setShown] = useState(false);
|
|
30
28
|
const { classes } = useStyles();
|
|
31
29
|
useEffect(() => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
1
|
+
import React, { lazy, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import { getContainingView } from '@jbrowse/core/util';
|
|
4
3
|
import { transaction } from 'mobx';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
5
|
import { makeStyles } from 'tss-react/mui';
|
|
6
|
-
import {
|
|
6
|
+
import { MAX_COLOR_RANGE, getId } from '../drawSynteny';
|
|
7
7
|
import SyntenyContextMenu from './SyntenyContextMenu';
|
|
8
8
|
import { getTooltip, onSynClick, onSynContextClick } from './util';
|
|
9
9
|
const SyntenyTooltip = lazy(() => import('./SyntenyTooltip'));
|
|
@@ -18,7 +18,6 @@ const useStyles = makeStyles()({
|
|
|
18
18
|
position: 'relative',
|
|
19
19
|
},
|
|
20
20
|
mouseoverCanvas: {
|
|
21
|
-
imageRendering: 'pixelated',
|
|
22
21
|
position: 'absolute',
|
|
23
22
|
pointEvents: 'none',
|
|
24
23
|
},
|
|
@@ -42,22 +41,13 @@ const LinearSyntenyRendering = observer(function ({ model, }) {
|
|
|
42
41
|
const [mouseInitialDownX, setMouseInitialDownX] = useState();
|
|
43
42
|
const [currY, setCurrY] = useState();
|
|
44
43
|
const mainSyntenyCanvasRefp = useRef();
|
|
45
|
-
// these useCallbacks avoid new refs from being created on any mouseover,
|
|
46
|
-
// etc.
|
|
47
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
48
44
|
const mouseoverDetectionCanvasRef = useCallback((ref) => {
|
|
49
45
|
model.setMouseoverCanvasRef(ref);
|
|
50
|
-
},
|
|
51
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
-
[model, height, width]);
|
|
53
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
46
|
+
}, [model, height, width]);
|
|
54
47
|
const mainSyntenyCanvasRef = useCallback((ref) => {
|
|
55
48
|
model.setMainCanvasRef(ref);
|
|
56
|
-
mainSyntenyCanvasRefp.current = ref;
|
|
57
|
-
},
|
|
58
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
-
[model, height, width]);
|
|
60
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
49
|
+
mainSyntenyCanvasRefp.current = ref;
|
|
50
|
+
}, [model, height, width]);
|
|
61
51
|
useEffect(() => {
|
|
62
52
|
var _a;
|
|
63
53
|
function onWheel(event) {
|
|
@@ -106,20 +96,13 @@ const LinearSyntenyRendering = observer(function ({ model, }) {
|
|
|
106
96
|
var _a;
|
|
107
97
|
(_a = mainSyntenyCanvasRefp.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('wheel', onWheel);
|
|
108
98
|
};
|
|
109
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
99
|
}, [model, height, width]);
|
|
111
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
112
100
|
const clickMapCanvasRef = useCallback((ref) => {
|
|
113
101
|
model.setClickMapCanvasRef(ref);
|
|
114
|
-
},
|
|
115
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
116
|
-
[model, height, width]);
|
|
117
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
102
|
+
}, [model, height, width]);
|
|
118
103
|
const cigarClickMapCanvasRef = useCallback((ref) => {
|
|
119
104
|
model.setCigarClickMapCanvasRef(ref);
|
|
120
|
-
},
|
|
121
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
|
-
[model, height, width]);
|
|
105
|
+
}, [model, height, width]);
|
|
123
106
|
return (React.createElement("div", { className: classes.rel },
|
|
124
107
|
React.createElement("canvas", { ref: mouseoverDetectionCanvasRef, width: width, height: height, className: classes.mouseoverCanvas }),
|
|
125
108
|
React.createElement("canvas", { ref: mainSyntenyCanvasRef, onMouseMove: event => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { LinearSyntenyDisplayModel } from '../model';
|
|
3
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
4
4
|
interface ClickCoord {
|
|
5
5
|
clientX: number;
|
|
6
6
|
clientY: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { getContainingView, getSession } from '@jbrowse/core/util';
|
|
3
2
|
import { Menu } from '@jbrowse/core/ui';
|
|
3
|
+
import { getContainingView, getSession } from '@jbrowse/core/util';
|
|
4
4
|
export default function SyntenyContextMenu({ model, onClose, anchorEl, }) {
|
|
5
5
|
const view = getContainingView(model);
|
|
6
6
|
const { clientX, clientY, feature } = anchorEl;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
3
2
|
import { SanitizedHTML } from '@jbrowse/core/ui';
|
|
4
3
|
import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
5
|
const SyntenyTooltip = observer(function ({ title }) {
|
|
6
6
|
return title ? (React.createElement(BaseTooltip, null,
|
|
7
7
|
React.createElement(SanitizedHTML, { html: title }))) : null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { LinearSyntenyDisplayModel } from '../model';
|
|
3
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
4
4
|
interface Pos {
|
|
5
5
|
offsetPx: number;
|
|
6
6
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { assembleLocString, doesIntersect2,
|
|
2
|
-
|
|
3
|
-
import { getId, MAX_COLOR_RANGE } from '../drawSynteny';
|
|
1
|
+
import { assembleLocString, doesIntersect2, getContainingTrack, getContainingView, getSession, isSessionModelWithWidgets, } from '@jbrowse/core/util';
|
|
2
|
+
import { MAX_COLOR_RANGE, getId } from '../drawSynteny';
|
|
4
3
|
export function drawMatchSimple({ feature, ctx, offsets, level, cb, height, drawCurves, oobLimit, viewWidth, hideTiny, }) {
|
|
5
4
|
const { p11, p12, p21, p22 } = feature;
|
|
6
5
|
const x11 = p11.offsetPx - offsets[level];
|
|
@@ -17,11 +16,7 @@ export function drawMatchSimple({ feature, ctx, offsets, level, cb, height, draw
|
|
|
17
16
|
if (!doesIntersect2(minX, maxX, -oobLimit, viewWidth + oobLimit)) {
|
|
18
17
|
return;
|
|
19
18
|
}
|
|
20
|
-
// drawing a line if the results are thin: drawing a line results in much
|
|
21
|
-
// less pixellation than filling in a thin polygon
|
|
22
19
|
if (l1 <= 1 && l2 <= 1) {
|
|
23
|
-
// hideTiny can be used to avoid drawing mouseover for thin lines in this
|
|
24
|
-
// case
|
|
25
20
|
if (!hideTiny) {
|
|
26
21
|
ctx.beginPath();
|
|
27
22
|
ctx.moveTo(x11, y1);
|
|
@@ -58,9 +53,6 @@ export function drawBox(ctx, x1, x2, y1, x3, x4, y2) {
|
|
|
58
53
|
export function drawBezierBox(ctx, x1, x2, y1, x3, x4, y2, mid) {
|
|
59
54
|
const len1 = Math.abs(x1 - x2);
|
|
60
55
|
const len2 = Math.abs(x1 - x2);
|
|
61
|
-
// heuristic to not draw hourglass inversions with bezier curves when they
|
|
62
|
-
// are thin and far apart because it results in areas that are not drawn well
|
|
63
|
-
// demo https://codesandbox.io/s/fast-glitter-q3b1or?file=/src/index.js
|
|
64
56
|
if (len1 < 5 && len2 < 5 && x2 < x1 && Math.abs(x1 - x3) > 100) {
|
|
65
57
|
const tmp = x1;
|
|
66
58
|
x1 = x2;
|
|
@@ -134,7 +126,6 @@ export function onSynContextClick(event, model, setAnchorEl) {
|
|
|
134
126
|
}
|
|
135
127
|
}
|
|
136
128
|
export function getTooltip({ feature, cigarOp, cigarOpLen, }) {
|
|
137
|
-
// @ts-expect-error
|
|
138
129
|
const f1 = feature.toJSON();
|
|
139
130
|
const f2 = f1.mate;
|
|
140
131
|
const l1 = f1.end - f1.start;
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
/**
|
|
3
|
-
* #config LinearSyntenyDisplay
|
|
4
|
-
*/
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
5
2
|
declare function configSchemaFactory(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
6
|
-
/**
|
|
7
|
-
* #slot
|
|
8
|
-
* currently unused
|
|
9
|
-
*/
|
|
10
3
|
trackIds: {
|
|
11
4
|
type: string;
|
|
12
5
|
defaultValue: never[];
|
|
13
6
|
};
|
|
14
|
-
/**
|
|
15
|
-
* #slot
|
|
16
|
-
* currently unused
|
|
17
|
-
*/
|
|
18
7
|
middle: {
|
|
19
8
|
type: string;
|
|
20
9
|
defaultValue: boolean;
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import baseConfigFactory from '../LinearComparativeDisplay/configSchemaF';
|
|
3
|
-
/**
|
|
4
|
-
* #config LinearSyntenyDisplay
|
|
5
|
-
*/
|
|
6
3
|
function configSchemaFactory(pluginManager) {
|
|
7
4
|
return ConfigurationSchema('LinearSyntenyDisplay', {
|
|
8
|
-
/**
|
|
9
|
-
* #slot
|
|
10
|
-
* currently unused
|
|
11
|
-
*/
|
|
12
5
|
trackIds: {
|
|
13
6
|
type: 'stringArray',
|
|
14
7
|
defaultValue: [],
|
|
15
8
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
* currently unused
|
|
19
|
-
*/
|
|
20
9
|
middle: { type: 'boolean', defaultValue: true },
|
|
21
10
|
}, {
|
|
22
|
-
/**
|
|
23
|
-
* #baseConfiguration
|
|
24
|
-
* this refers to the LinearComparativeDisplay
|
|
25
|
-
*/
|
|
26
11
|
baseConfiguration: baseConfigFactory(pluginManager),
|
|
27
12
|
explicitlyTyped: true,
|
|
28
13
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LinearSyntenyDisplayModel } from './model';
|
|
1
|
+
import type { LinearSyntenyDisplayModel } from './model';
|
|
2
2
|
export declare const MAX_COLOR_RANGE: number;
|
|
3
3
|
export declare function getId(r: number, g: number, b: number, unitMultiplier: number): number;
|
|
4
4
|
export declare function drawRef(model: LinearSyntenyDisplayModel, ctx1: CanvasRenderingContext2D, ctx3?: CanvasRenderingContext2D): void;
|