Comparing version 2.0.1 to 2.0.2
@@ -0,1 +1,5 @@ | ||
## [2.0.2](https://github.com/GMOD/bam-js/compare/v2.0.1...v2.0.2) (2024-02-21) | ||
## [2.0.1](https://github.com/GMOD/bam-js/compare/v2.0.0...v2.0.1) (2024-2-20) | ||
@@ -2,0 +6,0 @@ |
@@ -13,5 +13,3 @@ import VirtualOffset from './virtualOffset'; | ||
indices: { | ||
binIndex: { | ||
[key: string]: Chunk[]; | ||
}; | ||
binIndex: Record<string, Chunk[]>; | ||
linearIndex: VirtualOffset[]; | ||
@@ -35,5 +33,3 @@ stats?: { | ||
indices: { | ||
binIndex: { | ||
[key: string]: Chunk[]; | ||
}; | ||
binIndex: Record<string, Chunk[]>; | ||
linearIndex: VirtualOffset[]; | ||
@@ -40,0 +36,0 @@ stats?: { |
@@ -54,5 +54,3 @@ /// <reference types="node" /> | ||
_readRefSeqs(start: number, refSeqBytes: number, opts?: BaseOpts): Promise<{ | ||
chrToIndex: { | ||
[key: string]: number; | ||
}; | ||
chrToIndex: Record<string, number>; | ||
indexToChr: { | ||
@@ -59,0 +57,0 @@ refName: string; |
@@ -177,3 +177,3 @@ "use strict"; | ||
else { | ||
buffer = (yield this.bam.readFile(opts)); | ||
buffer = yield this.bam.readFile(opts); | ||
} | ||
@@ -180,0 +180,0 @@ const uncba = yield (0, bgzf_filehandle_1.unzip)(buffer); |
@@ -12,3 +12,3 @@ "use strict"; | ||
toUniqueString() { | ||
return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`; | ||
return `${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`; | ||
} | ||
@@ -15,0 +15,0 @@ toString() { |
@@ -14,5 +14,3 @@ /// <reference types="node" /> | ||
parseAuxData(bytes: Buffer, offset: number): { | ||
refNameToId: { | ||
[key: string]: number; | ||
}; | ||
refNameToId: Record<string, number>; | ||
refIdToName: string[]; | ||
@@ -34,5 +32,3 @@ columnNumbers: { | ||
}): Promise<{ | ||
refNameToId?: { | ||
[key: string]: number; | ||
} | undefined; | ||
refNameToId?: Record<string, number> | undefined; | ||
refIdToName?: string[] | undefined; | ||
@@ -53,5 +49,3 @@ columnNumbers?: { | ||
indices: { | ||
binIndex: { | ||
[key: string]: Chunk[]; | ||
}; | ||
binIndex: Record<string, Chunk[]>; | ||
stats?: { | ||
@@ -72,5 +66,3 @@ lineCount: number; | ||
parse(opts?: BaseOpts): Promise<{ | ||
refNameToId?: { | ||
[key: string]: number; | ||
} | undefined; | ||
refNameToId?: Record<string, number> | undefined; | ||
refIdToName?: string[] | undefined; | ||
@@ -91,5 +83,3 @@ columnNumbers?: { | ||
indices: { | ||
binIndex: { | ||
[key: string]: Chunk[]; | ||
}; | ||
binIndex: Record<string, Chunk[]>; | ||
stats?: { | ||
@@ -96,0 +86,0 @@ lineCount: number; |
@@ -85,3 +85,2 @@ "use strict"; | ||
// @ts-expect-error | ||
//eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { referer } = headers, rest = __rest(headers, ["referer"]); | ||
@@ -88,0 +87,0 @@ const res = yield fetch(url, Object.assign(Object.assign({}, opts), { headers: Object.assign(Object.assign({}, opts === null || opts === void 0 ? void 0 : opts.headers), rest) })); |
@@ -68,3 +68,2 @@ /// <reference types="node" /> | ||
cigar(): any; | ||
_flags(): void; | ||
length_on_ref(): any; | ||
@@ -86,5 +85,3 @@ _n_cigar_op(): number; | ||
template_length(): number; | ||
toJSON(): { | ||
[key: string]: any; | ||
}; | ||
toJSON(): Record<string, any>; | ||
} |
@@ -65,3 +65,3 @@ "use strict"; | ||
for (const k of Object.keys(this.data)) { | ||
if (k[0] !== '_' && k !== 'next_seq_id') { | ||
if (!k.startsWith('_') && k !== 'next_seq_id') { | ||
tags.push(k); | ||
@@ -434,3 +434,2 @@ } | ||
} | ||
_flags() { } | ||
length_on_ref() { | ||
@@ -534,3 +533,3 @@ if (this.data.length_on_ref) { | ||
for (const k of Object.keys(this)) { | ||
if (k.charAt(0) === '_' || k === 'bytes') { | ||
if (k.startsWith('_') || k === 'bytes') { | ||
continue; | ||
@@ -537,0 +536,0 @@ } |
@@ -43,6 +43,4 @@ /// <reference types="node" /> | ||
export declare function parseNameBytes(namesBytes: Buffer, renameRefSeq?: (arg: string) => string): { | ||
refNameToId: { | ||
[key: string]: number; | ||
}; | ||
refNameToId: Record<string, number>; | ||
refIdToName: string[]; | ||
}; |
@@ -13,5 +13,3 @@ import VirtualOffset from './virtualOffset'; | ||
indices: { | ||
binIndex: { | ||
[key: string]: Chunk[]; | ||
}; | ||
binIndex: Record<string, Chunk[]>; | ||
linearIndex: VirtualOffset[]; | ||
@@ -35,5 +33,3 @@ stats?: { | ||
indices: { | ||
binIndex: { | ||
[key: string]: Chunk[]; | ||
}; | ||
binIndex: Record<string, Chunk[]>; | ||
linearIndex: VirtualOffset[]; | ||
@@ -40,0 +36,0 @@ stats?: { |
@@ -54,5 +54,3 @@ /// <reference types="node" /> | ||
_readRefSeqs(start: number, refSeqBytes: number, opts?: BaseOpts): Promise<{ | ||
chrToIndex: { | ||
[key: string]: number; | ||
}; | ||
chrToIndex: Record<string, number>; | ||
indexToChr: { | ||
@@ -59,0 +57,0 @@ refName: string; |
@@ -120,3 +120,3 @@ import { Buffer } from 'buffer'; | ||
else { | ||
buffer = (await this.bam.readFile(opts)); | ||
buffer = await this.bam.readFile(opts); | ||
} | ||
@@ -123,0 +123,0 @@ const uncba = await unzip(buffer); |
@@ -10,3 +10,3 @@ // little class representing a chunk in the index | ||
toUniqueString() { | ||
return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`; | ||
return `${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`; | ||
} | ||
@@ -13,0 +13,0 @@ toString() { |
@@ -14,5 +14,3 @@ /// <reference types="node" /> | ||
parseAuxData(bytes: Buffer, offset: number): { | ||
refNameToId: { | ||
[key: string]: number; | ||
}; | ||
refNameToId: Record<string, number>; | ||
refIdToName: string[]; | ||
@@ -34,5 +32,3 @@ columnNumbers: { | ||
}): Promise<{ | ||
refNameToId?: { | ||
[key: string]: number; | ||
} | undefined; | ||
refNameToId?: Record<string, number> | undefined; | ||
refIdToName?: string[] | undefined; | ||
@@ -53,5 +49,3 @@ columnNumbers?: { | ||
indices: { | ||
binIndex: { | ||
[key: string]: Chunk[]; | ||
}; | ||
binIndex: Record<string, Chunk[]>; | ||
stats?: { | ||
@@ -72,5 +66,3 @@ lineCount: number; | ||
parse(opts?: BaseOpts): Promise<{ | ||
refNameToId?: { | ||
[key: string]: number; | ||
} | undefined; | ||
refNameToId?: Record<string, number> | undefined; | ||
refIdToName?: string[] | undefined; | ||
@@ -91,5 +83,3 @@ columnNumbers?: { | ||
indices: { | ||
binIndex: { | ||
[key: string]: Chunk[]; | ||
}; | ||
binIndex: Record<string, Chunk[]>; | ||
stats?: { | ||
@@ -96,0 +86,0 @@ lineCount: number; |
@@ -14,3 +14,2 @@ import { unzip } from '@gmod/bgzf-filehandle'; | ||
// @ts-expect-error | ||
//eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { referer, ...rest } = headers; | ||
@@ -17,0 +16,0 @@ const res = await fetch(url, { |
@@ -68,3 +68,2 @@ /// <reference types="node" /> | ||
cigar(): any; | ||
_flags(): void; | ||
length_on_ref(): any; | ||
@@ -86,5 +85,3 @@ _n_cigar_op(): number; | ||
template_length(): number; | ||
toJSON(): { | ||
[key: string]: any; | ||
}; | ||
toJSON(): Record<string, any>; | ||
} |
@@ -60,3 +60,3 @@ import Constants from './constants'; | ||
for (const k of Object.keys(this.data)) { | ||
if (k[0] !== '_' && k !== 'next_seq_id') { | ||
if (!k.startsWith('_') && k !== 'next_seq_id') { | ||
tags.push(k); | ||
@@ -429,3 +429,2 @@ } | ||
} | ||
_flags() { } | ||
length_on_ref() { | ||
@@ -529,3 +528,3 @@ if (this.data.length_on_ref) { | ||
for (const k of Object.keys(this)) { | ||
if (k.charAt(0) === '_' || k === 'bytes') { | ||
if (k.startsWith('_') || k === 'bytes') { | ||
continue; | ||
@@ -532,0 +531,0 @@ } |
@@ -43,6 +43,4 @@ /// <reference types="node" /> | ||
export declare function parseNameBytes(namesBytes: Buffer, renameRefSeq?: (arg: string) => string): { | ||
refNameToId: { | ||
[key: string]: number; | ||
}; | ||
refNameToId: Record<string, number>; | ||
refIdToName: string[]; | ||
}; |
{ | ||
"name": "@gmod/bam", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Parser for BAM and BAM index (bai) files", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -53,3 +53,3 @@ import VirtualOffset, { fromBytes } from './virtualOffset' | ||
type BinIndex = { [key: string]: Chunk[] } | ||
type BinIndex = Record<string, Chunk[]> | ||
type LinearIndex = VirtualOffset[] | ||
@@ -67,3 +67,3 @@ const indices = new Array<{ | ||
curr += 4 | ||
const binIndex: { [key: number]: Chunk[] } = {} | ||
const binIndex: Record<number, Chunk[]> = {} | ||
@@ -70,0 +70,0 @@ for (let j = 0; j < binCount; j += 1) { |
@@ -157,3 +157,3 @@ import { Buffer } from 'buffer' | ||
} else { | ||
buffer = (await this.bam.readFile(opts)) as Buffer | ||
buffer = await this.bam.readFile(opts) | ||
} | ||
@@ -202,3 +202,3 @@ | ||
): Promise<{ | ||
chrToIndex: { [key: string]: number } | ||
chrToIndex: Record<string, number> | ||
indexToChr: { refName: string; length: number }[] | ||
@@ -225,3 +225,3 @@ }> { | ||
let p = start + 4 | ||
const chrToIndex: { [key: string]: number } = {} | ||
const chrToIndex: Record<string, number> = {} | ||
const indexToChr: { refName: string; length: number }[] = [] | ||
@@ -320,6 +320,6 @@ for (let i = 0; i < nRef; i += 1) { | ||
const { pairAcrossChr, maxInsertSize = 200000 } = opts | ||
const unmatedPairs: { [key: string]: boolean } = {} | ||
const readIds: { [key: string]: number } = {} | ||
const unmatedPairs: Record<string, boolean> = {} | ||
const readIds: Record<string, number> = {} | ||
feats.map(ret => { | ||
const readNames: { [key: string]: number } = {} | ||
const readNames: Record<string, number> = {} | ||
for (const element of ret) { | ||
@@ -326,0 +326,0 @@ const name = element.name() |
@@ -15,3 +15,3 @@ import VirtualOffset from './virtualOffset' | ||
toUniqueString() { | ||
return `${this.minv}..${this.maxv} (bin ${ | ||
return `${this.minv.toString()}..${this.maxv.toString()} (bin ${ | ||
this.bin | ||
@@ -18,0 +18,0 @@ }, fetchedSize ${this.fetchedSize()})` |
@@ -45,5 +45,3 @@ import { unzip } from '@gmod/bgzf-filehandle' | ||
const format = ( | ||
{ 0: 'generic', 1: 'SAM', 2: 'VCF' } as { | ||
[key: number]: string | ||
} | ||
{ 0: 'generic', 1: 'SAM', 2: 'VCF' } as Record<number, string> | ||
)[formatFlags & 0xf] | ||
@@ -101,3 +99,3 @@ if (!format) { | ||
type BinIndex = { [key: string]: Chunk[] } | ||
type BinIndex = Record<string, Chunk[]> | ||
@@ -115,3 +113,3 @@ // read the indexes for each reference sequence | ||
curr += 4 | ||
const binIndex: { [key: string]: Chunk[] } = {} | ||
const binIndex: Record<string, Chunk[]> = {} | ||
let stats // < provided by parsing a pseudo-bin, if present | ||
@@ -118,0 +116,0 @@ for (let j = 0; j < binCount; j++) { |
@@ -21,3 +21,3 @@ import { unzip } from '@gmod/bgzf-filehandle' | ||
// @ts-expect-error | ||
//eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { referer, ...rest } = headers | ||
@@ -24,0 +24,0 @@ const res = await fetch(url, { |
@@ -10,3 +10,3 @@ import Constants from './constants' | ||
export default class BamRecord { | ||
private data = {} as { [key: string]: any } | ||
private data = {} as Record<string, any> | ||
private bytes: { start: number; end: number; byteArray: Buffer } | ||
@@ -87,3 +87,3 @@ private _id: number | ||
for (const k of Object.keys(this.data)) { | ||
if (k[0] !== '_' && k !== 'next_seq_id') { | ||
if (!k.startsWith('_') && k !== 'next_seq_id') { | ||
tags.push(k) | ||
@@ -93,3 +93,3 @@ } | ||
const seen: { [key: string]: boolean } = {} | ||
const seen: Record<string, boolean> = {} | ||
return tags.filter(t => { | ||
@@ -499,4 +499,2 @@ if ( | ||
_flags() {} | ||
length_on_ref() { | ||
@@ -612,5 +610,5 @@ if (this.data.length_on_ref) { | ||
toJSON() { | ||
const data: { [key: string]: any } = {} | ||
const data: Record<string, any> = {} | ||
for (const k of Object.keys(this)) { | ||
if (k.charAt(0) === '_' || k === 'bytes') { | ||
if (k.startsWith('_') || k === 'bytes') { | ||
continue | ||
@@ -617,0 +615,0 @@ } |
@@ -78,3 +78,3 @@ import Long from 'long' | ||
export function makeOpts(obj: AbortSignal | BaseOpts = {}): BaseOpts { | ||
return 'aborted' in obj ? ({ signal: obj } as BaseOpts) : (obj as BaseOpts) | ||
return 'aborted' in obj ? ({ signal: obj } as BaseOpts) : obj | ||
} | ||
@@ -144,3 +144,3 @@ | ||
const refIdToName = [] | ||
const refNameToId: { [key: string]: number } = {} | ||
const refNameToId: Record<string, number> = {} | ||
for (let i = 0; i < namesBytes.length; i += 1) { | ||
@@ -147,0 +147,0 @@ if (!namesBytes[i]) { |
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
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
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
373029
6559