@@ -19,18 +19,27 @@ function get_summary_stats(estimands)
19
19
return sort (combine (groupby (results, :OUTCOME ), nrow), :OUTCOME )
20
20
end
21
21
22
- function check_estimands_levels_order (estimands)
22
+ function check_estimands_levels_order (estimands, snp_info )
23
23
for Ψ in estimands
24
24
# If the two components are present, the first is the 0 -> 1 and the second is the 1 -> 2
25
25
variant = only (keys (Ψ. args[1 ]. treatment_values))
26
+ variant_info = filter (:snpid => x-> x== String (variant),snp_info)
27
+ allele1, allele2 = variant_info. allele1[1 ], variant_info. allele2[1 ]
28
+
29
+ # Here, we check if the order is sufficient to be able to compute non-linear effects any of these combinations will do
26
30
if length (Ψ. args) == 2
27
- @test Ψ. args[1 ]. treatment_values[variant] == (control = 0x00 , case = 0x01 )
28
- @test Ψ. args[2 ]. treatment_values[variant] == (control = 0x01 , case = 0x02 )
31
+ @test (Ψ. args[1 ]. treatment_values[variant] == (control = allele1* allele1, case = allele1* allele2) &&
32
+ Ψ. args[2 ]. treatment_values[variant] == (control = allele1* allele2, case = allele2* allele2)) ||
33
+ (Ψ. args[1 ]. treatment_values[variant] == (control = allele2* allele2, case = allele1* allele2) &&
34
+ Ψ. args[2 ]. treatment_values[variant] == (control = allele1* allele2, case = allele1* allele1))
29
35
else
30
36
# Otherwise we check they are one or the other
31
37
arg = only (Ψ. args)
32
- @test arg. treatment_values[variant]== (control = 0x00 , case = 0x01 ) ||
33
- arg. treatment_values[variant]== ( control = 0x01 , case = 0x02 )
38
+ @test arg. treatment_values[variant] == (control = allele1* allele1, case = allele1* allele2) ||
39
+ arg. treatment_values[variant] == (control = allele2* allele2, case = allele1* allele2) ||
40
+ arg. treatment_values[variant] == (control = allele1* allele2, case = allele2* allele2) ||
41
+ arg. treatment_values[variant] == (control = allele1* allele2, case = allele1* allele1)
42
+
34
43
end
35
44
end
36
45
end
48
57
" --positivity-constraint=0"
49
58
])
50
59
TargeneCore. julia_main ()
60
+ # Define SNP information to check string allele defintions
61
+ snpdata = read_bed_chromosome (joinpath (TESTDIR, " data" , " ukbb" , " genotypes" , " ukbb_1." ))
62
+ snp_info = select (DataFrame (snpdata. snp_info), [:snpid , :allele1 , :allele2 ])
51
63
# Check dataset
52
64
dataset = DataFrame (Arrow. Table (joinpath (tmpdir, " final.data.arrow" )))
53
65
@test size (dataset) == (1940 , 886 )
68
80
nrow = repeat ([875 ], 5 )
69
81
)
70
82
71
- check_estimands_levels_order (estimands)
83
+ check_estimands_levels_order (estimands, snp_info )
72
84
end
73
85
74
86
@testset " Test inputs_from_config gwas: positivity constraint" begin
85
97
" --positivity-constraint=0.2"
86
98
])
87
99
TargeneCore. julia_main ()
100
+ # Define SNP information to check string allele defintions
101
+ snpdata = read_bed_chromosome (joinpath (TESTDIR, " data" , " ukbb" , " genotypes" , " ukbb_1." ))
102
+ snp_info = select (DataFrame (snpdata. snp_info), [:snpid , :allele1 , :allele2 ])
88
103
# Check dataset
89
104
dataset = DataFrame (Arrow. Table (joinpath (tmpdir, " final.data.arrow" )))
90
105
@test size (dataset) == (1940 , 886 )
103
118
nrow = repeat ([777 ], 5 )
104
119
)
105
120
106
- check_estimands_levels_order (estimands)
121
+ check_estimands_levels_order (estimands, snp_info )
107
122
end
108
123
109
124
end
0 commit comments