@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
@@ -21,6 +21,7 @@ import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
21
21
  import { baseLinearDisplayConfigSchema, linearBasicDisplayConfigSchemaFactory, BaseLinearDisplay, BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
22
22
  import { BaseDisplay, createBaseTrackConfig, createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
23
23
  import { autorun, when, observable } from 'mobx';
24
+ import { makeStyles, Dialog, DialogTitle, IconButton, DialogContent, Typography as Typography$1, TextField, Button, Link, Paper, FormControlLabel, Checkbox, CircularProgress, FormGroup } from '@material-ui/core';
24
25
  import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain';
25
26
  import { getRpcSessionId, getFileName, makeIndex, makeIndexType } from '@jbrowse/core/util/tracks';
26
27
  import VisibilityIcon from '@material-ui/icons/Visibility';
@@ -38,7 +39,6 @@ import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType';
38
39
  import { IndexedCramFile, CraiIndex } from '@gmod/cram';
39
40
  import { openLocation } from '@jbrowse/core/util/io';
40
41
  import { BamFile, HtsgetFile } from '@gmod/bam';
41
- import { Dialog, DialogTitle, IconButton, DialogContent, Typography as Typography$1, TextField, Button, makeStyles, Link, Paper, FormControlLabel, Checkbox, CircularProgress, FormGroup } from '@material-ui/core';
42
42
  import CloseIcon from '@material-ui/icons/Close';
43
43
  import { FeatureDetails, BaseCard, SimpleValue } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
44
44
 
@@ -1941,18 +1941,16 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
1941
1941
  bins = _yield$_this$generate.bins;
1942
1942
  skipmap = _yield$_this$generate.skipmap;
1943
1943
  bins.forEach(function (bin, index) {
1944
- if (bin.total) {
1945
- observer.next(new SimpleFeature({
1946
- id: "".concat(_this.id, "-").concat(region.start, "-").concat(index),
1947
- data: {
1948
- score: bin.total,
1949
- snpinfo: bin,
1950
- start: region.start + index,
1951
- end: region.start + index + 1,
1952
- refName: region.refName
1953
- }
1954
- }));
1955
- }
1944
+ observer.next(new SimpleFeature({
1945
+ id: "".concat(_this.id, "-").concat(region.start, "-").concat(index),
1946
+ data: {
1947
+ score: bin.total,
1948
+ snpinfo: bin,
1949
+ start: region.start + index,
1950
+ end: region.start + index + 1,
1951
+ refName: region.refName
1952
+ }
1953
+ }));
1956
1954
  }); // make fake features from the coverage
1957
1955
 
1958
1956
  Object.entries(skipmap).forEach(function (_ref2) {
@@ -2073,7 +2071,7 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2073
2071
  key: "generateCoverageBins",
2074
2072
  value: function () {
2075
2073
  var _generateCoverageBins = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(features, region, opts) {
2076
- var colorBy, _yield$this$configure3, sequenceAdapter, originalRefName, refName, start, end, binMax, skipmap, initBins, regionSeq, _yield$sequenceAdapte, _yield$sequenceAdapte2, feat, bins;
2074
+ var colorBy, _yield$this$configure3, sequenceAdapter, originalRefName, refName, start, end, binMax, skipmap, regionSeq, _yield$sequenceAdapte, _yield$sequenceAdapte2, feat, bins;
2077
2075
 
2078
2076
  return runtime_1.wrap(function _callee5$(_context5) {
2079
2077
  while (1) {
@@ -2088,41 +2086,29 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2088
2086
  sequenceAdapter = _yield$this$configure3.sequenceAdapter;
2089
2087
  originalRefName = region.originalRefName, refName = region.refName, start = region.start, end = region.end;
2090
2088
  binMax = Math.ceil(region.end - region.start);
2091
- skipmap = {};
2092
- initBins = Array.from({
2093
- length: binMax
2094
- }, function () {
2095
- return {
2096
- total: 0,
2097
- lowqual: {},
2098
- cov: {},
2099
- delskips: {},
2100
- noncov: {},
2101
- ref: {}
2102
- };
2103
- }); // request an extra +1 on the end to get CpG crossing region boundary
2089
+ skipmap = {}; // request an extra +1 on the end to get CpG crossing region boundary
2104
2090
 
2105
2091
  if (!sequenceAdapter) {
2106
- _context5.next = 16;
2092
+ _context5.next = 15;
2107
2093
  break;
2108
2094
  }
2109
2095
 
2110
- _context5.next = 12;
2096
+ _context5.next = 11;
2111
2097
  return sequenceAdapter.getFeatures({
2112
2098
  refName: originalRefName || refName,
2113
2099
  start: start,
2114
2100
  end: end + 1,
2115
- assemblyName: 'na'
2101
+ assemblyName: region.assemblyName
2116
2102
  }).pipe(toArray()).toPromise();
2117
2103
 
2118
- case 12:
2104
+ case 11:
2119
2105
  _yield$sequenceAdapte = _context5.sent;
2120
2106
  _yield$sequenceAdapte2 = _slicedToArray(_yield$sequenceAdapte, 1);
2121
2107
  feat = _yield$sequenceAdapte2[0];
2122
2108
  regionSeq = feat === null || feat === void 0 ? void 0 : feat.get('seq');
2123
2109
 
2124
- case 16:
2125
- _context5.next = 18;
2110
+ case 15:
2111
+ _context5.next = 17;
2126
2112
  return features.pipe(reduce(function (bins, feature) {
2127
2113
  var cigar = feature.get('CIGAR');
2128
2114
  var fstart = feature.get('start');
@@ -2130,13 +2116,25 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2130
2116
  var fstrand = feature.get('strand');
2131
2117
  var cigarOps = parseCigar(cigar);
2132
2118
 
2133
- for (var j = fstart; j < fend; j++) {
2119
+ for (var j = fstart; j < fend + 1; j++) {
2134
2120
  var i = j - region.start;
2135
2121
 
2136
- if (i >= 0 && i < bins.length) {
2137
- var bin = bins[i];
2138
- bin.total++;
2139
- inc(bin, fstrand, 'ref', 'ref');
2122
+ if (i >= 0 && i < binMax) {
2123
+ var bin = bins[i] || {
2124
+ total: 0,
2125
+ lowqual: {},
2126
+ cov: {},
2127
+ delskips: {},
2128
+ noncov: {},
2129
+ ref: {}
2130
+ };
2131
+
2132
+ if (j !== fend) {
2133
+ bin.total++;
2134
+ inc(bin, fstrand, 'ref', 'ref');
2135
+ }
2136
+
2137
+ bins[i] = bin;
2140
2138
  }
2141
2139
  }
2142
2140
 
@@ -2168,7 +2166,14 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2168
2166
  var epos = pos + fstart - region.start;
2169
2167
 
2170
2168
  if (epos >= 0 && epos < bins.length && pos + fstart < fend) {
2171
- var _bin = bins[epos];
2169
+ var _bin = bins[epos] || {
2170
+ total: 0,
2171
+ lowqual: {},
2172
+ cov: {},
2173
+ delskips: {},
2174
+ noncov: {},
2175
+ ref: {}
2176
+ };
2172
2177
 
2173
2178
  if (probabilities[probIndex] > 0.5) {
2174
2179
  inc(_bin, fstrand, 'cov', mod);
@@ -2257,9 +2262,9 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2257
2262
  if (mismatches) {
2258
2263
  for (var _i2 = 0; _i2 < mismatches.length; _i2++) {
2259
2264
  var mismatch = mismatches[_i2];
2260
- var mstart = fstart + mismatch.start;
2265
+ var ms = fstart + mismatch.start;
2261
2266
 
2262
- for (var _j2 = mstart; _j2 < mstart + mismatchLen(mismatch); _j2++) {
2267
+ for (var _j2 = ms; _j2 < ms + mismatchLen(mismatch); _j2++) {
2263
2268
  var epos = _j2 - region.start;
2264
2269
 
2265
2270
  if (epos >= 0 && epos < bins.length) {
@@ -2299,7 +2304,7 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2299
2304
  start: start,
2300
2305
  end: end,
2301
2306
  strand: strand,
2302
- xs: feature.get('xs') || feature.get('ts') || feature.get('tags').XS || feature.get('tags').TS,
2307
+ xs: getTag(feature, 'XS') || getTag(feature, 'TS'),
2303
2308
  score: 1
2304
2309
  };
2305
2310
  } else {
@@ -2310,16 +2315,16 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2310
2315
  }
2311
2316
 
2312
2317
  return bins;
2313
- }, initBins)).toPromise();
2318
+ }, [])).toPromise();
2314
2319
 
2315
- case 18:
2320
+ case 17:
2316
2321
  bins = _context5.sent;
2317
2322
  return _context5.abrupt("return", {
2318
2323
  bins: bins,
2319
2324
  skipmap: skipmap
2320
2325
  });
2321
2326
 
2322
- case 20:
2327
+ case 19:
2323
2328
  case "end":
2324
2329
  return _context5.stop();
2325
2330
  }
@@ -2375,7 +2380,7 @@ var ConfigSchema = /*#__PURE__*/ConfigurationSchema('SNPCoverageRenderer', {
2375
2380
  indicatorThreshold: {
2376
2381
  type: 'number',
2377
2382
  description: 'the proportion of reads containing a insertion/clip indicator',
2378
- defaultValue: 0.3
2383
+ defaultValue: 0.4
2379
2384
  },
2380
2385
  drawArcs: {
2381
2386
  type: 'boolean',
@@ -2416,12 +2421,13 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2416
2421
  regions = props.regions,
2417
2422
  bpPerPx = props.bpPerPx,
2418
2423
  displayCrossHatches = props.displayCrossHatches,
2419
- modificationTagMap = props.modificationTagMap,
2424
+ _props$modificationTa = props.modificationTagMap,
2425
+ modificationTagMap = _props$modificationTa === void 0 ? {} : _props$modificationTa,
2420
2426
  scaleOpts = props.scaleOpts,
2421
2427
  unadjustedHeight = props.height,
2422
2428
  configTheme = props.theme,
2423
2429
  cfg = props.config,
2424
- values = props.ticks.values;
2430
+ ticks = props.ticks;
2425
2431
  var theme = createJBrowseTheme(configTheme);
2426
2432
 
2427
2433
  var _regions = _slicedToArray(regions, 1),
@@ -2433,6 +2439,11 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2433
2439
 
2434
2440
  var offset = YSCALEBAR_LABEL_OFFSET;
2435
2441
  var height = unadjustedHeight - offset * 2;
2442
+ var domain = scaleOpts.domain;
2443
+
2444
+ if (!domain) {
2445
+ return;
2446
+ }
2436
2447
 
2437
2448
  var opts = _objectSpread2(_objectSpread2({}, scaleOpts), {}, {
2438
2449
  range: [0, height]
@@ -2440,6 +2451,12 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2440
2451
 
2441
2452
  var viewScale = getScale(opts);
2442
2453
  var snpViewScale = getScale(_objectSpread2(_objectSpread2({}, opts), {}, {
2454
+ range: [0, height],
2455
+ scaleType: 'linear'
2456
+ })); // clipping and insertion indicators, uses a smaller height/2 scale
2457
+
2458
+ var indicatorViewScale = getScale(_objectSpread2(_objectSpread2({}, opts), {}, {
2459
+ range: [0, height / 2],
2443
2460
  scaleType: 'linear'
2444
2461
  }));
2445
2462
  var originY = getOrigin(scaleOpts.scaleType);
@@ -2462,10 +2479,18 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2462
2479
  return height - (snpViewScale(n) || 0) + offset;
2463
2480
  };
2464
2481
 
2482
+ var indicatorToY = function indicatorToY(n) {
2483
+ return height - (indicatorViewScale(n) || 0) + offset;
2484
+ };
2485
+
2465
2486
  var snpToHeight = function snpToHeight(n) {
2466
2487
  return snpToY(snpOriginY) - snpToY(n);
2467
2488
  };
2468
2489
 
2490
+ var indicatorToHeight = function indicatorToHeight(n) {
2491
+ return indicatorToY(snpOriginY) - indicatorToY(n);
2492
+ };
2493
+
2469
2494
  var colorForBase = {
2470
2495
  A: theme.palette.bases.A.main,
2471
2496
  C: theme.palette.bases.C.main,
@@ -2491,7 +2516,10 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2491
2516
  // bpPerPx First pass: draw the gray background
2492
2517
 
2493
2518
  ctx.fillStyle = colorForBase.total;
2494
- coverage.forEach(function (feature) {
2519
+
2520
+ for (var i = 0; i < coverage.length; i++) {
2521
+ var feature = coverage[i];
2522
+
2495
2523
  var _featureSpanPx = featureSpanPx(feature, region, bpPerPx),
2496
2524
  _featureSpanPx2 = _slicedToArray(_featureSpanPx, 2),
2497
2525
  leftPx = _featureSpanPx2[0],
@@ -2500,96 +2528,97 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2500
2528
  var w = rightPx - leftPx + 0.3;
2501
2529
  var score = feature.get('score');
2502
2530
  ctx.fillRect(leftPx, toY(score), w, toHeight(score));
2503
- });
2504
- ctx.fillStyle = 'grey';
2505
- ctx.beginPath();
2506
- ctx.lineTo(0, 0);
2507
- ctx.moveTo(0, width);
2508
- ctx.stroke(); // Second pass: draw the SNP data, and add a minimum feature width of 1px
2531
+ } // Keep track of previous total which we will use it to draw the interbase
2532
+ // indicator (if there is a sudden clip, there will be no read coverage but
2533
+ // there will be "clip" coverage) at that position beyond the read. if the
2534
+ // clip is right at a block boundary then prevTotal will not be available,
2535
+ // so this is a best attempt to plot interbase indicator at the "cliffs"
2536
+
2537
+
2538
+ var prevTotal = 0; // extraHorizontallyFlippedOffset is used to draw interbase items, which
2539
+ // are located to the left when forward and right when reversed
2540
+
2541
+ var extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx : 0; // Second pass: draw the SNP data, and add a minimum feature width of 1px
2509
2542
  // which can be wider than the actual bpPerPx This reduces overdrawing of
2510
2543
  // the grey background over the SNPs
2511
2544
 
2512
- coverage.forEach(function (feature) {
2513
- var _featureSpanPx3 = featureSpanPx(feature, region, bpPerPx),
2514
- _featureSpanPx4 = _slicedToArray(_featureSpanPx3, 2),
2515
- leftPx = _featureSpanPx4[0],
2516
- rightPx = _featureSpanPx4[1];
2545
+ for (var _i = 0; _i < coverage.length; _i++) {
2546
+ var _feature = coverage[_i];
2517
2547
 
2518
- var snpinfo = feature.get('snpinfo');
2519
- var w = Math.max(rightPx - leftPx + 0.3, 1);
2520
- var totalScore = snpinfo.total;
2521
- Object.entries(snpinfo.cov).sort(function (_ref, _ref2) {
2522
- var _ref3 = _slicedToArray(_ref, 1),
2523
- a = _ref3[0];
2548
+ var _featureSpanPx3 = featureSpanPx(_feature, region, bpPerPx),
2549
+ _featureSpanPx4 = _slicedToArray(_featureSpanPx3, 2),
2550
+ _leftPx = _featureSpanPx4[0],
2551
+ _rightPx = _featureSpanPx4[1];
2524
2552
 
2525
- var _ref4 = _slicedToArray(_ref2, 1),
2526
- b = _ref4[0];
2553
+ var snpinfo = _feature.get('snpinfo');
2527
2554
 
2528
- if (a < b) {
2529
- return -1;
2530
- }
2555
+ var _w = Math.max(_rightPx - _leftPx + 0.3, 1);
2531
2556
 
2532
- if (a > b) {
2533
- return 1;
2534
- }
2557
+ var totalScore = snpinfo.total;
2558
+ var keys = Object.keys(snpinfo.cov).sort();
2559
+ var curr = 0;
2560
+
2561
+ for (var _i2 = 0; _i2 < keys.length; _i2++) {
2562
+ var base = keys[_i2];
2563
+ var total = snpinfo.cov[base].total;
2564
+ ctx.fillStyle = colorForBase[base] || modificationTagMap[base.replace('mod_', '')] || '#888';
2565
+ ctx.fillRect(_leftPx, snpToY(total + curr), _w, snpToHeight(total));
2566
+ curr += total;
2567
+ }
2535
2568
 
2536
- return 0;
2537
- }).reduce(function (curr, _ref5) {
2538
- var _ref6 = _slicedToArray(_ref5, 2),
2539
- base = _ref6[0],
2540
- total = _ref6[1].total;
2541
-
2542
- ctx.fillStyle = colorForBase[base] || modificationTagMap[base.replace('mod_', '')] || 'red';
2543
- ctx.fillRect(leftPx, snpToY(total + curr), w, snpToHeight(total));
2544
- return curr + total;
2545
- }, 0);
2546
- var interbaseEvents = Object.entries(snpinfo.noncov);
2569
+ var interbaseEvents = Object.keys(snpinfo.noncov);
2547
2570
  var indicatorHeight = 4.5;
2548
2571
 
2549
2572
  if (drawInterbaseCounts) {
2550
- interbaseEvents.reduce(function (curr, _ref7) {
2551
- var _ref8 = _slicedToArray(_ref7, 2),
2552
- base = _ref8[0],
2553
- total = _ref8[1].total;
2554
-
2555
- ctx.fillStyle = colorForBase[base];
2556
- ctx.fillRect(leftPx - 0.6, indicatorHeight + snpToHeight(curr), 1.2, snpToHeight(total));
2557
- return curr + total;
2558
- }, 0);
2573
+ var _curr = 0;
2574
+
2575
+ for (var _i3 = 0; _i3 < interbaseEvents.length; _i3++) {
2576
+ var _base = interbaseEvents[_i3];
2577
+ var _total = snpinfo.noncov[_base].total;
2578
+ ctx.fillStyle = colorForBase[_base];
2579
+ ctx.fillRect(_leftPx - 0.6 + extraHorizontallyFlippedOffset, indicatorHeight + indicatorToHeight(_curr), 1.2, indicatorToHeight(_total));
2580
+ _curr += _total;
2581
+ }
2559
2582
  }
2560
2583
 
2561
2584
  if (drawIndicators) {
2562
2585
  var accum = 0;
2563
2586
  var max = 0;
2564
2587
  var maxBase = '';
2565
- interbaseEvents.forEach(function (_ref9) {
2566
- var _ref10 = _slicedToArray(_ref9, 2),
2567
- base = _ref10[0],
2568
- total = _ref10[1].total;
2569
2588
 
2570
- accum += total;
2589
+ for (var _i4 = 0; _i4 < interbaseEvents.length; _i4++) {
2590
+ var _base2 = interbaseEvents[_i4];
2591
+ var _total2 = snpinfo.noncov[_base2].total;
2592
+ accum += _total2;
2571
2593
 
2572
- if (total > max) {
2573
- max = total;
2574
- maxBase = base;
2594
+ if (_total2 > max) {
2595
+ max = _total2;
2596
+ maxBase = _base2;
2575
2597
  }
2576
- }); // avoid drawing a bunch of indicators if coverage is very low e.g.
2577
- // less than 7
2598
+ } // avoid drawing a bunch of indicators if coverage is very low e.g.
2599
+ // less than 7, uses the prev total in the case of the "cliff"
2600
+
2578
2601
 
2579
- if (accum > totalScore * indicatorThreshold && totalScore > 7) {
2602
+ var indicatorComparatorScore = Math.max(totalScore, prevTotal);
2603
+
2604
+ if (accum > indicatorComparatorScore * indicatorThreshold && indicatorComparatorScore > 7) {
2580
2605
  ctx.fillStyle = colorForBase[maxBase];
2581
2606
  ctx.beginPath();
2582
- ctx.moveTo(leftPx - 3, 0);
2583
- ctx.lineTo(leftPx + 3, 0);
2584
- ctx.lineTo(leftPx, indicatorHeight);
2607
+ var l = _leftPx + extraHorizontallyFlippedOffset;
2608
+ ctx.moveTo(l - 3.5, 0);
2609
+ ctx.lineTo(l + 3.5, 0);
2610
+ ctx.lineTo(l, indicatorHeight);
2585
2611
  ctx.fill();
2586
2612
  }
2587
2613
  }
2588
- });
2589
- ctx.globalAlpha = 0.7;
2614
+
2615
+ prevTotal = totalScore;
2616
+ }
2590
2617
 
2591
2618
  if (drawArcs) {
2592
- skips.forEach(function (f) {
2619
+ for (var _i5 = 0; _i5 < skips.length; _i5++) {
2620
+ var f = skips[_i5];
2621
+
2593
2622
  var _bpSpanPx = bpSpanPx(f.get('start'), f.get('end'), region, bpPerPx),
2594
2623
  _bpSpanPx2 = _slicedToArray(_bpSpanPx, 2),
2595
2624
  left = _bpSpanPx2[0],
@@ -2598,9 +2627,9 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2598
2627
  ctx.beginPath();
2599
2628
  var str = f.get('strand');
2600
2629
  var xs = f.get('xs');
2601
- var pos = 'rgb(255,200,200)';
2602
- var neg = 'rgb(200,200,255)';
2603
- var neutral = 'rgb(200,200,200)';
2630
+ var pos = 'rgba(255,200,200,0.7)';
2631
+ var neg = 'rgba(200,200,255,0.7)';
2632
+ var neutral = 'rgba(200,200,200,0.7)';
2604
2633
 
2605
2634
  if (xs === '+') {
2606
2635
  ctx.strokeStyle = pos;
@@ -2618,13 +2647,13 @@ var SNPCoverageRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2618
2647
  ctx.moveTo(left, height - offset * 2);
2619
2648
  ctx.bezierCurveTo(left, 0, right, 0, right, height - offset * 2);
2620
2649
  ctx.stroke();
2621
- });
2650
+ }
2622
2651
  }
2623
2652
 
2624
2653
  if (displayCrossHatches) {
2625
2654
  ctx.lineWidth = 1;
2626
2655
  ctx.strokeStyle = 'rgba(140,140,140,0.8)';
2627
- values.forEach(function (tick) {
2656
+ ticks.values.forEach(function (tick) {
2628
2657
  ctx.beginPath();
2629
2658
  ctx.moveTo(0, Math.round(toY(tick)));
2630
2659
  ctx.lineTo(width, Math.round(toY(tick)));
@@ -3061,9 +3090,11 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3061
3090
  var modifications = getModificationPositions(mm, seq, strand); // probIndex applies across multiple modifications e.g.
3062
3091
 
3063
3092
  var probIndex = 0;
3064
- modifications.forEach(function (_ref2) {
3065
- var type = _ref2.type,
3066
- positions = _ref2.positions;
3093
+
3094
+ for (var i = 0; i < modifications.length; i++) {
3095
+ var _modifications$i = modifications[i],
3096
+ type = _modifications$i.type,
3097
+ positions = _modifications$i.positions;
3067
3098
  var col = modificationTagMap[type] || 'black';
3068
3099
  var base = Color(col);
3069
3100
 
@@ -3093,7 +3124,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3093
3124
  } finally {
3094
3125
  _iterator.f();
3095
3126
  }
3096
- });
3127
+ }
3097
3128
  } // Color by methylation is slightly modified version of color by
3098
3129
  // modifications
3099
3130
  //
@@ -3120,9 +3151,12 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3120
3151
  var rstart = region.start,
3121
3152
  rend = region.end;
3122
3153
  var methBins = new Array(rend - rstart).fill(0);
3123
- getModificationPositions(mm, seq, strand).forEach(function (_ref3) {
3124
- var type = _ref3.type,
3125
- positions = _ref3.positions;
3154
+ var modifications = getModificationPositions(mm, seq, strand);
3155
+
3156
+ for (var i = 0; i < modifications.length; i++) {
3157
+ var _modifications$i2 = modifications[i],
3158
+ type = _modifications$i2.type,
3159
+ positions = _modifications$i2.positions;
3126
3160
 
3127
3161
  if (type === 'm' && positions) {
3128
3162
  var _iterator2 = _createForOfIteratorHelper(getNextRefPos(cigarOps, positions)),
@@ -3143,25 +3177,27 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3143
3177
  _iterator2.f();
3144
3178
  }
3145
3179
  }
3146
- });
3180
+ }
3147
3181
 
3148
3182
  for (var j = fstart; j < fend; j++) {
3149
- var i = j - rstart;
3183
+ var _i = j - rstart;
3184
+
3185
+ if (_i >= 0 && _i < methBins.length) {
3186
+ var l1 = regionSequence[_i].toLowerCase();
3187
+
3188
+ var l2 = regionSequence[_i + 1].toLowerCase(); // if we are zoomed out, display just a block over the cpg
3150
3189
 
3151
- if (i >= 0 && i < methBins.length) {
3152
- var l1 = regionSequence[i].toLowerCase();
3153
- var l2 = regionSequence[i + 1].toLowerCase(); // if we are zoomed out, display just a block over the cpg
3154
3190
 
3155
3191
  if (bpPerPx > 2) {
3156
3192
  if (l1 === 'c' && l2 === 'g') {
3157
- var s = rstart + i;
3193
+ var s = rstart + _i;
3158
3194
 
3159
3195
  var _bpSpanPx7 = bpSpanPx(s, s + 2, region, bpPerPx),
3160
3196
  _bpSpanPx8 = _slicedToArray(_bpSpanPx7, 2),
3161
3197
  leftPx = _bpSpanPx8[0],
3162
3198
  rightPx = _bpSpanPx8[1];
3163
3199
 
3164
- if (methBins[i] || methBins[i + 1]) {
3200
+ if (methBins[_i] || methBins[_i + 1]) {
3165
3201
  ctx.fillStyle = 'red';
3166
3202
  } else {
3167
3203
  ctx.fillStyle = 'blue';
@@ -3173,14 +3209,14 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3173
3209
  else {
3174
3210
  // color
3175
3211
  if (l1 === 'c' && l2 === 'g') {
3176
- var _s = rstart + i;
3212
+ var _s = rstart + _i;
3177
3213
 
3178
3214
  var _bpSpanPx9 = bpSpanPx(_s, _s + 1, region, bpPerPx),
3179
3215
  _bpSpanPx10 = _slicedToArray(_bpSpanPx9, 2),
3180
3216
  _leftPx = _bpSpanPx10[0],
3181
3217
  _rightPx = _bpSpanPx10[1];
3182
3218
 
3183
- if (methBins[i]) {
3219
+ if (methBins[_i]) {
3184
3220
  ctx.fillStyle = 'red';
3185
3221
  } else {
3186
3222
  ctx.fillStyle = 'blue';
@@ -3193,7 +3229,7 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3193
3229
  leftPx2 = _bpSpanPx12[0],
3194
3230
  rightPx2 = _bpSpanPx12[1];
3195
3231
 
3196
- if (methBins[i + 1]) {
3232
+ if (methBins[_i + 1]) {
3197
3233
  ctx.fillStyle = 'red';
3198
3234
  } else {
3199
3235
  ctx.fillStyle = 'blue';
@@ -3260,11 +3296,11 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3260
3296
  _props$colorTagMap = props.colorTagMap,
3261
3297
  colorTagMap = _props$colorTagMap === void 0 ? {} : _props$colorTagMap;
3262
3298
 
3263
- var _ref4 = colorBy || {},
3264
- _ref4$tag = _ref4.tag,
3265
- tag = _ref4$tag === void 0 ? '' : _ref4$tag,
3266
- _ref4$type = _ref4.type,
3267
- colorType = _ref4$type === void 0 ? '' : _ref4$type;
3299
+ var _ref2 = colorBy || {},
3300
+ _ref2$tag = _ref2.tag,
3301
+ tag = _ref2$tag === void 0 ? '' : _ref2$tag,
3302
+ _ref2$type = _ref2.type,
3303
+ colorType = _ref2$type === void 0 ? '' : _ref2$type;
3268
3304
 
3269
3305
  var feature = feat.feature;
3270
3306
  var region = regions[0]; // first pass for simple color changes that change the color of the
@@ -3391,10 +3427,13 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3391
3427
  }
3392
3428
 
3393
3429
  return color;
3394
- } // two pass rendering: first pass, draw all the mismatches except wide
3395
- // insertion markers
3430
+ } // extraHorizontallyFlippedOffset is used to draw interbase items, which
3431
+ // are located to the left when forward and right when reversed
3396
3432
 
3397
3433
 
3434
+ var extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx + 1 : -1; // two pass rendering: first pass, draw all the mismatches except wide
3435
+ // insertion markers
3436
+
3398
3437
  for (var i = 0; i < mismatches.length; i += 1) {
3399
3438
  var mismatch = mismatches[i];
3400
3439
  var mstart = start + mismatch.start;
@@ -3431,51 +3470,55 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3431
3470
  }
3432
3471
  } else if (mismatch.type === 'insertion' && drawIndels) {
3433
3472
  ctx.fillStyle = 'purple';
3434
- var pos = leftPx - 1;
3473
+ var pos = leftPx + extraHorizontallyFlippedOffset;
3435
3474
  var len = +mismatch.base || mismatch.length;
3475
+ var insW = Math.max(minWidth, Math.min(1.2, 1 / bpPerPx));
3436
3476
 
3437
3477
  if (len < 10) {
3438
- ctx.fillRect(pos, topPx, w, heightPx);
3478
+ ctx.fillRect(pos, topPx, insW, heightPx);
3439
3479
 
3440
3480
  if (1 / bpPerPx >= charWidth) {
3441
- ctx.fillRect(pos - w, topPx, w * 3, 1);
3442
- ctx.fillRect(pos - w, topPx + heightPx - 1, w * 3, 1);
3481
+ ctx.fillRect(pos - insW, topPx, insW * 3, 1);
3482
+ ctx.fillRect(pos - insW, topPx + heightPx - 1, insW * 3, 1);
3443
3483
  }
3444
3484
 
3445
3485
  if (1 / bpPerPx >= charWidth && heightPx >= heightLim) {
3446
- ctx.fillText("(".concat(mismatch.base, ")"), leftPx + 2, topPx + heightPx);
3486
+ ctx.fillText("(".concat(mismatch.base, ")"), pos + 3, topPx + heightPx);
3447
3487
  }
3448
3488
  }
3449
3489
  } else if (mismatch.type === 'hardclip' || mismatch.type === 'softclip') {
3450
3490
  ctx.fillStyle = mismatch.type === 'hardclip' ? 'red' : 'blue';
3451
3491
 
3452
- var _pos = leftPx - 1;
3492
+ var _pos = leftPx + extraHorizontallyFlippedOffset;
3453
3493
 
3454
- ctx.fillRect(_pos, topPx + 1, w, heightPx - 2);
3455
- ctx.fillRect(_pos - w, topPx, w * 3, 1);
3456
- ctx.fillRect(_pos - w, topPx + heightPx - 1, w * 3, 1);
3494
+ ctx.fillRect(_pos, topPx, w, heightPx);
3495
+
3496
+ if (1 / bpPerPx >= charWidth) {
3497
+ ctx.fillRect(_pos - w, topPx, w * 3, 1);
3498
+ ctx.fillRect(_pos - w, topPx + heightPx - 1, w * 3, 1);
3499
+ }
3457
3500
 
3458
3501
  if (widthPx >= charWidth && heightPx >= heightLim) {
3459
- ctx.fillText("(".concat(mismatch.base, ")"), leftPx + 2, topPx + heightPx);
3502
+ ctx.fillText("(".concat(mismatch.base, ")"), _pos + 3, topPx + heightPx);
3460
3503
  }
3461
3504
  } else if (mismatch.type === 'skip') {
3462
- // fix to avoid bad rendering
3463
- // note that this was also related to chrome bug https://bugs.chromium.org/p/chro>
3464
- // ref #1236
3505
+ // fix to avoid bad rendering note that this was also related to chrome
3506
+ // bug https://bugs.chromium.org/p/chromium/issues/detail?id=1131528
3507
+ // also affected firefox ref #1236 #2750
3465
3508
  if (leftPx + widthPx > 0) {
3466
3509
  // make small exons more visible when zoomed far out
3467
- ctx.clearRect(leftPx, topPx, widthPx - (bpPerPx > 10 ? 1.5 : 0), heightPx);
3510
+ var adjustPx = widthPx - (bpPerPx > 10 ? 1.5 : 0);
3511
+ ctx.clearRect(leftPx, topPx, adjustPx, heightPx);
3512
+ ctx.fillStyle = '#333';
3513
+ ctx.fillRect(Math.max(0, leftPx), topPx + heightPx / 2 - 1, adjustPx + (leftPx < 0 ? leftPx : 0), 2);
3468
3514
  }
3469
-
3470
- ctx.fillStyle = '#333';
3471
- ctx.fillRect(leftPx, topPx + heightPx / 2, widthPx, 2);
3472
3515
  }
3473
3516
  } // second pass, draw wide insertion markers on top
3474
3517
 
3475
3518
 
3476
3519
  if (drawIndels) {
3477
- for (var _i = 0; _i < mismatches.length; _i += 1) {
3478
- var _mismatch = mismatches[_i];
3520
+ for (var _i2 = 0; _i2 < mismatches.length; _i2 += 1) {
3521
+ var _mismatch = mismatches[_i2];
3479
3522
 
3480
3523
  var _mstart = start + _mismatch.start;
3481
3524
 
@@ -3543,7 +3586,8 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3543
3586
  return mismatch.type === 'softclip';
3544
3587
  }).forEach(function (mismatch) {
3545
3588
  var softClipLength = mismatch.cliplen || 0;
3546
- var softClipStart = mismatch.start === 0 ? feature.get('start') - softClipLength : feature.get('start') + mismatch.start;
3589
+ var s = feature.get('start');
3590
+ var softClipStart = mismatch.start === 0 ? s - softClipLength : s + mismatch.start;
3547
3591
 
3548
3592
  for (var k = 0; k < softClipLength; k += 1) {
3549
3593
  var base = seq.charAt(k + mismatch.start); // If softclip length+start is longer than sequence, no need to
@@ -3939,10 +3983,15 @@ function PileupRendering(props) {
3939
3983
 
3940
3984
  var offsetX = 0;
3941
3985
  var offsetY = 0;
3986
+ var canvas = highlightOverlayCanvas.current;
3942
3987
 
3943
- if (highlightOverlayCanvas.current) {
3944
- offsetX = highlightOverlayCanvas.current.getBoundingClientRect().left;
3945
- offsetY = highlightOverlayCanvas.current.getBoundingClientRect().top;
3988
+ if (canvas) {
3989
+ var _canvas$getBoundingCl = canvas.getBoundingClientRect(),
3990
+ left = _canvas$getBoundingCl.left,
3991
+ top = _canvas$getBoundingCl.top;
3992
+
3993
+ offsetX = left;
3994
+ offsetY = top;
3946
3995
  }
3947
3996
 
3948
3997
  offsetX = event.clientX - offsetX;
@@ -4326,45 +4375,51 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
4326
4375
  });
4327
4376
  };
4328
4377
 
4378
+ var useStyles = /*#__PURE__*/makeStyles(function () {
4379
+ return {
4380
+ resizeHandle: {
4381
+ height: 2,
4382
+ position: 'absolute',
4383
+ zIndex: 2
4384
+ }
4385
+ };
4386
+ });
4387
+
4329
4388
  function AlignmentsDisplay(_ref) {
4330
4389
  var model = _ref.model;
4331
4390
  var PileupDisplay = model.PileupDisplay,
4332
4391
  SNPCoverageDisplay = model.SNPCoverageDisplay,
4333
4392
  showPileup = model.showPileup,
4334
4393
  showCoverage = model.showCoverage;
4394
+ var classes = useStyles();
4395
+ var top = SNPCoverageDisplay.height;
4335
4396
  return /*#__PURE__*/React.createElement("div", {
4336
4397
  "data-testid": "display-".concat(getConf(model, 'displayId')),
4337
4398
  style: {
4338
4399
  position: 'relative'
4339
4400
  }
4340
- }, /*#__PURE__*/React.createElement("div", {
4401
+ }, showCoverage ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4341
4402
  "data-testid": "Blockset-snpcoverage"
4342
- }, showCoverage ? /*#__PURE__*/React.createElement(SNPCoverageDisplay.RenderingComponent, {
4403
+ }, /*#__PURE__*/React.createElement(SNPCoverageDisplay.RenderingComponent, {
4343
4404
  model: SNPCoverageDisplay
4344
- }) : null), /*#__PURE__*/React.createElement(ResizeHandle, {
4405
+ })), /*#__PURE__*/React.createElement(ResizeHandle, {
4345
4406
  onDrag: function onDrag(delta) {
4346
- if (SNPCoverageDisplay) {
4347
- SNPCoverageDisplay.setHeight(SNPCoverageDisplay.height + delta);
4348
- return delta;
4349
- }
4350
-
4351
- return 0;
4407
+ SNPCoverageDisplay.setHeight(SNPCoverageDisplay.height + delta);
4408
+ return delta;
4352
4409
  },
4410
+ className: classes.resizeHandle,
4353
4411
  style: {
4354
- position: 'absolute',
4355
- top: showCoverage ? SNPCoverageDisplay.height + 2 : 0,
4356
- height: 3
4412
+ top: top
4357
4413
  }
4358
- }), /*#__PURE__*/React.createElement("div", {
4414
+ })) : null, showPileup ? /*#__PURE__*/React.createElement("div", {
4359
4415
  "data-testid": "Blockset-pileup",
4360
4416
  style: {
4361
4417
  position: 'absolute',
4362
- top: showCoverage ? SNPCoverageDisplay.height + 5 : 0,
4363
- height: 3
4418
+ top: showCoverage ? SNPCoverageDisplay.height : 0
4364
4419
  }
4365
- }, showPileup ? /*#__PURE__*/React.createElement(PileupDisplay.RenderingComponent, {
4420
+ }, /*#__PURE__*/React.createElement(PileupDisplay.RenderingComponent, {
4366
4421
  model: PileupDisplay
4367
- }) : null));
4422
+ })) : null);
4368
4423
  }
4369
4424
 
4370
4425
  var ReactComponent$1 = /*#__PURE__*/observer(AlignmentsDisplay);
@@ -4413,10 +4468,10 @@ function SNPCoverageConfigFactory(pluginManager) {
4413
4468
  description: 'draw upside down',
4414
4469
  defaultValue: false
4415
4470
  },
4416
- headroom: {
4417
- type: 'number',
4418
- description: 'round the upper value of the domain scale to the nearest N',
4419
- defaultValue: 0
4471
+ multiTicks: {
4472
+ type: 'boolean',
4473
+ description: 'Display multiple values for the ticks',
4474
+ defaultValue: false
4420
4475
  },
4421
4476
  renderers: ConfigurationSchema('RenderersConfiguration', {
4422
4477
  SNPCoverageRenderer: SNPCoverageRendererConfigSchema
@@ -4436,10 +4491,10 @@ var TooltipContents = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
4436
4491
  var start = feature.get('start');
4437
4492
  var end = feature.get('end');
4438
4493
  var name = feature.get('refName');
4494
+ var info = feature.get('snpinfo');
4439
4495
  var loc = [name, start === end ? en(start) : "".concat(en(start), "..").concat(en(end))].filter(function (f) {
4440
4496
  return !!f;
4441
4497
  }).join(':');
4442
- var info = feature.get('snpinfo');
4443
4498
  var total = info === null || info === void 0 ? void 0 : info.total;
4444
4499
  return /*#__PURE__*/React.createElement("div", {
4445
4500
  ref: ref
@@ -4456,7 +4511,7 @@ var TooltipContents = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
4456
4511
  var strands = score.strands;
4457
4512
  return /*#__PURE__*/React.createElement("tr", {
4458
4513
  key: base
4459
- }, /*#__PURE__*/React.createElement("td", null, base.toUpperCase()), /*#__PURE__*/React.createElement("td", null, score.total), /*#__PURE__*/React.createElement("td", null, base === 'total' || base === 'skip' ? '---' : "".concat(Math.floor(score.total / total * 100), "%")), /*#__PURE__*/React.createElement("td", null, strands['-1'] ? "".concat(strands['-1'], "(-)") : '', strands['1'] ? "".concat(strands['1'], "(+)") : ''), /*#__PURE__*/React.createElement("td", null, key));
4514
+ }, /*#__PURE__*/React.createElement("td", null, base.toUpperCase()), /*#__PURE__*/React.createElement("td", null, score.total), /*#__PURE__*/React.createElement("td", null, base === 'total' || base === 'skip' ? '---' : "".concat(Math.floor(score.total / (total || score.total || 1) * 100), "%")), /*#__PURE__*/React.createElement("td", null, strands['-1'] ? "".concat(strands['-1'], "(-)") : '', strands['1'] ? "".concat(strands['1'], "(+)") : ''), /*#__PURE__*/React.createElement("td", null, key));
4460
4515
  });
4461
4516
  }))));
4462
4517
  });
@@ -6776,6 +6831,7 @@ var BamSlightlyLazyFeature = /*#__PURE__*/function () {
6776
6831
  this.record = record;
6777
6832
  this.adapter = adapter;
6778
6833
  this.ref = ref;
6834
+ this.cachedMD = '';
6779
6835
  }
6780
6836
 
6781
6837
  _createClass(BamSlightlyLazyFeature, [{
@@ -6839,11 +6895,15 @@ var BamSlightlyLazyFeature = /*#__PURE__*/function () {
6839
6895
  }, {
6840
6896
  key: "_get_MD",
6841
6897
  value: function _get_MD() {
6842
- var md = this.record.get('MD');
6843
- var seq = this.get('seq');
6898
+ var md = this.record.get('MD') || this.cachedMD;
6899
+
6900
+ if (!md) {
6901
+ var seq = this.get('seq');
6844
6902
 
6845
- if (!md && seq && this.ref) {
6846
- return generateMD(this.ref, this.record.getReadBases(), this.get('CIGAR'));
6903
+ if (seq && this.ref) {
6904
+ this.cachedMD = generateMD(this.ref, this.get('seq'), this.get('CIGAR'));
6905
+ return this.cachedMD;
6906
+ }
6847
6907
  }
6848
6908
 
6849
6909
  return md;
@@ -7417,7 +7477,7 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7417
7477
  key: "estimateRegionsStats",
7418
7478
  value: function () {
7419
7479
  var _estimateRegionsStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(regions, opts) {
7420
- var _yield$this$configure4, bam, index, bytes, fetchSizeLimit;
7480
+ var _yield$this$configure4, bam, bytes, fetchSizeLimit;
7421
7481
 
7422
7482
  return runtime_1.wrap(function _callee9$(_context9) {
7423
7483
  while (1) {
@@ -7429,18 +7489,16 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7429
7489
  case 2:
7430
7490
  _yield$this$configure4 = _context9.sent;
7431
7491
  bam = _yield$this$configure4.bam;
7432
- // @ts-ignore
7433
- index = bam.index; // this is a method to avoid calling on htsget adapters
7434
7492
 
7435
- if (!(index.filehandle !== '?')) {
7436
- _context9.next = 13;
7493
+ if (!(bam.index.filehandle !== '?')) {
7494
+ _context9.next = 12;
7437
7495
  break;
7438
7496
  }
7439
7497
 
7440
- _context9.next = 8;
7441
- return bytesForRegions(regions, index);
7498
+ _context9.next = 7;
7499
+ return bytesForRegions(regions, bam);
7442
7500
 
7443
- case 8:
7501
+ case 7:
7444
7502
  bytes = _context9.sent;
7445
7503
  fetchSizeLimit = readConfObject(this.config, 'fetchSizeLimit');
7446
7504
  return _context9.abrupt("return", {
@@ -7448,10 +7506,10 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7448
7506
  fetchSizeLimit: fetchSizeLimit
7449
7507
  });
7450
7508
 
7451
- case 13:
7509
+ case 12:
7452
7510
  return _context9.abrupt("return", _get(_getPrototypeOf(BamAdapter.prototype), "estimateRegionsStats", this).call(this, regions, opts));
7453
7511
 
7454
- case 14:
7512
+ case 13:
7455
7513
  case "end":
7456
7514
  return _context9.stop();
7457
7515
  }
@@ -7558,7 +7616,7 @@ var HtsgetBamAdapter$1 = {
7558
7616
  'default': HtsgetBamAdapter
7559
7617
  };
7560
7618
 
7561
- var useStyles = /*#__PURE__*/makeStyles(function (theme) {
7619
+ var useStyles$1 = /*#__PURE__*/makeStyles(function (theme) {
7562
7620
  return {
7563
7621
  root: {
7564
7622
  width: 300
@@ -7573,7 +7631,7 @@ var useStyles = /*#__PURE__*/makeStyles(function (theme) {
7573
7631
  });
7574
7632
 
7575
7633
  function ColorByTagDlg$1(props) {
7576
- var classes = useStyles();
7634
+ var classes = useStyles$1();
7577
7635
  var model = props.model,
7578
7636
  handleClose = props.handleClose;
7579
7637
 
@@ -7636,7 +7694,7 @@ var ColorByTag$1 = {
7636
7694
  'default': ColorByTag
7637
7695
  };
7638
7696
 
7639
- var useStyles$1 = /*#__PURE__*/makeStyles(function (theme) {
7697
+ var useStyles$2 = /*#__PURE__*/makeStyles(function (theme) {
7640
7698
  return {
7641
7699
  root: {
7642
7700
  width: 500
@@ -7694,7 +7752,7 @@ function FilterByTagDlg$1(props) {
7694
7752
 
7695
7753
  var model = props.model,
7696
7754
  handleClose = props.handleClose;
7697
- var classes = useStyles$1();
7755
+ var classes = useStyles$2();
7698
7756
  var filterBy = model.filterBy;
7699
7757
 
7700
7758
  var _useState = useState(filterBy === null || filterBy === void 0 ? void 0 : filterBy.flagInclude),
@@ -7815,7 +7873,7 @@ var FilterByTag$1 = {
7815
7873
  'default': FilterByTag
7816
7874
  };
7817
7875
 
7818
- var useStyles$2 = /*#__PURE__*/makeStyles(function (theme) {
7876
+ var useStyles$3 = /*#__PURE__*/makeStyles(function (theme) {
7819
7877
  return {
7820
7878
  root: {
7821
7879
  margin: 0,
@@ -7831,7 +7889,7 @@ var useStyles$2 = /*#__PURE__*/makeStyles(function (theme) {
7831
7889
  });
7832
7890
 
7833
7891
  function SortByTagDlg$1(props) {
7834
- var classes = useStyles$2();
7892
+ var classes = useStyles$3();
7835
7893
  var model = props.model,
7836
7894
  handleClose = props.handleClose;
7837
7895
 
@@ -7881,7 +7939,7 @@ var SortByTag$1 = {
7881
7939
  'default': SortByTag
7882
7940
  };
7883
7941
 
7884
- var useStyles$3 = /*#__PURE__*/makeStyles(function (theme) {
7942
+ var useStyles$4 = /*#__PURE__*/makeStyles(function (theme) {
7885
7943
  return {
7886
7944
  root: {
7887
7945
  margin: theme.spacing(4)
@@ -7896,7 +7954,7 @@ var useStyles$3 = /*#__PURE__*/makeStyles(function (theme) {
7896
7954
  });
7897
7955
 
7898
7956
  function SetFeatureHeightDlg$1(props) {
7899
- var classes = useStyles$3();
7957
+ var classes = useStyles$4();
7900
7958
  var model = props.model,
7901
7959
  handleClose = props.handleClose;
7902
7960
  var featureHeightSetting = model.featureHeightSetting,
@@ -7959,7 +8017,7 @@ var SetFeatureHeight$1 = {
7959
8017
  'default': SetFeatureHeight
7960
8018
  };
7961
8019
 
7962
- var useStyles$4 = /*#__PURE__*/makeStyles(function (theme) {
8020
+ var useStyles$5 = /*#__PURE__*/makeStyles(function (theme) {
7963
8021
  return {
7964
8022
  root: {
7965
8023
  width: 500
@@ -7979,7 +8037,7 @@ var useStyles$4 = /*#__PURE__*/makeStyles(function (theme) {
7979
8037
  function SetMaxHeightDlg$1(props) {
7980
8038
  var model = props.model,
7981
8039
  handleClose = props.handleClose;
7982
- var classes = useStyles$4();
8040
+ var classes = useStyles$5();
7983
8041
  var _model$maxHeight = model.maxHeight,
7984
8042
  maxHeight = _model$maxHeight === void 0 ? '' : _model$maxHeight;
7985
8043
 
@@ -8026,7 +8084,7 @@ var SetMaxHeight$1 = {
8026
8084
  'default': SetMaxHeight
8027
8085
  };
8028
8086
 
8029
- var useStyles$5 = /*#__PURE__*/makeStyles(function (theme) {
8087
+ var useStyles$6 = /*#__PURE__*/makeStyles(function (theme) {
8030
8088
  return {
8031
8089
  root: {},
8032
8090
  closeButton: {
@@ -8047,7 +8105,7 @@ var useStyles$5 = /*#__PURE__*/makeStyles(function (theme) {
8047
8105
 
8048
8106
  function ModificationTable(_ref) {
8049
8107
  var modifications = _ref.modifications;
8050
- var classes = useStyles$5();
8108
+ var classes = useStyles$6();
8051
8109
  return /*#__PURE__*/React.createElement("table", {
8052
8110
  className: classes.table
8053
8111
  }, /*#__PURE__*/React.createElement("tbody", null, modifications.map(function (_ref2) {
@@ -8067,7 +8125,7 @@ function ModificationTable(_ref) {
8067
8125
  }
8068
8126
 
8069
8127
  function ColorByTagDlg$2(props) {
8070
- var classes = useStyles$5();
8128
+ var classes = useStyles$6();
8071
8129
  var model = props.model,
8072
8130
  handleClose = props.handleClose;
8073
8131
  var colorBy = model.colorBy,
@@ -8141,7 +8199,7 @@ var ColorByModifications$1 = {
8141
8199
  'default': ColorByModifications
8142
8200
  };
8143
8201
 
8144
- var useStyles$6 = /*#__PURE__*/makeStyles(function () {
8202
+ var useStyles$7 = /*#__PURE__*/makeStyles(function () {
8145
8203
  return {
8146
8204
  compact: {
8147
8205
  paddingRight: 0,
@@ -8153,7 +8211,7 @@ var useStyles$6 = /*#__PURE__*/makeStyles(function () {
8153
8211
  var omit = ['clipPos', 'flags']; // eslint-disable-next-line @typescript-eslint/no-explicit-any
8154
8212
 
8155
8213
  function AlignmentFlags(props) {
8156
- var classes = useStyles$6();
8214
+ var classes = useStyles$7();
8157
8215
  var feature = props.feature;
8158
8216
  var flags = feature.flags;
8159
8217
  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'];
@@ -8255,10 +8313,15 @@ function SupplementaryAlignments(props) {
8255
8313
  onClick: function onClick() {
8256
8314
  var view = model.view;
8257
8315
 
8258
- if (view) {
8259
- view.navToLocString(locString);
8260
- } else {
8261
- session.notify('No view associated with this feature detail panel anymore', 'warning');
8316
+ try {
8317
+ if (view) {
8318
+ view.navToLocString(locString);
8319
+ } else {
8320
+ throw new Error('No view associated with this view anymore');
8321
+ }
8322
+ } catch (e) {
8323
+ console.error(e);
8324
+ session.notify("".concat(e));
8262
8325
  }
8263
8326
  },
8264
8327
  href: "#"
@@ -8275,10 +8338,15 @@ function PairLink(_ref2) {
8275
8338
  onClick: function onClick() {
8276
8339
  var view = model.view;
8277
8340
 
8278
- if (view) {
8279
- view.navToLocString(locString);
8280
- } else {
8281
- session.notify('No view associated with this feature detail panel anymore', 'warning');
8341
+ try {
8342
+ if (view) {
8343
+ view.navToLocString(locString);
8344
+ } else {
8345
+ session.notify('No view associated with this feature detail panel anymore', 'warning');
8346
+ }
8347
+ } catch (e) {
8348
+ console.error(e);
8349
+ session.notify("".concat(e));
8282
8350
  }
8283
8351
  },
8284
8352
  href: "#"