@jbrowse/plugin-alignments 1.7.7 → 1.7.10

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.
Files changed (39) hide show
  1. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +13 -3
  2. package/dist/AlignmentsFeatureDetail/index.d.ts +28 -3
  3. package/dist/AlignmentsFeatureDetail/index.js +6 -17
  4. package/dist/BamAdapter/BamAdapter.d.ts +1 -1
  5. package/dist/BamAdapter/BamAdapter.js +3 -3
  6. package/dist/BamAdapter/MismatchParser.d.ts +2 -5
  7. package/dist/BamAdapter/MismatchParser.js +108 -46
  8. package/dist/BamAdapter/MismatchParser.test.js +6 -14
  9. package/dist/CramAdapter/CramAdapter.d.ts +10 -9
  10. package/dist/CramAdapter/CramAdapter.js +6 -6
  11. package/dist/CramAdapter/CramSlightlyLazyFeature.js +35 -30
  12. package/dist/LinearPileupDisplay/model.d.ts +6 -3
  13. package/dist/LinearPileupDisplay/model.js +132 -51
  14. package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +37 -17
  15. package/dist/LinearSNPCoverageDisplay/models/model.d.ts +2 -2
  16. package/dist/LinearSNPCoverageDisplay/models/model.js +1 -1
  17. package/dist/PileupRenderer/PileupLayoutSession.d.ts +3 -0
  18. package/dist/PileupRenderer/PileupLayoutSession.js +3 -1
  19. package/dist/PileupRenderer/PileupRenderer.d.ts +66 -9
  20. package/dist/PileupRenderer/PileupRenderer.js +296 -258
  21. package/dist/PileupRenderer/configSchema.js +2 -2
  22. package/dist/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +6 -6
  23. package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +95 -96
  24. package/dist/SNPCoverageRenderer/configSchema.d.ts +1 -1
  25. package/package.json +3 -3
  26. package/src/AlignmentsFeatureDetail/AlignmentsFeatureDetail.tsx +14 -3
  27. package/src/AlignmentsFeatureDetail/index.ts +7 -17
  28. package/src/BamAdapter/BamAdapter.ts +3 -3
  29. package/src/BamAdapter/MismatchParser.test.ts +5 -7
  30. package/src/BamAdapter/MismatchParser.ts +72 -59
  31. package/src/CramAdapter/CramAdapter.ts +14 -10
  32. package/src/CramAdapter/CramSlightlyLazyFeature.ts +84 -91
  33. package/src/LinearPileupDisplay/model.ts +76 -24
  34. package/src/LinearSNPCoverageDisplay/components/Tooltip.tsx +41 -20
  35. package/src/LinearSNPCoverageDisplay/models/model.ts +1 -1
  36. package/src/PileupRenderer/PileupLayoutSession.ts +6 -1
  37. package/src/PileupRenderer/PileupRenderer.tsx +413 -225
  38. package/src/PileupRenderer/configSchema.ts +2 -2
  39. package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +89 -76
@@ -65,6 +65,18 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
65
65
 
66
66
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
67
67
 
68
+ function fillRect(ctx, l, t, w, h, cw, color) {
69
+ if (l + w < 0 || l > cw) {
70
+ return;
71
+ } else {
72
+ if (color) {
73
+ ctx.fillStyle = color;
74
+ }
75
+
76
+ ctx.fillRect(l, t, w, h);
77
+ }
78
+ }
79
+
68
80
  function getColorBaseMap(theme) {
69
81
  return {
70
82
  A: theme.palette.bases.A.main,
@@ -105,10 +117,14 @@ var alignmentColoring = {
105
117
  color_shortinsert: 'pink'
106
118
  };
107
119
 
108
- function shouldDrawMismatches(type) {
120
+ function shouldDrawSNPs(type) {
109
121
  return !['methylation', 'modifications'].includes(type || '');
110
122
  }
111
123
 
124
+ function shouldDrawIndels(type) {
125
+ return true;
126
+ }
127
+
112
128
  var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
113
129
  (0, _inherits2.default)(PileupRenderer, _BoxRendererType);
114
130
 
@@ -133,8 +149,8 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
133
149
  value: // get width and height of chars the height is an approximation: width
134
150
  // letter M is approximately the height
135
151
  function getCharWidthHeight(ctx) {
136
- var charWidth = ctx.measureText('A').width;
137
- var charHeight = ctx.measureText('M').width;
152
+ var charWidth = (0, _util.measureText)('A');
153
+ var charHeight = (0, _util.measureText)('M');
138
154
  return {
139
155
  charWidth: charWidth,
140
156
  charHeight: charHeight
@@ -271,18 +287,23 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
271
287
  }
272
288
  }, {
273
289
  key: "colorByPerBaseLettering",
274
- value: function colorByPerBaseLettering(ctx, feat, _config, region, bpPerPx, props) {
275
- var colorForBase = props.colorForBase,
276
- contrastForBase = props.contrastForBase,
277
- charWidth = props.charWidth,
278
- charHeight = props.charHeight;
290
+ value: function colorByPerBaseLettering(_ref4) {
291
+ var ctx = _ref4.ctx,
292
+ feat = _ref4.feat,
293
+ region = _ref4.region,
294
+ bpPerPx = _ref4.bpPerPx,
295
+ colorForBase = _ref4.colorForBase,
296
+ contrastForBase = _ref4.contrastForBase,
297
+ charWidth = _ref4.charWidth,
298
+ charHeight = _ref4.charHeight,
299
+ canvasWidth = _ref4.canvasWidth;
279
300
  var heightLim = charHeight - 2;
280
301
  var feature = feat.feature,
281
302
  topPx = feat.topPx,
282
303
  heightPx = feat.heightPx;
283
304
  var seq = feature.get('seq');
284
305
  var cigarOps = (0, _MismatchParser.parseCigar)(feature.get('CIGAR'));
285
- var widthPx = 1 / bpPerPx;
306
+ var w = 1 / bpPerPx;
286
307
  var start = feature.get('start');
287
308
  var soffset = 0; // sequence offset
288
309
 
@@ -299,18 +320,18 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
299
320
  } else if (op === 'M' || op === 'X' || op === '=') {
300
321
  for (var m = 0; m < len; m++) {
301
322
  var letter = seq[soffset + m];
302
- ctx.fillStyle = colorForBase[letter];
323
+ var r = start + roffset + m;
303
324
 
304
- var _bpSpanPx3 = (0, _util.bpSpanPx)(start + roffset + m, start + roffset + m + 1, region, bpPerPx),
325
+ var _bpSpanPx3 = (0, _util.bpSpanPx)(r, r + 1, region, bpPerPx),
305
326
  _bpSpanPx4 = (0, _slicedToArray2.default)(_bpSpanPx3, 1),
306
327
  leftPx = _bpSpanPx4[0];
307
328
 
308
- ctx.fillRect(leftPx, topPx, widthPx + 0.5, heightPx);
329
+ fillRect(ctx, leftPx, topPx, w + 0.5, heightPx, canvasWidth, colorForBase[letter]);
309
330
 
310
- if (widthPx >= charWidth && heightPx >= heightLim) {
331
+ if (w >= charWidth && heightPx >= heightLim) {
311
332
  // normal SNP coloring
312
333
  ctx.fillStyle = contrastForBase[letter];
313
- ctx.fillText(letter, leftPx + (widthPx - charWidth) / 2 + 1, topPx + heightPx);
334
+ ctx.fillText(letter, leftPx + (w - charWidth) / 2 + 1, topPx + heightPx);
314
335
  }
315
336
  }
316
337
 
@@ -321,7 +342,12 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
321
342
  }
322
343
  }, {
323
344
  key: "colorByPerBaseQuality",
324
- value: function colorByPerBaseQuality(ctx, feat, _config, region, bpPerPx) {
345
+ value: function colorByPerBaseQuality(_ref5) {
346
+ var ctx = _ref5.ctx,
347
+ feat = _ref5.feat,
348
+ region = _ref5.region,
349
+ bpPerPx = _ref5.bpPerPx,
350
+ canvasWidth = _ref5.canvasWidth;
325
351
  var feature = feat.feature,
326
352
  topPx = feat.topPx,
327
353
  heightPx = feat.heightPx;
@@ -347,13 +373,12 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
347
373
  } else if (op === 'M' || op === 'X' || op === '=') {
348
374
  for (var m = 0; m < len; m++) {
349
375
  var score = scores[soffset + m];
350
- ctx.fillStyle = "hsl(".concat(score === 255 ? 150 : score * 1.5, ",55%,50%)");
351
376
 
352
377
  var _bpSpanPx5 = (0, _util.bpSpanPx)(start + roffset + m, start + roffset + m + 1, region, bpPerPx),
353
378
  _bpSpanPx6 = (0, _slicedToArray2.default)(_bpSpanPx5, 1),
354
379
  leftPx = _bpSpanPx6[0];
355
380
 
356
- ctx.fillRect(leftPx, topPx, width + 0.5, heightPx);
381
+ fillRect(ctx, leftPx, topPx, width + 0.5, heightPx, canvasWidth, "hsl(".concat(score === 255 ? 150 : score * 1.5, ",55%,50%)"));
357
382
  }
358
383
 
359
384
  soffset += len;
@@ -372,12 +397,18 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
372
397
 
373
398
  }, {
374
399
  key: "colorByModifications",
375
- value: function colorByModifications(ctx, layoutFeature, _config, region, bpPerPx, props) {
376
- var feature = layoutFeature.feature,
377
- topPx = layoutFeature.topPx,
378
- heightPx = layoutFeature.heightPx;
379
- var _props$modificationTa = props.modificationTagMap,
380
- modificationTagMap = _props$modificationTa === void 0 ? {} : _props$modificationTa;
400
+ value: function colorByModifications(_ref6) {
401
+ var ctx = _ref6.ctx,
402
+ feat = _ref6.feat,
403
+ region = _ref6.region,
404
+ bpPerPx = _ref6.bpPerPx,
405
+ renderArgs = _ref6.renderArgs,
406
+ canvasWidth = _ref6.canvasWidth;
407
+ var feature = feat.feature,
408
+ topPx = feat.topPx,
409
+ heightPx = feat.heightPx;
410
+ var _renderArgs$modificat = renderArgs.modificationTagMap,
411
+ modificationTagMap = _renderArgs$modificat === void 0 ? {} : _renderArgs$modificat;
381
412
  var mm = (0, _util2.getTagAlt)(feature, 'MM', 'Mm') || '';
382
413
  var ml = (0, _util2.getTagAlt)(feature, 'ML', 'Ml') || [];
383
414
  var probabilities = ml ? (typeof ml === 'string' ? ml.split(',').map(function (e) {
@@ -391,7 +422,6 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
391
422
  });
392
423
  var cigar = feature.get('CIGAR');
393
424
  var start = feature.get('start');
394
- var end = feature.get('end');
395
425
  var seq = feature.get('seq');
396
426
  var strand = feature.get('strand');
397
427
  var cigarOps = (0, _MismatchParser.parseCigar)(cigar);
@@ -412,19 +442,17 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
412
442
  try {
413
443
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
414
444
  var readPos = _step.value;
445
+ var r = start + readPos;
415
446
 
416
- if (readPos >= 0 && start + readPos < end) {
417
- var _bpSpanPx7 = (0, _util.bpSpanPx)(start + readPos, start + readPos + 1, region, bpPerPx),
418
- _bpSpanPx8 = (0, _slicedToArray2.default)(_bpSpanPx7, 2),
419
- leftPx = _bpSpanPx8[0],
420
- rightPx = _bpSpanPx8[1]; // give it a little boost of 0.1 to not make them fully
421
- // invisible to avoid confusion
447
+ var _bpSpanPx7 = (0, _util.bpSpanPx)(r, r + 1, region, bpPerPx),
448
+ _bpSpanPx8 = (0, _slicedToArray2.default)(_bpSpanPx7, 2),
449
+ leftPx = _bpSpanPx8[0],
450
+ rightPx = _bpSpanPx8[1]; // give it a little boost of 0.1 to not make them fully
451
+ // invisible to avoid confusion
422
452
 
423
453
 
424
- ctx.fillStyle = base.alpha(probabilities[probIndex] + 0.1).hsl().string();
425
- ctx.fillRect(leftPx, topPx, rightPx - leftPx + 0.5, heightPx);
426
- }
427
-
454
+ var prob = probabilities[probIndex];
455
+ fillRect(ctx, leftPx, topPx, rightPx - leftPx + 0.5, heightPx, canvasWidth, prob && prob !== 1 ? base.alpha(prob + 0.1).hsl().string() : col);
428
456
  probIndex++;
429
457
  }
430
458
  } catch (err) {
@@ -439,11 +467,17 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
439
467
 
440
468
  }, {
441
469
  key: "colorByMethylation",
442
- value: function colorByMethylation(ctx, layoutFeature, _config, region, bpPerPx, props) {
443
- var regionSequence = props.regionSequence;
444
- var feature = layoutFeature.feature,
445
- topPx = layoutFeature.topPx,
446
- heightPx = layoutFeature.heightPx;
470
+ value: function colorByMethylation(_ref7) {
471
+ var ctx = _ref7.ctx,
472
+ feat = _ref7.feat,
473
+ region = _ref7.region,
474
+ bpPerPx = _ref7.bpPerPx,
475
+ renderArgs = _ref7.renderArgs,
476
+ canvasWidth = _ref7.canvasWidth;
477
+ var regionSequence = renderArgs.regionSequence;
478
+ var feature = feat.feature,
479
+ topPx = feat.topPx,
480
+ heightPx = feat.heightPx;
447
481
  var mm = (0, _util2.getTagAlt)(feature, 'MM', 'Mm') || '';
448
482
 
449
483
  if (!regionSequence) {
@@ -456,9 +490,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
456
490
  var seq = feature.get('seq');
457
491
  var strand = feature.get('strand');
458
492
  var cigarOps = (0, _MismatchParser.parseCigar)(cigar);
459
- var rstart = region.start,
460
- rend = region.end;
461
- var methBins = new Array(rend - rstart).fill(0);
493
+ var methBins = new Array(region.end - region.start).fill(0);
462
494
  var modifications = (0, _MismatchParser.getModificationPositions)(mm, seq, strand);
463
495
 
464
496
  for (var i = 0; i < modifications.length; i++) {
@@ -473,7 +505,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
473
505
  try {
474
506
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
475
507
  var pos = _step2.value;
476
- var epos = pos + fstart - rstart;
508
+ var epos = pos + fstart - region.start;
477
509
 
478
510
  if (epos >= 0 && epos < methBins.length) {
479
511
  methBins[epos] = 1;
@@ -488,7 +520,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
488
520
  }
489
521
 
490
522
  for (var j = fstart; j < fend; j++) {
491
- var _i = j - rstart;
523
+ var _i = j - region.start;
492
524
 
493
525
  if (_i >= 0 && _i < methBins.length) {
494
526
  var l1 = regionSequence[_i].toLowerCase();
@@ -498,52 +530,34 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
498
530
 
499
531
  if (bpPerPx > 2) {
500
532
  if (l1 === 'c' && l2 === 'g') {
501
- var s = rstart + _i;
533
+ var s = region.start + _i;
502
534
 
503
535
  var _bpSpanPx9 = (0, _util.bpSpanPx)(s, s + 2, region, bpPerPx),
504
536
  _bpSpanPx10 = (0, _slicedToArray2.default)(_bpSpanPx9, 2),
505
537
  leftPx = _bpSpanPx10[0],
506
538
  rightPx = _bpSpanPx10[1];
507
539
 
508
- if (methBins[_i] || methBins[_i + 1]) {
509
- ctx.fillStyle = 'red';
510
- } else {
511
- ctx.fillStyle = 'blue';
512
- }
513
-
514
- ctx.fillRect(leftPx, topPx, rightPx - leftPx + 0.5, heightPx);
540
+ fillRect(ctx, leftPx, topPx, rightPx - leftPx + 0.5, heightPx, canvasWidth, methBins[_i] || methBins[_i + 1] ? 'red' : 'blue');
515
541
  }
516
542
  } // if we are zoomed in, color the c inside the cpg
517
543
  else {
518
544
  // color
519
545
  if (l1 === 'c' && l2 === 'g') {
520
- var _s = rstart + _i;
546
+ var _s = region.start + _i;
521
547
 
522
548
  var _bpSpanPx11 = (0, _util.bpSpanPx)(_s, _s + 1, region, bpPerPx),
523
549
  _bpSpanPx12 = (0, _slicedToArray2.default)(_bpSpanPx11, 2),
524
550
  _leftPx = _bpSpanPx12[0],
525
551
  _rightPx = _bpSpanPx12[1];
526
552
 
527
- if (methBins[_i]) {
528
- ctx.fillStyle = 'red';
529
- } else {
530
- ctx.fillStyle = 'blue';
531
- }
532
-
533
- ctx.fillRect(_leftPx, topPx, _rightPx - _leftPx + 0.5, heightPx);
553
+ fillRect(ctx, _leftPx, topPx, _rightPx - _leftPx + 0.5, heightPx, canvasWidth, methBins[_i] ? 'red' : 'blue');
534
554
 
535
555
  var _bpSpanPx13 = (0, _util.bpSpanPx)(_s + 1, _s + 2, region, bpPerPx),
536
556
  _bpSpanPx14 = (0, _slicedToArray2.default)(_bpSpanPx13, 2),
537
557
  leftPx2 = _bpSpanPx14[0],
538
558
  rightPx2 = _bpSpanPx14[1];
539
559
 
540
- if (methBins[_i + 1]) {
541
- ctx.fillStyle = 'red';
542
- } else {
543
- ctx.fillStyle = 'blue';
544
- }
545
-
546
- ctx.fillRect(leftPx2, topPx, rightPx2 - leftPx2 + 0.5, heightPx);
560
+ fillRect(ctx, leftPx2, topPx, rightPx2 - leftPx2 + 0.5, heightPx, canvasWidth, methBins[_i + 1] ? 'red' : 'blue');
547
561
  }
548
562
  }
549
563
  }
@@ -595,24 +609,28 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
595
609
  }
596
610
  }, {
597
611
  key: "drawAlignmentRect",
598
- value: function drawAlignmentRect(ctx, feat, props) {
599
- var defaultColor = props.defaultColor,
600
- config = props.config,
601
- bpPerPx = props.bpPerPx,
602
- regions = props.regions,
603
- colorBy = props.colorBy,
604
- _props$colorTagMap = props.colorTagMap,
605
- colorTagMap = _props$colorTagMap === void 0 ? {} : _props$colorTagMap,
606
- colorForBase = props.colorForBase,
607
- contrastForBase = props.contrastForBase,
608
- charWidth = props.charWidth,
609
- charHeight = props.charHeight;
610
-
611
- var _ref4 = colorBy || {},
612
- _ref4$tag = _ref4.tag,
613
- tag = _ref4$tag === void 0 ? '' : _ref4$tag,
614
- _ref4$type = _ref4.type,
615
- colorType = _ref4$type === void 0 ? '' : _ref4$type;
612
+ value: function drawAlignmentRect(_ref8) {
613
+ var ctx = _ref8.ctx,
614
+ feat = _ref8.feat,
615
+ renderArgs = _ref8.renderArgs,
616
+ colorForBase = _ref8.colorForBase,
617
+ contrastForBase = _ref8.contrastForBase,
618
+ charWidth = _ref8.charWidth,
619
+ charHeight = _ref8.charHeight,
620
+ defaultColor = _ref8.defaultColor,
621
+ canvasWidth = _ref8.canvasWidth;
622
+ var config = renderArgs.config,
623
+ bpPerPx = renderArgs.bpPerPx,
624
+ regions = renderArgs.regions,
625
+ colorBy = renderArgs.colorBy,
626
+ _renderArgs$colorTagM = renderArgs.colorTagMap,
627
+ colorTagMap = _renderArgs$colorTagM === void 0 ? {} : _renderArgs$colorTagM;
628
+
629
+ var _ref9 = colorBy || {},
630
+ _ref9$tag = _ref9.tag,
631
+ tag = _ref9$tag === void 0 ? '' : _ref9$tag,
632
+ _ref9$type = _ref9.type,
633
+ colorType = _ref9$type === void 0 ? '' : _ref9$type;
616
634
 
617
635
  var feature = feat.feature;
618
636
  var region = regions[0]; // first pass for simple color changes that change the color of the
@@ -700,48 +718,77 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
700
718
  break;
701
719
  }
702
720
 
703
- this.drawRect(ctx, feat, props); // second pass for color types that render per-base things that go over the
721
+ this.drawRect(ctx, feat, renderArgs); // second pass for color types that render per-base things that go over the
704
722
  // existing drawing
705
723
 
706
724
  switch (colorType) {
707
725
  case 'perBaseQuality':
708
- this.colorByPerBaseQuality(ctx, feat, config, region, bpPerPx);
726
+ this.colorByPerBaseQuality({
727
+ ctx: ctx,
728
+ feat: feat,
729
+ region: region,
730
+ bpPerPx: bpPerPx,
731
+ canvasWidth: canvasWidth
732
+ });
709
733
  break;
710
734
 
711
735
  case 'perBaseLettering':
712
- this.colorByPerBaseLettering(ctx, feat, config, region, bpPerPx, {
736
+ this.colorByPerBaseLettering({
737
+ ctx: ctx,
738
+ feat: feat,
739
+ region: region,
740
+ bpPerPx: bpPerPx,
713
741
  colorForBase: colorForBase,
714
742
  contrastForBase: contrastForBase,
715
743
  charWidth: charWidth,
716
- charHeight: charHeight
744
+ charHeight: charHeight,
745
+ canvasWidth: canvasWidth
717
746
  });
718
747
  break;
719
748
 
720
749
  case 'modifications':
721
- this.colorByModifications(ctx, feat, config, region, bpPerPx, props);
750
+ this.colorByModifications({
751
+ ctx: ctx,
752
+ feat: feat,
753
+ region: region,
754
+ bpPerPx: bpPerPx,
755
+ renderArgs: renderArgs,
756
+ canvasWidth: canvasWidth
757
+ });
722
758
  break;
723
759
 
724
760
  case 'methylation':
725
- this.colorByMethylation(ctx, feat, config, region, bpPerPx, props);
761
+ this.colorByMethylation({
762
+ ctx: ctx,
763
+ feat: feat,
764
+ region: region,
765
+ bpPerPx: bpPerPx,
766
+ renderArgs: renderArgs,
767
+ canvasWidth: canvasWidth
768
+ });
726
769
  break;
727
770
  }
728
771
  }
729
772
  }, {
730
773
  key: "drawMismatches",
731
- value: function drawMismatches(ctx, feat, props, opts) {
732
- var minSubfeatureWidth = opts.minSubfeatureWidth,
733
- largeInsertionIndicatorScale = opts.largeInsertionIndicatorScale,
734
- mismatchAlpha = opts.mismatchAlpha,
735
- _opts$drawSNPs = opts.drawSNPs,
736
- drawSNPs = _opts$drawSNPs === void 0 ? true : _opts$drawSNPs,
737
- _opts$drawIndels = opts.drawIndels,
738
- drawIndels = _opts$drawIndels === void 0 ? true : _opts$drawIndels,
739
- charWidth = opts.charWidth,
740
- charHeight = opts.charHeight,
741
- colorForBase = opts.colorForBase,
742
- contrastForBase = opts.contrastForBase;
743
- var bpPerPx = props.bpPerPx,
744
- regions = props.regions;
774
+ value: function drawMismatches(_ref10) {
775
+ var ctx = _ref10.ctx,
776
+ feat = _ref10.feat,
777
+ renderArgs = _ref10.renderArgs,
778
+ minSubfeatureWidth = _ref10.minSubfeatureWidth,
779
+ largeInsertionIndicatorScale = _ref10.largeInsertionIndicatorScale,
780
+ mismatchAlpha = _ref10.mismatchAlpha,
781
+ charWidth = _ref10.charWidth,
782
+ charHeight = _ref10.charHeight,
783
+ colorForBase = _ref10.colorForBase,
784
+ contrastForBase = _ref10.contrastForBase,
785
+ canvasWidth = _ref10.canvasWidth,
786
+ _ref10$drawSNPs = _ref10.drawSNPs,
787
+ drawSNPs = _ref10$drawSNPs === void 0 ? true : _ref10$drawSNPs,
788
+ _ref10$drawIndels = _ref10.drawIndels,
789
+ drawIndels = _ref10$drawIndels === void 0 ? true : _ref10$drawIndels;
790
+ var bpPerPx = renderArgs.bpPerPx,
791
+ regions = renderArgs.regions;
745
792
  var heightPx = feat.heightPx,
746
793
  topPx = feat.topPx,
747
794
  feature = feat.feature;
@@ -753,20 +800,9 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
753
800
  var pxPerBp = Math.min(1 / bpPerPx, 2);
754
801
  var w = Math.max(minSubfeatureWidth, pxPerBp);
755
802
  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
803
+ var heightLim = charHeight - 2; // extraHorizontallyFlippedOffset is used to draw interbase items, which
767
804
  // are located to the left when forward and right when reversed
768
805
 
769
-
770
806
  var extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx + 1 : -1; // two pass rendering: first pass, draw all the mismatches except wide
771
807
  // insertion markers
772
808
 
@@ -785,19 +821,16 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
785
821
 
786
822
  if (mismatch.type === 'mismatch' && drawSNPs) {
787
823
  var baseColor = colorForBase[mismatch.base] || '#888';
788
- ctx.fillStyle = getAlphaColor(baseColor, mismatch);
789
- ctx.fillRect(leftPx, topPx, widthPx, heightPx);
824
+ fillRect(ctx, leftPx, topPx, widthPx, heightPx, canvasWidth, !mismatchAlpha ? baseColor : mismatch.qual !== undefined ? (0, _color.default)(baseColor).alpha(Math.min(1, mismatch.qual / 50)).hsl().string() : baseColor);
790
825
 
791
826
  if (widthPx >= charWidth && heightPx >= heightLim) {
792
827
  // normal SNP coloring
793
- var contrast = contrastForBase[mismatch.base] || 'black';
794
- ctx.fillStyle = getAlphaColor(contrast, mismatch);
828
+ var contrastColor = contrastForBase[mismatch.base] || 'black';
829
+ ctx.fillStyle = !mismatchAlpha ? contrastColor : mismatch.qual !== undefined ? (0, _color.default)(contrastColor).alpha(Math.min(1, mismatch.qual / 50)).hsl().string() : contrastColor;
795
830
  ctx.fillText(mbase, leftPx + (widthPx - charWidth) / 2 + 1, topPx + heightPx);
796
831
  }
797
832
  } else if (mismatch.type === 'deletion' && drawIndels) {
798
- var _baseColor = colorForBase.deletion;
799
- ctx.fillStyle = _baseColor;
800
- ctx.fillRect(leftPx, topPx, widthPx, heightPx);
833
+ fillRect(ctx, leftPx, topPx, widthPx, heightPx, canvasWidth, colorForBase.deletion);
801
834
  var txt = "".concat(mismatch.length);
802
835
  var rwidth = (0, _util.measureText)(txt, 10);
803
836
 
@@ -812,24 +845,22 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
812
845
  var insW = Math.max(minSubfeatureWidth / 2, Math.min(1.2, 1 / bpPerPx));
813
846
 
814
847
  if (len < 10) {
815
- ctx.fillRect(pos, topPx, insW, heightPx);
848
+ fillRect(ctx, pos, topPx, insW, heightPx, canvasWidth, 'purple');
816
849
 
817
850
  if (1 / bpPerPx >= charWidth && heightPx >= heightLim) {
818
- ctx.fillRect(pos - insW, topPx, insW * 3, 1);
819
- ctx.fillRect(pos - insW, topPx + heightPx - 1, insW * 3, 1);
851
+ fillRect(ctx, pos - insW, topPx, insW * 3, 1, canvasWidth);
852
+ fillRect(ctx, pos - insW, topPx + heightPx - 1, insW * 3, 1, canvasWidth);
820
853
  ctx.fillText("(".concat(mismatch.base, ")"), pos + 3, topPx + heightPx);
821
854
  }
822
855
  }
823
856
  } else if (mismatch.type === 'hardclip' || mismatch.type === 'softclip') {
824
- ctx.fillStyle = mismatch.type === 'hardclip' ? 'red' : 'blue';
825
-
826
857
  var _pos = leftPx + extraHorizontallyFlippedOffset;
827
858
 
828
- ctx.fillRect(_pos, topPx, w, heightPx);
859
+ fillRect(ctx, _pos, topPx, w, heightPx, canvasWidth, mismatch.type === 'hardclip' ? 'red' : 'blue');
829
860
 
830
861
  if (1 / bpPerPx >= charWidth && heightPx >= heightLim) {
831
- ctx.fillRect(_pos - w, topPx, w * 3, 1);
832
- ctx.fillRect(_pos - w, topPx + heightPx - 1, w * 3, 1);
862
+ fillRect(ctx, _pos - w, topPx, w * 3, 1, canvasWidth);
863
+ fillRect(ctx, _pos - w, topPx + heightPx - 1, w * 3, 1, canvasWidth);
833
864
  ctx.fillText("(".concat(mismatch.base, ")"), _pos + 3, topPx + heightPx);
834
865
  }
835
866
  } else if (mismatch.type === 'skip') {
@@ -840,8 +871,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
840
871
  // make small exons more visible when zoomed far out
841
872
  var adjustPx = widthPx - (bpPerPx > 10 ? 1.5 : 0);
842
873
  ctx.clearRect(leftPx, topPx, adjustPx, heightPx);
843
- ctx.fillStyle = '#333';
844
- ctx.fillRect(Math.max(0, leftPx), topPx + heightPx / 2 - 1, adjustPx + (leftPx < 0 ? leftPx : 0), 2);
874
+ fillRect(ctx, Math.max(0, leftPx), topPx + heightPx / 2 - 1, adjustPx + (leftPx < 0 ? leftPx : 0), 2, canvasWidth, '#333');
845
875
  }
846
876
  }
847
877
  } // second pass, draw wide insertion markers on top
@@ -865,19 +895,17 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
865
895
 
866
896
  if (_mismatch.type === 'insertion' && _len2 >= 10) {
867
897
  if (bpPerPx > largeInsertionIndicatorScale) {
868
- ctx.fillStyle = 'purple';
869
- ctx.fillRect(_leftPx2 - 1, topPx, 2, heightPx);
898
+ fillRect(ctx, _leftPx2 - 1, topPx, 2, heightPx, canvasWidth, 'purple');
870
899
  } else if (heightPx > charHeight) {
871
- var rect = ctx.measureText(_txt);
900
+ var _rwidth = (0, _util.measureText)(_txt);
901
+
872
902
  var padding = 5;
873
- ctx.fillStyle = 'purple';
874
- ctx.fillRect(_leftPx2 - rect.width / 2 - padding, topPx, rect.width + 2 * padding, heightPx);
903
+ fillRect(ctx, _leftPx2 - _rwidth / 2 - padding, topPx, _rwidth + 2 * padding, heightPx, canvasWidth, 'purple');
875
904
  ctx.fillStyle = 'white';
876
- ctx.fillText(_txt, _leftPx2 - rect.width / 2, topPx + heightPx);
905
+ ctx.fillText(_txt, _leftPx2 - _rwidth / 2, topPx + heightPx);
877
906
  } else {
878
907
  var _padding = 2;
879
- ctx.fillStyle = 'purple';
880
- ctx.fillRect(_leftPx2 - _padding, topPx, 2 * _padding, heightPx);
908
+ fillRect(ctx, _leftPx2 - _padding, topPx, 2 * _padding, heightPx, canvasWidth, 'purple');
881
909
  }
882
910
  }
883
911
  }
@@ -885,12 +913,18 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
885
913
  }
886
914
  }, {
887
915
  key: "drawSoftClipping",
888
- value: function drawSoftClipping(ctx, feat, props, config, theme) {
916
+ value: function drawSoftClipping(_ref11) {
917
+ var ctx = _ref11.ctx,
918
+ feat = _ref11.feat,
919
+ renderArgs = _ref11.renderArgs,
920
+ config = _ref11.config,
921
+ theme = _ref11.theme,
922
+ canvasWidth = _ref11.canvasWidth;
889
923
  var feature = feat.feature,
890
924
  topPx = feat.topPx,
891
925
  heightPx = feat.heightPx;
892
- var regions = props.regions,
893
- bpPerPx = props.bpPerPx;
926
+ var regions = renderArgs.regions,
927
+ bpPerPx = renderArgs.bpPerPx;
894
928
 
895
929
  var _regions3 = (0, _slicedToArray2.default)(regions, 1),
896
930
  region = _regions3[0];
@@ -938,7 +972,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
938
972
 
939
973
  var baseColor = colorForBase[base] || '#000000';
940
974
  ctx.fillStyle = baseColor;
941
- ctx.fillRect(softClipLeftPx, topPx, softClipWidthPx, heightPx);
975
+ fillRect(ctx, softClipLeftPx, topPx, softClipWidthPx, heightPx, canvasWidth);
942
976
 
943
977
  if (softClipWidthPx >= charWidth && heightPx >= charHeight - 5) {
944
978
  ctx.fillStyle = theme.palette.getContrastText(baseColor);
@@ -950,93 +984,93 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
950
984
  }
951
985
  }, {
952
986
  key: "makeImageData",
953
- value: function () {
954
- var _makeImageData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(ctx, layoutRecords, props) {
955
- var _this2 = this;
987
+ value: function makeImageData(_ref12) {
988
+ var ctx = _ref12.ctx,
989
+ layoutRecords = _ref12.layoutRecords,
990
+ canvasWidth = _ref12.canvasWidth,
991
+ renderArgs = _ref12.renderArgs;
992
+ var layout = renderArgs.layout,
993
+ config = renderArgs.config,
994
+ showSoftClip = renderArgs.showSoftClip,
995
+ colorBy = renderArgs.colorBy,
996
+ configTheme = renderArgs.theme;
997
+ var mismatchAlpha = (0, _configuration.readConfObject)(config, 'mismatchAlpha');
998
+ var minSubfeatureWidth = (0, _configuration.readConfObject)(config, 'minSubfeatureWidth');
999
+ var largeInsertionIndicatorScale = (0, _configuration.readConfObject)(config, 'largeInsertionIndicatorScale');
1000
+ var defaultColor = (0, _configuration.readConfObject)(config, 'color') === '#f0f';
1001
+ var theme = (0, _ui.createJBrowseTheme)(configTheme);
1002
+ var colorForBase = getColorBaseMap(theme);
1003
+ var contrastForBase = getContrastBaseMap(theme);
1004
+
1005
+ if (!layout) {
1006
+ throw new Error("layout required");
1007
+ }
956
1008
 
957
- var layout, config, showSoftClip, colorBy, configTheme, mismatchAlpha, minSubfeatureWidth, insertScale, defaultColor, theme, colorForBase, contrastForBase, _this$getCharWidthHei2, charWidth, charHeight;
1009
+ if (!layout.addRect) {
1010
+ throw new Error('invalid layout object');
1011
+ }
958
1012
 
959
- return _regenerator.default.wrap(function _callee$(_context) {
960
- while (1) {
961
- switch (_context.prev = _context.next) {
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
- }
1013
+ ctx.font = 'bold 10px Courier New,monospace';
976
1014
 
977
- throw new Error("layout required");
1015
+ var _this$getCharWidthHei2 = this.getCharWidthHeight(ctx),
1016
+ charWidth = _this$getCharWidthHei2.charWidth,
1017
+ charHeight = _this$getCharWidthHei2.charHeight;
978
1018
 
979
- case 10:
980
- if (layout.addRect) {
981
- _context.next = 12;
982
- break;
983
- }
1019
+ var drawSNPs = shouldDrawSNPs(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type);
1020
+ var drawIndels = shouldDrawIndels(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type);
984
1021
 
985
- throw new Error('invalid layout object');
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
- }));
1002
-
1003
- _this2.drawMismatches(ctx, feat, props, {
1004
- mismatchAlpha: mismatchAlpha,
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
- });
1022
+ for (var i = 0; i < layoutRecords.length; i++) {
1023
+ var feat = layoutRecords[i];
1014
1024
 
1015
- if (showSoftClip) {
1016
- _this2.drawSoftClipping(ctx, feat, props, config, theme);
1017
- }
1018
- });
1025
+ if (feat === null) {
1026
+ continue;
1027
+ }
1019
1028
 
1020
- case 15:
1021
- case "end":
1022
- return _context.stop();
1023
- }
1024
- }
1025
- }, _callee, this);
1026
- }));
1029
+ this.drawAlignmentRect({
1030
+ ctx: ctx,
1031
+ feat: feat,
1032
+ renderArgs: renderArgs,
1033
+ defaultColor: defaultColor,
1034
+ colorForBase: colorForBase,
1035
+ contrastForBase: contrastForBase,
1036
+ charWidth: charWidth,
1037
+ charHeight: charHeight,
1038
+ canvasWidth: canvasWidth
1039
+ });
1040
+ this.drawMismatches({
1041
+ ctx: ctx,
1042
+ feat: feat,
1043
+ renderArgs: renderArgs,
1044
+ mismatchAlpha: mismatchAlpha,
1045
+ drawSNPs: drawSNPs,
1046
+ drawIndels: drawIndels,
1047
+ largeInsertionIndicatorScale: largeInsertionIndicatorScale,
1048
+ minSubfeatureWidth: minSubfeatureWidth,
1049
+ charWidth: charWidth,
1050
+ charHeight: charHeight,
1051
+ colorForBase: colorForBase,
1052
+ contrastForBase: contrastForBase,
1053
+ canvasWidth: canvasWidth
1054
+ });
1027
1055
 
1028
- function makeImageData(_x, _x2, _x3) {
1029
- return _makeImageData.apply(this, arguments);
1056
+ if (showSoftClip) {
1057
+ this.drawSoftClipping({
1058
+ ctx: ctx,
1059
+ feat: feat,
1060
+ renderArgs: renderArgs,
1061
+ config: config,
1062
+ theme: theme,
1063
+ canvasWidth: canvasWidth
1064
+ });
1065
+ }
1030
1066
  }
1031
-
1032
- return makeImageData;
1033
- }() // we perform a full layout before render as a separate method because the
1067
+ } // we perform a full layout before render as a separate method because the
1034
1068
  // layout determines the height of the canvas that we use to render
1035
1069
 
1036
1070
  }, {
1037
1071
  key: "layoutFeats",
1038
1072
  value: function layoutFeats(props) {
1039
- var _this3 = this;
1073
+ var _this2 = this;
1040
1074
 
1041
1075
  var layout = props.layout,
1042
1076
  features = props.features,
@@ -1060,8 +1094,8 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
1060
1094
  var featureMap = sortedBy !== null && sortedBy !== void 0 && sortedBy.type && region.start === sortedBy.pos ? (0, _sortUtil.sortFeature)(features, sortedBy) : features;
1061
1095
  var heightPx = (0, _configuration.readConfObject)(config, 'height');
1062
1096
  var displayMode = (0, _configuration.readConfObject)(config, 'displayMode');
1063
- var layoutRecords = (0, _util.iterMap)(featureMap.values(), function (feature) {
1064
- return _this3.layoutFeature({
1097
+ return (0, _util.iterMap)(featureMap.values(), function (feature) {
1098
+ return _this2.layoutFeature({
1065
1099
  feature: feature,
1066
1100
  layout: layout,
1067
1101
  bpPerPx: bpPerPx,
@@ -1071,47 +1105,46 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
1071
1105
  displayMode: displayMode
1072
1106
  });
1073
1107
  }, featureMap.size);
1074
- return layoutRecords;
1075
1108
  }
1076
1109
  }, {
1077
1110
  key: "fetchSequence",
1078
1111
  value: function () {
1079
- var _fetchSequence2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(renderProps) {
1112
+ var _fetchSequence2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(renderProps) {
1080
1113
  var sessionId, regions, adapterConfig, sequenceAdapter, _yield$getAdapter, dataAdapter, _regions5, region;
1081
1114
 
1082
- return _regenerator.default.wrap(function _callee2$(_context2) {
1115
+ return _regenerator.default.wrap(function _callee$(_context) {
1083
1116
  while (1) {
1084
- switch (_context2.prev = _context2.next) {
1117
+ switch (_context.prev = _context.next) {
1085
1118
  case 0:
1086
1119
  sessionId = renderProps.sessionId, regions = renderProps.regions, adapterConfig = renderProps.adapterConfig;
1087
1120
  sequenceAdapter = adapterConfig.sequenceAdapter;
1088
1121
 
1089
1122
  if (sequenceAdapter) {
1090
- _context2.next = 4;
1123
+ _context.next = 4;
1091
1124
  break;
1092
1125
  }
1093
1126
 
1094
- return _context2.abrupt("return", undefined);
1127
+ return _context.abrupt("return", undefined);
1095
1128
 
1096
1129
  case 4:
1097
- _context2.next = 6;
1130
+ _context.next = 6;
1098
1131
  return (0, _dataAdapterCache.getAdapter)(this.pluginManager, sessionId, sequenceAdapter);
1099
1132
 
1100
1133
  case 6:
1101
- _yield$getAdapter = _context2.sent;
1134
+ _yield$getAdapter = _context.sent;
1102
1135
  dataAdapter = _yield$getAdapter.dataAdapter;
1103
1136
  _regions5 = (0, _slicedToArray2.default)(regions, 1), region = _regions5[0];
1104
- return _context2.abrupt("return", (0, _util2.fetchSequence)(region, dataAdapter));
1137
+ return _context.abrupt("return", (0, _util2.fetchSequence)(region, dataAdapter));
1105
1138
 
1106
1139
  case 10:
1107
1140
  case "end":
1108
- return _context2.stop();
1141
+ return _context.stop();
1109
1142
  }
1110
1143
  }
1111
- }, _callee2, this);
1144
+ }, _callee, this);
1112
1145
  }));
1113
1146
 
1114
- function fetchSequence(_x4) {
1147
+ function fetchSequence(_x) {
1115
1148
  return _fetchSequence2.apply(this, arguments);
1116
1149
  }
1117
1150
 
@@ -1120,21 +1153,21 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
1120
1153
  }, {
1121
1154
  key: "render",
1122
1155
  value: function () {
1123
- var _render = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(renderProps) {
1156
+ var _render = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(renderProps) {
1124
1157
  var _renderProps$colorBy,
1125
- _this4 = this;
1158
+ _this3 = this;
1126
1159
 
1127
1160
  var features, layout, regions, bpPerPx, layoutRecords, _regions6, region, regionSequence, end, start, width, height, res, results;
1128
1161
 
1129
- return _regenerator.default.wrap(function _callee3$(_context3) {
1162
+ return _regenerator.default.wrap(function _callee2$(_context2) {
1130
1163
  while (1) {
1131
- switch (_context3.prev = _context3.next) {
1164
+ switch (_context2.prev = _context2.next) {
1132
1165
  case 0:
1133
- _context3.next = 2;
1166
+ _context2.next = 2;
1134
1167
  return this.getFeatures(renderProps);
1135
1168
 
1136
1169
  case 2:
1137
- features = _context3.sent;
1170
+ features = _context2.sent;
1138
1171
  layout = this.createLayoutInWorker(renderProps);
1139
1172
  regions = renderProps.regions, bpPerPx = renderProps.bpPerPx;
1140
1173
  layoutRecords = this.layoutFeats(_objectSpread(_objectSpread({}, renderProps), {}, {
@@ -1145,38 +1178,43 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
1145
1178
  // cases
1146
1179
 
1147
1180
  if (!(features.size && (0, _util2.shouldFetchReferenceSequence)((_renderProps$colorBy = renderProps.colorBy) === null || _renderProps$colorBy === void 0 ? void 0 : _renderProps$colorBy.type))) {
1148
- _context3.next = 13;
1181
+ _context2.next = 13;
1149
1182
  break;
1150
1183
  }
1151
1184
 
1152
- _context3.next = 10;
1185
+ _context2.next = 10;
1153
1186
  return this.fetchSequence(renderProps);
1154
1187
 
1155
1188
  case 10:
1156
- _context3.t0 = _context3.sent;
1157
- _context3.next = 14;
1189
+ _context2.t0 = _context2.sent;
1190
+ _context2.next = 14;
1158
1191
  break;
1159
1192
 
1160
1193
  case 13:
1161
- _context3.t0 = undefined;
1194
+ _context2.t0 = undefined;
1162
1195
 
1163
1196
  case 14:
1164
- regionSequence = _context3.t0;
1197
+ regionSequence = _context2.t0;
1165
1198
  end = region.end, start = region.start;
1166
1199
  width = (end - start) / bpPerPx;
1167
1200
  height = Math.max(layout.getTotalHeight(), 1);
1168
- _context3.next = 20;
1201
+ _context2.next = 20;
1169
1202
  return (0, _offscreenCanvasUtils.renderToAbstractCanvas)(width, height, renderProps, function (ctx) {
1170
- return _this4.makeImageData(ctx, layoutRecords, _objectSpread(_objectSpread({}, renderProps), {}, {
1171
- layout: layout,
1172
- features: features,
1173
- regionSequence: regionSequence
1174
- }));
1203
+ return _this3.makeImageData({
1204
+ ctx: ctx,
1205
+ layoutRecords: layoutRecords,
1206
+ canvasWidth: width,
1207
+ renderArgs: _objectSpread(_objectSpread({}, renderProps), {}, {
1208
+ layout: layout,
1209
+ features: features,
1210
+ regionSequence: regionSequence
1211
+ })
1212
+ });
1175
1213
  });
1176
1214
 
1177
1215
  case 20:
1178
- res = _context3.sent;
1179
- _context3.next = 23;
1216
+ res = _context2.sent;
1217
+ _context2.next = 23;
1180
1218
  return (0, _get2.default)((0, _getPrototypeOf2.default)(PileupRenderer.prototype), "render", this).call(this, _objectSpread(_objectSpread(_objectSpread({}, renderProps), res), {}, {
1181
1219
  features: features,
1182
1220
  layout: layout,
@@ -1185,8 +1223,8 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
1185
1223
  }));
1186
1224
 
1187
1225
  case 23:
1188
- results = _context3.sent;
1189
- return _context3.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, results), res), {}, {
1226
+ results = _context2.sent;
1227
+ return _context2.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, results), res), {}, {
1190
1228
  features: new Map(),
1191
1229
  layout: layout,
1192
1230
  height: height,
@@ -1196,13 +1234,13 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
1196
1234
 
1197
1235
  case 25:
1198
1236
  case "end":
1199
- return _context3.stop();
1237
+ return _context2.stop();
1200
1238
  }
1201
1239
  }
1202
- }, _callee3, this);
1240
+ }, _callee2, this);
1203
1241
  }));
1204
1242
 
1205
- function render(_x5) {
1243
+ function render(_x2) {
1206
1244
  return _render.apply(this, arguments);
1207
1245
  }
1208
1246