@jbrowse/plugin-alignments 1.6.9 → 1.7.3
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/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +6 -6
- package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +216 -0
- package/dist/AlignmentsFeatureDetail/index.d.ts +13 -13
- package/dist/AlignmentsFeatureDetail/index.js +63 -0
- package/dist/AlignmentsFeatureDetail/index.test.js +60 -0
- package/dist/AlignmentsTrack/index.d.ts +2 -2
- package/dist/AlignmentsTrack/index.js +37 -0
- package/dist/BamAdapter/BamAdapter.d.ts +40 -30
- package/dist/BamAdapter/BamAdapter.js +598 -0
- package/dist/BamAdapter/BamAdapter.test.js +177 -0
- package/dist/BamAdapter/BamSlightlyLazyFeature.d.ts +33 -33
- package/dist/BamAdapter/BamSlightlyLazyFeature.js +176 -0
- package/dist/BamAdapter/MismatchParser.d.ts +28 -28
- package/dist/BamAdapter/MismatchParser.js +384 -0
- package/dist/BamAdapter/MismatchParser.test.js +259 -0
- package/dist/BamAdapter/configSchema.d.ts +2 -2
- package/dist/BamAdapter/configSchema.js +48 -0
- package/dist/BamAdapter/index.d.ts +3 -3
- package/dist/BamAdapter/index.js +36 -0
- package/dist/CramAdapter/CramAdapter.d.ts +52 -43
- package/dist/CramAdapter/CramAdapter.js +660 -0
- package/dist/CramAdapter/CramAdapter.test.js +138 -0
- package/dist/CramAdapter/CramSlightlyLazyFeature.d.ts +49 -49
- package/dist/CramAdapter/CramSlightlyLazyFeature.js +447 -0
- package/dist/CramAdapter/CramTestAdapters.d.ts +29 -29
- package/dist/CramAdapter/CramTestAdapters.js +234 -0
- package/dist/CramAdapter/configSchema.d.ts +3 -3
- package/dist/CramAdapter/configSchema.js +40 -0
- package/dist/CramAdapter/index.d.ts +3 -3
- package/dist/CramAdapter/index.js +36 -0
- package/dist/HtsgetBamAdapter/HtsgetBamAdapter.d.ts +9 -9
- package/dist/HtsgetBamAdapter/HtsgetBamAdapter.js +97 -0
- package/dist/HtsgetBamAdapter/configSchema.d.ts +2 -2
- package/dist/HtsgetBamAdapter/configSchema.js +31 -0
- package/dist/HtsgetBamAdapter/index.d.ts +3 -3
- package/dist/HtsgetBamAdapter/index.js +42 -0
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +7 -7
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +69 -0
- package/dist/LinearAlignmentsDisplay/index.d.ts +2 -2
- package/dist/LinearAlignmentsDisplay/index.js +31 -0
- package/dist/LinearAlignmentsDisplay/models/configSchema.d.ts +4 -4
- package/dist/LinearAlignmentsDisplay/models/configSchema.js +25 -0
- package/dist/LinearAlignmentsDisplay/models/configSchema.test.js +83 -0
- package/dist/LinearAlignmentsDisplay/models/model.d.ts +105 -105
- package/dist/LinearAlignmentsDisplay/models/model.js +250 -0
- package/dist/LinearPileupDisplay/components/ColorByModifications.d.ts +14 -14
- package/dist/LinearPileupDisplay/components/ColorByModifications.js +123 -0
- package/dist/LinearPileupDisplay/components/ColorByTag.d.ts +9 -9
- package/dist/LinearPileupDisplay/components/ColorByTag.js +98 -0
- package/dist/LinearPileupDisplay/components/FilterByTag.d.ts +18 -18
- package/dist/LinearPileupDisplay/components/FilterByTag.js +203 -0
- package/dist/LinearPileupDisplay/components/LinearPileupDisplayBlurb.d.ts +13 -13
- package/dist/LinearPileupDisplay/components/LinearPileupDisplayBlurb.js +32 -0
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.d.ts +16 -16
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.js +99 -0
- package/dist/LinearPileupDisplay/components/SetMaxHeight.d.ts +10 -10
- package/dist/LinearPileupDisplay/components/SetMaxHeight.js +90 -0
- package/dist/LinearPileupDisplay/components/SortByTag.d.ts +9 -9
- package/dist/LinearPileupDisplay/components/SortByTag.js +95 -0
- package/dist/LinearPileupDisplay/configSchema.d.ts +6 -6
- package/dist/LinearPileupDisplay/configSchema.js +47 -0
- package/dist/LinearPileupDisplay/configSchema.test.js +92 -0
- package/dist/LinearPileupDisplay/index.d.ts +2 -2
- package/dist/LinearPileupDisplay/index.js +30 -0
- package/dist/LinearPileupDisplay/model.d.ts +319 -321
- package/dist/LinearPileupDisplay/model.js +602 -0
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.d.ts +10 -10
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +63 -0
- package/dist/LinearSNPCoverageDisplay/index.d.ts +2 -2
- package/dist/LinearSNPCoverageDisplay/index.js +30 -0
- package/dist/LinearSNPCoverageDisplay/models/configSchema.d.ts +2 -2
- package/dist/LinearSNPCoverageDisplay/models/configSchema.js +57 -0
- package/dist/LinearSNPCoverageDisplay/models/configSchema.test.js +62 -0
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +346 -96
- package/dist/LinearSNPCoverageDisplay/models/model.js +237 -0
- package/dist/NestedFrequencyTable.d.ts +14 -14
- package/dist/NestedFrequencyTable.js +152 -0
- package/dist/PileupRPC/rpcMethods.d.ts +34 -34
- package/dist/PileupRPC/rpcMethods.js +285 -0
- package/dist/PileupRenderer/PileupLayoutSession.d.ts +29 -29
- package/dist/PileupRenderer/PileupLayoutSession.js +79 -0
- package/dist/PileupRenderer/PileupRenderer.d.ts +125 -125
- package/dist/PileupRenderer/PileupRenderer.js +1220 -0
- package/dist/PileupRenderer/components/PileupRendering.d.ts +23 -23
- package/dist/PileupRenderer/components/PileupRendering.js +270 -0
- package/dist/PileupRenderer/components/PileupRendering.test.js +36 -0
- package/dist/PileupRenderer/configSchema.d.ts +2 -2
- package/dist/PileupRenderer/configSchema.js +72 -0
- package/dist/PileupRenderer/index.d.ts +2 -2
- package/dist/PileupRenderer/index.js +25 -0
- package/dist/PileupRenderer/sortUtil.d.ts +8 -8
- package/dist/PileupRenderer/sortUtil.js +112 -0
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +67 -71
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +606 -0
- package/dist/SNPCoverageAdapter/configSchema.d.ts +3 -3
- package/dist/SNPCoverageAdapter/configSchema.js +22 -0
- package/dist/SNPCoverageAdapter/index.d.ts +3 -3
- package/dist/SNPCoverageAdapter/index.js +45 -0
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.d.ts +20 -20
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +296 -0
- package/dist/SNPCoverageRenderer/configSchema.d.ts +2 -2
- package/dist/SNPCoverageRenderer/configSchema.js +40 -0
- package/dist/SNPCoverageRenderer/index.d.ts +3 -3
- package/dist/SNPCoverageRenderer/index.js +34 -0
- package/dist/declare.d.js +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +154 -6
- package/dist/index.test.js +26 -0
- package/dist/shared.d.ts +25 -25
- package/dist/shared.js +96 -0
- package/dist/util.d.ts +19 -19
- package/dist/util.js +135 -0
- package/package.json +5 -8
- package/src/BamAdapter/BamAdapter.ts +35 -8
- package/src/CramAdapter/CramAdapter.ts +42 -15
- package/src/LinearPileupDisplay/components/SetMaxHeight.tsx +1 -1
- package/src/LinearPileupDisplay/model.ts +2 -22
- package/src/LinearSNPCoverageDisplay/models/model.ts +6 -36
- package/src/PileupRenderer/PileupRenderer.tsx +3 -6
- package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +11 -17
- package/dist/AlignmentsFeatureDetail/index.test.d.ts +0 -1
- package/dist/LinearAlignmentsDisplay/models/configSchema.test.d.ts +0 -1
- package/dist/LinearPileupDisplay/configSchema.test.d.ts +0 -1
- package/dist/LinearSNPCoverageDisplay/models/configSchema.test.d.ts +0 -1
- package/dist/PileupRenderer/components/PileupRendering.test.d.ts +0 -1
- package/dist/plugin-alignments.cjs.development.js +0 -8438
- package/dist/plugin-alignments.cjs.development.js.map +0 -1
- package/dist/plugin-alignments.cjs.production.min.js +0 -2
- package/dist/plugin-alignments.cjs.production.min.js.map +0 -1
- package/dist/plugin-alignments.esm.js +0 -8430
- package/dist/plugin-alignments.esm.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Region } from '@jbrowse/core/util/types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { BaseLinearDisplayModel } from '@jbrowse/plugin-linear-genome-view';
|
|
4
|
-
declare function PileupRendering(props: {
|
|
5
|
-
blockKey: string;
|
|
6
|
-
displayModel: BaseLinearDisplayModel;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
regions: Region[];
|
|
10
|
-
bpPerPx: number;
|
|
11
|
-
sortedBy?: {
|
|
12
|
-
type: string;
|
|
13
|
-
pos: number;
|
|
14
|
-
refName: string;
|
|
15
|
-
};
|
|
16
|
-
colorBy?: {
|
|
17
|
-
type: string;
|
|
18
|
-
tag?: string;
|
|
19
|
-
};
|
|
20
|
-
onMouseMove?: (event: React.MouseEvent, featureId: string | undefined) => void;
|
|
21
|
-
}): JSX.Element;
|
|
22
|
-
declare const _default: typeof PileupRendering;
|
|
23
|
-
export default _default;
|
|
1
|
+
import { Region } from '@jbrowse/core/util/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { BaseLinearDisplayModel } from '@jbrowse/plugin-linear-genome-view';
|
|
4
|
+
declare function PileupRendering(props: {
|
|
5
|
+
blockKey: string;
|
|
6
|
+
displayModel: BaseLinearDisplayModel;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
regions: Region[];
|
|
10
|
+
bpPerPx: number;
|
|
11
|
+
sortedBy?: {
|
|
12
|
+
type: string;
|
|
13
|
+
pos: number;
|
|
14
|
+
refName: string;
|
|
15
|
+
};
|
|
16
|
+
colorBy?: {
|
|
17
|
+
type: string;
|
|
18
|
+
tag?: string;
|
|
19
|
+
};
|
|
20
|
+
onMouseMove?: (event: React.MouseEvent, featureId: string | undefined) => void;
|
|
21
|
+
}): JSX.Element;
|
|
22
|
+
declare const _default: typeof PileupRendering;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _ui = require("@jbrowse/core/ui");
|
|
17
|
+
|
|
18
|
+
var _util = require("@jbrowse/core/util");
|
|
19
|
+
|
|
20
|
+
var _mobxReact = require("mobx-react");
|
|
21
|
+
|
|
22
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
|
|
27
|
+
|
|
28
|
+
// used so that user can click-away-from-feature below the laid out features
|
|
29
|
+
// (issue #1248)
|
|
30
|
+
var canvasPadding = 100;
|
|
31
|
+
|
|
32
|
+
function PileupRendering(props) {
|
|
33
|
+
var onMouseMove = props.onMouseMove,
|
|
34
|
+
blockKey = props.blockKey,
|
|
35
|
+
displayModel = props.displayModel,
|
|
36
|
+
width = props.width,
|
|
37
|
+
height = props.height,
|
|
38
|
+
regions = props.regions,
|
|
39
|
+
bpPerPx = props.bpPerPx,
|
|
40
|
+
sortedBy = props.sortedBy,
|
|
41
|
+
colorBy = props.colorBy;
|
|
42
|
+
var selectedFeatureId = displayModel.selectedFeatureId,
|
|
43
|
+
featureIdUnderMouse = displayModel.featureIdUnderMouse,
|
|
44
|
+
contextMenuFeature = displayModel.contextMenuFeature;
|
|
45
|
+
|
|
46
|
+
var _regions = (0, _slicedToArray2["default"])(regions, 1),
|
|
47
|
+
region = _regions[0];
|
|
48
|
+
|
|
49
|
+
var highlightOverlayCanvas = (0, _react.useRef)(null);
|
|
50
|
+
|
|
51
|
+
var _useState = (0, _react.useState)(false),
|
|
52
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
53
|
+
mouseIsDown = _useState2[0],
|
|
54
|
+
setMouseIsDown = _useState2[1];
|
|
55
|
+
|
|
56
|
+
var _useState3 = (0, _react.useState)(false),
|
|
57
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
58
|
+
movedDuringLastMouseDown = _useState4[0],
|
|
59
|
+
setMovedDuringLastMouseDown = _useState4[1];
|
|
60
|
+
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
var _displayModel$getFeat, _displayModel$getFeat2;
|
|
63
|
+
|
|
64
|
+
var canvas = highlightOverlayCanvas.current;
|
|
65
|
+
|
|
66
|
+
if (!canvas) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var ctx = canvas.getContext('2d');
|
|
71
|
+
|
|
72
|
+
if (!ctx) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
77
|
+
var selectedRect = selectedFeatureId ? (_displayModel$getFeat = displayModel.getFeatureByID) === null || _displayModel$getFeat === void 0 ? void 0 : _displayModel$getFeat.call(displayModel, blockKey, selectedFeatureId) : undefined;
|
|
78
|
+
|
|
79
|
+
if (selectedRect) {
|
|
80
|
+
var _selectedRect = (0, _slicedToArray2["default"])(selectedRect, 4),
|
|
81
|
+
leftBp = _selectedRect[0],
|
|
82
|
+
topPx = _selectedRect[1],
|
|
83
|
+
rightBp = _selectedRect[2],
|
|
84
|
+
bottomPx = _selectedRect[3];
|
|
85
|
+
|
|
86
|
+
var _bpSpanPx = (0, _util.bpSpanPx)(leftBp, rightBp, region, bpPerPx),
|
|
87
|
+
_bpSpanPx2 = (0, _slicedToArray2["default"])(_bpSpanPx, 2),
|
|
88
|
+
leftPx = _bpSpanPx2[0],
|
|
89
|
+
rightPx = _bpSpanPx2[1];
|
|
90
|
+
|
|
91
|
+
var rectTop = Math.round(topPx);
|
|
92
|
+
var rectHeight = Math.round(bottomPx - topPx);
|
|
93
|
+
ctx.shadowColor = '#222266';
|
|
94
|
+
ctx.shadowBlur = 10;
|
|
95
|
+
ctx.lineJoin = 'bevel';
|
|
96
|
+
ctx.lineWidth = 2;
|
|
97
|
+
ctx.strokeStyle = '#00b8ff';
|
|
98
|
+
ctx.strokeRect(leftPx - 2, rectTop - 2, rightPx - leftPx + 4, rectHeight + 4);
|
|
99
|
+
ctx.clearRect(leftPx, rectTop, rightPx - leftPx, rectHeight);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var highlightedFeature = featureIdUnderMouse || (contextMenuFeature === null || contextMenuFeature === void 0 ? void 0 : contextMenuFeature.id());
|
|
103
|
+
var highlightedRect = highlightedFeature ? (_displayModel$getFeat2 = displayModel.getFeatureByID) === null || _displayModel$getFeat2 === void 0 ? void 0 : _displayModel$getFeat2.call(displayModel, blockKey, highlightedFeature) : undefined;
|
|
104
|
+
|
|
105
|
+
if (highlightedRect) {
|
|
106
|
+
var _highlightedRect = (0, _slicedToArray2["default"])(highlightedRect, 4),
|
|
107
|
+
_leftBp = _highlightedRect[0],
|
|
108
|
+
_topPx = _highlightedRect[1],
|
|
109
|
+
_rightBp = _highlightedRect[2],
|
|
110
|
+
_bottomPx = _highlightedRect[3];
|
|
111
|
+
|
|
112
|
+
var _bpSpanPx3 = (0, _util.bpSpanPx)(_leftBp, _rightBp, region, bpPerPx),
|
|
113
|
+
_bpSpanPx4 = (0, _slicedToArray2["default"])(_bpSpanPx3, 2),
|
|
114
|
+
_leftPx = _bpSpanPx4[0],
|
|
115
|
+
_rightPx = _bpSpanPx4[1];
|
|
116
|
+
|
|
117
|
+
var _rectTop = Math.round(_topPx);
|
|
118
|
+
|
|
119
|
+
var _rectHeight = Math.round(_bottomPx - _topPx);
|
|
120
|
+
|
|
121
|
+
ctx.fillStyle = '#0003';
|
|
122
|
+
ctx.fillRect(_leftPx, _rectTop, _rightPx - _leftPx, _rectHeight);
|
|
123
|
+
}
|
|
124
|
+
}, [bpPerPx, region, blockKey, selectedFeatureId, displayModel, featureIdUnderMouse, contextMenuFeature]);
|
|
125
|
+
|
|
126
|
+
function _onMouseDown(event) {
|
|
127
|
+
setMouseIsDown(true);
|
|
128
|
+
setMovedDuringLastMouseDown(false);
|
|
129
|
+
callMouseHandler('MouseDown', event);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function _onMouseEnter(event) {
|
|
133
|
+
callMouseHandler('MouseEnter', event);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function _onMouseOut(event) {
|
|
137
|
+
callMouseHandler('MouseOut', event);
|
|
138
|
+
callMouseHandler('MouseLeave', event);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function _onMouseOver(event) {
|
|
142
|
+
callMouseHandler('MouseOver', event);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function _onMouseUp(event) {
|
|
146
|
+
setMouseIsDown(false);
|
|
147
|
+
callMouseHandler('MouseUp', event);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function _onClick(event) {
|
|
151
|
+
if (!movedDuringLastMouseDown) {
|
|
152
|
+
callMouseHandler('Click', event);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function _onMouseLeave(event) {
|
|
157
|
+
callMouseHandler('MouseOut', event);
|
|
158
|
+
callMouseHandler('MouseLeave', event);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function _onContextMenu(event) {
|
|
162
|
+
callMouseHandler('ContextMenu', event);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function mouseMove(event) {
|
|
166
|
+
if (mouseIsDown) {
|
|
167
|
+
setMovedDuringLastMouseDown(true);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var offsetX = 0;
|
|
171
|
+
var offsetY = 0;
|
|
172
|
+
var canvas = highlightOverlayCanvas.current;
|
|
173
|
+
|
|
174
|
+
if (canvas) {
|
|
175
|
+
var _canvas$getBoundingCl = canvas.getBoundingClientRect(),
|
|
176
|
+
left = _canvas$getBoundingCl.left,
|
|
177
|
+
top = _canvas$getBoundingCl.top;
|
|
178
|
+
|
|
179
|
+
offsetX = left;
|
|
180
|
+
offsetY = top;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
offsetX = event.clientX - offsetX;
|
|
184
|
+
offsetY = event.clientY - offsetY;
|
|
185
|
+
var px = region.reversed ? width - offsetX : offsetX;
|
|
186
|
+
var clientBp = region.start + bpPerPx * px;
|
|
187
|
+
var featIdUnderMouse = displayModel.getFeatureOverlapping(blockKey, clientBp, offsetY);
|
|
188
|
+
|
|
189
|
+
if (onMouseMove) {
|
|
190
|
+
onMouseMove(event, featIdUnderMouse);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function callMouseHandler(handlerName, event) {
|
|
195
|
+
// @ts-ignore
|
|
196
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
197
|
+
var featureHandler = props["onFeature".concat(handlerName)]; // @ts-ignore
|
|
198
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
199
|
+
|
|
200
|
+
var canvasHandler = props["on".concat(handlerName)];
|
|
201
|
+
|
|
202
|
+
if (featureHandler && featureIdUnderMouse) {
|
|
203
|
+
featureHandler(event, featureIdUnderMouse);
|
|
204
|
+
} else if (canvasHandler) {
|
|
205
|
+
canvasHandler(event, featureIdUnderMouse);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
var canvasWidth = Math.ceil(width); // need to call this in render so we get the right observer behavior
|
|
210
|
+
|
|
211
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
212
|
+
className: "PileupRendering",
|
|
213
|
+
"data-testid": "pileup-".concat(sortedBy || colorBy ? "".concat((sortedBy === null || sortedBy === void 0 ? void 0 : sortedBy.type) || '').concat((colorBy === null || colorBy === void 0 ? void 0 : colorBy.type) || '').concat((colorBy === null || colorBy === void 0 ? void 0 : colorBy.tag) || '') : 'normal'),
|
|
214
|
+
style: {
|
|
215
|
+
position: 'relative',
|
|
216
|
+
width: canvasWidth,
|
|
217
|
+
height: height
|
|
218
|
+
}
|
|
219
|
+
}, /*#__PURE__*/_react["default"].createElement(_ui.PrerenderedCanvas, (0, _extends2["default"])({}, props, {
|
|
220
|
+
style: {
|
|
221
|
+
position: 'absolute',
|
|
222
|
+
left: 0,
|
|
223
|
+
top: 0
|
|
224
|
+
}
|
|
225
|
+
})), /*#__PURE__*/_react["default"].createElement("canvas", {
|
|
226
|
+
"data-testid": "pileup_overlay_canvas",
|
|
227
|
+
width: canvasWidth,
|
|
228
|
+
height: height + canvasPadding,
|
|
229
|
+
style: {
|
|
230
|
+
position: 'absolute',
|
|
231
|
+
left: 0,
|
|
232
|
+
top: 0
|
|
233
|
+
},
|
|
234
|
+
className: "highlightOverlayCanvas",
|
|
235
|
+
ref: highlightOverlayCanvas,
|
|
236
|
+
onMouseDown: function onMouseDown(event) {
|
|
237
|
+
return _onMouseDown(event);
|
|
238
|
+
},
|
|
239
|
+
onMouseEnter: function onMouseEnter(event) {
|
|
240
|
+
return _onMouseEnter(event);
|
|
241
|
+
},
|
|
242
|
+
onMouseOut: function onMouseOut(event) {
|
|
243
|
+
return _onMouseOut(event);
|
|
244
|
+
},
|
|
245
|
+
onMouseOver: function onMouseOver(event) {
|
|
246
|
+
return _onMouseOver(event);
|
|
247
|
+
},
|
|
248
|
+
onMouseUp: function onMouseUp(event) {
|
|
249
|
+
return _onMouseUp(event);
|
|
250
|
+
},
|
|
251
|
+
onMouseLeave: function onMouseLeave(event) {
|
|
252
|
+
return _onMouseLeave(event);
|
|
253
|
+
},
|
|
254
|
+
onMouseMove: function onMouseMove(event) {
|
|
255
|
+
return mouseMove(event);
|
|
256
|
+
},
|
|
257
|
+
onClick: function onClick(event) {
|
|
258
|
+
return _onClick(event);
|
|
259
|
+
},
|
|
260
|
+
onContextMenu: function onContextMenu(event) {
|
|
261
|
+
return _onContextMenu(event);
|
|
262
|
+
},
|
|
263
|
+
onFocus: function onFocus() {},
|
|
264
|
+
onBlur: function onBlur() {}
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
var _default = (0, _mobxReact.observer)(PileupRendering);
|
|
269
|
+
|
|
270
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _PrecomputedLayout = _interopRequireDefault(require("@jbrowse/core/util/layouts/PrecomputedLayout"));
|
|
6
|
+
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
|
|
9
|
+
var _react2 = require("@testing-library/react");
|
|
10
|
+
|
|
11
|
+
var _PileupRendering = _interopRequireDefault(require("./PileupRendering"));
|
|
12
|
+
|
|
13
|
+
// these tests do very little, let's try to expand them at some point
|
|
14
|
+
test('one', function () {
|
|
15
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_PileupRendering["default"], {
|
|
16
|
+
width: 500,
|
|
17
|
+
height: 500,
|
|
18
|
+
regions: [{
|
|
19
|
+
refName: 'zonk',
|
|
20
|
+
start: 1,
|
|
21
|
+
end: 3
|
|
22
|
+
}],
|
|
23
|
+
layout: new _PrecomputedLayout["default"]({
|
|
24
|
+
rectangles: {},
|
|
25
|
+
totalHeight: 20
|
|
26
|
+
}),
|
|
27
|
+
displayModel: {},
|
|
28
|
+
bpPerPx: 3,
|
|
29
|
+
config: {
|
|
30
|
+
type: 'DummyRenderer'
|
|
31
|
+
}
|
|
32
|
+
})),
|
|
33
|
+
container = _render.container;
|
|
34
|
+
|
|
35
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
36
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _configuration = require("@jbrowse/core/configuration");
|
|
9
|
+
|
|
10
|
+
var _mobxStateTree = require("mobx-state-tree");
|
|
11
|
+
|
|
12
|
+
var _default = (0, _configuration.ConfigurationSchema)('PileupRenderer', {
|
|
13
|
+
// default magenta here is used to detect the user has not customized this
|
|
14
|
+
color: {
|
|
15
|
+
type: 'color',
|
|
16
|
+
description: 'the color of each feature in a pileup alignment',
|
|
17
|
+
defaultValue: '#f0f',
|
|
18
|
+
contextVariable: ['feature']
|
|
19
|
+
},
|
|
20
|
+
orientationType: {
|
|
21
|
+
type: 'stringEnum',
|
|
22
|
+
model: _mobxStateTree.types.enumeration('orientationType', ['fr', 'rf', 'ff']),
|
|
23
|
+
defaultValue: 'fr',
|
|
24
|
+
description: 'read sequencer orienation. fr is normal "reads pointing at each other ---> <--- while some other sequencers can use other options'
|
|
25
|
+
},
|
|
26
|
+
displayMode: {
|
|
27
|
+
type: 'stringEnum',
|
|
28
|
+
model: _mobxStateTree.types.enumeration('displayMode', ['normal', 'compact', 'collapse']),
|
|
29
|
+
description: 'Alternative display modes',
|
|
30
|
+
defaultValue: 'normal'
|
|
31
|
+
},
|
|
32
|
+
minSubfeatureWidth: {
|
|
33
|
+
type: 'number',
|
|
34
|
+
description: 'the minimum width in px for a pileup mismatch feature. use for increasing mismatch marker widths when zoomed out to e.g. 1px or 0.5px',
|
|
35
|
+
defaultValue: 0
|
|
36
|
+
},
|
|
37
|
+
maxHeight: {
|
|
38
|
+
type: 'integer',
|
|
39
|
+
description: 'the maximum height to be used in a pileup rendering',
|
|
40
|
+
defaultValue: 1200
|
|
41
|
+
},
|
|
42
|
+
maxClippingSize: {
|
|
43
|
+
type: 'integer',
|
|
44
|
+
description: 'the max clip size to be used in a pileup rendering',
|
|
45
|
+
defaultValue: 10000
|
|
46
|
+
},
|
|
47
|
+
height: {
|
|
48
|
+
type: 'number',
|
|
49
|
+
description: 'the height of each feature in a pileup alignment',
|
|
50
|
+
defaultValue: 7,
|
|
51
|
+
contextVariable: ['feature']
|
|
52
|
+
},
|
|
53
|
+
noSpacing: {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
description: 'remove spacing between features',
|
|
56
|
+
defaultValue: false
|
|
57
|
+
},
|
|
58
|
+
largeInsertionIndicatorScale: {
|
|
59
|
+
type: 'number',
|
|
60
|
+
description: 'scale at which to draw the large insertion indicators (bp/pixel)',
|
|
61
|
+
defaultValue: 10
|
|
62
|
+
},
|
|
63
|
+
mismatchAlpha: {
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
defaultValue: false,
|
|
66
|
+
description: 'Fade low quality mismatches'
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
explicitlyTyped: true
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
exports["default"] = _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
export default function register(pluginManager: PluginManager): void;
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
export default function register(pluginManager: PluginManager): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
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"] = register;
|
|
9
|
+
|
|
10
|
+
var _PileupRenderer = _interopRequireDefault(require("./PileupRenderer"));
|
|
11
|
+
|
|
12
|
+
var _PileupRendering = _interopRequireDefault(require("./components/PileupRendering"));
|
|
13
|
+
|
|
14
|
+
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
15
|
+
|
|
16
|
+
function register(pluginManager) {
|
|
17
|
+
pluginManager.addRendererType(function () {
|
|
18
|
+
return new _PileupRenderer["default"]({
|
|
19
|
+
name: 'PileupRenderer',
|
|
20
|
+
ReactComponent: _PileupRendering["default"],
|
|
21
|
+
configSchema: _configSchema["default"],
|
|
22
|
+
pluginManager: pluginManager
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
-
interface SortObject {
|
|
3
|
-
pos: number;
|
|
4
|
-
type: string;
|
|
5
|
-
tag?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const sortFeature: (features: Map<string, Feature>, sortedBy: SortObject) => Map<string, Feature>;
|
|
8
|
-
export {};
|
|
1
|
+
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
+
interface SortObject {
|
|
3
|
+
pos: number;
|
|
4
|
+
type: string;
|
|
5
|
+
tag?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const sortFeature: (features: Map<string, Feature>, sortedBy: SortObject) => Map<string, Feature>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sortFeature = void 0;
|
|
7
|
+
|
|
8
|
+
var _range = require("@jbrowse/core/util/range");
|
|
9
|
+
|
|
10
|
+
var sortFeature = function sortFeature(features, sortedBy) {
|
|
11
|
+
var featureArray = Array.from(features.values());
|
|
12
|
+
var featuresInCenterLine = [];
|
|
13
|
+
var featuresOutsideCenter = [];
|
|
14
|
+
var pos = sortedBy.pos,
|
|
15
|
+
type = sortedBy.type; // only sort on features that intersect center line, append those outside post-sort
|
|
16
|
+
|
|
17
|
+
featureArray.forEach(function (innerArray) {
|
|
18
|
+
var feature = innerArray;
|
|
19
|
+
var start = feature.get('start');
|
|
20
|
+
var end = feature.get('end');
|
|
21
|
+
|
|
22
|
+
if ((0, _range.doesIntersect2)(pos - 1, pos, start, end)) {
|
|
23
|
+
featuresInCenterLine.push(innerArray);
|
|
24
|
+
} else {
|
|
25
|
+
featuresOutsideCenter.push(innerArray);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var isCram = featureArray.length ? featureArray[0].get('tags') : false;
|
|
29
|
+
|
|
30
|
+
switch (type) {
|
|
31
|
+
case 'Start location':
|
|
32
|
+
{
|
|
33
|
+
featuresInCenterLine.sort(function (a, b) {
|
|
34
|
+
return a.get('start') - b.get('start');
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
case 'tag':
|
|
40
|
+
{
|
|
41
|
+
var tag = sortedBy.tag;
|
|
42
|
+
|
|
43
|
+
var getTag = function getTag(f, t) {
|
|
44
|
+
return isCram ? f.get('tags')[t] : f.get(t);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var isString = featuresInCenterLine[0] && typeof getTag(featuresInCenterLine[0], tag) === 'string';
|
|
48
|
+
|
|
49
|
+
if (isString) {
|
|
50
|
+
featuresInCenterLine.sort(function (a, b) {
|
|
51
|
+
return getTag(b, tag).localeCompare(getTag(a, tag));
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
featuresInCenterLine.sort(function (a, b) {
|
|
55
|
+
return (getTag(b, tag) || 0) - (getTag(a, tag) || 0);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
// first sort all mismatches, then all reference bases at the end
|
|
62
|
+
|
|
63
|
+
case 'Base pair':
|
|
64
|
+
{
|
|
65
|
+
var baseSortArray = [];
|
|
66
|
+
featuresInCenterLine.forEach(function (feature) {
|
|
67
|
+
var mismatches = feature.get('mismatches');
|
|
68
|
+
mismatches.forEach(function (mismatch) {
|
|
69
|
+
var start = feature.get('start');
|
|
70
|
+
var offset = start + mismatch.start + 1;
|
|
71
|
+
var consuming = mismatch.type === 'insertion' || mismatch.type === 'softclip';
|
|
72
|
+
var len = consuming ? 0 : mismatch.length;
|
|
73
|
+
|
|
74
|
+
if (pos >= offset && pos < offset + len) {
|
|
75
|
+
baseSortArray.push([feature.id(), mismatch]);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
var baseMap = new Map(baseSortArray);
|
|
80
|
+
featuresInCenterLine.sort(function (a, b) {
|
|
81
|
+
var aMismatch = baseMap.get(a.id());
|
|
82
|
+
var bMismatch = baseMap.get(b.id());
|
|
83
|
+
var acode = bMismatch && bMismatch.base.toUpperCase();
|
|
84
|
+
var bcode = aMismatch && aMismatch.base.toUpperCase();
|
|
85
|
+
|
|
86
|
+
if (acode === bcode && acode === '*') {
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
return aMismatch.length - bMismatch.length;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (acode ? acode.charCodeAt(0) : 0) - (bcode ? bcode.charCodeAt(0) : 0);
|
|
92
|
+
});
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
// sorts positive strands then negative strands
|
|
96
|
+
|
|
97
|
+
case 'Read strand':
|
|
98
|
+
{
|
|
99
|
+
featuresInCenterLine.sort(function (a, b) {
|
|
100
|
+
return a.get('strand') <= b.get('strand') ? 1 : -1;
|
|
101
|
+
});
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var sortedMap = new Map(featuresInCenterLine.concat(featuresOutsideCenter).map(function (feature) {
|
|
107
|
+
return [feature.id(), feature];
|
|
108
|
+
}));
|
|
109
|
+
return sortedMap;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
exports.sortFeature = sortFeature;
|