Skip to content

Commit 67ffa47

Browse files
committed
Raise ValueError when view_alignments is given irrelevant sample
1 parent 21af2d2 commit 67ffa47

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

malariagen_data/anoph/igv.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ def _igv_view_alignments_tracks(
8484
visibility_window: int = 20_000,
8585
):
8686
# Look up sample set for sample.
87-
sample_rec = self.sample_metadata().set_index("sample_id").loc[sample]
87+
try:
88+
sample_rec = self.sample_metadata().set_index("sample_id").loc[sample]
89+
except KeyError as e:
90+
raise ValueError(
91+
f"No data found for sample {sample!r}. This sample might be unavailable or irrelevant with respect to settings."
92+
) from e
93+
8894
sample_set = sample_rec["sample_set"]
8995

9096
# Load data catalog.

0 commit comments

Comments
 (0)