@jbrowse/plugin-sv-inspector 3.7.0 → 4.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/esm/LaunchSvInspectorView/index.js +6 -13
- package/esm/SvInspectorView/BreakpointSplitViewChoiceDialog.d.ts +1 -0
- package/esm/SvInspectorView/BreakpointSplitViewChoiceDialog.js +1 -0
- package/esm/SvInspectorView/components/CircularViewOptions.d.ts +1 -1
- package/esm/SvInspectorView/components/CircularViewOptions.js +2 -2
- package/esm/SvInspectorView/components/SvInspectorView.d.ts +1 -1
- package/esm/SvInspectorView/components/SvInspectorView.js +3 -6
- package/esm/SvInspectorView/index.js +24 -22
- package/esm/SvInspectorView/model.d.ts +201 -365
- package/esm/SvInspectorView/model.js +41 -10
- package/esm/index.js +3 -6
- package/package.json +27 -33
- package/dist/LaunchSvInspectorView/index.d.ts +0 -2
- package/dist/LaunchSvInspectorView/index.js +0 -21
- package/dist/SvInspectorView/components/CircularViewOptions.d.ts +0 -5
- package/dist/SvInspectorView/components/CircularViewOptions.js +0 -18
- package/dist/SvInspectorView/components/SvInspectorView.d.ts +0 -5
- package/dist/SvInspectorView/components/SvInspectorView.js +0 -44
- package/dist/SvInspectorView/index.d.ts +0 -2
- package/dist/SvInspectorView/index.js +0 -79
- package/dist/SvInspectorView/model.d.ts +0 -766
- package/dist/SvInspectorView/model.js +0 -208
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -32
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
7
|
-
const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
8
|
-
const util_1 = require("@jbrowse/core/util");
|
|
9
|
-
const mst_1 = require("@jbrowse/core/util/types/mst");
|
|
10
|
-
const FolderOpen_1 = __importDefault(require("@mui/icons-material/FolderOpen"));
|
|
11
|
-
const mobx_1 = require("mobx");
|
|
12
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
13
|
-
function SvInspectorViewF(pluginManager) {
|
|
14
|
-
const SpreadsheetViewType = pluginManager.getViewType('SpreadsheetView');
|
|
15
|
-
const CircularViewType = pluginManager.getViewType('CircularView');
|
|
16
|
-
const SpreadsheetModel = SpreadsheetViewType.stateModel;
|
|
17
|
-
const CircularModel = CircularViewType.stateModel;
|
|
18
|
-
const minHeight = 400;
|
|
19
|
-
const defaultHeight = 550;
|
|
20
|
-
const headerHeight = 52;
|
|
21
|
-
const circularViewOptionsBarHeight = 52;
|
|
22
|
-
return mobx_state_tree_1.types
|
|
23
|
-
.compose('SvInspectorView', models_1.BaseViewModel, mobx_state_tree_1.types.model({
|
|
24
|
-
id: mst_1.ElementId,
|
|
25
|
-
type: mobx_state_tree_1.types.literal('SvInspectorView'),
|
|
26
|
-
height: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, defaultHeight),
|
|
27
|
-
onlyDisplayRelevantRegionsInCircularView: false,
|
|
28
|
-
spreadsheetView: mobx_state_tree_1.types.optional(SpreadsheetModel, () => SpreadsheetModel.create({
|
|
29
|
-
type: 'SpreadsheetView',
|
|
30
|
-
hideVerticalResizeHandle: true,
|
|
31
|
-
})),
|
|
32
|
-
circularView: mobx_state_tree_1.types.optional(CircularModel, () => CircularModel.create({
|
|
33
|
-
type: 'CircularView',
|
|
34
|
-
hideVerticalResizeHandle: true,
|
|
35
|
-
hideTrackSelectorButton: true,
|
|
36
|
-
disableImportForm: true,
|
|
37
|
-
})),
|
|
38
|
-
}))
|
|
39
|
-
.volatile(() => ({
|
|
40
|
-
width: 800,
|
|
41
|
-
SpreadsheetViewReactComponent: SpreadsheetViewType.ReactComponent,
|
|
42
|
-
CircularViewReactComponent: CircularViewType.ReactComponent,
|
|
43
|
-
circularViewOptionsBarHeight,
|
|
44
|
-
}))
|
|
45
|
-
.views(self => ({
|
|
46
|
-
get assemblyName() {
|
|
47
|
-
const { assembly } = self.spreadsheetView;
|
|
48
|
-
return assembly
|
|
49
|
-
? (0, configuration_1.readConfObject)(assembly, 'name')
|
|
50
|
-
: undefined;
|
|
51
|
-
},
|
|
52
|
-
get showCircularView() {
|
|
53
|
-
var _a;
|
|
54
|
-
return !!((_a = self.spreadsheetView.spreadsheet) === null || _a === void 0 ? void 0 : _a.rowSet);
|
|
55
|
-
},
|
|
56
|
-
get features() {
|
|
57
|
-
var _a, _b;
|
|
58
|
-
return (((_b = structuredClone((_a = self.spreadsheetView.spreadsheet) === null || _a === void 0 ? void 0 : _a.visibleRows)) === null || _b === void 0 ? void 0 : _b.map(row => row.feature).filter(f => !!f)) || []);
|
|
59
|
-
},
|
|
60
|
-
get featuresAdapterConfigSnapshot() {
|
|
61
|
-
return {
|
|
62
|
-
type: 'FromConfigAdapter',
|
|
63
|
-
features: this.features,
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
get featureRefNames() {
|
|
67
|
-
return [
|
|
68
|
-
...new Set([
|
|
69
|
-
...this.features.map(r => r.refName),
|
|
70
|
-
...this.features.flatMap(r => { var _a; return (_a = r.INFO) === null || _a === void 0 ? void 0 : _a.CHR2; }),
|
|
71
|
-
...this.features.flatMap(r => { var _a; return (_a = r.mate) === null || _a === void 0 ? void 0 : _a.refName; }),
|
|
72
|
-
].filter(f => !!f)),
|
|
73
|
-
];
|
|
74
|
-
},
|
|
75
|
-
get currentAssembly() {
|
|
76
|
-
const { assemblyManager } = (0, util_1.getSession)(self);
|
|
77
|
-
return this.assemblyName
|
|
78
|
-
? assemblyManager.get(this.assemblyName)
|
|
79
|
-
: undefined;
|
|
80
|
-
},
|
|
81
|
-
get canonicalFeatureRefNameSet() {
|
|
82
|
-
const asm = this.currentAssembly;
|
|
83
|
-
return new Set((asm === null || asm === void 0 ? void 0 : asm.initialized)
|
|
84
|
-
? this.featureRefNames.map(r => asm.getCanonicalRefName(r) || r)
|
|
85
|
-
: []);
|
|
86
|
-
},
|
|
87
|
-
get featuresCircularTrackConfiguration() {
|
|
88
|
-
return {
|
|
89
|
-
type: 'VariantTrack',
|
|
90
|
-
trackId: `sv-inspector-variant-track-${self.id}`,
|
|
91
|
-
name: 'features from tabular data',
|
|
92
|
-
adapter: this.featuresAdapterConfigSnapshot,
|
|
93
|
-
assemblyNames: [this.assemblyName],
|
|
94
|
-
displays: [
|
|
95
|
-
{
|
|
96
|
-
type: 'ChordVariantDisplay',
|
|
97
|
-
displayId: `sv-inspector-variant-track-chord-display-${self.id}`,
|
|
98
|
-
onChordClick: 'jexl:defaultOnChordClick(feature, track, pluginManager)',
|
|
99
|
-
renderer: {
|
|
100
|
-
type: 'StructuralVariantChordRenderer',
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
}))
|
|
107
|
-
.actions(self => ({
|
|
108
|
-
setWidth(newWidth) {
|
|
109
|
-
self.width = newWidth;
|
|
110
|
-
},
|
|
111
|
-
setHeight(newHeight) {
|
|
112
|
-
self.height = Math.max(newHeight, minHeight);
|
|
113
|
-
return self.height;
|
|
114
|
-
},
|
|
115
|
-
setDisplayedRegions(regions) {
|
|
116
|
-
self.circularView.setDisplayedRegions(regions);
|
|
117
|
-
},
|
|
118
|
-
setOnlyDisplayRelevantRegionsInCircularView(val) {
|
|
119
|
-
self.onlyDisplayRelevantRegionsInCircularView = val;
|
|
120
|
-
},
|
|
121
|
-
}))
|
|
122
|
-
.views(self => ({
|
|
123
|
-
menuItems() {
|
|
124
|
-
return [
|
|
125
|
-
{
|
|
126
|
-
label: 'Return to import form',
|
|
127
|
-
icon: FolderOpen_1.default,
|
|
128
|
-
onClick: () => {
|
|
129
|
-
self.spreadsheetView.displaySpreadsheet(undefined);
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
},
|
|
134
|
-
}))
|
|
135
|
-
.actions(self => ({
|
|
136
|
-
resizeHeight(distance) {
|
|
137
|
-
const oldHeight = self.height;
|
|
138
|
-
const newHeight = self.setHeight(self.height + distance);
|
|
139
|
-
return newHeight - oldHeight;
|
|
140
|
-
},
|
|
141
|
-
afterAttach() {
|
|
142
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
143
|
-
const borderWidth = 1;
|
|
144
|
-
if (self.showCircularView) {
|
|
145
|
-
const spreadsheetWidth = Math.round(self.width * 0.66);
|
|
146
|
-
const circularViewWidth = self.width - spreadsheetWidth;
|
|
147
|
-
self.spreadsheetView.setWidth(spreadsheetWidth - borderWidth);
|
|
148
|
-
self.circularView.setWidth(circularViewWidth);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
self.spreadsheetView.setWidth(self.width);
|
|
152
|
-
}
|
|
153
|
-
}, { name: 'SvInspectorView width binding' }));
|
|
154
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
155
|
-
self.spreadsheetView.setHeight(self.height - headerHeight);
|
|
156
|
-
self.circularView.setHeight(self.height - headerHeight - circularViewOptionsBarHeight);
|
|
157
|
-
}, {
|
|
158
|
-
name: 'SvInspectorView height binding',
|
|
159
|
-
}));
|
|
160
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
|
|
161
|
-
const { onlyDisplayRelevantRegionsInCircularView, circularView, canonicalFeatureRefNameSet, currentAssembly, } = self;
|
|
162
|
-
if (!circularView.initialized || !(currentAssembly === null || currentAssembly === void 0 ? void 0 : currentAssembly.regions)) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
else if (onlyDisplayRelevantRegionsInCircularView) {
|
|
166
|
-
if (circularView.tracks.length === 1) {
|
|
167
|
-
try {
|
|
168
|
-
circularView.setDisplayedRegions(structuredClone(currentAssembly.regions.filter(r => canonicalFeatureRefNameSet.has(r.refName))));
|
|
169
|
-
}
|
|
170
|
-
catch (e) {
|
|
171
|
-
console.error(e);
|
|
172
|
-
(0, util_1.getSession)(self).notifyError(`${e}`, e);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
circularView.setDisplayedRegions(currentAssembly.regions);
|
|
178
|
-
}
|
|
179
|
-
}, { name: 'SvInspectorView displayed regions bind' }));
|
|
180
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.reaction)(() => ({
|
|
181
|
-
generatedTrackConf: self.featuresCircularTrackConfiguration,
|
|
182
|
-
assemblyName: self.assemblyName,
|
|
183
|
-
}), data => {
|
|
184
|
-
if (!data) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const { assemblyName, generatedTrackConf } = data;
|
|
188
|
-
const { circularView } = self;
|
|
189
|
-
for (const t of circularView.tracks) {
|
|
190
|
-
circularView.hideTrack(t.configuration.trackId);
|
|
191
|
-
}
|
|
192
|
-
if (assemblyName) {
|
|
193
|
-
circularView.addTrackConf(generatedTrackConf, {
|
|
194
|
-
assemblyName,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}, {
|
|
198
|
-
name: 'SvInspectorView track configuration binding',
|
|
199
|
-
fireImmediately: true,
|
|
200
|
-
}));
|
|
201
|
-
},
|
|
202
|
-
}))
|
|
203
|
-
.postProcessSnapshot(snap => {
|
|
204
|
-
const { circularView, ...rest } = snap;
|
|
205
|
-
return rest;
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
exports.default = SvInspectorViewF;
|
package/dist/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
|
-
export default class SvInspectorViewPlugin extends Plugin {
|
|
4
|
-
name: string;
|
|
5
|
-
install(pluginManager: PluginManager): void;
|
|
6
|
-
configure(pluginManager: PluginManager): void;
|
|
7
|
-
}
|
package/dist/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
|
|
7
|
-
const types_1 = require("@jbrowse/core/util/types");
|
|
8
|
-
const TableChart_1 = __importDefault(require("@mui/icons-material/TableChart"));
|
|
9
|
-
const LaunchSvInspectorView_1 = __importDefault(require("./LaunchSvInspectorView"));
|
|
10
|
-
const SvInspectorView_1 = __importDefault(require("./SvInspectorView"));
|
|
11
|
-
class SvInspectorViewPlugin extends Plugin_1.default {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.name = 'SvInspectorViewPlugin';
|
|
15
|
-
}
|
|
16
|
-
install(pluginManager) {
|
|
17
|
-
(0, SvInspectorView_1.default)(pluginManager);
|
|
18
|
-
(0, LaunchSvInspectorView_1.default)(pluginManager);
|
|
19
|
-
}
|
|
20
|
-
configure(pluginManager) {
|
|
21
|
-
if ((0, types_1.isAbstractMenuManager)(pluginManager.rootModel)) {
|
|
22
|
-
pluginManager.rootModel.appendToSubMenu(['Add'], {
|
|
23
|
-
label: 'SV inspector',
|
|
24
|
-
icon: TableChart_1.default,
|
|
25
|
-
onClick: (session) => {
|
|
26
|
-
session.addView('SvInspectorView', {});
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.default = SvInspectorViewPlugin;
|