File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -447,6 +447,11 @@ def gene_cnv_frequencies_advanced(
447447 inline_array : base_params .inline_array = base_params .inline_array_default ,
448448 taxon_by : Optional [frq_params .taxon_by ] = frq_params .taxon_by_default ,
449449 ) -> xr .Dataset :
450+ # Check that the taxon_by default hasn't been subverted.
451+ # This avoids type-checking errors, e.g. with `getattr`.
452+ if taxon_by is None :
453+ raise ValueError ("`taxon_by` cannot be set to `None`." )
454+
450455 regions : List [Region ] = parse_multi_region (self , region )
451456 del region
452457
Original file line number Diff line number Diff line change @@ -155,6 +155,11 @@ def haplotypes_frequencies_advanced(
155155 inline_array : base_params .inline_array = base_params .inline_array_default ,
156156 taxon_by : Optional [frq_params .taxon_by ] = frq_params .taxon_by_default ,
157157 ) -> xr .Dataset :
158+ # Check that the taxon_by default hasn't been subverted.
159+ # This avoids type-checking errors, e.g. with `getattr`.
160+ if taxon_by is None :
161+ raise ValueError ("`taxon_by` cannot be set to `None`." )
162+
158163 # Load sample metadata.
159164 df_samples = self .sample_metadata (
160165 sample_sets = sample_sets ,
Original file line number Diff line number Diff line change @@ -453,6 +453,11 @@ def snp_allele_frequencies_advanced(
453453 inline_array : base_params .inline_array = base_params .inline_array_default ,
454454 taxon_by : Optional [frq_params .taxon_by ] = frq_params .taxon_by_default ,
455455 ) -> xr .Dataset :
456+ # Check that the taxon_by default hasn't been subverted.
457+ # This avoids type-checking errors, e.g. with `getattr`.
458+ if taxon_by is None :
459+ raise ValueError ("`taxon_by` cannot be set to `None`." )
460+
456461 # Load sample metadata.
457462 df_samples = self .sample_metadata (
458463 sample_sets = sample_sets ,
@@ -680,8 +685,13 @@ def aa_allele_frequencies_advanced(
680685 ci_method : Optional [frq_params .ci_method ] = "wilson" ,
681686 chunks : base_params .chunks = base_params .native_chunks ,
682687 inline_array : base_params .inline_array = base_params .inline_array_default ,
683- taxon_by : frq_params .taxon_by = frq_params .taxon_by_default ,
688+ taxon_by : Optional [ frq_params .taxon_by ] = frq_params .taxon_by_default ,
684689 ) -> xr .Dataset :
690+ # Check that the taxon_by default hasn't been subverted.
691+ # This avoids type-checking errors, e.g. with `getattr`.
692+ if taxon_by is None :
693+ raise ValueError ("`taxon_by` cannot be set to `None`." )
694+
685695 # Begin by computing SNP allele frequencies.
686696 ds_snp_frq = self .snp_allele_frequencies_advanced (
687697 transcript = transcript ,
You can’t perform that action at this time.
0 commit comments