File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,51 +14,14 @@ import VCF from '@gmod/vcf'
1414const tbiIndexed = new TabixIndexedFile ({ path: ' /path/to/my.vcf.gz' })
1515
1616const headerText = await tbiIndexed .getHeader ()
17- const parser = new VCF ({ header: headerText })
17+ const parser = new VCF ({ header: headerText }) // strict?: boolean (default true)
1818
1919const variants = []
2020await 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:
You can’t perform that action at this time.
0 commit comments