5
5
6
6
import hail as hl
7
7
import hail .utils as utils
8
- from ...helpers import get_dataset , test_timeout , qobtest
8
+ from ...helpers import test_timeout , qobtest
9
9
10
10
11
- def plinkify (ds , min = None , max = None ):
11
+ @pytest .fixture (scope = 'module' )
12
+ def ds ():
13
+ dataset = hl .balding_nichols_model (1 , 100 , 100 )
14
+ dataset = dataset .key_cols_by (s = hl .str (dataset .sample_idx + 1 ))
15
+ return dataset
16
+
17
+
18
+ def plinkify (dataset , min = None , max = None ):
12
19
vcf = utils .new_temp_file (prefix = "plink" , extension = "vcf" )
13
- hl .export_vcf (ds , vcf )
20
+ hl .export_vcf (dataset , vcf )
14
21
15
22
local_tmpdir = utils .new_local_temp_dir ()
16
23
plinkpath = f'{ local_tmpdir } /plink-ibd'
@@ -45,9 +52,7 @@ def plinkify(ds, min=None, max=None):
45
52
@qobtest
46
53
@unittest .skipIf ('HAIL_TEST_SKIP_PLINK' in os .environ , 'Skipping tests requiring plink' )
47
54
@test_timeout (local = 10 * 60 , batch = 10 * 60 )
48
- def test_ibd_default_arguments ():
49
- ds = get_dataset ()
50
-
55
+ def test_ibd_default_arguments (ds ):
51
56
plink_results = plinkify (ds )
52
57
hail_results = hl .identity_by_descent (ds ).collect ()
53
58
@@ -62,11 +67,10 @@ def test_ibd_default_arguments():
62
67
assert plink_results [key ][1 ][2 ] == row .ibs2
63
68
64
69
70
+ @qobtest
65
71
@unittest .skipIf ('HAIL_TEST_SKIP_PLINK' in os .environ , 'Skipping tests requiring plink' )
66
72
@test_timeout (local = 10 * 60 , batch = 10 * 60 )
67
- def test_ibd_0_and_1 ():
68
- ds = get_dataset ()
69
-
73
+ def test_ibd_0_and_1 (ds ):
70
74
plink_results = plinkify (ds , min = 0.0 , max = 1.0 )
71
75
hail_results = hl .identity_by_descent (ds ).collect ()
72
76
@@ -81,15 +85,15 @@ def test_ibd_0_and_1():
81
85
assert plink_results [key ][1 ][2 ] == row .ibs2
82
86
83
87
88
+ @qobtest
84
89
@test_timeout (local = 10 * 60 , batch = 10 * 60 )
85
- def test_ibd_does_not_error_with_dummy_maf_float64 ():
86
- dataset = get_dataset ()
87
- dataset = dataset .annotate_rows (dummy_maf = 0.01 )
88
- hl .identity_by_descent (dataset , dataset ['dummy_maf' ], min = 0.0 , max = 1.0 )
90
+ def test_ibd_does_not_error_with_dummy_maf_float64 (ds ):
91
+ ds = ds .annotate_rows (dummy_maf = 0.01 )
92
+ hl .identity_by_descent (ds , ds ['dummy_maf' ], min = 0.0 , max = 1.0 )
89
93
90
94
95
+ @qobtest
91
96
@test_timeout (local = 10 * 60 , batch = 10 * 60 )
92
- def test_ibd_does_not_error_with_dummy_maf_float32 ():
93
- dataset = get_dataset ()
94
- dataset = dataset .annotate_rows (dummy_maf = 0.01 )
95
- hl .identity_by_descent (dataset , hl .float32 (dataset ['dummy_maf' ]), min = 0.0 , max = 1.0 )
97
+ def test_ibd_does_not_error_with_dummy_maf_float32 (ds ):
98
+ ds = ds .annotate_rows (dummy_maf = 0.01 )
99
+ hl .identity_by_descent (ds , hl .float32 (ds ['dummy_maf' ]), min = 0.0 , max = 1.0 )
0 commit comments