Skip to content

Commit b24f76e

Browse files
authored
Merge branch 'master' into issue-554-codecov-patch-threshold
2 parents 44bdba7 + 3b4722f commit b24f76e

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

malariagen_data/anoph/h12.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ def plot_h12_gwss_multi_overlay_track(
625625
)
626626

627627
# Plot H12.
628-
for i, (cohort_label, (x, h12, contig)) in enumerate(res.items()):
628+
for i, (cohort_label, (x, h12, contig_idx)) in enumerate(res.items()):
629629
fig.scatter(
630630
x=x,
631631
y=h12,

malariagen_data/anoph/snp_data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,9 +1872,10 @@ def biallelic_snp_calls(
18721872

18731873
# Apply missingness condition.
18741874
if max_missing_an is not None:
1875-
an_missing = (ds_out.sizes["samples"] * ds_out.sizes["ploidy"]) - an
1875+
an_total = ds_out.sizes["samples"] * ds_out.sizes["ploidy"]
1876+
an_missing = an_total - an
18761877
if isinstance(max_missing_an, float):
1877-
an_missing_frac = an_missing / an
1878+
an_missing_frac = an_missing / an_total
18781879
loc_missing = an_missing_frac <= max_missing_an
18791880
else:
18801881
loc_missing = an_missing <= max_missing_an

malariagen_data/anopheles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ def cohort_diversity_stats(
10661066
cohort_label, cohort_query = cohort
10671067

10681068
else:
1069-
raise TypeError(r"invalid cohort parameter: {cohort!r}")
1069+
raise TypeError(f"invalid cohort parameter: {cohort!r}")
10701070

10711071
debug("access allele counts")
10721072
ac = self.snp_allele_counts(

malariagen_data/util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ def _init_filesystem(url, **kwargs):
430430
"""Initialise a fsspec filesystem from a given base URL and parameters."""
431431

432432
storage_options = None # To prevent using before assignment (Pylint).
433+
simplecache_options = kwargs.pop("simplecache", None)
433434

434435
# Special case Google Cloud Storage, authenticate the user.
435436
if "gs://" in url or "gcs://" in url:
@@ -487,6 +488,9 @@ def _init_filesystem(url, **kwargs):
487488
# Some other kind of URL, pass through kwargs as-is.
488489
storage_options = kwargs
489490

491+
if simplecache_options is not None:
492+
storage_options["simplecache"] = simplecache_options
493+
490494
# Process the URL using fsspec.
491495
fs, path = url_to_fs(url, **storage_options)
492496

tests/anoph/test_snp_data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,8 +1723,9 @@ def test_biallelic_snp_calls_and_diplotypes_with_conditions_fractional(
17231723
an = ac.sum(axis=1)
17241724
ac_min = ac.min(axis=1)
17251725
assert np.all((ac_min / an) >= min_minor_ac)
1726-
an_missing = (ds.sizes["samples"] * ds.sizes["ploidy"]) - an
1727-
assert np.all((an_missing / an) <= max_missing_an)
1726+
an_total = ds.sizes["samples"] * ds.sizes["ploidy"]
1727+
an_missing = an_total - an
1728+
assert np.all((an_missing / an_total) <= max_missing_an)
17281729
gt = ds["call_genotype"].values
17291730
ac_check = allel.GenotypeArray(gt).count_alleles(max_allele=1)
17301731
assert np.all(ac == ac_check)

0 commit comments

Comments
 (0)