@@ -226,7 +226,7 @@ def plot_h12_calibration(
226226 else :
227227 return fig
228228
229- def _h12_gwss_contig (
229+ def _h12_gwss (
230230 self ,
231231 contig ,
232232 analysis ,
@@ -279,39 +279,6 @@ def _h12_gwss_contig(
279279
280280 return results
281281
282- def _h12_gwss (
283- self ,
284- contig ,
285- analysis ,
286- window_size ,
287- sample_sets ,
288- sample_query ,
289- sample_query_options ,
290- cohort_size ,
291- min_cohort_size ,
292- max_cohort_size ,
293- random_seed ,
294- chunks ,
295- inline_array ,
296- ):
297- results_tmp = self ._h12_gwss_contig (
298- contig = contig ,
299- analysis = analysis ,
300- window_size = window_size ,
301- sample_query = sample_query ,
302- sample_sets = sample_sets ,
303- sample_query_options = sample_query_options ,
304- cohort_size = cohort_size ,
305- min_cohort_size = min_cohort_size ,
306- max_cohort_size = max_cohort_size ,
307- random_seed = random_seed ,
308- chunks = chunks ,
309- inline_array = inline_array ,
310- )
311- results = dict (x = results_tmp ["x" ], h12 = results_tmp ["h12" ])
312-
313- return results
314-
315282 @check_types
316283 @doc (
317284 summary = "Run h12 genome-wide selection scan." ,
@@ -321,7 +288,7 @@ def _h12_gwss(
321288 contigs = "An array with the contig for each window. The median is chosen for windows overlapping a change of contig." ,
322289 ),
323290 )
324- def h12_gwss_contig (
291+ def h12_gwss (
325292 self ,
326293 contig : base_params .contig ,
327294 window_size : h12_params .window_size ,
@@ -364,9 +331,7 @@ def h12_gwss_contig(
364331 results = self .results_cache_get (name = name , params = params )
365332
366333 except CacheMiss :
367- results = self ._h12_gwss_contig (
368- chunks = chunks , inline_array = inline_array , ** params
369- )
334+ results = self ._h12_gwss (chunks = chunks , inline_array = inline_array , ** params )
370335 self .results_cache_set (name = name , params = params , results = results )
371336
372337 x = results ["x" ]
@@ -375,65 +340,6 @@ def h12_gwss_contig(
375340
376341 return x , h12 , contigs
377342
378- @check_types
379- @doc (
380- summary = "Run h12 genome-wide selection scan." ,
381- returns = dict (
382- x = "An array containing the window centre point genomic positions." ,
383- h12 = "An array with h12 statistic values for each window." ,
384- ),
385- )
386- def h12_gwss (
387- self ,
388- contig : base_params .contig ,
389- window_size : h12_params .window_size ,
390- analysis : hap_params .analysis = base_params .DEFAULT ,
391- sample_query : Optional [base_params .sample_query ] = None ,
392- sample_query_options : Optional [base_params .sample_query_options ] = None ,
393- sample_sets : Optional [base_params .sample_sets ] = None ,
394- cohort_size : Optional [base_params .cohort_size ] = h12_params .cohort_size_default ,
395- min_cohort_size : Optional [
396- base_params .min_cohort_size
397- ] = h12_params .min_cohort_size_default ,
398- max_cohort_size : Optional [
399- base_params .max_cohort_size
400- ] = h12_params .max_cohort_size_default ,
401- random_seed : base_params .random_seed = 42 ,
402- chunks : base_params .chunks = base_params .native_chunks ,
403- inline_array : base_params .inline_array = base_params .inline_array_default ,
404- ) -> Tuple [np .ndarray , np .ndarray ]:
405- # Change this name if you ever change the behaviour of this function, to
406- # invalidate any previously cached data.
407- name = "h12_gwss_v1"
408-
409- params = dict (
410- contig = contig ,
411- analysis = self ._prep_phasing_analysis_param (analysis = analysis ),
412- window_size = window_size ,
413- sample_sets = self ._prep_sample_sets_param (sample_sets = sample_sets ),
414- # N.B., do not be tempted to convert this sample query into integer
415- # indices using _prep_sample_selection_params, because the indices
416- # are different in the haplotype data.
417- sample_query = sample_query ,
418- sample_query_options = sample_query_options ,
419- cohort_size = cohort_size ,
420- min_cohort_size = min_cohort_size ,
421- max_cohort_size = max_cohort_size ,
422- random_seed = random_seed ,
423- )
424-
425- try :
426- results = self .results_cache_get (name = name , params = params )
427-
428- except CacheMiss :
429- results = self ._h12_gwss (chunks = chunks , inline_array = inline_array , ** params )
430- self .results_cache_set (name = name , params = params , results = results )
431-
432- x = results ["x" ]
433- h12 = results ["h12" ]
434-
435- return x , h12
436-
437343 @check_types
438344 @doc (
439345 summary = "Plot h12 GWSS data." ,
@@ -466,7 +372,7 @@ def plot_h12_gwss_track(
466372 inline_array : base_params .inline_array = base_params .inline_array_default ,
467373 ) -> gplt_params .figure :
468374 # Compute H12.
469- x , h12 , contigs = self .h12_gwss_contig (
375+ x , h12 , contigs = self .h12_gwss (
470376 contig = contig ,
471377 analysis = analysis ,
472378 window_size = window_size ,
0 commit comments