react-msaview 1.2.8 → 1.3.0
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/bundle/colorSchemes.d.ts +16 -0
- package/bundle/colorSchemes.js +455 -0
- package/bundle/components/AboutDlg.d.ts +5 -0
- package/bundle/components/AboutDlg.js +47 -0
- package/bundle/components/AddTrackDlg.d.ts +8 -0
- package/bundle/components/AddTrackDlg.js +26 -0
- package/bundle/components/AnnotationDlg.d.ts +11 -0
- package/bundle/components/AnnotationDlg.js +77 -0
- package/bundle/components/BoxTrack.d.ts +7 -0
- package/bundle/components/BoxTrack.js +143 -0
- package/bundle/components/DetailsDlg.d.ts +8 -0
- package/bundle/components/DetailsDlg.js +12 -0
- package/bundle/components/Header.d.ts +6 -0
- package/bundle/components/Header.js +63 -0
- package/bundle/components/ImportForm.d.ts +6 -0
- package/bundle/components/ImportForm.js +89 -0
- package/bundle/components/MSACanvas.d.ts +6 -0
- package/bundle/components/MSACanvas.js +210 -0
- package/bundle/components/MSAView.d.ts +6 -0
- package/bundle/components/MSAView.js +88 -0
- package/bundle/components/MoreInfoDlg.d.ts +6 -0
- package/bundle/components/MoreInfoDlg.js +11 -0
- package/bundle/components/ResizeHandles.d.ts +8 -0
- package/bundle/components/ResizeHandles.js +110 -0
- package/bundle/components/Rubberband.d.ts +7 -0
- package/bundle/components/Rubberband.js +196 -0
- package/bundle/components/Ruler.d.ts +20 -0
- package/bundle/components/Ruler.js +121 -0
- package/bundle/components/SettingsDlg.d.ts +8 -0
- package/bundle/components/SettingsDlg.js +40 -0
- package/bundle/components/TextTrack.d.ts +7 -0
- package/bundle/components/TextTrack.js +72 -0
- package/bundle/components/Track.d.ts +11 -0
- package/bundle/components/Track.js +81 -0
- package/bundle/components/TrackInfoDlg.d.ts +6 -0
- package/bundle/components/TrackInfoDlg.js +33 -0
- package/bundle/components/TracklistDlg.d.ts +8 -0
- package/bundle/components/TracklistDlg.js +18 -0
- package/bundle/components/TreeCanvas.d.ts +6 -0
- package/bundle/components/TreeCanvas.js +431 -0
- package/bundle/components/TreeRuler.d.ts +6 -0
- package/bundle/components/TreeRuler.js +8 -0
- package/bundle/components/data/seq2.d.ts +3 -0
- package/bundle/components/data/seq2.js +3 -0
- package/bundle/index.d.ts +4 -0
- package/bundle/index.js +97264 -0
- package/bundle/layout.d.ts +23 -0
- package/bundle/layout.js +53 -0
- package/bundle/model.d.ts +364 -0
- package/bundle/model.js +894 -0
- package/bundle/parseNewick.d.ts +64 -0
- package/bundle/parseNewick.js +94 -0
- package/bundle/parsers/ClustalMSA.d.ts +39 -0
- package/bundle/parsers/ClustalMSA.js +77 -0
- package/bundle/parsers/FastaMSA.d.ts +26 -0
- package/bundle/parsers/FastaMSA.js +78 -0
- package/bundle/parsers/StockholmMSA.d.ts +75 -0
- package/bundle/parsers/StockholmMSA.js +142 -0
- package/bundle/util.d.ts +17 -0
- package/bundle/util.js +33 -0
- package/dist/components/AboutDlg.d.ts +1 -0
- package/dist/components/AboutDlg.js +41 -27
- package/dist/components/AddTrackDlg.d.ts +1 -0
- package/dist/components/AddTrackDlg.js +17 -26
- package/dist/components/AnnotationDlg.d.ts +1 -0
- package/dist/components/AnnotationDlg.js +49 -47
- package/dist/components/BoxTrack.d.ts +1 -0
- package/dist/components/BoxTrack.js +22 -33
- package/dist/components/DetailsDlg.d.ts +1 -0
- package/dist/components/DetailsDlg.js +5 -14
- package/dist/components/Header.d.ts +1 -0
- package/dist/components/Header.js +38 -39
- package/dist/components/ImportForm.d.ts +1 -0
- package/dist/components/ImportForm.js +80 -73
- package/dist/components/MSACanvas.d.ts +1 -0
- package/dist/components/MSACanvas.js +10 -21
- package/dist/components/MSAView.d.ts +1 -0
- package/dist/components/MSAView.js +25 -17
- package/dist/components/MoreInfoDlg.d.ts +1 -0
- package/dist/components/MoreInfoDlg.js +5 -14
- package/dist/components/ResizeHandles.d.ts +1 -0
- package/dist/components/ResizeHandles.js +7 -6
- package/dist/components/Rubberband.js +46 -48
- package/dist/components/Ruler.d.ts +1 -0
- package/dist/components/Ruler.js +17 -26
- package/dist/components/SettingsDlg.d.ts +1 -0
- package/dist/components/SettingsDlg.js +24 -33
- package/dist/components/TextTrack.d.ts +1 -0
- package/dist/components/TextTrack.js +5 -17
- package/dist/components/Track.d.ts +1 -0
- package/dist/components/Track.js +24 -31
- package/dist/components/TrackInfoDlg.d.ts +1 -0
- package/dist/components/TrackInfoDlg.js +16 -23
- package/dist/components/TracklistDlg.d.ts +1 -0
- package/dist/components/TracklistDlg.js +12 -20
- package/dist/components/TreeCanvas.d.ts +1 -0
- package/dist/components/TreeCanvas.js +96 -84
- package/dist/components/TreeRuler.d.ts +1 -0
- package/dist/components/TreeRuler.js +2 -2
- package/dist/components/package.json +15 -10
- package/dist/model.d.ts +79 -6
- package/dist/model.js +25 -7
- package/package.json +15 -10
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useState } from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
14
2
|
import { Button, Container, Grid, Typography, Link } from '@material-ui/core';
|
|
15
3
|
import { observer } from 'mobx-react';
|
|
16
4
|
import { transaction } from 'mobx';
|
|
@@ -18,72 +6,91 @@ import { FileSelector } from '@jbrowse/core/ui';
|
|
|
18
6
|
import { smallTree, smallMSA, smallMSAOnly } from './data/seq2';
|
|
19
7
|
var ListItem = function (_a) {
|
|
20
8
|
var onClick = _a.onClick, model = _a.model, children = _a.children;
|
|
21
|
-
return (
|
|
9
|
+
return (React.createElement("li", null,
|
|
10
|
+
React.createElement(Link, { onClick: function (event) {
|
|
22
11
|
model.setError(undefined);
|
|
12
|
+
event.preventDefault();
|
|
23
13
|
onClick();
|
|
24
|
-
}, href: "#" },
|
|
14
|
+
}, href: "#" },
|
|
15
|
+
React.createElement(Typography, null, children))));
|
|
25
16
|
};
|
|
26
17
|
export default observer(function (_a) {
|
|
27
18
|
var model = _a.model;
|
|
28
19
|
var _b = useState(), msaFile = _b[0], setMsaFile = _b[1];
|
|
29
20
|
var _c = useState(), treeFile = _c[0], setTreeFile = _c[1];
|
|
30
21
|
var error = model.error;
|
|
31
|
-
return (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
22
|
+
return (React.createElement(Container, null,
|
|
23
|
+
React.createElement("div", { style: { width: '50%' } },
|
|
24
|
+
error ? (React.createElement("div", { style: { padding: 20 } },
|
|
25
|
+
React.createElement(Typography, { color: "error" },
|
|
26
|
+
"Error: ", "" + error))) : null,
|
|
27
|
+
React.createElement(Typography, null, "Open an MSA file (stockholm or clustal format) and/or a tree file (newick format)."),
|
|
28
|
+
React.createElement(Typography, { color: "error" }, "Note: you can open up just an MSA or just a tree, both are not required. Some MSA files e.g. stockholm format have an embedded tree also and this is fine, and opening a separate tree file is not required.")),
|
|
29
|
+
React.createElement(Grid, { container: true, spacing: 10, justifyContent: "center", alignItems: "center" },
|
|
30
|
+
React.createElement(Grid, { item: true },
|
|
31
|
+
React.createElement(Typography, null, "MSA file or URL"),
|
|
32
|
+
React.createElement(FileSelector, { location: msaFile, setLocation: setMsaFile }),
|
|
33
|
+
React.createElement(Typography, null, "Tree file or URL"),
|
|
34
|
+
React.createElement(FileSelector, { location: treeFile, setLocation: setTreeFile })),
|
|
35
|
+
React.createElement(Grid, { item: true },
|
|
36
|
+
React.createElement(Button, { onClick: function () {
|
|
37
|
+
model.setError(undefined);
|
|
38
|
+
if (msaFile) {
|
|
39
|
+
model.setMSAFilehandle(msaFile);
|
|
40
|
+
}
|
|
41
|
+
if (treeFile) {
|
|
42
|
+
model.setTreeFilehandle(treeFile);
|
|
43
|
+
}
|
|
44
|
+
}, variant: "contained", color: "primary", disabled: !msaFile && !treeFile }, "Open")),
|
|
45
|
+
React.createElement(Grid, { item: true },
|
|
46
|
+
React.createElement(Typography, null, "Examples"),
|
|
47
|
+
React.createElement("ul", null,
|
|
48
|
+
React.createElement(ListItem, { model: model, onClick: function () {
|
|
49
|
+
model.setTreeFilehandle({
|
|
50
|
+
uri: 'https://jbrowse.org/genomes/newick_trees/sarscov2phylo.pub.ft.nh',
|
|
51
|
+
locationType: 'UriLocation',
|
|
52
|
+
});
|
|
53
|
+
} }, "230k COVID-19 samples (tree only)"),
|
|
54
|
+
React.createElement(ListItem, { model: model, onClick: function () {
|
|
55
|
+
model.setData({ msa: smallMSA, tree: smallTree });
|
|
56
|
+
} }, "Small protein MSA+tree"),
|
|
57
|
+
React.createElement(ListItem, { model: model, onClick: function () {
|
|
58
|
+
model.setData({ msa: smallMSAOnly });
|
|
59
|
+
} }, "Small MSA only"),
|
|
60
|
+
React.createElement(ListItem, { model: model, onClick: function () {
|
|
61
|
+
model.setMSAFilehandle({
|
|
62
|
+
uri: 'https://ihh.github.io/abrowse/build/pfam-cov2.stock',
|
|
63
|
+
locationType: 'UriLocation',
|
|
64
|
+
});
|
|
65
|
+
} }, "PFAM SARS-CoV2 multi-stockholm"),
|
|
66
|
+
React.createElement(ListItem, { model: model, onClick: function () {
|
|
67
|
+
model.setMSAFilehandle({
|
|
68
|
+
uri: 'https://jbrowse.org/genomes/multiple_sequence_alignments/Lysine.stock',
|
|
69
|
+
locationType: 'UriLocation',
|
|
70
|
+
});
|
|
71
|
+
} }, "Lysine stockholm file"),
|
|
72
|
+
React.createElement(ListItem, { model: model, onClick: function () {
|
|
73
|
+
model.setMSAFilehandle({
|
|
74
|
+
uri: 'https://jbrowse.org/genomes/multiple_sequence_alignments/PF01601_full.txt',
|
|
75
|
+
locationType: 'UriLocation',
|
|
76
|
+
});
|
|
77
|
+
} }, "PF01601 stockholm file (SARS-CoV2 spike protein)"),
|
|
78
|
+
React.createElement(ListItem, { model: model, onClick: function () {
|
|
79
|
+
model.setMSAFilehandle({
|
|
80
|
+
uri: 'https://jbrowse.org/genomes/multiple_sequence_alignments/europe_covid.fa',
|
|
81
|
+
locationType: 'UriLocation',
|
|
82
|
+
});
|
|
83
|
+
} }, "Europe COVID full genomes (LR883044.1 and 199 other sequences)"),
|
|
84
|
+
React.createElement(ListItem, { model: model, onClick: function () {
|
|
85
|
+
transaction(function () {
|
|
86
|
+
model.setMSAFilehandle({
|
|
87
|
+
uri: 'https://jbrowse.org/genomes/multiple_sequence_alignments/rhv_test-only.aligned_with_mafft_auto.fa',
|
|
88
|
+
locationType: 'UriLocation',
|
|
89
|
+
});
|
|
90
|
+
model.setTreeFilehandle({
|
|
91
|
+
uri: 'https://jbrowse.org/genomes/multiple_sequence_alignments/rhv_test-only.aligned_with_mafft_auto.nh',
|
|
92
|
+
locationType: 'UriLocation',
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
} }, "MAFFT+VeryFastTree(17.9k samples)"))))));
|
|
89
96
|
});
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useEffect, useState, useRef, useMemo } from 'react';
|
|
1
|
+
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
14
2
|
import { Typography, CircularProgress, useTheme } from '@material-ui/core';
|
|
15
3
|
import { observer } from 'mobx-react';
|
|
16
4
|
import normalizeWheel from 'normalize-wheel';
|
|
@@ -97,7 +85,7 @@ var MSABlock = observer(function (_a) {
|
|
|
97
85
|
offsetY,
|
|
98
86
|
blockSize,
|
|
99
87
|
]);
|
|
100
|
-
return (
|
|
88
|
+
return (React.createElement("canvas", { ref: ref, onMouseMove: function (event) {
|
|
101
89
|
if (!ref.current) {
|
|
102
90
|
return;
|
|
103
91
|
}
|
|
@@ -111,7 +99,7 @@ var MSABlock = observer(function (_a) {
|
|
|
111
99
|
left: scrollX + offsetX,
|
|
112
100
|
width: blockSize,
|
|
113
101
|
height: blockSize,
|
|
114
|
-
} }
|
|
102
|
+
} }));
|
|
115
103
|
});
|
|
116
104
|
var MSACanvas = observer(function (_a) {
|
|
117
105
|
var model = _a.model;
|
|
@@ -190,7 +178,7 @@ var MSACanvas = observer(function (_a) {
|
|
|
190
178
|
}
|
|
191
179
|
return cleanup;
|
|
192
180
|
}, [model, mouseDragging]);
|
|
193
|
-
return (
|
|
181
|
+
return (React.createElement("div", { ref: ref, onMouseDown: function (event) {
|
|
194
182
|
// check if clicking a draggable element or a resize handle
|
|
195
183
|
var target = event.target;
|
|
196
184
|
if (target.draggable || target.dataset.resizer) {
|
|
@@ -212,10 +200,11 @@ var MSACanvas = observer(function (_a) {
|
|
|
212
200
|
height: height,
|
|
213
201
|
width: msaAreaWidth,
|
|
214
202
|
overflow: 'hidden',
|
|
215
|
-
} },
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
203
|
+
} }, !MSA && !msaFilehandle ? null : !MSA ? (React.createElement("div", { style: { position: 'absolute', left: '50%', top: '50%' } },
|
|
204
|
+
React.createElement(CircularProgress, null),
|
|
205
|
+
React.createElement(Typography, null, "Loading..."))) : (blocks2d.map(function (_a) {
|
|
206
|
+
var bx = _a[0], by = _a[1];
|
|
207
|
+
return (React.createElement(MSABlock, { key: bx + "_" + by, model: model, offsetX: bx, offsetY: by }));
|
|
208
|
+
}))));
|
|
220
209
|
});
|
|
221
210
|
export default MSACanvas;
|
|
@@ -9,8 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
import { useRef, useEffect } from 'react';
|
|
12
|
+
import React, { useRef, useEffect } from 'react';
|
|
14
13
|
import { observer } from 'mobx-react';
|
|
15
14
|
import { Typography } from '@material-ui/core';
|
|
16
15
|
import ImportForm from './ImportForm';
|
|
@@ -51,7 +50,7 @@ var MouseoverCanvas = observer(function (_a) {
|
|
|
51
50
|
treeAreaWidth,
|
|
52
51
|
width,
|
|
53
52
|
]);
|
|
54
|
-
return (
|
|
53
|
+
return (React.createElement("canvas", { ref: ref, width: width, height: height, style: {
|
|
55
54
|
position: 'absolute',
|
|
56
55
|
top: 0,
|
|
57
56
|
left: 0,
|
|
@@ -59,22 +58,31 @@ var MouseoverCanvas = observer(function (_a) {
|
|
|
59
58
|
height: height,
|
|
60
59
|
zIndex: 1000,
|
|
61
60
|
pointerEvents: 'none',
|
|
62
|
-
} }
|
|
61
|
+
} }));
|
|
63
62
|
});
|
|
64
63
|
export default observer(function (_a) {
|
|
65
64
|
var model = _a.model;
|
|
66
65
|
var done = model.done, initialized = model.initialized, treeAreaWidth = model.treeAreaWidth, height = model.height, resizeHandleWidth = model.resizeHandleWidth, turnedOnTracks = model.turnedOnTracks;
|
|
67
|
-
return (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
return (React.createElement("div", null,
|
|
67
|
+
!initialized ? (React.createElement(ImportForm, { model: model })) : !done ? (React.createElement(Typography, { variant: "h4" }, "Loading...")) : (React.createElement("div", null,
|
|
68
|
+
React.createElement("div", { style: { height: height, overflow: 'hidden' } },
|
|
69
|
+
React.createElement(Header, { model: model }),
|
|
70
|
+
React.createElement("div", null,
|
|
71
|
+
React.createElement("div", { style: { position: 'relative' } },
|
|
72
|
+
React.createElement("div", { style: { display: 'flex' } },
|
|
73
|
+
React.createElement("div", { style: { flexShrink: 0, width: treeAreaWidth } },
|
|
74
|
+
React.createElement(TreeRuler, { model: model })),
|
|
75
|
+
React.createElement(Rubberband, { model: model, ControlComponent: React.createElement(Ruler, { model: model }) })), turnedOnTracks === null || turnedOnTracks === void 0 ? void 0 :
|
|
76
|
+
turnedOnTracks.map(function (track) { return (React.createElement(Track, { key: track.model.id, model: model, track: track })); }),
|
|
77
|
+
React.createElement("div", { style: { display: 'flex' } },
|
|
78
|
+
React.createElement("div", { style: { flexShrink: 0, width: treeAreaWidth } },
|
|
79
|
+
React.createElement(TreeCanvas, { model: model })),
|
|
80
|
+
React.createElement(VerticalResizeHandle, { model: model }),
|
|
81
|
+
React.createElement(MSACanvas, { model: model }),
|
|
82
|
+
React.createElement(MouseoverCanvas, { model: model }))))),
|
|
83
|
+
React.createElement(HorizontalResizeHandle, { model: model }))),
|
|
84
|
+
model.DialogComponent ? (React.createElement(model.DialogComponent, __assign({}, (model.DialogProps || {}), { onClose: function () {
|
|
85
|
+
model.setDialogComponent(undefined, undefined);
|
|
86
|
+
} }))) : null,
|
|
87
|
+
model.annotPos ? (React.createElement(AnnotationDialog, { data: model.annotPos, model: model, onClose: function () { return model.clearAnnotPos(); } })) : null));
|
|
80
88
|
});
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import React from 'react';
|
|
13
2
|
import { Dialog, DialogTitle, DialogContent } from '@material-ui/core';
|
|
14
3
|
import { observer } from 'mobx-react';
|
|
15
4
|
import { Attributes } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
|
|
16
5
|
export default observer(function (_a) {
|
|
17
6
|
var info = _a.info, onClose = _a.onClose;
|
|
18
|
-
return (
|
|
19
|
-
|
|
7
|
+
return (React.createElement(Dialog, { onClose: function () { return onClose(); }, open: true },
|
|
8
|
+
React.createElement(DialogTitle, null, "Metadata"),
|
|
9
|
+
React.createElement(DialogContent, null,
|
|
10
|
+
React.createElement(Attributes, { attributes: info }))));
|
|
20
11
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
2
|
import { observer } from 'mobx-react';
|
|
4
3
|
export var VerticalResizeHandle = observer(function (_a) {
|
|
5
4
|
var model = _a.model;
|
|
@@ -46,13 +45,14 @@ export var VerticalResizeHandle = observer(function (_a) {
|
|
|
46
45
|
}
|
|
47
46
|
return function () { };
|
|
48
47
|
}, [mouseDragging, model]);
|
|
49
|
-
return (
|
|
48
|
+
return (React.createElement("div", null,
|
|
49
|
+
React.createElement("div", { onMouseDown: function () { return setMouseDragging(true); }, style: {
|
|
50
50
|
cursor: 'ew-resize',
|
|
51
51
|
height: '100%',
|
|
52
52
|
width: resizeHandleWidth,
|
|
53
53
|
background: "rgba(200,200,200)",
|
|
54
54
|
position: 'relative',
|
|
55
|
-
} }
|
|
55
|
+
} })));
|
|
56
56
|
});
|
|
57
57
|
export var HorizontalResizeHandle = observer(function (_a) {
|
|
58
58
|
var model = _a.model;
|
|
@@ -99,11 +99,12 @@ export var HorizontalResizeHandle = observer(function (_a) {
|
|
|
99
99
|
}
|
|
100
100
|
return function () { };
|
|
101
101
|
}, [mouseDragging, model]);
|
|
102
|
-
return (
|
|
102
|
+
return (React.createElement("div", null,
|
|
103
|
+
React.createElement("div", { onMouseDown: function () { return setMouseDragging(true); }, style: {
|
|
103
104
|
cursor: 'ns-resize',
|
|
104
105
|
width: '100%',
|
|
105
106
|
height: resizeHandleWidth,
|
|
106
107
|
background: "rgba(200,200,200)",
|
|
107
108
|
position: 'relative',
|
|
108
|
-
} }
|
|
109
|
+
} })));
|
|
109
110
|
});
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useRef, useEffect, useState } from 'react';
|
|
1
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
14
2
|
import { observer } from 'mobx-react';
|
|
15
3
|
// material ui
|
|
16
4
|
import { Popover, Tooltip, Typography, makeStyles, alpha, } from '@material-ui/core';
|
|
@@ -61,18 +49,20 @@ var VerticalGuide = observer(function (_a) {
|
|
|
61
49
|
var model = _a.model, coordX = _a.coordX;
|
|
62
50
|
var treeAreaWidth = model.treeAreaWidth;
|
|
63
51
|
var classes = useStyles();
|
|
64
|
-
return (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
height: 1,
|
|
68
|
-
} }, void 0) }), void 0),
|
|
69
|
-
_jsx("div", { className: classes.guide, style: {
|
|
52
|
+
return (React.createElement(React.Fragment, null,
|
|
53
|
+
React.createElement(Tooltip, { open: true, placement: "top", title: "" + (model.pxToBp(coordX) + 1), arrow: true },
|
|
54
|
+
React.createElement("div", { style: {
|
|
70
55
|
left: coordX + treeAreaWidth,
|
|
71
|
-
|
|
72
|
-
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
height: 1,
|
|
58
|
+
} })),
|
|
59
|
+
React.createElement("div", { className: classes.guide, style: {
|
|
60
|
+
left: coordX + treeAreaWidth,
|
|
61
|
+
background: 'red',
|
|
62
|
+
} })));
|
|
73
63
|
});
|
|
74
64
|
function Rubberband(_a) {
|
|
75
|
-
var model = _a.model, _b = _a.ControlComponent, ControlComponent = _b === void 0 ?
|
|
65
|
+
var model = _a.model, _b = _a.ControlComponent, ControlComponent = _b === void 0 ? React.createElement("div", null) : _b;
|
|
76
66
|
var treeAreaWidth = model.treeAreaWidth;
|
|
77
67
|
var _c = useState(), startX = _c[0], setStartX = _c[1];
|
|
78
68
|
var _d = useState(), currentX = _d[0], setCurrentX = _d[1];
|
|
@@ -151,8 +141,9 @@ function Rubberband(_a) {
|
|
|
151
141
|
handleClose();
|
|
152
142
|
}
|
|
153
143
|
if (startX === undefined) {
|
|
154
|
-
return (
|
|
155
|
-
|
|
144
|
+
return (React.createElement(React.Fragment, null,
|
|
145
|
+
guideX !== undefined ? (React.createElement(VerticalGuide, { model: model, coordX: guideX })) : null,
|
|
146
|
+
React.createElement("div", { "data-testid": "rubberband_controls", className: classes.rubberbandControl, role: "presentation", ref: controlsRef, onMouseDown: mouseDown, onMouseOut: mouseOut, onMouseMove: mouseMove }, ControlComponent)));
|
|
156
147
|
}
|
|
157
148
|
var right = anchorPosition ? anchorPosition.offsetX : currentX || 0;
|
|
158
149
|
var left = right < startX ? right : startX;
|
|
@@ -170,29 +161,36 @@ function Rubberband(_a) {
|
|
|
170
161
|
},
|
|
171
162
|
},
|
|
172
163
|
];
|
|
173
|
-
return (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
164
|
+
return (React.createElement(React.Fragment, null,
|
|
165
|
+
rubberbandRef.current ? (React.createElement(React.Fragment, null,
|
|
166
|
+
React.createElement(Popover, { className: classes.popover, classes: {
|
|
167
|
+
paper: classes.paper,
|
|
168
|
+
}, open: true, anchorEl: rubberbandRef.current, anchorOrigin: {
|
|
169
|
+
vertical: 'top',
|
|
170
|
+
horizontal: 'left',
|
|
171
|
+
}, transformOrigin: {
|
|
172
|
+
vertical: 'bottom',
|
|
173
|
+
horizontal: 'right',
|
|
174
|
+
}, keepMounted: true, disableRestoreFocus: true },
|
|
175
|
+
React.createElement(Typography, null, leftBpOffset + 1)),
|
|
176
|
+
React.createElement(Popover, { className: classes.popover, classes: {
|
|
177
|
+
paper: classes.paper,
|
|
178
|
+
}, open: true, anchorEl: rubberbandRef.current, anchorOrigin: {
|
|
179
|
+
vertical: 'top',
|
|
180
|
+
horizontal: 'right',
|
|
181
|
+
}, transformOrigin: {
|
|
182
|
+
vertical: 'bottom',
|
|
183
|
+
horizontal: 'left',
|
|
184
|
+
}, keepMounted: true, disableRestoreFocus: true },
|
|
185
|
+
React.createElement(Typography, null, rightBpOffset + 1)))) : null,
|
|
186
|
+
React.createElement("div", { ref: rubberbandRef, className: classes.rubberband, style: { left: left + treeAreaWidth, width: width } },
|
|
187
|
+
React.createElement(Typography, { variant: "h6", className: classes.rubberbandText },
|
|
188
|
+
numOfBpSelected.toLocaleString('en-US'),
|
|
189
|
+
" bp")),
|
|
190
|
+
React.createElement("div", { "data-testid": "rubberband_controls", className: classes.rubberbandControl, role: "presentation", ref: controlsRef, onMouseDown: mouseDown, onMouseOut: mouseOut, onMouseMove: mouseMove }, ControlComponent),
|
|
191
|
+
anchorPosition ? (React.createElement(Menu, { anchorReference: "anchorPosition", anchorPosition: {
|
|
192
|
+
left: anchorPosition.clientX,
|
|
193
|
+
top: anchorPosition.clientY,
|
|
194
|
+
}, onMenuItemClick: handleMenuItemClick, open: Boolean(anchorPosition), onClose: handleClose, menuItems: menuItems })) : null));
|
|
197
195
|
}
|
|
198
196
|
export default observer(Rubberband);
|
package/dist/components/Ruler.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useRef } from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
14
2
|
import { makeStyles } from '@material-ui/core';
|
|
15
3
|
import { observer } from 'mobx-react';
|
|
16
4
|
/**
|
|
@@ -97,34 +85,37 @@ function RulerBlock(_a) {
|
|
|
97
85
|
var start = _a.start, end = _a.end, bpPerPx = _a.bpPerPx, reversed = _a.reversed, major = _a.major, minor = _a.minor;
|
|
98
86
|
var classes = useStyles();
|
|
99
87
|
var ticks = makeTicks(start, end, bpPerPx, major, minor);
|
|
100
|
-
return (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
88
|
+
return (React.createElement(React.Fragment, null,
|
|
89
|
+
ticks.map(function (tick) {
|
|
90
|
+
var x = (reversed ? end - tick.base : tick.base - start) / bpPerPx;
|
|
91
|
+
return (React.createElement("line", { key: tick.base, x1: x, x2: x, y1: 11, y2: tick.type === 'major' ? 11 + 6 : 11 + 4, strokeWidth: 1, stroke: tick.type === 'major' ? '#555' : '#999', className: tick.type === 'major' ? classes.majorTick : classes.minorTick, "data-bp": tick.base }));
|
|
92
|
+
}),
|
|
93
|
+
ticks
|
|
94
|
+
.filter(function (tick) { return tick.type === 'major'; })
|
|
95
|
+
.map(function (tick) {
|
|
96
|
+
var x = (reversed ? end - tick.base : tick.base - start) / bpPerPx;
|
|
97
|
+
return (React.createElement("text", { x: x, y: 10, key: "label-" + tick.base, textAnchor: "middle", style: { fontSize: '11px' }, className: classes.majorTickLabel }, mathPower(tick.base + 1)));
|
|
98
|
+
})));
|
|
110
99
|
}
|
|
111
100
|
var Ruler = observer(function (_a) {
|
|
112
101
|
var model = _a.model;
|
|
113
102
|
var MSA = model.MSA, colWidth = model.colWidth, msaAreaWidth = model.msaAreaWidth, resizeHandleWidth = model.resizeHandleWidth, scrollX = model.scrollX, blocksX = model.blocksX, blockSize = model.blockSize;
|
|
114
103
|
var ref = useRef(null);
|
|
115
104
|
var offsetX = blocksX[0];
|
|
116
|
-
return !MSA ? null : (
|
|
105
|
+
return !MSA ? null : (React.createElement("div", { ref: ref, style: {
|
|
117
106
|
position: 'relative',
|
|
118
107
|
width: msaAreaWidth,
|
|
119
108
|
cursor: 'crosshair',
|
|
120
109
|
overflow: 'hidden',
|
|
121
110
|
height: 20,
|
|
122
111
|
background: '#ccc',
|
|
123
|
-
} },
|
|
112
|
+
} },
|
|
113
|
+
React.createElement("svg", { style: {
|
|
124
114
|
width: blocksX.length * blockSize,
|
|
125
115
|
position: 'absolute',
|
|
126
116
|
left: scrollX + offsetX + resizeHandleWidth,
|
|
127
117
|
pointerEvents: 'none',
|
|
128
|
-
} },
|
|
118
|
+
} },
|
|
119
|
+
React.createElement(RulerBlock, { key: offsetX, start: offsetX / colWidth, end: offsetX / colWidth + (blockSize * blocksX.length) / colWidth, bpPerPx: 1 / colWidth }))));
|
|
129
120
|
});
|
|
130
121
|
export default Ruler;
|