Skip to content

Commit 113defe

Browse files
committed
Rename to _check_types, update uses
1 parent 1db9094 commit 113defe

25 files changed

Lines changed: 153 additions & 153 deletions

malariagen_data/anoph/aim_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from malariagen_data.anoph import plotly_params
1212

13-
from ..util import DIM_SAMPLE, check_types, _init_zarr_store, _simple_xarray_concat
13+
from ..util import DIM_SAMPLE, _check_types, _init_zarr_store, _simple_xarray_concat
1414
from . import aim_params, base_params
1515
from .genome_features import AnophelesGenomeFeaturesData
1616
from .genome_sequence import AnophelesGenomeSequenceData
@@ -62,7 +62,7 @@ def _prep_aims_param(self, *, aims: aim_params.aims) -> str:
6262
else:
6363
raise ValueError(f"Invalid aims parameter, must be one of {self.aim_ids}.")
6464

65-
@check_types
65+
@_check_types
6666
@doc(
6767
summary="Access ancestry informative marker variants.",
6868
returns="""
@@ -110,7 +110,7 @@ def _aim_calls_dataset(self, *, aims, sample_set):
110110
ds = ds.set_coords(["variant_contig", "variant_position", "sample_id"])
111111
return ds
112112

113-
@check_types
113+
@_check_types
114114
@doc(
115115
summary="""
116116
Access ancestry informative marker SNP sites, alleles and genotype

malariagen_data/anoph/base.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
CacheMiss,
3535
LoggingHelper,
3636
_check_colab_location,
37-
check_types,
37+
_check_types,
3838
_distributed_client,
3939
_get_gcp_region,
4040
_hash_params,
@@ -222,12 +222,12 @@ def _spinner(
222222
else:
223223
return nullcontext()
224224

225-
@check_types
225+
@_check_types
226226
def open_file(self, path: str) -> IO:
227227
full_path = f"{self._base_path}/{path}"
228228
return self._fs.open(full_path)
229229

230-
@check_types
230+
@_check_types
231231
def read_files(
232232
self,
233233
paths: Iterable[str],
@@ -608,7 +608,7 @@ def _read_sample_sets_manifest(self, *, single_release: str):
608608

609609
return df
610610

611-
@check_types
611+
@_check_types
612612
@doc(
613613
summary="Access a dataframe of sample sets",
614614
returns="""A dataframe of sample sets, one row per sample set. It contains five columns:
@@ -630,7 +630,7 @@ def sample_sets(
630630
) -> pd.DataFrame:
631631
return self._relevant_sample_sets(release=release)
632632

633-
@check_types
633+
@_check_types
634634
@doc(
635635
summary="Access a dataframe of available sample sets",
636636
returns="""A dataframe of available sample sets, one row per sample set. It contains five columns:
@@ -685,7 +685,7 @@ def _available_sample_sets(
685685
# Return copy to ensure cached dataframes aren't modified by user.
686686
return df.copy()
687687

688-
@check_types
688+
@_check_types
689689
@doc(
690690
summary="Access a dataframe of relevant sample sets",
691691
returns="""A dataframe of relevant sample sets, one row per sample set. It contains five columns:
@@ -767,7 +767,7 @@ def _relevant_sample_sets(
767767
# Return copy to ensure cached dataframes aren't modified by user.
768768
return df.copy()
769769

770-
@check_types
770+
@_check_types
771771
@doc(
772772
summary="Find which release a sample set was included in.",
773773
returns="The release the sample set is part of.",
@@ -784,7 +784,7 @@ def lookup_release(self, sample_set: base_params.sample_set) -> str:
784784
f"No release found for sample set {sample_set!r}. This sample set might be unavailable or irrelevant with respect to settings."
785785
) from e
786786

787-
@check_types
787+
@_check_types
788788
@doc(
789789
summary="Find which study a sample set belongs to.",
790790
returns="The study the sample set belongs to.",
@@ -798,7 +798,7 @@ def lookup_study(self, sample_set: base_params.sample_set) -> str:
798798
except KeyError as e:
799799
raise ValueError(f"No study ID found for sample set {sample_set!r}") from e
800800

801-
@check_types
801+
@_check_types
802802
@doc(
803803
summary="Find the study info for a sample set.",
804804
returns="The info for the study the sample set belongs to.",
@@ -816,7 +816,7 @@ def lookup_study_info(self, sample_set: base_params.sample_set) -> dict:
816816
f"No study info found for sample set {sample_set!r}"
817817
) from e
818818

819-
@check_types
819+
@_check_types
820820
@doc(
821821
summary="Find the terms-of-use info for a sample set.",
822822
returns="The terms-of-use info for the sample set.",
@@ -980,7 +980,7 @@ def _results_cache_add_analysis_params(self, params: dict):
980980
# Expect sub-classes will override to add any analysis parameters.
981981
pass
982982

983-
@check_types
983+
@_check_types
984984
def results_cache_get(
985985
self, *, name: str, params: Dict[str, Any]
986986
) -> Mapping[str, np.ndarray]:
@@ -1004,7 +1004,7 @@ def results_cache_get(
10041004

10051005
raise CacheMiss
10061006

1007-
@check_types
1007+
@_check_types
10081008
def results_cache_set(
10091009
self, *, name: str, params: Dict[str, Any], results: Mapping[str, np.ndarray]
10101010
):

malariagen_data/anoph/cnv_data.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
DIM_SAMPLE,
1212
DIM_VARIANT,
1313
Region,
14-
check_types,
14+
_check_types,
1515
_da_from_zarr,
1616
_init_zarr_store,
1717
_parse_multi_region,
@@ -68,7 +68,7 @@ def coverage_calls_analysis_ids(self) -> Tuple[str, ...]:
6868
"""
6969
return tuple(self.config.get("COVERAGE_CALLS_ANALYSIS_IDS", ())) # ensure tuple
7070

71-
@check_types
71+
@_check_types
7272
@doc(
7373
summary="Open CNV HMM zarr.",
7474
returns="Zarr hierarchy or None.",
@@ -167,7 +167,7 @@ def _cnv_hmm_dataset(self, *, contig, sample_set, inline_array, chunks):
167167

168168
return ds
169169

170-
@check_types
170+
@_check_types
171171
@doc(
172172
summary="Access CNV HMM data from CNV calling.",
173173
returns="""A dataset with 2 dimensions:
@@ -271,7 +271,7 @@ def cnv_hmm(
271271

272272
return ds
273273

274-
@check_types
274+
@_check_types
275275
@doc(
276276
summary="Open CNV coverage calls zarr.",
277277
returns="Zarr hierarchy.",
@@ -386,7 +386,7 @@ def _cnv_coverage_calls_dataset(
386386

387387
return ds
388388

389-
@check_types
389+
@_check_types
390390
@doc(
391391
summary="Access CNV HMM data from genome-wide CNV discovery and filtering.",
392392
returns="""A dataset with 2 dimensions:
@@ -469,7 +469,7 @@ def cnv_coverage_calls(
469469

470470
return ds
471471

472-
@check_types
472+
@_check_types
473473
@doc(
474474
summary="Open CNV discordant read calls zarr.",
475475
returns="Zarr hierarchy.",
@@ -575,7 +575,7 @@ def _cnv_discordant_read_calls_dataset(
575575

576576
return ds
577577

578-
@check_types
578+
@_check_types
579579
@doc(
580580
summary="Access CNV discordant read calls data.",
581581
returns="""A dataset with 2 dimensions:
@@ -665,7 +665,7 @@ def cnv_discordant_read_calls(
665665

666666
return ds
667667

668-
@check_types
668+
@_check_types
669669
@doc(
670670
summary="Plot CNV HMM data for a single sample, using bokeh.",
671671
returns="Bokeh figure.",
@@ -790,7 +790,7 @@ def plot_cnv_hmm_coverage_track(
790790
else:
791791
return fig
792792

793-
@check_types
793+
@_check_types
794794
@doc(
795795
summary="Plot CNV HMM data for a single sample, together with a genes track, using bokeh.",
796796
returns="Bokeh figure.",
@@ -864,7 +864,7 @@ def plot_cnv_hmm_coverage(
864864
else:
865865
return fig
866866

867-
@check_types
867+
@_check_types
868868
@doc(
869869
summary="Plot CNV HMM data for multiple samples as a heatmap, using bokeh.",
870870
returns="Bokeh figure.",
@@ -1006,7 +1006,7 @@ def plot_cnv_hmm_heatmap_track(
10061006
else:
10071007
return fig
10081008

1009-
@check_types
1009+
@_check_types
10101010
@doc(
10111011
summary="Plot CNV HMM data for multiple samples as a heatmap, with a genes track, using bokeh.",
10121012
returns="Bokeh figure.",

malariagen_data/anoph/cnv_frq.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
_add_frequency_ci,
1717
)
1818
from ..util import (
19-
check_types,
19+
_check_types,
2020
_pandas_apply,
2121
Region,
2222
_parse_multi_region,
@@ -38,7 +38,7 @@ def __init__(
3838
# to the superclass constructor.
3939
super().__init__(**kwargs)
4040

41-
@check_types
41+
@_check_types
4242
@doc(
4343
summary="""
4444
Compute modal copy number by gene, from HMM data.
@@ -183,7 +183,7 @@ def _gene_cnv(
183183

184184
return ds_out
185185

186-
@check_types
186+
@_check_types
187187
@doc(
188188
summary="""
189189
Compute modal copy number by gene, then compute the frequency of
@@ -412,7 +412,7 @@ def _gene_cnv_frequencies(
412412

413413
return df
414414

415-
@check_types
415+
@_check_types
416416
@doc(
417417
summary="""
418418
Group samples by taxon, area (space) and period (time), then compute

malariagen_data/anoph/dipclust.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from ..util import (
1010
CacheMiss,
11-
check_types,
11+
_check_types,
1212
_multiallelic_diplotype_pdist,
1313
_multiallelic_diplotype_mean_sqeuclidean,
1414
_multiallelic_diplotype_mean_cityblock,
@@ -42,7 +42,7 @@ def __init__(
4242
# to the superclass constructor.
4343
super().__init__(**kwargs)
4444

45-
@check_types
45+
@_check_types
4646
@doc(
4747
summary=""""
4848
Hierarchically cluster diplotypes in region and produce an interactive plot.

malariagen_data/anoph/distance.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Internal imports.
1111
from .snp_data import AnophelesSnpData
1212
from . import base_params, distance_params, plotly_params, pca_params, tree_params
13-
from ..util import _square_to_condensed, check_types, CacheMiss
13+
from ..util import _square_to_condensed, _check_types, CacheMiss
1414

1515

1616
@numba.njit(parallel=True)
@@ -81,7 +81,7 @@ def __init__(self, **kwargs):
8181
# to the superclass constructor.
8282
super().__init__(**kwargs)
8383

84-
@check_types
84+
@_check_types
8585
@doc(
8686
summary="""
8787
Compute pairwise distances between samples using biallelic SNP genotypes.
@@ -240,7 +240,7 @@ def _biallelic_diplotype_pairwise_distances(
240240
), # ensure consistent behaviour to/from results cache
241241
)
242242

243-
@check_types
243+
@_check_types
244244
@doc(
245245
summary="""
246246
Construct a neighbour-joining tree between samples using biallelic SNP genotypes.
@@ -409,7 +409,7 @@ def _njt(
409409
), # ensure consistent behaviour to/from results cache
410410
)
411411

412-
@check_types
412+
@_check_types
413413
@doc(
414414
summary="""
415415
Plot an unrooted neighbour-joining tree, computed from pairwise distances

malariagen_data/anoph/frq_base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
frq_params,
1313
map_params,
1414
)
15-
from ..util import check_types
15+
from ..util import _check_types
1616
from .base import AnophelesBase
1717

1818

@@ -170,7 +170,7 @@ def __init__(
170170
# to the superclass constructor.
171171
super().__init__(**kwargs)
172172

173-
@check_types
173+
@_check_types
174174
@doc(
175175
summary="""
176176
Plot a heatmap from a pandas DataFrame of frequencies, e.g., output
@@ -323,7 +323,7 @@ def plot_frequencies_heatmap(
323323
else:
324324
return fig
325325

326-
@check_types
326+
@_check_types
327327
@doc(
328328
summary="Create a time series plot of variant frequencies using plotly.",
329329
parameters=dict(
@@ -461,7 +461,7 @@ def plot_frequencies_time_series(
461461
else:
462462
return fig
463463

464-
@check_types
464+
@_check_types
465465
@doc(
466466
summary="""
467467
Plot markers on a map showing variant frequencies for cohorts grouped
@@ -552,7 +552,7 @@ def plot_frequencies_map_markers(
552552
)
553553
m.add(marker)
554554

555-
@check_types
555+
@_check_types
556556
@doc(
557557
summary="""
558558
Create an interactive map with markers showing variant frequencies or

0 commit comments

Comments
 (0)