diff --git a/src/bamFile.ts b/src/bamFile.ts index 63df00e..754e746 100644 --- a/src/bamFile.ts +++ b/src/bamFile.ts @@ -152,7 +152,6 @@ export default class BamFile { buffer = await this.bam.readFile(opts) } - console.log({ buffer }) const uncba = await unzip(buffer) const dataView = new DataView(uncba.buffer) diff --git a/src/csi.ts b/src/csi.ts index 9519e89..d59b4e2 100644 --- a/src/csi.ts +++ b/src/csi.ts @@ -80,13 +80,14 @@ export default class CSI extends IndexFile { const dataView = new DataView(bytes.buffer) let csiVersion - // check TBI magic numbers - if (dataView.getUint32(0, true) === CSI1_MAGIC) { + const magic = dataView.getUint32(0, true) + + if (magic === CSI1_MAGIC) { csiVersion = 1 - } else if (dataView.getUint32(0, true) === CSI2_MAGIC) { + } else if (magic === CSI2_MAGIC) { csiVersion = 2 } else { - throw new Error('Not a CSI file') + throw new Error(`Not a CSI file ${magic}`) // TODO: do we need to support big-endian CSI files? }