|
49 | 49 | from gene.query import QueryHandler |
50 | 50 | from gene.schemas import MatchType, SourceName |
51 | 51 |
|
| 52 | +from dcd_mapping.exceptions import DataLookupError |
52 | 53 | from dcd_mapping.schemas import ( |
53 | 54 | GeneLocation, |
54 | 55 | ManeDescription, |
@@ -93,10 +94,6 @@ def cdot_rest() -> RESTDataProvider: |
93 | 94 | # ---------------------------------- Global ---------------------------------- # |
94 | 95 |
|
95 | 96 |
|
96 | | -class DataLookupError(Exception): |
97 | | - """Raise for misc. issues related to resource acquisition/lookup.""" |
98 | | - |
99 | | - |
100 | 97 | class CoolSeqToolBuilder: |
101 | 98 | """Singleton constructor for ``cool-seq-tool`` instance.""" |
102 | 99 |
|
@@ -241,7 +238,9 @@ async def check_uta() -> None: |
241 | 238 | query = f"select * from {uta.schema}.meta" # noqa: S608 |
242 | 239 | result = await uta.execute_query(query) |
243 | 240 | if not result: |
244 | | - raise DataLookupError |
| 241 | + msg = "UTA schema check failed. No results returned." |
| 242 | + _logger.error(msg) |
| 243 | + raise DataLookupError(msg) |
245 | 244 |
|
246 | 245 |
|
247 | 246 | async def get_protein_accession(transcript: str) -> str | None: |
@@ -302,9 +301,13 @@ async def get_transcripts( |
302 | 301 | def check_gene_normalizer() -> None: |
303 | 302 | q = GeneNormalizerBuilder() |
304 | 303 | if (not q.db.check_schema_initialized()) or not (q.db.check_tables_populated()): |
305 | | - raise DataLookupError |
| 304 | + msg = "Gene Normalizer database schema check failed. No results returned." |
| 305 | + _logger.error(msg) |
| 306 | + raise DataLookupError(msg) |
306 | 307 | if q.normalize("BRAF").match_type == MatchType.NO_MATCH: |
307 | | - raise DataLookupError |
| 308 | + msg = "Gene Normalizer returned no normalization results for BRAF. This indicates an underlying issue with the database that should be investigated." |
| 309 | + _logger.error(msg) |
| 310 | + raise DataLookupError(msg) |
308 | 311 |
|
309 | 312 |
|
310 | 313 | def _get_hgnc_symbol(term: str) -> str | None: |
@@ -436,7 +439,9 @@ def get_gene_location(target_gene: TargetGene) -> GeneLocation | None: |
436 | 439 | def check_seqrepo() -> None: |
437 | 440 | sr = get_seqrepo() |
438 | 441 | if not sr.sr["NC_000001.11"][780000:780020]: |
439 | | - raise DataLookupError |
| 442 | + msg = "SeqRepo returned no sequence for NC_000001.11 at 780000:780020. This indicates an underlying issue with SeqRepo that should be investigated." |
| 443 | + _logger.error(msg) |
| 444 | + raise DataLookupError(msg) |
440 | 445 | conn = sr.sr.aliases._db |
441 | 446 | try: |
442 | 447 | # conn = sr.sr.aliases._db |
|
0 commit comments