Skip to content

Protein Models

Protein-focused Python model types for parsed HGVS variants.

Type Aliases:

Name Description
ProteinEdit

Tagged union for supported protein edit models.

ProteinEffect

Tagged union for supported protein consequence models.

ProteinEffect module-attribute

Tagged union for supported protein consequence models:

ProteinCoordinate dataclass

ProteinCoordinate(residue: str, ordinal: int)

Protein position written as residue symbol plus ordinal.

Attributes:

Name Type Description
residue str

Amino-acid symbol.

ordinal int

Amino-acid position.

Examples:

A protein substitution at residue 24 is located using the amino-acid symbol and ordinal together.

>>> from tinyhgvs import parse_hgvs
>>> variant = parse_hgvs("NP_003997.1:p.Trp24Ter")
>>> position = variant.description.effect.location.start
>>> position.residue
'Trp'
>>> position.ordinal
24

ProteinSequence dataclass

ProteinSequence(residues: tuple[str, ...])

Ordered amino-acid sequence used by insertions and deletion-insertions.

Attributes:

Name Type Description
residues tuple[str, ...]

Ordered tuple of amino-acid symbols.

Examples:

A protein insertion adds three amino acids in order.

>>> from tinyhgvs import parse_hgvs
>>> variant = parse_hgvs("p.Lys2_Gly3insGlnSerLys")
>>> variant_edit = variant.description.effect.edit
>>> variant_edit.sequence.residues
('Gln', 'Ser', 'Lys')

ProteinSequenceOmittedEdit

Bases: str, Enum

Protein edits whose altered amino-acid sequence is not written explicitly.

Attributes:

Name Type Description
UNKNOWN

A protein change is expected, but the exact consequence is not known.

NO_CHANGE

No protein change, written as =.

DELETION

Deletion of the stated amino-acid interval.

DUPLICATION

Duplication of the stated amino-acid interval.

Examples:

A predicted but unspecified consequence at Met1:

>>> from tinyhgvs import ProteinSequenceOmittedEdit, parse_hgvs
>>> variant = parse_hgvs("LRG_199p1:p.(Met1?)")
>>> variant.description.effect.edit is ProteinSequenceOmittedEdit.UNKNOWN
True

An explicitly unchanged residue:

>>> variant = parse_hgvs("NP_003997.1:p.Cys188=")
>>> variant.description.effect.edit
<ProteinSequenceOmittedEdit.NO_CHANGE: 'no_change'>

ProteinSubstitutionEdit dataclass

ProteinSubstitutionEdit(to: str)

Protein substitution to another residue symbol.

Attributes:

Name Type Description
to str

Amino acid or stop symbol replacing the reference residue.

kind Literal['substitution']

Edit kind.

Examples:

A tryptophan residue is replaced by a termination codon.

>>> from tinyhgvs import parse_hgvs
>>> variant = parse_hgvs("NP_003997.1:p.Trp24Ter")
>>> variant_edit = variant.description.effect.edit
>>> variant_edit.to
'Ter'
>>> variant_edit.kind
'substitution'

ProteinInsertionEdit dataclass

ProteinInsertionEdit(sequence: ProteinSequence)

Model describing protein insertion.

Attributes:

Name Type Description
sequence ProteinSequence

Inserted amino-acid sequence.

kind Literal['insertion']

Edit kind.

Examples:

Three amino acids are inserted between residues 2 and 3.

>>> from tinyhgvs import parse_hgvs
>>> variant = parse_hgvs("p.Lys2_Gly3insGlnSerLys")
>>> variant_edit = variant.description.effect.edit
>>> variant_edit.sequence.residues
('Gln', 'Ser', 'Lys')
>>> variant_edit.kind
'insertion'

ProteinDeletionInsertionEdit dataclass

ProteinDeletionInsertionEdit(sequence: ProteinSequence)

Model describing protein deletion-insertion.

Attributes:

Name Type Description
sequence ProteinSequence

Replacement amino-acid sequence.

kind Literal['deletion_insertion']

Edit kind.

Examples:

One residue is deleted and replaced by two amino acids.

>>> from tinyhgvs import parse_hgvs
>>> variant = parse_hgvs("p.Cys28delinsTrpVal")
>>> variant_edit = variant.description.effect.edit
>>> variant_edit.sequence.residues
('Trp', 'Val')
>>> variant_edit.kind
'deletion_insertion'

ProteinRepeatEdit dataclass

ProteinRepeatEdit(count: int)

Model describing a top-level protein repeat variant.

Attributes:

Name Type Description
count int

Number of repeated amino-acid units.

kind Literal['repeat']

Edit kind.

Examples:

A protein repeat variant with repeat unit coming from an interval:

>>> from tinyhgvs import parse_hgvs
>>> variant = parse_hgvs("NP_0123456.1:p.Arg65_Ser67[12]")
>>> variant.description.effect.edit.count
12
>>> variant.description.effect.edit.kind
'repeat'

ProteinUnknownEffect dataclass

ProteinUnknownEffect()

Model describing the protein consequence p.?.

Attributes:

Name Type Description
kind Literal['unknown']

Effect kind.

Examples:

The protein consequence is entirely unknown.

>>> from tinyhgvs import parse_hgvs
>>> variant = parse_hgvs("NP_003997.1:p.?")
>>> variant.description.effect.kind
'unknown'

ProteinNoProteinProducedEffect dataclass

ProteinNoProteinProducedEffect()

Model describing the protein consequence p.0.

Attributes:

Name Type Description
kind Literal['no_protein_produced']

Effect kind.

Examples:

The variant predicts that no protein product is made.

>>> from tinyhgvs import parse_hgvs
>>> variant = parse_hgvs("LRG_199p1:p.0")
>>> variant.description.effect.kind
'no_protein_produced'

ProteinEditEffect dataclass

ProteinEditEffect(location: Interval[ProteinCoordinate], edit: ProteinEdit)

Concrete protein consequence at a known amino-acid interval.

Attributes:

Name Type Description
location Interval[ProteinCoordinate]

Amino-acid range where the edit occurs.

edit ProteinEdit

Protein edit applied at that range.

kind Literal['edit']

Effect kind.

Examples:

A deletion spanning residues Lys23 to Val25 is represented by a protein location and a protein deletion edit.

>>> from tinyhgvs import ProteinSequenceOmittedEdit, parse_hgvs
>>> variant = parse_hgvs("NP_003997.2:p.Lys23_Val25del")
>>> effect = variant.description.effect
>>> effect.location.start.residue
'Lys'
>>> effect.location.end.residue
'Val'
>>> effect.edit is ProteinSequenceOmittedEdit.DELETION
True

ProteinVariant dataclass

ProteinVariant(is_predicted: bool, effect: ProteinEffect)

Parsed protein-level consequence.

Attributes:

Name Type Description
is_predicted bool

Whether the effect was written in parentheses.

effect ProteinEffect

Parsed protein consequence model.

Examples:

An observed protein consequence is not predicted:

>>> from tinyhgvs import parse_hgvs
>>> parse_hgvs("NP_003997.1:p.Trp24Ter").description.is_predicted
False

A parenthesized protein consequence is predicted:

>>> parse_hgvs("LRG_199p1:p.(Met1?)").description.is_predicted
True