Skip to content

Commit

Permalink
Skip sets with missing CNV DRCs rather than FileNotFoundError. Raise …
Browse files Browse the repository at this point in the history
…ValueError when no given sets have DRCs.
  • Loading branch information
leehart committed Sep 13, 2024
1 parent 27f9589 commit 51f1077
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion malariagen_data/anoph/cnv_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,11 @@ def _cnv_discordant_read_calls_dataset(
data_vars = dict()

debug("open zarr")
root = self.open_cnv_discordant_read_calls(sample_set=sample_set)

try:
root = self.open_cnv_discordant_read_calls(sample_set=sample_set)
except FileNotFoundError:
return None

# not all contigs have CNVs, need to check
# TODO consider returning dataset with zero length variants dimension, would
Expand Down Expand Up @@ -556,8 +560,17 @@ def cnv_discordant_read_calls(
inline_array=inline_array,
chunks=chunks,
)

# If no CNV DRCs dataset was found then skip
if y is None:
continue

ly.append(y)

if len(ly) == 0:
# Bail out, no data for given sample sets and analysis.
raise ValueError("No data found for requested sample sets.")

x = simple_xarray_concat(ly, dim=DIM_SAMPLE)
lx.append(x)

Expand Down

0 comments on commit 51f1077

Please sign in to comment.