@jbrowse/plugin-dotplot-view 2.17.0 → 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/ComparativeRenderer/index.d.ts +3 -8
- package/dist/ComparativeRenderer/index.js +3 -8
- package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +1 -1
- package/dist/DotplotDisplay/components/DotplotDisplay.js +1 -1
- package/dist/DotplotDisplay/index.d.ts +1 -7
- package/dist/DotplotDisplay/index.js +2 -12
- package/dist/DotplotDisplay/renderDotplotBlock.d.ts +1 -1
- package/dist/DotplotDisplay/renderDotplotBlock.js +3 -9
- package/dist/DotplotDisplay/stateModelFactory.d.ts +7 -43
- package/dist/DotplotDisplay/stateModelFactory.js +55 -97
- package/dist/DotplotReadVsRef/DotplotReadVsRef.d.ts +2 -2
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js +13 -14
- package/dist/DotplotReadVsRef/index.d.ts +1 -1
- package/dist/DotplotReadVsRef/index.js +0 -2
- package/dist/DotplotRenderer/ComparativeRenderRpc.d.ts +3 -8
- package/dist/DotplotRenderer/ComparativeRenderRpc.js +3 -8
- package/dist/DotplotRenderer/DotplotRenderer.d.ts +5 -4
- package/dist/DotplotRenderer/DotplotRenderer.js +1 -2
- package/dist/DotplotRenderer/components/DotplotRendering.d.ts +1 -1
- package/dist/DotplotRenderer/configSchema.d.ts +0 -21
- package/dist/DotplotRenderer/configSchema.js +2 -27
- package/dist/DotplotRenderer/drawDotplot.d.ts +3 -3
- package/dist/DotplotRenderer/drawDotplot.js +3 -6
- package/dist/DotplotRenderer/index.d.ts +1 -1
- package/dist/DotplotRenderer/index.js +1 -1
- package/dist/DotplotView/1dview.d.ts +2 -77
- package/dist/DotplotView/1dview.js +4 -33
- package/dist/DotplotView/components/Axes.d.ts +1 -1
- package/dist/DotplotView/components/Axes.js +3 -4
- package/dist/DotplotView/components/CursorIcon.d.ts +1 -1
- package/dist/DotplotView/components/CursorIcon.js +1 -1
- package/dist/DotplotView/components/DotplotControls.d.ts +1 -1
- package/dist/DotplotView/components/DotplotControls.js +5 -6
- package/dist/DotplotView/components/DotplotTooltipClick.d.ts +1 -1
- package/dist/DotplotView/components/DotplotTooltipClick.js +1 -1
- package/dist/DotplotView/components/DotplotTooltipMouseover.d.ts +1 -1
- package/dist/DotplotView/components/DotplotTooltipMouseover.js +1 -1
- package/dist/DotplotView/components/DotplotView.d.ts +1 -1
- package/dist/DotplotView/components/DotplotView.js +5 -12
- package/dist/DotplotView/components/DotplotWarnings.d.ts +1 -1
- package/dist/DotplotView/components/DotplotWarnings.js +0 -1
- package/dist/DotplotView/components/ExportSvgDialog.d.ts +1 -1
- package/dist/DotplotView/components/ExportSvgDialog.js +2 -4
- package/dist/DotplotView/components/Grid.d.ts +1 -1
- package/dist/DotplotView/components/Grid.js +2 -4
- package/dist/DotplotView/components/Header.d.ts +1 -1
- package/dist/DotplotView/components/Header.js +2 -2
- package/dist/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +2 -2
- package/dist/DotplotView/components/ImportForm/ImportCustomTrack.js +1 -1
- package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +1 -1
- package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +5 -10
- package/dist/DotplotView/components/ImportForm/index.d.ts +1 -1
- package/dist/DotplotView/components/ImportForm/index.js +4 -5
- package/dist/DotplotView/components/ImportForm/util.js +1 -3
- package/dist/DotplotView/components/PanButtons.d.ts +1 -1
- package/dist/DotplotView/components/PanButtons.js +3 -4
- package/dist/DotplotView/components/WarningDialog.d.ts +6 -5
- package/dist/DotplotView/components/WarningDialog.js +10 -6
- package/dist/DotplotView/components/util.d.ts +2 -7
- package/dist/DotplotView/components/util.js +0 -5
- package/dist/DotplotView/index.d.ts +1 -1
- package/dist/DotplotView/index.js +0 -1
- package/dist/DotplotView/model.d.ts +5 -129
- package/dist/DotplotView/model.js +6 -192
- package/dist/DotplotView/svgcomponents/SVGBackground.js +1 -1
- package/dist/DotplotView/svgcomponents/SVGDotplotView.d.ts +1 -1
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js +5 -9
- package/dist/LaunchDotplotView.d.ts +1 -1
- package/dist/LaunchDotplotView.js +1 -4
- package/dist/ServerSideRenderedBlockContent.d.ts +2 -1
- package/dist/ServerSideRenderedBlockContent.js +2 -3
- package/dist/ServerSideSyntenyRendering.d.ts +0 -4
- package/dist/ServerSideSyntenyRendering.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -6
- package/dist/util.d.ts +1 -1
- package/esm/ComparativeRenderer/index.d.ts +3 -8
- package/esm/ComparativeRenderer/index.js +3 -8
- package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +1 -1
- package/esm/DotplotDisplay/components/DotplotDisplay.js +1 -1
- package/esm/DotplotDisplay/index.d.ts +1 -7
- package/esm/DotplotDisplay/index.js +2 -12
- package/esm/DotplotDisplay/renderDotplotBlock.d.ts +1 -1
- package/esm/DotplotDisplay/renderDotplotBlock.js +3 -6
- package/esm/DotplotDisplay/stateModelFactory.d.ts +7 -43
- package/esm/DotplotDisplay/stateModelFactory.js +56 -98
- package/esm/DotplotReadVsRef/DotplotReadVsRef.d.ts +2 -2
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js +15 -16
- package/esm/DotplotReadVsRef/index.d.ts +1 -1
- package/esm/DotplotReadVsRef/index.js +0 -2
- package/esm/DotplotRenderer/ComparativeRenderRpc.d.ts +3 -8
- package/esm/DotplotRenderer/ComparativeRenderRpc.js +3 -8
- package/esm/DotplotRenderer/DotplotRenderer.d.ts +5 -4
- package/esm/DotplotRenderer/DotplotRenderer.js +1 -2
- package/esm/DotplotRenderer/components/DotplotRendering.d.ts +1 -1
- package/esm/DotplotRenderer/configSchema.d.ts +0 -21
- package/esm/DotplotRenderer/configSchema.js +2 -27
- package/esm/DotplotRenderer/drawDotplot.d.ts +3 -3
- package/esm/DotplotRenderer/drawDotplot.js +4 -7
- package/esm/DotplotRenderer/index.d.ts +1 -1
- package/esm/DotplotRenderer/index.js +1 -1
- package/esm/DotplotView/1dview.d.ts +2 -77
- package/esm/DotplotView/1dview.js +4 -33
- package/esm/DotplotView/components/Axes.d.ts +1 -1
- package/esm/DotplotView/components/Axes.js +3 -4
- package/esm/DotplotView/components/CursorIcon.d.ts +1 -1
- package/esm/DotplotView/components/CursorIcon.js +1 -1
- package/esm/DotplotView/components/DotplotControls.d.ts +1 -1
- package/esm/DotplotView/components/DotplotControls.js +5 -6
- package/esm/DotplotView/components/DotplotTooltipClick.d.ts +1 -1
- package/esm/DotplotView/components/DotplotTooltipClick.js +1 -1
- package/esm/DotplotView/components/DotplotTooltipMouseover.d.ts +1 -1
- package/esm/DotplotView/components/DotplotTooltipMouseover.js +1 -1
- package/esm/DotplotView/components/DotplotView.d.ts +1 -1
- package/esm/DotplotView/components/DotplotView.js +6 -13
- package/esm/DotplotView/components/DotplotWarnings.d.ts +1 -1
- package/esm/DotplotView/components/DotplotWarnings.js +0 -1
- package/esm/DotplotView/components/ExportSvgDialog.d.ts +1 -1
- package/esm/DotplotView/components/ExportSvgDialog.js +2 -4
- package/esm/DotplotView/components/Grid.d.ts +1 -1
- package/esm/DotplotView/components/Grid.js +2 -4
- package/esm/DotplotView/components/Header.d.ts +1 -1
- package/esm/DotplotView/components/Header.js +2 -2
- package/esm/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +2 -2
- package/esm/DotplotView/components/ImportForm/ImportCustomTrack.js +2 -2
- package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +1 -1
- package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +6 -11
- package/esm/DotplotView/components/ImportForm/index.d.ts +1 -1
- package/esm/DotplotView/components/ImportForm/index.js +6 -7
- package/esm/DotplotView/components/ImportForm/util.js +1 -3
- package/esm/DotplotView/components/PanButtons.d.ts +1 -1
- package/esm/DotplotView/components/PanButtons.js +3 -4
- package/esm/DotplotView/components/WarningDialog.d.ts +6 -5
- package/esm/DotplotView/components/WarningDialog.js +10 -6
- package/esm/DotplotView/components/util.d.ts +2 -7
- package/esm/DotplotView/components/util.js +0 -5
- package/esm/DotplotView/index.d.ts +1 -1
- package/esm/DotplotView/index.js +0 -1
- package/esm/DotplotView/model.d.ts +5 -129
- package/esm/DotplotView/model.js +7 -193
- package/esm/DotplotView/svgcomponents/SVGBackground.js +1 -1
- package/esm/DotplotView/svgcomponents/SVGDotplotView.d.ts +1 -1
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js +5 -9
- package/esm/LaunchDotplotView.d.ts +1 -1
- package/esm/LaunchDotplotView.js +1 -4
- package/esm/ServerSideRenderedBlockContent.d.ts +2 -1
- package/esm/ServerSideRenderedBlockContent.js +2 -3
- package/esm/ServerSideSyntenyRendering.d.ts +0 -4
- package/esm/ServerSideSyntenyRendering.js +2 -2
- package/esm/index.d.ts +1 -1
- package/esm/index.js +3 -6
- package/esm/util.d.ts +1 -1
- package/package.json +2 -4
package/esm/DotplotView/model.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import { addDisposer, cast, getParent, getRoot, getSnapshot, resolveIdentifier, types, } from 'mobx-state-tree';
|
|
3
|
-
import { saveAs } from 'file-saver';
|
|
4
|
-
import { autorun, transaction } from 'mobx';
|
|
5
|
-
import { getParentRenderProps } from '@jbrowse/core/util/tracks';
|
|
6
|
-
import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel';
|
|
7
|
-
import { getSession, isSessionModelWithWidgets, minmax, measureText, max, localStorageGetItem, getTickDisplayStr, } from '@jbrowse/core/util';
|
|
8
2
|
import { getConf } from '@jbrowse/core/configuration';
|
|
9
|
-
import
|
|
10
|
-
// icons
|
|
3
|
+
import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel';
|
|
11
4
|
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons';
|
|
5
|
+
import { getSession, getTickDisplayStr, isSessionModelWithWidgets, localStorageGetItem, max, measureText, minmax, } from '@jbrowse/core/util';
|
|
6
|
+
import { getParentRenderProps } from '@jbrowse/core/util/tracks';
|
|
7
|
+
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
12
8
|
import FolderOpenIcon from '@mui/icons-material/FolderOpen';
|
|
13
9
|
import PhotoCameraIcon from '@mui/icons-material/PhotoCamera';
|
|
14
|
-
|
|
10
|
+
import { saveAs } from 'file-saver';
|
|
11
|
+
import { autorun, transaction } from 'mobx';
|
|
12
|
+
import { addDisposer, cast, getParent, getRoot, getSnapshot, resolveIdentifier, types, } from 'mobx-state-tree';
|
|
15
13
|
import { Dotplot1DView, DotplotHView, DotplotVView } from './1dview';
|
|
16
14
|
import { getBlockLabelKeysToHide, makeTicks } from './components/util';
|
|
17
|
-
// lazies
|
|
18
15
|
const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
|
|
19
16
|
const ReturnToImportFormDialog = lazy(() => import('@jbrowse/core/ui/ReturnToImportFormDialog'));
|
|
20
17
|
function stringLenPx(a) {
|
|
@@ -28,84 +25,28 @@ function pxWidthForBlocks(blocks, bpPerPx, hide) {
|
|
|
28
25
|
.map(b => stringLenPx(getTickDisplayStr(b.end, bpPerPx))),
|
|
29
26
|
]);
|
|
30
27
|
}
|
|
31
|
-
/**
|
|
32
|
-
* #stateModel DotplotView
|
|
33
|
-
* #category view
|
|
34
|
-
* extends
|
|
35
|
-
* - [BaseViewModel](../baseviewmodel)
|
|
36
|
-
*/
|
|
37
28
|
export default function stateModelFactory(pm) {
|
|
38
29
|
return types
|
|
39
30
|
.compose('DotplotView', BaseViewModel, types.model({
|
|
40
|
-
/**
|
|
41
|
-
* #property
|
|
42
|
-
*/
|
|
43
31
|
id: ElementId,
|
|
44
|
-
/**
|
|
45
|
-
* #property
|
|
46
|
-
*/
|
|
47
32
|
type: types.literal('DotplotView'),
|
|
48
|
-
/**
|
|
49
|
-
* #property
|
|
50
|
-
*/
|
|
51
33
|
height: 600,
|
|
52
|
-
/**
|
|
53
|
-
* #property
|
|
54
|
-
*/
|
|
55
34
|
borderSize: 20,
|
|
56
|
-
/**
|
|
57
|
-
* #property
|
|
58
|
-
*/
|
|
59
35
|
tickSize: 5,
|
|
60
|
-
/**
|
|
61
|
-
* #property
|
|
62
|
-
*/
|
|
63
36
|
vtextRotation: 0,
|
|
64
|
-
/**
|
|
65
|
-
* #property
|
|
66
|
-
*/
|
|
67
37
|
htextRotation: -90,
|
|
68
|
-
/**
|
|
69
|
-
* #property
|
|
70
|
-
*/
|
|
71
38
|
fontSize: 15,
|
|
72
|
-
/**
|
|
73
|
-
* #property
|
|
74
|
-
*/
|
|
75
39
|
trackSelectorType: 'hierarchical',
|
|
76
|
-
/**
|
|
77
|
-
* #property
|
|
78
|
-
*/
|
|
79
40
|
assemblyNames: types.array(types.string),
|
|
80
|
-
/**
|
|
81
|
-
* #property
|
|
82
|
-
*/
|
|
83
41
|
drawCigar: true,
|
|
84
|
-
/**
|
|
85
|
-
* #property
|
|
86
|
-
*/
|
|
87
42
|
hview: types.optional(DotplotHView, {}),
|
|
88
|
-
/**
|
|
89
|
-
* #property
|
|
90
|
-
*/
|
|
91
43
|
vview: types.optional(DotplotVView, {}),
|
|
92
|
-
/**
|
|
93
|
-
* #property
|
|
94
|
-
*/
|
|
95
44
|
tracks: types.array(pm.pluggableMstType('track', 'stateModel')),
|
|
96
|
-
/**
|
|
97
|
-
* #property
|
|
98
|
-
* this represents tracks specific to this view specifically used
|
|
99
|
-
* for read vs ref dotplots where this track would not really apply
|
|
100
|
-
* elsewhere
|
|
101
|
-
*/
|
|
102
45
|
viewTrackConfigs: types.array(pm.pluggableConfigSchemaType('track')),
|
|
103
46
|
}))
|
|
104
47
|
.volatile(() => ({
|
|
105
48
|
volatileWidth: undefined,
|
|
106
49
|
volatileError: undefined,
|
|
107
|
-
// these are 'personal preferences', stored in volatile and
|
|
108
|
-
// loaded/written to localStorage
|
|
109
50
|
cursorMode: localStorageGetItem('dotplot-cursorMode') || 'crosshair',
|
|
110
51
|
showPanButtons: Boolean(JSON.parse(localStorageGetItem('dotplot-showPanbuttons') || 'true')),
|
|
111
52
|
wheelMode: localStorageGetItem('dotplot-wheelMode') || 'zoom',
|
|
@@ -113,9 +54,6 @@ export default function stateModelFactory(pm) {
|
|
|
113
54
|
borderY: 100,
|
|
114
55
|
}))
|
|
115
56
|
.views(self => ({
|
|
116
|
-
/**
|
|
117
|
-
* #getter
|
|
118
|
-
*/
|
|
119
57
|
get width() {
|
|
120
58
|
if (!self.volatileWidth) {
|
|
121
59
|
throw new Error('width not initialized');
|
|
@@ -124,9 +62,6 @@ export default function stateModelFactory(pm) {
|
|
|
124
62
|
},
|
|
125
63
|
}))
|
|
126
64
|
.views(self => ({
|
|
127
|
-
/**
|
|
128
|
-
* #getter
|
|
129
|
-
*/
|
|
130
65
|
get assemblyErrors() {
|
|
131
66
|
const { assemblyManager } = getSession(self);
|
|
132
67
|
return self.assemblyNames
|
|
@@ -134,27 +69,18 @@ export default function stateModelFactory(pm) {
|
|
|
134
69
|
.filter(f => !!f)
|
|
135
70
|
.join(', ');
|
|
136
71
|
},
|
|
137
|
-
/**
|
|
138
|
-
* #getter
|
|
139
|
-
*/
|
|
140
72
|
get assembliesInitialized() {
|
|
141
73
|
const { assemblyManager } = getSession(self);
|
|
142
74
|
return self.assemblyNames.every(n => { var _a, _b; return (_b = (_a = assemblyManager.get(n)) === null || _a === void 0 ? void 0 : _a.initialized) !== null && _b !== void 0 ? _b : true; });
|
|
143
75
|
},
|
|
144
76
|
}))
|
|
145
77
|
.views(self => ({
|
|
146
|
-
/**
|
|
147
|
-
* #getter
|
|
148
|
-
*/
|
|
149
78
|
get initialized() {
|
|
150
79
|
return (self.volatileWidth !== undefined &&
|
|
151
80
|
self.hview.displayedRegions.length > 0 &&
|
|
152
81
|
self.vview.displayedRegions.length > 0 &&
|
|
153
82
|
self.assembliesInitialized);
|
|
154
83
|
},
|
|
155
|
-
/**
|
|
156
|
-
* #getter
|
|
157
|
-
*/
|
|
158
84
|
get hticks() {
|
|
159
85
|
const { hview } = self;
|
|
160
86
|
const { dynamicBlocks, staticBlocks, bpPerPx } = hview;
|
|
@@ -162,9 +88,6 @@ export default function stateModelFactory(pm) {
|
|
|
162
88
|
? []
|
|
163
89
|
: makeTicks(staticBlocks.contentBlocks, bpPerPx);
|
|
164
90
|
},
|
|
165
|
-
/**
|
|
166
|
-
* #getter
|
|
167
|
-
*/
|
|
168
91
|
get vticks() {
|
|
169
92
|
const { vview } = self;
|
|
170
93
|
const { dynamicBlocks, staticBlocks, bpPerPx } = vview;
|
|
@@ -172,33 +95,18 @@ export default function stateModelFactory(pm) {
|
|
|
172
95
|
? []
|
|
173
96
|
: makeTicks(staticBlocks.contentBlocks, bpPerPx);
|
|
174
97
|
},
|
|
175
|
-
/**
|
|
176
|
-
* #getter
|
|
177
|
-
*/
|
|
178
98
|
get loading() {
|
|
179
99
|
return self.assemblyNames.length > 0 && !this.initialized;
|
|
180
100
|
},
|
|
181
|
-
/**
|
|
182
|
-
* #getter
|
|
183
|
-
*/
|
|
184
101
|
get viewWidth() {
|
|
185
102
|
return self.width - self.borderX;
|
|
186
103
|
},
|
|
187
|
-
/**
|
|
188
|
-
* #getter
|
|
189
|
-
*/
|
|
190
104
|
get viewHeight() {
|
|
191
105
|
return self.height - self.borderY;
|
|
192
106
|
},
|
|
193
|
-
/**
|
|
194
|
-
* #getter
|
|
195
|
-
*/
|
|
196
107
|
get views() {
|
|
197
108
|
return [self.hview, self.vview];
|
|
198
109
|
},
|
|
199
|
-
/**
|
|
200
|
-
* #method
|
|
201
|
-
*/
|
|
202
110
|
renderProps() {
|
|
203
111
|
const session = getSession(self);
|
|
204
112
|
return {
|
|
@@ -209,89 +117,49 @@ export default function stateModelFactory(pm) {
|
|
|
209
117
|
},
|
|
210
118
|
}))
|
|
211
119
|
.actions(self => ({
|
|
212
|
-
/**
|
|
213
|
-
* #action
|
|
214
|
-
*/
|
|
215
120
|
setShowPanButtons(flag) {
|
|
216
121
|
self.showPanButtons = flag;
|
|
217
122
|
},
|
|
218
|
-
/**
|
|
219
|
-
* #action
|
|
220
|
-
*/
|
|
221
123
|
setWheelMode(str) {
|
|
222
124
|
self.wheelMode = str;
|
|
223
125
|
},
|
|
224
|
-
/**
|
|
225
|
-
* #action
|
|
226
|
-
*/
|
|
227
126
|
setCursorMode(str) {
|
|
228
127
|
self.cursorMode = str;
|
|
229
128
|
},
|
|
230
|
-
/**
|
|
231
|
-
* #action
|
|
232
|
-
*/
|
|
233
129
|
setDrawCigar(flag) {
|
|
234
130
|
self.drawCigar = flag;
|
|
235
131
|
},
|
|
236
|
-
/**
|
|
237
|
-
* #action
|
|
238
|
-
* returns to the import form
|
|
239
|
-
*/
|
|
240
132
|
clearView() {
|
|
241
133
|
self.hview.setDisplayedRegions([]);
|
|
242
134
|
self.vview.setDisplayedRegions([]);
|
|
243
135
|
self.assemblyNames = cast([]);
|
|
244
136
|
self.tracks.clear();
|
|
245
137
|
},
|
|
246
|
-
/**
|
|
247
|
-
* #action
|
|
248
|
-
*/
|
|
249
138
|
setBorderX(n) {
|
|
250
139
|
self.borderX = n;
|
|
251
140
|
},
|
|
252
|
-
/**
|
|
253
|
-
* #action
|
|
254
|
-
*/
|
|
255
141
|
setBorderY(n) {
|
|
256
142
|
self.borderY = n;
|
|
257
143
|
},
|
|
258
|
-
/**
|
|
259
|
-
* #action
|
|
260
|
-
*/
|
|
261
144
|
setWidth(newWidth) {
|
|
262
145
|
self.volatileWidth = newWidth;
|
|
263
146
|
return self.volatileWidth;
|
|
264
147
|
},
|
|
265
|
-
/**
|
|
266
|
-
* #action
|
|
267
|
-
*/
|
|
268
148
|
setHeight(newHeight) {
|
|
269
149
|
self.height = newHeight;
|
|
270
150
|
return self.height;
|
|
271
151
|
},
|
|
272
|
-
/**
|
|
273
|
-
* #action
|
|
274
|
-
*/
|
|
275
152
|
setError(e) {
|
|
276
153
|
self.volatileError = e;
|
|
277
154
|
},
|
|
278
|
-
/**
|
|
279
|
-
* #action
|
|
280
|
-
*/
|
|
281
155
|
zoomOut() {
|
|
282
156
|
self.hview.zoomOut();
|
|
283
157
|
self.vview.zoomOut();
|
|
284
158
|
},
|
|
285
|
-
/**
|
|
286
|
-
* #action
|
|
287
|
-
*/
|
|
288
159
|
zoomIn() {
|
|
289
160
|
self.hview.zoomIn();
|
|
290
161
|
self.vview.zoomIn();
|
|
291
162
|
},
|
|
292
|
-
/**
|
|
293
|
-
* #action
|
|
294
|
-
*/
|
|
295
163
|
activateTrackSelector() {
|
|
296
164
|
if (self.trackSelectorType === 'hierarchical') {
|
|
297
165
|
const session = getSession(self);
|
|
@@ -303,9 +171,6 @@ export default function stateModelFactory(pm) {
|
|
|
303
171
|
}
|
|
304
172
|
throw new Error(`invalid track selector type ${self.trackSelectorType}`);
|
|
305
173
|
},
|
|
306
|
-
/**
|
|
307
|
-
* #action
|
|
308
|
-
*/
|
|
309
174
|
showTrack(trackId, initialSnapshot = {}) {
|
|
310
175
|
const schema = pm.pluggableConfigSchemaType('track');
|
|
311
176
|
const conf = resolveIdentifier(schema, getRoot(self), trackId);
|
|
@@ -326,9 +191,6 @@ export default function stateModelFactory(pm) {
|
|
|
326
191
|
});
|
|
327
192
|
self.tracks.push(track);
|
|
328
193
|
},
|
|
329
|
-
/**
|
|
330
|
-
* #action
|
|
331
|
-
*/
|
|
332
194
|
hideTrack(trackId) {
|
|
333
195
|
const schema = pm.pluggableConfigSchemaType('track');
|
|
334
196
|
const conf = resolveIdentifier(schema, getRoot(self), trackId);
|
|
@@ -338,9 +200,6 @@ export default function stateModelFactory(pm) {
|
|
|
338
200
|
});
|
|
339
201
|
return t.length;
|
|
340
202
|
},
|
|
341
|
-
/**
|
|
342
|
-
* #action
|
|
343
|
-
*/
|
|
344
203
|
toggleTrack(trackId) {
|
|
345
204
|
const hiddenCount = this.hideTrack(trackId);
|
|
346
205
|
if (!hiddenCount) {
|
|
@@ -349,22 +208,13 @@ export default function stateModelFactory(pm) {
|
|
|
349
208
|
}
|
|
350
209
|
return false;
|
|
351
210
|
},
|
|
352
|
-
/**
|
|
353
|
-
* #action
|
|
354
|
-
*/
|
|
355
211
|
setAssemblyNames(target, query) {
|
|
356
212
|
self.assemblyNames = cast([target, query]);
|
|
357
213
|
},
|
|
358
|
-
/**
|
|
359
|
-
* #action
|
|
360
|
-
*/
|
|
361
214
|
setViews(arr) {
|
|
362
215
|
self.hview = cast(arr[0]);
|
|
363
216
|
self.vview = cast(arr[1]);
|
|
364
217
|
},
|
|
365
|
-
/**
|
|
366
|
-
* #action
|
|
367
|
-
*/
|
|
368
218
|
getCoords(mousedown, mouseup) {
|
|
369
219
|
const [xmin, xmax] = minmax(mouseup[0], mousedown[0]);
|
|
370
220
|
const [ymin, ymax] = minmax(mouseup[1], mousedown[1]);
|
|
@@ -377,10 +227,6 @@ export default function stateModelFactory(pm) {
|
|
|
377
227
|
]
|
|
378
228
|
: undefined;
|
|
379
229
|
},
|
|
380
|
-
/**
|
|
381
|
-
* #action
|
|
382
|
-
* zooms into clicked and dragged region
|
|
383
|
-
*/
|
|
384
230
|
zoomInToMouseCoords(mousedown, mouseup) {
|
|
385
231
|
const result = this.getCoords(mousedown, mouseup);
|
|
386
232
|
if (result) {
|
|
@@ -389,19 +235,12 @@ export default function stateModelFactory(pm) {
|
|
|
389
235
|
self.vview.moveTo(y2, y1);
|
|
390
236
|
}
|
|
391
237
|
},
|
|
392
|
-
/**
|
|
393
|
-
* #action
|
|
394
|
-
*/
|
|
395
238
|
showAllRegions() {
|
|
396
239
|
self.hview.zoomTo(self.hview.maxBpPerPx);
|
|
397
240
|
self.vview.zoomTo(self.vview.maxBpPerPx);
|
|
398
241
|
self.vview.center();
|
|
399
242
|
self.hview.center();
|
|
400
243
|
},
|
|
401
|
-
/**
|
|
402
|
-
* #action
|
|
403
|
-
* creates a linear synteny view from the clicked and dragged region
|
|
404
|
-
*/
|
|
405
244
|
onDotplotView(mousedown, mouseup) {
|
|
406
245
|
const result = this.getCoords(mousedown, mouseup);
|
|
407
246
|
if (result) {
|
|
@@ -423,9 +262,6 @@ export default function stateModelFactory(pm) {
|
|
|
423
262
|
d2.moveTo(y2, y1);
|
|
424
263
|
d1.zoomTo(d1.bpPerPx / (self.width / self.hview.width), 0);
|
|
425
264
|
d2.zoomTo(d2.bpPerPx / (self.width / self.vview.width), 0);
|
|
426
|
-
// add the specific evidence tracks to the LGVs in the split view
|
|
427
|
-
// note: scales the bpPerPx by scaling proportional of the dotplot
|
|
428
|
-
// width to the eventual lgv width
|
|
429
265
|
const tracks = self.tracks
|
|
430
266
|
.map(track => track.configuration.displays.find((display) => display.type === 'LinearSyntenyDisplay'))
|
|
431
267
|
.filter(f => !!f)
|
|
@@ -464,17 +300,12 @@ export default function stateModelFactory(pm) {
|
|
|
464
300
|
},
|
|
465
301
|
}))
|
|
466
302
|
.actions(self => ({
|
|
467
|
-
/**
|
|
468
|
-
* #action
|
|
469
|
-
* creates an svg export and save using FileSaver
|
|
470
|
-
*/
|
|
471
303
|
async exportSvg(opts = {}) {
|
|
472
304
|
const { renderToSvg } = await import('./svgcomponents/SVGDotplotView');
|
|
473
305
|
const html = await renderToSvg(self, opts);
|
|
474
306
|
const blob = new Blob([html], { type: 'image/svg+xml' });
|
|
475
307
|
saveAs(blob, opts.filename || 'image.svg');
|
|
476
308
|
},
|
|
477
|
-
// if any of our assemblies are temporary assemblies
|
|
478
309
|
beforeDestroy() {
|
|
479
310
|
var _a;
|
|
480
311
|
const session = getSession(self);
|
|
@@ -494,13 +325,10 @@ export default function stateModelFactory(pm) {
|
|
|
494
325
|
}));
|
|
495
326
|
addDisposer(self, autorun(() => {
|
|
496
327
|
const session = getSession(self);
|
|
497
|
-
// don't operate if width not set yet
|
|
498
328
|
if (self.volatileWidth === undefined ||
|
|
499
329
|
!self.assembliesInitialized) {
|
|
500
330
|
return;
|
|
501
331
|
}
|
|
502
|
-
// also don't operate if displayedRegions already set, this is a
|
|
503
|
-
// helper autorun to load regions from assembly
|
|
504
332
|
if (self.hview.displayedRegions.length > 0 &&
|
|
505
333
|
self.vview.displayedRegions.length > 0) {
|
|
506
334
|
return;
|
|
@@ -516,7 +344,6 @@ export default function stateModelFactory(pm) {
|
|
|
516
344
|
});
|
|
517
345
|
}, { delay: 1000 }));
|
|
518
346
|
addDisposer(self, autorun(function borderSetter() {
|
|
519
|
-
// make sure we have a width on the view before trying to load
|
|
520
347
|
if (self.volatileWidth === undefined) {
|
|
521
348
|
return;
|
|
522
349
|
}
|
|
@@ -530,14 +357,10 @@ export default function stateModelFactory(pm) {
|
|
|
530
357
|
const hhide = getBlockLabelKeysToHide(hblocks, viewWidth, hoffset);
|
|
531
358
|
const by = pxWidthForBlocks(hblocks, vview.bpPerPx, hhide);
|
|
532
359
|
const bx = pxWidthForBlocks(vblocks, hview.bpPerPx, vhide);
|
|
533
|
-
// these are set via autorun to avoid dependency cycle
|
|
534
360
|
self.setBorderY(Math.max(by + padding, 50));
|
|
535
361
|
self.setBorderX(Math.max(bx + padding, 50));
|
|
536
362
|
}));
|
|
537
363
|
},
|
|
538
|
-
/**
|
|
539
|
-
* #action
|
|
540
|
-
*/
|
|
541
364
|
squareView() {
|
|
542
365
|
const { hview, vview } = self;
|
|
543
366
|
const avg = (hview.bpPerPx + vview.bpPerPx) / 2;
|
|
@@ -548,9 +371,6 @@ export default function stateModelFactory(pm) {
|
|
|
548
371
|
vview.setBpPerPx(avg);
|
|
549
372
|
vview.centerAt(vpx.coord, vpx.refName, vpx.index);
|
|
550
373
|
},
|
|
551
|
-
/**
|
|
552
|
-
* #action
|
|
553
|
-
*/
|
|
554
374
|
squareViewProportional() {
|
|
555
375
|
const { hview, vview } = self;
|
|
556
376
|
const ratio = hview.width / vview.width;
|
|
@@ -564,9 +384,6 @@ export default function stateModelFactory(pm) {
|
|
|
564
384
|
},
|
|
565
385
|
}))
|
|
566
386
|
.views(self => ({
|
|
567
|
-
/**
|
|
568
|
-
* #method
|
|
569
|
-
*/
|
|
570
387
|
menuItems() {
|
|
571
388
|
const session = getSession(self);
|
|
572
389
|
return [
|
|
@@ -619,9 +436,6 @@ export default function stateModelFactory(pm) {
|
|
|
619
436
|
: []),
|
|
620
437
|
];
|
|
621
438
|
},
|
|
622
|
-
/**
|
|
623
|
-
* #getter
|
|
624
|
-
*/
|
|
625
439
|
get error() {
|
|
626
440
|
return self.volatileError || self.assemblyErrors;
|
|
627
441
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useTheme } from '@mui/material';
|
|
3
2
|
import { stripAlpha } from '@jbrowse/core/util';
|
|
3
|
+
import { useTheme } from '@mui/material';
|
|
4
4
|
export default function SVGBackground({ width, height, }) {
|
|
5
5
|
const theme = useTheme();
|
|
6
6
|
return (React.createElement("rect", { x: 0, y: 0, width: width, height: height, fill: stripAlpha(theme.palette.background.default) }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DotplotViewModel, ExportSvgOptions } from '../model';
|
|
1
|
+
import type { DotplotViewModel, ExportSvgOptions } from '../model';
|
|
2
2
|
export declare function renderToSvg(model: DotplotViewModel, opts: ExportSvgOptions): Promise<string>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
3
3
|
import { getSession, renderToStaticMarkup } from '@jbrowse/core/util';
|
|
4
4
|
import { ThemeProvider } from '@mui/material';
|
|
5
|
-
import {
|
|
5
|
+
import { when } from 'mobx';
|
|
6
6
|
import { getRoot } from 'mobx-state-tree';
|
|
7
|
-
import { GridRaw } from '../components/Grid';
|
|
8
|
-
import { HorizontalAxisRaw, VerticalAxisRaw } from '../components/Axes';
|
|
9
7
|
import SVGBackground from './SVGBackground';
|
|
10
|
-
|
|
8
|
+
import { HorizontalAxisRaw, VerticalAxisRaw } from '../components/Axes';
|
|
9
|
+
import { GridRaw } from '../components/Grid';
|
|
11
10
|
export async function renderToSvg(model, opts) {
|
|
12
11
|
var _a;
|
|
13
12
|
await when(() => model.initialized);
|
|
@@ -23,7 +22,6 @@ export async function renderToSvg(model, opts) {
|
|
|
23
22
|
return { track, result: await display.renderSvg({ ...opts, theme }) };
|
|
24
23
|
}));
|
|
25
24
|
const w = width + shift * 2;
|
|
26
|
-
// the xlink namespace is used for rendering <image> tag
|
|
27
25
|
return renderToStaticMarkup(React.createElement(ThemeProvider, { theme: createJBrowseTheme(theme) },
|
|
28
26
|
React.createElement(Wrapper, null,
|
|
29
27
|
React.createElement("svg", { width: width, height: height, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w, height].toString() },
|
|
@@ -34,9 +32,7 @@ export async function renderToSvg(model, opts) {
|
|
|
34
32
|
React.createElement("defs", null,
|
|
35
33
|
React.createElement("clipPath", { id: "clip-ruler" },
|
|
36
34
|
React.createElement("rect", { x: 0, y: 0, width: viewWidth, height: viewHeight }))),
|
|
37
|
-
React.createElement("g", { clipPath: "url(#clip-ruler)" }, displayResults.map(({ result }, i) => (
|
|
38
|
-
/* biome-ignore lint/suspicious/noArrayIndexKey: */
|
|
39
|
-
React.createElement("g", { key: i }, result))))),
|
|
35
|
+
React.createElement("g", { clipPath: "url(#clip-ruler)" }, displayResults.map(({ result }, i) => (React.createElement("g", { key: i }, result))))),
|
|
40
36
|
React.createElement("g", { transform: `translate(${borderX} ${viewHeight})` },
|
|
41
37
|
React.createElement(HorizontalAxisRaw, { model: model }))))), createRootFn);
|
|
42
38
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function LaunchDotplotView(pluginManager: PluginManager): void;
|
package/esm/LaunchDotplotView.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { transaction } from 'mobx';
|
|
2
2
|
export default function LaunchDotplotView(pluginManager) {
|
|
3
|
-
pluginManager.addToExtensionPoint('LaunchView-DotplotView',
|
|
4
|
-
// @ts-expect-error
|
|
5
|
-
async ({ session, views, tracks = [], }) => {
|
|
3
|
+
pluginManager.addToExtensionPoint('LaunchView-DotplotView', async ({ session, views, tracks = [], }) => {
|
|
6
4
|
try {
|
|
7
5
|
const model = session.addView('DotplotView', {});
|
|
8
6
|
const assemblyNames = views.map(view => view.assembly);
|
|
@@ -13,7 +11,6 @@ export default function LaunchDotplotView(pluginManager) {
|
|
|
13
11
|
]);
|
|
14
12
|
model.setAssemblyNames(assemblyNames[0], assemblyNames[1]);
|
|
15
13
|
});
|
|
16
|
-
// http://localhost:3000/?config=test_data%2Fvolvox%2Fconfig.json&session=spec-{"views":[{"type":"DotplotView","views":[{"assembly":"volvox"},{"assembly":"volvox"}],"tracks":["volvox_fake_synteny"]}]}
|
|
17
14
|
const idsNotFound = [];
|
|
18
15
|
tracks.forEach(track => {
|
|
19
16
|
tryTrack(model, track, idsNotFound);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { makeStyles } from 'tss-react/mui';
|
|
3
|
-
import { Typography } from '@mui/material';
|
|
4
2
|
import { LoadingEllipses } from '@jbrowse/core/ui';
|
|
3
|
+
import { Typography } from '@mui/material';
|
|
5
4
|
import { observer } from 'mobx-react';
|
|
5
|
+
import { makeStyles } from 'tss-react/mui';
|
|
6
6
|
const useStyles = makeStyles()(theme => {
|
|
7
7
|
const bg = theme.palette.action.disabledBackground;
|
|
8
8
|
return {
|
|
@@ -24,7 +24,6 @@ const useStyles = makeStyles()(theme => {
|
|
|
24
24
|
};
|
|
25
25
|
});
|
|
26
26
|
function LoadingMessage() {
|
|
27
|
-
// only show the loading message after 300ms to prevent excessive flickering
|
|
28
27
|
const [shown, setShown] = useState(false);
|
|
29
28
|
const { classes } = useStyles();
|
|
30
29
|
useEffect(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useRef, useState
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
2
|
import { drawImageOntoCanvasContext } from '@jbrowse/core/util/offscreenCanvasPonyfill';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
4
|
const ServerSideSyntenyRendering = observer(function ({ model, }) {
|
|
5
5
|
const { imageData, style, renderProps } = model;
|
|
6
6
|
const { width, height, highResolutionScaling = 1 } = renderProps;
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
3
|
export default class DotplotPlugin extends Plugin {
|
|
4
4
|
name: string;
|
|
5
5
|
install(pluginManager: PluginManager): void;
|
package/esm/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
2
|
import { isAbstractMenuManager } from '@jbrowse/core/util';
|
|
3
|
-
// icons
|
|
4
3
|
import TimelineIcon from '@mui/icons-material/Timeline';
|
|
5
|
-
|
|
6
|
-
import DotplotViewF from './DotplotView';
|
|
4
|
+
import ComparativeRenderer from './ComparativeRenderer';
|
|
7
5
|
import DotplotDisplayF from './DotplotDisplay';
|
|
6
|
+
import DotplotReadVsRefMenuItem from './DotplotReadVsRef';
|
|
8
7
|
import DotplotRendererF from './DotplotRenderer';
|
|
8
|
+
import DotplotViewF from './DotplotView';
|
|
9
9
|
import LaunchDotplotViewF from './LaunchDotplotView';
|
|
10
|
-
import ComparativeRenderer from './ComparativeRenderer';
|
|
11
|
-
import DotplotReadVsRefMenuItem from './DotplotReadVsRef';
|
|
12
10
|
export default class DotplotPlugin extends Plugin {
|
|
13
11
|
constructor() {
|
|
14
12
|
super(...arguments);
|
|
@@ -20,7 +18,6 @@ export default class DotplotPlugin extends Plugin {
|
|
|
20
18
|
DotplotRendererF(pluginManager);
|
|
21
19
|
LaunchDotplotViewF(pluginManager);
|
|
22
20
|
DotplotReadVsRefMenuItem(pluginManager);
|
|
23
|
-
// install our comparative rendering rpc callback
|
|
24
21
|
pluginManager.addRpcMethod(() => new ComparativeRenderer(pluginManager));
|
|
25
22
|
}
|
|
26
23
|
configure(pluginManager) {
|
package/esm/util.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-dotplot-view",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "JBrowse 2 dotplot view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -36,11 +36,9 @@
|
|
|
36
36
|
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@floating-ui/react": "^0.26.3",
|
|
40
39
|
"@mui/icons-material": "^6.0.0",
|
|
41
40
|
"@mui/x-data-grid": "^7.0.0",
|
|
42
41
|
"@types/file-saver": "^2.0.1",
|
|
43
|
-
"clone": "^2.1.2",
|
|
44
42
|
"file-saver": "^2.0.0"
|
|
45
43
|
},
|
|
46
44
|
"peerDependencies": {
|
|
@@ -61,5 +59,5 @@
|
|
|
61
59
|
"publishConfig": {
|
|
62
60
|
"access": "public"
|
|
63
61
|
},
|
|
64
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
|
|
65
63
|
}
|