|
1 | 1 | """The module for Transcript Mappings.""" |
2 | 2 | import csv |
| 3 | +from pathlib import Path |
3 | 4 | from typing import Dict, List, Optional |
4 | 5 |
|
5 | 6 | from cool_seq_tool import TRANSCRIPT_MAPPINGS_PATH, LRG_REFSEQGENE_PATH |
|
8 | 9 | class TranscriptMappings: |
9 | 10 | """The transcript mappings class.""" |
10 | 11 |
|
11 | | - def __init__(self, transcript_file_path: str = TRANSCRIPT_MAPPINGS_PATH, |
12 | | - lrg_refseqgene_path: str = LRG_REFSEQGENE_PATH) -> None: |
| 12 | + def __init__(self, transcript_file_path: Path = TRANSCRIPT_MAPPINGS_PATH, |
| 13 | + lrg_refseqgene_path: Path = LRG_REFSEQGENE_PATH) -> None: |
13 | 14 | """Initialize the transcript mappings class. |
14 | 15 |
|
15 | | - :param str transcript_file_path: Path to transcript mappings file |
16 | | - :param str lrg_refseqgene_path: Path to LRG RefSeqGene file |
| 16 | + :param Path transcript_file_path: Path to transcript mappings file |
| 17 | + :param Path lrg_refseqgene_path: Path to LRG RefSeqGene file |
17 | 18 | """ |
18 | 19 | # ENSP <-> Gene Symbol |
19 | 20 | self.ensembl_protein_version_for_gene_symbol: Dict[str, List[str]] = {} |
@@ -51,11 +52,10 @@ def __init__(self, transcript_file_path: str = TRANSCRIPT_MAPPINGS_PATH, |
51 | 52 | self._load_transcript_mappings_data(transcript_file_path) |
52 | 53 | self._load_refseq_gene_symbol_data(lrg_refseqgene_path) |
53 | 54 |
|
54 | | - def _load_transcript_mappings_data(self, |
55 | | - transcript_file_path: str) -> None: |
| 55 | + def _load_transcript_mappings_data(self, transcript_file_path: Path) -> None: |
56 | 56 | """Load transcript mappings file to dictionaries. |
57 | 57 |
|
58 | | - :param str transcript_file_path: Path to transcript mappings file |
| 58 | + :param Path transcript_file_path: Path to transcript mappings file |
59 | 59 | """ |
60 | 60 | with open(transcript_file_path) as file: |
61 | 61 | reader = csv.DictReader(file, delimiter="\t") |
@@ -96,10 +96,10 @@ def _load_transcript_mappings_data(self, |
96 | 96 | self.ensp_to_enst[versioned_protein_transcript] = \ |
97 | 97 | versioned_transcript |
98 | 98 |
|
99 | | - def _load_refseq_gene_symbol_data(self, lrg_refseqgene_path: str) -> None: |
| 99 | + def _load_refseq_gene_symbol_data(self, lrg_refseqgene_path: Path) -> None: |
100 | 100 | """Load data from RefSeq Gene Symbol file to dictionaries. |
101 | 101 |
|
102 | | - :param str lrg_refseqgene_path: Path to LRG RefSeqGene file |
| 102 | + :param Path lrg_refseqgene_path: Path to LRG RefSeqGene file |
103 | 103 | """ |
104 | 104 | with open(lrg_refseqgene_path) as file: |
105 | 105 | reader = csv.DictReader(file, delimiter="\t") |
|
0 commit comments