Skip to content

Commit 57c7cd3

Browse files
committed
Remove taxon_by param optionality and None check in frq advanced funcs
1 parent 4ffa4c1 commit 57c7cd3

4 files changed

Lines changed: 12 additions & 32 deletions

File tree

malariagen_data/anoph/cnv_frq.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,15 +445,8 @@ def gene_cnv_frequencies_advanced(
445445
ci_method: Optional[frq_params.ci_method] = frq_params.ci_method_default,
446446
chunks: base_params.chunks = base_params.native_chunks,
447447
inline_array: base_params.inline_array = base_params.inline_array_default,
448-
taxon_by: Optional[frq_params.taxon_by] = frq_params.taxon_by_default,
448+
taxon_by: frq_params.taxon_by = frq_params.taxon_by_default,
449449
) -> xr.Dataset:
450-
# Check that the taxon_by default hasn't been subverted, e.g. via `taxon_by=None`.
451-
# This also satisfies type-checking, e.g. with `getattr`.
452-
if taxon_by is None:
453-
raise ValueError(
454-
f"`taxon_by` cannot be set to `None`. The default would be {frq_params.taxon_by_default!r}."
455-
)
456-
457450
regions: List[Region] = parse_multi_region(self, region)
458451
del region
459452

malariagen_data/anoph/hap_frq.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,8 @@ def haplotypes_frequencies_advanced(
153153
ci_method: Optional[frq_params.ci_method] = frq_params.ci_method_default,
154154
chunks: base_params.chunks = base_params.native_chunks,
155155
inline_array: base_params.inline_array = base_params.inline_array_default,
156-
taxon_by: Optional[frq_params.taxon_by] = frq_params.taxon_by_default,
156+
taxon_by: frq_params.taxon_by = frq_params.taxon_by_default,
157157
) -> xr.Dataset:
158-
# Check that the taxon_by default hasn't been subverted, e.g. via `taxon_by=None`.
159-
# This also satisfies type-checking, e.g. with `getattr`.
160-
if taxon_by is None:
161-
raise ValueError(
162-
f"`taxon_by` cannot be set to `None`. The default would be {frq_params.taxon_by_default!r}."
163-
)
164-
165158
# Load sample metadata.
166159
df_samples = self.sample_metadata(
167160
sample_sets=sample_sets,

malariagen_data/anoph/snp_frq.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -451,15 +451,8 @@ def snp_allele_frequencies_advanced(
451451
ci_method: Optional[frq_params.ci_method] = frq_params.ci_method_default,
452452
chunks: base_params.chunks = base_params.native_chunks,
453453
inline_array: base_params.inline_array = base_params.inline_array_default,
454-
taxon_by: Optional[frq_params.taxon_by] = frq_params.taxon_by_default,
454+
taxon_by: frq_params.taxon_by = frq_params.taxon_by_default,
455455
) -> xr.Dataset:
456-
# Check that the taxon_by default hasn't been subverted, e.g. via `taxon_by=None`.
457-
# This also satisfies type-checking, e.g. with `getattr`.
458-
if taxon_by is None:
459-
raise ValueError(
460-
f"`taxon_by` cannot be set to `None`. The default would be {frq_params.taxon_by_default!r}."
461-
)
462-
463456
# Load sample metadata.
464457
df_samples = self.sample_metadata(
465458
sample_sets=sample_sets,
@@ -687,15 +680,8 @@ def aa_allele_frequencies_advanced(
687680
ci_method: Optional[frq_params.ci_method] = "wilson",
688681
chunks: base_params.chunks = base_params.native_chunks,
689682
inline_array: base_params.inline_array = base_params.inline_array_default,
690-
taxon_by: Optional[frq_params.taxon_by] = frq_params.taxon_by_default,
683+
taxon_by: frq_params.taxon_by = frq_params.taxon_by_default,
691684
) -> xr.Dataset:
692-
# Check that the taxon_by default hasn't been subverted, e.g. via `taxon_by=None`.
693-
# This also satisfies type-checking, e.g. with `getattr`.
694-
if taxon_by is None:
695-
raise ValueError(
696-
f"`taxon_by` cannot be set to `None`. The default would be {frq_params.taxon_by_default!r}."
697-
)
698-
699685
# Begin by computing SNP allele frequencies.
700686
ds_snp_frq = self.snp_allele_frequencies_advanced(
701687
transcript=transcript,

notebooks/plot_frequencies_space_time.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,14 @@
573573
"source": [
574574
"ag3.plot_frequencies_interactive_map(ds)"
575575
]
576+
},
577+
{
578+
"cell_type": "code",
579+
"execution_count": null,
580+
"id": "d22d6d58",
581+
"metadata": {},
582+
"outputs": [],
583+
"source": []
576584
}
577585
],
578586
"metadata": {

0 commit comments

Comments
 (0)