cool-seq-tool 0.4.0.dev2__py3-none-any.whl → 0.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. cool_seq_tool/__init__.py +1 -3
  2. cool_seq_tool/api.py +1 -2
  3. cool_seq_tool/app.py +42 -24
  4. cool_seq_tool/handlers/__init__.py +1 -0
  5. cool_seq_tool/handlers/seqrepo_access.py +13 -15
  6. cool_seq_tool/mappers/__init__.py +1 -0
  7. cool_seq_tool/mappers/alignment.py +5 -6
  8. cool_seq_tool/mappers/exon_genomic_coords.py +232 -68
  9. cool_seq_tool/mappers/mane_transcript.py +84 -86
  10. cool_seq_tool/resources/__init__.py +1 -0
  11. cool_seq_tool/resources/data_files.py +93 -0
  12. cool_seq_tool/resources/status.py +151 -0
  13. cool_seq_tool/routers/__init__.py +1 -0
  14. cool_seq_tool/routers/default.py +1 -0
  15. cool_seq_tool/routers/mane.py +4 -4
  16. cool_seq_tool/routers/mappings.py +2 -2
  17. cool_seq_tool/schemas.py +83 -37
  18. cool_seq_tool/sources/__init__.py +1 -0
  19. cool_seq_tool/sources/mane_transcript_mappings.py +14 -7
  20. cool_seq_tool/sources/transcript_mappings.py +41 -32
  21. cool_seq_tool/sources/uta_database.py +120 -69
  22. cool_seq_tool/utils.py +2 -2
  23. cool_seq_tool/version.py +2 -1
  24. {cool_seq_tool-0.4.0.dev2.dist-info → cool_seq_tool-0.4.1.dist-info}/LICENSE +1 -1
  25. {cool_seq_tool-0.4.0.dev2.dist-info → cool_seq_tool-0.4.1.dist-info}/METADATA +15 -8
  26. cool_seq_tool-0.4.1.dist-info/RECORD +29 -0
  27. {cool_seq_tool-0.4.0.dev2.dist-info → cool_seq_tool-0.4.1.dist-info}/WHEEL +1 -1
  28. cool_seq_tool/data/__init__.py +0 -2
  29. cool_seq_tool/data/data_downloads.py +0 -89
  30. cool_seq_tool/paths.py +0 -28
  31. cool_seq_tool-0.4.0.dev2.dist-info/RECORD +0 -29
  32. /cool_seq_tool/{data → resources}/transcript_mapping.tsv +0 -0
  33. {cool_seq_tool-0.4.0.dev2.dist-info → cool_seq_tool-0.4.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  """Module containing routes related to alignment mapping"""
2
+
2
3
  import logging
3
- from typing import Optional
4
4
 
5
5
  from fastapi import APIRouter, Query
6
6
 
@@ -66,7 +66,7 @@ async def c_to_g(
66
66
  c_ac: str = Query(..., description="cDNA RefSeq accession"),
67
67
  c_start_pos: int = Query(..., description="cDNA start position for codon"),
68
68
  c_end_pos: int = Query(..., description="cDNA end position for codon"),
69
- cds_start: Optional[int] = Query(
69
+ cds_start: int | None = Query(
70
70
  None, description="CDS start site. If not provided, this will be computed."
71
71
  ),
72
72
  residue_mode: ResidueMode = Query(
cool_seq_tool/schemas.py CHANGED
@@ -1,8 +1,9 @@
1
1
  """Defines attribute constants, useful object structures, and API response schemas."""
2
+
2
3
  import datetime
3
4
  import re
4
5
  from enum import Enum, IntEnum
5
- from typing import List, Literal, Optional, Tuple, Union
6
+ from typing import Literal
6
7
 
7
8
  from pydantic import (
8
9
  BaseModel,
@@ -52,10 +53,55 @@ class TranscriptPriority(str, Enum):
52
53
  class ResidueMode(str, Enum):
53
54
  """Create Enum for residue modes.
54
55
 
56
+ We typically prefer to operate in inter-residue coordinates, but users should be
57
+ careful to define the coordinate mode of their data when calling ``cool-seq-tool``
58
+ functions.
59
+
55
60
  | | C | | T | | G | |
56
61
  ZERO | | 0 | | 1 | | 2 | |
57
62
  RESIDUE | | 1 | | 2 | | 3 | |
58
63
  INTER_RESIDUE | 0 | | 1 | | 2 | | 3 |
64
+
65
+ .. tabularcolumns:: |L|C|C|C|C|C|C|C|
66
+ .. list-table::
67
+ :header-rows: 1
68
+
69
+ * -
70
+ -
71
+ - C
72
+ -
73
+ - T
74
+ -
75
+ - G
76
+ -
77
+ * - ``ZERO``
78
+ -
79
+ - 0
80
+ -
81
+ - 1
82
+ -
83
+ - 2
84
+ -
85
+ * - ``RESIDUE``
86
+ -
87
+ - 1
88
+ -
89
+ - 2
90
+ -
91
+ - 3
92
+ -
93
+ * - ``INTER_RESIDUE``
94
+ - 0
95
+ -
96
+ - 1
97
+ -
98
+ - 2
99
+ -
100
+ - 3
101
+
102
+
103
+ See "Conventions that promote reliable data sharing" and figure 3 within the
104
+ `Variation Representation Schema (VRS) paper <https://www.ncbi.nlm.nih.gov/pmc/articles/pmid/35311178/>`_ for further discussion.
59
105
  """
60
106
 
61
107
  ZERO = "zero"
@@ -70,12 +116,12 @@ class BaseModelForbidExtra(BaseModel, extra="forbid"):
70
116
  class GenomicRequestBody(BaseModelForbidExtra):
71
117
  """Define constraints for genomic to transcript exon coordinates request body"""
72
118
 
73
- chromosome: Union[StrictStr, StrictInt]
74
- start: Optional[StrictInt] = None
75
- end: Optional[StrictInt] = None
76
- strand: Optional[Strand] = None
77
- transcript: Optional[StrictStr] = None
78
- gene: Optional[StrictStr] = None
119
+ chromosome: StrictStr | StrictInt
120
+ start: StrictInt | None = None
121
+ end: StrictInt | None = None
122
+ strand: Strand | None = None
123
+ transcript: StrictStr | None = None
124
+ gene: StrictStr | None = None
79
125
  residue_mode: ResidueMode = ResidueMode.RESIDUE
80
126
 
81
127
  @model_validator(mode="after")
@@ -106,11 +152,11 @@ class TranscriptRequestBody(BaseModelForbidExtra):
106
152
  """Define constraints for transcript exon to genomic coordinates request body"""
107
153
 
108
154
  transcript: StrictStr
109
- gene: Optional[StrictStr] = None
110
- exon_start: Optional[StrictInt] = None
111
- exon_start_offset: Optional[StrictInt] = 0
112
- exon_end: Optional[StrictInt] = None
113
- exon_end_offset: Optional[StrictInt] = 0
155
+ gene: StrictStr | None = None
156
+ exon_start: StrictInt | None = None
157
+ exon_start_offset: StrictInt | None = 0
158
+ exon_end: StrictInt | None = None
159
+ exon_end_offset: StrictInt | None = 0
114
160
 
115
161
  @model_validator(mode="after")
116
162
  def check_exon_start_and_exon_end(cls, values):
@@ -166,12 +212,12 @@ class GenomicData(BaseModelForbidExtra):
166
212
 
167
213
  gene: StrictStr
168
214
  chr: StrictStr
169
- start: Optional[StrictInt] = None # Genomic start position
170
- end: Optional[StrictInt] = None # Genomic end position
171
- exon_start: Optional[StrictInt] = None
172
- exon_start_offset: Optional[StrictInt] = 0
173
- exon_end: Optional[StrictInt] = None
174
- exon_end_offset: Optional[StrictInt] = 0
215
+ start: StrictInt | None = None # Genomic start position
216
+ end: StrictInt | None = None # Genomic end position
217
+ exon_start: StrictInt | None = None
218
+ exon_start_offset: StrictInt | None = 0
219
+ exon_end: StrictInt | None = None
220
+ exon_end_offset: StrictInt | None = 0
175
221
  transcript: StrictStr
176
222
  strand: Strand
177
223
 
@@ -226,9 +272,9 @@ class ServiceMeta(BaseModelForbidExtra):
226
272
  name: Literal["cool_seq_tool"] = "cool_seq_tool"
227
273
  version: StrictStr
228
274
  response_datetime: datetime.datetime
229
- url: Literal[
275
+ url: Literal["https://github.com/GenomicMedLab/cool-seq-tool"] = (
230
276
  "https://github.com/GenomicMedLab/cool-seq-tool"
231
- ] = "https://github.com/GenomicMedLab/cool-seq-tool"
277
+ )
232
278
 
233
279
  @field_validator("version")
234
280
  def validate_version(cls, v):
@@ -256,8 +302,8 @@ class ServiceMeta(BaseModelForbidExtra):
256
302
  class TranscriptExonDataResponse(BaseModelForbidExtra):
257
303
  """Response model for Transcript Exon Data"""
258
304
 
259
- transcript_exon_data: Optional[TranscriptExonData] = None
260
- warnings: List[StrictStr] = []
305
+ transcript_exon_data: TranscriptExonData | None = None
306
+ warnings: list[StrictStr] = []
261
307
  service_meta: ServiceMeta
262
308
 
263
309
  model_config = ConfigDict(
@@ -287,8 +333,8 @@ class TranscriptExonDataResponse(BaseModelForbidExtra):
287
333
  class GenomicDataResponse(BaseModelForbidExtra):
288
334
  """Response model for Genomic Data"""
289
335
 
290
- genomic_data: Optional[GenomicData] = None
291
- warnings: List[StrictStr] = []
336
+ genomic_data: GenomicData | None = None
337
+ warnings: list[StrictStr] = []
292
338
  service_meta: ServiceMeta
293
339
 
294
340
  model_config = ConfigDict(
@@ -323,7 +369,7 @@ class MappedManeData(BaseModel):
323
369
 
324
370
  gene: StrictStr
325
371
  refseq: StrictStr
326
- ensembl: Optional[StrictStr] = None
372
+ ensembl: StrictStr | None = None
327
373
  strand: Strand
328
374
  status: TranscriptPriority
329
375
  alt_ac: StrictStr
@@ -347,8 +393,8 @@ class MappedManeData(BaseModel):
347
393
  class MappedManeDataService(BaseModelForbidExtra):
348
394
  """Service model response for mapped mane data"""
349
395
 
350
- mapped_mane_data: Optional[MappedManeData] = None
351
- warnings: List[StrictStr] = []
396
+ mapped_mane_data: MappedManeData | None = None
397
+ warnings: list[StrictStr] = []
352
398
  service_meta: ServiceMeta
353
399
 
354
400
  model_config = ConfigDict(
@@ -378,10 +424,10 @@ class MappedManeDataService(BaseModelForbidExtra):
378
424
  class ManeData(BaseModel):
379
425
  """Define mane data fields"""
380
426
 
381
- gene: Optional[StrictStr] = None
382
- refseq: Optional[StrictStr] = None
383
- ensembl: Optional[StrictStr] = None
384
- pos: Tuple[int, int]
427
+ gene: StrictStr | None = None
428
+ refseq: StrictStr | None = None
429
+ ensembl: StrictStr | None = None
430
+ pos: tuple[int, int]
385
431
  strand: Strand
386
432
  status: TranscriptPriority
387
433
 
@@ -402,8 +448,8 @@ class ManeData(BaseModel):
402
448
  class ManeDataService(BaseModelForbidExtra):
403
449
  """Service model response for getting mane data"""
404
450
 
405
- mane_data: Optional[ManeData] = None
406
- warnings: List[StrictStr] = []
451
+ mane_data: ManeData | None = None
452
+ warnings: list[StrictStr] = []
407
453
  service_meta: ServiceMeta
408
454
 
409
455
  model_config = ConfigDict(
@@ -457,8 +503,8 @@ class CdnaRepresentation(BaseModelForbidExtra):
457
503
  class ToCdnaService(BaseModelForbidExtra):
458
504
  """Service model response for protein -> cDNA"""
459
505
 
460
- c_data: Optional[CdnaRepresentation] = None
461
- warnings: List[StrictStr] = []
506
+ c_data: CdnaRepresentation | None = None
507
+ warnings: list[StrictStr] = []
462
508
  service_meta: ServiceMeta
463
509
 
464
510
  model_config = ConfigDict(
@@ -506,8 +552,8 @@ class GenomicRepresentation(BaseModelForbidExtra):
506
552
  class ToGenomicService(BaseModelForbidExtra):
507
553
  """Service model response for cDNA -> genomic"""
508
554
 
509
- g_data: Optional[GenomicRepresentation] = None
510
- warnings: List[StrictStr] = []
555
+ g_data: GenomicRepresentation | None = None
556
+ warnings: list[StrictStr] = []
511
557
  service_meta: ServiceMeta
512
558
 
513
559
  model_config = ConfigDict(
@@ -1,4 +1,5 @@
1
1
  """Module for providing basic acquisition/setup for the various resources"""
2
+
2
3
  from .mane_transcript_mappings import ManeTranscriptMappings
3
4
  from .transcript_mappings import TranscriptMappings
4
5
  from .uta_database import UtaDatabase
@@ -1,13 +1,13 @@
1
1
  """Provide fast tabular access to MANE summary file. Enables retrieval of associated
2
2
  MANE transcripts for gene symbols, genomic positions, or transcript accessions.
3
3
  """
4
+
4
5
  import logging
5
6
  from pathlib import Path
6
- from typing import Dict, List
7
7
 
8
8
  import polars as pl
9
9
 
10
- from cool_seq_tool.paths import MANE_SUMMARY_PATH
10
+ from cool_seq_tool.resources.data_files import DataFile, get_data_file
11
11
 
12
12
  logger = logging.getLogger(__name__)
13
13
 
@@ -22,11 +22,18 @@ class ManeTranscriptMappings:
22
22
  See the `NCBI MANE page <https://www.ncbi.nlm.nih.gov/refseq/MANE/>`_ for more information.
23
23
  """
24
24
 
25
- def __init__(self, mane_data_path: Path = MANE_SUMMARY_PATH) -> None:
25
+ def __init__(
26
+ self, mane_data_path: Path | None = None, from_local: bool = False
27
+ ) -> None:
26
28
  """Initialize the MANE Transcript mappings class.
27
29
 
28
- :param Path mane_data_path: Path to RefSeq MANE summary data
30
+ :param mane_data_path: Path to RefSeq MANE summary data
31
+ :param from_local: if ``True``, don't check for or acquire latest version --
32
+ just provide most recent locally available file, if possible, and raise
33
+ error otherwise
29
34
  """
35
+ if not mane_data_path:
36
+ mane_data_path = get_data_file(DataFile.MANE_SUMMARY, from_local)
30
37
  self.mane_data_path = mane_data_path
31
38
  self.df = self._load_mane_transcript_data()
32
39
 
@@ -37,7 +44,7 @@ class ManeTranscriptMappings:
37
44
  """
38
45
  return pl.read_csv(self.mane_data_path, separator="\t")
39
46
 
40
- def get_gene_mane_data(self, gene_symbol: str) -> List[Dict]:
47
+ def get_gene_mane_data(self, gene_symbol: str) -> list[dict]:
41
48
  """Return MANE Transcript data for a gene.
42
49
 
43
50
  >>> from cool_seq_tool.sources import ManeTranscriptMappings
@@ -64,7 +71,7 @@ class ManeTranscriptMappings:
64
71
  data = data.sort(by="MANE_status", descending=True)
65
72
  return data.to_dicts()
66
73
 
67
- def get_mane_from_transcripts(self, transcripts: List[str]) -> List[Dict]:
74
+ def get_mane_from_transcripts(self, transcripts: list[str]) -> list[dict]:
68
75
  """Get mane transcripts from a list of transcripts
69
76
 
70
77
  :param List[str] transcripts: RefSeq transcripts on c. coordinate
@@ -77,7 +84,7 @@ class ManeTranscriptMappings:
77
84
 
78
85
  def get_mane_data_from_chr_pos(
79
86
  self, alt_ac: str, start: int, end: int
80
- ) -> List[Dict]:
87
+ ) -> list[dict]:
81
88
  """Get MANE data given a GRCh38 genomic position.
82
89
 
83
90
  :param str alt_ac: NC Accession
@@ -1,15 +1,15 @@
1
1
  """Provide mappings between gene symbols and RefSeq + Ensembl transcript accessions."""
2
+
2
3
  import csv
3
4
  from pathlib import Path
4
- from typing import Dict, List, Optional
5
5
 
6
- from cool_seq_tool.paths import LRG_REFSEQGENE_PATH, TRANSCRIPT_MAPPINGS_PATH
6
+ from cool_seq_tool.resources.data_files import DataFile, get_data_file
7
7
 
8
8
 
9
9
  class TranscriptMappings:
10
10
  """Provide mappings between gene symbols and RefSeq + Ensembl transcript accessions.
11
11
 
12
- Uses ``LRG_RefSeqGene`` and ``transcript_mappings.csv``, which will automatically
12
+ Uses ``LRG_RefSeqGene`` and ``transcript_mappings.tsv``, which will automatically
13
13
  be acquired if they aren't already available. See the
14
14
  :ref:`configuration <configuration>` section in the documentation for information
15
15
  about manual acquisition of data.
@@ -21,44 +21,53 @@ class TranscriptMappings:
21
21
 
22
22
  def __init__(
23
23
  self,
24
- transcript_file_path: Path = TRANSCRIPT_MAPPINGS_PATH,
25
- lrg_refseqgene_path: Path = LRG_REFSEQGENE_PATH,
24
+ transcript_file_path: Path | None = None,
25
+ lrg_refseqgene_path: Path | None = None,
26
+ from_local: bool = False,
26
27
  ) -> None:
27
28
  """Initialize the transcript mappings class.
28
29
 
29
30
  :param transcript_file_path: Path to transcript mappings file
30
31
  :param lrg_refseqgene_path: Path to LRG RefSeqGene file
32
+ :param from_local: if ``True``, don't check for or acquire latest version --
33
+ just provide most recent locally available file, if possible, and raise
34
+ error otherwise
31
35
  """
32
36
  # ENSP <-> Gene Symbol
33
- self.ensembl_protein_version_for_gene_symbol: Dict[str, List[str]] = {}
34
- self.ensembl_protein_version_to_gene_symbol: Dict[str, str] = {}
35
- self.ensembl_protein_for_gene_symbol: Dict[str, List[str]] = {}
36
- self.ensembl_protein_to_gene_symbol: Dict[str, str] = {}
37
+ self.ensembl_protein_version_for_gene_symbol: dict[str, list[str]] = {}
38
+ self.ensembl_protein_version_to_gene_symbol: dict[str, str] = {}
39
+ self.ensembl_protein_for_gene_symbol: dict[str, list[str]] = {}
40
+ self.ensembl_protein_to_gene_symbol: dict[str, str] = {}
37
41
 
38
42
  # Gene Symbol <-> ENST
39
- self.ensembl_transcript_version_for_gene_symbol: Dict[str, List[str]] = {}
40
- self.ensembl_transcript_version_to_gene_symbol: Dict[str, str] = {}
41
- self.ensembl_transcript_for_gene_symbol: Dict[str, List[str]] = {}
42
- self.ensembl_transcript_to_gene_symbol: Dict[str, str] = {}
43
+ self.ensembl_transcript_version_for_gene_symbol: dict[str, list[str]] = {}
44
+ self.ensembl_transcript_version_to_gene_symbol: dict[str, str] = {}
45
+ self.ensembl_transcript_for_gene_symbol: dict[str, list[str]] = {}
46
+ self.ensembl_transcript_to_gene_symbol: dict[str, str] = {}
43
47
 
44
48
  # NP_ <-> Gene Symbol
45
- self.refseq_protein_for_gene_symbol: Dict[str, List[str]] = {}
46
- self.refseq_protein_to_gene_symbol: Dict[str, str] = {}
49
+ self.refseq_protein_for_gene_symbol: dict[str, list[str]] = {}
50
+ self.refseq_protein_to_gene_symbol: dict[str, str] = {}
47
51
 
48
52
  # NM_ <-> Gene Symbol
49
- self.refseq_rna_version_for_gene_symbol: Dict[str, List[str]] = {}
50
- self.refseq_rna_version_to_gene_symbol: Dict[str, str] = {}
51
- self.refseq_rna_for_gene_symbol: Dict[str, List[str]] = {}
52
- self.refseq_rna_to_gene_symbol: Dict[str, str] = {}
53
+ self.refseq_rna_version_for_gene_symbol: dict[str, list[str]] = {}
54
+ self.refseq_rna_version_to_gene_symbol: dict[str, str] = {}
55
+ self.refseq_rna_for_gene_symbol: dict[str, list[str]] = {}
56
+ self.refseq_rna_to_gene_symbol: dict[str, str] = {}
53
57
 
54
58
  # NP -> NM
55
- self.np_to_nm: Dict[str, str] = {}
59
+ self.np_to_nm: dict[str, str] = {}
56
60
 
57
61
  # ENSP -> ENST
58
- self.ensp_to_enst: Dict[str, str] = {}
62
+ self.ensp_to_enst: dict[str, str] = {}
59
63
 
60
- self._load_transcript_mappings_data(transcript_file_path)
61
- self._load_refseq_gene_symbol_data(lrg_refseqgene_path)
64
+ self._load_transcript_mappings_data(
65
+ transcript_file_path
66
+ or get_data_file(DataFile.TRANSCRIPT_MAPPINGS, from_local)
67
+ )
68
+ self._load_refseq_gene_symbol_data(
69
+ lrg_refseqgene_path or get_data_file(DataFile.LRG_REFSEQGENE, from_local)
70
+ )
62
71
 
63
72
  def _load_transcript_mappings_data(self, transcript_file_path: Path) -> None:
64
73
  """Load transcript mappings file to dictionaries.
@@ -99,9 +108,9 @@ class TranscriptMappings:
99
108
  ).append(transcript)
100
109
  self.ensembl_transcript_to_gene_symbol[transcript] = gene
101
110
  if versioned_transcript and versioned_protein_transcript:
102
- self.ensp_to_enst[
103
- versioned_protein_transcript
104
- ] = versioned_transcript
111
+ self.ensp_to_enst[versioned_protein_transcript] = (
112
+ versioned_transcript
113
+ )
105
114
 
106
115
  def _load_refseq_gene_symbol_data(self, lrg_refseqgene_path: Path) -> None:
107
116
  """Load data from RefSeq Gene Symbol file to dictionaries.
@@ -134,7 +143,7 @@ class TranscriptMappings:
134
143
  if refseq_transcript and rna_transcript:
135
144
  self.np_to_nm[refseq_transcript] = rna_transcript
136
145
 
137
- def protein_transcripts(self, identifier: str) -> List[str]:
146
+ def protein_transcripts(self, identifier: str) -> list[str]:
138
147
  """Return a list of protein transcripts for a gene symbol.
139
148
 
140
149
  >>> from cool_seq_tool.sources import TranscriptMappings
@@ -154,7 +163,7 @@ class TranscriptMappings:
154
163
  protein_transcripts += self.refseq_protein_for_gene_symbol.get(identifier, "")
155
164
  return list(set(protein_transcripts))
156
165
 
157
- def coding_dna_transcripts(self, identifier: str) -> List[str]:
166
+ def coding_dna_transcripts(self, identifier: str) -> list[str]:
158
167
  """Return transcripts from a coding dna refseq for a gene symbol.
159
168
 
160
169
  :param identifier: Gene identifier to find transcripts for
@@ -172,7 +181,7 @@ class TranscriptMappings:
172
181
  )
173
182
  return list(set(genomic_transcripts))
174
183
 
175
- def get_gene_symbol_from_ensembl_protein(self, q: str) -> Optional[str]:
184
+ def get_gene_symbol_from_ensembl_protein(self, q: str) -> str | None:
176
185
  """Return the gene symbol for a Ensembl Protein.
177
186
 
178
187
  :param q: ensembl protein accession
@@ -184,7 +193,7 @@ class TranscriptMappings:
184
193
  gene_symbol = self.ensembl_protein_to_gene_symbol.get(q)
185
194
  return gene_symbol
186
195
 
187
- def get_gene_symbol_from_refeq_protein(self, q: str) -> Optional[str]:
196
+ def get_gene_symbol_from_refeq_protein(self, q: str) -> str | None:
188
197
  """Return the gene symbol for a Refseq Protein.
189
198
 
190
199
  :param q: RefSeq protein accession
@@ -192,7 +201,7 @@ class TranscriptMappings:
192
201
  """
193
202
  return self.refseq_protein_to_gene_symbol.get(q)
194
203
 
195
- def get_gene_symbol_from_refseq_rna(self, q: str) -> Optional[str]:
204
+ def get_gene_symbol_from_refseq_rna(self, q: str) -> str | None:
196
205
  """Return gene symbol for a Refseq RNA Transcript.
197
206
 
198
207
  :param q: RefSeq RNA transcript accession
@@ -204,7 +213,7 @@ class TranscriptMappings:
204
213
  gene_symbol = self.refseq_rna_to_gene_symbol.get(q)
205
214
  return gene_symbol
206
215
 
207
- def get_gene_symbol_from_ensembl_transcript(self, q: str) -> Optional[str]:
216
+ def get_gene_symbol_from_ensembl_transcript(self, q: str) -> str | None:
208
217
  """Return gene symbol for an Ensembl Transcript.
209
218
 
210
219
  :param q: Ensembl transcript accession