From b03d7b996ce27311f5251211aa79c62c3996be15 Mon Sep 17 00:00:00 2001 From: Daniel Bolin Date: Fri, 9 Feb 2024 17:46:00 -0500 Subject: [PATCH] Improve error for unsupported organs --- src/algorithm/algorithm.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/algorithm/algorithm.py b/src/algorithm/algorithm.py index 2074f33..fe22ca7 100644 --- a/src/algorithm/algorithm.py +++ b/src/algorithm/algorithm.py @@ -90,10 +90,15 @@ def __load_metadata(self, organ: str, organ_metadata: Path) -> OrganMetadata: Returns: OrganMetadata: Organ specific metadata + + Raises: + ValueError: If the organ is not supported by the algorithm """ with open(organ_metadata) as file: - data = json.load(file) - return data[organ] + metadata = json.load(file) + if organ not in metadata: + raise ValueError(f"Organ {organ} is not supported") + return metadata[organ] def __post_process_result( self, result: RunResult, organ: str, metadata: OrganMetadata