@@ -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
+
61
+ # Define SNP information to check string allele defintions
62
+ snpdata = read_bed_chromosome (joinpath (TESTDIR, " data" , " ukbb" , " genotypes" , " ukbb_1." ))
63
+ snp_info = select (DataFrame (snpdata. snp_info), [:snpid , :allele1 , :allele2 ])
51
64
# Check dataset
52
65
dataset = DataFrame (Arrow. Table (joinpath (tmpdir, " final.data.arrow" )))
53
66
@test size (dataset) == (1940 , 886 )
68
81
nrow = repeat ([875 ], 5 )
69
82
)
70
83
71
- check_estimands_levels_order (estimands)
84
+ check_estimands_levels_order (estimands, snp_info )
72
85
end
73
86
74
87
@testset " Test inputs_from_config gwas: positivity constraint" begin
0 commit comments