Skip to content

onconova.oncology.models.genomic_variant

DNAChangeType

Bases: TextChoices

An enumeration of possible DNA change types for genomic variants.

Attributes:

Name Type Description
SUBSTITUTION

A single nucleotide is replaced by another.

DELETION_INSERTION

A combination of deletion and insertion at the same location.

INSERTION

Addition of one or more nucleotides into the DNA sequence.

DELETION

Removal of one or more nucleotides from the DNA sequence.

DUPLICATION

A segment of DNA is duplicated.

INVERSION

A segment of DNA is reversed end to end.

UNCHANGED

No change detected in the DNA sequence.

REPETITION

A sequence motif is repeated multiple times.

TRANSLOCATION

A segment of DNA is moved to a different location.

TRANSPOSITION

Movement of a DNA segment to a new position within the genome.

METHYLATION_GAIN

Gain of methylation at a specific DNA region.

METHYLATION_LOSS

Loss of methylation at a specific DNA region.

METHYLATION_UNCHANGED

No change in methylation status.

DELETION class-attribute instance-attribute

DELETION_INSERTION class-attribute instance-attribute

DUPLICATION class-attribute instance-attribute

INSERTION class-attribute instance-attribute

INVERSION class-attribute instance-attribute

METHYLATION_GAIN class-attribute instance-attribute

METHYLATION_LOSS class-attribute instance-attribute

METHYLATION_UNCHANGED class-attribute instance-attribute

REPETITION class-attribute instance-attribute

SUBSTITUTION class-attribute instance-attribute

TRANSLOCATION class-attribute instance-attribute

TRANSPOSITION class-attribute instance-attribute

UNCHANGED class-attribute instance-attribute

GenomicVariant

Bases: BaseModel

Represents a clinically relevant genomic variant detected in a patient's case.

This model captures detailed information about a genomic variant, including its assessment, confidence, clinical relevance, molecular consequence, and sequence-level changes at the DNA, RNA, and protein levels. It supports annotation and querying of variant properties, such as affected genes, cytogenetic location, chromosomes, and variant type, using HGVS expressions and coded concepts.

Attributes:

Name Type Description
case ForeignKey[PatientCase]

Reference to the patient case associated with the variant.

date DateField

Date relevant to the variant (e.g., specimen collection).

assessment_date DateField

Date the variant was assessed or reported.

gene_panel CharField

Name of the gene panel used for testing.

assessment CharField

Classification of variant presence/absence.

confidence CharField

Confidence level of the variant call.

analysis_method CodedConceptField[GenomicVariantAnalysisMethod]

Method used to detect the variant.

clinical_relevance CharField

Pathogenicity or clinical relevance classification.

is_vus GeneratedField

Indicates if the variant is of unknown significance.

is_pathogenic GeneratedField

Indicates if the variant is pathogenic.

genes CodedConceptField[Gene]

Genes affected by the variant.

cytogenetic_location AnnotationProperty

Cytogenetic location(s) of affected genes.

chromosomes AnnotationProperty

Chromosomes involved in the variant.

genome_assembly_version CodedConceptField[GenomeAssemblyVersion]

Reference genome assembly version.

dna_hgvs CharField

HGVS DNA-level expression.

dna_reference_sequence AnnotationProperty

DNA reference sequence from HGVS.

dna_change_position_range_start AnnotationProperty

Start position of DNA change range.

dna_change_position_range_end AnnotationProperty

End position of DNA change range.

dna_change_position_range AnnotationProperty

Range of DNA change positions.

dna_change_position AnnotationProperty

Single DNA change position.

dna_change_position_intron AnnotationProperty

Intron position of DNA change.

regions AnnotationProperty

Genomic regions affected (exon, intron, UTR).

dna_change_type AnnotationProperty

Type of DNA change (e.g., substitution, deletion).

rna_hgvs CharField

HGVS RNA-level expression.

rna_reference_sequence AnnotationProperty

RNA reference sequence from HGVS.

rna_change_position AnnotationProperty

RNA change position or range.

rna_change_type AnnotationProperty

Type of RNA change.

protein_hgvs CharField

HGVS protein-level expression.

protein_reference_sequence AnnotationProperty

Protein reference sequence from HGVS.

protein_change_type AnnotationProperty

Type of protein change.

nucleotides_length AnnotationProperty

Total affected nucleotides.

molecular_consequence CodedConceptField[MolecularConsequence]

Effect of the variant on transcript/protein.

copy_number PositiveSmallIntegerField

Structural variant copy number.

allele_frequency FloatField

Relative frequency of the allele in the sample.

allele_depth PositiveIntegerField

Number of reads supporting the allele.

zygosity CodedConceptField[Zygosity]

Zygosity of the variant.

inheritance CodedConceptField[Inheritance]

Inheritance origin of the variant.

coordinate_system CodedConceptField[GenomicCoordinateSystem]

Genomic coordinate system used.

clinvar CharField

ClinVar accession number for cross-reference.

Constraints

Constraints ensure valid HGVS expressions for DNA, RNA, and protein change fields.

allele_depth class-attribute instance-attribute

allele_frequency class-attribute instance-attribute

aminoacid_change property

analysis_method class-attribute instance-attribute

assessment class-attribute instance-attribute

assessment_date class-attribute instance-attribute

case class-attribute instance-attribute

chromosomes class-attribute instance-attribute

clinical_relevance class-attribute instance-attribute

clinvar class-attribute instance-attribute

confidence class-attribute instance-attribute

coordinate_system class-attribute instance-attribute

copy_number class-attribute instance-attribute

cytogenetic_location class-attribute instance-attribute

date class-attribute instance-attribute

description property

dna_change_position class-attribute instance-attribute

dna_change_position_intron class-attribute instance-attribute

dna_change_position_range class-attribute instance-attribute

dna_change_position_range_end class-attribute instance-attribute

dna_change_position_range_start class-attribute instance-attribute

dna_change_type class-attribute instance-attribute

dna_hgvs class-attribute instance-attribute

dna_reference_sequence class-attribute instance-attribute

gene_panel class-attribute instance-attribute

genes class-attribute instance-attribute

genes_label property

genome_assembly_version class-attribute instance-attribute

inheritance class-attribute instance-attribute

is_pathogenic class-attribute instance-attribute

is_vus class-attribute instance-attribute

molecular_consequence class-attribute instance-attribute

mutation_label property

nucleotides_length class-attribute instance-attribute

objects class-attribute instance-attribute

protein_change_type class-attribute instance-attribute

protein_hgvs class-attribute instance-attribute

protein_reference_sequence class-attribute instance-attribute

regions class-attribute instance-attribute

rna_change_position class-attribute instance-attribute

rna_change_type class-attribute instance-attribute

rna_hgvs class-attribute instance-attribute

rna_reference_sequence class-attribute instance-attribute

zygosity class-attribute instance-attribute

Meta

constraints class-attribute instance-attribute

GenomicVariantAssessmentChoices

Bases: TextChoices

An enumeration representing possible assessments for a genomic variant.

Attributes:

Name Type Description
PRESENT

Indicates the variant is present.

ABSENT

Indicates the variant is absent.

NOCALL

Indicates the variant call could not be made.

INDETERMINATE

Indicates the assessment is inconclusive.

ABSENT class-attribute instance-attribute

INDETERMINATE class-attribute instance-attribute

NOCALL class-attribute instance-attribute

PRESENT class-attribute instance-attribute

GenomicVariantClinicalRelevanceChoices

Bases: TextChoices

An enumeration of clinical relevance categories for genomic variants.

Attributes:

Name Type Description
PATHOGENIC

Indicates the variant is pathogenic.

LIKELY_PATHOGENIC

Indicates the variant is likely pathogenic.

UNCERTAIN_SIGNIFICANCE

Indicates the variant has uncertain clinical significance.

AMBIGUOUS

Indicates the variant's relevance is ambiguous.

LIKELY_BENIGN

Indicates the variant is likely benign.

BENIGN

Indicates the variant is benign.

AMBIGUOUS class-attribute instance-attribute

BENIGN class-attribute instance-attribute

LIKELY_BENIGN class-attribute instance-attribute

LIKELY_PATHOGENIC class-attribute instance-attribute

PATHOGENIC class-attribute instance-attribute

UNCERTAIN_SIGNIFICANCE class-attribute instance-attribute

GenomicVariantConfidenceChoices

Bases: TextChoices

An enumeration representing the confidence level assigned to a genomic variant.

Attributes:

Name Type Description
LOW

Indicates low confidence in the variant call.

HIGH

Indicates high confidence in the variant call.

INDETERMINATE

Indicates that the confidence level could not be determined.

HIGH class-attribute instance-attribute

INDETERMINATE class-attribute instance-attribute

LOW class-attribute instance-attribute

HGVSRegex

A collection of regular expressions for parsing and validating HGVS (Human Genome Variation Society) nomenclature strings.

References
  • HGVS v21.1.2 specification
  • NCBI RefSeq accession formats

Attributes:

Name Type Description
AMINOACID str

Regex for valid amino acid codes.

REPETITION_COPIES str

Regex for repetition copy notation.

VERSIONED_NUMBER str

Regex for versioned numbers.

GENOMIC_REFSEQ str

Regex for genomic reference sequence identifiers.

RNA_REFSEQ str

Regex for RNA reference sequence identifiers.

PROTEIN_REFSEQ str

Regex for protein reference sequence identifiers.

NUCLEOTIDE_POSITION_OR_RANGE str

Regex for nucleotide positions and ranges.

AMINOACID_POSITION_OR_RANGE str

Regex for amino acid positions and ranges.

DNA_CHANGE_DESCRIPTION str

Regex for DNA change descriptions.

RNA_CHANGE_DESCRIPTION str

Regex for RNA change descriptions.

PROTEIN_CHANGE_DESCRIPTION str

Regex for protein change descriptions.

DNA_HGVS str

Complete regex for HGVS strings for DNA.

RNA_HGVS str

Complete regex for HGVS strings for RNA.

PROTEIN_HGVS str

Complete regex for HGVS strings for protein.

Usage

Use these regex patterns to match, validate, or extract components from HGVS variant strings in genomic data processing pipelines.

AMINOACID class-attribute instance-attribute

AMINOACID_POSITION class-attribute instance-attribute

AMINOACID_POSITION_OR_RANGE class-attribute instance-attribute

AMINOACID_RANGE class-attribute instance-attribute

AMINOACID_UNCERTAIN_POSITION class-attribute instance-attribute

CODING_POSITION class-attribute instance-attribute

DNA_CHANGE_DESCRIPTION class-attribute instance-attribute

DNA_DELETION class-attribute instance-attribute

DNA_DELETION_INSERTION class-attribute instance-attribute

DNA_DUPLICATION class-attribute instance-attribute

DNA_HGVS class-attribute instance-attribute

DNA_INSERTION class-attribute instance-attribute

DNA_INVERSION class-attribute instance-attribute

DNA_METHYLATION_EQUAL class-attribute instance-attribute

DNA_METHYLATION_GAIN class-attribute instance-attribute

DNA_METHYLATION_LOSS class-attribute instance-attribute

DNA_REPETITION class-attribute instance-attribute

DNA_SEQUENCE class-attribute instance-attribute

DNA_SUBSTITUTION class-attribute instance-attribute

DNA_TRANSLOCATION class-attribute instance-attribute

DNA_TRANSPOSITION class-attribute instance-attribute

DNA_UNCHANGED class-attribute instance-attribute

DNA_VARIANT_TYPE class-attribute instance-attribute

GENOMIC_ENSEMBL_REFSEQ class-attribute instance-attribute

GENOMIC_LRG_REFSEQ class-attribute instance-attribute

GENOMIC_NCIB_REFSEQ class-attribute instance-attribute

GENOMIC_REFSEQ class-attribute instance-attribute

GENOMIC_REFSEQ_PREFIX class-attribute instance-attribute

INTRONIC_POSITION class-attribute instance-attribute

NONCODING_POSITION class-attribute instance-attribute

NUCLEOTIDE_POSITION class-attribute instance-attribute

NUCLEOTIDE_POSITION_OR_RANGE class-attribute instance-attribute

NUCLEOTIDE_RANGE class-attribute instance-attribute

NUCLEOTIDE_UNCERTAIN_POSITION class-attribute instance-attribute

POSITION class-attribute instance-attribute

PROTEIN_CHANGE_DESCRIPTION class-attribute instance-attribute

PROTEIN_DELETION class-attribute instance-attribute

PROTEIN_DELETION_INSERTION class-attribute instance-attribute

PROTEIN_DUPLICATION class-attribute instance-attribute

PROTEIN_ENSEMBL_REFSEQ class-attribute instance-attribute

PROTEIN_EXTENSION class-attribute instance-attribute

PROTEIN_FRAMESHIFT class-attribute instance-attribute

PROTEIN_HGVS class-attribute instance-attribute

PROTEIN_INSERTION class-attribute instance-attribute

PROTEIN_LRG_REFSEQ class-attribute instance-attribute

PROTEIN_MISSENSE class-attribute instance-attribute

PROTEIN_NCIB_REFSEQ class-attribute instance-attribute

PROTEIN_NONSENSE class-attribute instance-attribute

PROTEIN_NOTHING class-attribute instance-attribute

PROTEIN_REFSEQ class-attribute instance-attribute

PROTEIN_REFSEQ_PREFIX class-attribute instance-attribute

PROTEIN_REPETITION class-attribute instance-attribute

PROTEIN_SEQUENCE class-attribute instance-attribute

PROTEIN_SILENT class-attribute instance-attribute

PROTEIN_UNKNOWN class-attribute instance-attribute

PROTEIN_VARIANT_TYPE class-attribute instance-attribute

REPETITION_COPIES class-attribute instance-attribute

RNA_CHANGE_DESCRIPTION class-attribute instance-attribute

RNA_DELETION class-attribute instance-attribute

RNA_DELETION_INSERTION class-attribute instance-attribute

RNA_DUPLICATION class-attribute instance-attribute

RNA_ENSEMBL_REFSEQ class-attribute instance-attribute

RNA_HGVS class-attribute instance-attribute

RNA_INSERTION class-attribute instance-attribute

RNA_INVERSION class-attribute instance-attribute

RNA_LRG_REFSEQ class-attribute instance-attribute

RNA_METHYLATION_EQUAL class-attribute instance-attribute

RNA_METHYLATION_GAIN class-attribute instance-attribute

RNA_METHYLATION_LOSS class-attribute instance-attribute

RNA_NCIB_REFSEQ class-attribute instance-attribute

RNA_REFSEQ class-attribute instance-attribute

RNA_REFSEQ_PREFIX class-attribute instance-attribute

RNA_REPETITION class-attribute instance-attribute

RNA_SEQUENCE class-attribute instance-attribute

RNA_SUBSTITUTION class-attribute instance-attribute

RNA_UNCHANGED class-attribute instance-attribute

RNA_VARIANT_TYPE class-attribute instance-attribute

UTR3_POSITION class-attribute instance-attribute

UTR5_POSITION class-attribute instance-attribute

VERSIONED_NUMBER class-attribute instance-attribute

ProteinChangeType

Bases: TextChoices

An enumeration of protein change types observed in genomic variants.

Attributes:

Name Type Description
MISSENSE

A single nucleotide change resulting in a different amino acid.

NONSENSE

A mutation introducing a premature stop codon.

DELETION_INSERTION

A complex event involving both deletion and insertion of nucleotides.

INSERTION

Addition of one or more nucleotides into the DNA sequence.

DELETION

Removal of one or more nucleotides from the DNA sequence.

DUPLICATION

Duplication of a segment of DNA.

FRAMESHIFT

A mutation that shifts the reading frame of the genetic code.

EXTENSION

Extension of the protein sequence beyond its normal length.

SILENT

A mutation that does not alter the amino acid sequence.

NO_PROTEIN

No protein product is produced due to the mutation.

UNKNOWN

The effect of the mutation on the protein is unknown.

REPETITION

Repetition of a segment within the protein sequence.

DELETION class-attribute instance-attribute

DELETION_INSERTION class-attribute instance-attribute

DUPLICATION class-attribute instance-attribute

EXTENSION class-attribute instance-attribute

FRAMESHIFT class-attribute instance-attribute

INSERTION class-attribute instance-attribute

MISSENSE class-attribute instance-attribute

NONSENSE class-attribute instance-attribute

NO_PROTEIN class-attribute instance-attribute

REPETITION class-attribute instance-attribute

SILENT class-attribute instance-attribute

UNKNOWN class-attribute instance-attribute

RNAChangeType

Bases: TextChoices

An enumeration of possible RNA change types for genomic variants.

Attributes:

Name Type Description
SUBSTITUTION

Represents a substitution mutation in RNA.

DELETION_INSERTION

Represents a combined deletion and insertion mutation.

INSERTION

Represents an insertion mutation in RNA.

DELETION

Represents a deletion mutation in RNA.

DUPLICATION

Represents a duplication mutation in RNA.

INVERSION

Represents an inversion mutation in RNA.

UNCHANGED

Indicates no change in the RNA sequence.

REPETITION

Represents a repetition mutation in RNA.

DELETION class-attribute instance-attribute

DELETION_INSERTION class-attribute instance-attribute

DUPLICATION class-attribute instance-attribute

INSERTION class-attribute instance-attribute

INVERSION class-attribute instance-attribute

REPETITION class-attribute instance-attribute

SUBSTITUTION class-attribute instance-attribute

UNCHANGED class-attribute instance-attribute

RegexpMatchSubstring(expression, regex, **extra)

Bases: Func

A custom Django Func expression to extract a substring from a field using a regular expression.

This class wraps the PostgreSQL substring function, allowing you to specify a regular expression to match and extract a substring from a given expression (typically a model field).

Parameters:

Name Type Description Default

expression

Any

The database field or expression to apply the regular expression to.

required

regex

str

The regular expression pattern to use for matching the substring.

required

extra

dict

Additional keyword arguments passed to the parent Func class.

{}
Example

RegexpMatchSubstring('field_name', r'[A-Za-z]+')

Source code in onconova/oncology/models/genomic_variant.py
def __init__(self, expression, regex: str, **extra):
    # PostgreSQL regexp_match() returns an array, so we extract the nth element
    template = "(%(function)s(%(expressions)s, '%(regex)s'))"
    super().__init__(expression, regex=regex, template=template, **extra)

function class-attribute instance-attribute

runner