Skip to content

Commit 532d574

Browse files
authored
Merge pull request #895 from AswaniSahoo/fix/cnv-discordant-read-calls-error
fix: dedent empty-data check in cnv_discordant_read_calls (#777)
2 parents 73fdafe + 4044a2f commit 532d574

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

malariagen_data/anoph/cnv_data.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,13 @@ def cnv_discordant_read_calls(
642642

643643
ly.append(y)
644644

645-
if len(ly) == 0:
646-
# Bail out, no data for given sample sets and analysis.
647-
raise ValueError("No data found for requested sample sets.")
645+
if len(ly) == 0:
646+
# Bail out, no data for given sample sets and contig.
647+
raise ValueError(
648+
f"No CNV discordant read calls data found for contig {c!r} "
649+
f"in the requested sample sets. This could be because the "
650+
f"sample sets do not have discordant read calls data available."
651+
)
648652

649653
x = _simple_xarray_concat(ly, dim=DIM_SAMPLE)
650654
lx.append(x)

tests/anoph/test_cnv_data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,10 @@ def test_cnv_discordant_read_calls(fixture, api: AnophelesCnvData):
626626
assert isinstance(d2, xr.DataArray)
627627

628628
# Check with a contig that should not exist
629-
with pytest.raises(ValueError):
629+
with pytest.raises(
630+
ValueError,
631+
match="No CNV discordant read calls data found|no CNVs available for contig",
632+
):
630633
api.cnv_discordant_read_calls(
631634
contig="foobar", sample_sets=random.choice(all_sample_sets)
632635
)

0 commit comments

Comments
 (0)