@jbrowse/plugin-sv-inspector 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/LaunchSvInspectorView/index.d.ts +3 -0
- package/dist/LaunchSvInspectorView/index.js +27 -0
- package/dist/LaunchSvInspectorView/index.js.map +1 -0
- package/dist/SvInspectorView/components/CircularViewOptions.d.ts +6 -0
- package/dist/SvInspectorView/components/CircularViewOptions.js +22 -0
- package/dist/SvInspectorView/components/CircularViewOptions.js.map +1 -0
- package/dist/SvInspectorView/components/SvInspectorView.d.ts +6 -0
- package/dist/SvInspectorView/components/SvInspectorView.js +51 -0
- package/dist/SvInspectorView/components/SvInspectorView.js.map +1 -0
- package/dist/SvInspectorView/index.d.ts +3 -0
- package/dist/SvInspectorView/index.js +35 -0
- package/dist/SvInspectorView/index.js.map +1 -0
- package/dist/SvInspectorView/models/SvInspectorView.d.ts +881 -0
- package/dist/SvInspectorView/models/SvInspectorView.js +317 -0
- package/dist/SvInspectorView/models/SvInspectorView.js.map +1 -0
- package/dist/SvInspectorView/models/adhocFeatureUtils.d.ts +44 -0
- package/dist/SvInspectorView/models/adhocFeatureUtils.js +97 -0
- package/dist/SvInspectorView/models/adhocFeatureUtils.js.map +1 -0
- package/dist/SvInspectorView/models/breakpointSplitViewFromTableRow.d.ts +4 -0
- package/dist/SvInspectorView/models/breakpointSplitViewFromTableRow.js +49 -0
- package/dist/SvInspectorView/models/breakpointSplitViewFromTableRow.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/esm/LaunchSvInspectorView/index.d.ts +3 -0
- package/esm/LaunchSvInspectorView/index.js +25 -0
- package/esm/LaunchSvInspectorView/index.js.map +1 -0
- package/esm/SvInspectorView/components/CircularViewOptions.d.ts +6 -0
- package/esm/SvInspectorView/components/CircularViewOptions.js +17 -0
- package/esm/SvInspectorView/components/CircularViewOptions.js.map +1 -0
- package/esm/SvInspectorView/components/SvInspectorView.d.ts +6 -0
- package/esm/SvInspectorView/components/SvInspectorView.js +46 -0
- package/esm/SvInspectorView/components/SvInspectorView.js.map +1 -0
- package/esm/SvInspectorView/index.d.ts +3 -0
- package/esm/SvInspectorView/index.js +30 -0
- package/esm/SvInspectorView/index.js.map +1 -0
- package/esm/SvInspectorView/models/SvInspectorView.d.ts +881 -0
- package/esm/SvInspectorView/models/SvInspectorView.js +312 -0
- package/esm/SvInspectorView/models/SvInspectorView.js.map +1 -0
- package/esm/SvInspectorView/models/adhocFeatureUtils.d.ts +44 -0
- package/esm/SvInspectorView/models/adhocFeatureUtils.js +90 -0
- package/esm/SvInspectorView/models/adhocFeatureUtils.js.map +1 -0
- package/esm/SvInspectorView/models/breakpointSplitViewFromTableRow.d.ts +4 -0
- package/esm/SvInspectorView/models/breakpointSplitViewFromTableRow.js +42 -0
- package/esm/SvInspectorView/models/breakpointSplitViewFromTableRow.js.map +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +29 -0
- package/esm/index.js.map +1 -0
- package/package.json +62 -0
- package/src/LaunchSvInspectorView/index.ts +41 -0
- package/src/SvInspectorView/components/CircularViewOptions.tsx +47 -0
- package/src/SvInspectorView/components/SvInspectorView.tsx +81 -0
- package/src/SvInspectorView/index.ts +41 -0
- package/src/SvInspectorView/models/SvInspectorView.ts +406 -0
- package/src/SvInspectorView/models/adhocFeatureUtils.js +152 -0
- package/src/SvInspectorView/models/breakpointSplitViewFromTableRow.js +84 -0
- package/src/index.ts +34 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import clone from 'clone';
|
|
2
|
+
import { autorun, reaction } from 'mobx';
|
|
3
|
+
import { types, getParent, addDisposer } from 'mobx-state-tree';
|
|
4
|
+
import { getSession } from '@jbrowse/core/util';
|
|
5
|
+
import { readConfObject } from '@jbrowse/core/configuration';
|
|
6
|
+
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
7
|
+
import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
8
|
+
// icons
|
|
9
|
+
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
10
|
+
import FolderOpenIcon from '@mui/icons-material/FolderOpen';
|
|
11
|
+
// locals
|
|
12
|
+
import { canOpenBreakpointSplitViewFromTableRow, openBreakpointSplitViewFromTableRow, getFeatureForRow, } from './breakpointSplitViewFromTableRow';
|
|
13
|
+
/**
|
|
14
|
+
* #stateModel SvInspectorView
|
|
15
|
+
* #category view
|
|
16
|
+
* combination of a spreadsheetview and a circularview
|
|
17
|
+
*/
|
|
18
|
+
function SvInspectorViewF(pluginManager) {
|
|
19
|
+
const SpreadsheetViewType = pluginManager.getViewType('SpreadsheetView');
|
|
20
|
+
const CircularViewType = pluginManager.getViewType('CircularView');
|
|
21
|
+
const SpreadsheetModel = SpreadsheetViewType.stateModel;
|
|
22
|
+
const CircularModel = CircularViewType.stateModel;
|
|
23
|
+
const minHeight = 400;
|
|
24
|
+
const defaultHeight = 550;
|
|
25
|
+
const headerHeight = 52;
|
|
26
|
+
const circularViewOptionsBarHeight = 52;
|
|
27
|
+
return types
|
|
28
|
+
.compose(BaseViewModel, types.model('SvInspectorView', {
|
|
29
|
+
/**
|
|
30
|
+
* #property
|
|
31
|
+
*/
|
|
32
|
+
id: ElementId,
|
|
33
|
+
/**
|
|
34
|
+
* #property
|
|
35
|
+
*/
|
|
36
|
+
type: types.literal('SvInspectorView'),
|
|
37
|
+
/**
|
|
38
|
+
* #property
|
|
39
|
+
*/
|
|
40
|
+
height: types.optional(types.refinement('SvInspectorViewHeight', types.number, n => n >= minHeight), defaultHeight),
|
|
41
|
+
/**
|
|
42
|
+
* #property
|
|
43
|
+
*/
|
|
44
|
+
onlyDisplayRelevantRegionsInCircularView: false,
|
|
45
|
+
/**
|
|
46
|
+
* #property
|
|
47
|
+
* switch specifying whether we are showing the import wizard or the
|
|
48
|
+
* spreadsheet in our viewing area
|
|
49
|
+
*/
|
|
50
|
+
mode: types.optional(types.enumeration('SvInspectorViewMode', ['import', 'display']), 'import'),
|
|
51
|
+
/**
|
|
52
|
+
* #property
|
|
53
|
+
*/
|
|
54
|
+
spreadsheetView: types.optional(SpreadsheetModel, () => SpreadsheetModel.create({
|
|
55
|
+
type: 'SpreadsheetView',
|
|
56
|
+
hideVerticalResizeHandle: true,
|
|
57
|
+
})),
|
|
58
|
+
/**
|
|
59
|
+
* #property
|
|
60
|
+
*/
|
|
61
|
+
circularView: types.optional(CircularModel, () => CircularModel.create({
|
|
62
|
+
type: 'CircularView',
|
|
63
|
+
hideVerticalResizeHandle: true,
|
|
64
|
+
hideTrackSelectorButton: true,
|
|
65
|
+
disableImportForm: true,
|
|
66
|
+
})),
|
|
67
|
+
}))
|
|
68
|
+
.volatile(() => ({
|
|
69
|
+
width: 800,
|
|
70
|
+
}))
|
|
71
|
+
.views(self => ({
|
|
72
|
+
/**
|
|
73
|
+
* #getter
|
|
74
|
+
*/
|
|
75
|
+
get selectedRows() {
|
|
76
|
+
// @ts-expect-error
|
|
77
|
+
return self.spreadsheetView.rowSet.selectedRows;
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* #getter
|
|
81
|
+
*/
|
|
82
|
+
get assemblyName() {
|
|
83
|
+
const { assembly } = self.spreadsheetView;
|
|
84
|
+
return assembly ? readConfObject(assembly, 'name') : undefined;
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* #getter
|
|
88
|
+
*/
|
|
89
|
+
get showCircularView() {
|
|
90
|
+
return self.spreadsheetView.mode === 'display';
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* #getter
|
|
94
|
+
*/
|
|
95
|
+
get features() {
|
|
96
|
+
const session = getSession(self);
|
|
97
|
+
const { spreadsheetView } = self;
|
|
98
|
+
const { outputRows = [] } = spreadsheetView;
|
|
99
|
+
return outputRows
|
|
100
|
+
.map((r, i) => getFeatureForRow(session, spreadsheetView, r, i))
|
|
101
|
+
.filter(f => !!f);
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* #getter
|
|
105
|
+
*/
|
|
106
|
+
get featuresAdapterConfigSnapshot() {
|
|
107
|
+
return {
|
|
108
|
+
type: 'FromConfigAdapter',
|
|
109
|
+
features: this.features,
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* #getter
|
|
114
|
+
*/
|
|
115
|
+
get featureRefNames() {
|
|
116
|
+
const refs = this.features.map(r => r.refName);
|
|
117
|
+
const CHR2 = this.features.flatMap(r => { var _a; return (_a = r.INFO) === null || _a === void 0 ? void 0 : _a.CHR2; }).filter(f => !!f);
|
|
118
|
+
return [...refs, ...CHR2];
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* #getter
|
|
122
|
+
*/
|
|
123
|
+
get featuresCircularTrackConfiguration() {
|
|
124
|
+
return {
|
|
125
|
+
type: 'VariantTrack',
|
|
126
|
+
trackId: `sv-inspector-variant-track-${self.id}`,
|
|
127
|
+
name: 'features from tabular data',
|
|
128
|
+
adapter: this.featuresAdapterConfigSnapshot,
|
|
129
|
+
assemblyNames: [this.assemblyName],
|
|
130
|
+
displays: [
|
|
131
|
+
{
|
|
132
|
+
type: 'ChordVariantDisplay',
|
|
133
|
+
displayId: `sv-inspector-variant-track-chord-display-${self.id}`,
|
|
134
|
+
onChordClick: `jexl:defaultOnChordClick(feature, track, pluginManager)`,
|
|
135
|
+
renderer: { type: 'StructuralVariantChordRenderer' },
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
}))
|
|
141
|
+
.volatile(() => ({
|
|
142
|
+
SpreadsheetViewReactComponent: SpreadsheetViewType.ReactComponent,
|
|
143
|
+
CircularViewReactComponent: CircularViewType.ReactComponent,
|
|
144
|
+
circularViewOptionsBarHeight,
|
|
145
|
+
}))
|
|
146
|
+
.actions(self => ({
|
|
147
|
+
/**
|
|
148
|
+
* #action
|
|
149
|
+
*/
|
|
150
|
+
setWidth(newWidth) {
|
|
151
|
+
self.width = newWidth;
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* #action
|
|
155
|
+
*/
|
|
156
|
+
setHeight(newHeight) {
|
|
157
|
+
self.height = newHeight > minHeight ? newHeight : minHeight;
|
|
158
|
+
return self.height;
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* #action
|
|
162
|
+
*/
|
|
163
|
+
setImportMode() {
|
|
164
|
+
self.spreadsheetView.setImportMode();
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* #action
|
|
168
|
+
*/
|
|
169
|
+
setDisplayMode() {
|
|
170
|
+
self.spreadsheetView.setDisplayMode();
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* #action
|
|
174
|
+
*/
|
|
175
|
+
closeView() {
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
177
|
+
getParent(self, 2).removeView(self);
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* #action
|
|
181
|
+
*/
|
|
182
|
+
setDisplayedRegions(regions) {
|
|
183
|
+
self.circularView.setDisplayedRegions(regions);
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* #action
|
|
187
|
+
*/
|
|
188
|
+
setOnlyDisplayRelevantRegionsInCircularView(val) {
|
|
189
|
+
self.onlyDisplayRelevantRegionsInCircularView = Boolean(val);
|
|
190
|
+
},
|
|
191
|
+
}))
|
|
192
|
+
.views(self => ({
|
|
193
|
+
/**
|
|
194
|
+
* #method
|
|
195
|
+
*/
|
|
196
|
+
menuItems() {
|
|
197
|
+
return [
|
|
198
|
+
{
|
|
199
|
+
label: 'Return to import form',
|
|
200
|
+
onClick: () => self.setImportMode(),
|
|
201
|
+
icon: FolderOpenIcon,
|
|
202
|
+
},
|
|
203
|
+
];
|
|
204
|
+
},
|
|
205
|
+
}))
|
|
206
|
+
.actions(self => ({
|
|
207
|
+
/**
|
|
208
|
+
* #action
|
|
209
|
+
*/
|
|
210
|
+
resizeHeight(distance) {
|
|
211
|
+
const oldHeight = self.height;
|
|
212
|
+
const newHeight = self.setHeight(self.height + distance);
|
|
213
|
+
return newHeight - oldHeight;
|
|
214
|
+
},
|
|
215
|
+
afterAttach() {
|
|
216
|
+
// synchronize subview widths
|
|
217
|
+
addDisposer(self, autorun(() => {
|
|
218
|
+
const borderWidth = 1;
|
|
219
|
+
if (self.showCircularView) {
|
|
220
|
+
const spreadsheetWidth = Math.round(self.width * 0.66);
|
|
221
|
+
const circularViewWidth = self.width - spreadsheetWidth;
|
|
222
|
+
self.spreadsheetView.setWidth(spreadsheetWidth - borderWidth);
|
|
223
|
+
self.circularView.setWidth(circularViewWidth);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
self.spreadsheetView.setWidth(self.width);
|
|
227
|
+
}
|
|
228
|
+
}, { name: 'SvInspectorView width binding' }));
|
|
229
|
+
// synchronize subview heights
|
|
230
|
+
addDisposer(self, autorun(() => {
|
|
231
|
+
self.spreadsheetView.setHeight(self.height - headerHeight);
|
|
232
|
+
self.circularView.setHeight(self.height - headerHeight - circularViewOptionsBarHeight);
|
|
233
|
+
}, { name: 'SvInspectorView height binding' }));
|
|
234
|
+
// bind circularview displayedRegions to spreadsheet assembly, mediated
|
|
235
|
+
// by the onlyRelevantRegions toggle
|
|
236
|
+
addDisposer(self, autorun(async () => {
|
|
237
|
+
const { assemblyName, onlyDisplayRelevantRegionsInCircularView, circularView, featureRefNames, } = self;
|
|
238
|
+
const { tracks } = circularView;
|
|
239
|
+
const { assemblyManager } = getSession(self);
|
|
240
|
+
if (!assemblyName) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const asm = await assemblyManager.waitForAssembly(assemblyName);
|
|
244
|
+
if (!asm) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const { getCanonicalRefName, regions = [] } = asm;
|
|
248
|
+
if (onlyDisplayRelevantRegionsInCircularView) {
|
|
249
|
+
if (tracks.length === 1) {
|
|
250
|
+
try {
|
|
251
|
+
// canonicalize the store's ref names if necessary
|
|
252
|
+
const refSet = new Set(featureRefNames.map(r => getCanonicalRefName(r) || r));
|
|
253
|
+
circularView.setDisplayedRegions(clone(regions.filter(r => refSet.has(r.refName))));
|
|
254
|
+
}
|
|
255
|
+
catch (e) {
|
|
256
|
+
circularView.setError(e);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
circularView.setDisplayedRegions(regions);
|
|
262
|
+
}
|
|
263
|
+
}, { name: 'SvInspectorView displayed regions bind' }));
|
|
264
|
+
// bind circularview tracks to our track snapshot view
|
|
265
|
+
addDisposer(self, reaction(() => ({
|
|
266
|
+
generatedTrackConf: self === null || self === void 0 ? void 0 : self.featuresCircularTrackConfiguration,
|
|
267
|
+
assemblyName: self === null || self === void 0 ? void 0 : self.assemblyName,
|
|
268
|
+
}), data => {
|
|
269
|
+
if (!data) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const { assemblyName, generatedTrackConf } = data;
|
|
273
|
+
const { circularView } = self;
|
|
274
|
+
// hide any visible tracks
|
|
275
|
+
circularView.tracks.forEach(t => circularView.hideTrack(t.configuration.trackId));
|
|
276
|
+
// put our track in as the only track
|
|
277
|
+
if (assemblyName && generatedTrackConf) {
|
|
278
|
+
// @ts-expect-error
|
|
279
|
+
circularView.addTrackConf(generatedTrackConf, {
|
|
280
|
+
assemblyName,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
name: 'SvInspectorView track configuration binding',
|
|
285
|
+
fireImmediately: true,
|
|
286
|
+
}));
|
|
287
|
+
// bind spreadsheetView row menu actions to us
|
|
288
|
+
addDisposer(self, autorun(() => {
|
|
289
|
+
self.spreadsheetView.setRowMenuItems(
|
|
290
|
+
// these are the MenuItem entries for the row menu actions in the
|
|
291
|
+
// spreadsheet view. these are installed into the child
|
|
292
|
+
// SpreadsheetView using an autorun below
|
|
293
|
+
[
|
|
294
|
+
{
|
|
295
|
+
label: 'Open split detail view',
|
|
296
|
+
icon: OpenInNewIcon,
|
|
297
|
+
// @ts-expect-error
|
|
298
|
+
disabled(spreadsheetView, spreadsheet, rowNumber, row) {
|
|
299
|
+
return !canOpenBreakpointSplitViewFromTableRow(self, spreadsheetView, spreadsheet, row, rowNumber);
|
|
300
|
+
},
|
|
301
|
+
// @ts-expect-error
|
|
302
|
+
onClick(spreadsheetView, spreadsheet, rowNumber, row) {
|
|
303
|
+
openBreakpointSplitViewFromTableRow(self, spreadsheetView, spreadsheet, row, rowNumber);
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
]);
|
|
307
|
+
}));
|
|
308
|
+
},
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
311
|
+
export default SvInspectorViewF;
|
|
312
|
+
//# sourceMappingURL=SvInspectorView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvInspectorView.js","sourceRoot":"","sources":["../../../src/SvInspectorView/models/SvInspectorView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAY,MAAM,iBAAiB,CAAA;AAGzE,OAAO,EAAE,UAAU,EAAU,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAA;AAI1E,QAAQ;AACR,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,cAAc,MAAM,gCAAgC,CAAA;AAE3D,SAAS;AACT,OAAO,EACL,sCAAsC,EACtC,mCAAmC,EACnC,gBAAgB,GACjB,MAAM,mCAAmC,CAAA;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gBAAgB,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export function makeAdHocFeature(columns: any, columnsAlreadyUsedInLocations: any, row: any, loc1: any, loc2: any, rowNumber: any): {
|
|
2
|
+
uniqueId: string;
|
|
3
|
+
refName: any;
|
|
4
|
+
start: any;
|
|
5
|
+
end: any;
|
|
6
|
+
mate: {
|
|
7
|
+
refName: any;
|
|
8
|
+
start: any;
|
|
9
|
+
end: any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export function makeAdHocSvFeatureFromTwoLocations(columns: any, locationColumnNumbers: any, row: any, rowNumber: any, isValidRefName: any): {
|
|
13
|
+
uniqueId: string;
|
|
14
|
+
refName: any;
|
|
15
|
+
start: any;
|
|
16
|
+
end: any;
|
|
17
|
+
mate: {
|
|
18
|
+
refName: any;
|
|
19
|
+
start: any;
|
|
20
|
+
end: any;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export function makeAdHocSvFeatureFromTwoRefStartEndSets(columns: any, locRefColumnNumbers: any, locStartColumnNumbers: any, locEndColumnNumbers: any, row: any, rowNumber: any): {
|
|
24
|
+
uniqueId: string;
|
|
25
|
+
refName: any;
|
|
26
|
+
start: any;
|
|
27
|
+
end: any;
|
|
28
|
+
mate: {
|
|
29
|
+
refName: any;
|
|
30
|
+
start: any;
|
|
31
|
+
end: any;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export function makeAdHocSvFeature(sheet: any, rowNumber: any, row: any, isValidRefName: any): {
|
|
35
|
+
uniqueId: string;
|
|
36
|
+
refName: any;
|
|
37
|
+
start: any;
|
|
38
|
+
end: any;
|
|
39
|
+
mate: {
|
|
40
|
+
refName: any;
|
|
41
|
+
start: any;
|
|
42
|
+
end: any;
|
|
43
|
+
};
|
|
44
|
+
} | undefined;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// this file contains the rather verbose functions for
|
|
2
|
+
// creating features from CSV/TSV lines
|
|
3
|
+
import { parseLocString } from '@jbrowse/core/util';
|
|
4
|
+
export function makeAdHocFeature(columns, columnsAlreadyUsedInLocations, row, loc1, loc2, rowNumber) {
|
|
5
|
+
// load all the other data in the row into an `otherData` object
|
|
6
|
+
const otherData = {};
|
|
7
|
+
columns.forEach((column, columnNumber) => {
|
|
8
|
+
if (columnsAlreadyUsedInLocations.includes(columnNumber)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let { text } = row.cells[columnNumber];
|
|
12
|
+
if (column.dataType.type === 'Number') {
|
|
13
|
+
text = parseFloat(text);
|
|
14
|
+
}
|
|
15
|
+
otherData[column.name] = text;
|
|
16
|
+
});
|
|
17
|
+
// make the final feature data out of otherData + the parsed locations
|
|
18
|
+
return {
|
|
19
|
+
...otherData,
|
|
20
|
+
uniqueId: `sv-inspector-adhoc-${rowNumber}`,
|
|
21
|
+
refName: loc1.refName,
|
|
22
|
+
start: loc1.start,
|
|
23
|
+
end: loc1.end,
|
|
24
|
+
mate: {
|
|
25
|
+
refName: loc2.refName,
|
|
26
|
+
start: loc2.start,
|
|
27
|
+
end: loc2.end,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function makeAdHocSvFeatureFromTwoLocations(columns, locationColumnNumbers, row, rowNumber, isValidRefName) {
|
|
32
|
+
// use the first two locations we found (first according to *displayed* order)
|
|
33
|
+
const loc1 = parseLocString(row.cells[locationColumnNumbers[0]].text, isValidRefName);
|
|
34
|
+
const loc2 = parseLocString(row.cells[locationColumnNumbers[1]].text, isValidRefName);
|
|
35
|
+
const columnsAlreadyUsedInLocations = [
|
|
36
|
+
locationColumnNumbers[0],
|
|
37
|
+
locationColumnNumbers[1],
|
|
38
|
+
];
|
|
39
|
+
return makeAdHocFeature(columns, columnsAlreadyUsedInLocations, row, loc1, loc2, rowNumber);
|
|
40
|
+
}
|
|
41
|
+
export function makeAdHocSvFeatureFromTwoRefStartEndSets(columns, locRefColumnNumbers, locStartColumnNumbers, locEndColumnNumbers, row, rowNumber) {
|
|
42
|
+
const textOf = colno => row.cells[colno].text;
|
|
43
|
+
const loc1 = {
|
|
44
|
+
refName: textOf(locRefColumnNumbers[0]),
|
|
45
|
+
start: parseInt(textOf(locStartColumnNumbers[0]), 10) - 1,
|
|
46
|
+
end: parseInt(textOf(locEndColumnNumbers[0]), 10),
|
|
47
|
+
};
|
|
48
|
+
const loc2 = {
|
|
49
|
+
refName: textOf(locRefColumnNumbers[1]),
|
|
50
|
+
start: parseInt(textOf(locStartColumnNumbers[1]), 10) - 1,
|
|
51
|
+
end: parseInt(textOf(locEndColumnNumbers[1]), 10),
|
|
52
|
+
};
|
|
53
|
+
const columnsAlreadyUsedInLocations = [
|
|
54
|
+
locRefColumnNumbers[0],
|
|
55
|
+
locStartColumnNumbers[0],
|
|
56
|
+
locEndColumnNumbers[0],
|
|
57
|
+
locRefColumnNumbers[1],
|
|
58
|
+
locStartColumnNumbers[1],
|
|
59
|
+
locEndColumnNumbers[1],
|
|
60
|
+
];
|
|
61
|
+
return makeAdHocFeature(columns, columnsAlreadyUsedInLocations, row, loc1, loc2, rowNumber);
|
|
62
|
+
}
|
|
63
|
+
// makes a feature data object (passed as `data` to a SimpleFeature constructor)
|
|
64
|
+
// out of table row if the row has 2 location columns. undefined if not
|
|
65
|
+
export function makeAdHocSvFeature(sheet, rowNumber, row, isValidRefName) {
|
|
66
|
+
const { columns, columnDisplayOrder } = sheet;
|
|
67
|
+
const columnTypes = {};
|
|
68
|
+
columnDisplayOrder.forEach(columnNumber => {
|
|
69
|
+
const columnDefinition = columns[columnNumber];
|
|
70
|
+
if (!columnTypes[columnDefinition.dataType.type]) {
|
|
71
|
+
columnTypes[columnDefinition.dataType.type] = [];
|
|
72
|
+
}
|
|
73
|
+
columnTypes[columnDefinition.dataType.type].push(columnNumber);
|
|
74
|
+
});
|
|
75
|
+
const locationColumnNumbers = columnTypes.LocString || [];
|
|
76
|
+
const locStartColumnNumbers = columnTypes.LocStart || [];
|
|
77
|
+
const locEndColumnNumbers = columnTypes.LocEnd || [];
|
|
78
|
+
const locRefColumnNumbers = columnTypes.LocRef || [];
|
|
79
|
+
// if we have 2 or more columns of type location, make a feature from them
|
|
80
|
+
if (locationColumnNumbers.length >= 2) {
|
|
81
|
+
return makeAdHocSvFeatureFromTwoLocations(columns, locationColumnNumbers, row, rowNumber, isValidRefName);
|
|
82
|
+
}
|
|
83
|
+
if (locRefColumnNumbers.length >= 2 &&
|
|
84
|
+
locStartColumnNumbers.length >= 2 &&
|
|
85
|
+
locEndColumnNumbers.length >= 2) {
|
|
86
|
+
return makeAdHocSvFeatureFromTwoRefStartEndSets(columns, locRefColumnNumbers, locStartColumnNumbers, locEndColumnNumbers, row, rowNumber);
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=adhocFeatureUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adhocFeatureUtils.js","sourceRoot":"","sources":["../../../src/SvInspectorView/models/adhocFeatureUtils.js"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,UAAU,gBAAgB,CAC9B,OAAO,EACP,6BAA6B,EAC7B,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,SAAS;IAET,gEAAgE;IAChE,MAAM,SAAS,GAAG,EAAE,CAAA;IACpB,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE;QACvC,IAAI,6BAA6B,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;YACxD,OAAM;SACP;QACD,IAAI,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;QACtC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE;YACrC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;SACxB;QACD,SAA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AAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAChD,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;SACjD;QACD,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;IACF,MAAM,qBAAqB,GAAG,WAAW,CAAC,SAAS,IAAI,EAAE,CAAA;IACzD,MAAM,qBAAqB,GAAG,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAA;IACxD,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAA;IACpD,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAA;IAEpD,0EAA0E;IAC1E,IAAI,qBAAqB,CAAC,MAAM,IAAI,CAAC,EAAE;QACrC,OAAO,kCAAkC,CACvC,OAAO,EACP,qBAAqB,EACrB,GAAG,EACH,SAAS,EACT,cAAc,CACf,CAAA;KACF;IACD,IACE,mBAAmB,CAAC,MAAM,IAAI,CAAC;QAC/B,qBAAqB,CAAC,MAAM,IAAI,CAAC;QACjC,mBAAmB,CAAC,MAAM,IAAI,CAAC,EAC/B;QACA,OAAO,wCAAwC,CAC7C,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,GAAG,EACH,SAAS,CACV,CAAA;KACF;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export function getFeatureForRow(session: any, spreadsheetView: any, row: any, rowNumber: any): any;
|
|
2
|
+
export function breakpointSplitViewSnapshotFromTableRow(svInspectorView: any, spreadsheetView: any, spreadsheet: any, row: any, rowNumber: any): any;
|
|
3
|
+
export function openBreakpointSplitViewFromTableRow(svInspectorView: any, spreadsheetView: any, spreadsheet: any, row: any, rowNumber: any): void;
|
|
4
|
+
export function canOpenBreakpointSplitViewFromTableRow(svInspectorView: any, spreadsheetView: any, spreadsheet: any, row: any, rowNumber: any): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SimpleFeature, getEnv, getSession } from '@jbrowse/core/util';
|
|
2
|
+
import { makeAdHocSvFeature } from './adhocFeatureUtils';
|
|
3
|
+
export function getFeatureForRow(session, spreadsheetView, row, rowNumber) {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
return (((_a = row.extendedData) === null || _a === void 0 ? void 0 : _a.vcfFeature) ||
|
|
6
|
+
((_b = row.extendedData) === null || _b === void 0 ? void 0 : _b.feature) ||
|
|
7
|
+
makeAdHocSvFeature(spreadsheetView.spreadsheet, rowNumber, row, session.assemblyManager.isValidRefName));
|
|
8
|
+
}
|
|
9
|
+
export function breakpointSplitViewSnapshotFromTableRow(svInspectorView, spreadsheetView, spreadsheet, row, rowNumber) {
|
|
10
|
+
const { pluginManager } = getEnv(svInspectorView);
|
|
11
|
+
const session = getSession(spreadsheetView);
|
|
12
|
+
const featureData = getFeatureForRow(session, spreadsheet, row, rowNumber);
|
|
13
|
+
if (featureData) {
|
|
14
|
+
const feature = new SimpleFeature(featureData);
|
|
15
|
+
session.setSelection(feature);
|
|
16
|
+
return pluginManager
|
|
17
|
+
.getViewType('BreakpointSplitView')
|
|
18
|
+
.snapshotFromBreakendFeature(feature, svInspectorView.circularView);
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
export function openBreakpointSplitViewFromTableRow(svInspectorView, spreadsheetView, spreadsheet, row, rowNumber) {
|
|
23
|
+
const viewSnapshot = breakpointSplitViewSnapshotFromTableRow(svInspectorView, spreadsheetView, spreadsheet, row, rowNumber);
|
|
24
|
+
if (viewSnapshot) {
|
|
25
|
+
// try to center the offsetPx
|
|
26
|
+
const { circularView } = svInspectorView;
|
|
27
|
+
viewSnapshot.views[0].offsetPx -= circularView.width / 2 + 100;
|
|
28
|
+
viewSnapshot.views[1].offsetPx -= circularView.width / 2 + 100;
|
|
29
|
+
const session = getSession(spreadsheetView);
|
|
30
|
+
session.addView('BreakpointSplitView', viewSnapshot);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function canOpenBreakpointSplitViewFromTableRow(svInspectorView, spreadsheetView, spreadsheet, row, rowNumber) {
|
|
34
|
+
try {
|
|
35
|
+
return Boolean(breakpointSplitViewSnapshotFromTableRow(svInspectorView, spreadsheetView, spreadsheet, row, rowNumber));
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
console.error('Unable to open breakpoint split view from table row', e);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=breakpointSplitViewFromTableRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breakpointSplitViewFromTableRow.js","sourceRoot":"","sources":["../../../src/SvInspectorView/models/breakpointSplitViewFromTableRow.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAExD,MAAM,UAAU,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,SAAS;;IACvE,OAAO,CACL,CAAA,MAAA,GAAG,CAAC,YAAY,0CAAE,UAAU;SAC5B,MAAA,GAAG,CAAC,YAAY,0CAAE,OAAO,CAAA;QACzB,kBAAkB,CAChB,eAAe,CAAC,WAAW,EAC3B,SAAS,EACT,GAAG,EACH,OAAO,CAAC,eAAe,CAAC,cAAc,CACvC,CACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,eAAe,EACf,eAAe,EACf,WAAW,EACX,GAAG,EACH,SAAS;IAET,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA;IACjD,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,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,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,qDAAqD,EAAE,CAAC,CAAC,CAAA;QACvE,OAAO,KAAK,CAAA;KACb;AACH,CAAC"}
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import Plugin from '@jbrowse/core/Plugin';
|
|
3
|
+
export default class SvInspectorViewPlugin extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
install(pluginManager: PluginManager): void;
|
|
6
|
+
configure(pluginManager: PluginManager): void;
|
|
7
|
+
}
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
+
import { isAbstractMenuManager, } from '@jbrowse/core/util/types';
|
|
3
|
+
// icons
|
|
4
|
+
import TableChartIcon from '@mui/icons-material/TableChart';
|
|
5
|
+
// locals
|
|
6
|
+
import SvInspectorViewF from './SvInspectorView';
|
|
7
|
+
import LaunchSvInspectorViewF from './LaunchSvInspectorView';
|
|
8
|
+
export default class SvInspectorViewPlugin extends Plugin {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.name = 'SvInspectorViewPlugin';
|
|
12
|
+
}
|
|
13
|
+
install(pluginManager) {
|
|
14
|
+
SvInspectorViewF(pluginManager);
|
|
15
|
+
LaunchSvInspectorViewF(pluginManager);
|
|
16
|
+
}
|
|
17
|
+
configure(pluginManager) {
|
|
18
|
+
if (isAbstractMenuManager(pluginManager.rootModel)) {
|
|
19
|
+
pluginManager.rootModel.appendToSubMenu(['Add'], {
|
|
20
|
+
label: 'SV inspector',
|
|
21
|
+
icon: TableChartIcon,
|
|
22
|
+
onClick: (session) => {
|
|
23
|
+
session.addView('SvInspectorView', {});
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AACzC,OAAO,EAEL,qBAAqB,GACtB,MAAM,0BAA0B,CAAA;AAEjC,QAAQ;AACR,OAAO,cAAc,MAAM,gCAAgC,CAAA;AAE3D,SAAS;AACT,OAAO,gBAAgB,MAAM,mBAAmB,CAAA;AAChD,OAAO,sBAAsB,MAAM,yBAAyB,CAAA;AAE5D,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,MAAM;IAAzD;;QACE,SAAI,GAAG,uBAAuB,CAAA;IAkBhC,CAAC;IAhBC,OAAO,CAAC,aAA4B;QAClC,gBAAgB,CAAC,aAAa,CAAC,CAAA;QAC/B,sBAAsB,CAAC,aAAa,CAAC,CAAA;IACvC,CAAC;IAED,SAAS,CAAC,aAA4B;QACpC,IAAI,qBAAqB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YAClD,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE;gBAC/C,KAAK,EAAE,cAAc;gBACrB,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,CAAC,OAA6B,EAAE,EAAE;oBACzC,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;gBACxC,CAAC;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jbrowse/plugin-sv-inspector",
|
|
3
|
+
"version": "2.6.1",
|
|
4
|
+
"description": "JBrowse 2 SV inspector view",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"jbrowse",
|
|
7
|
+
"jbrowse2"
|
|
8
|
+
],
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"homepage": "https://jbrowse.org",
|
|
11
|
+
"bugs": "https://github.com/GMOD/jbrowse-components/issues",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/GMOD/jbrowse-components.git",
|
|
15
|
+
"directory": "plugins/sv-inspector"
|
|
16
|
+
},
|
|
17
|
+
"author": "JBrowse Team",
|
|
18
|
+
"distMain": "dist/index.js",
|
|
19
|
+
"srcMain": "src/index.ts",
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src",
|
|
24
|
+
"esm"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "npm-run-all build:*",
|
|
28
|
+
"test": "cd ../..; jest plugins/sv-inspector",
|
|
29
|
+
"prepublishOnly": "yarn test",
|
|
30
|
+
"prepack": "yarn build && yarn useDist",
|
|
31
|
+
"postpack": "yarn useSrc",
|
|
32
|
+
"useDist": "node ../../scripts/useDist.js",
|
|
33
|
+
"useSrc": "node ../../scripts/useSrc.js",
|
|
34
|
+
"prebuild": "npm run clean",
|
|
35
|
+
"build:esm": "tsc --build tsconfig.build.esm.json",
|
|
36
|
+
"build:es5": "tsc --build tsconfig.build.es5.json",
|
|
37
|
+
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@mui/icons-material": "^5.0.1",
|
|
41
|
+
"clone": "^2.1.2"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@jbrowse/core": "^2.0.0",
|
|
45
|
+
"@jbrowse/plugin-circular-view": "^2.0.0",
|
|
46
|
+
"@jbrowse/plugin-spreadsheet-view": "^2.0.0",
|
|
47
|
+
"@mui/material": "^5.0.0",
|
|
48
|
+
"mobx": "^6.0.0",
|
|
49
|
+
"mobx-react": "^7.0.0",
|
|
50
|
+
"mobx-state-tree": "^5.0.0",
|
|
51
|
+
"react": ">=16.8.0",
|
|
52
|
+
"react-dom": ">=16.8.0",
|
|
53
|
+
"tss-react": "^4.0.0"
|
|
54
|
+
},
|
|
55
|
+
"distModule": "esm/index.js",
|
|
56
|
+
"srcModule": "src/index.ts",
|
|
57
|
+
"module": "esm/index.js",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "1cbe7ba097fb2d2763c776e5e429e4670cdd583c"
|
|
62
|
+
}
|