diff --git a/malariagen_data/anoph/cnv_data.py b/malariagen_data/anoph/cnv_data.py index 38e389939..f9e6d474c 100644 --- a/malariagen_data/anoph/cnv_data.py +++ b/malariagen_data/anoph/cnv_data.py @@ -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 @@ -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)