@jbrowse/plugin-alignments 1.5.8 → 1.6.2
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.
- package/dist/BamAdapter/BamAdapter.d.ts +5 -0
- package/dist/BamAdapter/BamSlightlyLazyFeature.d.ts +1 -2
- package/dist/CramAdapter/CramAdapter.d.ts +16 -5
- package/dist/LinearAlignmentsDisplay/models/model.d.ts +2 -1
- package/dist/LinearPileupDisplay/model.d.ts +28 -6
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +3 -0
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +1 -0
- package/dist/plugin-alignments.cjs.development.js +557 -346
- package/dist/plugin-alignments.cjs.development.js.map +1 -1
- package/dist/plugin-alignments.cjs.production.min.js +1 -1
- package/dist/plugin-alignments.cjs.production.min.js.map +1 -1
- package/dist/plugin-alignments.esm.js +557 -346
- package/dist/plugin-alignments.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/BamAdapter/BamAdapter.ts +56 -35
- package/src/BamAdapter/BamSlightlyLazyFeature.ts +18 -25
- package/src/BamAdapter/configSchema.ts +2 -2
- package/src/CramAdapter/CramAdapter.ts +105 -91
- package/src/CramAdapter/configSchema.ts +5 -1
- package/src/LinearAlignmentsDisplay/models/model.tsx +4 -3
- package/src/LinearPileupDisplay/configSchema.ts +3 -3
- package/src/LinearPileupDisplay/model.ts +8 -7
- package/src/LinearSNPCoverageDisplay/models/configSchema.ts +1 -5
- package/src/LinearSNPCoverageDisplay/models/model.ts +3 -2
- package/src/PileupRenderer/PileupRenderer.tsx +5 -3
- package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +5 -0
- package/src/index.ts +22 -15
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import { revcom, featureSpanPx, bpSpanPx, iterMap, getContainingTrack, getSession, getContainingView, isSessionModelWithWidgets, renameRegionsIfNeeded, checkAbortSignal } from '@jbrowse/core/util';
|
|
2
|
+
import { revcom, featureSpanPx, bpSpanPx, iterMap, getContainingTrack, getSession, getContainingView, isSessionModelWithWidgets, renameRegionsIfNeeded, checkAbortSignal, updateStatus, bytesForRegions } from '@jbrowse/core/util';
|
|
3
3
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
4
4
|
import { ConfigurationSchema, readConfObject, ConfigurationReference, getConf } from '@jbrowse/core/configuration';
|
|
5
5
|
import { types, addDisposer, getSnapshot, cast, getEnv } from 'mobx-state-tree';
|
|
@@ -149,14 +149,14 @@ function _inherits(subClass, superClass) {
|
|
|
149
149
|
throw new TypeError("Super expression must either be null or a function");
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
153
|
+
constructor: {
|
|
154
|
+
value: subClass,
|
|
155
|
+
writable: true,
|
|
156
|
+
configurable: true
|
|
157
|
+
}
|
|
158
|
+
});
|
|
152
159
|
Object.defineProperty(subClass, "prototype", {
|
|
153
|
-
value: Object.create(superClass && superClass.prototype, {
|
|
154
|
-
constructor: {
|
|
155
|
-
value: subClass,
|
|
156
|
-
writable: true,
|
|
157
|
-
configurable: true
|
|
158
|
-
}
|
|
159
|
-
}),
|
|
160
160
|
writable: false
|
|
161
161
|
});
|
|
162
162
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
@@ -1596,9 +1596,12 @@ var MismatchParser = {
|
|
|
1596
1596
|
};
|
|
1597
1597
|
|
|
1598
1598
|
var configSchemaF = (function (pluginManager) {
|
|
1599
|
-
var types = pluginManager.lib['mobx-state-tree'].types;
|
|
1600
1599
|
return types.late(function () {
|
|
1601
1600
|
return ConfigurationSchema('CramAdapter', {
|
|
1601
|
+
fetchSizeLimit: {
|
|
1602
|
+
type: 'number',
|
|
1603
|
+
defaultValue: 3000000
|
|
1604
|
+
},
|
|
1602
1605
|
cramLocation: {
|
|
1603
1606
|
type: 'fileLocation',
|
|
1604
1607
|
defaultValue: {
|
|
@@ -1663,7 +1666,7 @@ var configSchema = /*#__PURE__*/types.late(function () {
|
|
|
1663
1666
|
},
|
|
1664
1667
|
fetchSizeLimit: {
|
|
1665
1668
|
type: 'number',
|
|
1666
|
-
defaultValue:
|
|
1669
|
+
defaultValue: 5000000
|
|
1667
1670
|
},
|
|
1668
1671
|
sequenceAdapter: {
|
|
1669
1672
|
type: 'frozen',
|
|
@@ -1985,28 +1988,24 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1985
1988
|
}(), opts.signal);
|
|
1986
1989
|
}
|
|
1987
1990
|
}, {
|
|
1988
|
-
key: "
|
|
1991
|
+
key: "estimateRegionsStats",
|
|
1989
1992
|
value: function () {
|
|
1990
|
-
var
|
|
1991
|
-
var
|
|
1992
|
-
_yield$this$configure,
|
|
1993
|
-
subadapter,
|
|
1994
|
-
_args3 = arguments;
|
|
1993
|
+
var _estimateRegionsStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(regions, opts) {
|
|
1994
|
+
var _yield$this$configure, subadapter;
|
|
1995
1995
|
|
|
1996
1996
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1997
1997
|
while (1) {
|
|
1998
1998
|
switch (_context3.prev = _context3.next) {
|
|
1999
1999
|
case 0:
|
|
2000
|
-
|
|
2001
|
-
_context3.next = 3;
|
|
2000
|
+
_context3.next = 2;
|
|
2002
2001
|
return this.configure();
|
|
2003
2002
|
|
|
2004
|
-
case
|
|
2003
|
+
case 2:
|
|
2005
2004
|
_yield$this$configure = _context3.sent;
|
|
2006
2005
|
subadapter = _yield$this$configure.subadapter;
|
|
2007
|
-
return _context3.abrupt("return", subadapter.
|
|
2006
|
+
return _context3.abrupt("return", subadapter.estimateRegionsStats(regions, opts));
|
|
2008
2007
|
|
|
2009
|
-
case
|
|
2008
|
+
case 5:
|
|
2010
2009
|
case "end":
|
|
2011
2010
|
return _context3.stop();
|
|
2012
2011
|
}
|
|
@@ -2014,6 +2013,42 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2014
2013
|
}, _callee3, this);
|
|
2015
2014
|
}));
|
|
2016
2015
|
|
|
2016
|
+
function estimateRegionsStats(_x2, _x3) {
|
|
2017
|
+
return _estimateRegionsStats.apply(this, arguments);
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
return estimateRegionsStats;
|
|
2021
|
+
}()
|
|
2022
|
+
}, {
|
|
2023
|
+
key: "getRefNames",
|
|
2024
|
+
value: function () {
|
|
2025
|
+
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
2026
|
+
var opts,
|
|
2027
|
+
_yield$this$configure2,
|
|
2028
|
+
subadapter,
|
|
2029
|
+
_args4 = arguments;
|
|
2030
|
+
|
|
2031
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2032
|
+
while (1) {
|
|
2033
|
+
switch (_context4.prev = _context4.next) {
|
|
2034
|
+
case 0:
|
|
2035
|
+
opts = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
2036
|
+
_context4.next = 3;
|
|
2037
|
+
return this.configure();
|
|
2038
|
+
|
|
2039
|
+
case 3:
|
|
2040
|
+
_yield$this$configure2 = _context4.sent;
|
|
2041
|
+
subadapter = _yield$this$configure2.subadapter;
|
|
2042
|
+
return _context4.abrupt("return", subadapter.getRefNames(opts));
|
|
2043
|
+
|
|
2044
|
+
case 6:
|
|
2045
|
+
case "end":
|
|
2046
|
+
return _context4.stop();
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
}, _callee4, this);
|
|
2050
|
+
}));
|
|
2051
|
+
|
|
2017
2052
|
function getRefNames() {
|
|
2018
2053
|
return _getRefNames.apply(this, arguments);
|
|
2019
2054
|
}
|
|
@@ -2037,20 +2072,20 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2037
2072
|
}, {
|
|
2038
2073
|
key: "generateCoverageBins",
|
|
2039
2074
|
value: function () {
|
|
2040
|
-
var _generateCoverageBins = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2041
|
-
var colorBy, _yield$this$
|
|
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;
|
|
2042
2077
|
|
|
2043
|
-
return runtime_1.wrap(function
|
|
2078
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2044
2079
|
while (1) {
|
|
2045
|
-
switch (
|
|
2080
|
+
switch (_context5.prev = _context5.next) {
|
|
2046
2081
|
case 0:
|
|
2047
2082
|
colorBy = opts.colorBy;
|
|
2048
|
-
|
|
2083
|
+
_context5.next = 3;
|
|
2049
2084
|
return this.configure();
|
|
2050
2085
|
|
|
2051
2086
|
case 3:
|
|
2052
|
-
_yield$this$
|
|
2053
|
-
sequenceAdapter = _yield$this$
|
|
2087
|
+
_yield$this$configure3 = _context5.sent;
|
|
2088
|
+
sequenceAdapter = _yield$this$configure3.sequenceAdapter;
|
|
2054
2089
|
originalRefName = region.originalRefName, refName = region.refName, start = region.start, end = region.end;
|
|
2055
2090
|
binMax = Math.ceil(region.end - region.start);
|
|
2056
2091
|
skipmap = {};
|
|
@@ -2068,11 +2103,11 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2068
2103
|
}); // request an extra +1 on the end to get CpG crossing region boundary
|
|
2069
2104
|
|
|
2070
2105
|
if (!sequenceAdapter) {
|
|
2071
|
-
|
|
2106
|
+
_context5.next = 16;
|
|
2072
2107
|
break;
|
|
2073
2108
|
}
|
|
2074
2109
|
|
|
2075
|
-
|
|
2110
|
+
_context5.next = 12;
|
|
2076
2111
|
return sequenceAdapter.getFeatures({
|
|
2077
2112
|
refName: originalRefName || refName,
|
|
2078
2113
|
start: start,
|
|
@@ -2081,13 +2116,13 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2081
2116
|
}).pipe(toArray()).toPromise();
|
|
2082
2117
|
|
|
2083
2118
|
case 12:
|
|
2084
|
-
_yield$sequenceAdapte =
|
|
2119
|
+
_yield$sequenceAdapte = _context5.sent;
|
|
2085
2120
|
_yield$sequenceAdapte2 = _slicedToArray(_yield$sequenceAdapte, 1);
|
|
2086
2121
|
feat = _yield$sequenceAdapte2[0];
|
|
2087
2122
|
regionSeq = feat === null || feat === void 0 ? void 0 : feat.get('seq');
|
|
2088
2123
|
|
|
2089
2124
|
case 16:
|
|
2090
|
-
|
|
2125
|
+
_context5.next = 18;
|
|
2091
2126
|
return features.pipe(reduce(function (bins, feature) {
|
|
2092
2127
|
var cigar = feature.get('CIGAR');
|
|
2093
2128
|
var fstart = feature.get('start');
|
|
@@ -2278,21 +2313,21 @@ var SNPCoverageAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2278
2313
|
}, initBins)).toPromise();
|
|
2279
2314
|
|
|
2280
2315
|
case 18:
|
|
2281
|
-
bins =
|
|
2282
|
-
return
|
|
2316
|
+
bins = _context5.sent;
|
|
2317
|
+
return _context5.abrupt("return", {
|
|
2283
2318
|
bins: bins,
|
|
2284
2319
|
skipmap: skipmap
|
|
2285
2320
|
});
|
|
2286
2321
|
|
|
2287
2322
|
case 20:
|
|
2288
2323
|
case "end":
|
|
2289
|
-
return
|
|
2324
|
+
return _context5.stop();
|
|
2290
2325
|
}
|
|
2291
2326
|
}
|
|
2292
|
-
},
|
|
2327
|
+
}, _callee5, this);
|
|
2293
2328
|
}));
|
|
2294
2329
|
|
|
2295
|
-
function generateCoverageBins(
|
|
2330
|
+
function generateCoverageBins(_x4, _x5, _x6) {
|
|
2296
2331
|
return _generateCoverageBins.apply(this, arguments);
|
|
2297
2332
|
}
|
|
2298
2333
|
|
|
@@ -3387,10 +3422,12 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
3387
3422
|
var _baseColor = colorForBase.deletion;
|
|
3388
3423
|
ctx.fillStyle = _baseColor;
|
|
3389
3424
|
ctx.fillRect(leftPx, topPx, widthPx, heightPx);
|
|
3425
|
+
var txt = "".concat(mismatch.length);
|
|
3426
|
+
var rect = ctx.measureText(txt);
|
|
3390
3427
|
|
|
3391
|
-
if (widthPx >=
|
|
3428
|
+
if (widthPx >= rect.width && heightPx >= heightLim) {
|
|
3392
3429
|
ctx.fillStyle = theme.palette.getContrastText(_baseColor);
|
|
3393
|
-
ctx.fillText(
|
|
3430
|
+
ctx.fillText(txt, leftPx + (rightPx - leftPx) / 2 - rect.width / 2, topPx + heightPx);
|
|
3394
3431
|
}
|
|
3395
3432
|
} else if (mismatch.type === 'insertion' && drawIndels) {
|
|
3396
3433
|
ctx.fillStyle = 'purple';
|
|
@@ -3450,19 +3487,20 @@ var PileupRenderer = /*#__PURE__*/function (_BoxRendererType) {
|
|
|
3450
3487
|
|
|
3451
3488
|
var _len = +_mismatch.base || _mismatch.length;
|
|
3452
3489
|
|
|
3453
|
-
var
|
|
3490
|
+
var _txt = "".concat(_len);
|
|
3454
3491
|
|
|
3455
3492
|
if (_mismatch.type === 'insertion' && _len >= 10) {
|
|
3456
3493
|
if (bpPerPx > largeInsertionIndicatorScale) {
|
|
3457
3494
|
ctx.fillStyle = 'purple';
|
|
3458
3495
|
ctx.fillRect(_leftPx2 - 1, topPx, 2, heightPx);
|
|
3459
3496
|
} else if (heightPx > charHeight) {
|
|
3460
|
-
var
|
|
3497
|
+
var _rect = ctx.measureText(_txt);
|
|
3498
|
+
|
|
3461
3499
|
var padding = 5;
|
|
3462
3500
|
ctx.fillStyle = 'purple';
|
|
3463
|
-
ctx.fillRect(_leftPx2 -
|
|
3501
|
+
ctx.fillRect(_leftPx2 - _rect.width / 2 - padding, topPx, _rect.width + 2 * padding, heightPx);
|
|
3464
3502
|
ctx.fillStyle = 'white';
|
|
3465
|
-
ctx.fillText(
|
|
3503
|
+
ctx.fillText(_txt, _leftPx2 - _rect.width / 2, topPx + heightPx);
|
|
3466
3504
|
} else {
|
|
3467
3505
|
var _padding = 2;
|
|
3468
3506
|
ctx.fillStyle = 'purple';
|
|
@@ -4088,7 +4126,8 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
|
|
|
4088
4126
|
configuration: ConfigurationReference(configSchema),
|
|
4089
4127
|
height: 250,
|
|
4090
4128
|
showCoverage: true,
|
|
4091
|
-
showPileup: true
|
|
4129
|
+
showPileup: true,
|
|
4130
|
+
userFeatureScreenDensity: types.maybe(types.number)
|
|
4092
4131
|
}))["volatile"](function () {
|
|
4093
4132
|
return {
|
|
4094
4133
|
scrollTop: 0
|
|
@@ -4181,9 +4220,9 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
|
|
|
4181
4220
|
height: self.snpCovHeight
|
|
4182
4221
|
};
|
|
4183
4222
|
},
|
|
4184
|
-
|
|
4185
|
-
self.PileupDisplay.
|
|
4186
|
-
self.SNPCoverageDisplay.
|
|
4223
|
+
setUserFeatureScreenDensity: function setUserFeatureScreenDensity(limit) {
|
|
4224
|
+
self.PileupDisplay.setUserFeatureScreenDensity(limit);
|
|
4225
|
+
self.SNPCoverageDisplay.setUserFeatureScreenDensity(limit);
|
|
4187
4226
|
},
|
|
4188
4227
|
setPileupDisplay: function setPileupDisplay(displayConfig) {
|
|
4189
4228
|
self.PileupDisplay = {
|
|
@@ -4374,11 +4413,6 @@ function SNPCoverageConfigFactory(pluginManager) {
|
|
|
4374
4413
|
description: 'draw upside down',
|
|
4375
4414
|
defaultValue: false
|
|
4376
4415
|
},
|
|
4377
|
-
maxDisplayedBpPerPx: {
|
|
4378
|
-
type: 'number',
|
|
4379
|
-
description: 'maximum bpPerPx that is displayed in the view',
|
|
4380
|
-
defaultValue: 100
|
|
4381
|
-
},
|
|
4382
4416
|
headroom: {
|
|
4383
4417
|
type: 'number',
|
|
4384
4418
|
description: 'round the upper value of the domain scale to the nearest N',
|
|
@@ -4585,8 +4619,9 @@ var stateModelFactory$1 = function stateModelFactory(pluginManager, configSchema
|
|
|
4585
4619
|
},
|
|
4586
4620
|
|
|
4587
4621
|
renderProps: function renderProps() {
|
|
4588
|
-
|
|
4589
|
-
|
|
4622
|
+
var superProps = superRenderProps();
|
|
4623
|
+
return _objectSpread2(_objectSpread2({}, superProps), {}, {
|
|
4624
|
+
notReady: superProps.notReady || !this.modificationsReady,
|
|
4590
4625
|
filters: self.filters,
|
|
4591
4626
|
modificationTagMap: JSON.parse(JSON.stringify(self.modificationTagMap)),
|
|
4592
4627
|
// must use getSnapshot because otherwise changes to e.g. just the
|
|
@@ -4765,10 +4800,10 @@ function PileupConfigFactory(pluginManager) {
|
|
|
4765
4800
|
SvgFeatureRenderer: SvgFeatureRendererConfigSchema
|
|
4766
4801
|
}),
|
|
4767
4802
|
renderer: '',
|
|
4768
|
-
|
|
4803
|
+
maxFeatureScreenDensity: {
|
|
4769
4804
|
type: 'number',
|
|
4770
|
-
description: 'maximum
|
|
4771
|
-
defaultValue:
|
|
4805
|
+
description: 'maximum features per pixel that is displayed in the view',
|
|
4806
|
+
defaultValue: 5
|
|
4772
4807
|
},
|
|
4773
4808
|
colorScheme: {
|
|
4774
4809
|
type: 'stringEnum',
|
|
@@ -4855,17 +4890,13 @@ var stateModelFactory$2 = function stateModelFactory(configSchema) {
|
|
|
4855
4890
|
return {
|
|
4856
4891
|
colorTagMap: observable.map({}),
|
|
4857
4892
|
modificationTagMap: observable.map({}),
|
|
4858
|
-
ready: false
|
|
4859
|
-
currBpPerPx: 0
|
|
4893
|
+
ready: false
|
|
4860
4894
|
};
|
|
4861
4895
|
}).actions(function (self) {
|
|
4862
4896
|
return {
|
|
4863
4897
|
setReady: function setReady(flag) {
|
|
4864
4898
|
self.ready = flag;
|
|
4865
4899
|
},
|
|
4866
|
-
setCurrBpPerPx: function setCurrBpPerPx(n) {
|
|
4867
|
-
self.currBpPerPx = n;
|
|
4868
|
-
},
|
|
4869
4900
|
setMaxHeight: function setMaxHeight(n) {
|
|
4870
4901
|
self.trackMaxHeight = n;
|
|
4871
4902
|
},
|
|
@@ -5168,14 +5199,14 @@ var stateModelFactory$2 = function stateModelFactory(configSchema) {
|
|
|
5168
5199
|
|
|
5169
5200
|
renderProps: function renderProps() {
|
|
5170
5201
|
var view = getContainingView(self);
|
|
5171
|
-
var
|
|
5172
|
-
colorTagMap = self.colorTagMap,
|
|
5202
|
+
var colorTagMap = self.colorTagMap,
|
|
5173
5203
|
modificationTagMap = self.modificationTagMap,
|
|
5174
5204
|
sortedBy = self.sortedBy,
|
|
5175
5205
|
colorBy = self.colorBy,
|
|
5176
5206
|
rpcDriverName = self.rpcDriverName;
|
|
5177
|
-
|
|
5178
|
-
|
|
5207
|
+
var superProps = superRenderProps();
|
|
5208
|
+
return _objectSpread2(_objectSpread2({}, superProps), {}, {
|
|
5209
|
+
notReady: superProps.notReady || !self.ready || sortedBy && self.currBpPerPx !== view.bpPerPx,
|
|
5179
5210
|
rpcDriverName: rpcDriverName,
|
|
5180
5211
|
displayModel: self,
|
|
5181
5212
|
sortedBy: sortedBy,
|
|
@@ -5668,13 +5699,16 @@ var AlignmentsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
5668
5699
|
var regexGuess = /\.cram$/i;
|
|
5669
5700
|
var adapterName = 'CramAdapter';
|
|
5670
5701
|
var fileName = getFileName(file);
|
|
5702
|
+
var obj = {
|
|
5703
|
+
type: adapterName,
|
|
5704
|
+
cramLocation: file,
|
|
5705
|
+
craiLocation: index || makeIndex(file, '.crai')
|
|
5706
|
+
};
|
|
5671
5707
|
|
|
5672
|
-
if (regexGuess.test(fileName)
|
|
5673
|
-
return
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
craiLocation: index || makeIndex(file, '.crai')
|
|
5677
|
-
};
|
|
5708
|
+
if (regexGuess.test(fileName) && !adapterHint) {
|
|
5709
|
+
return obj;
|
|
5710
|
+
} else if (adapterHint === adapterName) {
|
|
5711
|
+
return obj;
|
|
5678
5712
|
}
|
|
5679
5713
|
|
|
5680
5714
|
return adapterGuesser(file, index, adapterHint);
|
|
@@ -5686,16 +5720,19 @@ var AlignmentsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
5686
5720
|
var adapterName = 'BamAdapter';
|
|
5687
5721
|
var fileName = getFileName(file);
|
|
5688
5722
|
var indexName = index && getFileName(index);
|
|
5723
|
+
var obj = {
|
|
5724
|
+
type: adapterName,
|
|
5725
|
+
bamLocation: file,
|
|
5726
|
+
index: {
|
|
5727
|
+
location: index || makeIndex(file, '.bai'),
|
|
5728
|
+
indexType: makeIndexType(indexName, 'CSI', 'BAI')
|
|
5729
|
+
}
|
|
5730
|
+
};
|
|
5689
5731
|
|
|
5690
|
-
if (regexGuess.test(fileName)
|
|
5691
|
-
return
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
index: {
|
|
5695
|
-
location: index || makeIndex(file, '.bai'),
|
|
5696
|
-
indexType: makeIndexType(indexName, 'CSI', 'BAI')
|
|
5697
|
-
}
|
|
5698
|
-
};
|
|
5732
|
+
if (regexGuess.test(fileName) && !adapterHint) {
|
|
5733
|
+
return obj;
|
|
5734
|
+
} else if (adapterHint === adapterName) {
|
|
5735
|
+
return obj;
|
|
5699
5736
|
}
|
|
5700
5737
|
|
|
5701
5738
|
return adapterGuesser(file, index, adapterHint);
|
|
@@ -6166,7 +6203,7 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6166
6203
|
key: "configure",
|
|
6167
6204
|
value: function () {
|
|
6168
6205
|
var _configure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
6169
|
-
var cramLocation, craiLocation, sequenceAdapterType, _yield$this$getSubAda,
|
|
6206
|
+
var cramLocation, craiLocation, cram, sequenceAdapterType, seqConf, _yield$this$getSubAda, sequenceAdapter;
|
|
6170
6207
|
|
|
6171
6208
|
return runtime_1.wrap(function _callee$(_context) {
|
|
6172
6209
|
while (1) {
|
|
@@ -6191,14 +6228,15 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6191
6228
|
throw new Error('missing craiLocation argument');
|
|
6192
6229
|
|
|
6193
6230
|
case 6:
|
|
6194
|
-
|
|
6231
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6232
|
+
cram = new IndexedCramFile({
|
|
6195
6233
|
cramFilehandle: openLocation(cramLocation, this.pluginManager),
|
|
6196
6234
|
index: new CraiIndex({
|
|
6197
6235
|
filehandle: openLocation(craiLocation, this.pluginManager)
|
|
6198
6236
|
}),
|
|
6199
6237
|
seqFetch: this.seqFetch.bind(this),
|
|
6200
6238
|
checkSequenceMD5: false,
|
|
6201
|
-
fetchSizeLimit:
|
|
6239
|
+
fetchSizeLimit: 200000000
|
|
6202
6240
|
}); // instantiate the sequence adapter
|
|
6203
6241
|
|
|
6204
6242
|
sequenceAdapterType = readConfObject(this.config, ['sequenceAdapter', 'type']);
|
|
@@ -6211,31 +6249,28 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6211
6249
|
throw new Error('Error getting subadapter');
|
|
6212
6250
|
|
|
6213
6251
|
case 10:
|
|
6214
|
-
|
|
6215
|
-
|
|
6252
|
+
seqConf = readConfObject(this.config, 'sequenceAdapter');
|
|
6253
|
+
_context.next = 13;
|
|
6254
|
+
return this.getSubAdapter(seqConf);
|
|
6216
6255
|
|
|
6217
|
-
case
|
|
6256
|
+
case 13:
|
|
6218
6257
|
_yield$this$getSubAda = _context.sent;
|
|
6219
|
-
|
|
6258
|
+
sequenceAdapter = _yield$this$getSubAda.dataAdapter;
|
|
6220
6259
|
|
|
6221
|
-
if (
|
|
6222
|
-
_context.next =
|
|
6260
|
+
if (sequenceAdapter instanceof BaseFeatureDataAdapter) {
|
|
6261
|
+
_context.next = 17;
|
|
6223
6262
|
break;
|
|
6224
6263
|
}
|
|
6225
6264
|
|
|
6226
|
-
this.sequenceAdapter = dataAdapter;
|
|
6227
|
-
_context.next = 19;
|
|
6228
|
-
break;
|
|
6229
|
-
|
|
6230
|
-
case 18:
|
|
6231
6265
|
throw new Error("CRAM feature adapters cannot use sequence adapters of type '".concat(sequenceAdapterType, "'"));
|
|
6232
6266
|
|
|
6233
|
-
case
|
|
6267
|
+
case 17:
|
|
6234
6268
|
return _context.abrupt("return", {
|
|
6235
|
-
|
|
6269
|
+
cram: cram,
|
|
6270
|
+
sequenceAdapter: sequenceAdapter
|
|
6236
6271
|
});
|
|
6237
6272
|
|
|
6238
|
-
case
|
|
6273
|
+
case 18:
|
|
6239
6274
|
case "end":
|
|
6240
6275
|
return _context.stop();
|
|
6241
6276
|
}
|
|
@@ -6253,6 +6288,8 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6253
6288
|
key: "getHeader",
|
|
6254
6289
|
value: function () {
|
|
6255
6290
|
var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(opts) {
|
|
6291
|
+
var _yield$this$configure, cram;
|
|
6292
|
+
|
|
6256
6293
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
6257
6294
|
while (1) {
|
|
6258
6295
|
switch (_context2.prev = _context2.next) {
|
|
@@ -6261,9 +6298,11 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6261
6298
|
return this.configure();
|
|
6262
6299
|
|
|
6263
6300
|
case 2:
|
|
6264
|
-
|
|
6301
|
+
_yield$this$configure = _context2.sent;
|
|
6302
|
+
cram = _yield$this$configure.cram;
|
|
6303
|
+
return _context2.abrupt("return", cram.cram.getHeaderText(opts));
|
|
6265
6304
|
|
|
6266
|
-
case
|
|
6305
|
+
case 5:
|
|
6267
6306
|
case "end":
|
|
6268
6307
|
return _context2.stop();
|
|
6269
6308
|
}
|
|
@@ -6281,69 +6320,63 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6281
6320
|
key: "seqFetch",
|
|
6282
6321
|
value: function () {
|
|
6283
6322
|
var _seqFetch = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(seqId, start, end) {
|
|
6284
|
-
var
|
|
6323
|
+
var _yield$this$configure2, sequenceAdapter, refName, seqChunks, sequence;
|
|
6324
|
+
|
|
6285
6325
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
6286
6326
|
while (1) {
|
|
6287
6327
|
switch (_context3.prev = _context3.next) {
|
|
6288
6328
|
case 0:
|
|
6289
6329
|
start -= 1; // convert from 1-based closed to interbase
|
|
6290
6330
|
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
if (refSeqStore) {
|
|
6294
|
-
_context3.next = 4;
|
|
6295
|
-
break;
|
|
6296
|
-
}
|
|
6297
|
-
|
|
6298
|
-
return _context3.abrupt("return", undefined);
|
|
6331
|
+
_context3.next = 3;
|
|
6332
|
+
return this.configure();
|
|
6299
6333
|
|
|
6300
|
-
case
|
|
6334
|
+
case 3:
|
|
6335
|
+
_yield$this$configure2 = _context3.sent;
|
|
6336
|
+
sequenceAdapter = _yield$this$configure2.sequenceAdapter;
|
|
6301
6337
|
refName = this.refIdToOriginalName(seqId) || this.refIdToName(seqId);
|
|
6302
6338
|
|
|
6303
6339
|
if (refName) {
|
|
6304
|
-
_context3.next =
|
|
6340
|
+
_context3.next = 8;
|
|
6305
6341
|
break;
|
|
6306
6342
|
}
|
|
6307
6343
|
|
|
6308
6344
|
return _context3.abrupt("return", undefined);
|
|
6309
6345
|
|
|
6310
|
-
case
|
|
6311
|
-
|
|
6346
|
+
case 8:
|
|
6347
|
+
_context3.next = 10;
|
|
6348
|
+
return sequenceAdapter.getFeatures({
|
|
6312
6349
|
refName: refName,
|
|
6313
6350
|
start: start,
|
|
6314
6351
|
end: end,
|
|
6315
6352
|
assemblyName: ''
|
|
6316
|
-
}
|
|
6317
|
-
_context3.next = 10;
|
|
6318
|
-
return features.pipe(toArray()).toPromise();
|
|
6353
|
+
}).pipe(toArray()).toPromise();
|
|
6319
6354
|
|
|
6320
6355
|
case 10:
|
|
6321
6356
|
seqChunks = _context3.sent;
|
|
6322
|
-
|
|
6323
|
-
seqChunks.sort(function (a, b) {
|
|
6357
|
+
sequence = seqChunks.sort(function (a, b) {
|
|
6324
6358
|
return a.get('start') - b.get('start');
|
|
6325
|
-
}).
|
|
6359
|
+
}).map(function (chunk) {
|
|
6326
6360
|
var chunkStart = chunk.get('start');
|
|
6327
6361
|
var chunkEnd = chunk.get('end');
|
|
6328
6362
|
var trimStart = Math.max(start - chunkStart, 0);
|
|
6329
6363
|
var trimEnd = Math.min(end - chunkStart, chunkEnd - chunkStart);
|
|
6330
6364
|
var trimLength = trimEnd - trimStart;
|
|
6331
6365
|
var chunkSeq = chunk.get('seq') || chunk.get('residues');
|
|
6332
|
-
|
|
6333
|
-
});
|
|
6334
|
-
sequence = trimmed.join('');
|
|
6366
|
+
return chunkSeq.substr(trimStart, trimLength);
|
|
6367
|
+
}).join('');
|
|
6335
6368
|
|
|
6336
6369
|
if (!(sequence.length !== end - start)) {
|
|
6337
|
-
_context3.next =
|
|
6370
|
+
_context3.next = 14;
|
|
6338
6371
|
break;
|
|
6339
6372
|
}
|
|
6340
6373
|
|
|
6341
6374
|
throw new Error("sequence fetch failed: fetching ".concat(refName, ":").concat((start - 1).toLocaleString(), "-").concat(end.toLocaleString(), " returned ").concat(sequence.length.toLocaleString(), " bases, but should have returned ").concat((end - start).toLocaleString()));
|
|
6342
6375
|
|
|
6343
|
-
case
|
|
6376
|
+
case 14:
|
|
6344
6377
|
return _context3.abrupt("return", sequence);
|
|
6345
6378
|
|
|
6346
|
-
case
|
|
6379
|
+
case 15:
|
|
6347
6380
|
case "end":
|
|
6348
6381
|
return _context3.stop();
|
|
6349
6382
|
}
|
|
@@ -6357,77 +6390,91 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6357
6390
|
|
|
6358
6391
|
return seqFetch;
|
|
6359
6392
|
}()
|
|
6393
|
+
}, {
|
|
6394
|
+
key: "setupPre",
|
|
6395
|
+
value: function () {
|
|
6396
|
+
var _setupPre = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(opts) {
|
|
6397
|
+
var _ref, _ref$statusCallback, statusCallback, configured, cram, samHeader, idToName, nameToId, readGroups, data;
|
|
6398
|
+
|
|
6399
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
6400
|
+
while (1) {
|
|
6401
|
+
switch (_context4.prev = _context4.next) {
|
|
6402
|
+
case 0:
|
|
6403
|
+
_ref = opts || {}, _ref$statusCallback = _ref.statusCallback, statusCallback = _ref$statusCallback === void 0 ? function () {} : _ref$statusCallback;
|
|
6404
|
+
_context4.next = 3;
|
|
6405
|
+
return this.configure();
|
|
6406
|
+
|
|
6407
|
+
case 3:
|
|
6408
|
+
configured = _context4.sent;
|
|
6409
|
+
statusCallback('Downloading index');
|
|
6410
|
+
cram = configured.cram;
|
|
6411
|
+
_context4.next = 8;
|
|
6412
|
+
return cram.cram.getSamHeader(opts === null || opts === void 0 ? void 0 : opts.signal);
|
|
6413
|
+
|
|
6414
|
+
case 8:
|
|
6415
|
+
samHeader = _context4.sent;
|
|
6416
|
+
// use the @SQ lines in the header to figure out the
|
|
6417
|
+
// mapping between ref ID numbers and names
|
|
6418
|
+
idToName = [];
|
|
6419
|
+
nameToId = {};
|
|
6420
|
+
samHeader.filter(function (l) {
|
|
6421
|
+
return l.tag === 'SQ';
|
|
6422
|
+
}).forEach(function (sqLine, refId) {
|
|
6423
|
+
sqLine.data.forEach(function (item) {
|
|
6424
|
+
if (item.tag === 'SN') {
|
|
6425
|
+
// this is the ref name
|
|
6426
|
+
var refName = item.value;
|
|
6427
|
+
nameToId[refName] = refId;
|
|
6428
|
+
idToName[refId] = refName;
|
|
6429
|
+
}
|
|
6430
|
+
});
|
|
6431
|
+
});
|
|
6432
|
+
readGroups = samHeader.filter(function (l) {
|
|
6433
|
+
return l.tag === 'RG';
|
|
6434
|
+
}).map(function (rgLine) {
|
|
6435
|
+
var _rgLine$data$find;
|
|
6436
|
+
|
|
6437
|
+
return (_rgLine$data$find = rgLine.data.find(function (item) {
|
|
6438
|
+
return item.tag === 'ID';
|
|
6439
|
+
})) === null || _rgLine$data$find === void 0 ? void 0 : _rgLine$data$find.value;
|
|
6440
|
+
});
|
|
6441
|
+
data = {
|
|
6442
|
+
idToName: idToName,
|
|
6443
|
+
nameToId: nameToId,
|
|
6444
|
+
readGroups: readGroups
|
|
6445
|
+
};
|
|
6446
|
+
statusCallback('');
|
|
6447
|
+
this.samHeader = data;
|
|
6448
|
+
return _context4.abrupt("return", _objectSpread2({
|
|
6449
|
+
samHeader: data
|
|
6450
|
+
}, configured));
|
|
6451
|
+
|
|
6452
|
+
case 17:
|
|
6453
|
+
case "end":
|
|
6454
|
+
return _context4.stop();
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6457
|
+
}, _callee4, this);
|
|
6458
|
+
}));
|
|
6459
|
+
|
|
6460
|
+
function setupPre(_x5) {
|
|
6461
|
+
return _setupPre.apply(this, arguments);
|
|
6462
|
+
}
|
|
6463
|
+
|
|
6464
|
+
return setupPre;
|
|
6465
|
+
}()
|
|
6360
6466
|
}, {
|
|
6361
6467
|
key: "setup",
|
|
6362
6468
|
value: function () {
|
|
6363
6469
|
var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(opts) {
|
|
6364
6470
|
var _this2 = this;
|
|
6365
6471
|
|
|
6366
|
-
var _ref, _ref$statusCallback, statusCallback;
|
|
6367
|
-
|
|
6368
6472
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
6369
6473
|
while (1) {
|
|
6370
6474
|
switch (_context5.prev = _context5.next) {
|
|
6371
6475
|
case 0:
|
|
6372
|
-
_ref = opts || {}, _ref$statusCallback = _ref.statusCallback, statusCallback = _ref$statusCallback === void 0 ? function () {} : _ref$statusCallback;
|
|
6373
|
-
|
|
6374
6476
|
if (!this.setupP) {
|
|
6375
|
-
this.setupP = this.
|
|
6376
|
-
var samHeader, idToName, nameToId, readGroups;
|
|
6377
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
6378
|
-
while (1) {
|
|
6379
|
-
switch (_context4.prev = _context4.next) {
|
|
6380
|
-
case 0:
|
|
6381
|
-
statusCallback('Downloading index');
|
|
6382
|
-
_context4.next = 3;
|
|
6383
|
-
return _this2.cram.cram.getSamHeader(opts === null || opts === void 0 ? void 0 : opts.signal);
|
|
6384
|
-
|
|
6385
|
-
case 3:
|
|
6386
|
-
samHeader = _context4.sent;
|
|
6387
|
-
// use the @SQ lines in the header to figure out the
|
|
6388
|
-
// mapping between ref ID numbers and names
|
|
6389
|
-
idToName = [];
|
|
6390
|
-
nameToId = {};
|
|
6391
|
-
samHeader.filter(function (l) {
|
|
6392
|
-
return l.tag === 'SQ';
|
|
6393
|
-
}).forEach(function (sqLine, refId) {
|
|
6394
|
-
sqLine.data.forEach(function (item) {
|
|
6395
|
-
if (item.tag === 'SN') {
|
|
6396
|
-
// this is the ref name
|
|
6397
|
-
var refName = item.value;
|
|
6398
|
-
nameToId[refName] = refId;
|
|
6399
|
-
idToName[refId] = refName;
|
|
6400
|
-
}
|
|
6401
|
-
});
|
|
6402
|
-
});
|
|
6403
|
-
readGroups = samHeader.filter(function (l) {
|
|
6404
|
-
return l.tag === 'RG';
|
|
6405
|
-
}).map(function (rgLine) {
|
|
6406
|
-
var _rgLine$data$find;
|
|
6407
|
-
|
|
6408
|
-
return (_rgLine$data$find = rgLine.data.find(function (item) {
|
|
6409
|
-
return item.tag === 'ID';
|
|
6410
|
-
})) === null || _rgLine$data$find === void 0 ? void 0 : _rgLine$data$find.value;
|
|
6411
|
-
});
|
|
6412
|
-
|
|
6413
|
-
if (idToName.length) {
|
|
6414
|
-
_this2.samHeader = {
|
|
6415
|
-
idToName: idToName,
|
|
6416
|
-
nameToId: nameToId,
|
|
6417
|
-
readGroups: readGroups
|
|
6418
|
-
};
|
|
6419
|
-
}
|
|
6420
|
-
|
|
6421
|
-
statusCallback('');
|
|
6422
|
-
return _context4.abrupt("return", _this2.samHeader);
|
|
6423
|
-
|
|
6424
|
-
case 11:
|
|
6425
|
-
case "end":
|
|
6426
|
-
return _context4.stop();
|
|
6427
|
-
}
|
|
6428
|
-
}
|
|
6429
|
-
}, _callee4);
|
|
6430
|
-
})))["catch"](function (e) {
|
|
6477
|
+
this.setupP = this.setupPre(opts)["catch"](function (e) {
|
|
6431
6478
|
_this2.setupP = undefined;
|
|
6432
6479
|
throw e;
|
|
6433
6480
|
});
|
|
@@ -6435,7 +6482,7 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6435
6482
|
|
|
6436
6483
|
return _context5.abrupt("return", this.setupP);
|
|
6437
6484
|
|
|
6438
|
-
case
|
|
6485
|
+
case 2:
|
|
6439
6486
|
case "end":
|
|
6440
6487
|
return _context5.stop();
|
|
6441
6488
|
}
|
|
@@ -6443,7 +6490,7 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6443
6490
|
}, _callee5, this);
|
|
6444
6491
|
}));
|
|
6445
6492
|
|
|
6446
|
-
function setup(
|
|
6493
|
+
function setup(_x6) {
|
|
6447
6494
|
return _setup.apply(this, arguments);
|
|
6448
6495
|
}
|
|
6449
6496
|
|
|
@@ -6453,6 +6500,8 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6453
6500
|
key: "getRefNames",
|
|
6454
6501
|
value: function () {
|
|
6455
6502
|
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(opts) {
|
|
6503
|
+
var _yield$this$setup, samHeader;
|
|
6504
|
+
|
|
6456
6505
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
6457
6506
|
while (1) {
|
|
6458
6507
|
switch (_context6.prev = _context6.next) {
|
|
@@ -6461,23 +6510,18 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6461
6510
|
return this.setup(opts);
|
|
6462
6511
|
|
|
6463
6512
|
case 2:
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
break;
|
|
6467
|
-
}
|
|
6468
|
-
|
|
6469
|
-
return _context6.abrupt("return", this.samHeader.idToName);
|
|
6513
|
+
_yield$this$setup = _context6.sent;
|
|
6514
|
+
samHeader = _yield$this$setup.samHeader;
|
|
6470
6515
|
|
|
6471
|
-
|
|
6472
|
-
if (!this.sequenceAdapter) {
|
|
6516
|
+
if (samHeader.idToName) {
|
|
6473
6517
|
_context6.next = 6;
|
|
6474
6518
|
break;
|
|
6475
6519
|
}
|
|
6476
6520
|
|
|
6477
|
-
|
|
6521
|
+
throw new Error('CRAM file has no header lines');
|
|
6478
6522
|
|
|
6479
6523
|
case 6:
|
|
6480
|
-
|
|
6524
|
+
return _context6.abrupt("return", samHeader.idToName);
|
|
6481
6525
|
|
|
6482
6526
|
case 7:
|
|
6483
6527
|
case "end":
|
|
@@ -6487,7 +6531,7 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6487
6531
|
}, _callee6, this);
|
|
6488
6532
|
}));
|
|
6489
6533
|
|
|
6490
|
-
function getRefNames(
|
|
6534
|
+
function getRefNames(_x7) {
|
|
6491
6535
|
return _getRefNames.apply(this, arguments);
|
|
6492
6536
|
}
|
|
6493
6537
|
|
|
@@ -6533,18 +6577,19 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6533
6577
|
value: function getFeatures(region, opts) {
|
|
6534
6578
|
var _this3 = this;
|
|
6535
6579
|
|
|
6536
|
-
var
|
|
6537
|
-
signal =
|
|
6538
|
-
|
|
6539
|
-
statusCallback =
|
|
6580
|
+
var _ref2 = opts || {},
|
|
6581
|
+
signal = _ref2.signal,
|
|
6582
|
+
_ref2$statusCallback = _ref2.statusCallback,
|
|
6583
|
+
statusCallback = _ref2$statusCallback === void 0 ? function () {} : _ref2$statusCallback;
|
|
6540
6584
|
|
|
6541
6585
|
var refName = region.refName,
|
|
6542
6586
|
start = region.start,
|
|
6543
6587
|
end = region.end,
|
|
6544
6588
|
originalRefName = region.originalRefName;
|
|
6545
6589
|
return ObservableCreate( /*#__PURE__*/function () {
|
|
6546
|
-
var
|
|
6547
|
-
var refId, records;
|
|
6590
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(observer) {
|
|
6591
|
+
var _yield$_this3$setup, cram, sequenceAdapter, refId, records;
|
|
6592
|
+
|
|
6548
6593
|
return runtime_1.wrap(function _callee7$(_context7) {
|
|
6549
6594
|
while (1) {
|
|
6550
6595
|
switch (_context7.prev = _context7.next) {
|
|
@@ -6553,22 +6598,27 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6553
6598
|
return _this3.setup(opts);
|
|
6554
6599
|
|
|
6555
6600
|
case 2:
|
|
6556
|
-
|
|
6557
|
-
|
|
6601
|
+
_yield$_this3$setup = _context7.sent;
|
|
6602
|
+
cram = _yield$_this3$setup.cram;
|
|
6603
|
+
sequenceAdapter = _yield$_this3$setup.sequenceAdapter;
|
|
6604
|
+
statusCallback('Downloading alignments');
|
|
6605
|
+
|
|
6606
|
+
if (_this3.seqIdToRefName) {
|
|
6607
|
+
_context7.next = 10;
|
|
6558
6608
|
break;
|
|
6559
6609
|
}
|
|
6560
6610
|
|
|
6561
|
-
_context7.next =
|
|
6562
|
-
return
|
|
6611
|
+
_context7.next = 9;
|
|
6612
|
+
return sequenceAdapter.getRefNames(opts);
|
|
6563
6613
|
|
|
6564
|
-
case
|
|
6614
|
+
case 9:
|
|
6565
6615
|
_this3.seqIdToRefName = _context7.sent;
|
|
6566
6616
|
|
|
6567
|
-
case
|
|
6617
|
+
case 10:
|
|
6568
6618
|
refId = _this3.refNameToId(refName);
|
|
6569
6619
|
|
|
6570
6620
|
if (!(refId !== undefined)) {
|
|
6571
|
-
_context7.next =
|
|
6621
|
+
_context7.next = 20;
|
|
6572
6622
|
break;
|
|
6573
6623
|
}
|
|
6574
6624
|
|
|
@@ -6576,23 +6626,27 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6576
6626
|
_this3.seqIdToOriginalRefName[refId] = originalRefName;
|
|
6577
6627
|
}
|
|
6578
6628
|
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
return _this3.cram.getRecordsForRange(refId, start, end, opts);
|
|
6629
|
+
_context7.next = 15;
|
|
6630
|
+
return cram.getRecordsForRange(refId, start, end, opts);
|
|
6582
6631
|
|
|
6583
|
-
case
|
|
6632
|
+
case 15:
|
|
6584
6633
|
records = _context7.sent;
|
|
6585
6634
|
checkAbortSignal(signal); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6586
6635
|
|
|
6587
6636
|
records.forEach(function (record) {
|
|
6588
6637
|
observer.next(_this3.cramRecordToFeature(record));
|
|
6589
6638
|
});
|
|
6639
|
+
_context7.next = 21;
|
|
6640
|
+
break;
|
|
6590
6641
|
|
|
6591
|
-
case
|
|
6642
|
+
case 20:
|
|
6643
|
+
console.warn('Unknown refName', refName);
|
|
6644
|
+
|
|
6645
|
+
case 21:
|
|
6592
6646
|
statusCallback('');
|
|
6593
6647
|
observer.complete();
|
|
6594
6648
|
|
|
6595
|
-
case
|
|
6649
|
+
case 23:
|
|
6596
6650
|
case "end":
|
|
6597
6651
|
return _context7.stop();
|
|
6598
6652
|
}
|
|
@@ -6600,8 +6654,8 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6600
6654
|
}, _callee7);
|
|
6601
6655
|
}));
|
|
6602
6656
|
|
|
6603
|
-
return function (
|
|
6604
|
-
return
|
|
6657
|
+
return function (_x8) {
|
|
6658
|
+
return _ref3.apply(this, arguments);
|
|
6605
6659
|
};
|
|
6606
6660
|
}(), signal);
|
|
6607
6661
|
}
|
|
@@ -6609,13 +6663,102 @@ var CramAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6609
6663
|
key: "freeResources",
|
|
6610
6664
|
value: function
|
|
6611
6665
|
/* { region } */
|
|
6612
|
-
freeResources() {}
|
|
6613
|
-
|
|
6666
|
+
freeResources() {}
|
|
6614
6667
|
}, {
|
|
6615
6668
|
key: "cramRecordToFeature",
|
|
6616
6669
|
value: function cramRecordToFeature(record) {
|
|
6617
6670
|
return new CramSlightlyLazyFeature(record, this);
|
|
6618
|
-
}
|
|
6671
|
+
} // we return the configured fetchSizeLimit, and the bytes for the region
|
|
6672
|
+
|
|
6673
|
+
}, {
|
|
6674
|
+
key: "estimateRegionsStats",
|
|
6675
|
+
value: function () {
|
|
6676
|
+
var _estimateRegionsStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(regions, opts) {
|
|
6677
|
+
var bytes, fetchSizeLimit;
|
|
6678
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
6679
|
+
while (1) {
|
|
6680
|
+
switch (_context8.prev = _context8.next) {
|
|
6681
|
+
case 0:
|
|
6682
|
+
_context8.next = 2;
|
|
6683
|
+
return this.bytesForRegions(regions, opts);
|
|
6684
|
+
|
|
6685
|
+
case 2:
|
|
6686
|
+
bytes = _context8.sent;
|
|
6687
|
+
fetchSizeLimit = readConfObject(this.config, 'fetchSizeLimit');
|
|
6688
|
+
return _context8.abrupt("return", {
|
|
6689
|
+
bytes: bytes,
|
|
6690
|
+
fetchSizeLimit: fetchSizeLimit
|
|
6691
|
+
});
|
|
6692
|
+
|
|
6693
|
+
case 5:
|
|
6694
|
+
case "end":
|
|
6695
|
+
return _context8.stop();
|
|
6696
|
+
}
|
|
6697
|
+
}
|
|
6698
|
+
}, _callee8, this);
|
|
6699
|
+
}));
|
|
6700
|
+
|
|
6701
|
+
function estimateRegionsStats(_x9, _x10) {
|
|
6702
|
+
return _estimateRegionsStats.apply(this, arguments);
|
|
6703
|
+
}
|
|
6704
|
+
|
|
6705
|
+
return estimateRegionsStats;
|
|
6706
|
+
}()
|
|
6707
|
+
/**
|
|
6708
|
+
* get the approximate number of bytes queried from the file for the given
|
|
6709
|
+
* query regions
|
|
6710
|
+
* @param regions - list of query regions
|
|
6711
|
+
*/
|
|
6712
|
+
|
|
6713
|
+
}, {
|
|
6714
|
+
key: "bytesForRegions",
|
|
6715
|
+
value: function () {
|
|
6716
|
+
var _bytesForRegions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(regions, _opts) {
|
|
6717
|
+
var _this4 = this;
|
|
6718
|
+
|
|
6719
|
+
var _yield$this$configure3, cram, blockResults;
|
|
6720
|
+
|
|
6721
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
6722
|
+
while (1) {
|
|
6723
|
+
switch (_context9.prev = _context9.next) {
|
|
6724
|
+
case 0:
|
|
6725
|
+
_context9.next = 2;
|
|
6726
|
+
return this.configure();
|
|
6727
|
+
|
|
6728
|
+
case 2:
|
|
6729
|
+
_yield$this$configure3 = _context9.sent;
|
|
6730
|
+
cram = _yield$this$configure3.cram;
|
|
6731
|
+
_context9.next = 6;
|
|
6732
|
+
return Promise.all(regions.map(function (region) {
|
|
6733
|
+
var refName = region.refName,
|
|
6734
|
+
start = region.start,
|
|
6735
|
+
end = region.end;
|
|
6736
|
+
|
|
6737
|
+
var chrId = _this4.refNameToId(refName);
|
|
6738
|
+
|
|
6739
|
+
return cram.index.getEntriesForRange(chrId, start, end);
|
|
6740
|
+
}));
|
|
6741
|
+
|
|
6742
|
+
case 6:
|
|
6743
|
+
blockResults = _context9.sent;
|
|
6744
|
+
return _context9.abrupt("return", blockResults.flat().reduce(function (a, b) {
|
|
6745
|
+
return a + b.sliceBytes;
|
|
6746
|
+
}, 0));
|
|
6747
|
+
|
|
6748
|
+
case 8:
|
|
6749
|
+
case "end":
|
|
6750
|
+
return _context9.stop();
|
|
6751
|
+
}
|
|
6752
|
+
}
|
|
6753
|
+
}, _callee9, this);
|
|
6754
|
+
}));
|
|
6755
|
+
|
|
6756
|
+
function bytesForRegions(_x11, _x12) {
|
|
6757
|
+
return _bytesForRegions.apply(this, arguments);
|
|
6758
|
+
}
|
|
6759
|
+
|
|
6760
|
+
return bytesForRegions;
|
|
6761
|
+
}()
|
|
6619
6762
|
}]);
|
|
6620
6763
|
|
|
6621
6764
|
return CramAdapter;
|
|
@@ -6653,7 +6796,6 @@ var BamSlightlyLazyFeature = /*#__PURE__*/function () {
|
|
|
6653
6796
|
}, {
|
|
6654
6797
|
key: "_get_flags",
|
|
6655
6798
|
value: function _get_flags() {
|
|
6656
|
-
// @ts-ignore
|
|
6657
6799
|
return this.record.flags;
|
|
6658
6800
|
}
|
|
6659
6801
|
}, {
|
|
@@ -6661,12 +6803,6 @@ var BamSlightlyLazyFeature = /*#__PURE__*/function () {
|
|
|
6661
6803
|
value: function _get_strand() {
|
|
6662
6804
|
return this.record.isReverseComplemented() ? -1 : 1;
|
|
6663
6805
|
}
|
|
6664
|
-
}, {
|
|
6665
|
-
key: "_get_read_group_id",
|
|
6666
|
-
value: function _get_read_group_id() {
|
|
6667
|
-
// @ts-ignore
|
|
6668
|
-
return this.record.readGroupId;
|
|
6669
|
-
}
|
|
6670
6806
|
}, {
|
|
6671
6807
|
key: "_get_pair_orientation",
|
|
6672
6808
|
value: function _get_pair_orientation() {
|
|
@@ -6691,7 +6827,9 @@ var BamSlightlyLazyFeature = /*#__PURE__*/function () {
|
|
|
6691
6827
|
}, {
|
|
6692
6828
|
key: "_get_next_segment_position",
|
|
6693
6829
|
value: function _get_next_segment_position() {
|
|
6694
|
-
|
|
6830
|
+
var record = this.record,
|
|
6831
|
+
adapter = this.adapter;
|
|
6832
|
+
return record.isPaired() ? "".concat(adapter.refIdToName(record._next_refid()), ":").concat(record._next_pos() + 1) : undefined;
|
|
6695
6833
|
}
|
|
6696
6834
|
}, {
|
|
6697
6835
|
key: "_get_seq",
|
|
@@ -6863,7 +7001,7 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6863
7001
|
// configure method allows derived classes to override this behavior
|
|
6864
7002
|
function () {
|
|
6865
7003
|
var _configure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
6866
|
-
var bamLocation, location, indexType, chunkSizeLimit,
|
|
7004
|
+
var bamLocation, location, indexType, chunkSizeLimit, bam, adapterConfig;
|
|
6867
7005
|
return runtime_1.wrap(function _callee$(_context) {
|
|
6868
7006
|
while (1) {
|
|
6869
7007
|
switch (_context.prev = _context.next) {
|
|
@@ -6873,13 +7011,12 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6873
7011
|
location = readConfObject(this.config, ['index', 'location']);
|
|
6874
7012
|
indexType = readConfObject(this.config, ['index', 'indexType']);
|
|
6875
7013
|
chunkSizeLimit = readConfObject(this.config, 'chunkSizeLimit');
|
|
6876
|
-
fetchSizeLimit = readConfObject(this.config, 'fetchSizeLimit');
|
|
6877
7014
|
bam = new BamFile({
|
|
6878
7015
|
bamFilehandle: openLocation(bamLocation, this.pluginManager),
|
|
6879
7016
|
csiFilehandle: indexType === 'CSI' ? openLocation(location, this.pluginManager) : undefined,
|
|
6880
7017
|
baiFilehandle: indexType !== 'CSI' ? openLocation(location, this.pluginManager) : undefined,
|
|
6881
7018
|
chunkSizeLimit: chunkSizeLimit,
|
|
6882
|
-
fetchSizeLimit:
|
|
7019
|
+
fetchSizeLimit: 100000000
|
|
6883
7020
|
});
|
|
6884
7021
|
adapterConfig = readConfObject(this.config, 'sequenceAdapter');
|
|
6885
7022
|
|
|
@@ -6947,87 +7084,109 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
6947
7084
|
return getHeader;
|
|
6948
7085
|
}()
|
|
6949
7086
|
}, {
|
|
6950
|
-
key: "
|
|
7087
|
+
key: "setupPre",
|
|
6951
7088
|
value: function () {
|
|
6952
|
-
var
|
|
6953
|
-
var
|
|
6954
|
-
|
|
6955
|
-
var _ref2, _ref2$statusCallback, statusCallback;
|
|
7089
|
+
var _setupPre = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(opts) {
|
|
7090
|
+
var _ref2, _ref2$statusCallback, statusCallback, _yield$this$configure2, bam;
|
|
6956
7091
|
|
|
6957
7092
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
6958
7093
|
while (1) {
|
|
6959
7094
|
switch (_context4.prev = _context4.next) {
|
|
6960
7095
|
case 0:
|
|
6961
|
-
// note that derived classes may not provide a BAM directly so this is
|
|
6962
|
-
// conditional
|
|
6963
7096
|
_ref2 = opts || {}, _ref2$statusCallback = _ref2.statusCallback, statusCallback = _ref2$statusCallback === void 0 ? function () {} : _ref2$statusCallback;
|
|
7097
|
+
_context4.next = 3;
|
|
7098
|
+
return this.configure();
|
|
6964
7099
|
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
}, _callee3);
|
|
7009
|
-
}));
|
|
7100
|
+
case 3:
|
|
7101
|
+
_yield$this$configure2 = _context4.sent;
|
|
7102
|
+
bam = _yield$this$configure2.bam;
|
|
7103
|
+
_context4.next = 7;
|
|
7104
|
+
return updateStatus('Downloading index', statusCallback, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
7105
|
+
var samHeader, idToName, nameToId;
|
|
7106
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
7107
|
+
while (1) {
|
|
7108
|
+
switch (_context3.prev = _context3.next) {
|
|
7109
|
+
case 0:
|
|
7110
|
+
_context3.next = 2;
|
|
7111
|
+
return bam.getHeader(opts);
|
|
7112
|
+
|
|
7113
|
+
case 2:
|
|
7114
|
+
samHeader = _context3.sent;
|
|
7115
|
+
// use the @SQ lines in the header to figure out the
|
|
7116
|
+
// mapping between ref ref ID numbers and names
|
|
7117
|
+
idToName = [];
|
|
7118
|
+
nameToId = {};
|
|
7119
|
+
samHeader.filter(function (l) {
|
|
7120
|
+
return l.tag === 'SQ';
|
|
7121
|
+
}).forEach(function (sqLine, refId) {
|
|
7122
|
+
sqLine.data.forEach(function (item) {
|
|
7123
|
+
if (item.tag === 'SN') {
|
|
7124
|
+
// this is the ref name
|
|
7125
|
+
var refName = item.value;
|
|
7126
|
+
nameToId[refName] = refId;
|
|
7127
|
+
idToName[refId] = refName;
|
|
7128
|
+
}
|
|
7129
|
+
});
|
|
7130
|
+
});
|
|
7131
|
+
return _context3.abrupt("return", {
|
|
7132
|
+
idToName: idToName,
|
|
7133
|
+
nameToId: nameToId
|
|
7134
|
+
});
|
|
7135
|
+
|
|
7136
|
+
case 7:
|
|
7137
|
+
case "end":
|
|
7138
|
+
return _context3.stop();
|
|
7139
|
+
}
|
|
7140
|
+
}
|
|
7141
|
+
}, _callee3);
|
|
7142
|
+
})));
|
|
7010
7143
|
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7144
|
+
case 7:
|
|
7145
|
+
this.samHeader = _context4.sent;
|
|
7146
|
+
return _context4.abrupt("return", this.samHeader);
|
|
7147
|
+
|
|
7148
|
+
case 9:
|
|
7149
|
+
case "end":
|
|
7150
|
+
return _context4.stop();
|
|
7151
|
+
}
|
|
7152
|
+
}
|
|
7153
|
+
}, _callee4, this);
|
|
7154
|
+
}));
|
|
7155
|
+
|
|
7156
|
+
function setupPre(_x2) {
|
|
7157
|
+
return _setupPre.apply(this, arguments);
|
|
7158
|
+
}
|
|
7159
|
+
|
|
7160
|
+
return setupPre;
|
|
7161
|
+
}()
|
|
7162
|
+
}, {
|
|
7163
|
+
key: "setup",
|
|
7164
|
+
value: function () {
|
|
7165
|
+
var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(opts) {
|
|
7166
|
+
var _this = this;
|
|
7167
|
+
|
|
7168
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
7169
|
+
while (1) {
|
|
7170
|
+
switch (_context5.prev = _context5.next) {
|
|
7171
|
+
case 0:
|
|
7172
|
+
if (!this.setupP) {
|
|
7173
|
+
this.setupP = this.setupPre(opts)["catch"](function (e) {
|
|
7015
7174
|
_this.setupP = undefined;
|
|
7016
7175
|
throw e;
|
|
7017
7176
|
});
|
|
7018
7177
|
}
|
|
7019
7178
|
|
|
7020
|
-
return
|
|
7179
|
+
return _context5.abrupt("return", this.setupP);
|
|
7021
7180
|
|
|
7022
|
-
case
|
|
7181
|
+
case 2:
|
|
7023
7182
|
case "end":
|
|
7024
|
-
return
|
|
7183
|
+
return _context5.stop();
|
|
7025
7184
|
}
|
|
7026
7185
|
}
|
|
7027
|
-
},
|
|
7186
|
+
}, _callee5, this);
|
|
7028
7187
|
}));
|
|
7029
7188
|
|
|
7030
|
-
function setup(
|
|
7189
|
+
function setup(_x3) {
|
|
7031
7190
|
return _setup.apply(this, arguments);
|
|
7032
7191
|
}
|
|
7033
7192
|
|
|
@@ -7036,27 +7195,27 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
7036
7195
|
}, {
|
|
7037
7196
|
key: "getRefNames",
|
|
7038
7197
|
value: function () {
|
|
7039
|
-
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
7198
|
+
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(opts) {
|
|
7040
7199
|
var _yield$this$setup, idToName;
|
|
7041
7200
|
|
|
7042
|
-
return runtime_1.wrap(function
|
|
7201
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
7043
7202
|
while (1) {
|
|
7044
|
-
switch (
|
|
7203
|
+
switch (_context6.prev = _context6.next) {
|
|
7045
7204
|
case 0:
|
|
7046
|
-
|
|
7205
|
+
_context6.next = 2;
|
|
7047
7206
|
return this.setup(opts);
|
|
7048
7207
|
|
|
7049
7208
|
case 2:
|
|
7050
|
-
_yield$this$setup =
|
|
7209
|
+
_yield$this$setup = _context6.sent;
|
|
7051
7210
|
idToName = _yield$this$setup.idToName;
|
|
7052
|
-
return
|
|
7211
|
+
return _context6.abrupt("return", idToName);
|
|
7053
7212
|
|
|
7054
7213
|
case 5:
|
|
7055
7214
|
case "end":
|
|
7056
|
-
return
|
|
7215
|
+
return _context6.stop();
|
|
7057
7216
|
}
|
|
7058
7217
|
}
|
|
7059
|
-
},
|
|
7218
|
+
}, _callee6, this);
|
|
7060
7219
|
}));
|
|
7061
7220
|
|
|
7062
7221
|
function getRefNames(_x4) {
|
|
@@ -7068,35 +7227,35 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
7068
7227
|
}, {
|
|
7069
7228
|
key: "seqFetch",
|
|
7070
7229
|
value: function () {
|
|
7071
|
-
var _seqFetch = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
7072
|
-
var _yield$this$
|
|
7230
|
+
var _seqFetch = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(refName, start, end) {
|
|
7231
|
+
var _yield$this$configure3, sequenceAdapter, refSeqStore, features, seqChunks, trimmed, sequence;
|
|
7073
7232
|
|
|
7074
|
-
return runtime_1.wrap(function
|
|
7233
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
7075
7234
|
while (1) {
|
|
7076
|
-
switch (
|
|
7235
|
+
switch (_context7.prev = _context7.next) {
|
|
7077
7236
|
case 0:
|
|
7078
|
-
|
|
7237
|
+
_context7.next = 2;
|
|
7079
7238
|
return this.configure();
|
|
7080
7239
|
|
|
7081
7240
|
case 2:
|
|
7082
|
-
_yield$this$
|
|
7083
|
-
sequenceAdapter = _yield$this$
|
|
7241
|
+
_yield$this$configure3 = _context7.sent;
|
|
7242
|
+
sequenceAdapter = _yield$this$configure3.sequenceAdapter;
|
|
7084
7243
|
refSeqStore = sequenceAdapter;
|
|
7085
7244
|
|
|
7086
7245
|
if (refSeqStore) {
|
|
7087
|
-
|
|
7246
|
+
_context7.next = 7;
|
|
7088
7247
|
break;
|
|
7089
7248
|
}
|
|
7090
7249
|
|
|
7091
|
-
return
|
|
7250
|
+
return _context7.abrupt("return", undefined);
|
|
7092
7251
|
|
|
7093
7252
|
case 7:
|
|
7094
7253
|
if (refName) {
|
|
7095
|
-
|
|
7254
|
+
_context7.next = 9;
|
|
7096
7255
|
break;
|
|
7097
7256
|
}
|
|
7098
7257
|
|
|
7099
|
-
return
|
|
7258
|
+
return _context7.abrupt("return", undefined);
|
|
7100
7259
|
|
|
7101
7260
|
case 9:
|
|
7102
7261
|
features = refSeqStore.getFeatures({
|
|
@@ -7105,11 +7264,11 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
7105
7264
|
end: end,
|
|
7106
7265
|
assemblyName: ''
|
|
7107
7266
|
});
|
|
7108
|
-
|
|
7267
|
+
_context7.next = 12;
|
|
7109
7268
|
return features.pipe(toArray()).toPromise();
|
|
7110
7269
|
|
|
7111
7270
|
case 12:
|
|
7112
|
-
seqChunks =
|
|
7271
|
+
seqChunks = _context7.sent;
|
|
7113
7272
|
trimmed = [];
|
|
7114
7273
|
seqChunks.sort(function (a, b) {
|
|
7115
7274
|
return a.get('start') - b.get('start');
|
|
@@ -7125,21 +7284,21 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
7125
7284
|
sequence = trimmed.join('');
|
|
7126
7285
|
|
|
7127
7286
|
if (!(sequence.length !== end - start)) {
|
|
7128
|
-
|
|
7287
|
+
_context7.next = 18;
|
|
7129
7288
|
break;
|
|
7130
7289
|
}
|
|
7131
7290
|
|
|
7132
7291
|
throw new Error("sequence fetch failed: fetching ".concat(refName, ":").concat((start - 1).toLocaleString(), "-").concat(end.toLocaleString(), " returned ").concat(sequence.length.toLocaleString(), " bases, but should have returned ").concat((end - start).toLocaleString()));
|
|
7133
7292
|
|
|
7134
7293
|
case 18:
|
|
7135
|
-
return
|
|
7294
|
+
return _context7.abrupt("return", sequence);
|
|
7136
7295
|
|
|
7137
7296
|
case 19:
|
|
7138
7297
|
case "end":
|
|
7139
|
-
return
|
|
7298
|
+
return _context7.stop();
|
|
7140
7299
|
}
|
|
7141
7300
|
}
|
|
7142
|
-
},
|
|
7301
|
+
}, _callee7, this);
|
|
7143
7302
|
}));
|
|
7144
7303
|
|
|
7145
7304
|
function seqFetch(_x5, _x6, _x7) {
|
|
@@ -7158,44 +7317,44 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
7158
7317
|
end = region.end,
|
|
7159
7318
|
originalRefName = region.originalRefName;
|
|
7160
7319
|
|
|
7161
|
-
var
|
|
7162
|
-
signal =
|
|
7163
|
-
|
|
7164
|
-
statusCallback =
|
|
7320
|
+
var _ref4 = opts || {},
|
|
7321
|
+
signal = _ref4.signal,
|
|
7322
|
+
_ref4$statusCallback = _ref4.statusCallback,
|
|
7323
|
+
statusCallback = _ref4$statusCallback === void 0 ? function () {} : _ref4$statusCallback;
|
|
7165
7324
|
|
|
7166
7325
|
return ObservableCreate( /*#__PURE__*/function () {
|
|
7167
|
-
var
|
|
7326
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(observer) {
|
|
7168
7327
|
var _yield$_this2$configu, bam, records, _iterator, _step, record, ref;
|
|
7169
7328
|
|
|
7170
|
-
return runtime_1.wrap(function
|
|
7329
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
7171
7330
|
while (1) {
|
|
7172
|
-
switch (
|
|
7331
|
+
switch (_context8.prev = _context8.next) {
|
|
7173
7332
|
case 0:
|
|
7174
|
-
|
|
7333
|
+
_context8.next = 2;
|
|
7175
7334
|
return _this2.configure();
|
|
7176
7335
|
|
|
7177
7336
|
case 2:
|
|
7178
|
-
_yield$_this2$configu =
|
|
7337
|
+
_yield$_this2$configu = _context8.sent;
|
|
7179
7338
|
bam = _yield$_this2$configu.bam;
|
|
7180
|
-
|
|
7339
|
+
_context8.next = 6;
|
|
7181
7340
|
return _this2.setup(opts);
|
|
7182
7341
|
|
|
7183
7342
|
case 6:
|
|
7184
7343
|
statusCallback('Downloading alignments');
|
|
7185
|
-
|
|
7344
|
+
_context8.next = 9;
|
|
7186
7345
|
return bam.getRecordsForRange(refName, start, end, opts);
|
|
7187
7346
|
|
|
7188
7347
|
case 9:
|
|
7189
|
-
records =
|
|
7348
|
+
records = _context8.sent;
|
|
7190
7349
|
checkAbortSignal(signal);
|
|
7191
7350
|
_iterator = _createForOfIteratorHelper(records);
|
|
7192
|
-
|
|
7351
|
+
_context8.prev = 12;
|
|
7193
7352
|
|
|
7194
7353
|
_iterator.s();
|
|
7195
7354
|
|
|
7196
7355
|
case 14:
|
|
7197
7356
|
if ((_step = _iterator.n()).done) {
|
|
7198
|
-
|
|
7357
|
+
_context8.next = 24;
|
|
7199
7358
|
break;
|
|
7200
7359
|
}
|
|
7201
7360
|
|
|
@@ -7203,39 +7362,39 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
7203
7362
|
ref = void 0;
|
|
7204
7363
|
|
|
7205
7364
|
if (record.get('md')) {
|
|
7206
|
-
|
|
7365
|
+
_context8.next = 21;
|
|
7207
7366
|
break;
|
|
7208
7367
|
}
|
|
7209
7368
|
|
|
7210
|
-
|
|
7369
|
+
_context8.next = 20;
|
|
7211
7370
|
return _this2.seqFetch(originalRefName || refName, record.get('start'), record.get('end'));
|
|
7212
7371
|
|
|
7213
7372
|
case 20:
|
|
7214
|
-
ref =
|
|
7373
|
+
ref = _context8.sent;
|
|
7215
7374
|
|
|
7216
7375
|
case 21:
|
|
7217
7376
|
observer.next(new BamSlightlyLazyFeature(record, _this2, ref));
|
|
7218
7377
|
|
|
7219
7378
|
case 22:
|
|
7220
|
-
|
|
7379
|
+
_context8.next = 14;
|
|
7221
7380
|
break;
|
|
7222
7381
|
|
|
7223
7382
|
case 24:
|
|
7224
|
-
|
|
7383
|
+
_context8.next = 29;
|
|
7225
7384
|
break;
|
|
7226
7385
|
|
|
7227
7386
|
case 26:
|
|
7228
|
-
|
|
7229
|
-
|
|
7387
|
+
_context8.prev = 26;
|
|
7388
|
+
_context8.t0 = _context8["catch"](12);
|
|
7230
7389
|
|
|
7231
|
-
_iterator.e(
|
|
7390
|
+
_iterator.e(_context8.t0);
|
|
7232
7391
|
|
|
7233
7392
|
case 29:
|
|
7234
|
-
|
|
7393
|
+
_context8.prev = 29;
|
|
7235
7394
|
|
|
7236
7395
|
_iterator.f();
|
|
7237
7396
|
|
|
7238
|
-
return
|
|
7397
|
+
return _context8.finish(29);
|
|
7239
7398
|
|
|
7240
7399
|
case 32:
|
|
7241
7400
|
statusCallback('');
|
|
@@ -7243,17 +7402,69 @@ var BamAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
7243
7402
|
|
|
7244
7403
|
case 34:
|
|
7245
7404
|
case "end":
|
|
7246
|
-
return
|
|
7405
|
+
return _context8.stop();
|
|
7247
7406
|
}
|
|
7248
7407
|
}
|
|
7249
|
-
},
|
|
7408
|
+
}, _callee8, null, [[12, 26, 29, 32]]);
|
|
7250
7409
|
}));
|
|
7251
7410
|
|
|
7252
7411
|
return function (_x8) {
|
|
7253
|
-
return
|
|
7412
|
+
return _ref5.apply(this, arguments);
|
|
7254
7413
|
};
|
|
7255
7414
|
}(), signal);
|
|
7256
7415
|
}
|
|
7416
|
+
}, {
|
|
7417
|
+
key: "estimateRegionsStats",
|
|
7418
|
+
value: function () {
|
|
7419
|
+
var _estimateRegionsStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(regions, opts) {
|
|
7420
|
+
var _yield$this$configure4, bam, index, bytes, fetchSizeLimit;
|
|
7421
|
+
|
|
7422
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
7423
|
+
while (1) {
|
|
7424
|
+
switch (_context9.prev = _context9.next) {
|
|
7425
|
+
case 0:
|
|
7426
|
+
_context9.next = 2;
|
|
7427
|
+
return this.configure();
|
|
7428
|
+
|
|
7429
|
+
case 2:
|
|
7430
|
+
_yield$this$configure4 = _context9.sent;
|
|
7431
|
+
bam = _yield$this$configure4.bam;
|
|
7432
|
+
// @ts-ignore
|
|
7433
|
+
index = bam.index; // this is a method to avoid calling on htsget adapters
|
|
7434
|
+
|
|
7435
|
+
if (!(index.filehandle !== '?')) {
|
|
7436
|
+
_context9.next = 13;
|
|
7437
|
+
break;
|
|
7438
|
+
}
|
|
7439
|
+
|
|
7440
|
+
_context9.next = 8;
|
|
7441
|
+
return bytesForRegions(regions, index);
|
|
7442
|
+
|
|
7443
|
+
case 8:
|
|
7444
|
+
bytes = _context9.sent;
|
|
7445
|
+
fetchSizeLimit = readConfObject(this.config, 'fetchSizeLimit');
|
|
7446
|
+
return _context9.abrupt("return", {
|
|
7447
|
+
bytes: bytes,
|
|
7448
|
+
fetchSizeLimit: fetchSizeLimit
|
|
7449
|
+
});
|
|
7450
|
+
|
|
7451
|
+
case 13:
|
|
7452
|
+
return _context9.abrupt("return", _get(_getPrototypeOf(BamAdapter.prototype), "estimateRegionsStats", this).call(this, regions, opts));
|
|
7453
|
+
|
|
7454
|
+
case 14:
|
|
7455
|
+
case "end":
|
|
7456
|
+
return _context9.stop();
|
|
7457
|
+
}
|
|
7458
|
+
}
|
|
7459
|
+
}, _callee9, this);
|
|
7460
|
+
}));
|
|
7461
|
+
|
|
7462
|
+
function estimateRegionsStats(_x9, _x10) {
|
|
7463
|
+
return _estimateRegionsStats.apply(this, arguments);
|
|
7464
|
+
}
|
|
7465
|
+
|
|
7466
|
+
return estimateRegionsStats;
|
|
7467
|
+
}()
|
|
7257
7468
|
}, {
|
|
7258
7469
|
key: "freeResources",
|
|
7259
7470
|
value: function
|