@gmod/cram
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -93,3 +93,3 @@ 'use strict'; | ||
var seqId, slices, totalSize, filter, sliceResults, ret, readNames, readIds, _i, name, id, unmatedPairs, matePromises, _i2, _name, mateSlices, mateBlocks, mateChunks, i, _mateChunks, mateRecordPromises, mateFeatPromises, newMateFeats, newMates; | ||
var seqId, slices, totalSize, filter, sliceResults, ret, readNames, readIds, _i, name, id, unmatedPairs, matePromises, _i2, _name, mateSlices, mateBlocks, mateChunks, i, _mateChunks, mateRecordPromises, mateFeatPromises, mateTotalSize, newMateFeats, newMates; | ||
@@ -100,4 +100,8 @@ return _regenerator2.default.wrap(function _callee$(_context) { | ||
case 0: | ||
opts.viewAsPairs = opts.viewAsPairs || false; | ||
opts.pairAcrossChr = opts.pairAcrossChr || false; | ||
opts.maxInsertSize = opts.maxInsertSize || 200000; | ||
if (!(typeof seq === 'string')) { | ||
_context.next = 2; | ||
_context.next = 5; | ||
break; | ||
@@ -108,8 +112,8 @@ } | ||
case 2: | ||
case 5: | ||
seqId = seq; | ||
_context.next = 5; | ||
_context.next = 8; | ||
return this.index.getEntriesForRange(seqId, start, end); | ||
case 5: | ||
case 8: | ||
slices = _context.sent; | ||
@@ -123,3 +127,3 @@ totalSize = slices.map(function (s) { | ||
if (!(totalSize > this.fetchSizeLimit)) { | ||
_context.next = 9; | ||
_context.next = 12; | ||
break; | ||
@@ -130,3 +134,3 @@ } | ||
case 9: | ||
case 12: | ||
@@ -140,3 +144,3 @@ // TODO: do we need to merge or de-duplicate the blocks? | ||
_context.next = 12; | ||
_context.next = 15; | ||
return _promise2.default.all(slices.map(function (slice) { | ||
@@ -146,3 +150,3 @@ return _this.getRecordsInSlice(slice, filter); | ||
case 12: | ||
case 15: | ||
sliceResults = _context.sent; | ||
@@ -152,3 +156,3 @@ ret = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, (0, _toConsumableArray3.default)(sliceResults)); | ||
if (!opts.viewAsPairs) { | ||
_context.next = 35; | ||
_context.next = 41; | ||
break; | ||
@@ -182,3 +186,3 @@ } | ||
if (unmatedPairs[_name] && (ret[_i2].mate.sequenceId == seqId || opts.pairAcrossChr)) { | ||
if (unmatedPairs[_name] && (ret[_i2].mate.sequenceId == seqId || opts.pairAcrossChr) && Math.abs(ret[_i2].alignmentStart - ret[_i2].mate.alignmentStart) < opts.maxInsertSize) { | ||
mateSlices = this.index.getEntriesForRange(ret[_i2].mate.sequenceId, ret[_i2].mate.alignmentStart, ret[_i2].mate.alignmentStart + 1); | ||
@@ -189,6 +193,6 @@ | ||
} | ||
_context.next = 24; | ||
_context.next = 27; | ||
return _promise2.default.all(matePromises); | ||
case 24: | ||
case 27: | ||
mateBlocks = _context.sent; | ||
@@ -209,4 +213,17 @@ mateChunks = []; | ||
mateFeatPromises = []; | ||
mateTotalSize = mateChunks.map(function (s) { | ||
return s.sliceBytes; | ||
}).reduce(function (a, b) { | ||
return a + b; | ||
}, 0); | ||
if (!(mateTotalSize > this.fetchSizeLimit)) { | ||
_context.next = 36; | ||
break; | ||
} | ||
throw new Error('mate data size of ' + mateTotalSize.toLocaleString() + ' bytes exceeded fetch size limit of ' + this.fetchSizeLimit.toLocaleString() + ' bytes'); | ||
case 36: | ||
mateChunks.forEach(function (c) { | ||
@@ -233,6 +250,6 @@ var recordPromise = _this.cram.featureCache.get(c.toString()); | ||
}); | ||
_context.next = 33; | ||
_context.next = 39; | ||
return _promise2.default.all(mateFeatPromises); | ||
case 33: | ||
case 39: | ||
newMateFeats = _context.sent; | ||
@@ -248,6 +265,6 @@ | ||
case 35: | ||
case 41: | ||
return _context.abrupt('return', ret); | ||
case 36: | ||
case 42: | ||
case 'end': | ||
@@ -254,0 +271,0 @@ return _context.stop(); |
{ | ||
"name": "@gmod/cram", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "read CRAM files with pure Javascript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
219825
4786
4