Skip to content

Commit

Permalink
Remove note about percent decoding not being done
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Dec 8, 2024
1 parent 02029da commit 2ade7e9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"arrowParens": "avoid"
"arrowParens": "avoid",
"proseWrap": "always"
}
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# [6.0.0](https://github.com/GMOD/vcf-js/compare/v5.0.10...v6.0.0) (2024-11-30)

- Changes the default Variant object to have a SAMPLES() function call instead of a SAMPLES getter, to make it mor abundantly clear that it is a lazy operation. Also adds a GENOTYPES() function that returns the raw string of genotype fields
- Changes the default Variant object to have a SAMPLES() function call instead
of a SAMPLES getter, to make it mor abundantly clear that it is a lazy
operation. Also adds a GENOTYPES() function that returns the raw string of
genotype fields

## [5.0.10](https://github.com/GMOD/vcf-js/compare/v5.0.9...v5.0.10) (2022-12-17)

Expand Down Expand Up @@ -30,7 +33,8 @@

## [5.0.5](https://github.com/GMOD/vcf-js/compare/v5.0.4...v5.0.5) (2022-01-12)

- Add optimization related to better allocation of variant records, thanks to @bpow for contributing
- Add optimization related to better allocation of variant records, thanks to
@bpow for contributing

<a name="5.0.4"></a>

Expand Down
48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ The `variant` object returned by `parseLine()` would be
}
```

The `variant.SAMPLES()` and `variant.GENOTYPES()` are functions because it does not
try to eagerly parse all the genotype data, so will only do so when you call
The `variant.SAMPLES()` and `variant.GENOTYPES()` are functions because it does
not try to eagerly parse all the genotype data, so will only do so when you call
either of these which can save time especially if your VCF has a lot of samples
in it.

Expand All @@ -125,13 +125,11 @@ using the header metadata. For example, if there is a header line like
```

The parser will expect any INFO entry ABC to be an array of two integers, so it
would convert `ABC=12,20` to `{ ABC: [12, 20] }`. Each INFO entry value will be
an array unless `Type=Flag` is specified, in which case it will be `true`. If no
metadata can be found for the entry, it will assume `Number=1` and
`Type=String`.
would convert `ABC=12,20` to `{ ABC: [12, 20] }`.

_NOTE: the vcf specification allows percent-encoded characters. this library
does not decode them, an end-use library can call url-decode methods_
Each INFO entry value will be an array unless `Type=Flag` is specified, in which
case it will be `true`. If no metadata can be found for the entry, it will
assume `Number=1` and `Type=String`.

Some fields are pre-defined by the
[VCF spec](https://samtools.github.io/hts-specs/VCFv4.3.pdf), which is why in
Expand Down Expand Up @@ -199,7 +197,8 @@ you can access the VCF's header metadata like (some output omitted for clarity):
1
```
A list of sample names is also available in the `samples` attribute of the parser object:
A list of sample names is also available in the `samples` attribute of the
parser object:
```typescript
> console.log(vcfParser.samples)
Expand Down Expand Up @@ -285,22 +284,27 @@ Class representing a VCF parser, instantiated with the VCF header.
#### Parameters
- `args` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
- `args`
**[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
- `args.header` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The VCF header. Supports both LF and CRLF
newlines. (optional, default `''`)
- `args.strict` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether to parse in strict mode or not
(default true) (optional, default `true`)
- `args.header`
**[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
The VCF header. Supports both LF and CRLF newlines. (optional, default `''`)
- `args.strict`
**[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
Whether to parse in strict mode or not (default true) (optional, default
`true`)
#### getMetadata
Get metadata filtered by the elements in args. For example, can pass
('INFO', 'DP') to only get info on an metadata tag that was like
"##INFO=\<ID=DP,...>"
Get metadata filtered by the elements in args. For example, can pass ('INFO',
'DP') to only get info on an metadata tag that was like "##INFO=\<ID=DP,...>"
##### Parameters
- `args` **...[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of metadata filter strings.
- `args`
**...[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
List of metadata filter strings.
Returns **any** An object, string, or number, depending on the filtering
Expand Down Expand Up @@ -337,8 +341,8 @@ Parse a VCF line into an object like
```
SAMPLES and GENOTYPES methods are functions instead of static data fields
because it avoids parsing the potentially long list of samples from e.g.
1000 genotypes data unless requested.
because it avoids parsing the potentially long list of samples from e.g. 1000
genotypes data unless requested.
The SAMPLES function gives all info about the samples
Expand All @@ -347,4 +351,6 @@ potentially optimized parsing by programs that need it
##### Parameters
- `line` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A string of a line from a VCF
- `line`
**[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
A string of a line from a VCF

0 comments on commit 2ade7e9

Please sign in to comment.