@jbrowse/plugin-alignments 1.7.7 → 1.7.8
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/BamAdapter/BamAdapter.d.ts +1 -1
- package/dist/BamAdapter/BamAdapter.js +3 -3
- package/dist/BamAdapter/MismatchParser.d.ts +2 -5
- package/dist/BamAdapter/MismatchParser.js +104 -44
- package/dist/BamAdapter/MismatchParser.test.js +6 -14
- package/dist/CramAdapter/CramAdapter.d.ts +10 -9
- package/dist/CramAdapter/CramAdapter.js +6 -6
- package/dist/CramAdapter/CramSlightlyLazyFeature.js +35 -30
- package/dist/LinearPileupDisplay/model.js +1 -1
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +2 -3
- package/dist/LinearSNPCoverageDisplay/models/model.js +1 -1
- package/dist/PileupRenderer/PileupLayoutSession.d.ts +3 -0
- package/dist/PileupRenderer/PileupLayoutSession.js +3 -1
- package/dist/PileupRenderer/PileupRenderer.d.ts +1 -1
- package/dist/PileupRenderer/PileupRenderer.js +125 -162
- package/dist/PileupRenderer/configSchema.js +2 -2
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +4 -6
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +92 -96
- package/package.json +3 -3
- package/src/BamAdapter/BamAdapter.ts +3 -3
- package/src/BamAdapter/MismatchParser.test.ts +5 -7
- package/src/BamAdapter/MismatchParser.ts +69 -58
- package/src/CramAdapter/CramAdapter.ts +14 -10
- package/src/CramAdapter/CramSlightlyLazyFeature.ts +84 -91
- package/src/LinearPileupDisplay/model.ts +1 -1
- package/src/LinearSNPCoverageDisplay/components/Tooltip.tsx +32 -25
- package/src/LinearSNPCoverageDisplay/models/model.ts +1 -1
- package/src/PileupRenderer/PileupLayoutSession.ts +6 -1
- package/src/PileupRenderer/PileupRenderer.tsx +70 -68
- package/src/PileupRenderer/configSchema.ts +2 -2
- package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +84 -76
|
@@ -105,10 +105,14 @@ var alignmentColoring = {
|
|
|
105
105
|
color_shortinsert: 'pink'
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
function
|
|
108
|
+
function shouldDrawSNPs(type) {
|
|
109
109
|
return !['methylation', 'modifications'].includes(type || '');
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
function shouldDrawIndels(type) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
|
|
112
116
|
var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
113
117
|
(0, _inherits2.default)(PileupRenderer, _BoxRendererType);
|
|
114
118
|
|
|
@@ -391,7 +395,6 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
391
395
|
});
|
|
392
396
|
var cigar = feature.get('CIGAR');
|
|
393
397
|
var start = feature.get('start');
|
|
394
|
-
var end = feature.get('end');
|
|
395
398
|
var seq = feature.get('seq');
|
|
396
399
|
var strand = feature.get('strand');
|
|
397
400
|
var cigarOps = (0, _MismatchParser.parseCigar)(cigar);
|
|
@@ -412,19 +415,18 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
412
415
|
try {
|
|
413
416
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
414
417
|
var readPos = _step.value;
|
|
418
|
+
var r = start + readPos;
|
|
415
419
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
// invisible to avoid confusion
|
|
422
|
-
|
|
420
|
+
var _bpSpanPx7 = (0, _util.bpSpanPx)(r, r + 1, region, bpPerPx),
|
|
421
|
+
_bpSpanPx8 = (0, _slicedToArray2.default)(_bpSpanPx7, 2),
|
|
422
|
+
leftPx = _bpSpanPx8[0],
|
|
423
|
+
rightPx = _bpSpanPx8[1]; // give it a little boost of 0.1 to not make them fully
|
|
424
|
+
// invisible to avoid confusion
|
|
423
425
|
|
|
424
|
-
ctx.fillStyle = base.alpha(probabilities[probIndex] + 0.1).hsl().string();
|
|
425
|
-
ctx.fillRect(leftPx, topPx, rightPx - leftPx + 0.5, heightPx);
|
|
426
|
-
}
|
|
427
426
|
|
|
427
|
+
var prob = probabilities[probIndex];
|
|
428
|
+
ctx.fillStyle = prob && prob !== 1 ? base.alpha(prob + 0.1).hsl().string() : col;
|
|
429
|
+
ctx.fillRect(leftPx, topPx, rightPx - leftPx + 0.5, heightPx);
|
|
428
430
|
probIndex++;
|
|
429
431
|
}
|
|
430
432
|
} catch (err) {
|
|
@@ -456,9 +458,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
456
458
|
var seq = feature.get('seq');
|
|
457
459
|
var strand = feature.get('strand');
|
|
458
460
|
var cigarOps = (0, _MismatchParser.parseCigar)(cigar);
|
|
459
|
-
var
|
|
460
|
-
rend = region.end;
|
|
461
|
-
var methBins = new Array(rend - rstart).fill(0);
|
|
461
|
+
var methBins = new Array(region.end - region.start).fill(0);
|
|
462
462
|
var modifications = (0, _MismatchParser.getModificationPositions)(mm, seq, strand);
|
|
463
463
|
|
|
464
464
|
for (var i = 0; i < modifications.length; i++) {
|
|
@@ -473,7 +473,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
473
473
|
try {
|
|
474
474
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
475
475
|
var pos = _step2.value;
|
|
476
|
-
var epos = pos + fstart -
|
|
476
|
+
var epos = pos + fstart - region.start;
|
|
477
477
|
|
|
478
478
|
if (epos >= 0 && epos < methBins.length) {
|
|
479
479
|
methBins[epos] = 1;
|
|
@@ -488,7 +488,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
for (var j = fstart; j < fend; j++) {
|
|
491
|
-
var _i = j -
|
|
491
|
+
var _i = j - region.start;
|
|
492
492
|
|
|
493
493
|
if (_i >= 0 && _i < methBins.length) {
|
|
494
494
|
var l1 = regionSequence[_i].toLowerCase();
|
|
@@ -498,38 +498,28 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
498
498
|
|
|
499
499
|
if (bpPerPx > 2) {
|
|
500
500
|
if (l1 === 'c' && l2 === 'g') {
|
|
501
|
-
var s =
|
|
501
|
+
var s = region.start + _i;
|
|
502
502
|
|
|
503
503
|
var _bpSpanPx9 = (0, _util.bpSpanPx)(s, s + 2, region, bpPerPx),
|
|
504
504
|
_bpSpanPx10 = (0, _slicedToArray2.default)(_bpSpanPx9, 2),
|
|
505
505
|
leftPx = _bpSpanPx10[0],
|
|
506
506
|
rightPx = _bpSpanPx10[1];
|
|
507
507
|
|
|
508
|
-
|
|
509
|
-
ctx.fillStyle = 'red';
|
|
510
|
-
} else {
|
|
511
|
-
ctx.fillStyle = 'blue';
|
|
512
|
-
}
|
|
513
|
-
|
|
508
|
+
ctx.fillStyle = methBins[_i] || methBins[_i + 1] ? 'red' : 'blue';
|
|
514
509
|
ctx.fillRect(leftPx, topPx, rightPx - leftPx + 0.5, heightPx);
|
|
515
510
|
}
|
|
516
511
|
} // if we are zoomed in, color the c inside the cpg
|
|
517
512
|
else {
|
|
518
513
|
// color
|
|
519
514
|
if (l1 === 'c' && l2 === 'g') {
|
|
520
|
-
var _s =
|
|
515
|
+
var _s = region.start + _i;
|
|
521
516
|
|
|
522
517
|
var _bpSpanPx11 = (0, _util.bpSpanPx)(_s, _s + 1, region, bpPerPx),
|
|
523
518
|
_bpSpanPx12 = (0, _slicedToArray2.default)(_bpSpanPx11, 2),
|
|
524
519
|
_leftPx = _bpSpanPx12[0],
|
|
525
520
|
_rightPx = _bpSpanPx12[1];
|
|
526
521
|
|
|
527
|
-
|
|
528
|
-
ctx.fillStyle = 'red';
|
|
529
|
-
} else {
|
|
530
|
-
ctx.fillStyle = 'blue';
|
|
531
|
-
}
|
|
532
|
-
|
|
522
|
+
ctx.fillStyle = methBins[_i] ? 'red' : 'blue';
|
|
533
523
|
ctx.fillRect(_leftPx, topPx, _rightPx - _leftPx + 0.5, heightPx);
|
|
534
524
|
|
|
535
525
|
var _bpSpanPx13 = (0, _util.bpSpanPx)(_s + 1, _s + 2, region, bpPerPx),
|
|
@@ -537,12 +527,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
537
527
|
leftPx2 = _bpSpanPx14[0],
|
|
538
528
|
rightPx2 = _bpSpanPx14[1];
|
|
539
529
|
|
|
540
|
-
|
|
541
|
-
ctx.fillStyle = 'red';
|
|
542
|
-
} else {
|
|
543
|
-
ctx.fillStyle = 'blue';
|
|
544
|
-
}
|
|
545
|
-
|
|
530
|
+
ctx.fillStyle = methBins[_i + 1] ? 'red' : 'blue';
|
|
546
531
|
ctx.fillRect(leftPx2, topPx, rightPx2 - leftPx2 + 0.5, heightPx);
|
|
547
532
|
}
|
|
548
533
|
}
|
|
@@ -753,20 +738,9 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
753
738
|
var pxPerBp = Math.min(1 / bpPerPx, 2);
|
|
754
739
|
var w = Math.max(minSubfeatureWidth, pxPerBp);
|
|
755
740
|
var mismatches = feature.get('mismatches');
|
|
756
|
-
var heightLim = charHeight - 2;
|
|
757
|
-
|
|
758
|
-
function getAlphaColor(baseColor, mismatch) {
|
|
759
|
-
var color = baseColor;
|
|
760
|
-
|
|
761
|
-
if (mismatchAlpha && mismatch.qual !== undefined) {
|
|
762
|
-
color = (0, _color.default)(baseColor).alpha(Math.min(1, mismatch.qual / 50)).hsl().string();
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
return color;
|
|
766
|
-
} // extraHorizontallyFlippedOffset is used to draw interbase items, which
|
|
741
|
+
var heightLim = charHeight - 2; // extraHorizontallyFlippedOffset is used to draw interbase items, which
|
|
767
742
|
// are located to the left when forward and right when reversed
|
|
768
743
|
|
|
769
|
-
|
|
770
744
|
var extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx + 1 : -1; // two pass rendering: first pass, draw all the mismatches except wide
|
|
771
745
|
// insertion markers
|
|
772
746
|
|
|
@@ -785,13 +759,13 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
785
759
|
|
|
786
760
|
if (mismatch.type === 'mismatch' && drawSNPs) {
|
|
787
761
|
var baseColor = colorForBase[mismatch.base] || '#888';
|
|
788
|
-
ctx.fillStyle =
|
|
762
|
+
ctx.fillStyle = !mismatchAlpha ? baseColor : mismatch.qual !== undefined ? (0, _color.default)(baseColor).alpha(Math.min(1, mismatch.qual / 50)).hsl().string() : baseColor;
|
|
789
763
|
ctx.fillRect(leftPx, topPx, widthPx, heightPx);
|
|
790
764
|
|
|
791
765
|
if (widthPx >= charWidth && heightPx >= heightLim) {
|
|
792
766
|
// normal SNP coloring
|
|
793
|
-
var
|
|
794
|
-
ctx.fillStyle =
|
|
767
|
+
var contrastColor = contrastForBase[mismatch.base] || 'black';
|
|
768
|
+
ctx.fillStyle = !mismatchAlpha ? contrastColor : mismatch.qual !== undefined ? (0, _color.default)(contrastColor).alpha(Math.min(1, mismatch.qual / 50)).hsl().string() : contrastColor;
|
|
795
769
|
ctx.fillText(mbase, leftPx + (widthPx - charWidth) / 2 + 1, topPx + heightPx);
|
|
796
770
|
}
|
|
797
771
|
} else if (mismatch.type === 'deletion' && drawIndels) {
|
|
@@ -868,12 +842,13 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
868
842
|
ctx.fillStyle = 'purple';
|
|
869
843
|
ctx.fillRect(_leftPx2 - 1, topPx, 2, heightPx);
|
|
870
844
|
} else if (heightPx > charHeight) {
|
|
871
|
-
var
|
|
845
|
+
var _rwidth = (0, _util.measureText)(_txt);
|
|
846
|
+
|
|
872
847
|
var padding = 5;
|
|
873
848
|
ctx.fillStyle = 'purple';
|
|
874
|
-
ctx.fillRect(_leftPx2 -
|
|
849
|
+
ctx.fillRect(_leftPx2 - _rwidth / 2 - padding, topPx, _rwidth + 2 * padding, heightPx);
|
|
875
850
|
ctx.fillStyle = 'white';
|
|
876
|
-
ctx.fillText(_txt, _leftPx2 -
|
|
851
|
+
ctx.fillText(_txt, _leftPx2 - _rwidth / 2, topPx + heightPx);
|
|
877
852
|
} else {
|
|
878
853
|
var _padding = 2;
|
|
879
854
|
ctx.fillStyle = 'purple';
|
|
@@ -950,93 +925,82 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
950
925
|
}
|
|
951
926
|
}, {
|
|
952
927
|
key: "makeImageData",
|
|
953
|
-
value: function () {
|
|
954
|
-
var
|
|
955
|
-
|
|
928
|
+
value: function makeImageData(ctx, layoutRecords, props) {
|
|
929
|
+
var layout = props.layout,
|
|
930
|
+
config = props.config,
|
|
931
|
+
showSoftClip = props.showSoftClip,
|
|
932
|
+
colorBy = props.colorBy,
|
|
933
|
+
configTheme = props.theme;
|
|
934
|
+
var mismatchAlpha = (0, _configuration.readConfObject)(config, 'mismatchAlpha');
|
|
935
|
+
var minSubfeatureWidth = (0, _configuration.readConfObject)(config, 'minSubfeatureWidth');
|
|
936
|
+
var largeInsertionIndicatorScale = (0, _configuration.readConfObject)(config, 'largeInsertionIndicatorScale');
|
|
937
|
+
var defaultColor = (0, _configuration.readConfObject)(config, 'color') === '#f0f';
|
|
938
|
+
var theme = (0, _ui.createJBrowseTheme)(configTheme);
|
|
939
|
+
var colorForBase = getColorBaseMap(theme);
|
|
940
|
+
var contrastForBase = getContrastBaseMap(theme);
|
|
956
941
|
|
|
957
|
-
|
|
942
|
+
if (!layout) {
|
|
943
|
+
throw new Error("layout required");
|
|
944
|
+
}
|
|
958
945
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
case 0:
|
|
963
|
-
layout = props.layout, config = props.config, showSoftClip = props.showSoftClip, colorBy = props.colorBy, configTheme = props.theme;
|
|
964
|
-
mismatchAlpha = (0, _configuration.readConfObject)(config, 'mismatchAlpha');
|
|
965
|
-
minSubfeatureWidth = (0, _configuration.readConfObject)(config, 'minSubfeatureWidth');
|
|
966
|
-
insertScale = (0, _configuration.readConfObject)(config, 'largeInsertionIndicatorScale');
|
|
967
|
-
defaultColor = (0, _configuration.readConfObject)(config, 'color') === '#f0f';
|
|
968
|
-
theme = (0, _ui.createJBrowseTheme)(configTheme);
|
|
969
|
-
colorForBase = getColorBaseMap(theme);
|
|
970
|
-
contrastForBase = getContrastBaseMap(theme);
|
|
971
|
-
|
|
972
|
-
if (layout) {
|
|
973
|
-
_context.next = 10;
|
|
974
|
-
break;
|
|
975
|
-
}
|
|
946
|
+
if (!layout.addRect) {
|
|
947
|
+
throw new Error('invalid layout object');
|
|
948
|
+
}
|
|
976
949
|
|
|
977
|
-
|
|
950
|
+
ctx.font = 'bold 10px Courier New,monospace';
|
|
978
951
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
break;
|
|
983
|
-
}
|
|
952
|
+
var _this$getCharWidthHei2 = this.getCharWidthHeight(ctx),
|
|
953
|
+
charWidth = _this$getCharWidthHei2.charWidth,
|
|
954
|
+
charHeight = _this$getCharWidthHei2.charHeight;
|
|
984
955
|
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
case 12:
|
|
988
|
-
ctx.font = 'bold 10px Courier New,monospace';
|
|
989
|
-
_this$getCharWidthHei2 = this.getCharWidthHeight(ctx), charWidth = _this$getCharWidthHei2.charWidth, charHeight = _this$getCharWidthHei2.charHeight;
|
|
990
|
-
layoutRecords.forEach(function (feat) {
|
|
991
|
-
if (feat === null) {
|
|
992
|
-
return;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
_this2.drawAlignmentRect(ctx, feat, _objectSpread(_objectSpread({}, props), {}, {
|
|
996
|
-
defaultColor: defaultColor,
|
|
997
|
-
colorForBase: colorForBase,
|
|
998
|
-
contrastForBase: contrastForBase,
|
|
999
|
-
charWidth: charWidth,
|
|
1000
|
-
charHeight: charHeight
|
|
1001
|
-
}));
|
|
956
|
+
var drawSNPs = shouldDrawSNPs(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type);
|
|
957
|
+
var drawIndels = shouldDrawIndels(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type);
|
|
1002
958
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
drawSNPs: shouldDrawMismatches(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type),
|
|
1006
|
-
drawIndels: shouldDrawMismatches(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type),
|
|
1007
|
-
largeInsertionIndicatorScale: insertScale,
|
|
1008
|
-
minSubfeatureWidth: minSubfeatureWidth,
|
|
1009
|
-
charWidth: charWidth,
|
|
1010
|
-
charHeight: charHeight,
|
|
1011
|
-
colorForBase: colorForBase,
|
|
1012
|
-
contrastForBase: contrastForBase
|
|
1013
|
-
});
|
|
1014
|
-
|
|
1015
|
-
if (showSoftClip) {
|
|
1016
|
-
_this2.drawSoftClipping(ctx, feat, props, config, theme);
|
|
1017
|
-
}
|
|
1018
|
-
});
|
|
959
|
+
for (var i = 0; i < layoutRecords.length; i++) {
|
|
960
|
+
var feat = layoutRecords[i];
|
|
1019
961
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
}, _callee, this);
|
|
1026
|
-
}));
|
|
962
|
+
if (feat === null) {
|
|
963
|
+
continue;
|
|
964
|
+
}
|
|
1027
965
|
|
|
1028
|
-
|
|
1029
|
-
|
|
966
|
+
this.drawAlignmentRect(ctx, feat, _objectSpread(_objectSpread({}, props), {}, {
|
|
967
|
+
defaultColor: defaultColor,
|
|
968
|
+
colorForBase: colorForBase,
|
|
969
|
+
contrastForBase: contrastForBase,
|
|
970
|
+
charWidth: charWidth,
|
|
971
|
+
charHeight: charHeight
|
|
972
|
+
}));
|
|
973
|
+
this.drawMismatches(ctx, feat, props, {
|
|
974
|
+
mismatchAlpha: mismatchAlpha,
|
|
975
|
+
drawSNPs: drawSNPs,
|
|
976
|
+
drawIndels: drawIndels,
|
|
977
|
+
largeInsertionIndicatorScale: largeInsertionIndicatorScale,
|
|
978
|
+
minSubfeatureWidth: minSubfeatureWidth,
|
|
979
|
+
charWidth: charWidth,
|
|
980
|
+
charHeight: charHeight,
|
|
981
|
+
colorForBase: colorForBase,
|
|
982
|
+
contrastForBase: contrastForBase
|
|
983
|
+
});
|
|
1030
984
|
}
|
|
1031
985
|
|
|
1032
|
-
|
|
1033
|
-
|
|
986
|
+
if (showSoftClip) {
|
|
987
|
+
for (var _i3 = 0; _i3 < layoutRecords.length; _i3++) {
|
|
988
|
+
var _feat = layoutRecords[_i3];
|
|
989
|
+
|
|
990
|
+
if (_feat === null) {
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
this.drawSoftClipping(ctx, _feat, props, config, theme);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
} // we perform a full layout before render as a separate method because the
|
|
1034
998
|
// layout determines the height of the canvas that we use to render
|
|
1035
999
|
|
|
1036
1000
|
}, {
|
|
1037
1001
|
key: "layoutFeats",
|
|
1038
1002
|
value: function layoutFeats(props) {
|
|
1039
|
-
var
|
|
1003
|
+
var _this2 = this;
|
|
1040
1004
|
|
|
1041
1005
|
var layout = props.layout,
|
|
1042
1006
|
features = props.features,
|
|
@@ -1060,8 +1024,8 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
1060
1024
|
var featureMap = sortedBy !== null && sortedBy !== void 0 && sortedBy.type && region.start === sortedBy.pos ? (0, _sortUtil.sortFeature)(features, sortedBy) : features;
|
|
1061
1025
|
var heightPx = (0, _configuration.readConfObject)(config, 'height');
|
|
1062
1026
|
var displayMode = (0, _configuration.readConfObject)(config, 'displayMode');
|
|
1063
|
-
|
|
1064
|
-
return
|
|
1027
|
+
return (0, _util.iterMap)(featureMap.values(), function (feature) {
|
|
1028
|
+
return _this2.layoutFeature({
|
|
1065
1029
|
feature: feature,
|
|
1066
1030
|
layout: layout,
|
|
1067
1031
|
bpPerPx: bpPerPx,
|
|
@@ -1071,47 +1035,46 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
1071
1035
|
displayMode: displayMode
|
|
1072
1036
|
});
|
|
1073
1037
|
}, featureMap.size);
|
|
1074
|
-
return layoutRecords;
|
|
1075
1038
|
}
|
|
1076
1039
|
}, {
|
|
1077
1040
|
key: "fetchSequence",
|
|
1078
1041
|
value: function () {
|
|
1079
|
-
var _fetchSequence2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1042
|
+
var _fetchSequence2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(renderProps) {
|
|
1080
1043
|
var sessionId, regions, adapterConfig, sequenceAdapter, _yield$getAdapter, dataAdapter, _regions5, region;
|
|
1081
1044
|
|
|
1082
|
-
return _regenerator.default.wrap(function
|
|
1045
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
1083
1046
|
while (1) {
|
|
1084
|
-
switch (
|
|
1047
|
+
switch (_context.prev = _context.next) {
|
|
1085
1048
|
case 0:
|
|
1086
1049
|
sessionId = renderProps.sessionId, regions = renderProps.regions, adapterConfig = renderProps.adapterConfig;
|
|
1087
1050
|
sequenceAdapter = adapterConfig.sequenceAdapter;
|
|
1088
1051
|
|
|
1089
1052
|
if (sequenceAdapter) {
|
|
1090
|
-
|
|
1053
|
+
_context.next = 4;
|
|
1091
1054
|
break;
|
|
1092
1055
|
}
|
|
1093
1056
|
|
|
1094
|
-
return
|
|
1057
|
+
return _context.abrupt("return", undefined);
|
|
1095
1058
|
|
|
1096
1059
|
case 4:
|
|
1097
|
-
|
|
1060
|
+
_context.next = 6;
|
|
1098
1061
|
return (0, _dataAdapterCache.getAdapter)(this.pluginManager, sessionId, sequenceAdapter);
|
|
1099
1062
|
|
|
1100
1063
|
case 6:
|
|
1101
|
-
_yield$getAdapter =
|
|
1064
|
+
_yield$getAdapter = _context.sent;
|
|
1102
1065
|
dataAdapter = _yield$getAdapter.dataAdapter;
|
|
1103
1066
|
_regions5 = (0, _slicedToArray2.default)(regions, 1), region = _regions5[0];
|
|
1104
|
-
return
|
|
1067
|
+
return _context.abrupt("return", (0, _util2.fetchSequence)(region, dataAdapter));
|
|
1105
1068
|
|
|
1106
1069
|
case 10:
|
|
1107
1070
|
case "end":
|
|
1108
|
-
return
|
|
1071
|
+
return _context.stop();
|
|
1109
1072
|
}
|
|
1110
1073
|
}
|
|
1111
|
-
},
|
|
1074
|
+
}, _callee, this);
|
|
1112
1075
|
}));
|
|
1113
1076
|
|
|
1114
|
-
function fetchSequence(
|
|
1077
|
+
function fetchSequence(_x) {
|
|
1115
1078
|
return _fetchSequence2.apply(this, arguments);
|
|
1116
1079
|
}
|
|
1117
1080
|
|
|
@@ -1120,21 +1083,21 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
1120
1083
|
}, {
|
|
1121
1084
|
key: "render",
|
|
1122
1085
|
value: function () {
|
|
1123
|
-
var _render = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1086
|
+
var _render = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(renderProps) {
|
|
1124
1087
|
var _renderProps$colorBy,
|
|
1125
|
-
|
|
1088
|
+
_this3 = this;
|
|
1126
1089
|
|
|
1127
1090
|
var features, layout, regions, bpPerPx, layoutRecords, _regions6, region, regionSequence, end, start, width, height, res, results;
|
|
1128
1091
|
|
|
1129
|
-
return _regenerator.default.wrap(function
|
|
1092
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
1130
1093
|
while (1) {
|
|
1131
|
-
switch (
|
|
1094
|
+
switch (_context2.prev = _context2.next) {
|
|
1132
1095
|
case 0:
|
|
1133
|
-
|
|
1096
|
+
_context2.next = 2;
|
|
1134
1097
|
return this.getFeatures(renderProps);
|
|
1135
1098
|
|
|
1136
1099
|
case 2:
|
|
1137
|
-
features =
|
|
1100
|
+
features = _context2.sent;
|
|
1138
1101
|
layout = this.createLayoutInWorker(renderProps);
|
|
1139
1102
|
regions = renderProps.regions, bpPerPx = renderProps.bpPerPx;
|
|
1140
1103
|
layoutRecords = this.layoutFeats(_objectSpread(_objectSpread({}, renderProps), {}, {
|
|
@@ -1145,29 +1108,29 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
1145
1108
|
// cases
|
|
1146
1109
|
|
|
1147
1110
|
if (!(features.size && (0, _util2.shouldFetchReferenceSequence)((_renderProps$colorBy = renderProps.colorBy) === null || _renderProps$colorBy === void 0 ? void 0 : _renderProps$colorBy.type))) {
|
|
1148
|
-
|
|
1111
|
+
_context2.next = 13;
|
|
1149
1112
|
break;
|
|
1150
1113
|
}
|
|
1151
1114
|
|
|
1152
|
-
|
|
1115
|
+
_context2.next = 10;
|
|
1153
1116
|
return this.fetchSequence(renderProps);
|
|
1154
1117
|
|
|
1155
1118
|
case 10:
|
|
1156
|
-
|
|
1157
|
-
|
|
1119
|
+
_context2.t0 = _context2.sent;
|
|
1120
|
+
_context2.next = 14;
|
|
1158
1121
|
break;
|
|
1159
1122
|
|
|
1160
1123
|
case 13:
|
|
1161
|
-
|
|
1124
|
+
_context2.t0 = undefined;
|
|
1162
1125
|
|
|
1163
1126
|
case 14:
|
|
1164
|
-
regionSequence =
|
|
1127
|
+
regionSequence = _context2.t0;
|
|
1165
1128
|
end = region.end, start = region.start;
|
|
1166
1129
|
width = (end - start) / bpPerPx;
|
|
1167
1130
|
height = Math.max(layout.getTotalHeight(), 1);
|
|
1168
|
-
|
|
1131
|
+
_context2.next = 20;
|
|
1169
1132
|
return (0, _offscreenCanvasUtils.renderToAbstractCanvas)(width, height, renderProps, function (ctx) {
|
|
1170
|
-
return
|
|
1133
|
+
return _this3.makeImageData(ctx, layoutRecords, _objectSpread(_objectSpread({}, renderProps), {}, {
|
|
1171
1134
|
layout: layout,
|
|
1172
1135
|
features: features,
|
|
1173
1136
|
regionSequence: regionSequence
|
|
@@ -1175,8 +1138,8 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
1175
1138
|
});
|
|
1176
1139
|
|
|
1177
1140
|
case 20:
|
|
1178
|
-
res =
|
|
1179
|
-
|
|
1141
|
+
res = _context2.sent;
|
|
1142
|
+
_context2.next = 23;
|
|
1180
1143
|
return (0, _get2.default)((0, _getPrototypeOf2.default)(PileupRenderer.prototype), "render", this).call(this, _objectSpread(_objectSpread(_objectSpread({}, renderProps), res), {}, {
|
|
1181
1144
|
features: features,
|
|
1182
1145
|
layout: layout,
|
|
@@ -1185,8 +1148,8 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
1185
1148
|
}));
|
|
1186
1149
|
|
|
1187
1150
|
case 23:
|
|
1188
|
-
results =
|
|
1189
|
-
return
|
|
1151
|
+
results = _context2.sent;
|
|
1152
|
+
return _context2.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, results), res), {}, {
|
|
1190
1153
|
features: new Map(),
|
|
1191
1154
|
layout: layout,
|
|
1192
1155
|
height: height,
|
|
@@ -1196,13 +1159,13 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
1196
1159
|
|
|
1197
1160
|
case 25:
|
|
1198
1161
|
case "end":
|
|
1199
|
-
return
|
|
1162
|
+
return _context2.stop();
|
|
1200
1163
|
}
|
|
1201
1164
|
}
|
|
1202
|
-
},
|
|
1165
|
+
}, _callee2, this);
|
|
1203
1166
|
}));
|
|
1204
1167
|
|
|
1205
|
-
function render(
|
|
1168
|
+
function render(_x2) {
|
|
1206
1169
|
return _render.apply(this, arguments);
|
|
1207
1170
|
}
|
|
1208
1171
|
|
|
@@ -31,8 +31,8 @@ var _default = (0, _configuration.ConfigurationSchema)('PileupRenderer', {
|
|
|
31
31
|
},
|
|
32
32
|
minSubfeatureWidth: {
|
|
33
33
|
type: 'number',
|
|
34
|
-
description: 'the minimum width in px for a pileup mismatch feature. use for increasing mismatch marker widths when zoomed out
|
|
35
|
-
defaultValue: 0
|
|
34
|
+
description: 'the minimum width in px for a pileup mismatch feature. use for increasing/decreasing mismatch marker widths when zoomed out, e.g. 0 or 1',
|
|
35
|
+
defaultValue: 0.7
|
|
36
36
|
},
|
|
37
37
|
maxHeight: {
|
|
38
38
|
type: 'integer',
|
|
@@ -20,6 +20,10 @@ export default class SNPCoverageAdapter extends BaseFeatureDataAdapter {
|
|
|
20
20
|
}): Promise<{
|
|
21
21
|
bins: {
|
|
22
22
|
total: number;
|
|
23
|
+
ref: number;
|
|
24
|
+
'-1': 0;
|
|
25
|
+
'0': 0;
|
|
26
|
+
'1': 0;
|
|
23
27
|
lowqual: {
|
|
24
28
|
total: number;
|
|
25
29
|
strands: {
|
|
@@ -44,12 +48,6 @@ export default class SNPCoverageAdapter extends BaseFeatureDataAdapter {
|
|
|
44
48
|
[key: string]: number;
|
|
45
49
|
};
|
|
46
50
|
};
|
|
47
|
-
ref: {
|
|
48
|
-
total: number;
|
|
49
|
-
strands: {
|
|
50
|
-
[key: string]: number;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
51
|
}[];
|
|
54
52
|
skipmap: {
|
|
55
53
|
[key: string]: {
|