@@ -58,7 +58,11 @@ def phasing_analysis_ids(self) -> Tuple[str, ...]:
5858 def _prep_phasing_analysis_param (self , * , analysis : hap_params .analysis ) -> str :
5959 if analysis == base_params .DEFAULT :
6060 # Use whatever is the default phasing analysis for this data resource.
61- assert self ._default_phasing_analysis is not None
61+ if self ._default_phasing_analysis is None :
62+ raise RuntimeError (
63+ "No default phasing analysis configured. "
64+ "Please specify the 'analysis' parameter explicitly."
65+ )
6266 return self ._default_phasing_analysis
6367 elif analysis in self .phasing_analysis_ids :
6468 return analysis
@@ -118,7 +122,11 @@ def _haplotype_sites_for_contig(
118122
119123 # Handle contig in the reference genome.
120124 else :
121- assert contig in self .contigs
125+ if contig not in self .contigs :
126+ raise ValueError (
127+ f"Contig { contig !r} not found. "
128+ f"Available contigs: { self .contigs } "
129+ )
122130 root = self .open_haplotype_sites (analysis = analysis )
123131 z = root [f"{ contig } /variants/{ field } " ]
124132 ret = _da_from_zarr (z , inline_array = inline_array , chunks = chunks )
@@ -251,7 +259,11 @@ def _haplotypes_for_contig(
251259
252260 # Handle contig in the reference genome.
253261 else :
254- assert contig in self .contigs
262+ if contig not in self .contigs :
263+ raise ValueError (
264+ f"Contig { contig !r} not found. "
265+ f"Available contigs: { self .contigs } "
266+ )
255267
256268 # Open haplotypes zarr.
257269 root = self .open_haplotypes (sample_set = sample_set , analysis = analysis )
0 commit comments