Vote count:
0
Recently, I wrote a small R script run_QTL.R and ran it like this:
R --slave --args 1 500 <run_QTL.R &
The content of run_QTL.R:
Args <- commandArgs(TRUE)
k.low <- as.numeric(Args[1])
k.high <- as.numeric(Args[2])
load("rqtl.usedata.RData")
source("eqtl20130521.R")
library(qtl)
qtl.res <- sapply(i<-k.low:k.high, function(x) {
cim.x <- cim(data, n.marcovar=2, method="hk", pheno.col=x, window=2)
eqtl.tmp <- eqtl(cim.x, 1, 4)
if (length(eqtl.tmp) >= 1) {
res.tmp <- calc.eff(data,eqtl.tmp, x)
trait.names <- colnames(data$pheno)[x]
res <- cbind(trait.names,res.tmp)
res <- data.frame(res, stringsAsFactors=FALSE)
tmp.per <- cim(data, n.marcovar=2, method="hk", pheno.col=x, window=2, n.perm=1000)
res$cut <- as.numeric(summary(tmp.per, alpha=c(0.05)))
return(res)
} else {
return(NULL)
}
})
out.fl <- paste("sqtl", k.low, k.high, sep=".")
out.fl <- paste(out.fl, ".RData", sep="")
save(qtl.res, file=out.fl)
Since it may take a long time to finish. So I am wondering if I can interrupt the command:
R --slave --args 1 500 <run_QTL.R &
and get the result that had been partially finished (the content of the variable "qtl.res", probably in the memory). I am wondering if there are any black magic to make this in R?
Thanks!
asked 50 secs ago
How to interrupt "R --slave --args" and get temp result?
Aucun commentaire:
Enregistrer un commentaire