Comparing version 1.1.13 to 1.1.14
@@ -1,5 +0,9 @@ | ||
## [1.1.13](https://github.com/GMOD/bam-js/compare/v1.1.12...v1.1.13) (2022-02-25) | ||
## [1.1.14](https://github.com/GMOD/bam-js/compare/v1.1.13...v1.1.14) (2022-03-14) | ||
- Fix seq function for corner case | ||
## [1.1.13](https://github.com/GMOD/bam-js/compare/v1.1.12...v1.1.13) (2022-02-25) | ||
- Optimize qual and sequence string record functions for less GC pressure | ||
@@ -6,0 +10,0 @@ |
@@ -19,3 +19,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -22,0 +26,0 @@ if (k2 === undefined) k2 = k; |
@@ -30,3 +30,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -33,0 +37,0 @@ if (k2 === undefined) k2 = k; |
@@ -448,20 +448,18 @@ "use strict"; | ||
BamRecord.prototype.seq = function () { | ||
var _a = this.bytes, start = _a.start, byteArray = _a.byteArray; | ||
var _a = this.bytes, byteArray = _a.byteArray, start = _a.start; | ||
var p = start + 36 + this.get('_l_read_name') + this.get('_n_cigar_op') * 4; | ||
var seqBytes = this.get('_seq_bytes'); | ||
var len = this.get('seq_length'); | ||
var buf = []; | ||
for (var j = 0; j < seqBytes - 1; ++j) { | ||
var sb_1 = byteArray[p + j]; | ||
buf.push(SEQRET_DECODER[(sb_1 & 0xf0) >> 4]); | ||
buf.push(SEQRET_DECODER[sb_1 & 0x0f]); | ||
var buf = ''; | ||
var i = 0; | ||
for (var j = 0; j < seqBytes; ++j) { | ||
var sb = byteArray[p + j]; | ||
buf += SEQRET_DECODER[(sb & 0xf0) >> 4]; | ||
i++; | ||
if (i < len) { | ||
buf += SEQRET_DECODER[sb & 0x0f]; | ||
i++; | ||
} | ||
} | ||
// there are two bases per byte, so this handles the case where it is odd | ||
// length | ||
var sb = byteArray[p + seqBytes - 1]; | ||
buf.push(SEQRET_DECODER[(sb & 0xf0) >> 4]); | ||
if (len % 2 === 0) { | ||
buf.push(SEQRET_DECODER[sb & 0x0f]); | ||
} | ||
return buf.join(''); | ||
return buf; | ||
}; | ||
@@ -468,0 +466,0 @@ // adapted from igv.js |
@@ -442,20 +442,18 @@ /* eslint-disable @typescript-eslint/no-empty-function */ | ||
seq() { | ||
const { start, byteArray } = this.bytes; | ||
const { byteArray, start } = this.bytes; | ||
const p = start + 36 + this.get('_l_read_name') + this.get('_n_cigar_op') * 4; | ||
const seqBytes = this.get('_seq_bytes'); | ||
const len = this.get('seq_length'); | ||
const buf = []; | ||
for (let j = 0; j < seqBytes - 1; ++j) { | ||
let buf = ''; | ||
let i = 0; | ||
for (let j = 0; j < seqBytes; ++j) { | ||
const sb = byteArray[p + j]; | ||
buf.push(SEQRET_DECODER[(sb & 0xf0) >> 4]); | ||
buf.push(SEQRET_DECODER[sb & 0x0f]); | ||
buf += SEQRET_DECODER[(sb & 0xf0) >> 4]; | ||
i++; | ||
if (i < len) { | ||
buf += SEQRET_DECODER[sb & 0x0f]; | ||
i++; | ||
} | ||
} | ||
// there are two bases per byte, so this handles the case where it is odd | ||
// length | ||
const sb = byteArray[p + seqBytes - 1]; | ||
buf.push(SEQRET_DECODER[(sb & 0xf0) >> 4]); | ||
if (len % 2 === 0) { | ||
buf.push(SEQRET_DECODER[sb & 0x0f]); | ||
} | ||
return buf.join(''); | ||
return buf; | ||
} | ||
@@ -462,0 +460,0 @@ // adapted from igv.js |
{ | ||
"name": "@gmod/bam", | ||
"version": "1.1.13", | ||
"version": "1.1.14", | ||
"description": "Parser for BAM and BAM index (bai) files", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
5090
351812