Skip to content

Commit 2cc4f13

Browse files
cmdcolinclaude
andcommitted
Further trim README: remove streaming example, fold constructor docs inline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4fa65c0 commit 2cc4f13

1 file changed

Lines changed: 1 addition & 38 deletions

File tree

README.md

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,14 @@ import VCF from '@gmod/vcf'
1414
const tbiIndexed = new TabixIndexedFile({ path: '/path/to/my.vcf.gz' })
1515

1616
const headerText = await tbiIndexed.getHeader()
17-
const parser = new VCF({ header: headerText })
17+
const parser = new VCF({ header: headerText }) // strict?: boolean (default true)
1818

1919
const variants = []
2020
await tbiIndexed.getLines('ctgA', 200, 300, line =>
2121
variants.push(parser.parseLine(line)),
2222
)
2323
```
2424

25-
For streaming a VCF file directly:
26-
27-
```typescript
28-
import fs from 'fs'
29-
import VCF from '@gmod/vcf'
30-
import { createGunzip } from 'zlib'
31-
import readline from 'readline'
32-
33-
const rl = readline.createInterface({
34-
input: fs.createReadStream(process.argv[2]).pipe(createGunzip()),
35-
})
36-
37-
const header = []
38-
let parser
39-
40-
rl.on('line', line => {
41-
if (line.startsWith('#')) {
42-
header.push(line)
43-
} else {
44-
if (!parser) {
45-
parser = new VCF({ header: header.join('\n') })
46-
}
47-
const variant = parser.parseLine(line)
48-
console.log(variant.INFO.NS[0])
49-
}
50-
})
51-
```
52-
53-
## Constructor
54-
55-
```typescript
56-
new VCF({ header: string, strict?: boolean })
57-
```
58-
59-
- `header` — the full VCF header string (LF or CRLF)
60-
- `strict` — throw on missing INFO field (default `true`)
61-
6225
## Variant
6326

6427
`parseLine(line)` returns a `Variant` with these fields:

0 commit comments

Comments
 (0)