hgvs - manipulate biological sequence variants according to Human Genome Variation Society recommendations
The hgvs package provides a Python library to parse, format, validate,
normalize, and map sequence variants according to Variation
Nomenclature (aka Human Genome Variation
Society) recommendations.
Specifically, the hgvs package focuses on the subset of the HGVS
recommendations that precisely describe sequence-level variation
relevant to the application of high-throughput sequencing to clinical
diagnostics. The package does not attempt to cover the full scope of
HGVS recommendations. Please refer to
issues for limitations.
Information
Latest Release
Development
Features
Parsing is based on formal grammar.
An easy-to-use object model that represents most variant types
(SNVs, indels, dups, inversions, etc) and concepts (intronic
offsets, uncertain positions, intervals)
A variant normalizer that rewrites variants in canonical forms and
substitutes reference sequences (if reference and transcript
sequences differ)
Formatters that generate HGVS strings from internal representations
Tools to map variants between genome, transcript, and protein
sequences
Reliable handling of regions genome-transcript discrepancies
Pluggable data providers support alternative sources of transcript
mapping data
Extensive automated tests, including those for all variant types and
"problematic" transcripts
Easily installed using remote data sources. Installation with local
data sources is straightforward and completely obviates network
access
Citation
Wang M, Callenberg KM, Dalgleish R, Fedtsov A, Fox N, Freeman PJ, et al.
hgvs: A Python package for manipulating sequence variants using HGVS nomenclature: 2018 Update. Hum Mutat. 2018. doi:10.1002/humu.23615
Important Notes
You are encouraged tobrowse
issues. All known issues
are listed there. Please report any issues you find.
Use a pip package specification to stay within minor releases.
For example, hgvs>=1.5,<1.6. hgvs uses Semantic
Versioning.
Installing HGVS Locally
Important: For more detailed installation and configuration
instructions, see the HGVS readthedocs
By default, hgvs uses remote data sources, which makes
installation easy. If you would like to use local instances of the data sources, see the readthedocs.
Create a virtual environment using your preferred method.
Example:
python3 -m venv venv
Run the following commands in your virtual environment:
The hgvs package is a community effort. Please see
Contributing to get
started in submitting source code, tests, or documentation. Thanks for getting
involved!
Create a Python virtual environment, install dependencies, install pre-commit hooks, and install an editable package:
make devready
Development
N.B. Developers are expected to use make to invoke tools to
ensure consistency with the CI/CD pipelines. Type make to see a list of
supported targets. A subset are listed here:
» make
🌟🌟 biocommons conventional make targets 🌟🌟
Using these targets promots consistency between local development and ci/cd commands.
usage: make [target ...]
BASIC USAGE
help Display help message
SETUP, INSTALLATION, PACKAGING
devready Prepare local dev env: Create virtual env, install the pre-commit hooks
build Build package
publish publish package to PyPI
FORMATTING, TESTING, AND CODE QUALITY
cqa Run code quality assessments
test Test the code with pytest
DOCUMENTATION
docs-serve Build and serve the documentation
docs-test Test if documentation can be built without warnings or errors
CLEANUP
clean Remove temporary and backup files
cleaner Remove files and directories that are easily rebuilt
cleanest Remove all files that can be rebuilt
distclean Remove untracked files and other detritus
Testing
Existing tests use a cache that is committed with the repo to ensure that tests do not require external networking. To develop new tests, which requires loading the cache, you should install UTA and Seqrepo (and the rest service) locally.
docker compose --project-name biocommons -f ./misc/docker-compose.yml up
IMPORTANT: Loading the test caches is currently hampered by
#551,
#760, and
#761. To load reliably, use
make test-relearn-iteratively for now.
hgvs - manipulate biological sequence variants according to Human Genome Variation Society recommendations
The hgvs package provides a Python library to parse, format, validate, normalize, and map sequence variants according to Variation Nomenclature (aka Human Genome Variation Society) recommendations.
Specifically, the hgvs package focuses on the subset of the HGVS recommendations that precisely describe sequence-level variation relevant to the application of high-throughput sequencing to clinical diagnostics. The package does not attempt to cover the full scope of HGVS recommendations. Please refer to issues for limitations.
Information
Latest Release
Development
Features
Citation
Wang M, Callenberg KM, Dalgleish R, Fedtsov A, Fox N, Freeman PJ, et al.
hgvs: A Python package for manipulating sequence variants using HGVS nomenclature: 2018 Update.
Hum Mutat. 2018. doi:10.1002/humu.23615
Important Notes
hgvs>=1.5,<1.6. hgvs uses Semantic Versioning.Installing HGVS Locally
Important: For more detailed installation and configuration instructions, see the HGVS readthedocs
Prerequisites
Examples for installation:
MacOS :
Ubuntu :
Installation Steps
By default, hgvs uses remote data sources, which makes installation easy. If you would like to use local instances of the data sources, see the readthedocs.
Create a virtual environment using your preferred method.
Example:
Run the following commands in your virtual environment:
See Installation instructions for details, including instructions for installing Universal Transcript Archive (UTA) and SeqRepo locally.
Examples and Usage
See examples and readthedocs for usage.
Developer Setup
The hgvs package is a community effort. Please see Contributing to get started in submitting source code, tests, or documentation. Thanks for getting involved!
Install Prerequisites
These tools are required to get started:
MacOS or Linux Systems
brew install git make uvLinux (Debian-based systems)
You may also install using distribution packages:
Then install uv using the uv installation instructions.
One-time development setup
Create a Python virtual environment, install dependencies, install pre-commit hooks, and install an editable package:
Development
N.B. Developers are expected to use
maketo invoke tools to ensure consistency with the CI/CD pipelines. Typemaketo see a list of supported targets. A subset are listed here:Testing
Existing tests use a cache that is committed with the repo to ensure that tests do not require external networking. To develop new tests, which requires loading the cache, you should install UTA and Seqrepo (and the rest service) locally.
IMPORTANT: Loading the test caches is currently hampered by #551, #760, and #761. To load reliably, use
make test-relearn-iterativelyfor now.