@jbrowse/plugin-alignments 1.6.4 → 1.6.7

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 (35) hide show
  1. package/dist/AlignmentsFeatureDetail/index.d.ts +1 -1
  2. package/dist/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -2
  3. package/dist/BamAdapter/configSchema.d.ts +1 -1
  4. package/dist/CramAdapter/configSchema.d.ts +1 -1
  5. package/dist/HtsgetBamAdapter/configSchema.d.ts +1 -1
  6. package/dist/LinearAlignmentsDisplay/models/configSchema.d.ts +1 -1
  7. package/dist/LinearAlignmentsDisplay/models/model.d.ts +1 -1
  8. package/dist/LinearPileupDisplay/configSchema.d.ts +1 -1
  9. package/dist/LinearSNPCoverageDisplay/components/Tooltip.d.ts +1 -1
  10. package/dist/LinearSNPCoverageDisplay/models/configSchema.d.ts +1 -1
  11. package/dist/PileupRenderer/configSchema.d.ts +1 -1
  12. package/dist/SNPCoverageAdapter/configSchema.d.ts +1 -1
  13. package/dist/SNPCoverageRenderer/SNPCoverageRenderer.d.ts +1 -1
  14. package/dist/SNPCoverageRenderer/configSchema.d.ts +1 -1
  15. package/dist/SNPCoverageRenderer/index.d.ts +1 -1
  16. package/dist/plugin-alignments.cjs.development.js +291 -223
  17. package/dist/plugin-alignments.cjs.development.js.map +1 -1
  18. package/dist/plugin-alignments.cjs.production.min.js +1 -1
  19. package/dist/plugin-alignments.cjs.production.min.js.map +1 -1
  20. package/dist/plugin-alignments.esm.js +291 -223
  21. package/dist/plugin-alignments.esm.js.map +1 -1
  22. package/package.json +6 -6
  23. package/src/AlignmentsFeatureDetail/AlignmentsFeatureDetail.tsx +23 -14
  24. package/src/BamAdapter/BamAdapter.ts +3 -4
  25. package/src/BamAdapter/BamSlightlyLazyFeature.ts +8 -4
  26. package/src/LinearAlignmentsDisplay/components/AlignmentsDisplay.tsx +38 -30
  27. package/src/LinearAlignmentsDisplay/models/model.tsx +10 -9
  28. package/src/LinearPileupDisplay/model.ts +6 -6
  29. package/src/LinearSNPCoverageDisplay/components/Tooltip.tsx +5 -3
  30. package/src/LinearSNPCoverageDisplay/models/configSchema.ts +4 -5
  31. package/src/PileupRenderer/PileupRenderer.tsx +39 -27
  32. package/src/PileupRenderer/components/PileupRendering.tsx +5 -3
  33. package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +188 -169
  34. package/src/SNPCoverageRenderer/SNPCoverageRenderer.ts +86 -56
  35. package/src/SNPCoverageRenderer/configSchema.js +1 -1
@@ -29,6 +29,7 @@ var DisplayType = _interopDefault(require('@jbrowse/core/pluggableElementTypes/D
29
29
  var pluginLinearGenomeView = require('@jbrowse/plugin-linear-genome-view');
30
30
  var models = require('@jbrowse/core/pluggableElementTypes/models');
31
31
  var mobx = require('mobx');
32
+ var core = require('@material-ui/core');
32
33
  var SerializableFilterChain = _interopDefault(require('@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'));
33
34
  var tracks = require('@jbrowse/core/util/tracks');
34
35
  var VisibilityIcon = _interopDefault(require('@material-ui/icons/Visibility'));
@@ -46,7 +47,6 @@ var RpcMethodType = _interopDefault(require('@jbrowse/core/pluggableElementTypes
46
47
  var cram = require('@gmod/cram');
47
48
  var io = require('@jbrowse/core/util/io');
48
49
  var bam = require('@gmod/bam');
49
- var core = require('@material-ui/core');
50
50
  var CloseIcon = _interopDefault(require('@material-ui/icons/Close'));
51
51
  var BaseFeatureDetail = require('@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail');
52
52
 
@@ -1949,18 +1949,16 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
1949
1949
  bins = _yield$_this$generate.bins;
1950
1950
  skipmap = _yield$_this$generate.skipmap;
1951
1951
  bins.forEach(function (bin, index) {
1952
- if (bin.total) {
1953
- observer.next(new SimpleFeature({
1954
- id: "".concat(_this.id, "-").concat(region.start, "-").concat(index),
1955
- data: {
1956
- score: bin.total,
1957
- snpinfo: bin,
1958
- start: region.start + index,
1959
- end: region.start + index + 1,
1960
- refName: region.refName
1961
- }
1962
- }));
1963
- }
1952
+ observer.next(new SimpleFeature({
1953
+ id: "".concat(_this.id, "-").concat(region.start, "-").concat(index),
1954
+ data: {
1955
+ score: bin.total,
1956
+ snpinfo: bin,
1957
+ start: region.start + index,
1958
+ end: region.start + index + 1,
1959
+ refName: region.refName
1960
+ }
1961
+ }));
1964
1962
  }); // make fake features from the coverage
1965
1963
 
1966
1964
  Object.entries(skipmap).forEach(function (_ref2) {
@@ -2081,7 +2079,7 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2081
2079
  key: "generateCoverageBins",
2082
2080
  value: function () {
2083
2081
  var _generateCoverageBins = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(features, region, opts) {
2084
- var colorBy, _yield$this$configure3, sequenceAdapter, originalRefName, refName, start, end, binMax, skipmap, initBins, regionSeq, _yield$sequenceAdapte, _yield$sequenceAdapte2, feat, bins;
2082
+ var colorBy, _yield$this$configure3, sequenceAdapter, originalRefName, refName, start, end, binMax, skipmap, regionSeq, _yield$sequenceAdapte, _yield$sequenceAdapte2, feat, bins;
2085
2083
 
2086
2084
  return runtime_1.wrap(function _callee5$(_context5) {
2087
2085
  while (1) {
@@ -2096,41 +2094,29 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2096
2094
  sequenceAdapter = _yield$this$configure3.sequenceAdapter;
2097
2095
  originalRefName = region.originalRefName, refName = region.refName, start = region.start, end = region.end;
2098
2096
  binMax = Math.ceil(region.end - region.start);
2099
- skipmap = {};
2100
- initBins = Array.from({
2101
- length: binMax
2102
- }, function () {
2103
- return {
2104
- total: 0,
2105
- lowqual: {},
2106
- cov: {},
2107
- delskips: {},
2108
- noncov: {},
2109
- ref: {}
2110
- };
2111
- }); // request an extra +1 on the end to get CpG crossing region boundary
2097
+ skipmap = {}; // request an extra +1 on the end to get CpG crossing region boundary
2112
2098
 
2113
2099
  if (!sequenceAdapter) {
2114
- _context5.next = 16;
2100
+ _context5.next = 15;
2115
2101
  break;
2116
2102
  }
2117
2103
 
2118
- _context5.next = 12;
2104
+ _context5.next = 11;
2119
2105
  return sequenceAdapter.getFeatures({
2120
2106
  refName: originalRefName || refName,
2121
2107
  start: start,
2122
2108
  end: end + 1,
2123
- assemblyName: 'na'
2109
+ assemblyName: region.assemblyName
2124
2110
  }).pipe(operators.toArray()).toPromise();
2125
2111
 
2126
- case 12:
2112
+ case 11:
2127
2113
  _yield$sequenceAdapte = _context5.sent;
2128
2114
  _yield$sequenceAdapte2 = _slicedToArray(_yield$sequenceAdapte, 1);
2129
2115
  feat = _yield$sequenceAdapte2[0];
2130
2116
  regionSeq = feat === null || feat === void 0 ? void 0 : feat.get('seq');
2131
2117
 
2132
- case 16:
2133
- _context5.next = 18;
2118
+ case 15:
2119
+ _context5.next = 17;
2134
2120
  return features.pipe(operators.reduce(function (bins, feature) {
2135
2121
  var cigar = feature.get('CIGAR');
2136
2122
  var fstart = feature.get('start');
@@ -2138,13 +2124,25 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2138
2124
  var fstrand = feature.get('strand');
2139
2125
  var cigarOps = parseCigar(cigar);
2140
2126
 
2141
- for (var j = fstart; j < fend; j++) {
2127
+ for (var j = fstart; j < fend + 1; j++) {
2142
2128
  var i = j - region.start;
2143
2129
 
2144
- if (i >= 0 && i < bins.length) {
2145
- var bin = bins[i];
2146
- bin.total++;
2147
- inc(bin, fstrand, 'ref', 'ref');
2130
+ if (i >= 0 && i < binMax) {
2131
+ var bin = bins[i] || {
2132
+ total: 0,
2133
+ lowqual: {},
2134
+ cov: {},
2135
+ delskips: {},
2136
+ noncov: {},
2137
+ ref: {}
2138
+ };
2139
+
2140
+ if (j !== fend) {
2141
+ bin.total++;
2142
+ inc(bin, fstrand, 'ref', 'ref');
2143
+ }
2144
+
2145
+ bins[i] = bin;
2148
2146
  }
2149
2147
  }
2150
2148
 
@@ -2176,7 +2174,14 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2176
2174
  var epos = pos + fstart - region.start;
2177
2175
 
2178
2176
  if (epos >= 0 && epos < bins.length && pos + fstart < fend) {
2179
- var _bin = bins[epos];
2177
+ var _bin = bins[epos] || {
2178
+ total: 0,
2179
+ lowqual: {},
2180
+ cov: {},
2181
+ delskips: {},
2182
+ noncov: {},
2183
+ ref: {}
2184
+ };
2180
2185
 
2181
2186
  if (probabilities[probIndex] > 0.5) {
2182
2187
  inc(_bin, fstrand, 'cov', mod);
@@ -2265,9 +2270,9 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2265
2270
  if (mismatches) {
2266
2271
  for (var _i2 = 0; _i2 < mismatches.length; _i2++) {
2267
2272
  var mismatch = mismatches[_i2];
2268
- var mstart = fstart + mismatch.start;
2273
+ var ms = fstart + mismatch.start;
2269
2274
 
2270
- for (var _j2 = mstart; _j2 < mstart + mismatchLen(mismatch); _j2++) {
2275
+ for (var _j2 = ms; _j2 < ms + mismatchLen(mismatch); _j2++) {
2271
2276
  var epos = _j2 - region.start;
2272
2277
 
2273
2278
  if (epos >= 0 && epos < bins.length) {
@@ -2307,7 +2312,7 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2307
2312
  start: start,
2308
2313
  end: end,
2309
2314
  strand: strand,
2310
- xs: feature.get('xs') || feature.get('ts') || feature.get('tags').XS || feature.get('tags').TS,
2315
+ xs: getTag(feature, 'XS') || getTag(feature, 'TS'),
2311
2316
  score: 1
2312
2317
  };
2313
2318
  } else {
@@ -2318,16 +2323,16 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2318
2323
  }
2319
2324
 
2320
2325
  return bins;
2321
- }, initBins)).toPromise();
2326
+ }, [])).toPromise();
2322
2327
 
2323
- case 18:
2328
+ case 17:
2324
2329
  bins = _context5.sent;
2325
2330
  return _context5.abrupt("return", {
2326
2331
  bins: bins,
2327
2332
  skipmap: skipmap
2328
2333
  });
2329
2334
 
2330
- case 20:
2335
+ case 19:
2331
2336
  case "end":
2332
2337
  return _context5.stop();
2333
2338
  }
@@ -2383,7 +2388,7 @@ var ConfigSchema = /*#__PURE__*/configuration.ConfigurationSchema('SNPCoverageRe
2383
2388
  indicatorThreshold: {
2384
2389
  type: 'number',
2385
2390
  description: 'the proportion of reads containing a insertion/clip indicator',
2386
- defaultValue: 0.3
2391
+ defaultValue: 0.4
2387
2392
  },
2388
2393
  drawArcs: {
2389
2394
  type: 'boolean',
@@ -2424,12 +2429,13 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2424
2429
  regions = props.regions,
2425
2430
  bpPerPx = props.bpPerPx,
2426
2431
  displayCrossHatches = props.displayCrossHatches,
2427
- modificationTagMap = props.modificationTagMap,
2432
+ _props$modificationTa = props.modificationTagMap,
2433
+ modificationTagMap = _props$modificationTa === void 0 ? {} : _props$modificationTa,
2428
2434
  scaleOpts = props.scaleOpts,
2429
2435
  unadjustedHeight = props.height,
2430
2436
  configTheme = props.theme,
2431
2437
  cfg = props.config,
2432
- values = props.ticks.values;
2438
+ ticks = props.ticks;
2433
2439
  var theme = ui.createJBrowseTheme(configTheme);
2434
2440
 
2435
2441
  var _regions = _slicedToArray(regions, 1),
@@ -2441,6 +2447,11 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2441
2447
 
2442
2448
  var offset = pluginWiggle.YSCALEBAR_LABEL_OFFSET;
2443
2449
  var height = unadjustedHeight - offset * 2;
2450
+ var domain = scaleOpts.domain;
2451
+
2452
+ if (!domain) {
2453
+ return;
2454
+ }
2444
2455
 
2445
2456
  var opts = _objectSpread2(_objectSpread2({}, scaleOpts), {}, {
2446
2457
  range: [0, height]
@@ -2448,6 +2459,12 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2448
2459
 
2449
2460
  var viewScale = pluginWiggle.getScale(opts);
2450
2461
  var snpViewScale = pluginWiggle.getScale(_objectSpread2(_objectSpread2({}, opts), {}, {
2462
+ range: [0, height],
2463
+ scaleType: 'linear'
2464
+ })); // clipping and insertion indicators, uses a smaller height/2 scale
2465
+
2466
+ var indicatorViewScale = pluginWiggle.getScale(_objectSpread2(_objectSpread2({}, opts), {}, {
2467
+ range: [0, height / 2],
2451
2468
  scaleType: 'linear'
2452
2469
  }));
2453
2470
  var originY = pluginWiggle.getOrigin(scaleOpts.scaleType);
@@ -2470,10 +2487,18 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2470
2487
  return height - (snpViewScale(n) || 0) + offset;
2471
2488
  };
2472
2489
 
2490
+ var indicatorToY = function indicatorToY(n) {
2491
+ return height - (indicatorViewScale(n) || 0) + offset;
2492
+ };
2493
+
2473
2494
  var snpToHeight = function snpToHeight(n) {
2474
2495
  return snpToY(snpOriginY) - snpToY(n);
2475
2496
  };
2476
2497
 
2498
+ var indicatorToHeight = function indicatorToHeight(n) {
2499
+ return indicatorToY(snpOriginY) - indicatorToY(n);
2500
+ };
2501
+
2477
2502
  var colorForBase = {
2478
2503
  A: theme.palette.bases.A.main,
2479
2504
  C: theme.palette.bases.C.main,
@@ -2499,7 +2524,10 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2499
2524
  // bpPerPx First pass: draw the gray background
2500
2525
 
2501
2526
  ctx.fillStyle = colorForBase.total;
2502
- coverage.forEach(function (feature) {
2527
+
2528
+ for (var i = 0; i < coverage.length; i++) {
2529
+ var feature = coverage[i];
2530
+
2503
2531
  var _featureSpanPx = util.featureSpanPx(feature, region, bpPerPx),
2504
2532
  _featureSpanPx2 = _slicedToArray(_featureSpanPx, 2),
2505
2533
  leftPx = _featureSpanPx2[0],
@@ -2508,96 +2536,97 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2508
2536
  var w = rightPx - leftPx + 0.3;
2509
2537
  var score = feature.get('score');
2510
2538
  ctx.fillRect(leftPx, toY(score), w, toHeight(score));
2511
- });
2512
- ctx.fillStyle = 'grey';
2513
- ctx.beginPath();
2514
- ctx.lineTo(0, 0);
2515
- ctx.moveTo(0, width);
2516
- ctx.stroke(); // Second pass: draw the SNP data, and add a minimum feature width of 1px
2539
+ } // Keep track of previous total which we will use it to draw the interbase
2540
+ // indicator (if there is a sudden clip, there will be no read coverage but
2541
+ // there will be "clip" coverage) at that position beyond the read. if the
2542
+ // clip is right at a block boundary then prevTotal will not be available,
2543
+ // so this is a best attempt to plot interbase indicator at the "cliffs"
2544
+
2545
+
2546
+ var prevTotal = 0; // extraHorizontallyFlippedOffset is used to draw interbase items, which
2547
+ // are located to the left when forward and right when reversed
2548
+
2549
+ var extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx : 0; // Second pass: draw the SNP data, and add a minimum feature width of 1px
2517
2550
  // which can be wider than the actual bpPerPx This reduces overdrawing of
2518
2551
  // the grey background over the SNPs
2519
2552
 
2520
- coverage.forEach(function (feature) {
2521
- var _featureSpanPx3 = util.featureSpanPx(feature, region, bpPerPx),
2522
- _featureSpanPx4 = _slicedToArray(_featureSpanPx3, 2),
2523
- leftPx = _featureSpanPx4[0],
2524
- rightPx = _featureSpanPx4[1];
2553
+ for (var _i = 0; _i < coverage.length; _i++) {
2554
+ var _feature = coverage[_i];
2525
2555
 
2526
- var snpinfo = feature.get('snpinfo');
2527
- var w = Math.max(rightPx - leftPx + 0.3, 1);
2528
- var totalScore = snpinfo.total;
2529
- Object.entries(snpinfo.cov).sort(function (_ref, _ref2) {
2530
- var _ref3 = _slicedToArray(_ref, 1),
2531
- a = _ref3[0];
2556
+ var _featureSpanPx3 = util.featureSpanPx(_feature, region, bpPerPx),
2557
+ _featureSpanPx4 = _slicedToArray(_featureSpanPx3, 2),
2558
+ _leftPx = _featureSpanPx4[0],
2559
+ _rightPx = _featureSpanPx4[1];
2532
2560
 
2533
- var _ref4 = _slicedToArray(_ref2, 1),
2534
- b = _ref4[0];
2561
+ var snpinfo = _feature.get('snpinfo');
2535
2562
 
2536
- if (a < b) {
2537
- return -1;
2538
- }
2563
+ var _w = Math.max(_rightPx - _leftPx + 0.3, 1);
2539
2564
 
2540
- if (a > b) {
2541
- return 1;
2542
- }
2565
+ var totalScore = snpinfo.total;
2566
+ var keys = Object.keys(snpinfo.cov).sort();
2567
+ var curr = 0;
2568
+
2569
+ for (var _i2 = 0; _i2 < keys.length; _i2++) {
2570
+ var base = keys[_i2];
2571
+ var total = snpinfo.cov[base].total;
2572
+ ctx.fillStyle = colorForBase[base] || modificationTagMap[base.replace('mod_', '')] || '#888';
2573
+ ctx.fillRect(_leftPx, snpToY(total + curr), _w, snpToHeight(total));
2574
+ curr += total;
2575
+ }
2543
2576
 
2544
- return 0;
2545
- }).reduce(function (curr, _ref5) {
2546
- var _ref6 = _slicedToArray(_ref5, 2),
2547
- base = _ref6[0],
2548
- total = _ref6[1].total;
2549
-
2550
- ctx.fillStyle = colorForBase[base] || modificationTagMap[base.replace('mod_', '')] || 'red';
2551
- ctx.fillRect(leftPx, snpToY(total + curr), w, snpToHeight(total));
2552
- return curr + total;
2553
- }, 0);
2554
- var interbaseEvents = Object.entries(snpinfo.noncov);
2577
+ var interbaseEvents = Object.keys(snpinfo.noncov);
2555
2578
  var indicatorHeight = 4.5;
2556
2579
 
2557
2580
  if (drawInterbaseCounts) {
2558
- interbaseEvents.reduce(function (curr, _ref7) {
2559
- var _ref8 = _slicedToArray(_ref7, 2),
2560
- base = _ref8[0],
2561
- total = _ref8[1].total;
2562
-
2563
- ctx.fillStyle = colorForBase[base];
2564
- ctx.fillRect(leftPx - 0.6, indicatorHeight + snpToHeight(curr), 1.2, snpToHeight(total));
2565
- return curr + total;
2566
- }, 0);
2581
+ var _curr = 0;
2582
+
2583
+ for (var _i3 = 0; _i3 < interbaseEvents.length; _i3++) {
2584
+ var _base = interbaseEvents[_i3];
2585
+ var _total = snpinfo.noncov[_base].total;
2586
+ ctx.fillStyle = colorForBase[_base];
2587
+ ctx.fillRect(_leftPx - 0.6 + extraHorizontallyFlippedOffset, indicatorHeight + indicatorToHeight(_curr), 1.2, indicatorToHeight(_total));
2588
+ _curr += _total;
2589
+ }
2567
2590
  }
2568
2591
 
2569
2592
  if (drawIndicators) {
2570
2593
  var accum = 0;
2571
2594
  var max = 0;
2572
2595
  var maxBase = '';
2573
- interbaseEvents.forEach(function (_ref9) {
2574
- var _ref10 = _slicedToArray(_ref9, 2),
2575
- base = _ref10[0],
2576
- total = _ref10[1].total;
2577
2596
 
2578
- accum += total;
2597
+ for (var _i4 = 0; _i4 < interbaseEvents.length; _i4++) {
2598
+ var _base2 = interbaseEvents[_i4];
2599
+ var _total2 = snpinfo.noncov[_base2].total;
2600
+ accum += _total2;
2579
2601
 
2580
- if (total > max) {
2581
- max = total;
2582
- maxBase = base;
2602
+ if (_total2 > max) {
2603
+ max = _total2;
2604
+ maxBase = _base2;
2583
2605
  }
2584
- }); // avoid drawing a bunch of indicators if coverage is very low e.g.
2585
- // less than 7
2606
+ } // avoid drawing a bunch of indicators if coverage is very low e.g.
2607
+ // less than 7, uses the prev total in the case of the "cliff"
2586
2608
 
2587
- if (accum > totalScore * indicatorThreshold && totalScore > 7) {
2609
+
2610
+ var indicatorComparatorScore = Math.max(totalScore, prevTotal);
2611
+
2612
+ if (accum > indicatorComparatorScore * indicatorThreshold && indicatorComparatorScore > 7) {
2588
2613
  ctx.fillStyle = colorForBase[maxBase];
2589
2614
  ctx.beginPath();
2590
- ctx.moveTo(leftPx - 3, 0);
2591
- ctx.lineTo(leftPx + 3, 0);
2592
- ctx.lineTo(leftPx, indicatorHeight);
2615
+ var l = _leftPx + extraHorizontallyFlippedOffset;
2616
+ ctx.moveTo(l - 3.5, 0);
2617
+ ctx.lineTo(l + 3.5, 0);
2618
+ ctx.lineTo(l, indicatorHeight);
2593
2619
  ctx.fill();
2594
2620
  }
2595
2621
  }
2596
- });
2597
- ctx.globalAlpha = 0.7;
2622
+
2623
+ prevTotal = totalScore;
2624
+ }
2598
2625
 
2599
2626
  if (drawArcs) {
2600
- skips.forEach(function (f) {
2627
+ for (var _i5 = 0; _i5 < skips.length; _i5++) {
2628
+ var f = skips[_i5];
2629
+
2601
2630
  var _bpSpanPx = util.bpSpanPx(f.get('start'), f.get('end'), region, bpPerPx),
2602
2631
  _bpSpanPx2 = _slicedToArray(_bpSpanPx, 2),
2603
2632
  left = _bpSpanPx2[0],
@@ -2606,9 +2635,9 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2606
2635
  ctx.beginPath();
2607
2636
  var str = f.get('strand');
2608
2637
  var xs = f.get('xs');
2609
- var pos = 'rgb(255,200,200)';
2610
- var neg = 'rgb(200,200,255)';
2611
- var neutral = 'rgb(200,200,200)';
2638
+ var pos = 'rgba(255,200,200,0.7)';
2639
+ var neg = 'rgba(200,200,255,0.7)';
2640
+ var neutral = 'rgba(200,200,200,0.7)';
2612
2641
 
2613
2642
  if (xs === '+') {
2614
2643
  ctx.strokeStyle = pos;
@@ -2626,13 +2655,13 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2626
2655
  ctx.moveTo(left, height - offset * 2);
2627
2656
  ctx.bezierCurveTo(left, 0, right, 0, right, height - offset * 2);
2628
2657
  ctx.stroke();
2629
- });
2658
+ }
2630
2659
  }
2631
2660
 
2632
2661
  if (displayCrossHatches) {
2633
2662
  ctx.lineWidth = 1;
2634
2663
  ctx.strokeStyle = 'rgba(140,140,140,0.8)';
2635
- values.forEach(function (tick) {
2664
+ ticks.values.forEach(function (tick) {
2636
2665
  ctx.beginPath();
2637
2666
  ctx.moveTo(0, Math.round(toY(tick)));
2638
2667
  ctx.lineTo(width, Math.round(toY(tick)));
@@ -3069,9 +3098,11 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3069
3098
  var modifications = getModificationPositions(mm, seq, strand); // probIndex applies across multiple modifications e.g.
3070
3099
 
3071
3100
  var probIndex = 0;
3072
- modifications.forEach(function (_ref2) {
3073
- var type = _ref2.type,
3074
- positions = _ref2.positions;
3101
+
3102
+ for (var i = 0; i < modifications.length; i++) {
3103
+ var _modifications$i = modifications[i],
3104
+ type = _modifications$i.type,
3105
+ positions = _modifications$i.positions;
3075
3106
  var col = modificationTagMap[type] || 'black';
3076
3107
  var base = Color(col);
3077
3108
 
@@ -3101,7 +3132,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3101
3132
  } finally {
3102
3133
  _iterator.f();
3103
3134
  }
3104
- });
3135
+ }
3105
3136
  } // Color by methylation is slightly modified version of color by
3106
3137
  // modifications
3107
3138
  //
@@ -3128,9 +3159,12 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3128
3159
  var rstart = region.start,
3129
3160
  rend = region.end;
3130
3161
  var methBins = new Array(rend - rstart).fill(0);
3131
- getModificationPositions(mm, seq, strand).forEach(function (_ref3) {
3132
- var type = _ref3.type,
3133
- positions = _ref3.positions;
3162
+ var modifications = getModificationPositions(mm, seq, strand);
3163
+
3164
+ for (var i = 0; i < modifications.length; i++) {
3165
+ var _modifications$i2 = modifications[i],
3166
+ type = _modifications$i2.type,
3167
+ positions = _modifications$i2.positions;
3134
3168
 
3135
3169
  if (type === 'm' && positions) {
3136
3170
  var _iterator2 = _createForOfIteratorHelper(getNextRefPos(cigarOps, positions)),
@@ -3151,25 +3185,27 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3151
3185
  _iterator2.f();
3152
3186
  }
3153
3187
  }
3154
- });
3188
+ }
3155
3189
 
3156
3190
  for (var j = fstart; j < fend; j++) {
3157
- var i = j - rstart;
3191
+ var _i = j - rstart;
3192
+
3193
+ if (_i >= 0 && _i < methBins.length) {
3194
+ var l1 = regionSequence[_i].toLowerCase();
3195
+
3196
+ var l2 = regionSequence[_i + 1].toLowerCase(); // if we are zoomed out, display just a block over the cpg
3158
3197
 
3159
- if (i >= 0 && i < methBins.length) {
3160
- var l1 = regionSequence[i].toLowerCase();
3161
- var l2 = regionSequence[i + 1].toLowerCase(); // if we are zoomed out, display just a block over the cpg
3162
3198
 
3163
3199
  if (bpPerPx > 2) {
3164
3200
  if (l1 === 'c' && l2 === 'g') {
3165
- var s = rstart + i;
3201
+ var s = rstart + _i;
3166
3202
 
3167
3203
  var _bpSpanPx7 = util.bpSpanPx(s, s + 2, region, bpPerPx),
3168
3204
  _bpSpanPx8 = _slicedToArray(_bpSpanPx7, 2),
3169
3205
  leftPx = _bpSpanPx8[0],
3170
3206
  rightPx = _bpSpanPx8[1];
3171
3207
 
3172
- if (methBins[i] || methBins[i + 1]) {
3208
+ if (methBins[_i] || methBins[_i + 1]) {
3173
3209
  ctx.fillStyle = 'red';
3174
3210
  } else {
3175
3211
  ctx.fillStyle = 'blue';
@@ -3181,14 +3217,14 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3181
3217
  else {
3182
3218
  // color
3183
3219
  if (l1 === 'c' && l2 === 'g') {
3184
- var _s = rstart + i;
3220
+ var _s = rstart + _i;
3185
3221
 
3186
3222
  var _bpSpanPx9 = util.bpSpanPx(_s, _s + 1, region, bpPerPx),
3187
3223
  _bpSpanPx10 = _slicedToArray(_bpSpanPx9, 2),
3188
3224
  _leftPx = _bpSpanPx10[0],
3189
3225
  _rightPx = _bpSpanPx10[1];
3190
3226
 
3191
- if (methBins[i]) {
3227
+ if (methBins[_i]) {
3192
3228
  ctx.fillStyle = 'red';
3193
3229
  } else {
3194
3230
  ctx.fillStyle = 'blue';
@@ -3201,7 +3237,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3201
3237
  leftPx2 = _bpSpanPx12[0],
3202
3238
  rightPx2 = _bpSpanPx12[1];
3203
3239
 
3204
- if (methBins[i + 1]) {
3240
+ if (methBins[_i + 1]) {
3205
3241
  ctx.fillStyle = 'red';
3206
3242
  } else {
3207
3243
  ctx.fillStyle = 'blue';
@@ -3268,11 +3304,11 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3268
3304
  _props$colorTagMap = props.colorTagMap,
3269
3305
  colorTagMap = _props$colorTagMap === void 0 ? {} : _props$colorTagMap;
3270
3306
 
3271
- var _ref4 = colorBy || {},
3272
- _ref4$tag = _ref4.tag,
3273
- tag = _ref4$tag === void 0 ? '' : _ref4$tag,
3274
- _ref4$type = _ref4.type,
3275
- colorType = _ref4$type === void 0 ? '' : _ref4$type;
3307
+ var _ref2 = colorBy || {},
3308
+ _ref2$tag = _ref2.tag,
3309
+ tag = _ref2$tag === void 0 ? '' : _ref2$tag,
3310
+ _ref2$type = _ref2.type,
3311
+ colorType = _ref2$type === void 0 ? '' : _ref2$type;
3276
3312
 
3277
3313
  var feature = feat.feature;
3278
3314
  var region = regions[0]; // first pass for simple color changes that change the color of the
@@ -3399,9 +3435,12 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3399
3435
  }
3400
3436
 
3401
3437
  return color;
3402
- } // two pass rendering: first pass, draw all the mismatches except wide
3403
- // insertion markers
3438
+ } // extraHorizontallyFlippedOffset is used to draw interbase items, which
3439
+ // are located to the left when forward and right when reversed
3440
+
3404
3441
 
3442
+ var extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx + 1 : -1; // two pass rendering: first pass, draw all the mismatches except wide
3443
+ // insertion markers
3405
3444
 
3406
3445
  for (var i = 0; i < mismatches.length; i += 1) {
3407
3446
  var mismatch = mismatches[i];
@@ -3439,51 +3478,55 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3439
3478
  }
3440
3479
  } else if (mismatch.type === 'insertion' && drawIndels) {
3441
3480
  ctx.fillStyle = 'purple';
3442
- var pos = leftPx - 1;
3481
+ var pos = leftPx + extraHorizontallyFlippedOffset;
3443
3482
  var len = +mismatch.base || mismatch.length;
3483
+ var insW = Math.max(minWidth, Math.min(1.2, 1 / bpPerPx));
3444
3484
 
3445
3485
  if (len < 10) {
3446
- ctx.fillRect(pos, topPx, w, heightPx);
3486
+ ctx.fillRect(pos, topPx, insW, heightPx);
3447
3487
 
3448
3488
  if (1 / bpPerPx >= charWidth) {
3449
- ctx.fillRect(pos - w, topPx, w * 3, 1);
3450
- ctx.fillRect(pos - w, topPx + heightPx - 1, w * 3, 1);
3489
+ ctx.fillRect(pos - insW, topPx, insW * 3, 1);
3490
+ ctx.fillRect(pos - insW, topPx + heightPx - 1, insW * 3, 1);
3451
3491
  }
3452
3492
 
3453
3493
  if (1 / bpPerPx >= charWidth && heightPx >= heightLim) {
3454
- ctx.fillText("(".concat(mismatch.base, ")"), leftPx + 2, topPx + heightPx);
3494
+ ctx.fillText("(".concat(mismatch.base, ")"), pos + 3, topPx + heightPx);
3455
3495
  }
3456
3496
  }
3457
3497
  } else if (mismatch.type === 'hardclip' || mismatch.type === 'softclip') {
3458
3498
  ctx.fillStyle = mismatch.type === 'hardclip' ? 'red' : 'blue';
3459
3499
 
3460
- var _pos = leftPx - 1;
3500
+ var _pos = leftPx + extraHorizontallyFlippedOffset;
3501
+
3502
+ ctx.fillRect(_pos, topPx, w, heightPx);
3461
3503
 
3462
- ctx.fillRect(_pos, topPx + 1, w, heightPx - 2);
3463
- ctx.fillRect(_pos - w, topPx, w * 3, 1);
3464
- ctx.fillRect(_pos - w, topPx + heightPx - 1, w * 3, 1);
3504
+ if (1 / bpPerPx >= charWidth) {
3505
+ ctx.fillRect(_pos - w, topPx, w * 3, 1);
3506
+ ctx.fillRect(_pos - w, topPx + heightPx - 1, w * 3, 1);
3507
+ }
3465
3508
 
3466
3509
  if (widthPx >= charWidth && heightPx >= heightLim) {
3467
- ctx.fillText("(".concat(mismatch.base, ")"), leftPx + 2, topPx + heightPx);
3510
+ ctx.fillText("(".concat(mismatch.base, ")"), _pos + 3, topPx + heightPx);
3468
3511
  }
3469
3512
  } else if (mismatch.type === 'skip') {
3470
- // fix to avoid bad rendering
3471
- // note that this was also related to chrome bug https://bugs.chromium.org/p/chro>
3472
- // ref #1236
3513
+ // fix to avoid bad rendering note that this was also related to chrome
3514
+ // bug https://bugs.chromium.org/p/chromium/issues/detail?id=1131528
3515
+ // also affected firefox ref #1236 #2750
3473
3516
  if (leftPx + widthPx > 0) {
3474
3517
  // make small exons more visible when zoomed far out
3475
- ctx.clearRect(leftPx, topPx, widthPx - (bpPerPx > 10 ? 1.5 : 0), heightPx);
3518
+ var adjustPx = widthPx - (bpPerPx > 10 ? 1.5 : 0);
3519
+ ctx.clearRect(leftPx, topPx, adjustPx, heightPx);
3520
+ ctx.fillStyle = '#333';
3521
+ ctx.fillRect(Math.max(0, leftPx), topPx + heightPx / 2 - 1, adjustPx + (leftPx < 0 ? leftPx : 0), 2);
3476
3522
  }
3477
-
3478
- ctx.fillStyle = '#333';
3479
- ctx.fillRect(leftPx, topPx + heightPx / 2, widthPx, 2);
3480
3523
  }
3481
3524
  } // second pass, draw wide insertion markers on top
3482
3525
 
3483
3526
 
3484
3527
  if (drawIndels) {
3485
- for (var _i = 0; _i < mismatches.length; _i += 1) {
3486
- var _mismatch = mismatches[_i];
3528
+ for (var _i2 = 0; _i2 < mismatches.length; _i2 += 1) {
3529
+ var _mismatch = mismatches[_i2];
3487
3530
 
3488
3531
  var _mstart = start + _mismatch.start;
3489
3532
 
@@ -3551,7 +3594,8 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3551
3594
  return mismatch.type === 'softclip';
3552
3595
  }).forEach(function (mismatch) {
3553
3596
  var softClipLength = mismatch.cliplen || 0;
3554
- var softClipStart = mismatch.start === 0 ? feature.get('start') - softClipLength : feature.get('start') + mismatch.start;
3597
+ var s = feature.get('start');
3598
+ var softClipStart = mismatch.start === 0 ? s - softClipLength : s + mismatch.start;
3555
3599
 
3556
3600
  for (var k = 0; k < softClipLength; k += 1) {
3557
3601
  var base = seq.charAt(k + mismatch.start); // If softclip length+start is longer than sequence, no need to
@@ -3947,10 +3991,15 @@ function PileupRendering(props) {
3947
3991
 
3948
3992
  var offsetX = 0;
3949
3993
  var offsetY = 0;
3994
+ var canvas = highlightOverlayCanvas.current;
3995
+
3996
+ if (canvas) {
3997
+ var _canvas$getBoundingCl = canvas.getBoundingClientRect(),
3998
+ left = _canvas$getBoundingCl.left,
3999
+ top = _canvas$getBoundingCl.top;
3950
4000
 
3951
- if (highlightOverlayCanvas.current) {
3952
- offsetX = highlightOverlayCanvas.current.getBoundingClientRect().left;
3953
- offsetY = highlightOverlayCanvas.current.getBoundingClientRect().top;
4001
+ offsetX = left;
4002
+ offsetY = top;
3954
4003
  }
3955
4004
 
3956
4005
  offsetX = event.clientX - offsetX;
@@ -4334,45 +4383,51 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
4334
4383
  });
4335
4384
  };
4336
4385
 
4386
+ var useStyles = /*#__PURE__*/core.makeStyles(function () {
4387
+ return {
4388
+ resizeHandle: {
4389
+ height: 2,
4390
+ position: 'absolute',
4391
+ zIndex: 2
4392
+ }
4393
+ };
4394
+ });
4395
+
4337
4396
  function AlignmentsDisplay(_ref) {
4338
4397
  var model = _ref.model;
4339
4398
  var PileupDisplay = model.PileupDisplay,
4340
4399
  SNPCoverageDisplay = model.SNPCoverageDisplay,
4341
4400
  showPileup = model.showPileup,
4342
4401
  showCoverage = model.showCoverage;
4402
+ var classes = useStyles();
4403
+ var top = SNPCoverageDisplay.height;
4343
4404
  return /*#__PURE__*/React__default.createElement("div", {
4344
4405
  "data-testid": "display-".concat(configuration.getConf(model, 'displayId')),
4345
4406
  style: {
4346
4407
  position: 'relative'
4347
4408
  }
4348
- }, /*#__PURE__*/React__default.createElement("div", {
4409
+ }, showCoverage ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
4349
4410
  "data-testid": "Blockset-snpcoverage"
4350
- }, showCoverage ? /*#__PURE__*/React__default.createElement(SNPCoverageDisplay.RenderingComponent, {
4411
+ }, /*#__PURE__*/React__default.createElement(SNPCoverageDisplay.RenderingComponent, {
4351
4412
  model: SNPCoverageDisplay
4352
- }) : null), /*#__PURE__*/React__default.createElement(ui.ResizeHandle, {
4413
+ })), /*#__PURE__*/React__default.createElement(ui.ResizeHandle, {
4353
4414
  onDrag: function onDrag(delta) {
4354
- if (SNPCoverageDisplay) {
4355
- SNPCoverageDisplay.setHeight(SNPCoverageDisplay.height + delta);
4356
- return delta;
4357
- }
4358
-
4359
- return 0;
4415
+ SNPCoverageDisplay.setHeight(SNPCoverageDisplay.height + delta);
4416
+ return delta;
4360
4417
  },
4418
+ className: classes.resizeHandle,
4361
4419
  style: {
4362
- position: 'absolute',
4363
- top: showCoverage ? SNPCoverageDisplay.height + 2 : 0,
4364
- height: 3
4420
+ top: top
4365
4421
  }
4366
- }), /*#__PURE__*/React__default.createElement("div", {
4422
+ })) : null, showPileup ? /*#__PURE__*/React__default.createElement("div", {
4367
4423
  "data-testid": "Blockset-pileup",
4368
4424
  style: {
4369
4425
  position: 'absolute',
4370
- top: showCoverage ? SNPCoverageDisplay.height + 5 : 0,
4371
- height: 3
4426
+ top: showCoverage ? SNPCoverageDisplay.height : 0
4372
4427
  }
4373
- }, showPileup ? /*#__PURE__*/React__default.createElement(PileupDisplay.RenderingComponent, {
4428
+ }, /*#__PURE__*/React__default.createElement(PileupDisplay.RenderingComponent, {
4374
4429
  model: PileupDisplay
4375
- }) : null));
4430
+ })) : null);
4376
4431
  }
4377
4432
 
4378
4433
  var ReactComponent$1 = /*#__PURE__*/mobxReact.observer(AlignmentsDisplay);
@@ -4421,10 +4476,10 @@ function SNPCoverageConfigFactory(pluginManager) {
4421
4476
  description: 'draw upside down',
4422
4477
  defaultValue: false
4423
4478
  },
4424
- headroom: {
4425
- type: 'number',
4426
- description: 'round the upper value of the domain scale to the nearest N',
4427
- defaultValue: 0
4479
+ multiTicks: {
4480
+ type: 'boolean',
4481
+ description: 'Display multiple values for the ticks',
4482
+ defaultValue: false
4428
4483
  },
4429
4484
  renderers: configuration.ConfigurationSchema('RenderersConfiguration', {
4430
4485
  SNPCoverageRenderer: SNPCoverageRendererConfigSchema
@@ -4444,10 +4499,10 @@ var TooltipContents = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
4444
4499
  var start = feature.get('start');
4445
4500
  var end = feature.get('end');
4446
4501
  var name = feature.get('refName');
4502
+ var info = feature.get('snpinfo');
4447
4503
  var loc = [name, start === end ? en(start) : "".concat(en(start), "..").concat(en(end))].filter(function (f) {
4448
4504
  return !!f;
4449
4505
  }).join(':');
4450
- var info = feature.get('snpinfo');
4451
4506
  var total = info === null || info === void 0 ? void 0 : info.total;
4452
4507
  return /*#__PURE__*/React__default.createElement("div", {
4453
4508
  ref: ref
@@ -4464,7 +4519,7 @@ var TooltipContents = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
4464
4519
  var strands = score.strands;
4465
4520
  return /*#__PURE__*/React__default.createElement("tr", {
4466
4521
  key: base
4467
- }, /*#__PURE__*/React__default.createElement("td", null, base.toUpperCase()), /*#__PURE__*/React__default.createElement("td", null, score.total), /*#__PURE__*/React__default.createElement("td", null, base === 'total' || base === 'skip' ? '---' : "".concat(Math.floor(score.total / total * 100), "%")), /*#__PURE__*/React__default.createElement("td", null, strands['-1'] ? "".concat(strands['-1'], "(-)") : '', strands['1'] ? "".concat(strands['1'], "(+)") : ''), /*#__PURE__*/React__default.createElement("td", null, key));
4522
+ }, /*#__PURE__*/React__default.createElement("td", null, base.toUpperCase()), /*#__PURE__*/React__default.createElement("td", null, score.total), /*#__PURE__*/React__default.createElement("td", null, base === 'total' || base === 'skip' ? '---' : "".concat(Math.floor(score.total / (total || score.total || 1) * 100), "%")), /*#__PURE__*/React__default.createElement("td", null, strands['-1'] ? "".concat(strands['-1'], "(-)") : '', strands['1'] ? "".concat(strands['1'], "(+)") : ''), /*#__PURE__*/React__default.createElement("td", null, key));
4468
4523
  });
4469
4524
  }))));
4470
4525
  });
@@ -6784,6 +6839,7 @@ var BamSlightlyLazyFeature = /*#__PURE__*/function () {
6784
6839
  this.record = record;
6785
6840
  this.adapter = adapter;
6786
6841
  this.ref = ref;
6842
+ this.cachedMD = '';
6787
6843
  }
6788
6844
 
6789
6845
  _createClass(BamSlightlyLazyFeature, [{
@@ -6847,11 +6903,15 @@ var BamSlightlyLazyFeature = /*#__PURE__*/function () {
6847
6903
  }, {
6848
6904
  key: "_get_MD",
6849
6905
  value: function _get_MD() {
6850
- var md = this.record.get('MD');
6851
- var seq = this.get('seq');
6906
+ var md = this.record.get('MD') || this.cachedMD;
6907
+
6908
+ if (!md) {
6909
+ var seq = this.get('seq');
6852
6910
 
6853
- if (!md && seq && this.ref) {
6854
- return generateMD(this.ref, this.record.getReadBases(), this.get('CIGAR'));
6911
+ if (seq && this.ref) {
6912
+ this.cachedMD = generateMD(this.ref, this.get('seq'), this.get('CIGAR'));
6913
+ return this.cachedMD;
6914
+ }
6855
6915
  }
6856
6916
 
6857
6917
  return md;
@@ -7425,7 +7485,7 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7425
7485
  key: "estimateRegionsStats",
7426
7486
  value: function () {
7427
7487
  var _estimateRegionsStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(regions, opts) {
7428
- var _yield$this$configure4, bam, index, bytes, fetchSizeLimit;
7488
+ var _yield$this$configure4, bam, bytes, fetchSizeLimit;
7429
7489
 
7430
7490
  return runtime_1.wrap(function _callee9$(_context9) {
7431
7491
  while (1) {
@@ -7437,18 +7497,16 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7437
7497
  case 2:
7438
7498
  _yield$this$configure4 = _context9.sent;
7439
7499
  bam = _yield$this$configure4.bam;
7440
- // @ts-ignore
7441
- index = bam.index; // this is a method to avoid calling on htsget adapters
7442
7500
 
7443
- if (!(index.filehandle !== '?')) {
7444
- _context9.next = 13;
7501
+ if (!(bam.index.filehandle !== '?')) {
7502
+ _context9.next = 12;
7445
7503
  break;
7446
7504
  }
7447
7505
 
7448
- _context9.next = 8;
7449
- return util.bytesForRegions(regions, index);
7506
+ _context9.next = 7;
7507
+ return util.bytesForRegions(regions, bam);
7450
7508
 
7451
- case 8:
7509
+ case 7:
7452
7510
  bytes = _context9.sent;
7453
7511
  fetchSizeLimit = configuration.readConfObject(this.config, 'fetchSizeLimit');
7454
7512
  return _context9.abrupt("return", {
@@ -7456,10 +7514,10 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7456
7514
  fetchSizeLimit: fetchSizeLimit
7457
7515
  });
7458
7516
 
7459
- case 13:
7517
+ case 12:
7460
7518
  return _context9.abrupt("return", _get(_getPrototypeOf(BamAdapter.prototype), "estimateRegionsStats", this).call(this, regions, opts));
7461
7519
 
7462
- case 14:
7520
+ case 13:
7463
7521
  case "end":
7464
7522
  return _context9.stop();
7465
7523
  }
@@ -7566,7 +7624,7 @@ var HtsgetBamAdapter$1 = {
7566
7624
  'default': HtsgetBamAdapter
7567
7625
  };
7568
7626
 
7569
- var useStyles = /*#__PURE__*/core.makeStyles(function (theme) {
7627
+ var useStyles$1 = /*#__PURE__*/core.makeStyles(function (theme) {
7570
7628
  return {
7571
7629
  root: {
7572
7630
  width: 300
@@ -7581,7 +7639,7 @@ var useStyles = /*#__PURE__*/core.makeStyles(function (theme) {
7581
7639
  });
7582
7640
 
7583
7641
  function ColorByTagDlg$1(props) {
7584
- var classes = useStyles();
7642
+ var classes = useStyles$1();
7585
7643
  var model = props.model,
7586
7644
  handleClose = props.handleClose;
7587
7645
 
@@ -7644,7 +7702,7 @@ var ColorByTag$1 = {
7644
7702
  'default': ColorByTag
7645
7703
  };
7646
7704
 
7647
- var useStyles$1 = /*#__PURE__*/core.makeStyles(function (theme) {
7705
+ var useStyles$2 = /*#__PURE__*/core.makeStyles(function (theme) {
7648
7706
  return {
7649
7707
  root: {
7650
7708
  width: 500
@@ -7702,7 +7760,7 @@ function FilterByTagDlg$1(props) {
7702
7760
 
7703
7761
  var model = props.model,
7704
7762
  handleClose = props.handleClose;
7705
- var classes = useStyles$1();
7763
+ var classes = useStyles$2();
7706
7764
  var filterBy = model.filterBy;
7707
7765
 
7708
7766
  var _useState = React.useState(filterBy === null || filterBy === void 0 ? void 0 : filterBy.flagInclude),
@@ -7823,7 +7881,7 @@ var FilterByTag$1 = {
7823
7881
  'default': FilterByTag
7824
7882
  };
7825
7883
 
7826
- var useStyles$2 = /*#__PURE__*/core.makeStyles(function (theme) {
7884
+ var useStyles$3 = /*#__PURE__*/core.makeStyles(function (theme) {
7827
7885
  return {
7828
7886
  root: {
7829
7887
  margin: 0,
@@ -7839,7 +7897,7 @@ var useStyles$2 = /*#__PURE__*/core.makeStyles(function (theme) {
7839
7897
  });
7840
7898
 
7841
7899
  function SortByTagDlg$1(props) {
7842
- var classes = useStyles$2();
7900
+ var classes = useStyles$3();
7843
7901
  var model = props.model,
7844
7902
  handleClose = props.handleClose;
7845
7903
 
@@ -7889,7 +7947,7 @@ var SortByTag$1 = {
7889
7947
  'default': SortByTag
7890
7948
  };
7891
7949
 
7892
- var useStyles$3 = /*#__PURE__*/core.makeStyles(function (theme) {
7950
+ var useStyles$4 = /*#__PURE__*/core.makeStyles(function (theme) {
7893
7951
  return {
7894
7952
  root: {
7895
7953
  margin: theme.spacing(4)
@@ -7904,7 +7962,7 @@ var useStyles$3 = /*#__PURE__*/core.makeStyles(function (theme) {
7904
7962
  });
7905
7963
 
7906
7964
  function SetFeatureHeightDlg$1(props) {
7907
- var classes = useStyles$3();
7965
+ var classes = useStyles$4();
7908
7966
  var model = props.model,
7909
7967
  handleClose = props.handleClose;
7910
7968
  var featureHeightSetting = model.featureHeightSetting,
@@ -7967,7 +8025,7 @@ var SetFeatureHeight$1 = {
7967
8025
  'default': SetFeatureHeight
7968
8026
  };
7969
8027
 
7970
- var useStyles$4 = /*#__PURE__*/core.makeStyles(function (theme) {
8028
+ var useStyles$5 = /*#__PURE__*/core.makeStyles(function (theme) {
7971
8029
  return {
7972
8030
  root: {
7973
8031
  width: 500
@@ -7987,7 +8045,7 @@ var useStyles$4 = /*#__PURE__*/core.makeStyles(function (theme) {
7987
8045
  function SetMaxHeightDlg$1(props) {
7988
8046
  var model = props.model,
7989
8047
  handleClose = props.handleClose;
7990
- var classes = useStyles$4();
8048
+ var classes = useStyles$5();
7991
8049
  var _model$maxHeight = model.maxHeight,
7992
8050
  maxHeight = _model$maxHeight === void 0 ? '' : _model$maxHeight;
7993
8051
 
@@ -8034,7 +8092,7 @@ var SetMaxHeight$1 = {
8034
8092
  'default': SetMaxHeight
8035
8093
  };
8036
8094
 
8037
- var useStyles$5 = /*#__PURE__*/core.makeStyles(function (theme) {
8095
+ var useStyles$6 = /*#__PURE__*/core.makeStyles(function (theme) {
8038
8096
  return {
8039
8097
  root: {},
8040
8098
  closeButton: {
@@ -8055,7 +8113,7 @@ var useStyles$5 = /*#__PURE__*/core.makeStyles(function (theme) {
8055
8113
 
8056
8114
  function ModificationTable(_ref) {
8057
8115
  var modifications = _ref.modifications;
8058
- var classes = useStyles$5();
8116
+ var classes = useStyles$6();
8059
8117
  return /*#__PURE__*/React__default.createElement("table", {
8060
8118
  className: classes.table
8061
8119
  }, /*#__PURE__*/React__default.createElement("tbody", null, modifications.map(function (_ref2) {
@@ -8075,7 +8133,7 @@ function ModificationTable(_ref) {
8075
8133
  }
8076
8134
 
8077
8135
  function ColorByTagDlg$2(props) {
8078
- var classes = useStyles$5();
8136
+ var classes = useStyles$6();
8079
8137
  var model = props.model,
8080
8138
  handleClose = props.handleClose;
8081
8139
  var colorBy = model.colorBy,
@@ -8149,7 +8207,7 @@ var ColorByModifications$1 = {
8149
8207
  'default': ColorByModifications
8150
8208
  };
8151
8209
 
8152
- var useStyles$6 = /*#__PURE__*/core.makeStyles(function () {
8210
+ var useStyles$7 = /*#__PURE__*/core.makeStyles(function () {
8153
8211
  return {
8154
8212
  compact: {
8155
8213
  paddingRight: 0,
@@ -8161,7 +8219,7 @@ var useStyles$6 = /*#__PURE__*/core.makeStyles(function () {
8161
8219
  var omit = ['clipPos', 'flags']; // eslint-disable-next-line @typescript-eslint/no-explicit-any
8162
8220
 
8163
8221
  function AlignmentFlags(props) {
8164
- var classes = useStyles$6();
8222
+ var classes = useStyles$7();
8165
8223
  var feature = props.feature;
8166
8224
  var flags = feature.flags;
8167
8225
  var flagNames = ['read paired', 'read mapped in proper pair', 'read unmapped', 'mate unmapped', 'read reverse strand', 'mate reverse strand', 'first in pair', 'second in pair', 'not primary alignment', 'read fails platform/vendor quality checks', 'read is PCR or optical duplicate', 'supplementary alignment'];
@@ -8263,10 +8321,15 @@ function SupplementaryAlignments(props) {
8263
8321
  onClick: function onClick() {
8264
8322
  var view = model.view;
8265
8323
 
8266
- if (view) {
8267
- view.navToLocString(locString);
8268
- } else {
8269
- session.notify('No view associated with this feature detail panel anymore', 'warning');
8324
+ try {
8325
+ if (view) {
8326
+ view.navToLocString(locString);
8327
+ } else {
8328
+ throw new Error('No view associated with this view anymore');
8329
+ }
8330
+ } catch (e) {
8331
+ console.error(e);
8332
+ session.notify("".concat(e));
8270
8333
  }
8271
8334
  },
8272
8335
  href: "#"
@@ -8283,10 +8346,15 @@ function PairLink(_ref2) {
8283
8346
  onClick: function onClick() {
8284
8347
  var view = model.view;
8285
8348
 
8286
- if (view) {
8287
- view.navToLocString(locString);
8288
- } else {
8289
- session.notify('No view associated with this feature detail panel anymore', 'warning');
8349
+ try {
8350
+ if (view) {
8351
+ view.navToLocString(locString);
8352
+ } else {
8353
+ session.notify('No view associated with this feature detail panel anymore', 'warning');
8354
+ }
8355
+ } catch (e) {
8356
+ console.error(e);
8357
+ session.notify("".concat(e));
8290
8358
  }
8291
8359
  },
8292
8360
  href: "#"