Skip to content

Commit c9a4ca3

Browse files
authored
Merge pull request #34 from VariantEffect/mavedb-dev
Release 2024.1.3
2 parents b923f4e + 0cb7f8a commit c9a4ca3

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

src/dcd_mapping/annotate.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -306,22 +306,20 @@ def _annotate_haplotype_mapping(
306306
for allele in pre_mapped.members:
307307
allele.extensions = [_get_vrs_ref_allele_seq(allele, metadata, tx_results)]
308308

309-
# Determine reference sequence
310-
if mapped_score.annotation_layer == AnnotationLayer.GENOMIC:
311-
sequence_id = (
312-
f"ga4gh:{post_mapped.members[0].location.sequenceReference.refgetAccession}"
313-
)
314-
accession = get_chromosome_identifier_from_vrs_id(sequence_id)
315-
if accession is None:
316-
raise ValueError
317-
if accession.startswith("refseq:"):
318-
accession = accession[7:]
319-
else:
320-
if tx_results is None:
321-
raise ValueError # impossible by definition
322-
accession = tx_results.np
323-
324309
if post_mapped:
310+
# Determine reference sequence
311+
if mapped_score.annotation_layer == AnnotationLayer.GENOMIC:
312+
sequence_id = f"ga4gh:{post_mapped.members[0].location.sequenceReference.refgetAccession}"
313+
accession = get_chromosome_identifier_from_vrs_id(sequence_id)
314+
if accession is None:
315+
raise ValueError
316+
if accession.startswith("refseq:"):
317+
accession = accession[7:]
318+
else:
319+
if tx_results is None:
320+
raise ValueError # impossible by definition
321+
accession = tx_results.np
322+
325323
sr = get_seqrepo()
326324
for allele in post_mapped.members:
327325
loc = allele.location

src/dcd_mapping/mavedb_data.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from typing import Any
1515

1616
import requests
17+
from fastapi import HTTPException
1718
from pydantic import ValidationError
1819

1920
from dcd_mapping.resource_utils import (
@@ -283,8 +284,17 @@ async def wrapper(*args, **kwargs) -> ScoresetMapping: # noqa: ANN002
283284
# Set up metadata and scores for the current run. Now they will be accessible by these functions
284285
# without the need to download the data again.
285286
temp_dir_as_path = Path(temp_dir)
286-
get_scoreset_metadata(urn, temp_dir_as_path)
287-
get_scoreset_records(urn, silent, temp_dir_as_path)
287+
try:
288+
get_scoreset_metadata(urn, temp_dir_as_path)
289+
get_scoreset_records(urn, silent, temp_dir_as_path)
290+
except ScoresetNotSupportedError as e:
291+
return ScoresetMapping(
292+
metadata=None,
293+
error_message=str(e).strip("'"),
294+
)
295+
except ResourceAcquisitionError as e:
296+
msg = f"Unable to acquire resource from MaveDB: {e}"
297+
raise HTTPException(status_code=500, detail=msg) from e
288298

289299
# Pass the storage path of the temp directory to the wrapped function as a kwarg.
290300
kwargs["store_path"] = temp_dir_as_path

src/dcd_mapping/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Provide dcd mapping version"""
22

3-
dcd_mapping_version = "2024.1.2"
3+
dcd_mapping_version = "2024.1.3"

0 commit comments

Comments
 (0)