@jbrowse/plugin-wiggle 1.6.8 → 1.7.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/dist/BigWigAdapter/BigWigAdapter.d.ts +24 -24
- package/dist/BigWigAdapter/BigWigAdapter.js +288 -0
- package/dist/BigWigAdapter/BigWigAdapter.test.js +157 -0
- package/dist/BigWigAdapter/configSchema.d.ts +2 -2
- package/dist/BigWigAdapter/configSchema.js +22 -0
- package/dist/BigWigAdapter/index.d.ts +1 -1
- package/dist/BigWigAdapter/index.js +15 -0
- package/dist/DensityRenderer/DensityRenderer.test.js +84 -0
- package/dist/DensityRenderer/index.d.ts +6 -6
- package/dist/DensityRenderer/index.js +137 -0
- package/dist/LinePlotRenderer/LinePlotRenderer.d.ts +4 -9
- package/dist/LinePlotRenderer/LinePlotRenderer.js +171 -0
- package/dist/LinePlotRenderer/configSchema.d.ts +2 -2
- package/dist/LinePlotRenderer/configSchema.js +70 -0
- package/dist/LinePlotRenderer/index.d.ts +3 -3
- package/dist/LinePlotRenderer/index.js +34 -0
- package/dist/LinearWiggleDisplay/components/SetColorDialog.d.ts +10 -10
- package/dist/LinearWiggleDisplay/components/SetColorDialog.js +111 -0
- package/dist/LinearWiggleDisplay/components/SetMinMaxDialog.d.ts +11 -11
- package/dist/LinearWiggleDisplay/components/SetMinMaxDialog.js +112 -0
- package/dist/LinearWiggleDisplay/components/Tooltip.d.ts +24 -24
- package/dist/LinearWiggleDisplay/components/Tooltip.js +167 -0
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +8 -8
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js +52 -0
- package/dist/LinearWiggleDisplay/components/YScaleBar.d.ts +7 -7
- package/dist/LinearWiggleDisplay/components/YScaleBar.js +33 -0
- package/dist/LinearWiggleDisplay/index.d.ts +3 -3
- package/dist/LinearWiggleDisplay/index.js +43 -0
- package/dist/LinearWiggleDisplay/models/configSchema.d.ts +2 -2
- package/dist/LinearWiggleDisplay/models/configSchema.js +71 -0
- package/dist/LinearWiggleDisplay/models/model.d.ts +288 -288
- package/dist/LinearWiggleDisplay/models/model.js +706 -0
- package/dist/WiggleBaseRenderer.d.ts +44 -42
- package/dist/WiggleBaseRenderer.js +131 -0
- package/dist/WiggleRPC/rpcMethods.d.ts +31 -31
- package/dist/WiggleRPC/rpcMethods.js +295 -0
- package/dist/WiggleRendering.d.ts +16 -16
- package/dist/WiggleRendering.js +109 -0
- package/dist/WiggleRendering.test.js +52 -0
- package/dist/XYPlotRenderer/XYPlotRenderer.d.ts +4 -4
- package/dist/XYPlotRenderer/XYPlotRenderer.js +199 -0
- package/dist/XYPlotRenderer/XYPlotRenderer.test.js +83 -0
- package/dist/XYPlotRenderer/index.d.ts +3 -3
- package/dist/XYPlotRenderer/index.js +34 -0
- package/dist/configSchema.d.ts +2 -2
- package/dist/configSchema.js +75 -0
- package/dist/declare.d.js +1 -0
- package/dist/index.d.ts +866 -866
- package/dist/index.js +251 -6
- package/dist/index.test.js +24 -0
- package/dist/util.d.ts +41 -41
- package/dist/util.js +178 -0
- package/dist/util.test.js +66 -0
- package/package.json +4 -6
- package/src/LinearWiggleDisplay/models/model.tsx +2 -2
- package/src/WiggleBaseRenderer.tsx +1 -0
- package/dist/DensityRenderer/DensityRenderer.test.d.ts +0 -1
- package/dist/WiggleRendering.test.d.ts +0 -1
- package/dist/XYPlotRenderer/XYPlotRenderer.test.d.ts +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin-wiggle.cjs.development.js +0 -3556
- package/dist/plugin-wiggle.cjs.development.js.map +0 -1
- package/dist/plugin-wiggle.cjs.production.min.js +0 -2
- package/dist/plugin-wiggle.cjs.production.min.js.map +0 -1
- package/dist/plugin-wiggle.esm.js +0 -3541
- package/dist/plugin-wiggle.esm.js.map +0 -1
- package/dist/util.test.d.ts +0 -1
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.YSCALEBAR_LABEL_OFFSET = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
19
|
+
|
|
20
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
+
|
|
22
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
+
|
|
24
|
+
var _configuration = require("@jbrowse/core/configuration");
|
|
25
|
+
|
|
26
|
+
var _util = require("@jbrowse/core/util");
|
|
27
|
+
|
|
28
|
+
var _tracks = require("@jbrowse/core/util/tracks");
|
|
29
|
+
|
|
30
|
+
var _pluginLinearGenomeView = require("@jbrowse/plugin-linear-genome-view");
|
|
31
|
+
|
|
32
|
+
var _mobx = require("mobx");
|
|
33
|
+
|
|
34
|
+
var _mobxStateTree = require("mobx-state-tree");
|
|
35
|
+
|
|
36
|
+
var _reactD3AxisMod = require("react-d3-axis-mod");
|
|
37
|
+
|
|
38
|
+
var _util2 = require("../../util");
|
|
39
|
+
|
|
40
|
+
var _Tooltip = _interopRequireDefault(require("../components/Tooltip"));
|
|
41
|
+
|
|
42
|
+
var _WiggleDisplayComponent = require("../components/WiggleDisplayComponent");
|
|
43
|
+
|
|
44
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
45
|
+
|
|
46
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
47
|
+
|
|
48
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
49
|
+
|
|
50
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || (0, _typeof2["default"])(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
51
|
+
|
|
52
|
+
var SetMinMaxDlg = /*#__PURE__*/(0, _react.lazy)(function () {
|
|
53
|
+
return Promise.resolve().then(function () {
|
|
54
|
+
return _interopRequireWildcard(require('../components/SetMinMaxDialog'));
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
var SetColorDlg = /*#__PURE__*/(0, _react.lazy)(function () {
|
|
58
|
+
return Promise.resolve().then(function () {
|
|
59
|
+
return _interopRequireWildcard(require('../components/SetColorDialog'));
|
|
60
|
+
});
|
|
61
|
+
}); // fudge factor for making all labels on the YScalebar visible
|
|
62
|
+
|
|
63
|
+
var YSCALEBAR_LABEL_OFFSET = 5; // using a map because it preserves order
|
|
64
|
+
|
|
65
|
+
exports.YSCALEBAR_LABEL_OFFSET = YSCALEBAR_LABEL_OFFSET;
|
|
66
|
+
var rendererTypes = new Map([['xyplot', 'XYPlotRenderer'], ['density', 'DensityRenderer'], ['line', 'LinePlotRenderer']]);
|
|
67
|
+
|
|
68
|
+
var stateModelFactory = function stateModelFactory(pluginManager, configSchema) {
|
|
69
|
+
return _mobxStateTree.types.compose('LinearWiggleDisplay', _pluginLinearGenomeView.BaseLinearDisplay, _mobxStateTree.types.model({
|
|
70
|
+
type: _mobxStateTree.types.literal('LinearWiggleDisplay'),
|
|
71
|
+
configuration: (0, _configuration.ConfigurationReference)(configSchema),
|
|
72
|
+
selectedRendering: _mobxStateTree.types.optional(_mobxStateTree.types.string, ''),
|
|
73
|
+
resolution: _mobxStateTree.types.optional(_mobxStateTree.types.number, 1),
|
|
74
|
+
fill: _mobxStateTree.types.maybe(_mobxStateTree.types["boolean"]),
|
|
75
|
+
color: _mobxStateTree.types.maybe(_mobxStateTree.types.string),
|
|
76
|
+
posColor: _mobxStateTree.types.maybe(_mobxStateTree.types.string),
|
|
77
|
+
negColor: _mobxStateTree.types.maybe(_mobxStateTree.types.string),
|
|
78
|
+
summaryScoreMode: _mobxStateTree.types.maybe(_mobxStateTree.types.string),
|
|
79
|
+
rendererTypeNameState: _mobxStateTree.types.maybe(_mobxStateTree.types.string),
|
|
80
|
+
scale: _mobxStateTree.types.maybe(_mobxStateTree.types.string),
|
|
81
|
+
autoscale: _mobxStateTree.types.maybe(_mobxStateTree.types.string),
|
|
82
|
+
displayCrossHatches: _mobxStateTree.types.maybe(_mobxStateTree.types["boolean"]),
|
|
83
|
+
constraints: _mobxStateTree.types.optional(_mobxStateTree.types.model({
|
|
84
|
+
max: _mobxStateTree.types.maybe(_mobxStateTree.types.number),
|
|
85
|
+
min: _mobxStateTree.types.maybe(_mobxStateTree.types.number)
|
|
86
|
+
}), {})
|
|
87
|
+
}))["volatile"](function () {
|
|
88
|
+
return {
|
|
89
|
+
statsReady: false,
|
|
90
|
+
message: undefined,
|
|
91
|
+
stats: {
|
|
92
|
+
scoreMin: 0,
|
|
93
|
+
scoreMax: 50
|
|
94
|
+
},
|
|
95
|
+
statsFetchInProgress: undefined
|
|
96
|
+
};
|
|
97
|
+
}).actions(function (self) {
|
|
98
|
+
return {
|
|
99
|
+
updateStats: function updateStats(_ref) {
|
|
100
|
+
var scoreMin = _ref.scoreMin,
|
|
101
|
+
scoreMax = _ref.scoreMax;
|
|
102
|
+
|
|
103
|
+
if (self.stats.scoreMin !== scoreMin || self.stats.scoreMax !== scoreMax) {
|
|
104
|
+
self.stats = {
|
|
105
|
+
scoreMin: scoreMin,
|
|
106
|
+
scoreMax: scoreMax
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
self.statsReady = true;
|
|
111
|
+
},
|
|
112
|
+
setColor: function setColor(color) {
|
|
113
|
+
self.color = color;
|
|
114
|
+
},
|
|
115
|
+
setPosColor: function setPosColor(color) {
|
|
116
|
+
self.posColor = color;
|
|
117
|
+
},
|
|
118
|
+
setNegColor: function setNegColor(color) {
|
|
119
|
+
self.negColor = color;
|
|
120
|
+
},
|
|
121
|
+
setLoading: function setLoading(aborter) {
|
|
122
|
+
var statsFetch = self.statsFetchInProgress;
|
|
123
|
+
|
|
124
|
+
if (statsFetch !== undefined && !statsFetch.signal.aborted) {
|
|
125
|
+
statsFetch.abort();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
self.statsFetchInProgress = aborter;
|
|
129
|
+
},
|
|
130
|
+
// this overrides the BaseLinearDisplayModel to avoid popping up a
|
|
131
|
+
// feature detail display, but still sets the feature selection on the
|
|
132
|
+
// model so listeners can detect a click
|
|
133
|
+
selectFeature: function selectFeature(feature) {
|
|
134
|
+
var session = (0, _util.getSession)(self);
|
|
135
|
+
|
|
136
|
+
if ((0, _util.isSelectionContainer)(session)) {
|
|
137
|
+
session.setSelection(feature);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
setResolution: function setResolution(res) {
|
|
141
|
+
self.resolution = res;
|
|
142
|
+
},
|
|
143
|
+
setFill: function setFill(fill) {
|
|
144
|
+
self.fill = fill;
|
|
145
|
+
},
|
|
146
|
+
toggleLogScale: function toggleLogScale() {
|
|
147
|
+
if (self.scale !== 'log') {
|
|
148
|
+
self.scale = 'log';
|
|
149
|
+
} else {
|
|
150
|
+
self.scale = 'linear';
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
setScaleType: function setScaleType(scale) {
|
|
154
|
+
self.scale = scale;
|
|
155
|
+
},
|
|
156
|
+
setSummaryScoreMode: function setSummaryScoreMode(val) {
|
|
157
|
+
self.summaryScoreMode = val;
|
|
158
|
+
},
|
|
159
|
+
setAutoscale: function setAutoscale(val) {
|
|
160
|
+
self.autoscale = val;
|
|
161
|
+
},
|
|
162
|
+
setMaxScore: function setMaxScore(val) {
|
|
163
|
+
self.constraints.max = val;
|
|
164
|
+
},
|
|
165
|
+
setRendererType: function setRendererType(val) {
|
|
166
|
+
self.rendererTypeNameState = val;
|
|
167
|
+
},
|
|
168
|
+
setMinScore: function setMinScore(val) {
|
|
169
|
+
self.constraints.min = val;
|
|
170
|
+
},
|
|
171
|
+
toggleCrossHatches: function toggleCrossHatches() {
|
|
172
|
+
self.displayCrossHatches = !self.displayCrossHatches;
|
|
173
|
+
},
|
|
174
|
+
setCrossHatches: function setCrossHatches(cross) {
|
|
175
|
+
self.displayCrossHatches = cross;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}).views(function (self) {
|
|
179
|
+
return {
|
|
180
|
+
get TooltipComponent() {
|
|
181
|
+
return _Tooltip["default"];
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
get adapterTypeName() {
|
|
185
|
+
return self.adapterConfig.type;
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
get rendererTypeName() {
|
|
189
|
+
var viewName = self.rendererTypeNameState || (0, _configuration.getConf)(self, 'defaultRendering');
|
|
190
|
+
var rendererType = rendererTypes.get(viewName);
|
|
191
|
+
|
|
192
|
+
if (!rendererType) {
|
|
193
|
+
throw new Error("unknown alignments view name ".concat(viewName));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return rendererType;
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
// subclasses can define these, as snpcoverage track does
|
|
200
|
+
get filters() {
|
|
201
|
+
return undefined;
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
get scaleType() {
|
|
205
|
+
return self.scale || (0, _configuration.getConf)(self, 'scaleType');
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
get maxScore() {
|
|
209
|
+
var max = self.constraints.max;
|
|
210
|
+
return max !== undefined ? max : (0, _configuration.getConf)(self, 'maxScore');
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
get minScore() {
|
|
214
|
+
var min = self.constraints.min;
|
|
215
|
+
return min !== undefined ? min : (0, _configuration.getConf)(self, 'minScore');
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
};
|
|
219
|
+
}).views(function (self) {
|
|
220
|
+
return {
|
|
221
|
+
get rendererConfig() {
|
|
222
|
+
var configBlob = (0, _configuration.getConf)(self, ['renderers', self.rendererTypeName]) || {};
|
|
223
|
+
return self.rendererType.configSchema.create(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, configBlob), {}, {
|
|
224
|
+
filled: self.fill,
|
|
225
|
+
scaleType: self.scaleType,
|
|
226
|
+
displayCrossHatches: self.displayCrossHatches,
|
|
227
|
+
summaryScoreMode: self.summaryScoreMode
|
|
228
|
+
}, self.color ? {
|
|
229
|
+
color: self.color
|
|
230
|
+
} : {}), self.negColor ? {
|
|
231
|
+
negColor: self.negColor
|
|
232
|
+
} : {}), self.posColor ? {
|
|
233
|
+
posColor: self.posColor
|
|
234
|
+
} : {}), (0, _mobxStateTree.getEnv)(self));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
};
|
|
238
|
+
}).views(function (self) {
|
|
239
|
+
var oldDomain = [0, 0];
|
|
240
|
+
return {
|
|
241
|
+
get filled() {
|
|
242
|
+
return typeof self.fill !== 'undefined' ? self.fill : (0, _configuration.readConfObject)(self.rendererConfig, 'filled');
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
get summaryScoreModeSetting() {
|
|
246
|
+
return self.summaryScoreMode || (0, _configuration.readConfObject)(self.rendererConfig, 'summaryScoreMode');
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
get domain() {
|
|
250
|
+
var stats = self.stats,
|
|
251
|
+
scaleType = self.scaleType,
|
|
252
|
+
minScore = self.minScore,
|
|
253
|
+
maxScore = self.maxScore;
|
|
254
|
+
var scoreMin = stats.scoreMin,
|
|
255
|
+
scoreMax = stats.scoreMax;
|
|
256
|
+
var ret = (0, _util2.getNiceDomain)({
|
|
257
|
+
domain: [scoreMin, scoreMax],
|
|
258
|
+
bounds: [minScore, maxScore],
|
|
259
|
+
scaleType: scaleType
|
|
260
|
+
}); // avoid weird scalebar if log value and empty region displayed
|
|
261
|
+
|
|
262
|
+
if (scaleType === 'log' && ret[1] === Number.MIN_VALUE) {
|
|
263
|
+
return [0, Number.MIN_VALUE];
|
|
264
|
+
} // avoid returning a new object if it matches the old value
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
if (JSON.stringify(oldDomain) !== JSON.stringify(ret)) {
|
|
268
|
+
oldDomain = ret;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return oldDomain;
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
get needsScalebar() {
|
|
275
|
+
return self.rendererTypeName === 'XYPlotRenderer' || self.rendererTypeName === 'LinePlotRenderer';
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
get scaleOpts() {
|
|
279
|
+
return {
|
|
280
|
+
domain: this.domain,
|
|
281
|
+
stats: self.stats,
|
|
282
|
+
autoscaleType: this.autoscaleType,
|
|
283
|
+
scaleType: self.scaleType,
|
|
284
|
+
inverted: (0, _configuration.getConf)(self, 'inverted')
|
|
285
|
+
};
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
get canHaveFill() {
|
|
289
|
+
return self.rendererTypeName === 'XYPlotRenderer';
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
get autoscaleType() {
|
|
293
|
+
return self.autoscale || (0, _configuration.getConf)(self, 'autoscale');
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
get displayCrossHatchesSetting() {
|
|
297
|
+
return self.displayCrossHatches || (0, _configuration.readConfObject)(self.rendererConfig, 'displayCrossHatches');
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
};
|
|
301
|
+
}).views(function (self) {
|
|
302
|
+
return {
|
|
303
|
+
get ticks() {
|
|
304
|
+
var scaleType = self.scaleType,
|
|
305
|
+
domain = self.domain,
|
|
306
|
+
height = self.height;
|
|
307
|
+
var minimalTicks = (0, _configuration.getConf)(self, 'minimalTicks');
|
|
308
|
+
var range = [height - YSCALEBAR_LABEL_OFFSET, YSCALEBAR_LABEL_OFFSET];
|
|
309
|
+
var scale = (0, _util2.getScale)({
|
|
310
|
+
scaleType: scaleType,
|
|
311
|
+
domain: domain,
|
|
312
|
+
range: range,
|
|
313
|
+
inverted: (0, _configuration.getConf)(self, 'inverted')
|
|
314
|
+
});
|
|
315
|
+
var ticks = (0, _reactD3AxisMod.axisPropsFromTickScale)(scale, 4);
|
|
316
|
+
return height < 100 || minimalTicks ? _objectSpread(_objectSpread({}, ticks), {}, {
|
|
317
|
+
values: domain
|
|
318
|
+
}) : ticks;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
};
|
|
322
|
+
}).views(function (self) {
|
|
323
|
+
var superRenderProps = self.renderProps;
|
|
324
|
+
return {
|
|
325
|
+
renderProps: function renderProps() {
|
|
326
|
+
var superProps = superRenderProps();
|
|
327
|
+
return _objectSpread(_objectSpread({}, superProps), {}, {
|
|
328
|
+
notReady: superProps.notReady || !self.statsReady,
|
|
329
|
+
rpcDriverName: self.rpcDriverName,
|
|
330
|
+
displayModel: self,
|
|
331
|
+
config: self.rendererConfig,
|
|
332
|
+
scaleOpts: self.scaleOpts,
|
|
333
|
+
resolution: self.resolution,
|
|
334
|
+
height: self.height,
|
|
335
|
+
ticks: self.ticks,
|
|
336
|
+
displayCrossHatches: self.displayCrossHatches,
|
|
337
|
+
filters: self.filters
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
get adapterCapabilities() {
|
|
342
|
+
return pluginManager.getAdapterType(self.adapterTypeName).adapterCapabilities;
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
get hasResolution() {
|
|
346
|
+
return this.adapterCapabilities.includes('hasResolution');
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
get hasGlobalStats() {
|
|
350
|
+
return this.adapterCapabilities.includes('hasGlobalStats');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
};
|
|
354
|
+
}).views(function (self) {
|
|
355
|
+
var superTrackMenuItems = self.trackMenuItems;
|
|
356
|
+
return {
|
|
357
|
+
trackMenuItems: function trackMenuItems() {
|
|
358
|
+
return [].concat((0, _toConsumableArray2["default"])(superTrackMenuItems()), (0, _toConsumableArray2["default"])(self.hasResolution ? [{
|
|
359
|
+
label: 'Resolution',
|
|
360
|
+
subMenu: [{
|
|
361
|
+
label: 'Finer resolution',
|
|
362
|
+
onClick: function onClick() {
|
|
363
|
+
self.setResolution(self.resolution * 5);
|
|
364
|
+
}
|
|
365
|
+
}, {
|
|
366
|
+
label: 'Coarser resolution',
|
|
367
|
+
onClick: function onClick() {
|
|
368
|
+
self.setResolution(self.resolution / 5);
|
|
369
|
+
}
|
|
370
|
+
}]
|
|
371
|
+
}, {
|
|
372
|
+
label: 'Summary score mode',
|
|
373
|
+
subMenu: ['min', 'max', 'avg', 'whiskers'].map(function (elt) {
|
|
374
|
+
return {
|
|
375
|
+
label: elt,
|
|
376
|
+
onClick: function onClick() {
|
|
377
|
+
return self.setSummaryScoreMode(elt);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
})
|
|
381
|
+
}] : []), (0, _toConsumableArray2["default"])(self.canHaveFill ? [{
|
|
382
|
+
label: self.filled ? 'Turn off histogram fill' : 'Turn on histogram fill',
|
|
383
|
+
onClick: function onClick() {
|
|
384
|
+
self.setFill(!self.filled);
|
|
385
|
+
}
|
|
386
|
+
}] : []), [{
|
|
387
|
+
label: self.scaleType === 'log' ? 'Set linear scale' : 'Set log scale',
|
|
388
|
+
onClick: function onClick() {
|
|
389
|
+
self.toggleLogScale();
|
|
390
|
+
}
|
|
391
|
+
}, {
|
|
392
|
+
type: 'checkbox',
|
|
393
|
+
label: 'Draw cross hatches',
|
|
394
|
+
checked: self.displayCrossHatchesSetting,
|
|
395
|
+
onClick: function onClick() {
|
|
396
|
+
self.toggleCrossHatches();
|
|
397
|
+
}
|
|
398
|
+
}], (0, _toConsumableArray2["default"])(Object.keys((0, _configuration.getConf)(self, 'renderers') || {}).length > 1 ? [{
|
|
399
|
+
label: 'Renderer type',
|
|
400
|
+
subMenu: (0, _toConsumableArray2["default"])(rendererTypes.keys()).map(function (key) {
|
|
401
|
+
return {
|
|
402
|
+
label: key,
|
|
403
|
+
onClick: function onClick() {
|
|
404
|
+
return self.setRendererType(key);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
})
|
|
408
|
+
}] : []), [{
|
|
409
|
+
label: 'Autoscale type',
|
|
410
|
+
subMenu: [['local', 'Local']].concat((0, _toConsumableArray2["default"])(self.hasGlobalStats ? [['global', 'Global'], ['globalsd', 'Global ± 3σ']] : []), [['localsd', 'Local ± 3σ']]).map(function (_ref2) {
|
|
411
|
+
var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2),
|
|
412
|
+
val = _ref3[0],
|
|
413
|
+
label = _ref3[1];
|
|
414
|
+
|
|
415
|
+
return {
|
|
416
|
+
label: label,
|
|
417
|
+
onClick: function onClick() {
|
|
418
|
+
self.setAutoscale(val);
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
})
|
|
422
|
+
}, {
|
|
423
|
+
label: 'Set min/max score',
|
|
424
|
+
onClick: function onClick() {
|
|
425
|
+
(0, _util.getSession)(self).queueDialog(function (doneCallback) {
|
|
426
|
+
return [SetMinMaxDlg, {
|
|
427
|
+
model: self,
|
|
428
|
+
handleClose: doneCallback
|
|
429
|
+
}];
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}, {
|
|
433
|
+
label: 'Set color',
|
|
434
|
+
onClick: function onClick() {
|
|
435
|
+
(0, _util.getSession)(self).queueDialog(function (doneCallback) {
|
|
436
|
+
return [SetColorDlg, {
|
|
437
|
+
model: self,
|
|
438
|
+
handleClose: doneCallback
|
|
439
|
+
}];
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}]);
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
}).actions(function (self) {
|
|
446
|
+
var superReload = self.reload,
|
|
447
|
+
superRenderSvg = self.renderSvg;
|
|
448
|
+
|
|
449
|
+
function getStats(_x) {
|
|
450
|
+
return _getStats.apply(this, arguments);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function _getStats() {
|
|
454
|
+
_getStats = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(opts) {
|
|
455
|
+
var _getSession, rpcManager, nd, adapterConfig, autoscaleType, sessionId, params, results, scoreMin, scoreMean, scoreStdDev, _ref6, dynamicBlocks, bpPerPx, _results, _scoreMin, _scoreMean, _scoreStdDev;
|
|
456
|
+
|
|
457
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
458
|
+
while (1) {
|
|
459
|
+
switch (_context4.prev = _context4.next) {
|
|
460
|
+
case 0:
|
|
461
|
+
_getSession = (0, _util.getSession)(self), rpcManager = _getSession.rpcManager;
|
|
462
|
+
nd = (0, _configuration.getConf)(self, 'numStdDev') || 3;
|
|
463
|
+
adapterConfig = self.adapterConfig, autoscaleType = self.autoscaleType;
|
|
464
|
+
sessionId = (0, _tracks.getRpcSessionId)(self);
|
|
465
|
+
params = _objectSpread({
|
|
466
|
+
sessionId: sessionId,
|
|
467
|
+
adapterConfig: adapterConfig,
|
|
468
|
+
statusCallback: function statusCallback(message) {
|
|
469
|
+
if ((0, _mobxStateTree.isAlive)(self)) {
|
|
470
|
+
self.setMessage(message);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}, opts);
|
|
474
|
+
|
|
475
|
+
if (!(autoscaleType === 'global' || autoscaleType === 'globalsd')) {
|
|
476
|
+
_context4.next = 11;
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
_context4.next = 8;
|
|
481
|
+
return rpcManager.call(sessionId, 'WiggleGetGlobalStats', params);
|
|
482
|
+
|
|
483
|
+
case 8:
|
|
484
|
+
results = _context4.sent;
|
|
485
|
+
scoreMin = results.scoreMin, scoreMean = results.scoreMean, scoreStdDev = results.scoreStdDev; // globalsd uses heuristic to avoid unnecessary scoreMin<0
|
|
486
|
+
// if the scoreMin is never less than 0
|
|
487
|
+
// helps with most coverage bigwigs just being >0
|
|
488
|
+
|
|
489
|
+
return _context4.abrupt("return", autoscaleType === 'globalsd' ? _objectSpread(_objectSpread({}, results), {}, {
|
|
490
|
+
scoreMin: scoreMin >= 0 ? 0 : scoreMean - nd * scoreStdDev,
|
|
491
|
+
scoreMax: scoreMean + nd * scoreStdDev
|
|
492
|
+
}) : results);
|
|
493
|
+
|
|
494
|
+
case 11:
|
|
495
|
+
if (!(autoscaleType === 'local' || autoscaleType === 'localsd')) {
|
|
496
|
+
_context4.next = 18;
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
_ref6 = (0, _util.getContainingView)(self), dynamicBlocks = _ref6.dynamicBlocks, bpPerPx = _ref6.bpPerPx;
|
|
501
|
+
_context4.next = 15;
|
|
502
|
+
return rpcManager.call(sessionId, 'WiggleGetMultiRegionStats', _objectSpread(_objectSpread({}, params), {}, {
|
|
503
|
+
regions: dynamicBlocks.contentBlocks.map(function (region) {
|
|
504
|
+
var start = region.start,
|
|
505
|
+
end = region.end;
|
|
506
|
+
return _objectSpread(_objectSpread({}, JSON.parse(JSON.stringify(region))), {}, {
|
|
507
|
+
start: Math.floor(start),
|
|
508
|
+
end: Math.ceil(end)
|
|
509
|
+
});
|
|
510
|
+
}),
|
|
511
|
+
bpPerPx: bpPerPx
|
|
512
|
+
}));
|
|
513
|
+
|
|
514
|
+
case 15:
|
|
515
|
+
_results = _context4.sent;
|
|
516
|
+
_scoreMin = _results.scoreMin, _scoreMean = _results.scoreMean, _scoreStdDev = _results.scoreStdDev; // localsd uses heuristic to avoid unnecessary scoreMin<0 if the
|
|
517
|
+
// scoreMin is never less than 0 helps with most coverage bigwigs
|
|
518
|
+
// just being >0
|
|
519
|
+
|
|
520
|
+
return _context4.abrupt("return", autoscaleType === 'localsd' ? _objectSpread(_objectSpread({}, _results), {}, {
|
|
521
|
+
scoreMin: _scoreMin >= 0 ? 0 : _scoreMean - nd * _scoreStdDev,
|
|
522
|
+
scoreMax: _scoreMean + nd * _scoreStdDev
|
|
523
|
+
}) : _results);
|
|
524
|
+
|
|
525
|
+
case 18:
|
|
526
|
+
if (!(autoscaleType === 'zscale')) {
|
|
527
|
+
_context4.next = 20;
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
return _context4.abrupt("return", rpcManager.call(sessionId, 'WiggleGetGlobalStats', params));
|
|
532
|
+
|
|
533
|
+
case 20:
|
|
534
|
+
throw new Error("invalid autoscaleType '".concat(autoscaleType, "'"));
|
|
535
|
+
|
|
536
|
+
case 21:
|
|
537
|
+
case "end":
|
|
538
|
+
return _context4.stop();
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}, _callee4);
|
|
542
|
+
}));
|
|
543
|
+
return _getStats.apply(this, arguments);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return {
|
|
547
|
+
// re-runs stats and refresh whole display on reload
|
|
548
|
+
reload: function reload() {
|
|
549
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
550
|
+
var aborter, stats;
|
|
551
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
552
|
+
while (1) {
|
|
553
|
+
switch (_context.prev = _context.next) {
|
|
554
|
+
case 0:
|
|
555
|
+
self.setError();
|
|
556
|
+
aborter = new AbortController();
|
|
557
|
+
_context.prev = 2;
|
|
558
|
+
_context.next = 5;
|
|
559
|
+
return getStats(_objectSpread({
|
|
560
|
+
signal: aborter.signal
|
|
561
|
+
}, self.renderProps()));
|
|
562
|
+
|
|
563
|
+
case 5:
|
|
564
|
+
stats = _context.sent;
|
|
565
|
+
|
|
566
|
+
if ((0, _mobxStateTree.isAlive)(self)) {
|
|
567
|
+
self.updateStats(stats);
|
|
568
|
+
superReload();
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
_context.next = 12;
|
|
572
|
+
break;
|
|
573
|
+
|
|
574
|
+
case 9:
|
|
575
|
+
_context.prev = 9;
|
|
576
|
+
_context.t0 = _context["catch"](2);
|
|
577
|
+
self.setError(_context.t0);
|
|
578
|
+
|
|
579
|
+
case 12:
|
|
580
|
+
case "end":
|
|
581
|
+
return _context.stop();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}, _callee, null, [[2, 9]]);
|
|
585
|
+
}))();
|
|
586
|
+
},
|
|
587
|
+
afterAttach: function afterAttach() {
|
|
588
|
+
(0, _mobxStateTree.addDisposer)(self, (0, _mobx.autorun)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
589
|
+
var aborter, view, wiggleStats;
|
|
590
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
591
|
+
while (1) {
|
|
592
|
+
switch (_context2.prev = _context2.next) {
|
|
593
|
+
case 0:
|
|
594
|
+
_context2.prev = 0;
|
|
595
|
+
aborter = new AbortController();
|
|
596
|
+
view = (0, _util.getContainingView)(self);
|
|
597
|
+
self.setLoading(aborter);
|
|
598
|
+
|
|
599
|
+
if (view.initialized) {
|
|
600
|
+
_context2.next = 6;
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return _context2.abrupt("return");
|
|
605
|
+
|
|
606
|
+
case 6:
|
|
607
|
+
if (self.estimatedStatsReady) {
|
|
608
|
+
_context2.next = 8;
|
|
609
|
+
break;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
return _context2.abrupt("return");
|
|
613
|
+
|
|
614
|
+
case 8:
|
|
615
|
+
if (!self.regionTooLarge) {
|
|
616
|
+
_context2.next = 10;
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
return _context2.abrupt("return");
|
|
621
|
+
|
|
622
|
+
case 10:
|
|
623
|
+
_context2.next = 12;
|
|
624
|
+
return getStats(_objectSpread({
|
|
625
|
+
signal: aborter.signal
|
|
626
|
+
}, self.renderProps()));
|
|
627
|
+
|
|
628
|
+
case 12:
|
|
629
|
+
wiggleStats = _context2.sent;
|
|
630
|
+
|
|
631
|
+
if ((0, _mobxStateTree.isAlive)(self)) {
|
|
632
|
+
self.updateStats(wiggleStats);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
_context2.next = 19;
|
|
636
|
+
break;
|
|
637
|
+
|
|
638
|
+
case 16:
|
|
639
|
+
_context2.prev = 16;
|
|
640
|
+
_context2.t0 = _context2["catch"](0);
|
|
641
|
+
|
|
642
|
+
if (!(0, _util.isAbortException)(_context2.t0) && (0, _mobxStateTree.isAlive)(self)) {
|
|
643
|
+
console.error(_context2.t0);
|
|
644
|
+
self.setError(_context2.t0);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
case 19:
|
|
648
|
+
case "end":
|
|
649
|
+
return _context2.stop();
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}, _callee2, null, [[0, 16]]);
|
|
653
|
+
})), {
|
|
654
|
+
delay: 1000
|
|
655
|
+
}));
|
|
656
|
+
},
|
|
657
|
+
renderSvg: function renderSvg(opts) {
|
|
658
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
659
|
+
var needsScalebar, stats, _ref5, offsetPx;
|
|
660
|
+
|
|
661
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
662
|
+
while (1) {
|
|
663
|
+
switch (_context3.prev = _context3.next) {
|
|
664
|
+
case 0:
|
|
665
|
+
_context3.next = 2;
|
|
666
|
+
return (0, _mobx.when)(function () {
|
|
667
|
+
return self.statsReady && !!self.regionCannotBeRenderedText;
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
case 2:
|
|
671
|
+
needsScalebar = self.needsScalebar, stats = self.stats;
|
|
672
|
+
_ref5 = (0, _util.getContainingView)(self), offsetPx = _ref5.offsetPx;
|
|
673
|
+
_context3.t0 = _react["default"];
|
|
674
|
+
_context3.t1 = _react["default"].Fragment;
|
|
675
|
+
_context3.t2 = _react["default"];
|
|
676
|
+
_context3.t3 = {
|
|
677
|
+
id: "snpcov"
|
|
678
|
+
};
|
|
679
|
+
_context3.next = 10;
|
|
680
|
+
return superRenderSvg(opts);
|
|
681
|
+
|
|
682
|
+
case 10:
|
|
683
|
+
_context3.t4 = _context3.sent;
|
|
684
|
+
_context3.t5 = _context3.t2.createElement.call(_context3.t2, "g", _context3.t3, _context3.t4);
|
|
685
|
+
_context3.t6 = needsScalebar && stats ? /*#__PURE__*/_react["default"].createElement("g", {
|
|
686
|
+
transform: "translate(".concat(Math.max(-offsetPx, 0), ")")
|
|
687
|
+
}, /*#__PURE__*/_react["default"].createElement(_WiggleDisplayComponent.YScaleBar, {
|
|
688
|
+
model: self,
|
|
689
|
+
orientation: "left"
|
|
690
|
+
})) : null;
|
|
691
|
+
return _context3.abrupt("return", _context3.t0.createElement.call(_context3.t0, _context3.t1, null, _context3.t5, _context3.t6));
|
|
692
|
+
|
|
693
|
+
case 14:
|
|
694
|
+
case "end":
|
|
695
|
+
return _context3.stop();
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}, _callee3);
|
|
699
|
+
}))();
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
});
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
var _default = stateModelFactory;
|
|
706
|
+
exports["default"] = _default;
|