@@ -20,7 +20,7 @@ function get_summary_stats(estimands)
20
20
return sort (combine (groupby (results, :OUTCOME ), nrow), :OUTCOME )
21
21
end
22
22
23
- function check_estimands_levels_interactions (estimands)
23
+ function check_estimands_levels_interactions (estimands, snp_info )
24
24
extra_treatments = YAML. load_file (joinpath (TESTDIR, " data" , " config_gweis_first_order.yaml" ))[" extra_treatments" ]
25
25
for (i,x) in enumerate (extra_treatments)
26
26
extra_treatments[i]= Symbol (x)
@@ -31,18 +31,27 @@ function check_estimands_levels_interactions(estimands)
31
31
# The variant should always be the last key
32
32
treatment_set = collect (keys (Ψ. args[1 ]. treatment_values))
33
33
variant = setdiff (treatment_set, extra_treatments)[1 ]
34
+ variant_info = filter (:snpid => x-> x== String (variant),snp_info)
35
+ allele1, allele2 = variant_info. allele1[1 ], variant_info. allele2[1 ]
36
+ # Here, we check if the order is sufficient to be able to compute non-linear effects any of these combinations will do
34
37
if length (Ψ. args) == 2
35
- @test Ψ. args[1 ]. treatment_values[variant] == (control = 0x00 , case = 0x01 )
36
- @test Ψ. args[2 ]. treatment_values[variant] == (control = 0x01 , case = 0x02 )
38
+ @test (Ψ. args[1 ]. treatment_values[variant] == (control = allele1* allele1, case = allele1* allele2) &&
39
+ Ψ. args[2 ]. treatment_values[variant] == (control = allele1* allele2, case = allele2* allele2)) ||
40
+ (Ψ. args[1 ]. treatment_values[variant] == (control = allele2* allele2, case = allele1* allele2) &&
41
+ Ψ. args[2 ]. treatment_values[variant] == (control = allele1* allele2, case = allele1* allele1))
37
42
else
38
43
# Otherwise we check they are one or the other
39
44
arg = only (Ψ. args)
40
- @test arg. treatment_values[variant]== (control = 0x00 , case = 0x01 ) ||
41
- arg. treatment_values[variant]== ( control = 0x01 , case = 0x02 )
45
+ @test arg. treatment_values[variant] == (control = allele1* allele1, case = allele1* allele2) ||
46
+ arg. treatment_values[variant] == (control = allele2* allele2, case = allele1* allele2) ||
47
+ arg. treatment_values[variant] == (control = allele1* allele2, case = allele2* allele2) ||
48
+ arg. treatment_values[variant] == (control = allele1* allele2, case = allele1* allele1)
49
+
42
50
end
43
51
end
44
52
end
45
53
54
+
46
55
@testset " Test inputs_from_config gweis: no positivity constraint" begin
47
56
tmpdir = mktempdir ()
48
57
copy! (ARGS , [
76
85
OUTCOME = [:BINARY_1 , :BINARY_2 , :CONTINUOUS_1 , :CONTINUOUS_2 ],
77
86
nrow = repeat ([2625 ], 4 )
78
87
)
79
- println (estimands[1 ])
80
- check_estimands_levels_interactions (estimands)
88
+ # Define SNP information to check string allele defintions
89
+ snpdata = read_bed_chromosome (joinpath (TESTDIR, " data" , " ukbb" , " genotypes" , " ukbb_1." ))
90
+ snp_info = select (DataFrame (snpdata. snp_info), [:snpid , :allele1 , :allele2 ])
91
+
92
+ check_estimands_levels_interactions (estimands, snp_info)
81
93
end
82
94
83
95
113
125
nrow = repeat ([430 ], 4 )
114
126
)
115
127
116
- check_estimands_levels_interactions (estimands)
128
+ # Define SNP information to check string allele defintions
129
+ snpdata = read_bed_chromosome (joinpath (TESTDIR, " data" , " ukbb" , " genotypes" , " ukbb_1." ))
130
+ snp_info = select (DataFrame (snpdata. snp_info), [:snpid , :allele1 , :allele2 ])
131
+
132
+ check_estimands_levels_interactions (estimands, snp_info)
117
133
end
118
134
119
135
0 commit comments