Skip to content

Commit

Permalink
Lazy load alternative methods
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 12, 2023
1 parent 8db6cac commit 84b13c2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20,834 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on: push

jobs:
test:
name: Lint, build, and test on node 16.x and ubuntu-latest
name: Lint, build, and test on node 20.x and ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
- name: Lint codebase
Expand Down
16 changes: 2 additions & 14 deletions src/cramFile/file.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { unzip } from '../unzip'
import crc32 from 'buffer-crc32'
import QuickLRU from 'quick-lru'
import htscodecs from '@jkbonfield/htscodecs'
import { Parser } from '@gmod/binary-parser'
// @ts-expect-error
import bzip2 from 'bzip2'
import { XzReadableStream } from 'xz-decompress'
import htscodecs from '@jkbonfield/htscodecs'
import { Parser } from '@gmod/binary-parser'

import { CramMalformedError, CramUnimplementedError } from '../errors'
import ransuncompress from '../rans'
import {
Expand Down Expand Up @@ -110,17 +109,6 @@ export default class CramFile {
}
}

// toString() {
// if (this.file.filename) {
// return this.file.filename
// }
// if (this.file.url) {
// return this.file.url
// }
//
// return '(cram file)'
// }

// can just read this object like a filehandle
read(
buffer: Buffer,
Expand Down
4 changes: 2 additions & 2 deletions test/compressions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CramFile } from '../src/index'
import { FetchableSmallFasta } from './lib/fasta'

test('lzma', async () => {
const fasta = new FetchableSmallFasta(testDataFile('hts-specs/ce.fa'))
const fasta = new FetchableSmallFasta(testDataFile('ce.fa'))
const seqFetch = fasta.fetch.bind(fasta)
const file = new CramFile({
filehandle: testDataFile('hts-specs/0903_comp_lzma.cram'),
Expand All @@ -18,7 +18,7 @@ test('lzma', async () => {
})

test('bzip2', async () => {
const fasta = new FetchableSmallFasta(testDataFile('hts-specs/ce.fa'))
const fasta = new FetchableSmallFasta(testDataFile('ce.fa'))
const seqFetch = fasta.fetch.bind(fasta)
const file = new CramFile({
filehandle: testDataFile('hts-specs/0902_comp_bz2.cram'),
Expand Down
Loading

0 comments on commit 84b13c2

Please sign in to comment.