From c6450a11f3dcd5785894966fc3c6aade75329b37 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 11 Dec 2024 14:04:37 -0500 Subject: [PATCH] Passing tests --- src/bamFile.ts | 1 - src/csi.ts | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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? }