Coverage for src/python/ensembl/vep/models/genic/gene.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.17.2, created at 2026-11-18 14:41 +0000

1# See the NOTICE file distributed with this work for additional information 

2# regarding copyright ownership. 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); 

5# you may not use this file except in compliance with the License. 

6# You may obtain a copy of the License at 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14"""Gene class.""" 

15 

16from __future__ import annotations 

17 

18from typing import TYPE_CHECKING 

19from attrs import define, field 

20 

21from ensembl.vep.common import ExternalReference 

22from ensembl.vep.models import Feature 

23 

24if TYPE_CHECKING: 

25 from ensembl.vep.models.genic import Transcript 

26 

27 

28@define(kw_only=True, auto_attribs=True) 

29class Gene(Feature): 

30 """ 

31 Represents a gene. 

32 

33 Attributes: 

34 stable_id (str): Ensembl stable gene identifier (e.g. "ENSG00000116016"). 

35 version (int | None): Version of the stable identifier. 

36 name (str | None): Gene name from known nomenclature such as HGNC(e.g. "BRCA2"). 

37 symbol (str | None): Gene symbol or short name (e.g. "BRCA2"). 

38 alternative_names (list[ExternalReference] | None): Alternative names for the gene. 

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

40 biotype (str | None): Biotype of the gene (e.g. "protein_coding"). 

41 """ 

42 

43 stable_id: str 

44 version: int | None = field(default=None, init=False) 

45 name: str | None = field(default=None, init=False) 

46 symbol: str | None = field(default=None, init=False) 

47 alternative_names: list[ExternalReference] | None = field(factory=list, init=False) 

48 transcripts: list[Transcript] | None = field(factory=list, init=False) 

49 biotype: str | None = field(default=None, init=False)