react-msaview 1.3.1 → 1.3.2

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.
@@ -446,7 +446,7 @@ export function getPercentIdentityColor(stats, model, row, col) {
446
446
  }
447
447
  }
448
448
  var proportion = ent / total;
449
- var thresh = "hsl(240, 30%, " + 100 * Math.max(1 - ent / total / 3, 0.3) + "%)";
449
+ var thresh = "hsl(240, 30%, ".concat(100 * Math.max(1 - ent / total / 3, 0.3), "%)");
450
450
  if (proportion > 0.4) {
451
451
  if (l === letter) {
452
452
  return thresh;
@@ -13,7 +13,7 @@ export default observer(function (_a) {
13
13
  React.createElement(Typography, null, "Open relevant per-alignment tracks e.g. protein domains"),
14
14
  React.createElement(TextField, { select: true, helperText: "Which row does this track apply to?", value: currentOption, onChange: function (event) {
15
15
  setCurrentOption(event.target.value);
16
- } }, options.map(function (option, index) { return (React.createElement(MenuItem, { key: option + "-" + index, value: option }, option)); })),
16
+ } }, options.map(function (option, index) { return (React.createElement(MenuItem, { key: "".concat(option, "-").concat(index), value: option }, option)); })),
17
17
  React.createElement(FileSelector, { location: trackFile, setLocation: setTrackFile }),
18
18
  React.createElement(DialogActions, null,
19
19
  React.createElement(Button, { onClick: function () {
@@ -48,7 +48,7 @@ export default observer(function (_a) {
48
48
  r,
49
49
  ' ',
50
50
  blanks.length
51
- ? " (gapped " + model.getPos(l) + ".." + model.getPos(r)
51
+ ? " (gapped ".concat(model.getPos(l), "..").concat(model.getPos(r))
52
52
  : ''),
53
53
  rows.map(function (_a, index) {
54
54
  var key = _a[0], val = _a[1];
@@ -16,12 +16,12 @@ var AnnotationBlock = observer(function (_a) {
16
16
  if (associatedRowName) {
17
17
  var s = model.rowSpecificBpToPx(associatedRowName, start - 1);
18
18
  var e = model.rowSpecificBpToPx(associatedRowName, end);
19
- temp.addRect("" + index, s, e, rowHeight, feature);
19
+ temp.addRect("".concat(index), s, e, rowHeight, feature);
20
20
  }
21
21
  else {
22
22
  var s = model.globalBpToPx(start - 1);
23
23
  var e = model.globalBpToPx(end);
24
- temp.addRect("" + index, s, e, rowHeight, feature);
24
+ temp.addRect("".concat(index), s, e, rowHeight, feature);
25
25
  }
26
26
  });
27
27
  return temp;
@@ -42,7 +42,7 @@ var AnnotationBlock = observer(function (_a) {
42
42
  ctx.clearRect(0, 0, blockSize, height);
43
43
  ctx.translate(-offsetX, 0);
44
44
  ctx.textAlign = 'center';
45
- ctx.font = ctx.font.replace(/\d+px/, Math.max(8, rowHeight - 8) + "px");
45
+ ctx.font = ctx.font.replace(/\d+px/, "".concat(Math.max(8, rowHeight - 8), "px"));
46
46
  var xStart = Math.max(0, Math.floor(offsetX / colWidth));
47
47
  ctx.fillStyle = 'goldenrod';
48
48
  layout.rectangles.forEach(function (value) {
@@ -80,7 +80,7 @@ var AnnotationBlock = observer(function (_a) {
80
80
  ctx.clearRect(0, 0, blockSize, height);
81
81
  ctx.translate(-offsetX, 0);
82
82
  ctx.textAlign = 'center';
83
- ctx.font = ctx.font.replace(/\d+px/, Math.max(8, rowHeight - 8) + "px");
83
+ ctx.font = ctx.font.replace(/\d+px/, "".concat(Math.max(8, rowHeight - 8), "px"));
84
84
  ctx.fillStyle = 'black';
85
85
  ctx.textAlign = 'left';
86
86
  layout.rectangles.forEach(function (value) {
@@ -54,7 +54,7 @@ var Header = observer(function (_a) {
54
54
  model.setCurrentAlignment(+event.target.value);
55
55
  model.setScrollX(0);
56
56
  model.setScrollY(0);
57
- } }, alignmentNames.map(function (option, index) { return (React.createElement("option", { key: option + "-" + index, value: index }, option)); }))) : null,
57
+ } }, alignmentNames.map(function (option, index) { return (React.createElement("option", { key: "".concat(option, "-").concat(index), value: index }, option)); }))) : null,
58
58
  React.createElement(InfoArea, { model: model }),
59
59
  React.createElement("div", { style: { flex: 1 } }),
60
60
  React.createElement(IconButton, { onClick: function () { return setAboutDialogVisible(true); } },
@@ -23,7 +23,7 @@ export default observer(function (_a) {
23
23
  React.createElement("div", { style: { width: '50%' } },
24
24
  error ? (React.createElement("div", { style: { padding: 20 } },
25
25
  React.createElement(Typography, { color: "error" },
26
- "Error: ", "" + error))) : null,
26
+ "Error: ", "".concat(error)))) : null,
27
27
  React.createElement(Typography, null, "Open an MSA file (stockholm or clustal format) and/or a tree file (newick format)."),
28
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
29
  React.createElement(Grid, { container: true, spacing: 10, justifyContent: "center", alignItems: "center" },
@@ -23,7 +23,7 @@ var MSABlock = observer(function (_a) {
23
23
  ctx.clearRect(0, 0, blockSize, blockSize);
24
24
  ctx.translate(-offsetX, rowHeight / 2 - offsetY);
25
25
  ctx.textAlign = 'center';
26
- ctx.font = ctx.font.replace(/\d+px/, Math.max(8, rowHeight - 8) + "px");
26
+ ctx.font = ctx.font.replace(/\d+px/, "".concat(Math.max(8, rowHeight - 8), "px"));
27
27
  var leaves = hierarchy.leaves();
28
28
  var b = blockSize;
29
29
  // slice vertical rows, e.g. tree leaves, avoid negative slice
@@ -204,7 +204,7 @@ var MSACanvas = observer(function (_a) {
204
204
  React.createElement(CircularProgress, null),
205
205
  React.createElement(Typography, null, "Loading..."))) : (blocks2d.map(function (_a) {
206
206
  var bx = _a[0], by = _a[1];
207
- return (React.createElement(MSABlock, { key: bx + "_" + by, model: model, offsetX: bx, offsetY: by }));
207
+ return (React.createElement(MSABlock, { key: "".concat(bx, "_").concat(by), model: model, offsetX: bx, offsetY: by }));
208
208
  }))));
209
209
  });
210
210
  export default MSACanvas;
@@ -50,7 +50,7 @@ var VerticalGuide = observer(function (_a) {
50
50
  var treeAreaWidth = model.treeAreaWidth;
51
51
  var classes = useStyles();
52
52
  return (React.createElement(React.Fragment, null,
53
- React.createElement(Tooltip, { open: true, placement: "top", title: "" + (model.pxToBp(coordX) + 1), arrow: true },
53
+ React.createElement(Tooltip, { open: true, placement: "top", title: "".concat(model.pxToBp(coordX) + 1), arrow: true },
54
54
  React.createElement("div", { style: {
55
55
  left: coordX + treeAreaWidth,
56
56
  position: 'absolute',
@@ -68,7 +68,7 @@ function mathPower(num) {
68
68
  if (num < 999) {
69
69
  return String(num);
70
70
  }
71
- return mathPower(~~(num / 1000)) + "," + ("00" + ~~(num % 1000)).substr(-3, 3);
71
+ return "".concat(mathPower(~~(num / 1000)), ",").concat("00".concat(~~(num % 1000)).substr(-3, 3));
72
72
  }
73
73
  var useStyles = makeStyles(function ( /* theme */) { return ({
74
74
  majorTickLabel: {
@@ -94,7 +94,7 @@ function RulerBlock(_a) {
94
94
  .filter(function (tick) { return tick.type === 'major'; })
95
95
  .map(function (tick) {
96
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)));
97
+ return (React.createElement("text", { x: x, y: 10, key: "label-".concat(tick.base), textAnchor: "middle", style: { fontSize: '11px' }, className: classes.majorTickLabel }, mathPower(tick.base + 1)));
98
98
  })));
99
99
  }
100
100
  var Ruler = observer(function (_a) {
@@ -5,9 +5,9 @@ import colorSchemes from '../colorSchemes';
5
5
  export default observer(function (_a) {
6
6
  var model = _a.model, onClose = _a.onClose, open = _a.open;
7
7
  var rowHeightInit = model.rowHeight, colWidthInit = model.colWidth, treeWidthInit = model.treeWidth, colorSchemeName = model.colorSchemeName, noTree = model.noTree;
8
- var _b = useState("" + rowHeightInit), rowHeight = _b[0], setRowHeight = _b[1];
9
- var _c = useState("" + colWidthInit), colWidth = _c[0], setColWidth = _c[1];
10
- var _d = useState("" + treeWidthInit), treeWidth = _d[0], setTreeWidth = _d[1];
8
+ var _b = useState("".concat(rowHeightInit)), rowHeight = _b[0], setRowHeight = _b[1];
9
+ var _c = useState("".concat(colWidthInit)), colWidth = _c[0], setColWidth = _c[1];
10
+ var _d = useState("".concat(treeWidthInit)), treeWidth = _d[0], setTreeWidth = _d[1];
11
11
  function error(n) {
12
12
  return Number.isNaN(+n) || +n < 0;
13
13
  }
@@ -24,7 +24,7 @@ var AnnotationBlock = observer(function (_a) {
24
24
  ctx.clearRect(0, 0, blockSize, rowHeight);
25
25
  ctx.translate(-offsetX, 0);
26
26
  ctx.textAlign = 'center';
27
- ctx.font = ctx.font.replace(/\d+px/, Math.max(8, rowHeight - 8) + "px");
27
+ ctx.font = ctx.font.replace(/\d+px/, "".concat(Math.max(8, rowHeight - 8), "px"));
28
28
  var xStart = Math.max(0, Math.floor(offsetX / colWidth));
29
29
  var xEnd = Math.max(0, Math.ceil((offsetX + blockSize) / colWidth));
30
30
  var str = data === null || data === void 0 ? void 0 : data.slice(xStart, xEnd);
@@ -110,7 +110,7 @@ var TreeBlock = observer(function (_a) {
110
110
  ctx.clearRect(0, 0, treeWidth + padding, blockSize);
111
111
  ctx.translate(margin.left, -offsetY);
112
112
  var font = ctx.font;
113
- ctx.font = font.replace(/\d+px/, Math.max(8, rowHeight - 8) + "px");
113
+ ctx.font = font.replace(/\d+px/, "".concat(Math.max(8, rowHeight - 8), "px"));
114
114
  if (!noTree && drawTree) {
115
115
  hierarchy.links().forEach(function (_a) {
116
116
  var source = _a.source, target = _a.target;
@@ -249,6 +249,7 @@ var TreeBlock = observer(function (_a) {
249
249
  labelsAlignRight,
250
250
  treeAreaWidth,
251
251
  structures,
252
+ highResScaleFactor,
252
253
  ]);
253
254
  useEffect(function () {
254
255
  var canvas = mouseoverRef.current;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.0",
2
+ "version": "1.3.1",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/dist/model.js CHANGED
@@ -159,12 +159,12 @@ var UniprotTrack = types
159
159
  case 0:
160
160
  _a.trys.push([0, 3, , 4]);
161
161
  accession = self.accession;
162
- url = "https://www.uniprot.org/uniprot/" + accession + ".gff";
162
+ url = "https://www.uniprot.org/uniprot/".concat(accession, ".gff");
163
163
  return [4 /*yield*/, fetch(url)];
164
164
  case 1:
165
165
  response = _a.sent();
166
166
  if (!response.ok) {
167
- throw new Error("HTTP " + response.status + " " + response.statusText + " fetching " + url);
167
+ throw new Error("HTTP ".concat(response.status, " ").concat(response.statusText, " fetching ").concat(url));
168
168
  }
169
169
  return [4 /*yield*/, response.text()];
170
170
  case 2:
@@ -503,9 +503,9 @@ var MSAModel = types
503
503
  return ((_a = this.MSA) === null || _a === void 0 ? void 0 : _a.getDetails()) || {};
504
504
  },
505
505
  getRowDetails: function (name) {
506
- var _a;
506
+ var _a, _b;
507
507
  //@ts-ignore
508
- var details = (_a = this.MSA) === null || _a === void 0 ? void 0 : _a.getRowDetails(name);
508
+ var details = (_b = (_a = this.MSA) === null || _a === void 0 ? void 0 : _a.getRowDetails) === null || _b === void 0 ? void 0 : _b.call(_a, name);
509
509
  var matches = name.match(/\S+\/(\d+)-(\d+)/);
510
510
  return __assign(__assign({}, details), (matches && { range: { start: +matches[1], end: +matches[2] } }));
511
511
  },
@@ -774,7 +774,7 @@ var MSAModel = types
774
774
  ? Object.entries(region.attributes)
775
775
  .map(function (_a) {
776
776
  var k = _a[0], v = _a[1];
777
- return k + "=" + v.join(',');
777
+ return "".concat(k, "=").concat(v.join(','));
778
778
  })
779
779
  .join(';')
780
780
  : '.';
@@ -32,7 +32,7 @@ var StockholmMSA = /** @class */ (function () {
32
32
  };
33
33
  Object.defineProperty(StockholmMSA.prototype, "alignmentNames", {
34
34
  get: function () {
35
- return this.data.map(function (aln, index) { var _a; return ((_a = aln.gf.DE) === null || _a === void 0 ? void 0 : _a[0]) || "Alignment " + (index + 1); });
35
+ return this.data.map(function (aln, index) { var _a; return ((_a = aln.gf.DE) === null || _a === void 0 ? void 0 : _a[0]) || "Alignment ".concat(index + 1); });
36
36
  },
37
37
  enumerable: false,
38
38
  configurable: true
package/dist/util.js CHANGED
@@ -17,9 +17,9 @@ export function generateNodeIds(tree, parent, depth) {
17
17
  var _a;
18
18
  if (parent === void 0) { parent = 'node'; }
19
19
  if (depth === void 0) { depth = 0; }
20
- var id = parent + "-" + depth;
20
+ var id = "".concat(parent, "-").concat(depth);
21
21
  return __assign(__assign({}, tree), { id: id, branchset: ((_a = tree.branchset) === null || _a === void 0 ? void 0 : _a.map(function (b, i) {
22
- return generateNodeIds(b, id + "-" + i, depth + 1);
22
+ return generateNodeIds(b, "".concat(id, "-").concat(i), depth + 1);
23
23
  })) || [] });
24
24
  }
25
25
  export function colorContrast(colorScheme, theme) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.1",
2
+ "version": "1.3.2",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",