@jbrowse/plugin-alignments 1.7.4 → 1.7.7
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/LinearPileupDisplay/configSchema.js +3 -5
- package/dist/LinearPileupDisplay/model.d.ts +2 -2
- package/dist/LinearPileupDisplay/model.js +167 -41
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +1 -1
- package/dist/PileupRenderer/PileupRenderer.d.ts +2 -2
- package/dist/PileupRenderer/PileupRenderer.js +3 -3
- package/package.json +2 -2
- package/src/LinearPileupDisplay/configSchema.ts +1 -4
- package/src/LinearPileupDisplay/model.ts +96 -19
- package/src/PileupRenderer/PileupRenderer.tsx +6 -2
|
@@ -12,18 +12,16 @@ var _pluginLinearGenomeView = require("@jbrowse/plugin-linear-genome-view");
|
|
|
12
12
|
var _mobxStateTree = require("mobx-state-tree");
|
|
13
13
|
|
|
14
14
|
function PileupConfigFactory(pluginManager) {
|
|
15
|
-
var PileupRendererConfigSchema = pluginManager.getRendererType('PileupRenderer').configSchema;
|
|
16
|
-
var SvgFeatureRendererConfigSchema = pluginManager.getRendererType('SvgFeatureRenderer').configSchema; // modify config schema to take in a sub coverage display
|
|
15
|
+
var PileupRendererConfigSchema = pluginManager.getRendererType('PileupRenderer').configSchema; // modify config schema to take in a sub coverage display
|
|
17
16
|
|
|
18
17
|
return (0, _configuration.ConfigurationSchema)('LinearPileupDisplay', {
|
|
19
18
|
defaultRendering: {
|
|
20
19
|
type: 'stringEnum',
|
|
21
|
-
model: _mobxStateTree.types.enumeration('Rendering', ['pileup'
|
|
20
|
+
model: _mobxStateTree.types.enumeration('Rendering', ['pileup']),
|
|
22
21
|
defaultValue: 'pileup'
|
|
23
22
|
},
|
|
24
23
|
renderers: (0, _configuration.ConfigurationSchema)('RenderersConfiguration', {
|
|
25
|
-
PileupRenderer: PileupRendererConfigSchema
|
|
26
|
-
SvgFeatureRenderer: SvgFeatureRendererConfigSchema
|
|
24
|
+
PileupRenderer: PileupRendererConfigSchema
|
|
27
25
|
}),
|
|
28
26
|
renderer: '',
|
|
29
27
|
maxFeatureScreenDensity: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { Feature } from '@jbrowse/core/util';
|
|
2
3
|
import { ContentCopy as ContentCopyIcon } from '@jbrowse/core/ui/Icons';
|
|
3
4
|
import { Instance } from 'mobx-state-tree';
|
|
4
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
5
5
|
import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema';
|
|
6
6
|
import { LinearPileupDisplayConfigModel } from './configSchema';
|
|
7
7
|
declare const stateModelFactory: (configSchema: LinearPileupDisplayConfigModel) => import("mobx-state-tree").IModelType<{
|
|
@@ -174,7 +174,7 @@ declare const stateModelFactory: (configSchema: LinearPileupDisplayConfigModel)
|
|
|
174
174
|
headers?: Record<string, string> | undefined;
|
|
175
175
|
signal?: AbortSignal | undefined;
|
|
176
176
|
filters?: string[] | undefined;
|
|
177
|
-
}): Promise<
|
|
177
|
+
}): Promise<{}>;
|
|
178
178
|
setRegionStatsP(p?: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").Stats> | undefined): void;
|
|
179
179
|
setRegionStats(estimatedRegionStats?: import("@jbrowse/core/data_adapters/BaseAdapter").Stats | undefined): void;
|
|
180
180
|
clearRegionStats(): void;
|
|
@@ -177,7 +177,7 @@ var stateModelFactory = function stateModelFactory(configSchema) {
|
|
|
177
177
|
return {
|
|
178
178
|
afterAttach: function afterAttach() {
|
|
179
179
|
(0, _mobxStateTree.addDisposer)(self, (0, _mobx.autorun)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
180
|
-
var _getSession, rpcManager, sortedBy, colorBy,
|
|
180
|
+
var _getSession, rpcManager, view, sortedBy, colorBy, parentTrack, adapterConfig, rendererType, staticBlocks, bpPerPx, uniqueTagSet, adapter, pos, refName, assemblyName;
|
|
181
181
|
|
|
182
182
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
183
183
|
while (1) {
|
|
@@ -185,84 +185,88 @@ var stateModelFactory = function stateModelFactory(configSchema) {
|
|
|
185
185
|
case 0:
|
|
186
186
|
_context.prev = 0;
|
|
187
187
|
_getSession = (0, _util.getSession)(self), rpcManager = _getSession.rpcManager;
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
view = (0, _util.getContainingView)(self);
|
|
189
|
+
sortedBy = self.sortedBy, colorBy = self.colorBy, parentTrack = self.parentTrack, adapterConfig = self.adapterConfig, rendererType = self.rendererType;
|
|
190
|
+
staticBlocks = view.staticBlocks, bpPerPx = view.bpPerPx; // continually generate the vc pairing, set and rerender if any
|
|
190
191
|
// new values seen
|
|
191
192
|
|
|
192
193
|
if (!(colorBy !== null && colorBy !== void 0 && colorBy.tag)) {
|
|
193
|
-
_context.next =
|
|
194
|
+
_context.next = 10;
|
|
194
195
|
break;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
_context.next =
|
|
198
|
-
return (0, _shared.getUniqueTagValues)(self, colorBy,
|
|
198
|
+
_context.next = 8;
|
|
199
|
+
return (0, _shared.getUniqueTagValues)(self, colorBy, staticBlocks);
|
|
199
200
|
|
|
200
|
-
case
|
|
201
|
+
case 8:
|
|
201
202
|
uniqueTagSet = _context.sent;
|
|
202
203
|
self.updateColorTagMap(uniqueTagSet);
|
|
203
204
|
|
|
204
|
-
case
|
|
205
|
+
case 10:
|
|
205
206
|
if (!((colorBy === null || colorBy === void 0 ? void 0 : colorBy.type) === 'modifications')) {
|
|
206
|
-
_context.next =
|
|
207
|
+
_context.next = 17;
|
|
207
208
|
break;
|
|
208
209
|
}
|
|
209
210
|
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
adapter = (0, _configuration.getConf)(parentTrack, ['adapter']);
|
|
212
|
+
_context.t0 = self;
|
|
213
|
+
_context.next = 15;
|
|
214
|
+
return (0, _shared.getUniqueModificationValues)(self, adapter, colorBy, staticBlocks);
|
|
212
215
|
|
|
213
|
-
case
|
|
214
|
-
|
|
215
|
-
self.updateModificationColorMap(uniqueModificationsSet);
|
|
216
|
+
case 15:
|
|
217
|
+
_context.t1 = _context.sent;
|
|
216
218
|
|
|
217
|
-
|
|
219
|
+
_context.t0.updateModificationColorMap.call(_context.t0, _context.t1);
|
|
220
|
+
|
|
221
|
+
case 17:
|
|
218
222
|
if (!sortedBy) {
|
|
219
|
-
_context.next =
|
|
223
|
+
_context.next = 25;
|
|
220
224
|
break;
|
|
221
225
|
}
|
|
222
226
|
|
|
223
|
-
pos = sortedBy.pos, refName = sortedBy.refName, assemblyName = sortedBy.assemblyName;
|
|
224
|
-
region = {
|
|
225
|
-
start: pos,
|
|
226
|
-
end: pos + 1,
|
|
227
|
-
refName: refName,
|
|
228
|
-
assemblyName: assemblyName
|
|
229
|
-
}; // render just the sorted region first
|
|
227
|
+
pos = sortedBy.pos, refName = sortedBy.refName, assemblyName = sortedBy.assemblyName; // render just the sorted region first
|
|
230
228
|
|
|
231
|
-
_context.next =
|
|
229
|
+
_context.next = 21;
|
|
232
230
|
return self.rendererType.renderInClient(rpcManager, _objectSpread({
|
|
233
231
|
assemblyName: assemblyName,
|
|
234
|
-
regions: [
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
regions: [{
|
|
233
|
+
start: pos,
|
|
234
|
+
end: pos + 1,
|
|
235
|
+
refName: refName,
|
|
236
|
+
assemblyName: assemblyName
|
|
237
|
+
}],
|
|
238
|
+
adapterConfig: adapterConfig,
|
|
239
|
+
rendererType: rendererType.name,
|
|
237
240
|
sessionId: (0, _tracks.getRpcSessionId)(self),
|
|
241
|
+
layoutId: view.id,
|
|
238
242
|
timeout: 1000000
|
|
239
243
|
}, self.renderProps()));
|
|
240
244
|
|
|
241
|
-
case
|
|
245
|
+
case 21:
|
|
242
246
|
self.setReady(true);
|
|
243
|
-
self.setCurrBpPerPx(
|
|
244
|
-
_context.next =
|
|
247
|
+
self.setCurrBpPerPx(bpPerPx);
|
|
248
|
+
_context.next = 26;
|
|
245
249
|
break;
|
|
246
250
|
|
|
247
|
-
case
|
|
251
|
+
case 25:
|
|
248
252
|
self.setReady(true);
|
|
249
253
|
|
|
250
|
-
case
|
|
251
|
-
_context.next =
|
|
254
|
+
case 26:
|
|
255
|
+
_context.next = 32;
|
|
252
256
|
break;
|
|
253
257
|
|
|
254
|
-
case
|
|
255
|
-
_context.prev =
|
|
256
|
-
_context.
|
|
257
|
-
console.error(_context.
|
|
258
|
-
self.setError(_context.
|
|
258
|
+
case 28:
|
|
259
|
+
_context.prev = 28;
|
|
260
|
+
_context.t2 = _context["catch"](0);
|
|
261
|
+
console.error(_context.t2);
|
|
262
|
+
self.setError(_context.t2);
|
|
259
263
|
|
|
260
|
-
case
|
|
264
|
+
case 32:
|
|
261
265
|
case "end":
|
|
262
266
|
return _context.stop();
|
|
263
267
|
}
|
|
264
268
|
}
|
|
265
|
-
}, _callee, null, [[0,
|
|
269
|
+
}, _callee, null, [[0, 28]]);
|
|
266
270
|
})), {
|
|
267
271
|
delay: 1000
|
|
268
272
|
}));
|
|
@@ -430,7 +434,129 @@ var stateModelFactory = function stateModelFactory(configSchema) {
|
|
|
430
434
|
colorTagMap: JSON.parse(JSON.stringify(colorTagMap)),
|
|
431
435
|
modificationTagMap: JSON.parse(JSON.stringify(modificationTagMap)),
|
|
432
436
|
showSoftClip: self.showSoftClipping,
|
|
433
|
-
config: self.rendererConfig
|
|
437
|
+
config: self.rendererConfig,
|
|
438
|
+
onFeatureClick: function onFeatureClick(_, featureId) {
|
|
439
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
440
|
+
var session, rpcManager, f, sessionId, _ref3, feature;
|
|
441
|
+
|
|
442
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
443
|
+
while (1) {
|
|
444
|
+
switch (_context2.prev = _context2.next) {
|
|
445
|
+
case 0:
|
|
446
|
+
session = (0, _util.getSession)(self);
|
|
447
|
+
rpcManager = session.rpcManager;
|
|
448
|
+
_context2.prev = 2;
|
|
449
|
+
f = featureId || self.featureIdUnderMouse;
|
|
450
|
+
|
|
451
|
+
if (f) {
|
|
452
|
+
_context2.next = 8;
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
self.clearFeatureSelection();
|
|
457
|
+
_context2.next = 14;
|
|
458
|
+
break;
|
|
459
|
+
|
|
460
|
+
case 8:
|
|
461
|
+
sessionId = (0, _tracks.getRpcSessionId)(self);
|
|
462
|
+
_context2.next = 11;
|
|
463
|
+
return rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
464
|
+
featureId: f,
|
|
465
|
+
sessionId: sessionId,
|
|
466
|
+
layoutId: (0, _util.getContainingView)(self).id,
|
|
467
|
+
rendererType: 'PileupRenderer'
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
case 11:
|
|
471
|
+
_ref3 = _context2.sent;
|
|
472
|
+
feature = _ref3.feature;
|
|
473
|
+
|
|
474
|
+
if (feature) {
|
|
475
|
+
// @ts-ignore
|
|
476
|
+
self.selectFeature(new _util.SimpleFeature(feature));
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
case 14:
|
|
480
|
+
_context2.next = 20;
|
|
481
|
+
break;
|
|
482
|
+
|
|
483
|
+
case 16:
|
|
484
|
+
_context2.prev = 16;
|
|
485
|
+
_context2.t0 = _context2["catch"](2);
|
|
486
|
+
console.error(_context2.t0);
|
|
487
|
+
session.notify("".concat(_context2.t0));
|
|
488
|
+
|
|
489
|
+
case 20:
|
|
490
|
+
case "end":
|
|
491
|
+
return _context2.stop();
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}, _callee2, null, [[2, 16]]);
|
|
495
|
+
}))();
|
|
496
|
+
},
|
|
497
|
+
onClick: function onClick() {
|
|
498
|
+
self.clearFeatureSelection();
|
|
499
|
+
},
|
|
500
|
+
// similar to click but opens a menu with further options
|
|
501
|
+
onFeatureContextMenu: function onFeatureContextMenu(_, featureId) {
|
|
502
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
503
|
+
var session, rpcManager, f, sessionId, _ref4, feature;
|
|
504
|
+
|
|
505
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
506
|
+
while (1) {
|
|
507
|
+
switch (_context3.prev = _context3.next) {
|
|
508
|
+
case 0:
|
|
509
|
+
session = (0, _util.getSession)(self);
|
|
510
|
+
rpcManager = session.rpcManager;
|
|
511
|
+
_context3.prev = 2;
|
|
512
|
+
f = featureId || self.featureIdUnderMouse;
|
|
513
|
+
|
|
514
|
+
if (f) {
|
|
515
|
+
_context3.next = 8;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
self.clearFeatureSelection();
|
|
520
|
+
_context3.next = 14;
|
|
521
|
+
break;
|
|
522
|
+
|
|
523
|
+
case 8:
|
|
524
|
+
sessionId = (0, _tracks.getRpcSessionId)(self);
|
|
525
|
+
_context3.next = 11;
|
|
526
|
+
return rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
527
|
+
featureId: f,
|
|
528
|
+
sessionId: sessionId,
|
|
529
|
+
layoutId: (0, _util.getContainingView)(self).id,
|
|
530
|
+
rendererType: 'PileupRenderer'
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
case 11:
|
|
534
|
+
_ref4 = _context3.sent;
|
|
535
|
+
feature = _ref4.feature;
|
|
536
|
+
|
|
537
|
+
if (feature) {
|
|
538
|
+
// @ts-ignore
|
|
539
|
+
self.setContextMenuFeature(new _util.SimpleFeature(feature));
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
case 14:
|
|
543
|
+
_context3.next = 20;
|
|
544
|
+
break;
|
|
545
|
+
|
|
546
|
+
case 16:
|
|
547
|
+
_context3.prev = 16;
|
|
548
|
+
_context3.t0 = _context3["catch"](2);
|
|
549
|
+
console.error(_context3.t0);
|
|
550
|
+
session.notify("".concat(_context3.t0));
|
|
551
|
+
|
|
552
|
+
case 20:
|
|
553
|
+
case "end":
|
|
554
|
+
return _context3.stop();
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}, _callee3, null, [[2, 16]]);
|
|
558
|
+
}))();
|
|
559
|
+
}
|
|
434
560
|
});
|
|
435
561
|
},
|
|
436
562
|
trackMenuItems: function trackMenuItems() {
|
|
@@ -177,7 +177,7 @@ declare const stateModelFactory: (pluginManager: PluginManager, configSchema: An
|
|
|
177
177
|
headers?: Record<string, string> | undefined;
|
|
178
178
|
signal?: AbortSignal | undefined;
|
|
179
179
|
filters?: string[] | undefined;
|
|
180
|
-
}): Promise<
|
|
180
|
+
}): Promise<{}>;
|
|
181
181
|
setRegionStatsP(p?: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").Stats> | undefined): void;
|
|
182
182
|
setRegionStats(estimatedRegionStats?: import("@jbrowse/core/data_adapters/BaseAdapter").Stats | undefined): void;
|
|
183
183
|
clearRegionStats(): void;
|
|
@@ -102,7 +102,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
102
102
|
layoutFeats(props: RenderArgsDeserializedWithFeaturesAndLayout): (LayoutRecord | null)[];
|
|
103
103
|
fetchSequence(renderProps: RenderArgsDeserialized): Promise<any>;
|
|
104
104
|
render(renderProps: RenderArgsDeserialized): Promise<{
|
|
105
|
-
features: Map<
|
|
105
|
+
features: Map<any, any>;
|
|
106
106
|
layout: import("@jbrowse/core/util/layouts").GranularRectLayout<unknown>;
|
|
107
107
|
height: number;
|
|
108
108
|
width: number;
|
|
@@ -111,7 +111,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
111
111
|
imageData?: undefined;
|
|
112
112
|
html?: string | undefined;
|
|
113
113
|
} | {
|
|
114
|
-
features: Map<
|
|
114
|
+
features: Map<any, any>;
|
|
115
115
|
layout: import("@jbrowse/core/util/layouts").GranularRectLayout<unknown>;
|
|
116
116
|
height: number;
|
|
117
117
|
width: number;
|
|
@@ -185,7 +185,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
185
185
|
throw new Error("feature ".concat(feature.id(), " is not on the current region's reference sequence ").concat(region.refName));
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
var topPx = layout.addRect(feature.id(), feature.get('start') - expansionBefore, feature.get('end') + expansionAfter, heightPx);
|
|
188
|
+
var topPx = layout.addRect(feature.id(), feature.get('start') - expansionBefore, feature.get('end') + expansionAfter, heightPx, feature);
|
|
189
189
|
|
|
190
190
|
if (topPx === null) {
|
|
191
191
|
return null;
|
|
@@ -809,7 +809,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
809
809
|
ctx.fillStyle = 'purple';
|
|
810
810
|
var pos = leftPx + extraHorizontallyFlippedOffset;
|
|
811
811
|
var len = +mismatch.base || mismatch.length;
|
|
812
|
-
var insW = Math.max(minSubfeatureWidth, Math.min(1.2, 1 / bpPerPx));
|
|
812
|
+
var insW = Math.max(minSubfeatureWidth / 2, Math.min(1.2, 1 / bpPerPx));
|
|
813
813
|
|
|
814
814
|
if (len < 10) {
|
|
815
815
|
ctx.fillRect(pos, topPx, insW, heightPx);
|
|
@@ -1187,7 +1187,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
1187
1187
|
case 23:
|
|
1188
1188
|
results = _context3.sent;
|
|
1189
1189
|
return _context3.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, results), res), {}, {
|
|
1190
|
-
features:
|
|
1190
|
+
features: new Map(),
|
|
1191
1191
|
layout: layout,
|
|
1192
1192
|
height: height,
|
|
1193
1193
|
width: width,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-alignments",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"description": "JBrowse 2 alignments adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "2c26e04ae942c380bf2f5b79ef7a49cc32b7bfed"
|
|
61
61
|
}
|
|
@@ -6,8 +6,6 @@ import PluginManager from '@jbrowse/core/PluginManager'
|
|
|
6
6
|
function PileupConfigFactory(pluginManager: PluginManager) {
|
|
7
7
|
const PileupRendererConfigSchema =
|
|
8
8
|
pluginManager.getRendererType('PileupRenderer').configSchema
|
|
9
|
-
const SvgFeatureRendererConfigSchema =
|
|
10
|
-
pluginManager.getRendererType('SvgFeatureRenderer').configSchema
|
|
11
9
|
|
|
12
10
|
// modify config schema to take in a sub coverage display
|
|
13
11
|
return ConfigurationSchema(
|
|
@@ -15,12 +13,11 @@ function PileupConfigFactory(pluginManager: PluginManager) {
|
|
|
15
13
|
{
|
|
16
14
|
defaultRendering: {
|
|
17
15
|
type: 'stringEnum',
|
|
18
|
-
model: types.enumeration('Rendering', ['pileup'
|
|
16
|
+
model: types.enumeration('Rendering', ['pileup']),
|
|
19
17
|
defaultValue: 'pileup',
|
|
20
18
|
},
|
|
21
19
|
renderers: ConfigurationSchema('RenderersConfiguration', {
|
|
22
20
|
PileupRenderer: PileupRendererConfigSchema,
|
|
23
|
-
SvgFeatureRenderer: SvgFeatureRendererConfigSchema,
|
|
24
21
|
}),
|
|
25
22
|
renderer: '',
|
|
26
23
|
maxFeatureScreenDensity: {
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
getSession,
|
|
10
10
|
isSessionModelWithWidgets,
|
|
11
11
|
getContainingView,
|
|
12
|
+
SimpleFeature,
|
|
13
|
+
Feature,
|
|
12
14
|
} from '@jbrowse/core/util'
|
|
13
15
|
|
|
14
16
|
import VisibilityIcon from '@material-ui/icons/Visibility'
|
|
@@ -19,7 +21,6 @@ import {
|
|
|
19
21
|
} from '@jbrowse/plugin-linear-genome-view'
|
|
20
22
|
import { cast, types, addDisposer, getEnv, Instance } from 'mobx-state-tree'
|
|
21
23
|
import copy from 'copy-to-clipboard'
|
|
22
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature'
|
|
23
24
|
import MenuOpenIcon from '@material-ui/icons/MenuOpen'
|
|
24
25
|
import SortIcon from '@material-ui/icons/Sort'
|
|
25
26
|
import PaletteIcon from '@material-ui/icons/Palette'
|
|
@@ -158,8 +159,15 @@ const stateModelFactory = (configSchema: LinearPileupDisplayConfigModel) =>
|
|
|
158
159
|
async () => {
|
|
159
160
|
try {
|
|
160
161
|
const { rpcManager } = getSession(self)
|
|
161
|
-
const { sortedBy, colorBy } = self
|
|
162
162
|
const view = getContainingView(self) as LGV
|
|
163
|
+
const {
|
|
164
|
+
sortedBy,
|
|
165
|
+
colorBy,
|
|
166
|
+
parentTrack,
|
|
167
|
+
adapterConfig,
|
|
168
|
+
rendererType,
|
|
169
|
+
} = self
|
|
170
|
+
const { staticBlocks, bpPerPx } = view
|
|
163
171
|
|
|
164
172
|
// continually generate the vc pairing, set and rerender if any
|
|
165
173
|
// new values seen
|
|
@@ -167,44 +175,46 @@ const stateModelFactory = (configSchema: LinearPileupDisplayConfigModel) =>
|
|
|
167
175
|
const uniqueTagSet = await getUniqueTagValues(
|
|
168
176
|
self,
|
|
169
177
|
colorBy,
|
|
170
|
-
|
|
178
|
+
staticBlocks,
|
|
171
179
|
)
|
|
172
180
|
self.updateColorTagMap(uniqueTagSet)
|
|
173
181
|
}
|
|
174
182
|
|
|
175
183
|
if (colorBy?.type === 'modifications') {
|
|
176
|
-
const
|
|
184
|
+
const adapter = getConf(parentTrack, ['adapter'])
|
|
185
|
+
self.updateModificationColorMap(
|
|
177
186
|
await getUniqueModificationValues(
|
|
178
187
|
self,
|
|
179
|
-
|
|
188
|
+
adapter,
|
|
180
189
|
colorBy,
|
|
181
|
-
|
|
182
|
-
)
|
|
183
|
-
|
|
190
|
+
staticBlocks,
|
|
191
|
+
),
|
|
192
|
+
)
|
|
184
193
|
}
|
|
185
194
|
|
|
186
195
|
if (sortedBy) {
|
|
187
196
|
const { pos, refName, assemblyName } = sortedBy
|
|
188
197
|
|
|
189
|
-
const region = {
|
|
190
|
-
start: pos,
|
|
191
|
-
end: pos + 1,
|
|
192
|
-
refName,
|
|
193
|
-
assemblyName,
|
|
194
|
-
}
|
|
195
|
-
|
|
196
198
|
// render just the sorted region first
|
|
197
199
|
await self.rendererType.renderInClient(rpcManager, {
|
|
198
200
|
assemblyName,
|
|
199
|
-
regions: [
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
regions: [
|
|
202
|
+
{
|
|
203
|
+
start: pos,
|
|
204
|
+
end: pos + 1,
|
|
205
|
+
refName,
|
|
206
|
+
assemblyName,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
adapterConfig: adapterConfig,
|
|
210
|
+
rendererType: rendererType.name,
|
|
202
211
|
sessionId: getRpcSessionId(self),
|
|
212
|
+
layoutId: view.id,
|
|
203
213
|
timeout: 1000000,
|
|
204
214
|
...self.renderProps(),
|
|
205
215
|
})
|
|
206
216
|
self.setReady(true)
|
|
207
|
-
self.setCurrBpPerPx(
|
|
217
|
+
self.setCurrBpPerPx(bpPerPx)
|
|
208
218
|
} else {
|
|
209
219
|
self.setReady(true)
|
|
210
220
|
}
|
|
@@ -404,6 +414,73 @@ const stateModelFactory = (configSchema: LinearPileupDisplayConfigModel) =>
|
|
|
404
414
|
modificationTagMap: JSON.parse(JSON.stringify(modificationTagMap)),
|
|
405
415
|
showSoftClip: self.showSoftClipping,
|
|
406
416
|
config: self.rendererConfig,
|
|
417
|
+
async onFeatureClick(_: unknown, featureId: string | undefined) {
|
|
418
|
+
const session = getSession(self)
|
|
419
|
+
const { rpcManager } = session
|
|
420
|
+
try {
|
|
421
|
+
const f = featureId || self.featureIdUnderMouse
|
|
422
|
+
if (!f) {
|
|
423
|
+
self.clearFeatureSelection()
|
|
424
|
+
} else {
|
|
425
|
+
const sessionId = getRpcSessionId(self)
|
|
426
|
+
const { feature } = (await rpcManager.call(
|
|
427
|
+
sessionId,
|
|
428
|
+
'CoreGetFeatureDetails',
|
|
429
|
+
{
|
|
430
|
+
featureId: f,
|
|
431
|
+
sessionId,
|
|
432
|
+
layoutId: getContainingView(self).id,
|
|
433
|
+
rendererType: 'PileupRenderer',
|
|
434
|
+
},
|
|
435
|
+
)) as { feature: unknown }
|
|
436
|
+
|
|
437
|
+
if (feature) {
|
|
438
|
+
// @ts-ignore
|
|
439
|
+
self.selectFeature(new SimpleFeature(feature))
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
} catch (e) {
|
|
443
|
+
console.error(e)
|
|
444
|
+
session.notify(`${e}`)
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
onClick() {
|
|
448
|
+
self.clearFeatureSelection()
|
|
449
|
+
},
|
|
450
|
+
// similar to click but opens a menu with further options
|
|
451
|
+
async onFeatureContextMenu(
|
|
452
|
+
_: unknown,
|
|
453
|
+
featureId: string | undefined,
|
|
454
|
+
) {
|
|
455
|
+
const session = getSession(self)
|
|
456
|
+
const { rpcManager } = session
|
|
457
|
+
try {
|
|
458
|
+
const f = featureId || self.featureIdUnderMouse
|
|
459
|
+
if (!f) {
|
|
460
|
+
self.clearFeatureSelection()
|
|
461
|
+
} else {
|
|
462
|
+
const sessionId = getRpcSessionId(self)
|
|
463
|
+
const { feature } = (await rpcManager.call(
|
|
464
|
+
sessionId,
|
|
465
|
+
'CoreGetFeatureDetails',
|
|
466
|
+
{
|
|
467
|
+
featureId: f,
|
|
468
|
+
sessionId,
|
|
469
|
+
layoutId: getContainingView(self).id,
|
|
470
|
+
rendererType: 'PileupRenderer',
|
|
471
|
+
},
|
|
472
|
+
)) as { feature: unknown }
|
|
473
|
+
|
|
474
|
+
if (feature) {
|
|
475
|
+
// @ts-ignore
|
|
476
|
+
self.setContextMenuFeature(new SimpleFeature(feature))
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
} catch (e) {
|
|
480
|
+
console.error(e)
|
|
481
|
+
session.notify(`${e}`)
|
|
482
|
+
}
|
|
483
|
+
},
|
|
407
484
|
}
|
|
408
485
|
},
|
|
409
486
|
|
|
@@ -191,6 +191,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
191
191
|
feature.get('start') - expansionBefore,
|
|
192
192
|
feature.get('end') + expansionAfter,
|
|
193
193
|
heightPx,
|
|
194
|
+
feature,
|
|
194
195
|
)
|
|
195
196
|
if (topPx === null) {
|
|
196
197
|
return null
|
|
@@ -814,7 +815,10 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
814
815
|
ctx.fillStyle = 'purple'
|
|
815
816
|
const pos = leftPx + extraHorizontallyFlippedOffset
|
|
816
817
|
const len = +mismatch.base || mismatch.length
|
|
817
|
-
const insW = Math.max(
|
|
818
|
+
const insW = Math.max(
|
|
819
|
+
minSubfeatureWidth / 2,
|
|
820
|
+
Math.min(1.2, 1 / bpPerPx),
|
|
821
|
+
)
|
|
818
822
|
if (len < 10) {
|
|
819
823
|
ctx.fillRect(pos, topPx, insW, heightPx)
|
|
820
824
|
if (1 / bpPerPx >= charWidth && heightPx >= heightLim) {
|
|
@@ -1117,7 +1121,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
1117
1121
|
return {
|
|
1118
1122
|
...results,
|
|
1119
1123
|
...res,
|
|
1120
|
-
features,
|
|
1124
|
+
features: new Map(),
|
|
1121
1125
|
layout,
|
|
1122
1126
|
height,
|
|
1123
1127
|
width,
|