diff --git a/src/MendelIHT.jl b/src/MendelIHT.jl index 7abe3624..f8cc3d0e 100644 --- a/src/MendelIHT.jl +++ b/src/MendelIHT.jl @@ -54,8 +54,9 @@ module MendelIHT # force Julia to precompile some common functions (only Gaussian case are handled here) function __init__() dir = normpath(MendelIHT.datadir()) - cross_validate(joinpath(dir, "normal"), Normal, verbose=false) - cross_validate(joinpath(dir, "multivariate"), MvNormal, phenotypes=[6, 7], verbose=false) + cross_validate(joinpath(dir, "normal"), Normal, verbose=false, cv_summaryfile="_tmp_init_cv_file_.txt") + cross_validate(joinpath(dir, "multivariate"), MvNormal, phenotypes=[6, 7], verbose=false, cv_summaryfile="_tmp_init_cv_file_.txt") + rm("_tmp_init_cv_file_.txt", force=true) end end # end module diff --git a/src/wrapper.jl b/src/wrapper.jl index 9b5823d0..69a52a14 100644 --- a/src/wrapper.jl +++ b/src/wrapper.jl @@ -85,21 +85,21 @@ function iht( show(io, result) + # save estimated beta to disk if is_multivariate(y) open(betafile, "w") do io - print(io, "SNPid") + print(io, "chr\tpos\tSNPid\tref\talt") for i in 1:size(y, 1) print(io, '\t', "beta_$i") end print(io, '\n') - writedlm(io, [X_ids result.beta']) + writedlm(io, [X_chr X_pos X_ids X_ref X_alt result.beta']) end - # writedlm(betafile, DataFrame([X_ids result.beta'], ["SNPid", "Estimated_beta"])) writedlm(covariancefile, result.Σ) else open(betafile, "w") do io - println(io, "SNPid", '\t', "Estimated_beta") - writedlm(io, [X_ids result.beta]) + println(io, "chr\tpos\tSNPid\tref\talt\tEstimated_beta") + writedlm(io, [X_chr X_pos X_ids X_ref X_alt result.beta]) end end