ensembl.vep.models.genic package#

Genic data models.

Submodules#

ensembl.vep.models.genic.cdna module#

cDNA class.

class ensembl.vep.models.genic.cdna.CDNA(*, start, end, strand, slice=None)[source]#

Bases: Feature

Represents a cDNA.

Variables:

transcript (Transcript | None) – The transcript to which this cDNA belongs.

transcript: Transcript | None#

ensembl.vep.models.genic.cds module#

CDS class.

class ensembl.vep.models.genic.cds.CDS(*, start, end, strand, slice=None, seq=None)[source]#

Bases: Feature

Represents a CDS.

Variables:
  • seq (str | None) – The nucleotide sequence of the CDS.

  • transcript (Transcript | None) – The transcript to which this CDS belongs.

  • translation (Translation | None) – The translation associated with this CDS.

property nucleotide_length: int | None#

Public accessor for _nucleotide_length.

Returns:

Length in nucleotides, or None if not applicable.

Return type:

int | None

property protein_length: int | None#

Public accessor for _protein_length.

Returns:

Length in amino acids, or None if not applicable.

Return type:

int | None

seq: str | None#
transcript: Transcript | None#
translation: Translation | None#

ensembl.vep.models.genic.exon module#

Exon class.

class ensembl.vep.models.genic.exon.Exon(*, start, end, strand, slice=None, stable_id)[source]#

Bases: Feature

Represents an exon.

Variables:
  • stable_id (str) – Ensembl stable exon identifier (e.g. “ENSE00003666667”).

  • version (int | None) – Version of the stable identifier.

  • phase (ExonPhase | None) – The phase of the exon, which is the number of bases of the first codon that are on the previous exon/intron. The value can be 0, 1, or 2.

  • end_phase (ExonPhase | None) – Number of bases of the last codon if it is incomplete. The value can be 0, 1, or 2.

end_phase: ExonPhase | None#
property frame: int | None#

Public accessor for _frame.

Returns:

The frame of the exon, or None if not applicable.

Return type:

int | None

phase: ExonPhase | None#
stable_id: str#
version: int | None#

ensembl.vep.models.genic.gene module#

Gene class.

class ensembl.vep.models.genic.gene.Gene(*, start, end, strand, slice=None, stable_id)[source]#

Bases: Feature

Represents a gene.

Variables:
  • stable_id (str) – Ensembl stable gene identifier (e.g. “ENSG00000116016”).

  • version (int | None) – Version of the stable identifier.

  • name (str | None) – Gene name from known nomenclature such as HGNC(e.g. “BRCA2”).

  • symbol (str | None) – Gene symbol or short name (e.g. “BRCA2”).

  • alternative_names (list[ExternalReference] | None) – Alternative names for the gene.

  • transcripts (list[Transcript] | None) – List of transcripts associated with the gene.

  • biotype (str | None) – Biotype of the gene (e.g. “protein_coding”).

alternative_names: list[ExternalReference] | None#
biotype: str | None#
name: str | None#
stable_id: str#
symbol: str | None#
transcripts: list[Transcript] | None#
version: int | None#

ensembl.vep.models.genic.intron module#

Intron class.

class ensembl.vep.models.genic.intron.Intron(*, start, end, strand, slice=None)[source]#

Bases: Feature

Represents an intron.

Variables:
  • next_exon (Exon | None) – The exon following this intron.

  • prev_exon (Exon | None) – The exon preceding this intron.

next_exon: Exon | None#
prev_exon: Exon | None#

ensembl.vep.models.genic.transcript module#

Transcript class.

class ensembl.vep.models.genic.transcript.Transcript(*, start, end, strand, slice=None, stable_id)[source]#

Bases: Feature

Represents a transcript.

Variables:
  • stable_id (str) – Ensembl stable transcript identifier (e.g. “ENST00000366667”).

  • version (int | None) – Version of the stable identifier.

  • gene (Gene | None) – The gene to which this transcript belongs.

  • biotype (str | None) – Biotype of the transcript (e.g. “protein_coding”).

  • spliced_exons (list[Exon]) – List of exons that are spliced together to form the transcript, in transcript (5’ to 3’) order, therefore, index 0 is always the first exon.

  • introns (list[Intron]) – Introns between consecutive spliced exons, in transcript order. Derived from spliced_exons on first access rather than loaded; seed with seed_attrs.

  • translation (Translation | None) – The translation associated with this transcript, explicitly assigned or derived from whatever coding-boundary information is available.

  • alternative_translations (list[Translation] | None) – List of alternative translations associated with this transcript, if applicable.

  • attributes (list[Attribute] | None) – List of attributes associated with this transcript.

SEED_INVALIDATES: ClassVar[Mapping[str, tuple[str, ...]]] = {'cds': ('_coding_start', '_coding_end', '_first_coding_exon_index', '_last_coding_exon_index', '_exon_coding_start', '_exon_coding_end', '_cds_start_phase', '_cdna_coding_start', '_cdna_coding_end', '_cds', '_five_prime_utr', '_three_prime_utr', '_coding_sequence', '_translated_seq', '_cds_genomic_spans', '_five_prime_utr_genomic_spans', '_three_prime_utr_genomic_spans', '_cds_mapper', '_cdna_mapper'), 'five_prime_utr': ('_coding_start', '_coding_end', '_first_coding_exon_index', '_last_coding_exon_index', '_exon_coding_start', '_exon_coding_end', '_cds_start_phase', '_cdna_coding_start', '_cdna_coding_end', '_cds', '_five_prime_utr', '_three_prime_utr', '_coding_sequence', '_translated_seq', '_cds_genomic_spans', '_five_prime_utr_genomic_spans', '_three_prime_utr_genomic_spans', '_cds_mapper', '_cdna_mapper'), 'three_prime_utr': ('_coding_start', '_coding_end', '_first_coding_exon_index', '_last_coding_exon_index', '_exon_coding_start', '_exon_coding_end', '_cds_start_phase', '_cdna_coding_start', '_cdna_coding_end', '_cds', '_five_prime_utr', '_three_prime_utr', '_coding_sequence', '_translated_seq', '_cds_genomic_spans', '_five_prime_utr_genomic_spans', '_three_prime_utr_genomic_spans', '_cds_mapper', '_cdna_mapper'), 'translation': ('_coding_start', '_coding_end', '_first_coding_exon_index', '_last_coding_exon_index', '_exon_coding_start', '_exon_coding_end', '_cds_start_phase', '_cdna_coding_start', '_cdna_coding_end', '_cds', '_five_prime_utr', '_three_prime_utr', '_coding_sequence', '_translated_seq', '_cds_genomic_spans', '_five_prime_utr_genomic_spans', '_three_prime_utr_genomic_spans', '_cds_mapper', '_cdna_mapper')}#

Seeding any coding-signal source invalidates the whole coding derivation closure.

alternative_translations: list[Translation] | None#
attributes: list[Attribute] | None#
biotype: str | None#
cdna: CDNA | None#
property cdna_coding_end: int | None#

Public accessor for _cdna_coding_end.

Returns:

cDNA coordinate of the end of the coding sequence, or None if not applicable.

Return type:

int | None

property cdna_coding_start: int | None#

Public accessor for _cdna_coding_start.

Returns:

cDNA coordinate of the start of the coding sequence, or None if not applicable.

Return type:

int | None

property cdna_mapper: Mapper | None#

Public accessor for _cdna_mapper.

Offsets are cDNA-relative: offset 0 is the transcript’s first base, so 5’ UTR, CDS and 3’ UTR positions all map. Use this to place a variant anywhere on the mature transcript.

Returns:

The genomic<->cDNA coordinate mapper for this transcript’s whole

spliced sequence (5’ UTR + CDS + 3’ UTR), or None if it has no exons.

Return type:

Mapper | None

property cds: CDS | None#

Public accessor for _cds.

Returns:

The CDS of the transcript, or None if not applicable.

Return type:

CDS | None

property cds_genomic_spans: list[tuple[int, int]] | None#

Public accessor for _cds_genomic_spans.

Returns:

Transcript (5’ to 3’) order exon blocks clipped to the

CDS, or None if the transcript is not coding.

Return type:

list[tuple[int, int]] | None

property cds_length: int | None#

Number of nucleotides in the CDS.

Returns:

Number of nucleotides in the CDS, or None if the transcript is not coding.

Return type:

int | None

property cds_mapper: Mapper | None#

Public accessor for _cds_mapper.

Offsets are CDS-relative: offset 0 is the first base of the start codon, and UTR bases map to nothing at all. A CDS with an incomplete 5’ end starts at offset cds_start_phase instead, the offsets before it being VEP’s N padding. Use this for anything expressed in coding coordinates, e.g., codon windows, protein offsets. Its sibling cdna_mapper covers the whole spliced transcript instead; the two disagree by cdna_coding_start - 1 over the CDS, and only cdna_mapper can place a UTR position.

Returns:

The genomic<->CDS<->protein coordinate mapper for this transcript’s

CDS, or None if the transcript is not coding.

Return type:

Mapper | None

cds_offset_to_genomic(cds_offset, *, accelerator=None)[source]#

Map a 0-based CDS offset to its genomic position.

Parameters:
  • cds_offset (int) – 0-based offset into the CDS.

  • accelerator (MapperIndex | None, default: None) – Optional O(1)-lookup accelerator for the mapping.

Returns:

The genomic position, or None if the offset is out of range or the transcript

is not coding.

Return type:

int | None

property cds_start_phase: int#

Public accessor for _cds_start_phase.

Returns:

Bases of the first codon missing from the CDS’s 5’ end, 0 when it is complete.

Return type:

int

property coding_end: int | None#

Public accessor for _coding_end.

Returns:

End of the coding region, or None if not applicable.

Return type:

int | None

property coding_sequence: str | None#

Public accessor for _coding_sequence.

Returns:

The full CDS nucleotide sequence in transcript-sense, or

None if the transcript is not coding or sequence is unavailable.

Return type:

str | None

property coding_start: int | None#

Public accessor for _coding_start.

Returns:

Start of the coding region or None if not applicable.

Return type:

int | None

property exon_coding_end: int | None#

Public accessor for _exon_coding_end.

Returns:

1-based offset, within the last coding exon, of the last coding base, or

None if the transcript has no coding signal at all.

Return type:

int | None

property exon_coding_start: int | None#

Public accessor for _exon_coding_start.

Returns:

1-based offset, within the first coding exon, of the first coding base,

or None if the transcript has no coding signal at all.

Return type:

int | None

property first_coding_exon_index: int | None#

Public accessor for _first_coding_exon_index.

Returns:

Index into spliced_exons of the exon where coding starts,

or None if the transcript has no coding signal at all.

Return type:

int | None

property five_prime_utr: UTR | None#

Public accessor for _five_prime_utr.

Returns:

The 5’ UTR of the transcript, or None if not applicable.

property five_prime_utr_genomic_spans: list[tuple[int, int]] | None#

Public accessor for _five_prime_utr_genomic_spans.

Returns:

Transcript (5’ to 3’) order exon blocks clipped to the

5’ UTR, or None if the transcript is not coding or has no 5’ UTR.

Return type:

list[tuple[int, int]] | None

gene: Gene | None#
genomic_to_cds_offset(genomic_position, *, accelerator=None)[source]#

Map a genomic position to its 0-based CDS offset.

Parameters:
  • genomic_position (int) – A genomic position, 1-based.

  • accelerator (MapperIndex | None, default: None) – Optional O(1)-lookup accelerator for the mapping.

Returns:

The 0-based offset into the CDS, or None if the position is not coding.

Return type:

int | None

property introns: list[Intron]#

Public accessor for _introns.

Returns:

The introns between consecutive spliced exons, in transcript (5’ to 3’)

order.

Return type:

list[Intron]

property last_coding_exon_index: int | None#

Public accessor for _last_coding_exon_index.

Returns:

Index into spliced_exons of the exon where coding ends, or None

if the transcript has no coding signal at all.

Return type:

int | None

spliced_exons: list[Exon]#
property spliced_seq: str | None#

Public accessor for _spliced_seq.

Returns:

The spliced sequence of the transcript, or None if sequence information is not available for all exons.

stable_id: str#
start_codon_genomic_spans()[source]#

Genomic spans of the three start-codon bases.

A list rather than a single (min, max) envelope because a start codon whose three bases split across an exon-exon junction can have more than one genomic span here.

Returns:

Ascending genomic spans, or None if the transcript is

not coding.

Return type:

list[tuple[int, int]] | None

stop_codon_genomic_spans()[source]#

Genomic spans of the three stop-codon bases.

A list rather than a single (min, max) envelope.

Returns:

Ascending genomic spans, or None if not coding or the

CDS is shorter than 3 bases.

Return type:

list[tuple[int, int]] | None

property three_prime_utr: UTR | None#

Public accessor for _three_prime_utr.

Returns:

The 3’ UTR of the transcript, or None if not applicable.

property three_prime_utr_genomic_spans: list[tuple[int, int]] | None#

Public accessor for _three_prime_utr_genomic_spans.

Returns:

Transcript (5’ to 3’) order exon blocks clipped to the

3’ UTR, or None if the transcript is not coding or has no 3’ UTR.

Return type:

list[tuple[int, int]] | None

property translated_seq: str | None#

Public accessor for _translated_seq.

Returns:

The translated sequence of the transcript, or None if not applicable.

Return type:

str | None

property translation: Translation | None#

Public accessor for _translation.

Returns:

The transcript’s translation, seeded or derived, or None if the

transcript has no coding signal at all.

Return type:

Translation | None

version: int | None#

ensembl.vep.models.genic.translation module#

Translation class.

class ensembl.vep.models.genic.translation.Translation(*, start, end, stable_id, exon_coding_start=None, exon_coding_end=None)[source]#

Bases: object

Represents a translation.

Variables:
  • start (int) – The start position of the translation on the transcript, relative to the start of the transcript.

  • end (int) – The end position of the translation on the transcript, relative to the start of the transcript.

  • stable_id (str) – Ensembl stable transcript identifier (e.g. “ENST00000366667”).

  • version (int | None) – Version of the stable identifier.

  • seq (str | None) – The amino acid sequence of the translation.

  • transcript (Transcript | None) – The transcript to which this translation belongs.

  • exon_coding_start (int | None) – The position of the first coding base in the start exon, relative to the start of the exon (1-based).

  • exon_coding_end (int | None) – The position of the last coding base in the end exon, relative to the start of the exon (1-based).

  • derived_from_coding_sequence (bool) – Whether seq was computed by Transcript._translation from this transcript’s own coding_sequence, as opposed to seeded from an external source that may curate it differently (for example without a trailing stop, or with selenocysteine edits). False by default and for every externally seeded translation; set True only at the one place that derives seq this way (Transcript._translation).

derived_from_coding_sequence: bool#
end: int#
exon_coding_end: int | None#
exon_coding_start: int | None#
property length: int#

Public accessor for _length.

Returns:

The length of the translation.

Return type:

int

seq: str | None#
stable_id: str#
start: int#
transcript: Transcript | None#
version: int | None#

ensembl.vep.models.genic.utr module#

UTR class.

class ensembl.vep.models.genic.utr.UTR(*, start, end, strand, slice=None)[source]#

Bases: Feature

Represents a UTR.

Variables:

transcript (Transcript | None) – The transcript to which this UTR belongs.

transcript: Transcript | None#