Skip to content

Commit

Permalink
retrieve PVE estimate from GEMMA's log
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothée Flutre committed Nov 24, 2017
1 parent 884a5ce commit 74b6f44
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rutilstimflutre
Title: Timothee Flutre's personal R code
Version: 0.152.0
Version: 0.152.1
Authors@R: c(
person("Timothee", "Flutre", email="[email protected]", role=c("aut", "ctb", "cre")),
person("Peter", "Carbonetto", role="aut", comment="function from varbvs example"),
Expand Down
9 changes: 9 additions & 0 deletions R/GEMMA.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ genoDoses2bimbam <- function(X=NULL, tX=NULL, alleles, file=NULL, format="mean")
##' ## test SNPs one by one with the univariate LMM
##' fit.u <- gemma(model="ulmm", y=modelA$Y[,1], X=X, snp.coords, alleles,
##' W=modelA$W, out.dir=tempdir(), clean="all")
##' fit.u$global.mean
##' fit.u$pve
##' cor(modelA$a[modelA$gamma == 1], fit.u$tests$beta[modelA$gamma == 1])
##' cols <- rep("black",ncol(X)); cols[modelA$gamma==1] <- "red"
##' pvadj.AA <- qqplotPval(fit.u$tests$p_wald, col=cols, ctl.fdr.bh=TRUE,
Expand Down Expand Up @@ -302,6 +304,13 @@ gemma <- function(model="ulmm", y, X, snp.coords, alleles=NULL,
output[["global.mean"]] <- c(beta.hat=as.numeric(tmp1[length(tmp1)]),
se.beta.hat=as.numeric(tmp2[length(tmp2)]))
}
idx <- grep("pve estimate in the null model", output[["log"]])
if(length(idx) == 1){
tmp1 <- strsplit(output$log[idx], " ")[[1]]
tmp2 <- strsplit(output$log[idx+1], " ")[[1]]
output[["pve"]] <- c(pve.hat=as.numeric(tmp1[length(tmp1)]),
se.pve.hat=as.numeric(tmp2[length(tmp2)]))
}
if(clean == "all")
file.remove(f)
if(model == "ulmm"){
Expand Down
2 changes: 2 additions & 0 deletions man/gemma.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 74b6f44

Please sign in to comment.