https://github.com/svm-zhang/tinyhgvs
Lightweight HGVS variant parser
https://github.com/svm-zhang/tinyhgvs
bioinformatics genomics hgvs parser variant-analysis
Last synced: 3 months ago
JSON representation
Lightweight HGVS variant parser
- Host: GitHub
- URL: https://github.com/svm-zhang/tinyhgvs
- Owner: svm-zhang
- License: mit
- Created: 2025-01-08T07:03:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-04-01T16:35:31.000Z (3 months ago)
- Last Synced: 2026-04-02T05:11:30.366Z (3 months ago)
- Topics: bioinformatics, genomics, hgvs, parser, variant-analysis
- Language: Rust
- Homepage: https://svm-zhang.github.io/tinyhgvs/
- Size: 380 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# tinyhgvs
[](https://pypi.org/project/tinyhgvs/)
[](https://pypi.org/project/tinyhgvs/)
[](https://github.com/svm-zhang/tinyhgvs/actions/workflows/ci.yml)
[](https://github.com/svm-zhang/tinyhgvs/blob/main/LICENSE)
[](https://crates.io/crates/tinyhgvs)
[](https://docs.rs/tinyhgvs)
`tinyhgvs` is a lightweight HGVS parsing Python library backed by a core parser and
structured data and error model implemented in Rust.
## Installation
`tinyhgvs` can be installed directly from PyPI:
```bash
pip install tinyhgvs
```
## Quick start
- A splicing-site substitution crossing an exon/intron boundary:
```python
from tinyhgvs import parse_hgvs
variant = parse_hgvs("NM_004006.2:c.357+1G>A")
print(variant.reference.primary.id)
print(variant.coordinate_system.value)
print(variant.description.location.start.coordinate)
print(variant.description.location.start.offset)
```
- An exact repeat is parsed into a structured repeat edit:
```python
from tinyhgvs import parse_hgvs
variant = parse_hgvs("NC_000014.8:g.123CAG[23]")
print(variant.description.location.start.coordinate)
print(variant.description.edit.blocks[0].unit)
print(variant.description.edit.blocks[0].count)
```
- A protein frameshift variant:
```python
from tinyhgvs import parse_hgvs
variant = parse_hgvs("NP_0123456.1:p.Arg97ProfsTer23")
print(variant.description.effect.edit.to_residue)
print(variant.description.effect.edit.stop.ordinal)
```
- Known but unsupported HGVS syntax raises `TinyHGVSError` with a diagnostic code:
```python
from tinyhgvs import TinyHGVSError, parse_hgvs
try:
parse_hgvs("NC_000001.11:g.[123G>A;345del]")
except TinyHGVSError as error:
print(error.code)
```
## Documentation
Please refer to official documents for details about both Python and Rust APIs:
- [Python API and project docs](https://svm-zhang.github.io/tinyhgvs)
- [Rust API docs](https://docs.rs/tinyhgvs)
## Citation
If you use `tinyhgvs` in your project, please kindly cite the github repository.
## License
`tinyhgvs` is licensed under the MIT license.