-
Notifications
You must be signed in to change notification settings - Fork 2
GWIS configuration #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joshua-slaughter
wants to merge
19
commits into
main
Choose a base branch
from
gwis
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
GWIS configuration #201
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6a03213
GWIS configuration
joshua-slaughter c9ebfa5
missing true in gwis test file
joshua-slaughter 4019b38
fixing GWIS test string output
joshua-slaughter f21d4d1
Changes from GWIS to GWIES; Updated tests and generalized estimand cr…
joshua-slaughter 1b1a740
Adding unwatched files for testing GWEIS
joshua-slaughter 8d63364
Update CI for actions
joshua-slaughter 5e575f7
correct behavior to do first order interactions iteratively across li…
joshua-slaughter b1ef821
variant mapping file output; gwis is now under gwas functions specifi…
joshua-slaughter 04d2ac5
adding genotype/variant mapping for interpretability of gwas results
joshua-slaughter 02322ab
fix typo
joshua-slaughter 79cb895
Undo premature changes
joshua-slaughter 1c3453f
up manifest
joshua-slaughter 0a4c105
Merge branch 'gwis' of github.com:TARGENE/TargeneCore.jl into gwis
joshua-slaughter 99976c1
Errors in Project.toml
joshua-slaughter e016964
allow duplicate variant names for estimation
joshua-slaughter 4516d04
Merge branch 'gwis' of github.com:TARGENE/TargeneCore.jl into gwis
joshua-slaughter 5ede1f0
Revert "Merge branch 'gwis' of github.com:TARGENE/TargeneCore.jl into…
joshua-slaughter abef210
harmonization of estimands; 0x00 will be encoded as major-major relat…
joshua-slaughter 086ee83
allele orientation fix
joshua-slaughter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
type: gwis | ||
|
||
extra_treatments: | ||
- 22001 | ||
|
||
outcome_extra_covariates: | ||
- COV_1 | ||
|
||
extra_confounders: | ||
- 21003 |
joshua-slaughter marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
module TestGwisEstimands | ||
|
||
using Test | ||
using SnpArrays | ||
using TargeneCore | ||
using Arrow | ||
using DataFrames | ||
using Serialization | ||
using TMLE | ||
using CSV | ||
|
||
TESTDIR = joinpath(pkgdir(TargeneCore), "test") | ||
|
||
include(joinpath(TESTDIR, "testutils.jl")) | ||
|
||
function get_summary_stats(estimands) | ||
outcomes = [TargeneCore.get_outcome(Ψ) for Ψ in estimands] | ||
results = DataFrame(ESTIMAND = estimands, OUTCOME = outcomes) | ||
return sort(combine(groupby(results, :OUTCOME), nrow), :OUTCOME) | ||
end | ||
|
||
function check_estimands_levels_order(estimands) | ||
for Ψ in estimands | ||
# If the two components are present, the first is the 0 -> 1 and the second is the 1 -> 2 | ||
variant = collect(keys(Ψ.args[1].treatment_values))[2] | ||
if length(Ψ.args) == 2 | ||
@test Ψ.args[1].treatment_values[variant] == (control = 0x00, case = 0x01) | ||
@test Ψ.args[2].treatment_values[variant] == (control = 0x01, case = 0x02) | ||
else | ||
# Otherwise we check they are one or the other | ||
arg = only(Ψ.args) | ||
@test arg.treatment_values[variant]==(control = 0x00, case = 0x01) || | ||
arg.treatment_values[variant]==( control = 0x01, case = 0x02) | ||
end | ||
end | ||
end | ||
|
||
@testset "Test inputs_from_config gwis: no positivity constraint" begin | ||
tmpdir = mktempdir() | ||
copy!(ARGS, [ | ||
"estimation-inputs", | ||
joinpath(TESTDIR, "data", "config_gwis.yaml"), | ||
string("--traits-file=", joinpath(TESTDIR, "data", "ukbb_traits.csv")), | ||
string("--pcs-file=", joinpath(TESTDIR, "data", "ukbb_pcs.csv")), | ||
string("--genotypes-prefix=", joinpath(TESTDIR, "data", "ukbb", "genotypes" , "ukbb_1.")), | ||
string("--outprefix=", joinpath(tmpdir, "final")), | ||
"--batchsize=5", | ||
"--verbosity=0", | ||
"--positivity-constraint=0" | ||
]) | ||
TargeneCore.julia_main() | ||
# Check dataset | ||
dataset = DataFrame(Arrow.Table(joinpath(tmpdir, "final.data.arrow"))) | ||
@test size(dataset) == (1940, 886) | ||
|
||
# Check estimands | ||
estimands = [] | ||
for file in readdir(tmpdir, join=true) | ||
if endswith(file, "jls") | ||
append!(estimands, deserialize(file).estimands) | ||
end | ||
end | ||
@test all(e isa JointEstimand for e in estimands) | ||
|
||
# There are 875 variants in the dataset | ||
summary_stats = get_summary_stats(estimands) | ||
@test summary_stats == DataFrame( | ||
OUTCOME = [:BINARY_1, :BINARY_2, :CONTINUOUS_1, :CONTINUOUS_2, :TREAT_1], | ||
nrow = repeat([875], 5) | ||
) | ||
|
||
check_estimands_levels_order(estimands) | ||
end | ||
|
||
|
||
@testset "Test inputs_from_config gwis: positivity constraint" begin | ||
tmpdir = mktempdir() | ||
copy!(ARGS, [ | ||
"estimation-inputs", | ||
joinpath(TESTDIR, "data", "config_gwis.yaml"), | ||
string("--traits-file=", joinpath(TESTDIR, "data", "ukbb_traits.csv")), | ||
string("--pcs-file=", joinpath(TESTDIR, "data", "ukbb_pcs.csv")), | ||
string("--genotypes-prefix=", joinpath(TESTDIR, "data", "ukbb", "genotypes" , "ukbb_1.")), | ||
string("--outprefix=", joinpath(tmpdir, "final")), | ||
"--batchsize=5", | ||
"--verbosity=0", | ||
"--positivity-constraint=0.2" | ||
]) | ||
TargeneCore.julia_main() | ||
# Check dataset | ||
dataset = DataFrame(Arrow.Table(joinpath(tmpdir, "final.data.arrow"))) | ||
@test size(dataset) == (1940, 886) | ||
# Check estimands | ||
estimands = [] | ||
for file in readdir(tmpdir, join=true) | ||
if endswith(file, "jls") | ||
append!(estimands, deserialize(file).estimands) | ||
end | ||
end | ||
# The positivity constraint reduces the number of variants | ||
@test all(e isa JointEstimand for e in estimands) | ||
summary_stats = get_summary_stats(estimands) | ||
@test summary_stats == DataFrame( | ||
OUTCOME = [:BINARY_1, :BINARY_2, :CONTINUOUS_1, :CONTINUOUS_2, :TREAT_1], | ||
nrow = repeat([142], 5) | ||
) | ||
|
||
check_estimands_levels_order(estimands) | ||
end | ||
|
||
|
||
end | ||
true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.