Commit dd327fff authored by Rauschenberger's avatar Rauschenberger
Browse files

automation

parent dd7ffffe
......@@ -874,16 +874,20 @@ test.multiple <- function(Y,X,map,rho=c(0,0.5,1),spec=4){
if(max != sum(steps)){stop("Invalid combination?",call.=FALSE)}
# parallel computation
type <- ifelse(test=.Platform$OS.type=="windows",yes="PSOCK",no="FORK")
cluster <- parallel::makeCluster(spec=spec,type=type)
parallel::clusterSetRNGStream(cl=cluster,iseed=1)
#parallel::clusterExport(cl=cluster,varlist=c("Y","X","map","limit","steps","rho"),envir=environment())
start <- Sys.time()
parallel::clusterEvalQ(cl=cluster,library(spliceQTL))
pvalue <- parallel::parLapply(cl=cluster,X=seq_len(p),fun=function(i) test.single(Y=Y,X=X,map=map,i=i,limit=limit,steps=steps,rho=rho))
end <- Sys.time()
parallel::stopCluster(cluster)
rm(cluster)
#type <- ifelse(test=.Platform$OS.type=="windows",yes="PSOCK",no="FORK")
#cluster <- parallel::makeCluster(spec=spec,type=type)
#parallel::clusterSetRNGStream(cl=cluster,iseed=1)
##parallel::clusterExport(cl=cluster,varlist=c("Y","X","map","limit","steps","rho"),envir=environment())
#start <- Sys.time()
#parallel::clusterEvalQ(cl=cluster,library(spliceQTL))
#pvalue <- parallel::parLapply(cl=cluster,X=seq_len(p),fun=function(i) test.single(Y=Y,X=X,map=map,i=i,limit=limit,steps=steps,rho=rho))
#end <- Sys.time()
#parallel::stopCluster(cluster)
#rm(cluster)
#pvalue <- parallel::mclapply(X=seq_len(p),FUN=function(i) test.single(Y=Y,X=X,map=map,i=i,limit=limit,steps=steps,rho=rho))
pvalue <- lapply(X=seq_len(p),FUN=function(i) test.single(Y=Y,X=X,map=map,i=i,limit=limit,steps=steps,rho=rho))
# tyding up
pvalue <- do.call(what=rbind,args=pvalue)
......
......@@ -154,12 +154,13 @@
<a class="sourceLine" id="cb4-44" data-line-number="44"> </a>
<a class="sourceLine" id="cb4-45" data-line-number="45"> <span class="kw">cat</span>(<span class="st">"Testing:"</span>,<span class="kw">as.character</span>(<span class="kw">Sys.time</span>()),<span class="st">" -&gt; "</span>)</a>
<a class="sourceLine" id="cb4-46" data-line-number="46"> <span class="kw">rm</span>(<span class="dt">list=</span><span class="kw">setdiff</span>(<span class="kw">ls</span>(),<span class="kw">c</span>(<span class="st">"exons"</span>,<span class="st">"snps"</span>,<span class="st">"map"</span>,<span class="st">"data"</span>,<span class="st">"chr"</span>))); <span class="kw">gc</span>()</a>
<a class="sourceLine" id="cb4-47" data-line-number="47"> pvalue &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/test.multiple">test.multiple</a></span>(<span class="dt">Y=</span>exons,<span class="dt">X=</span>snps,<span class="dt">map=</span>map,<span class="dt">rho=</span><span class="kw">c</span>(<span class="dv">0</span>,<span class="fl">0.5</span>),<span class="dt">spec=</span><span class="dv">1</span>)</a>
<a class="sourceLine" id="cb4-48" data-line-number="48"> <span class="kw">cat</span>(<span class="kw">as.character</span>(<span class="kw">Sys.time</span>()),<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-49" data-line-number="49"> </a>
<a class="sourceLine" id="cb4-50" data-line-number="50"> <span class="kw">save</span>(<span class="dt">object=</span>pvalue,<span class="dt">file=</span><span class="kw">file.path</span>(path,<span class="kw">paste0</span>(<span class="st">"pval."</span>,data,<span class="st">".chr"</span>,chr,<span class="st">".RData"</span>)))</a>
<a class="sourceLine" id="cb4-51" data-line-number="51"> }</a>
<a class="sourceLine" id="cb4-52" data-line-number="52">}</a></code></pre></div>
<a class="sourceLine" id="cb4-47" data-line-number="47"> pvalue &lt;-<span class="st"> </span><span class="kw"><a href="../reference/test.multiple.html">test.multiple</a></span>(<span class="dt">Y=</span>exons,<span class="dt">X=</span>snps,<span class="dt">map=</span>map,<span class="dt">rho=</span><span class="kw">c</span>(<span class="dv">0</span>,<span class="fl">0.5</span>))</a>
<a class="sourceLine" id="cb4-48" data-line-number="48"> pvalue &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/test.multiple">test.multiple</a></span>(<span class="dt">Y=</span>exons,<span class="dt">X=</span>snps,<span class="dt">map=</span>map,<span class="dt">rho=</span><span class="kw">c</span>(<span class="dv">0</span>,<span class="fl">0.5</span>),<span class="dt">spec=</span><span class="dv">1</span>)</a>
<a class="sourceLine" id="cb4-49" data-line-number="49"> <span class="kw">cat</span>(<span class="kw">as.character</span>(<span class="kw">Sys.time</span>()),<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-50" data-line-number="50"> </a>
<a class="sourceLine" id="cb4-51" data-line-number="51"> <span class="kw">save</span>(<span class="dt">object=</span>pvalue,<span class="dt">file=</span><span class="kw">file.path</span>(path,<span class="kw">paste0</span>(<span class="st">"pval."</span>,data,<span class="st">".chr"</span>,chr,<span class="st">".RData"</span>)))</a>
<a class="sourceLine" id="cb4-52" data-line-number="52"> }</a>
<a class="sourceLine" id="cb4-53" data-line-number="53">}</a></code></pre></div>
<p>On the virtual machine, execute this chunk to compare the results between the Geuvadis and the BBMRI project.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1">cor &lt;-<span class="st"> </span>chisq &lt;-<span class="st"> </span><span class="kw">rep</span>(<span class="ot">NA</span>,<span class="dt">length=</span><span class="dv">22</span>)</a>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="cf">for</span>(chr <span class="cf">in</span> <span class="dv">1</span><span class="op">:</span><span class="dv">22</span>){</a>
......
......@@ -86,6 +86,7 @@ for(chr in 1:22){
cat("Testing:",as.character(Sys.time())," -> ")
rm(list=setdiff(ls(),c("exons","snps","map","data","chr"))); gc()
pvalue <- test.multiple(Y=exons,X=snps,map=map,rho=c(0,0.5))
pvalue <- spliceQTL::test.multiple(Y=exons,X=snps,map=map,rho=c(0,0.5),spec=1)
cat(as.character(Sys.time()),"\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment