Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with example from README #70

Closed
nathanweeks opened this issue Apr 20, 2023 · 2 comments
Closed

Error with example from README #70

nathanweeks opened this issue Apr 20, 2023 · 2 comments

Comments

@nathanweeks
Copy link
Member

The last example in the README (substituting real .fa/.fai files):

```typescript
import { IndexedFasta, BgzipIndexedFasta } from '@gmod/indexedfasta'
import { RemoteFile } from 'generic-filehandle'
import fetch from 'cross-fetch'
const t = new IndexedFasta({
filehandle: new RemoteFile('http://yourside.com/test.fa', { fetch }),
faiFilehandle: new RemoteFile('http://yourside.com/test.fa.fai', { fetch }),
})
```

Results in the error

% cat example.mjs
import { IndexedFasta, BgzipIndexedFasta } from '@gmod/indexedfasta'
import { RemoteFile } from 'generic-filehandle'

const t = new IndexedFasta({
  filehandle: new RemoteFile('https://raw.githubusercontent.com/samtools/htslib/develop/test/faidx/faidx.fa', { fetch }),
  faiFilehandle: new RemoteFile('https://raw.githubusercontent.com/samtools/htslib/develop/test/faidx/faidx.fa.expected.fai', { fetch }),
})
% node example.mjs
/.../node_modules/@gmod/indexedfasta/dist/indexedFasta.js:97
            throw new Error('Need to pass filehandle for fasta or path to localfile');
                  ^

Error: Need to pass filehandle for fasta or path to localfile
    at new IndexedFasta (/.../node_modules/@gmod/indexedfasta/dist/indexedFasta.js:97:19)
    at file:///.../example.mjs:4:11
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Node.js v18.15.0

Substituting the parameters "filehandle" and "faiFilehandle" with "fasta" and "fai", respectively, appears to resolve the issue. Is the documentation out of date, or is something else amiss?

@cmdcolin
Copy link
Collaborator

that is a real bug in the docs, thanks for pointing it out! actually fixed other cases of that issue recently but didn't apply to entire readme c028625

@cmdcolin
Copy link
Collaborator

just auto closed issue with the commit message but lemme know if anything else comes up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants