Skip to content

Commit 372c797

Browse files
committed
save SNP pos/chr/id/ref/alt in output file and also remove tmp file during init
1 parent b93b778 commit 372c797

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/MendelIHT.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ module MendelIHT
5454
# force Julia to precompile some common functions (only Gaussian case are handled here)
5555
function __init__()
5656
dir = normpath(MendelIHT.datadir())
57-
cross_validate(joinpath(dir, "normal"), Normal, verbose=false)
58-
cross_validate(joinpath(dir, "multivariate"), MvNormal, phenotypes=[6, 7], verbose=false)
57+
cross_validate(joinpath(dir, "normal"), Normal, verbose=false, cv_summaryfile="_tmp_init_cv_file_.txt")
58+
cross_validate(joinpath(dir, "multivariate"), MvNormal, phenotypes=[6, 7], verbose=false, cv_summaryfile="_tmp_init_cv_file_.txt")
59+
rm("_tmp_init_cv_file_.txt", force=true)
5960
end
6061

6162
end # end module

src/wrapper.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,21 @@ function iht(
8585

8686
show(io, result)
8787

88+
# save estimated beta to disk
8889
if is_multivariate(y)
8990
open(betafile, "w") do io
90-
print(io, "SNPid")
91+
print(io, "chr\tpos\tSNPid\tref\talt")
9192
for i in 1:size(y, 1)
9293
print(io, '\t', "beta_$i")
9394
end
9495
print(io, '\n')
95-
writedlm(io, [X_ids result.beta'])
96+
writedlm(io, [X_chr X_pos X_ids X_ref X_alt result.beta'])
9697
end
97-
# writedlm(betafile, DataFrame([X_ids result.beta'], ["SNPid", "Estimated_beta"]))
9898
writedlm(covariancefile, result.Σ)
9999
else
100100
open(betafile, "w") do io
101-
println(io, "SNPid", '\t', "Estimated_beta")
102-
writedlm(io, [X_ids result.beta])
101+
println(io, "chr\tpos\tSNPid\tref\talt\tEstimated_beta")
102+
writedlm(io, [X_chr X_pos X_ids X_ref X_alt result.beta])
103103
end
104104
end
105105

0 commit comments

Comments
 (0)