Skip to content

Commit

Permalink
save SNP pos/chr/id/ref/alt in output file and also remove tmp file d…
Browse files Browse the repository at this point in the history
…uring init
  • Loading branch information
biona001 committed Feb 17, 2022
1 parent b93b778 commit 372c797
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/MendelIHT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions src/wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

2 comments on commit 372c797

@biona001
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/54860

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.4.5 -m "<description of version>" 372c797deefc7c836234c262d2d9e25d3f28d5dc
git push origin v1.4.5

Please sign in to comment.