Comparing version 2.0.2 to 2.0.3
@@ -1,9 +0,17 @@ | ||
## [2.0.2](https://github.com/GMOD/bam-js/compare/v2.0.1...v2.0.2) (2024-02-21) | ||
## [2.0.3](https://github.com/GMOD/bam-js/compare/v2.0.2...v2.0.3) (2024-07-23) | ||
### Reverts | ||
## [2.0.1](https://github.com/GMOD/bam-js/compare/v2.0.0...v2.0.1) (2024-2-20) | ||
* Revert "Migrate to eslint9" ([65adcbb](https://github.com/GMOD/bam-js/commit/65adcbb2793243659682d30694f8604d241a5337)) | ||
* Revert "Run format" ([2a02535](https://github.com/GMOD/bam-js/commit/2a02535db4df80f245232522cdba771cbf5ea214)) | ||
## [2.0.2](https://github.com/GMOD/bam-js/compare/v2.0.1...v2.0.2) (2024-02-21) | ||
- Update typescript-eslint config and related fixes | ||
## [2.0.1](https://github.com/GMOD/bam-js/compare/v2.0.0...v2.0.1) (2024-2-20) | ||
- Update to buffer-crc32 1.0.0 | ||
@@ -10,0 +18,0 @@ - Fix BAM header parsing of refNames containing a : |
@@ -17,3 +17,3 @@ import VirtualOffset from './virtualOffset'; | ||
lineCount: number; | ||
} | undefined; | ||
}; | ||
}[]; | ||
@@ -20,0 +20,0 @@ refCount: number; |
@@ -39,4 +39,4 @@ "use strict"; | ||
lineCount(refId, opts) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b; | ||
const indexData = yield this.parse(opts); | ||
@@ -116,4 +116,4 @@ return ((_b = (_a = indexData.indices[refId]) === null || _a === void 0 ? void 0 : _a.stats) === null || _b === void 0 ? void 0 : _b.lineCount) || 0; | ||
} | ||
indexCov(seqId, start, end, opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
indexCov(seqId_1, start_1, end_1) { | ||
return __awaiter(this, arguments, void 0, function* (seqId, start, end, opts = {}) { | ||
const v = 16384; | ||
@@ -151,4 +151,4 @@ const range = start !== undefined; | ||
} | ||
blocksForRange(refId, min, max, opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
blocksForRange(refId_1, min_1, max_1) { | ||
return __awaiter(this, arguments, void 0, function* (refId, min, max, opts = {}) { | ||
if (min < 0) { | ||
@@ -194,4 +194,4 @@ min = 0; | ||
} | ||
parse(opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
parse() { | ||
return __awaiter(this, arguments, void 0, function* (opts = {}) { | ||
if (!this.setupP) { | ||
@@ -206,5 +206,5 @@ this.setupP = this._parse(opts).catch(e => { | ||
} | ||
hasRefSeq(seqId, opts = {}) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
hasRefSeq(seqId_1) { | ||
return __awaiter(this, arguments, void 0, function* (seqId, opts = {}) { | ||
var _a; | ||
const header = yield this.parse(opts); | ||
@@ -211,0 +211,0 @@ return !!((_a = header.indices[seqId]) === null || _a === void 0 ? void 0 : _a.binIndex); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Buffer } from 'buffer'; | ||
@@ -3,0 +2,0 @@ import { GenericFilehandle } from 'generic-filehandle'; |
@@ -45,3 +45,3 @@ "use strict"; | ||
const generic_filehandle_1 = require("generic-filehandle"); | ||
const abortable_promise_cache_1 = __importDefault(require("abortable-promise-cache")); | ||
const abortable_promise_cache_1 = __importDefault(require("@gmod/abortable-promise-cache")); | ||
const quick_lru_1 = __importDefault(require("quick-lru")); | ||
@@ -57,5 +57,5 @@ // locals | ||
function gen2array(gen) { | ||
var _a, gen_1, gen_1_1; | ||
var _b, e_1, _c, _d; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a, gen_1, gen_1_1; | ||
var _b, e_1, _c, _d; | ||
let out = []; | ||
@@ -202,4 +202,4 @@ try { | ||
} | ||
getHeaderText(opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
getHeaderText() { | ||
return __awaiter(this, arguments, void 0, function* (opts = {}) { | ||
yield this.getHeader(opts); | ||
@@ -247,4 +247,4 @@ return this.header; | ||
streamRecordsForRange(chr, min, max, opts) { | ||
var _a; | ||
return __asyncGenerator(this, arguments, function* streamRecordsForRange_1() { | ||
var _a; | ||
yield __await(this.getHeader(opts)); | ||
@@ -261,4 +261,4 @@ const chrId = (_a = this.chrToIndex) === null || _a === void 0 ? void 0 : _a[chr]; | ||
} | ||
_fetchChunkFeatures(chunks, chrId, min, max, opts = {}) { | ||
return __asyncGenerator(this, arguments, function* _fetchChunkFeatures_1() { | ||
_fetchChunkFeatures(chunks_1, chrId_1, min_1, max_1) { | ||
return __asyncGenerator(this, arguments, function* _fetchChunkFeatures_1(chunks, chrId, min, max, opts = {}) { | ||
const { viewAsPairs } = opts; | ||
@@ -357,4 +357,4 @@ const feats = []; | ||
} | ||
_readRegion(position, size, opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
_readRegion(position_1, size_1) { | ||
return __awaiter(this, arguments, void 0, function* (position, size, opts = {}) { | ||
const { bytesRead, buffer } = yield this.bam.read(buffer_1.Buffer.alloc(size), 0, size, position, opts); | ||
@@ -364,4 +364,4 @@ return buffer.subarray(0, Math.min(bytesRead, size)); | ||
} | ||
_readChunk({ chunk, opts }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
_readChunk(_a) { | ||
return __awaiter(this, arguments, void 0, function* ({ chunk, opts }) { | ||
const buffer = yield this._readRegion(chunk.minv.blockPosition, chunk.fetchedSize(), opts); | ||
@@ -434,4 +434,4 @@ const { buffer: data, cpositions, dpositions, } = yield (0, bgzf_filehandle_1.unzipChunkSlice)(buffer, chunk); | ||
hasRefSeq(seqName) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b; | ||
const seqId = (_a = this.chrToIndex) === null || _a === void 0 ? void 0 : _a[seqName]; | ||
@@ -442,4 +442,4 @@ return seqId === undefined ? false : (_b = this.index) === null || _b === void 0 ? void 0 : _b.hasRefSeq(seqId); | ||
lineCount(seqName) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
const seqId = (_a = this.chrToIndex) === null || _a === void 0 ? void 0 : _a[seqName]; | ||
@@ -450,4 +450,4 @@ return seqId === undefined || !this.index ? 0 : this.index.lineCount(seqId); | ||
indexCov(seqName, start, end) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
if (!this.index) { | ||
@@ -462,4 +462,4 @@ return []; | ||
blocksForRange(seqName, start, end, opts) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
if (!this.index) { | ||
@@ -466,0 +466,0 @@ return []; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import VirtualOffset from './virtualOffset'; | ||
@@ -3,0 +2,0 @@ export default class Chunk { |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import VirtualOffset from './virtualOffset'; | ||
@@ -50,3 +49,3 @@ import Chunk from './chunk'; | ||
lineCount: number; | ||
} | undefined; | ||
}; | ||
}[]; | ||
@@ -53,0 +52,0 @@ refCount: number; |
@@ -59,4 +59,4 @@ "use strict"; | ||
lineCount(refId, opts) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b; | ||
const indexData = yield this.parse(opts); | ||
@@ -160,4 +160,4 @@ return ((_b = (_a = indexData.indices[refId]) === null || _a === void 0 ? void 0 : _a.stats) === null || _b === void 0 ? void 0 : _b.lineCount) || 0; | ||
} | ||
blocksForRange(refId, min, max, opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
blocksForRange(refId_1, min_1, max_1) { | ||
return __awaiter(this, arguments, void 0, function* (refId, min, max, opts = {}) { | ||
if (min < 0) { | ||
@@ -217,4 +217,4 @@ min = 0; | ||
} | ||
parse(opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
parse() { | ||
return __awaiter(this, arguments, void 0, function* (opts = {}) { | ||
if (!this.setupP) { | ||
@@ -229,5 +229,5 @@ this.setupP = this._parse(opts).catch(e => { | ||
} | ||
hasRefSeq(seqId, opts = {}) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
hasRefSeq(seqId_1) { | ||
return __awaiter(this, arguments, void 0, function* (seqId, opts = {}) { | ||
var _a; | ||
const header = yield this.parse(opts); | ||
@@ -234,0 +234,0 @@ return !!((_a = header.indices[seqId]) === null || _a === void 0 ? void 0 : _a.binIndex); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Buffer } from 'buffer'; | ||
@@ -3,0 +2,0 @@ import { BaseOpts, BamOpts } from './util'; |
@@ -103,4 +103,4 @@ "use strict"; | ||
streamRecordsForRange(chr, min, max, opts) { | ||
var _a; | ||
return __asyncGenerator(this, arguments, function* streamRecordsForRange_1() { | ||
var _a; | ||
const base = `${this.baseUrl}/${this.trackId}`; | ||
@@ -152,4 +152,4 @@ const url = `${base}?referenceName=${chr}&start=${min}&end=${max}&format=BAM`; | ||
} | ||
_readChunk({ chunk }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
_readChunk(_a) { | ||
return __awaiter(this, arguments, void 0, function* ({ chunk }) { | ||
if (!chunk.buffer) { | ||
@@ -161,4 +161,4 @@ throw new Error('expected chunk.buffer in htsget'); | ||
} | ||
getHeader(opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
getHeader() { | ||
return __awaiter(this, arguments, void 0, function* (opts = {}) { | ||
const url = `${this.baseUrl}/${this.trackId}?referenceName=na&class=header`; | ||
@@ -165,0 +165,0 @@ const result = yield fetch(url, opts); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
/** | ||
@@ -3,0 +2,0 @@ * Class of each BAM record returned by this API. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseHeaderText = void 0; | ||
exports.parseHeaderText = parseHeaderText; | ||
function parseHeaderText(text) { | ||
@@ -23,3 +23,2 @@ const lines = text.split(/\r?\n/); | ||
} | ||
exports.parseHeaderText = parseHeaderText; | ||
//# sourceMappingURL=sam.js.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import Long from 'long'; | ||
@@ -3,0 +2,0 @@ import Chunk from './chunk'; |
@@ -15,3 +15,12 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseNameBytes = exports.findFirstData = exports.parsePseudoBin = exports.optimizeChunks = exports.makeOpts = exports.canMergeBlocks = exports.abortBreakPoint = exports.checkAbortSignal = exports.longToNumber = exports.timeout = void 0; | ||
exports.timeout = timeout; | ||
exports.longToNumber = longToNumber; | ||
exports.checkAbortSignal = checkAbortSignal; | ||
exports.abortBreakPoint = abortBreakPoint; | ||
exports.canMergeBlocks = canMergeBlocks; | ||
exports.makeOpts = makeOpts; | ||
exports.optimizeChunks = optimizeChunks; | ||
exports.parsePseudoBin = parsePseudoBin; | ||
exports.findFirstData = findFirstData; | ||
exports.parseNameBytes = parseNameBytes; | ||
const long_1 = __importDefault(require("long")); | ||
@@ -21,3 +30,2 @@ function timeout(ms) { | ||
} | ||
exports.timeout = timeout; | ||
function longToNumber(long) { | ||
@@ -30,3 +38,2 @@ if (long.greaterThan(Number.MAX_SAFE_INTEGER) || | ||
} | ||
exports.longToNumber = longToNumber; | ||
/** | ||
@@ -60,3 +67,2 @@ * Properly check if the given AbortSignal is aborted. | ||
} | ||
exports.checkAbortSignal = checkAbortSignal; | ||
/** | ||
@@ -74,3 +80,2 @@ * Skips to the next tick, then runs `checkAbortSignal`. | ||
} | ||
exports.abortBreakPoint = abortBreakPoint; | ||
function canMergeBlocks(chunk1, chunk2) { | ||
@@ -80,7 +85,5 @@ return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 && | ||
} | ||
exports.canMergeBlocks = canMergeBlocks; | ||
function makeOpts(obj = {}) { | ||
return 'aborted' in obj ? { signal: obj } : obj; | ||
} | ||
exports.makeOpts = makeOpts; | ||
function optimizeChunks(chunks, lowest) { | ||
@@ -117,3 +120,2 @@ const mergedChunks = []; | ||
} | ||
exports.optimizeChunks = optimizeChunks; | ||
function parsePseudoBin(bytes, offset) { | ||
@@ -123,3 +125,2 @@ const lineCount = longToNumber(long_1.default.fromBytesLE(Array.prototype.slice.call(bytes, offset, offset + 8), true)); | ||
} | ||
exports.parsePseudoBin = parsePseudoBin; | ||
function findFirstData(firstDataLine, virtualOffset) { | ||
@@ -132,3 +133,2 @@ return firstDataLine | ||
} | ||
exports.findFirstData = findFirstData; | ||
function parseNameBytes(namesBytes, renameRefSeq = s => s) { | ||
@@ -153,3 +153,2 @@ let currRefId = 0; | ||
} | ||
exports.parseNameBytes = parseNameBytes; | ||
//# sourceMappingURL=util.js.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
export default class VirtualOffset { | ||
@@ -3,0 +2,0 @@ blockPosition: number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fromBytes = void 0; | ||
exports.fromBytes = fromBytes; | ||
class VirtualOffset { | ||
@@ -41,3 +41,2 @@ constructor(blockPosition, dataPosition) { | ||
} | ||
exports.fromBytes = fromBytes; | ||
//# sourceMappingURL=virtualOffset.js.map |
@@ -17,3 +17,3 @@ import VirtualOffset from './virtualOffset'; | ||
lineCount: number; | ||
} | undefined; | ||
}; | ||
}[]; | ||
@@ -20,0 +20,0 @@ refCount: number; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Buffer } from 'buffer'; | ||
@@ -3,0 +2,0 @@ import { GenericFilehandle } from 'generic-filehandle'; |
@@ -5,3 +5,3 @@ import { Buffer } from 'buffer'; | ||
import { LocalFile, RemoteFile } from 'generic-filehandle'; | ||
import AbortablePromiseCache from 'abortable-promise-cache'; | ||
import AbortablePromiseCache from '@gmod/abortable-promise-cache'; | ||
import QuickLRU from 'quick-lru'; | ||
@@ -8,0 +8,0 @@ // locals |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import VirtualOffset from './virtualOffset'; | ||
@@ -3,0 +2,0 @@ export default class Chunk { |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import VirtualOffset from './virtualOffset'; | ||
@@ -50,3 +49,3 @@ import Chunk from './chunk'; | ||
lineCount: number; | ||
} | undefined; | ||
}; | ||
}[]; | ||
@@ -53,0 +52,0 @@ refCount: number; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Buffer } from 'buffer'; | ||
@@ -3,0 +2,0 @@ import { BaseOpts, BamOpts } from './util'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
/** | ||
@@ -3,0 +2,0 @@ * Class of each BAM record returned by this API. |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import Long from 'long'; | ||
@@ -3,0 +2,0 @@ import Chunk from './chunk'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
export default class VirtualOffset { | ||
@@ -3,0 +2,0 @@ blockPosition: number; |
{ | ||
"name": "@gmod/bam", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Parser for BAM and BAM index (bai) files", | ||
@@ -25,3 +25,3 @@ "license": "MIT", | ||
"coverage": "npm test -- --coverage", | ||
"lint": "eslint --report-unused-disable-directives --max-warnings 0 --ext .js,.ts src test", | ||
"lint": "eslint --report-unused-disable-directives --max-warnings 0 src test", | ||
"clean": "rimraf dist esm", | ||
@@ -43,4 +43,4 @@ "build:esm": "tsc --target es2018 --outDir esm", | ||
"dependencies": { | ||
"@gmod/abortable-promise-cache": "^2.0.0", | ||
"@gmod/bgzf-filehandle": "^1.4.4", | ||
"abortable-promise-cache": "^1.5.0", | ||
"buffer-crc32": "^1.0.0", | ||
@@ -57,12 +57,11 @@ "generic-filehandle": "^3.0.0", | ||
"@typescript-eslint/parser": "^7.0.2", | ||
"eslint": "^8.40.0", | ||
"eslint": "^9.0.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-unicorn": "^51.0.1", | ||
"eslint-plugin-unicorn": "^54.0.0", | ||
"jest": "^29.5.0", | ||
"jest-fetch-mock": "^3.0.3", | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.0", | ||
"standard-changelog": "^5.0.0", | ||
"rimraf": "^6.0.1", | ||
"standard-changelog": "^6.0.0", | ||
"ts-jest": "^29.1.0", | ||
@@ -69,0 +68,0 @@ "typescript": "^5.0.4" |
@@ -5,3 +5,3 @@ import { Buffer } from 'buffer' | ||
import { LocalFile, RemoteFile, GenericFilehandle } from 'generic-filehandle' | ||
import AbortablePromiseCache from 'abortable-promise-cache' | ||
import AbortablePromiseCache from '@gmod/abortable-promise-cache' | ||
import QuickLRU from 'quick-lru' | ||
@@ -8,0 +8,0 @@ |
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
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
16
372905
6542
+ Added@gmod/abortable-promise-cache@2.0.1(transitive)
- Removedabortable-promise-cache@^1.5.0
- Removedabortable-promise-cache@1.5.0(transitive)
- Removedabortcontroller-polyfill@1.7.8(transitive)