@jbrowse/plugin-dotplot-view 2.17.0 → 3.0.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 +2 -3
- package/dist/DotplotDisplay/components/DotplotDisplay.js +7 -12
- 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 +8 -45
- package/dist/DotplotDisplay/stateModelFactory.js +57 -100
- 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 +8 -7
- package/dist/DotplotRenderer/DotplotRenderer.js +18 -9
- package/dist/DotplotRenderer/components/DotplotRendering.d.ts +2 -3
- package/dist/DotplotRenderer/components/DotplotRendering.js +2 -5
- 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 +5 -6
- package/dist/DotplotView/components/Axes.js +26 -40
- package/dist/DotplotView/components/CursorIcon.d.ts +3 -4
- package/dist/DotplotView/components/CursorIcon.js +3 -5
- package/dist/DotplotView/components/DotplotControls.d.ts +2 -3
- package/dist/DotplotView/components/DotplotControls.js +94 -97
- package/dist/DotplotView/components/DotplotTooltipClick.d.ts +2 -3
- package/dist/DotplotView/components/DotplotTooltipClick.js +3 -7
- package/dist/DotplotView/components/DotplotTooltipMouseover.d.ts +2 -3
- package/dist/DotplotView/components/DotplotTooltipMouseover.js +4 -8
- package/dist/DotplotView/components/DotplotView.d.ts +2 -3
- package/dist/DotplotView/components/DotplotView.js +80 -92
- package/dist/DotplotView/components/DotplotWarnings.d.ts +2 -3
- package/dist/DotplotView/components/DotplotWarnings.js +26 -21
- package/dist/DotplotView/components/ExportSvgDialog.d.ts +2 -3
- package/dist/DotplotView/components/ExportSvgDialog.js +32 -67
- package/dist/DotplotView/components/Grid.d.ts +3 -4
- package/dist/DotplotView/components/Grid.js +19 -32
- package/dist/DotplotView/components/Header.d.ts +2 -3
- package/dist/DotplotView/components/Header.js +4 -23
- package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +7 -0
- package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +129 -0
- package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +4 -6
- package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +17 -48
- package/dist/DotplotView/components/ImportForm/TrackSelector.d.ts +7 -0
- package/dist/DotplotView/components/ImportForm/TrackSelector.js +23 -0
- package/dist/DotplotView/components/ImportForm/getAdapter.d.ts +117 -0
- package/dist/DotplotView/components/ImportForm/getAdapter.js +68 -0
- package/dist/DotplotView/components/ImportForm/index.d.ts +3 -4
- package/dist/DotplotView/components/ImportForm/index.js +47 -97
- package/dist/DotplotView/components/ImportForm/util.js +1 -3
- package/dist/DotplotView/components/PanButtons.d.ts +2 -3
- package/dist/DotplotView/components/PanButtons.js +17 -36
- package/dist/DotplotView/components/WarningDialog.d.ts +7 -7
- package/dist/DotplotView/components/WarningDialog.js +12 -15
- 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 +17 -8
- package/dist/DotplotView/model.d.ts +11 -133
- package/dist/DotplotView/model.js +46 -222
- package/dist/DotplotView/svgcomponents/SVGBackground.d.ts +1 -2
- package/dist/DotplotView/svgcomponents/SVGBackground.js +3 -6
- package/dist/DotplotView/svgcomponents/SVGDotplotView.d.ts +1 -1
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js +6 -24
- package/dist/DotplotView/types.d.ts +12 -0
- package/dist/DotplotView/types.js +2 -0
- package/dist/LaunchDotplotView.d.ts +1 -1
- package/dist/LaunchDotplotView.js +1 -4
- package/dist/ServerSideRenderedBlockContent.d.ts +2 -2
- package/dist/ServerSideRenderedBlockContent.js +11 -37
- package/dist/ServerSideSyntenyRendering.d.ts +1 -6
- package/dist/ServerSideSyntenyRendering.js +4 -26
- 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 +2 -3
- package/esm/DotplotDisplay/components/DotplotDisplay.js +7 -9
- 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 +8 -45
- package/esm/DotplotDisplay/stateModelFactory.js +58 -101
- 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 +8 -7
- package/esm/DotplotRenderer/DotplotRenderer.js +1 -2
- package/esm/DotplotRenderer/components/DotplotRendering.d.ts +2 -3
- package/esm/DotplotRenderer/components/DotplotRendering.js +2 -2
- 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 +5 -6
- package/esm/DotplotView/components/Axes.js +26 -37
- package/esm/DotplotView/components/CursorIcon.d.ts +3 -4
- package/esm/DotplotView/components/CursorIcon.js +3 -5
- package/esm/DotplotView/components/DotplotControls.d.ts +2 -3
- package/esm/DotplotView/components/DotplotControls.js +94 -97
- package/esm/DotplotView/components/DotplotTooltipClick.d.ts +2 -3
- package/esm/DotplotView/components/DotplotTooltipClick.js +3 -7
- package/esm/DotplotView/components/DotplotTooltipMouseover.d.ts +2 -3
- package/esm/DotplotView/components/DotplotTooltipMouseover.js +4 -8
- package/esm/DotplotView/components/DotplotView.d.ts +2 -3
- package/esm/DotplotView/components/DotplotView.js +63 -85
- package/esm/DotplotView/components/DotplotWarnings.d.ts +2 -3
- package/esm/DotplotView/components/DotplotWarnings.js +9 -14
- package/esm/DotplotView/components/ExportSvgDialog.d.ts +2 -3
- package/esm/DotplotView/components/ExportSvgDialog.js +32 -44
- package/esm/DotplotView/components/Grid.d.ts +3 -4
- package/esm/DotplotView/components/Grid.js +19 -29
- package/esm/DotplotView/components/Header.d.ts +2 -3
- package/esm/DotplotView/components/Header.js +4 -23
- package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +7 -0
- package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +124 -0
- package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +4 -6
- package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +17 -25
- package/esm/DotplotView/components/ImportForm/TrackSelector.d.ts +7 -0
- package/esm/DotplotView/components/ImportForm/TrackSelector.js +18 -0
- package/esm/DotplotView/components/ImportForm/getAdapter.d.ts +117 -0
- package/esm/DotplotView/components/ImportForm/getAdapter.js +65 -0
- package/esm/DotplotView/components/ImportForm/index.d.ts +3 -4
- package/esm/DotplotView/components/ImportForm/index.js +48 -75
- package/esm/DotplotView/components/ImportForm/util.js +1 -3
- package/esm/DotplotView/components/PanButtons.d.ts +2 -3
- package/esm/DotplotView/components/PanButtons.js +17 -36
- package/esm/DotplotView/components/WarningDialog.d.ts +7 -7
- package/esm/DotplotView/components/WarningDialog.js +12 -12
- 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 +11 -133
- package/esm/DotplotView/model.js +30 -216
- package/esm/DotplotView/svgcomponents/SVGBackground.d.ts +1 -2
- package/esm/DotplotView/svgcomponents/SVGBackground.js +3 -3
- package/esm/DotplotView/svgcomponents/SVGDotplotView.d.ts +1 -1
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js +6 -24
- package/esm/DotplotView/types.d.ts +12 -0
- package/esm/DotplotView/types.js +1 -0
- package/esm/LaunchDotplotView.d.ts +1 -1
- package/esm/LaunchDotplotView.js +1 -4
- package/esm/ServerSideRenderedBlockContent.d.ts +2 -2
- package/esm/ServerSideRenderedBlockContent.js +11 -14
- package/esm/ServerSideSyntenyRendering.d.ts +1 -6
- package/esm/ServerSideSyntenyRendering.js +4 -3
- 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/dist/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +0 -11
- package/dist/DotplotView/components/ImportForm/ImportCustomTrack.js +0 -194
- package/esm/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +0 -11
- package/esm/DotplotView/components/ImportForm/ImportCustomTrack.js +0 -169
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, localStorageGetBoolean, 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, observable, 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,94 +25,47 @@ 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
|
-
showPanButtons:
|
|
51
|
+
showPanButtons: localStorageGetBoolean('dotplot-showPanbuttons', true),
|
|
111
52
|
wheelMode: localStorageGetItem('dotplot-wheelMode') || 'zoom',
|
|
112
53
|
borderX: 100,
|
|
113
54
|
borderY: 100,
|
|
55
|
+
importFormSyntenyTrackSelections: observable.array(),
|
|
56
|
+
}))
|
|
57
|
+
.actions(self => ({
|
|
58
|
+
importFormRemoveRow(idx) {
|
|
59
|
+
self.importFormSyntenyTrackSelections.splice(idx, 1);
|
|
60
|
+
},
|
|
61
|
+
clearImportFormSyntenyTracks() {
|
|
62
|
+
self.importFormSyntenyTrackSelections.clear();
|
|
63
|
+
},
|
|
64
|
+
setImportFormSyntenyTrack(arg, val) {
|
|
65
|
+
self.importFormSyntenyTrackSelections[arg] = val;
|
|
66
|
+
},
|
|
114
67
|
}))
|
|
115
68
|
.views(self => ({
|
|
116
|
-
/**
|
|
117
|
-
* #getter
|
|
118
|
-
*/
|
|
119
69
|
get width() {
|
|
120
70
|
if (!self.volatileWidth) {
|
|
121
71
|
throw new Error('width not initialized');
|
|
@@ -124,9 +74,6 @@ export default function stateModelFactory(pm) {
|
|
|
124
74
|
},
|
|
125
75
|
}))
|
|
126
76
|
.views(self => ({
|
|
127
|
-
/**
|
|
128
|
-
* #getter
|
|
129
|
-
*/
|
|
130
77
|
get assemblyErrors() {
|
|
131
78
|
const { assemblyManager } = getSession(self);
|
|
132
79
|
return self.assemblyNames
|
|
@@ -134,27 +81,18 @@ export default function stateModelFactory(pm) {
|
|
|
134
81
|
.filter(f => !!f)
|
|
135
82
|
.join(', ');
|
|
136
83
|
},
|
|
137
|
-
/**
|
|
138
|
-
* #getter
|
|
139
|
-
*/
|
|
140
84
|
get assembliesInitialized() {
|
|
141
85
|
const { assemblyManager } = getSession(self);
|
|
142
86
|
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
87
|
},
|
|
144
88
|
}))
|
|
145
89
|
.views(self => ({
|
|
146
|
-
/**
|
|
147
|
-
* #getter
|
|
148
|
-
*/
|
|
149
90
|
get initialized() {
|
|
150
91
|
return (self.volatileWidth !== undefined &&
|
|
151
92
|
self.hview.displayedRegions.length > 0 &&
|
|
152
93
|
self.vview.displayedRegions.length > 0 &&
|
|
153
94
|
self.assembliesInitialized);
|
|
154
95
|
},
|
|
155
|
-
/**
|
|
156
|
-
* #getter
|
|
157
|
-
*/
|
|
158
96
|
get hticks() {
|
|
159
97
|
const { hview } = self;
|
|
160
98
|
const { dynamicBlocks, staticBlocks, bpPerPx } = hview;
|
|
@@ -162,9 +100,6 @@ export default function stateModelFactory(pm) {
|
|
|
162
100
|
? []
|
|
163
101
|
: makeTicks(staticBlocks.contentBlocks, bpPerPx);
|
|
164
102
|
},
|
|
165
|
-
/**
|
|
166
|
-
* #getter
|
|
167
|
-
*/
|
|
168
103
|
get vticks() {
|
|
169
104
|
const { vview } = self;
|
|
170
105
|
const { dynamicBlocks, staticBlocks, bpPerPx } = vview;
|
|
@@ -172,33 +107,18 @@ export default function stateModelFactory(pm) {
|
|
|
172
107
|
? []
|
|
173
108
|
: makeTicks(staticBlocks.contentBlocks, bpPerPx);
|
|
174
109
|
},
|
|
175
|
-
/**
|
|
176
|
-
* #getter
|
|
177
|
-
*/
|
|
178
110
|
get loading() {
|
|
179
111
|
return self.assemblyNames.length > 0 && !this.initialized;
|
|
180
112
|
},
|
|
181
|
-
/**
|
|
182
|
-
* #getter
|
|
183
|
-
*/
|
|
184
113
|
get viewWidth() {
|
|
185
114
|
return self.width - self.borderX;
|
|
186
115
|
},
|
|
187
|
-
/**
|
|
188
|
-
* #getter
|
|
189
|
-
*/
|
|
190
116
|
get viewHeight() {
|
|
191
117
|
return self.height - self.borderY;
|
|
192
118
|
},
|
|
193
|
-
/**
|
|
194
|
-
* #getter
|
|
195
|
-
*/
|
|
196
119
|
get views() {
|
|
197
120
|
return [self.hview, self.vview];
|
|
198
121
|
},
|
|
199
|
-
/**
|
|
200
|
-
* #method
|
|
201
|
-
*/
|
|
202
122
|
renderProps() {
|
|
203
123
|
const session = getSession(self);
|
|
204
124
|
return {
|
|
@@ -209,89 +129,49 @@ export default function stateModelFactory(pm) {
|
|
|
209
129
|
},
|
|
210
130
|
}))
|
|
211
131
|
.actions(self => ({
|
|
212
|
-
/**
|
|
213
|
-
* #action
|
|
214
|
-
*/
|
|
215
132
|
setShowPanButtons(flag) {
|
|
216
133
|
self.showPanButtons = flag;
|
|
217
134
|
},
|
|
218
|
-
/**
|
|
219
|
-
* #action
|
|
220
|
-
*/
|
|
221
135
|
setWheelMode(str) {
|
|
222
136
|
self.wheelMode = str;
|
|
223
137
|
},
|
|
224
|
-
/**
|
|
225
|
-
* #action
|
|
226
|
-
*/
|
|
227
138
|
setCursorMode(str) {
|
|
228
139
|
self.cursorMode = str;
|
|
229
140
|
},
|
|
230
|
-
/**
|
|
231
|
-
* #action
|
|
232
|
-
*/
|
|
233
141
|
setDrawCigar(flag) {
|
|
234
142
|
self.drawCigar = flag;
|
|
235
143
|
},
|
|
236
|
-
/**
|
|
237
|
-
* #action
|
|
238
|
-
* returns to the import form
|
|
239
|
-
*/
|
|
240
144
|
clearView() {
|
|
241
145
|
self.hview.setDisplayedRegions([]);
|
|
242
146
|
self.vview.setDisplayedRegions([]);
|
|
243
147
|
self.assemblyNames = cast([]);
|
|
244
148
|
self.tracks.clear();
|
|
245
149
|
},
|
|
246
|
-
/**
|
|
247
|
-
* #action
|
|
248
|
-
*/
|
|
249
150
|
setBorderX(n) {
|
|
250
151
|
self.borderX = n;
|
|
251
152
|
},
|
|
252
|
-
/**
|
|
253
|
-
* #action
|
|
254
|
-
*/
|
|
255
153
|
setBorderY(n) {
|
|
256
154
|
self.borderY = n;
|
|
257
155
|
},
|
|
258
|
-
/**
|
|
259
|
-
* #action
|
|
260
|
-
*/
|
|
261
156
|
setWidth(newWidth) {
|
|
262
157
|
self.volatileWidth = newWidth;
|
|
263
158
|
return self.volatileWidth;
|
|
264
159
|
},
|
|
265
|
-
/**
|
|
266
|
-
* #action
|
|
267
|
-
*/
|
|
268
160
|
setHeight(newHeight) {
|
|
269
161
|
self.height = newHeight;
|
|
270
162
|
return self.height;
|
|
271
163
|
},
|
|
272
|
-
/**
|
|
273
|
-
* #action
|
|
274
|
-
*/
|
|
275
164
|
setError(e) {
|
|
276
165
|
self.volatileError = e;
|
|
277
166
|
},
|
|
278
|
-
/**
|
|
279
|
-
* #action
|
|
280
|
-
*/
|
|
281
167
|
zoomOut() {
|
|
282
168
|
self.hview.zoomOut();
|
|
283
169
|
self.vview.zoomOut();
|
|
284
170
|
},
|
|
285
|
-
/**
|
|
286
|
-
* #action
|
|
287
|
-
*/
|
|
288
171
|
zoomIn() {
|
|
289
172
|
self.hview.zoomIn();
|
|
290
173
|
self.vview.zoomIn();
|
|
291
174
|
},
|
|
292
|
-
/**
|
|
293
|
-
* #action
|
|
294
|
-
*/
|
|
295
175
|
activateTrackSelector() {
|
|
296
176
|
if (self.trackSelectorType === 'hierarchical') {
|
|
297
177
|
const session = getSession(self);
|
|
@@ -303,9 +183,6 @@ export default function stateModelFactory(pm) {
|
|
|
303
183
|
}
|
|
304
184
|
throw new Error(`invalid track selector type ${self.trackSelectorType}`);
|
|
305
185
|
},
|
|
306
|
-
/**
|
|
307
|
-
* #action
|
|
308
|
-
*/
|
|
309
186
|
showTrack(trackId, initialSnapshot = {}) {
|
|
310
187
|
const schema = pm.pluggableConfigSchemaType('track');
|
|
311
188
|
const conf = resolveIdentifier(schema, getRoot(self), trackId);
|
|
@@ -326,9 +203,6 @@ export default function stateModelFactory(pm) {
|
|
|
326
203
|
});
|
|
327
204
|
self.tracks.push(track);
|
|
328
205
|
},
|
|
329
|
-
/**
|
|
330
|
-
* #action
|
|
331
|
-
*/
|
|
332
206
|
hideTrack(trackId) {
|
|
333
207
|
const schema = pm.pluggableConfigSchemaType('track');
|
|
334
208
|
const conf = resolveIdentifier(schema, getRoot(self), trackId);
|
|
@@ -338,9 +212,6 @@ export default function stateModelFactory(pm) {
|
|
|
338
212
|
});
|
|
339
213
|
return t.length;
|
|
340
214
|
},
|
|
341
|
-
/**
|
|
342
|
-
* #action
|
|
343
|
-
*/
|
|
344
215
|
toggleTrack(trackId) {
|
|
345
216
|
const hiddenCount = this.hideTrack(trackId);
|
|
346
217
|
if (!hiddenCount) {
|
|
@@ -349,22 +220,13 @@ export default function stateModelFactory(pm) {
|
|
|
349
220
|
}
|
|
350
221
|
return false;
|
|
351
222
|
},
|
|
352
|
-
/**
|
|
353
|
-
* #action
|
|
354
|
-
*/
|
|
355
223
|
setAssemblyNames(target, query) {
|
|
356
224
|
self.assemblyNames = cast([target, query]);
|
|
357
225
|
},
|
|
358
|
-
/**
|
|
359
|
-
* #action
|
|
360
|
-
*/
|
|
361
226
|
setViews(arr) {
|
|
362
227
|
self.hview = cast(arr[0]);
|
|
363
228
|
self.vview = cast(arr[1]);
|
|
364
229
|
},
|
|
365
|
-
/**
|
|
366
|
-
* #action
|
|
367
|
-
*/
|
|
368
230
|
getCoords(mousedown, mouseup) {
|
|
369
231
|
const [xmin, xmax] = minmax(mouseup[0], mousedown[0]);
|
|
370
232
|
const [ymin, ymax] = minmax(mouseup[1], mousedown[1]);
|
|
@@ -377,10 +239,6 @@ export default function stateModelFactory(pm) {
|
|
|
377
239
|
]
|
|
378
240
|
: undefined;
|
|
379
241
|
},
|
|
380
|
-
/**
|
|
381
|
-
* #action
|
|
382
|
-
* zooms into clicked and dragged region
|
|
383
|
-
*/
|
|
384
242
|
zoomInToMouseCoords(mousedown, mouseup) {
|
|
385
243
|
const result = this.getCoords(mousedown, mouseup);
|
|
386
244
|
if (result) {
|
|
@@ -389,19 +247,12 @@ export default function stateModelFactory(pm) {
|
|
|
389
247
|
self.vview.moveTo(y2, y1);
|
|
390
248
|
}
|
|
391
249
|
},
|
|
392
|
-
/**
|
|
393
|
-
* #action
|
|
394
|
-
*/
|
|
395
250
|
showAllRegions() {
|
|
396
251
|
self.hview.zoomTo(self.hview.maxBpPerPx);
|
|
397
252
|
self.vview.zoomTo(self.vview.maxBpPerPx);
|
|
398
253
|
self.vview.center();
|
|
399
254
|
self.hview.center();
|
|
400
255
|
},
|
|
401
|
-
/**
|
|
402
|
-
* #action
|
|
403
|
-
* creates a linear synteny view from the clicked and dragged region
|
|
404
|
-
*/
|
|
405
256
|
onDotplotView(mousedown, mouseup) {
|
|
406
257
|
const result = this.getCoords(mousedown, mouseup);
|
|
407
258
|
if (result) {
|
|
@@ -423,9 +274,6 @@ export default function stateModelFactory(pm) {
|
|
|
423
274
|
d2.moveTo(y2, y1);
|
|
424
275
|
d1.zoomTo(d1.bpPerPx / (self.width / self.hview.width), 0);
|
|
425
276
|
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
277
|
const tracks = self.tracks
|
|
430
278
|
.map(track => track.configuration.displays.find((display) => display.type === 'LinearSyntenyDisplay'))
|
|
431
279
|
.filter(f => !!f)
|
|
@@ -464,21 +312,16 @@ export default function stateModelFactory(pm) {
|
|
|
464
312
|
},
|
|
465
313
|
}))
|
|
466
314
|
.actions(self => ({
|
|
467
|
-
/**
|
|
468
|
-
* #action
|
|
469
|
-
* creates an svg export and save using FileSaver
|
|
470
|
-
*/
|
|
471
315
|
async exportSvg(opts = {}) {
|
|
472
316
|
const { renderToSvg } = await import('./svgcomponents/SVGDotplotView');
|
|
473
317
|
const html = await renderToSvg(self, opts);
|
|
474
318
|
const blob = new Blob([html], { type: 'image/svg+xml' });
|
|
475
319
|
saveAs(blob, opts.filename || 'image.svg');
|
|
476
320
|
},
|
|
477
|
-
// if any of our assemblies are temporary assemblies
|
|
478
321
|
beforeDestroy() {
|
|
479
322
|
var _a;
|
|
480
323
|
const session = getSession(self);
|
|
481
|
-
for (const name
|
|
324
|
+
for (const name of self.assemblyNames) {
|
|
482
325
|
(_a = session.removeTemporaryAssembly) === null || _a === void 0 ? void 0 : _a.call(session, name);
|
|
483
326
|
}
|
|
484
327
|
},
|
|
@@ -494,13 +337,10 @@ export default function stateModelFactory(pm) {
|
|
|
494
337
|
}));
|
|
495
338
|
addDisposer(self, autorun(() => {
|
|
496
339
|
const session = getSession(self);
|
|
497
|
-
// don't operate if width not set yet
|
|
498
340
|
if (self.volatileWidth === undefined ||
|
|
499
341
|
!self.assembliesInitialized) {
|
|
500
342
|
return;
|
|
501
343
|
}
|
|
502
|
-
// also don't operate if displayedRegions already set, this is a
|
|
503
|
-
// helper autorun to load regions from assembly
|
|
504
344
|
if (self.hview.displayedRegions.length > 0 &&
|
|
505
345
|
self.vview.displayedRegions.length > 0) {
|
|
506
346
|
return;
|
|
@@ -516,7 +356,6 @@ export default function stateModelFactory(pm) {
|
|
|
516
356
|
});
|
|
517
357
|
}, { delay: 1000 }));
|
|
518
358
|
addDisposer(self, autorun(function borderSetter() {
|
|
519
|
-
// make sure we have a width on the view before trying to load
|
|
520
359
|
if (self.volatileWidth === undefined) {
|
|
521
360
|
return;
|
|
522
361
|
}
|
|
@@ -530,14 +369,10 @@ export default function stateModelFactory(pm) {
|
|
|
530
369
|
const hhide = getBlockLabelKeysToHide(hblocks, viewWidth, hoffset);
|
|
531
370
|
const by = pxWidthForBlocks(hblocks, vview.bpPerPx, hhide);
|
|
532
371
|
const bx = pxWidthForBlocks(vblocks, hview.bpPerPx, vhide);
|
|
533
|
-
// these are set via autorun to avoid dependency cycle
|
|
534
372
|
self.setBorderY(Math.max(by + padding, 50));
|
|
535
373
|
self.setBorderX(Math.max(bx + padding, 50));
|
|
536
374
|
}));
|
|
537
375
|
},
|
|
538
|
-
/**
|
|
539
|
-
* #action
|
|
540
|
-
*/
|
|
541
376
|
squareView() {
|
|
542
377
|
const { hview, vview } = self;
|
|
543
378
|
const avg = (hview.bpPerPx + vview.bpPerPx) / 2;
|
|
@@ -548,9 +383,6 @@ export default function stateModelFactory(pm) {
|
|
|
548
383
|
vview.setBpPerPx(avg);
|
|
549
384
|
vview.centerAt(vpx.coord, vpx.refName, vpx.index);
|
|
550
385
|
},
|
|
551
|
-
/**
|
|
552
|
-
* #action
|
|
553
|
-
*/
|
|
554
386
|
squareViewProportional() {
|
|
555
387
|
const { hview, vview } = self;
|
|
556
388
|
const ratio = hview.width / vview.width;
|
|
@@ -564,39 +396,21 @@ export default function stateModelFactory(pm) {
|
|
|
564
396
|
},
|
|
565
397
|
}))
|
|
566
398
|
.views(self => ({
|
|
567
|
-
/**
|
|
568
|
-
* #method
|
|
569
|
-
*/
|
|
570
399
|
menuItems() {
|
|
571
400
|
const session = getSession(self);
|
|
572
401
|
return [
|
|
573
402
|
{
|
|
574
403
|
label: 'Return to import form',
|
|
404
|
+
icon: FolderOpenIcon,
|
|
575
405
|
onClick: () => {
|
|
576
406
|
getSession(self).queueDialog(handleClose => [
|
|
577
407
|
ReturnToImportFormDialog,
|
|
578
|
-
{
|
|
408
|
+
{
|
|
409
|
+
model: self,
|
|
410
|
+
handleClose,
|
|
411
|
+
},
|
|
579
412
|
]);
|
|
580
413
|
},
|
|
581
|
-
icon: FolderOpenIcon,
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
label: 'Square view - same bp per pixel',
|
|
585
|
-
onClick: () => {
|
|
586
|
-
self.squareView();
|
|
587
|
-
},
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
label: 'Rectangular view - same total bp',
|
|
591
|
-
onClick: () => {
|
|
592
|
-
self.squareView();
|
|
593
|
-
},
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
label: 'Show all regions',
|
|
597
|
-
onClick: () => {
|
|
598
|
-
self.showAllRegions();
|
|
599
|
-
},
|
|
600
414
|
},
|
|
601
415
|
{
|
|
602
416
|
label: 'Export SVG',
|
|
@@ -604,7 +418,10 @@ export default function stateModelFactory(pm) {
|
|
|
604
418
|
onClick: () => {
|
|
605
419
|
getSession(self).queueDialog(handleClose => [
|
|
606
420
|
ExportSvgDialog,
|
|
607
|
-
{
|
|
421
|
+
{
|
|
422
|
+
model: self,
|
|
423
|
+
handleClose,
|
|
424
|
+
},
|
|
608
425
|
]);
|
|
609
426
|
},
|
|
610
427
|
},
|
|
@@ -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,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useTheme } from '@mui/material';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
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
|
-
return (
|
|
6
|
+
return (_jsx("rect", { x: 0, y: 0, width: width, height: height, fill: stripAlpha(theme.palette.background.default) }));
|
|
7
7
|
}
|
|
@@ -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,18 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 {
|
|
6
|
-
import { getRoot } from 'mobx-state-tree';
|
|
7
|
-
import { GridRaw } from '../components/Grid';
|
|
8
|
-
import { HorizontalAxisRaw, VerticalAxisRaw } from '../components/Axes';
|
|
5
|
+
import { when } from 'mobx';
|
|
9
6
|
import SVGBackground from './SVGBackground';
|
|
10
|
-
|
|
7
|
+
import { HorizontalAxisRaw, VerticalAxisRaw } from '../components/Axes';
|
|
8
|
+
import { GridRaw } from '../components/Grid';
|
|
11
9
|
export async function renderToSvg(model, opts) {
|
|
12
10
|
var _a;
|
|
13
11
|
await when(() => model.initialized);
|
|
14
12
|
const { themeName = 'default', Wrapper = ({ children }) => children } = opts;
|
|
15
|
-
const { createRootFn } = getRoot(model);
|
|
16
13
|
const session = getSession(model);
|
|
17
14
|
const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
|
|
18
15
|
const { width, borderX, viewWidth, viewHeight, tracks, height } = model;
|
|
@@ -23,20 +20,5 @@ export async function renderToSvg(model, opts) {
|
|
|
23
20
|
return { track, result: await display.renderSvg({ ...opts, theme }) };
|
|
24
21
|
}));
|
|
25
22
|
const w = width + shift * 2;
|
|
26
|
-
|
|
27
|
-
return renderToStaticMarkup(React.createElement(ThemeProvider, { theme: createJBrowseTheme(theme) },
|
|
28
|
-
React.createElement(Wrapper, null,
|
|
29
|
-
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() },
|
|
30
|
-
React.createElement(SVGBackground, { width: w, height: height }),
|
|
31
|
-
React.createElement(VerticalAxisRaw, { model: model }),
|
|
32
|
-
React.createElement("g", { transform: `translate(${borderX} 0)` },
|
|
33
|
-
React.createElement(GridRaw, { model: model }),
|
|
34
|
-
React.createElement("defs", null,
|
|
35
|
-
React.createElement("clipPath", { id: "clip-ruler" },
|
|
36
|
-
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))))),
|
|
40
|
-
React.createElement("g", { transform: `translate(${borderX} ${viewHeight})` },
|
|
41
|
-
React.createElement(HorizontalAxisRaw, { model: model }))))), createRootFn);
|
|
23
|
+
return renderToStaticMarkup(_jsx(ThemeProvider, { theme: createJBrowseTheme(theme), children: _jsx(Wrapper, { children: _jsxs("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(), children: [_jsx(SVGBackground, { width: w, height: height }), _jsx(VerticalAxisRaw, { model: model }), _jsxs("g", { transform: `translate(${borderX} 0)`, children: [_jsx(GridRaw, { model: model }), _jsx("defs", { children: _jsx("clipPath", { id: "clip-ruler", children: _jsx("rect", { x: 0, y: 0, width: viewWidth, height: viewHeight }) }) }), _jsx("g", { clipPath: "url(#clip-ruler)", children: displayResults.map(({ result }, i) => (_jsx("g", { children: result }, i))) })] }), _jsx("g", { transform: `translate(${borderX} ${viewHeight})`, children: _jsx(HorizontalAxisRaw, { model: model }) })] }) }) }));
|
|
42
24
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
+
import type { SnapshotIn } from 'mobx-state-tree';
|
|
3
|
+
export type Conf = SnapshotIn<AnyConfigurationModel>;
|
|
4
|
+
export type ImportFormSyntenyTrack = {
|
|
5
|
+
type: 'preConfigured';
|
|
6
|
+
value: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'userOpened';
|
|
9
|
+
value: Conf;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'none';
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
2
|
declare const ServerSideRenderedDotplotContent: ({ model, style, }: {
|
|
3
3
|
model: {
|
|
4
4
|
error?: unknown;
|
|
@@ -8,5 +8,5 @@ declare const ServerSideRenderedDotplotContent: ({ model, style, }: {
|
|
|
8
8
|
reactElement?: React.ReactElement;
|
|
9
9
|
};
|
|
10
10
|
style: CSSProperties;
|
|
11
|
-
}) =>
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
12
|
export default ServerSideRenderedDotplotContent;
|