ferro-hgvs
A high-performance HGVS variant nomenclature parser and normalizer written in Rust.
WARNING: ALPHA SOFTWARE - USE AT YOUR OWN RISK
This software is currently in ALPHA. While we have extensively tested it across a wide variety of HGVS patterns, no guarantees are made regarding correctness or stability.
Features
- Full HGVS Parsing: All coordinate systems (g/c/n/r/p/m/o) and edit types
- Variant Normalization: 3' shifting per HGVS specification
- High Performance: ~5M variants/sec single-threaded parsing (>12M/s parallel), zero-copy with nom
- Type-Safe: Leverages Rust's type system for correctness
Installation
Python
Pre-built wheels are available for Linux (x86_64, aarch64), macOS (x86_64, Apple Silicon), and Windows (x86_64) on Python 3.10+.
Rust
Add to your Cargo.toml:
[]
= "0.1"
Or install the CLI:
Quick Start
CLI
# Parse a variant
# Parse from file
# Prepare reference data (downloads RefSeq, genome, cdot — RefSeq-only by default)
# Verify reference data is ready
# (Optional) pre-build the on-disk cdot cache as a setup step, so the one-time
# cache build doesn't slow the start of a real (or timed/benchmarked) run.
# Normalize with reference
Read the warnings. Normalization sometimes repairs a description in a way the normalized string does not record — separately reported cis members merged into one
delins(MEMBERS_COALESCED_FROM_REPORTED_FORM), ains[100_110]reference-range payload replaced by the bases it denotes (INSERTED_SEQUENCE_EXPANDED), a stated reference base that contradicted the reference and was accepted anyway (REFSEQ_MISMATCH). Those are reported aswarning[CODE]: messageon stderr (and in thewarningsarray under--format json, thedetailcolumn under--format tsv), so a pipeline reading only stdout will not see them.--error-mode strictis not a substitute: it rejects a specific ladder of conditions and reports the rest exactly as lenient does.
Throughput tip: when normalizing many variants, feed them sorted by transcript accession (or by genomic position). ferro caches each resolved transcript, so consecutive variants on the same transcript skip the (dominant) cost of re-reading and re-building it from the reference. Sorted input keeps the relevant transcripts resident in the cache and is markedly faster on large batches — see Performance Comparison.
Optional reference data
A bare ferro prepare builds a RefSeq-only reference (accessions NM_/NR_/NP_/NG_). Two opt-in flags provision additional data — pass them at prepare time; they are what a fully-provisioned ("blessed") reference is built with:
# Add Ensembl support (accessions ENST/ENSG/ENSP). Downloads the Ensembl cdot
# metadata and cDNA FASTAs (~1 GB+); off by default. Without it, an ENST/ENSG/ENSP
# input reports "Reference not found" and the message points back at this flag.
# Derive version-independent NG_ placements and the NG_→transcript-version map
# (ng_hosted_transcripts) for a curated list of RefSeqGene accessions. Required to
# resolve legacy gene-symbol selectors (NG_(GENE):c.…) and bare-NG_ hosted lookups.
# A fully-provisioned reference combines both in one run:
Both flags are incremental: re-running ferro prepare over an existing reference adds the requested data and preserves already-provisioned artifacts.
Library
use ;
Python
# Parse a variant
=
# "coding"
# "NM_000088.3"
# "NM_000088.3:c.459A>G"
# Normalize with reference data
=
=
# `normalize` returns only the string, so it cannot tell you that normalization
# repaired something. `normalize_with_warnings` returns the same string plus the
# diagnostics — as a free function, or as a Normalizer method.
=
# the same normalized string
Documentation
Full guides live in the documentation site (source under docs/src/):
- Normalization rules — ferro's output contract: what a normalized description is allowed to be
- Deriving a description from sequences — turn a window of bases into one canonical description, no reference needed
- Normalize variants · Reference data
- Project to another axis — re-express a variant on a transcript; the projected
c./r.axis applies the coding-axis rules a genomic axis cannot - Error handling — strict / lenient / silent modes and warning codes
- Comparing normalization rules (
FERRO_PARTITION) - Benchmarking
- CLI reference · Supported HGVS syntax
- Why ferro-hgvs? — tool comparison — capability matrix, cross-tool benchmarks, and what
ferro preparebuilds - Interpreting the HGVS recommendations — how ferro reads each clause
Why ferro-hgvs?
ferro-hgvs provides the most comprehensive HGVS variant normalization across all pattern types, with performance orders of magnitude faster than alternatives. For the full capability matrix against mutalyzer / biocommons / hgvs-rs, the cross-tool parse/normalize benchmarks, and what ferro prepare builds, see Why ferro-hgvs? — tool comparison.
Benchmark: Reference Data & Tool Comparison
The main ferro binary includes commands to prepare reference data (ferro prepare) and check its status (ferro check). The ferro-benchmark tool (build with --features benchmark) extends this for tool comparison benchmarks.
| Command | Description |
|---|---|
prepare <tool> |
Prepare reference data for a tool |
check <tool> |
Verify tool configuration and dependencies |
parse <tool> |
Parse HGVS patterns with specified tool |
normalize <tool> |
Normalize HGVS patterns with specified tool |
compare results |
Compare parse/normalize results between tools |
extract |
Extract patterns from ClinVar, VCFs, or create samples |
setup |
Set up UTA database, SeqRepo, and other services |
generate |
Generate summary reports and configs |
collate |
Aggregate sharded results |
Quick Start
# Prepare ferro reference (main binary - no special features needed)
# Check reference data
# Normalize with ferro
# For tool comparison, build with benchmark support
# Prepare other tools (uses ferro reference for transcript data)
# Compare results between tools
Supported tools: ferro-hgvs, mutalyzer, biocommons/hgvs, hgvs-rs
Note: The
pixi.tomlandpixi.lockfiles in this repository define a pixi environment for the Python-based external tools (mutalyzer, biocommons/hgvs, seqrepo) used in benchmarking. Runpixi shellto activate it.
See docs/BENCHMARK_GUIDE.md for detailed usage.
Development
The commands above use the default feature set, and CI keeps them compiling (see
the build job). They do not cover the whole suite — the feature-gated tests and
the integration tree need dev, which is what CI runs and what you want before
opening a PR:
License
Licensed under the MIT License. See LICENSE for details.
Disclaimer
This software is under active development. While we make a best effort to test this software and to fix issues as they are reported, this software is provided as-is without any warranty (see the license for details). Please submit an issue, and better yet a pull request as well, if you discover a bug or identify a missing feature. Please contact Fulcrum Genomics if you are considering using this software or are interested in sponsoring its development.
Contributing
See CONTRIBUTING.md for guidelines.