@jbrowse/plugin-alignments 1.6.1 → 1.6.5

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.
@@ -2073,7 +2073,7 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2073
2073
  key: "generateCoverageBins",
2074
2074
  value: function () {
2075
2075
  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;
2076
+ var colorBy, _yield$this$configure3, sequenceAdapter, originalRefName, refName, start, end, binMax, skipmap, regionSeq, _yield$sequenceAdapte, _yield$sequenceAdapte2, feat, bins;
2077
2077
 
2078
2078
  return runtime_1.wrap(function _callee5$(_context5) {
2079
2079
  while (1) {
@@ -2088,41 +2088,29 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2088
2088
  sequenceAdapter = _yield$this$configure3.sequenceAdapter;
2089
2089
  originalRefName = region.originalRefName, refName = region.refName, start = region.start, end = region.end;
2090
2090
  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
2091
+ skipmap = {}; // request an extra +1 on the end to get CpG crossing region boundary
2104
2092
 
2105
2093
  if (!sequenceAdapter) {
2106
- _context5.next = 16;
2094
+ _context5.next = 15;
2107
2095
  break;
2108
2096
  }
2109
2097
 
2110
- _context5.next = 12;
2098
+ _context5.next = 11;
2111
2099
  return sequenceAdapter.getFeatures({
2112
2100
  refName: originalRefName || refName,
2113
2101
  start: start,
2114
2102
  end: end + 1,
2115
- assemblyName: 'na'
2103
+ assemblyName: region.assemblyName
2116
2104
  }).pipe(toArray()).toPromise();
2117
2105
 
2118
- case 12:
2106
+ case 11:
2119
2107
  _yield$sequenceAdapte = _context5.sent;
2120
2108
  _yield$sequenceAdapte2 = _slicedToArray(_yield$sequenceAdapte, 1);
2121
2109
  feat = _yield$sequenceAdapte2[0];
2122
2110
  regionSeq = feat === null || feat === void 0 ? void 0 : feat.get('seq');
2123
2111
 
2124
- case 16:
2125
- _context5.next = 18;
2112
+ case 15:
2113
+ _context5.next = 17;
2126
2114
  return features.pipe(reduce(function (bins, feature) {
2127
2115
  var cigar = feature.get('CIGAR');
2128
2116
  var fstart = feature.get('start');
@@ -2133,10 +2121,18 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2133
2121
  for (var j = fstart; j < fend; j++) {
2134
2122
  var i = j - region.start;
2135
2123
 
2136
- if (i >= 0 && i < bins.length) {
2137
- var bin = bins[i];
2124
+ if (i >= 0 && i < binMax) {
2125
+ var bin = bins[i] || {
2126
+ total: 0,
2127
+ lowqual: {},
2128
+ cov: {},
2129
+ delskips: {},
2130
+ noncov: {},
2131
+ ref: {}
2132
+ };
2138
2133
  bin.total++;
2139
2134
  inc(bin, fstrand, 'ref', 'ref');
2135
+ bins[i] = bin;
2140
2136
  }
2141
2137
  }
2142
2138
 
@@ -2299,7 +2295,7 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2299
2295
  start: start,
2300
2296
  end: end,
2301
2297
  strand: strand,
2302
- xs: feature.get('xs') || feature.get('ts') || feature.get('tags').XS || feature.get('tags').TS,
2298
+ xs: getTag(feature, 'XS') || getTag(feature, 'TS'),
2303
2299
  score: 1
2304
2300
  };
2305
2301
  } else {
@@ -2310,16 +2306,16 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2310
2306
  }
2311
2307
 
2312
2308
  return bins;
2313
- }, initBins)).toPromise();
2309
+ }, [])).toPromise();
2314
2310
 
2315
- case 18:
2311
+ case 17:
2316
2312
  bins = _context5.sent;
2317
2313
  return _context5.abrupt("return", {
2318
2314
  bins: bins,
2319
2315
  skipmap: skipmap
2320
2316
  });
2321
2317
 
2322
- case 20:
2318
+ case 19:
2323
2319
  case "end":
2324
2320
  return _context5.stop();
2325
2321
  }
@@ -3459,16 +3455,16 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
3459
3455
  ctx.fillText("(".concat(mismatch.base, ")"), leftPx + 2, topPx + heightPx);
3460
3456
  }
3461
3457
  } 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
3458
+ // fix to avoid bad rendering note that this was also related to chrome
3459
+ // bug https://bugs.chromium.org/p/chromium/issues/detail?id=1131528
3460
+ // also affected firefox ref #1236 #2750
3465
3461
  if (leftPx + widthPx > 0) {
3466
3462
  // make small exons more visible when zoomed far out
3467
- ctx.clearRect(leftPx, topPx, widthPx - (bpPerPx > 10 ? 1.5 : 0), heightPx);
3463
+ var adjustPx = widthPx - (bpPerPx > 10 ? 1.5 : 0);
3464
+ ctx.clearRect(leftPx, topPx, adjustPx, heightPx);
3465
+ ctx.fillStyle = '#333';
3466
+ ctx.fillRect(Math.max(0, leftPx), topPx + heightPx / 2 - 1, adjustPx + (leftPx < 0 ? leftPx : 0), 2);
3468
3467
  }
3469
-
3470
- ctx.fillStyle = '#333';
3471
- ctx.fillRect(leftPx, topPx + heightPx / 2, widthPx, 2);
3472
3468
  }
3473
3469
  } // second pass, draw wide insertion markers on top
3474
3470
 
@@ -7417,7 +7413,7 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7417
7413
  key: "estimateRegionsStats",
7418
7414
  value: function () {
7419
7415
  var _estimateRegionsStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(regions, opts) {
7420
- var _yield$this$configure4, bam, index, bytes, fetchSizeLimit;
7416
+ var _yield$this$configure4, bam, bytes, fetchSizeLimit;
7421
7417
 
7422
7418
  return runtime_1.wrap(function _callee9$(_context9) {
7423
7419
  while (1) {
@@ -7429,18 +7425,16 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7429
7425
  case 2:
7430
7426
  _yield$this$configure4 = _context9.sent;
7431
7427
  bam = _yield$this$configure4.bam;
7432
- // @ts-ignore
7433
- index = bam.index; // this is a method to avoid calling on htsget adapters
7434
7428
 
7435
- if (!(index.filehandle !== '?')) {
7436
- _context9.next = 13;
7429
+ if (!(bam.index.filehandle !== '?')) {
7430
+ _context9.next = 12;
7437
7431
  break;
7438
7432
  }
7439
7433
 
7440
- _context9.next = 8;
7441
- return bytesForRegions(regions, index);
7434
+ _context9.next = 7;
7435
+ return bytesForRegions(regions, bam);
7442
7436
 
7443
- case 8:
7437
+ case 7:
7444
7438
  bytes = _context9.sent;
7445
7439
  fetchSizeLimit = readConfObject(this.config, 'fetchSizeLimit');
7446
7440
  return _context9.abrupt("return", {
@@ -7448,10 +7442,10 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
7448
7442
  fetchSizeLimit: fetchSizeLimit
7449
7443
  });
7450
7444
 
7451
- case 13:
7445
+ case 12:
7452
7446
  return _context9.abrupt("return", _get(_getPrototypeOf(BamAdapter.prototype), "estimateRegionsStats", this).call(this, regions, opts));
7453
7447
 
7454
- case 14:
7448
+ case 13:
7455
7449
  case "end":
7456
7450
  return _context9.stop();
7457
7451
  }