variant

BaseVariant Objects

class BaseVariant()

Base class for all variant types.

show_annotations

def show_annotations() -> Dict[str, Any]

Return annotation types.

query_annotation

def query_annotation(key: str) -> Any

Query a specific annotation.

add_annotation

def add_annotation(key: str, value: Any) -> None

Add or update an annotation.

SequenceVariant Objects

class SequenceVariant(BaseVariant)

Class for SNV and Indel variants.

__len__

def __len__()

Return the length of the variant.

__str__

def __str__()

Return a string representation of the variant.

__repr__

def __repr__()

Return a detailed string representation of the variant.

StructuralVariant Objects

class StructuralVariant(BaseVariant)

Class for SV/CNV variants (INS, DEL, INV, DUP, BND, CNV).

__len__

def __len__()

Return the length of the variant.

__str__

def __str__()

Return a string representation of the variant.

__repr__

def __repr__()

Return a detailed string representation of the variant.

TandemRepeatVariant Objects

class TandemRepeatVariant(BaseVariant)

Class for Tandem Repeat variants (SRWGS and LRWGS).

__len__

def __len__()

Return the length of the variant.

__str__

def __str__()

Return a string representation of the variant.

__repr__

def __repr__()

Return a detailed string representation of the variant.

utils

infer_variant_type

def infer_variant_type(ref_allele, alt_allele)

Infer the variant type based on reference and alternative alleles.

Arguments:

  • ref_allele str - Reference allele sequence
  • alt_allele str - Alternative allele sequence

Returns:

  • str - Inferred variant type (‘snv’, ‘deletion’, ‘insertion’, ‘indel’, ‘duplication’, ‘translocation’)

to_hgvs

def to_hgvs(variant)

Convert genomic coordinates and variant details to HGVS notation, inferring variant type.

Arguments:

  • chromosome str - Chromosome name (e.g., ‘1’, ‘X’, ‘chr1’)
  • position int - Genomic position of the variant
  • ref_allele str - Reference allele or sequence
  • alt_allele str - Alternative allele or sequence

Returns:

  • str - HGVS notation for the variant