Skip to content

Commit

Permalink
Merge pull request #32 from VariantEffect/bugfix/bencap/31/score-set-…
Browse files Browse the repository at this point in the history
…supported-decorator-handling

Fixed: Unsupported score sets not handled by decorator
  • Loading branch information
bencap authored Nov 27, 2024
2 parents d28ce73 + e64e41f commit a6586b7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/dcd_mapping/mavedb_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import Any

import requests
from fastapi import HTTPException
from pydantic import ValidationError

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

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

0 comments on commit a6586b7

Please sign in to comment.