@jbrowse/plugin-wiggle 1.7.10 → 2.0.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.js +176 -284
- package/dist/BigWigAdapter/BigWigAdapter.js.map +1 -0
- package/dist/BigWigAdapter/configSchema.js +12 -21
- package/dist/BigWigAdapter/configSchema.js.map +1 -0
- package/dist/BigWigAdapter/index.js +8 -14
- package/dist/BigWigAdapter/index.js.map +1 -0
- package/dist/DensityRenderer/index.d.ts +1 -1
- package/dist/DensityRenderer/index.js +152 -133
- package/dist/DensityRenderer/index.js.map +1 -0
- package/dist/LinePlotRenderer/LinePlotRenderer.d.ts +1 -1
- package/dist/LinePlotRenderer/LinePlotRenderer.js +182 -168
- package/dist/LinePlotRenderer/LinePlotRenderer.js.map +1 -0
- package/dist/LinePlotRenderer/index.js +19 -33
- package/dist/LinePlotRenderer/index.js.map +1 -0
- package/dist/LinearWiggleDisplay/components/SetColorDialog.js +95 -105
- package/dist/LinearWiggleDisplay/components/SetColorDialog.js.map +1 -0
- package/dist/LinearWiggleDisplay/components/SetMinMaxDialog.js +86 -107
- package/dist/LinearWiggleDisplay/components/SetMinMaxDialog.js.map +1 -0
- package/dist/LinearWiggleDisplay/components/Tooltip.js +147 -152
- package/dist/LinearWiggleDisplay/components/Tooltip.js.map +1 -0
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js +44 -50
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -0
- package/dist/LinearWiggleDisplay/components/YScaleBar.js +24 -31
- package/dist/LinearWiggleDisplay/components/YScaleBar.js.map +1 -0
- package/dist/LinearWiggleDisplay/index.js +13 -42
- package/dist/LinearWiggleDisplay/index.js.map +1 -0
- package/dist/LinearWiggleDisplay/models/configSchema.js +65 -69
- package/dist/LinearWiggleDisplay/models/configSchema.js.map +1 -0
- package/dist/LinearWiggleDisplay/models/model.d.ts +16 -14
- package/dist/LinearWiggleDisplay/models/model.js +585 -696
- package/dist/LinearWiggleDisplay/models/model.js.map +1 -0
- package/dist/WiggleBaseRenderer.d.ts +3 -3
- package/dist/WiggleBaseRenderer.js +119 -129
- package/dist/WiggleBaseRenderer.js.map +1 -0
- package/dist/WiggleRPC/rpcMethods.js +182 -288
- package/dist/WiggleRPC/rpcMethods.js.map +1 -0
- package/dist/WiggleRendering.js +107 -102
- package/dist/WiggleRendering.js.map +1 -0
- package/dist/XYPlotRenderer/XYPlotRenderer.d.ts +1 -1
- package/dist/XYPlotRenderer/XYPlotRenderer.js +250 -194
- package/dist/XYPlotRenderer/XYPlotRenderer.js.map +1 -0
- package/dist/XYPlotRenderer/index.js +30 -33
- package/dist/XYPlotRenderer/index.js.map +1 -0
- package/dist/configSchema.js +47 -74
- package/dist/configSchema.js.map +1 -0
- package/dist/index.d.ts +118 -67
- package/dist/index.js +167 -242
- package/dist/index.js.map +1 -0
- package/dist/util.js +112 -143
- package/dist/util.js.map +1 -0
- package/esm/BigWigAdapter/BigWigAdapter.d.ts +24 -0
- package/esm/BigWigAdapter/BigWigAdapter.js +62 -0
- package/esm/BigWigAdapter/BigWigAdapter.js.map +1 -0
- package/{dist/LinePlotRenderer → esm/BigWigAdapter}/configSchema.d.ts +0 -0
- package/esm/BigWigAdapter/configSchema.js +11 -0
- package/esm/BigWigAdapter/configSchema.js.map +1 -0
- package/esm/BigWigAdapter/index.d.ts +1 -0
- package/esm/BigWigAdapter/index.js +2 -0
- package/esm/BigWigAdapter/index.js.map +1 -0
- package/esm/DensityRenderer/index.d.ts +6 -0
- package/esm/DensityRenderer/index.js +39 -0
- package/esm/DensityRenderer/index.js.map +1 -0
- package/esm/LinePlotRenderer/LinePlotRenderer.d.ts +4 -0
- package/esm/LinePlotRenderer/LinePlotRenderer.js +71 -0
- package/esm/LinePlotRenderer/LinePlotRenderer.js.map +1 -0
- package/esm/LinePlotRenderer/index.d.ts +3 -0
- package/esm/LinePlotRenderer/index.js +12 -0
- package/esm/LinePlotRenderer/index.js.map +1 -0
- package/esm/LinearWiggleDisplay/components/SetColorDialog.d.ts +10 -0
- package/esm/LinearWiggleDisplay/components/SetColorDialog.js +55 -0
- package/esm/LinearWiggleDisplay/components/SetColorDialog.js.map +1 -0
- package/esm/LinearWiggleDisplay/components/SetMinMaxDialog.d.ts +11 -0
- package/esm/LinearWiggleDisplay/components/SetMinMaxDialog.js +46 -0
- package/esm/LinearWiggleDisplay/components/SetMinMaxDialog.js.map +1 -0
- package/esm/LinearWiggleDisplay/components/Tooltip.d.ts +24 -0
- package/esm/LinearWiggleDisplay/components/Tooltip.js +107 -0
- package/esm/LinearWiggleDisplay/components/Tooltip.js.map +1 -0
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +8 -0
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js +29 -0
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -0
- package/esm/LinearWiggleDisplay/components/YScaleBar.d.ts +7 -0
- package/esm/LinearWiggleDisplay/components/YScaleBar.js +9 -0
- package/esm/LinearWiggleDisplay/components/YScaleBar.js.map +1 -0
- package/esm/LinearWiggleDisplay/index.d.ts +3 -0
- package/esm/LinearWiggleDisplay/index.js +4 -0
- package/esm/LinearWiggleDisplay/index.js.map +1 -0
- package/esm/LinearWiggleDisplay/models/configSchema.d.ts +2 -0
- package/esm/LinearWiggleDisplay/models/configSchema.js +64 -0
- package/esm/LinearWiggleDisplay/models/configSchema.js.map +1 -0
- package/esm/LinearWiggleDisplay/models/model.d.ts +290 -0
- package/esm/LinearWiggleDisplay/models/model.js +495 -0
- package/esm/LinearWiggleDisplay/models/model.js.map +1 -0
- package/esm/WiggleBaseRenderer.d.ts +55 -0
- package/esm/WiggleBaseRenderer.js +34 -0
- package/esm/WiggleBaseRenderer.js.map +1 -0
- package/esm/WiggleRPC/rpcMethods.d.ts +31 -0
- package/esm/WiggleRPC/rpcMethods.js +70 -0
- package/esm/WiggleRPC/rpcMethods.js.map +1 -0
- package/esm/WiggleRendering.d.ts +16 -0
- package/esm/WiggleRendering.js +40 -0
- package/esm/WiggleRendering.js.map +1 -0
- package/esm/XYPlotRenderer/XYPlotRenderer.d.ts +4 -0
- package/esm/XYPlotRenderer/XYPlotRenderer.js +109 -0
- package/esm/XYPlotRenderer/XYPlotRenderer.js.map +1 -0
- package/esm/XYPlotRenderer/index.d.ts +3 -0
- package/esm/XYPlotRenderer/index.js +23 -0
- package/esm/XYPlotRenderer/index.js.map +1 -0
- package/esm/configSchema.d.ts +2 -0
- package/esm/configSchema.js +46 -0
- package/esm/configSchema.js.map +1 -0
- package/esm/index.d.ts +917 -0
- package/esm/index.js +115 -0
- package/esm/index.js.map +1 -0
- package/esm/util.d.ts +41 -0
- package/esm/util.js +123 -0
- package/esm/util.js.map +1 -0
- package/package.json +23 -15
- package/src/DensityRenderer/DensityRenderer.test.js +5 -0
- package/src/DensityRenderer/index.ts +1 -1
- package/src/LinePlotRenderer/LinePlotRenderer.js +1 -1
- package/src/LinePlotRenderer/index.js +7 -1
- package/src/LinearWiggleDisplay/components/SetColorDialog.tsx +10 -13
- package/src/LinearWiggleDisplay/components/SetMinMaxDialog.tsx +13 -11
- package/src/LinearWiggleDisplay/components/Tooltip.tsx +4 -3
- package/src/LinearWiggleDisplay/components/WiggleDisplayComponent.tsx +9 -4
- package/src/LinearWiggleDisplay/models/model.tsx +56 -65
- package/src/WiggleBaseRenderer.tsx +3 -3
- package/src/XYPlotRenderer/XYPlotRenderer.test.js +5 -0
- package/src/XYPlotRenderer/XYPlotRenderer.ts +87 -40
- package/src/XYPlotRenderer/index.ts +19 -2
- package/src/configSchema.ts +0 -23
- package/dist/BigWigAdapter/BigWigAdapter.test.js +0 -157
- package/dist/DensityRenderer/DensityRenderer.test.js +0 -84
- package/dist/LinePlotRenderer/configSchema.js +0 -70
- package/dist/WiggleRendering.test.js +0 -52
- package/dist/XYPlotRenderer/XYPlotRenderer.test.js +0 -83
- package/dist/declare.d.js +0 -1
- package/dist/index.test.js +0 -24
- package/dist/util.test.js +0 -66
- package/src/LinePlotRenderer/configSchema.js +0 -68
|
@@ -1,137 +1,156 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
-
|
|
26
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
-
|
|
30
|
-
var _configuration = require("@jbrowse/core/configuration");
|
|
31
|
-
|
|
32
|
-
var _util = require("@jbrowse/core/util");
|
|
33
|
-
|
|
34
|
-
var _util2 = require("../util");
|
|
35
|
-
|
|
36
|
-
var _configSchema = _interopRequireDefault(require("../configSchema"));
|
|
37
|
-
|
|
38
|
-
var _WiggleBaseRenderer2 = _interopRequireDefault(require("../WiggleBaseRenderer"));
|
|
39
|
-
|
|
40
|
-
var _WiggleRendering = _interopRequireDefault(require("../WiggleRendering"));
|
|
41
|
-
|
|
42
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
43
|
-
|
|
44
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
45
|
-
|
|
46
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
47
|
-
|
|
48
|
-
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; }
|
|
49
|
-
|
|
50
|
-
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; }
|
|
51
|
-
|
|
52
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
53
|
-
|
|
54
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
55
|
-
|
|
56
|
-
var DensityRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
|
|
57
|
-
(0, _inherits2.default)(DensityRenderer, _WiggleBaseRenderer);
|
|
58
|
-
|
|
59
|
-
var _super = _createSuper(DensityRenderer);
|
|
60
|
-
|
|
61
|
-
function DensityRenderer() {
|
|
62
|
-
(0, _classCallCheck2.default)(this, DensityRenderer);
|
|
63
|
-
return _super.apply(this, arguments);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
(0, _createClass2.default)(DensityRenderer, [{
|
|
67
|
-
key: "draw",
|
|
68
|
-
value: function draw(ctx, props) {
|
|
69
|
-
var features = props.features,
|
|
70
|
-
regions = props.regions,
|
|
71
|
-
bpPerPx = props.bpPerPx,
|
|
72
|
-
scaleOpts = props.scaleOpts,
|
|
73
|
-
height = props.height,
|
|
74
|
-
config = props.config;
|
|
75
|
-
|
|
76
|
-
var _regions = (0, _slicedToArray2.default)(regions, 1),
|
|
77
|
-
region = _regions[0];
|
|
78
|
-
|
|
79
|
-
var pivot = (0, _configuration.readConfObject)(config, 'bicolorPivot');
|
|
80
|
-
var pivotValue = (0, _configuration.readConfObject)(config, 'bicolorPivotValue');
|
|
81
|
-
var negColor = (0, _configuration.readConfObject)(config, 'negColor');
|
|
82
|
-
var posColor = (0, _configuration.readConfObject)(config, 'posColor');
|
|
83
|
-
var color = (0, _configuration.readConfObject)(config, 'color');
|
|
84
|
-
var colorCallback;
|
|
85
|
-
|
|
86
|
-
if (color === '#f0f') {
|
|
87
|
-
var colorScale = pivot !== 'none' ? (0, _util2.getScale)(_objectSpread(_objectSpread({}, scaleOpts), {}, {
|
|
88
|
-
pivotValue: pivotValue,
|
|
89
|
-
range: [negColor, 'white', posColor]
|
|
90
|
-
})) : (0, _util2.getScale)(_objectSpread(_objectSpread({}, scaleOpts), {}, {
|
|
91
|
-
range: ['white', posColor]
|
|
92
|
-
}));
|
|
93
|
-
|
|
94
|
-
colorCallback = function colorCallback(feature) {
|
|
95
|
-
return colorScale(feature.get('score'));
|
|
96
|
-
};
|
|
97
|
-
} else {
|
|
98
|
-
colorCallback = function colorCallback(feature) {
|
|
99
|
-
return (0, _configuration.readConfObject)(config, 'color', {
|
|
100
|
-
feature: feature
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
var _iterator = _createForOfIteratorHelper(features.values()),
|
|
106
|
-
_step;
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
110
|
-
var feature = _step.value;
|
|
111
|
-
|
|
112
|
-
var _featureSpanPx = (0, _util.featureSpanPx)(feature, region, bpPerPx),
|
|
113
|
-
_featureSpanPx2 = (0, _slicedToArray2.default)(_featureSpanPx, 2),
|
|
114
|
-
leftPx = _featureSpanPx2[0],
|
|
115
|
-
rightPx = _featureSpanPx2[1];
|
|
116
|
-
|
|
117
|
-
var w = rightPx - leftPx + 0.3; // fudge factor for subpixel rendering
|
|
118
|
-
|
|
119
|
-
ctx.fillStyle = colorCallback(feature);
|
|
120
|
-
ctx.fillRect(leftPx, 0, w, height);
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
121
23
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
+
function step(op) {
|
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
+
while (_) try {
|
|
44
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
+
switch (op[0]) {
|
|
47
|
+
case 0: case 1: t = op; break;
|
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
+
default:
|
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
+
if (t[2]) _.ops.pop();
|
|
57
|
+
_.trys.pop(); continue;
|
|
58
|
+
}
|
|
59
|
+
op = body.call(thisArg, _);
|
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
127
62
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
63
|
+
};
|
|
64
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
65
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
66
|
+
if (!m) return o;
|
|
67
|
+
var i = m.call(o), r, ar = [], e;
|
|
68
|
+
try {
|
|
69
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
70
|
+
}
|
|
71
|
+
catch (error) { e = { error: error }; }
|
|
72
|
+
finally {
|
|
73
|
+
try {
|
|
74
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
75
|
+
}
|
|
76
|
+
finally { if (e) throw e.error; }
|
|
77
|
+
}
|
|
78
|
+
return ar;
|
|
79
|
+
};
|
|
80
|
+
var __values = (this && this.__values) || function(o) {
|
|
81
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
82
|
+
if (m) return m.call(o);
|
|
83
|
+
if (o && typeof o.length === "number") return {
|
|
84
|
+
next: function () {
|
|
85
|
+
if (o && i >= o.length) o = void 0;
|
|
86
|
+
return { value: o && o[i++], done: !o };
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
90
|
+
};
|
|
91
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
92
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
93
|
+
};
|
|
94
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
95
|
+
exports.configSchema = exports.ReactComponent = void 0;
|
|
96
|
+
var configuration_1 = require("@jbrowse/core/configuration");
|
|
97
|
+
var util_1 = require("@jbrowse/core/util");
|
|
98
|
+
var util_2 = require("../util");
|
|
99
|
+
var configSchema_1 = __importDefault(require("../configSchema"));
|
|
100
|
+
var WiggleBaseRenderer_1 = __importDefault(require("../WiggleBaseRenderer"));
|
|
101
|
+
var WiggleRendering_1 = require("../WiggleRendering");
|
|
102
|
+
Object.defineProperty(exports, "ReactComponent", { enumerable: true, get: function () { return __importDefault(WiggleRendering_1).default; } });
|
|
103
|
+
var DensityRenderer = /** @class */ (function (_super) {
|
|
104
|
+
__extends(DensityRenderer, _super);
|
|
105
|
+
function DensityRenderer() {
|
|
106
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
107
|
+
}
|
|
108
|
+
DensityRenderer.prototype.draw = function (ctx, props) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var features, regions, bpPerPx, scaleOpts, height, config, _a, region, pivot, pivotValue, negColor, posColor, color, colorCallback, colorScale_1, _b, _c, feature, _d, leftPx, rightPx, w;
|
|
111
|
+
var e_1, _e;
|
|
112
|
+
return __generator(this, function (_f) {
|
|
113
|
+
features = props.features, regions = props.regions, bpPerPx = props.bpPerPx, scaleOpts = props.scaleOpts, height = props.height, config = props.config;
|
|
114
|
+
_a = __read(regions, 1), region = _a[0];
|
|
115
|
+
pivot = (0, configuration_1.readConfObject)(config, 'bicolorPivot');
|
|
116
|
+
pivotValue = (0, configuration_1.readConfObject)(config, 'bicolorPivotValue');
|
|
117
|
+
negColor = (0, configuration_1.readConfObject)(config, 'negColor');
|
|
118
|
+
posColor = (0, configuration_1.readConfObject)(config, 'posColor');
|
|
119
|
+
color = (0, configuration_1.readConfObject)(config, 'color');
|
|
120
|
+
if (color === '#f0f') {
|
|
121
|
+
colorScale_1 = pivot !== 'none'
|
|
122
|
+
? (0, util_2.getScale)(__assign(__assign({}, scaleOpts), { pivotValue: pivotValue, range: [negColor, 'white', posColor] }))
|
|
123
|
+
: (0, util_2.getScale)(__assign(__assign({}, scaleOpts), { range: ['white', posColor] }));
|
|
124
|
+
colorCallback = function (feature) { return colorScale_1(feature.get('score')); };
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
colorCallback = function (feature) {
|
|
128
|
+
return (0, configuration_1.readConfObject)(config, 'color', { feature: feature });
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
for (_b = __values(features.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
133
|
+
feature = _c.value;
|
|
134
|
+
_d = __read((0, util_1.featureSpanPx)(feature, region, bpPerPx), 2), leftPx = _d[0], rightPx = _d[1];
|
|
135
|
+
w = rightPx - leftPx + 0.3 // fudge factor for subpixel rendering
|
|
136
|
+
;
|
|
137
|
+
ctx.fillStyle = colorCallback(feature);
|
|
138
|
+
ctx.fillRect(leftPx, 0, w, height);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
142
|
+
finally {
|
|
143
|
+
try {
|
|
144
|
+
if (_c && !_c.done && (_e = _b.return)) _e.call(_b);
|
|
145
|
+
}
|
|
146
|
+
finally { if (e_1) throw e_1.error; }
|
|
147
|
+
}
|
|
148
|
+
return [2 /*return*/];
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
return DensityRenderer;
|
|
153
|
+
}(WiggleBaseRenderer_1.default));
|
|
132
154
|
exports.default = DensityRenderer;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
explicitlyTyped: true
|
|
136
|
-
});
|
|
137
|
-
exports.configSchema = configSchema;
|
|
155
|
+
exports.configSchema = (0, configuration_1.ConfigurationSchema)('DensityRenderer', {}, { baseConfiguration: configSchema_1.default, explicitlyTyped: true });
|
|
156
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DensityRenderer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAGoC;AACpC,2CAAkD;AAElD,gCAAkC;AAElC,iEAA0C;AAC1C,6EAE8B;AAE9B,sDAA8D;AAArD,kIAAA,OAAO,OAAkB;AAElC;IAA6C,mCAAkB;IAA/D;;IAmCA,CAAC;IAlCO,8BAAI,GAAV,UACE,GAA6B,EAC7B,KAAyC;;;;;gBAEjC,QAAQ,GAAkD,KAAK,SAAvD,E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