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