Skip to main content

VariantHierarchy

VariantHierarchy is an open-source computational framework for semantic normalization and hierarchical organization of somatic categorical variants in precision oncology. Precision-oncology evidence is often described at different levels of abstraction: a knowledge base may annotate evidence for EGFR exon 19 in-frame deletion while a patient report contains EGFR E746_A750del, or evidence may be assigned to BRAF V600X while the patient variant is BRAF V600E. VariantHierarchy makes these cross-granularity relationships explicit, machine-readable, and reusable.

The framework represents each normalized variant concept across three semantic dimensions: genomic location, molecular alteration, and functional interpretation. It then infers directed containment relationships from broader concepts to more specific compatible concepts. The core implementation is maintained in src/variant_hierarchy and is distributed on PyPI as the variant-hierarchy package.

Research Scope

VariantHierarchy focuses on somatic categorical variants from cancer precision oncology resources, including protein-level sequence variants, amino-acid site and region categories, exon-level categories, gene-level mutation classes, copy-number alterations, structural variants, expression and methylation states, and functional or oncogenicity assertions.

The current study integrates variant concepts from COSMIC, OncoKB, CIViC, and the Cancer Genome Interpreter (CGI). After normalization and deduplication, 12,472 unique source-derived variant concepts were retained. The final hierarchy contains semantically inferred containment relationships and knowledge-supported functional relationships, followed by redundancy removal to produce a non-redundant hierarchy graph.

Framework Overview

VariantHierarchy is organized around four methodological components:

Component Role
Semantic representation Represents each variant concept using genomic location, molecular alteration, and functional interpretation.
Controlled vocabularies Standardize recurrent molecular alteration and functional interpretation terms and encode broader-narrower relationships.
Variant normalization Converts heterogeneous source terms into structured normalized variant concepts with canonical display names.
Containment inference Infers parent-child relationships between compatible concepts and constructs a directed hierarchy graph.

Semantic Representation

Each normalized variant concept is represented by a display name and three semantic dimensions:

Dimension Meaning Examples
Genomic location The biological scope at which the variant is described. gene, exon, amino-acid site, protein HGVS position/edit
Molecular alteration The molecular event or alteration class. mutation, missense, in-frame deletion, amplification, fusion, methylation
Functional interpretation Biological consequence or oncogenicity assertion. gain-of-function, loss-of-function, oncogenic mutation, inconclusive mutation

The framework distinguishes concrete variants from categorical variants. In this project, a concrete variant refers to a protein-level sequence alteration that can be represented using HGVS protein nomenclature, such as BRAF V600E. Categorical variants are broader concepts that encompass multiple biologically related variants, such as BRAF V600X, BRAF mutation, or BRAF oncogenic mutation.

Variant concepts are further grouped into semantic categories including p.HGVS variants, categorical sequence variants, copy-number alteration categories, structural alteration categories, expression-state categories, methylation-state categories, and functional assertion categories.

Variant Normalization

Variant normalization converts heterogeneous source terms into the semantic representation described above. The procedure includes source-specific preprocessing, gene normalization, variant parsing, and semantic assignment.

The normalization process covers:

  • protein-level substitutions, deletions, duplications, delins, frameshift and nonsense variants;
  • amino-acid site and region-level variant classes;
  • exon-level mutation, deletion, insertion, splice, and exon-skipping categories;
  • gene-level mutation and copy-number categories;
  • structural variants including fusions, rearrangements, and translocations;
  • expression and methylation states;
  • functional and oncogenicity assertions.

Clinical and database shorthand is handled conservatively. For example, incomplete insertion shorthand such as ALK T1151ins is represented as an amino-acid position-level in-frame insertion rather than as a complete coordinate-resolvable protein HGVS edit.

Gene normalization uses a local alias table by default. If a VICC Gene Normalizer service is available at:

http://localhost:8001

the runtime can use it as an enhanced gene-normalization backend and fall back to local aliases when needed.

Hierarchy Construction

Containment inference determines whether one normalized variant concept semantically encompasses another. Candidate parent-child pairs are compared jointly across genomic location, molecular alteration, and functional interpretation. A parent contains a child when no dimension is incompatible and at least one dimension is broader.

Examples of containment relationships include:

  • BRAF V600X contains BRAF V600E;
  • EGFR exon 19 in-frame deletion contains EGFR E746_A750del;
  • TP53 mutation contains TP53 R175H;
  • ALK fusion contains compatible specific fusions such as EML4::ALK fusion;
  • PTEN loss-of-function contains compatible loss-of-function mechanisms.

Location containment uses structured gene, exon, amino-acid, and p.HGVS representations. When precise positional comparison is required, local genomic infrastructure can be used to convert protein or region-level descriptions into comparable transcript-based intervals. This dynamic containment pathway may require:

  • VICC Gene Normalizer at http://localhost:8001 for enhanced gene normalization;
  • UTA, the Universal Transcript Archive, for transcript alignment data;
  • SeqRepo sequence data for local biological sequence retrieval.

A typical local UTA DSN is:

postgresql://uta_admin:uta@localhost:5432/uta/uta_20241220

Precomputed hierarchy queries do not require local VICC, UTA, or SeqRepo services.

Python Package

Install the runtime package from PyPI:

pip install variant-hierarchy

The package exposes precomputed hierarchy queries and lightweight normalization:

from variant_hierarchy import (
    ancestors,
    children,
    descendants,
    gene_hierarchy,
    hierarchy,
    normalize_variant,
    parents,
    variant_hierarchy,
)

normalize_variant("BRAF V600")
parents("BRAF V600D")
children("BRAF V600X")
ancestors("EGFR E746_A750del")
descendants("BRAF V600")

The package supports both gene-level and variant-level hierarchy queries:

gene_hierarchy("BRAF")
variant_hierarchy("BRAF V600D")

# Auto mode: gene input returns a gene hierarchy; variant input returns a variant hierarchy.
hierarchy("BRAF")
hierarchy("BRAF V600D")

Dynamic containment can be used when the required genomic infrastructure is available:

from variant_hierarchy import contains_variant

contains_variant(
    "EGFR exon 19 in-frame deletion",
    "EGFR E746_A750del",
    uta_dsn="postgresql://uta_admin:uta@localhost:5432/uta/uta_20241220",
)

If the required genomic dependencies, UTA service, or SeqRepo data are unavailable, contains_variant raises GenomicBackendUnavailable. This does not affect precomputed hierarchy queries such as parents(), children(), gene_hierarchy(), or variant_hierarchy().

Hierarchy Visualization

An interactive hierarchy browser is available through GitHub Pages:

https://hui-zju.github.io/variant_hierarchy/visualization/

The visualization supports gene hierarchy queries, variant node queries, ancestor paths, descendants, branch expansion and collapse, pan and zoom, and inspection of normalized variant metadata.

Evaluation

VariantHierarchy is evaluated at two levels.

First, curated challenge sets are used to evaluate variant normalization and containment inference. The normalization challenge set samples heterogeneous variant terms across predefined categories, and the hierarchy challenge set samples candidate parent-child pairs across positive and negative relation types. Expert-reviewed labels are used as the reference standard.

Second, application-level utility is evaluated by comparing exact matching with hierarchy-aware matching for precision oncology evidence retrieval. Patient-variant records from GENIE/MSKCC and MSK-IMPACT cohorts are normalized and matched against evidence-bearing variant concepts from COSMIC, OncoKB, CIViC, and CGI. Hierarchy-aware matching additionally allows patient variants to retrieve evidence assigned to compatible broader ancestor concepts.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

variant_hierarchy-0.2.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

variant_hierarchy-0.2.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file variant_hierarchy-0.2.0.tar.gz.

File metadata

  • Download URL: variant_hierarchy-0.2.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for variant_hierarchy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 51ea8d90d88b025f82c17fd0f87f167d3d4139ed84d560e9addfdeb33bbf3cdb
MD5 e9e831cbf1aad738a65a287edf35dace
BLAKE2b-256 596617bd265583bfa5a747554343caff7dfe6b48a02d94818c45fb0ed2718db7

See more details on using hashes here.

File details

Details for the file variant_hierarchy-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for variant_hierarchy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37d6e4bf57950df241a9b6fb0021681f251cc8bef2f2397dea39173b99df4954
MD5 401ebcd800854e7be1c79582407ebbf2
BLAKE2b-256 bbf58adcce57f9975c57502cf30a96474402e07030f70c18a1122e7b8ab42f35

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page