Skip to content

Commit 3371f37

Browse files
authored
Merge branch 'master' into GH953-synonymous-start-stop
2 parents 9d14600 + 8e2fce4 commit 3371f37

6 files changed

Lines changed: 17 additions & 18 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)

malariagen_data/anoph/fst.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,10 @@ def plot_pairwise_average_fst(
539539
if annotation == "standard error":
540540
fig_df.loc[cohort1, cohort2] = se
541541
elif annotation == "Z score":
542-
try:
543-
zs = fst / se
544-
fig_df.loc[cohort1, cohort2] = zs
545-
except ZeroDivisionError:
542+
if se == 0:
546543
fig_df.loc[cohort1, cohort2] = np.nan
544+
else:
545+
fig_df.loc[cohort1, cohort2] = fst / se
547546
else:
548547
fig_df.loc[cohort1, cohort2] = fst
549548

malariagen_data/anoph/g123.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def g123_gwss(
170170
) -> Tuple[np.ndarray, np.ndarray]:
171171
# Change this name if you ever change the behaviour of this function, to
172172
# invalidate any previously cached data.
173-
name = "g123_gwss_v1"
173+
name = "g123_gwss_v2"
174174

175175
valid_sites = self.phasing_analysis_ids + ("all", "segregating")
176176
if sites not in valid_sites:
@@ -181,7 +181,7 @@ def g123_gwss(
181181
params = dict(
182182
contig=contig,
183183
sites=sites,
184-
site_mask=site_mask,
184+
site_mask=self._prep_optional_site_mask_param(site_mask=site_mask),
185185
window_size=window_size,
186186
sample_sets=self._prep_sample_sets_param(sample_sets=sample_sets),
187187
# N.B., do not be tempted to convert this sample query into integer

malariagen_data/mjn.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,6 @@ def _mjn_graph_edges(
281281
# add edge from final intermediate node to node j
282282
source = f"anon_{i}_{j}_{sep-2}"
283283
target = j
284-
graph_node = {
285-
"id": source,
286-
"count": 0,
287-
"width": anon_width,
288-
}
289-
graph_nodes.append(graph_node)
290284
graph_edge = {
291285
"id": f"edge_{i}_{j}_{sep-1}",
292286
"source": source,

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
)

tests/anoph/test_g123.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,7 @@ def test_g123_calibration(fixture, api: AnophelesG123Analysis):
240240

241241
# Set up test parameters.
242242
all_sample_sets = api.sample_sets()["sample_set"].to_list()
243-
window_sizes = np.random.randint(100, 500, size=random.randint(2, 5)).tolist()
244-
window_sizes = sorted([int(x) for x in window_sizes])
243+
window_sizes = sorted(random.sample(range(100, 500), k=random.randint(2, 5)))
245244
g123_params = dict(
246245
contig=random.choice(api.contigs),
247246
sites=random.choice(api.phasing_analysis_ids),

0 commit comments

Comments
 (0)