Commit c31632d1 authored by Rauschenberger's avatar Rauschenberger
Browse files

automation

parent a294a69f
......@@ -54,7 +54,8 @@ NULL
#' chromosome: integer \eqn{1-22}
#'
#' @param data
#' local directory for VCF (variant call format) and SDRF (sample and data relationship format) files
#' local directory for VCF (variant call format)
#' and SDRF (sample and data relationship format) files
#'
#' @param path
#' local directory for output
......@@ -731,10 +732,10 @@ drop.trivial <- function(map){
#' @export
#' @title
#' Conduct single tests
#' Conduct single test
#'
#' @description
#' This function
#' This function tests for alternative splicing.
#'
#' @param Y
#' exon expression\strong{:}
......@@ -853,7 +854,7 @@ test.single <- function(Y,X,map,i,limit=NULL,steps=NULL,rho=c(0,0.5,1)){
#' Conduct multiple tests
#'
#' @description
#' This function ...
#' This function tests for alternative splicing.
#'
#' @param Y
#' exon expression\strong{:}
......@@ -908,13 +909,13 @@ test.multiple <- function(Y,X,map,rho=c(0,0.5,1),spec=1){
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)
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))
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))
#pvalue <- parallel::parLapply(cl=cluster,X=seq_len(p),fun=function(i) test.trial(y=Y[,map$exons[[i]],drop=FALSE],x=X[,seq(from=map$snps$from[i],to=map$snps$to[i],by=1),drop=FALSE],limit=limit,steps=steps,rho=rho))
#end <- Sys.time()
#parallel::stopCluster(cluster)
......@@ -924,7 +925,7 @@ test.multiple <- function(Y,X,map,rho=c(0,0.5,1),spec=1){
#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))
## sequential computation
pvalue <- lapply(X=seq_len(p),FUN=function(i) spliceQTL::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) spliceQTL::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)
......
......@@ -112,7 +112,7 @@
<a class="sourceLine" id="cb4-2" data-line-number="2"> <span class="cf">for</span>(data <span class="cf">in</span> <span class="kw">c</span>(<span class="st">"Geuvadis"</span>,<span class="st">"LLS"</span>)){</a>
<a class="sourceLine" id="cb4-3" data-line-number="3"> <span class="kw">set.seed</span>(<span class="dv">1</span>)</a>
<a class="sourceLine" id="cb4-4" data-line-number="4"> </a>
<a class="sourceLine" id="cb4-5" data-line-number="5"> <span class="kw">cat</span>(<span class="st">"Analysing"</span>,data,<span class="st">"data:"</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-5" data-line-number="5"> <span class="kw">cat</span>(<span class="st">"Analysing"</span>,data,chr,<span class="st">":"</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-6" data-line-number="6"> <span class="cf">if</span>(data<span class="op">==</span><span class="st">"Geuvadis"</span>){</a>
<a class="sourceLine" id="cb4-7" data-line-number="7"> <span class="kw">load</span>(<span class="kw">file.path</span>(path,<span class="st">"Geuvadis.exons.RData"</span>),<span class="dt">verbose=</span><span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb4-8" data-line-number="8"> } <span class="cf">else</span> {</a>
......@@ -120,47 +120,48 @@
<a class="sourceLine" id="cb4-10" data-line-number="10"> cond &lt;-<span class="st"> </span><span class="kw">sapply</span>(<span class="kw">strsplit</span>(<span class="dt">x=</span><span class="kw">rownames</span>(exons),<span class="dt">split=</span><span class="st">":"</span>),<span class="cf">function</span>(x) x[[<span class="dv">1</span>]]<span class="op">==</span>data)</a>
<a class="sourceLine" id="cb4-11" data-line-number="11"> exons &lt;-<span class="st"> </span>exons[cond,]</a>
<a class="sourceLine" id="cb4-12" data-line-number="12"> }</a>
<a class="sourceLine" id="cb4-13" data-line-number="13"> <span class="kw">load</span>(<span class="kw">file.path</span>(path,<span class="kw">paste0</span>(data,<span class="st">".chr"</span>,chr,<span class="st">".RData"</span>)),<span class="dt">verbose=</span><span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb4-14" data-line-number="14"> </a>
<a class="sourceLine" id="cb4-15" data-line-number="15"> <span class="kw">cat</span>(<span class="st">"Matching samples:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-16" data-line-number="16"> list &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/match.samples">match.samples</a></span>(exons,snps)</a>
<a class="sourceLine" id="cb4-17" data-line-number="17"> exons &lt;-<span class="st"> </span>list<span class="op">$</span>exons; snps &lt;-<span class="st"> </span>list<span class="op">$</span>snps; <span class="kw">rm</span>(list)</a>
<a class="sourceLine" id="cb4-18" data-line-number="18"> </a>
<a class="sourceLine" id="cb4-19" data-line-number="19"> <span class="kw">cat</span>(<span class="st">"Adjusting samples:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-20" data-line-number="20"> exons &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/adjust.samples">adjust.samples</a></span>(<span class="dt">x=</span>exons) <span class="co"># slow!</span></a>
<a class="sourceLine" id="cb4-21" data-line-number="21"> exons &lt;-<span class="st"> </span><span class="kw">asinh</span>(<span class="dt">x=</span>exons)</a>
<a class="sourceLine" id="cb4-22" data-line-number="22"> </a>
<a class="sourceLine" id="cb4-23" data-line-number="23"> <span class="kw">cat</span>(<span class="st">"Adjusting covariates:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-24" data-line-number="24"> names &lt;-<span class="st"> </span><span class="kw">strsplit</span>(<span class="dt">x=</span><span class="kw">colnames</span>(exons),<span class="dt">split=</span><span class="st">"_"</span>) <span class="co"># exon names</span></a>
<a class="sourceLine" id="cb4-25" data-line-number="25"> length &lt;-<span class="st"> </span><span class="kw">sapply</span>(names,<span class="cf">function</span>(x) <span class="kw">as.integer</span>(x[[<span class="dv">3</span>]])<span class="op">-</span><span class="kw">as.integer</span>(x[[<span class="dv">2</span>]])) <span class="co"># exon length</span></a>
<a class="sourceLine" id="cb4-26" data-line-number="26"> exons &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/adjust.covariates">adjust.covariates</a></span>(<span class="dt">x=</span>exons,<span class="dt">group=</span>gene_id,<span class="dt">offset=</span>length) <span class="co"># slow!</span></a>
<a class="sourceLine" id="cb4-27" data-line-number="27"> </a>
<a class="sourceLine" id="cb4-28" data-line-number="28"> <span class="kw">cat</span>(<span class="st">"Mapping exons:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-29" data-line-number="29"> map &lt;-<span class="st"> </span><span class="kw">list</span>()</a>
<a class="sourceLine" id="cb4-30" data-line-number="30"> map<span class="op">$</span>genes &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/map.genes">map.genes</a></span>(<span class="dt">chr=</span>chr,<span class="dt">path=</span>path)</a>
<a class="sourceLine" id="cb4-31" data-line-number="31"> map<span class="op">$</span>exons &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/map.exons">map.exons</a></span>(<span class="dt">gene=</span><span class="kw">as.character</span>(map<span class="op">$</span>genes<span class="op">$</span>gene_id),<span class="dt">exon=</span>gene_id)</a>
<a class="sourceLine" id="cb4-32" data-line-number="32"> </a>
<a class="sourceLine" id="cb4-33" data-line-number="33"> <span class="kw">cat</span>(<span class="st">"Mapping SNPs:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-34" data-line-number="34"> names &lt;-<span class="st"> </span><span class="kw">strsplit</span>(<span class="dt">x=</span><span class="kw">colnames</span>(snps),<span class="dt">split=</span><span class="st">":"</span>)</a>
<a class="sourceLine" id="cb4-35" data-line-number="35"> snp.chr &lt;-<span class="st"> </span><span class="kw">sapply</span>(names,<span class="cf">function</span>(x) x[[<span class="dv">1</span>]])</a>
<a class="sourceLine" id="cb4-36" data-line-number="36"> snp.pos &lt;-<span class="st"> </span><span class="kw">sapply</span>(names,<span class="cf">function</span>(x) x[[<span class="dv">2</span>]])</a>
<a class="sourceLine" id="cb4-37" data-line-number="37"> map<span class="op">$</span>snps &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/map.snps">map.snps</a></span>(<span class="dt">gene.chr=</span>map<span class="op">$</span>genes<span class="op">$</span>chr,</a>
<a class="sourceLine" id="cb4-38" data-line-number="38"> <span class="dt">gene.start=</span>map<span class="op">$</span>genes<span class="op">$</span>start,</a>
<a class="sourceLine" id="cb4-39" data-line-number="39"> <span class="dt">gene.end=</span>map<span class="op">$</span>genes<span class="op">$</span>end,</a>
<a class="sourceLine" id="cb4-40" data-line-number="40"> <span class="dt">snp.chr=</span>snp.chr,<span class="dt">snp.pos=</span>snp.pos)</a>
<a class="sourceLine" id="cb4-41" data-line-number="41"> </a>
<a class="sourceLine" id="cb4-42" data-line-number="42"> <span class="kw">cat</span>(<span class="st">"Dropping genes:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-43" data-line-number="43"> map &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/drop.trivial">drop.trivial</a></span>(<span class="dt">map=</span>map)</a>
<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"> <span class="co">#pvalue &lt;- test.multiple(Y=exons,X=snps,map=map,rho=c(0,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>
<a class="sourceLine" id="cb4-13" data-line-number="13"> cond &lt;-<span class="st"> </span><span class="kw">sapply</span>(<span class="kw">strsplit</span>(<span class="dt">x=</span><span class="kw">colnames</span>(exons),<span class="dt">split=</span><span class="st">"_"</span>),<span class="cf">function</span>(x) x[[<span class="dv">1</span>]]<span class="op">==</span>chr)</a>
<a class="sourceLine" id="cb4-14" data-line-number="14"> exons &lt;-<span class="st"> </span>exons[,cond]</a>
<a class="sourceLine" id="cb4-15" data-line-number="15"> <span class="kw">load</span>(<span class="kw">file.path</span>(path,<span class="kw">paste0</span>(data,<span class="st">".chr"</span>,chr,<span class="st">".RData"</span>)),<span class="dt">verbose=</span><span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb4-16" data-line-number="16"> </a>
<a class="sourceLine" id="cb4-17" data-line-number="17"> <span class="kw">cat</span>(<span class="st">"Matching samples:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-18" data-line-number="18"> list &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/match.samples">match.samples</a></span>(exons,snps)</a>
<a class="sourceLine" id="cb4-19" data-line-number="19"> exons &lt;-<span class="st"> </span>list<span class="op">$</span>exons; snps &lt;-<span class="st"> </span>list<span class="op">$</span>snps; <span class="kw">rm</span>(list)</a>
<a class="sourceLine" id="cb4-20" data-line-number="20"> </a>
<a class="sourceLine" id="cb4-21" data-line-number="21"> <span class="kw">cat</span>(<span class="st">"Adjusting samples:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-22" data-line-number="22"> exons &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/adjust.samples">adjust.samples</a></span>(<span class="dt">x=</span>exons) <span class="co"># slow!</span></a>
<a class="sourceLine" id="cb4-23" data-line-number="23"> exons &lt;-<span class="st"> </span><span class="kw">asinh</span>(<span class="dt">x=</span>exons)</a>
<a class="sourceLine" id="cb4-24" data-line-number="24"> </a>
<a class="sourceLine" id="cb4-25" data-line-number="25"> <span class="kw">cat</span>(<span class="st">"Adjusting covariates:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-26" data-line-number="26"> names &lt;-<span class="st"> </span><span class="kw">strsplit</span>(<span class="dt">x=</span><span class="kw">colnames</span>(exons),<span class="dt">split=</span><span class="st">"_"</span>) <span class="co"># exon names</span></a>
<a class="sourceLine" id="cb4-27" data-line-number="27"> length &lt;-<span class="st"> </span><span class="kw">sapply</span>(names,<span class="cf">function</span>(x) <span class="kw">as.integer</span>(x[[<span class="dv">3</span>]])<span class="op">-</span><span class="kw">as.integer</span>(x[[<span class="dv">2</span>]])) <span class="co"># exon length</span></a>
<a class="sourceLine" id="cb4-28" data-line-number="28"> exons &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/adjust.covariates">adjust.covariates</a></span>(<span class="dt">x=</span>exons,<span class="dt">group=</span>gene_id,<span class="dt">offset=</span>length) <span class="co"># slow!</span></a>
<a class="sourceLine" id="cb4-29" data-line-number="29"> </a>
<a class="sourceLine" id="cb4-30" data-line-number="30"> <span class="kw">cat</span>(<span class="st">"Mapping exons:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-31" data-line-number="31"> map &lt;-<span class="st"> </span><span class="kw">list</span>()</a>
<a class="sourceLine" id="cb4-32" data-line-number="32"> map<span class="op">$</span>genes &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/map.genes">map.genes</a></span>(<span class="dt">chr=</span>chr,<span class="dt">path=</span>path)</a>
<a class="sourceLine" id="cb4-33" data-line-number="33"> map<span class="op">$</span>exons &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/map.exons">map.exons</a></span>(<span class="dt">gene=</span><span class="kw">as.character</span>(map<span class="op">$</span>genes<span class="op">$</span>gene_id),<span class="dt">exon=</span>gene_id)</a>
<a class="sourceLine" id="cb4-34" data-line-number="34"> </a>
<a class="sourceLine" id="cb4-35" data-line-number="35"> <span class="kw">cat</span>(<span class="st">"Mapping SNPs:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-36" data-line-number="36"> names &lt;-<span class="st"> </span><span class="kw">strsplit</span>(<span class="dt">x=</span><span class="kw">colnames</span>(snps),<span class="dt">split=</span><span class="st">":"</span>)</a>
<a class="sourceLine" id="cb4-37" data-line-number="37"> snp.chr &lt;-<span class="st"> </span><span class="kw">sapply</span>(names,<span class="cf">function</span>(x) x[[<span class="dv">1</span>]])</a>
<a class="sourceLine" id="cb4-38" data-line-number="38"> snp.pos &lt;-<span class="st"> </span><span class="kw">sapply</span>(names,<span class="cf">function</span>(x) x[[<span class="dv">2</span>]])</a>
<a class="sourceLine" id="cb4-39" data-line-number="39"> map<span class="op">$</span>snps &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/map.snps">map.snps</a></span>(<span class="dt">gene.chr=</span>map<span class="op">$</span>genes<span class="op">$</span>chr,</a>
<a class="sourceLine" id="cb4-40" data-line-number="40"> <span class="dt">gene.start=</span>map<span class="op">$</span>genes<span class="op">$</span>start,</a>
<a class="sourceLine" id="cb4-41" data-line-number="41"> <span class="dt">gene.end=</span>map<span class="op">$</span>genes<span class="op">$</span>end,</a>
<a class="sourceLine" id="cb4-42" data-line-number="42"> <span class="dt">snp.chr=</span>snp.chr,<span class="dt">snp.pos=</span>snp.pos)</a>
<a class="sourceLine" id="cb4-43" data-line-number="43"> </a>
<a class="sourceLine" id="cb4-44" data-line-number="44"> <span class="kw">cat</span>(<span class="st">"Dropping genes:"</span>,<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb4-45" data-line-number="45"> map &lt;-<span class="st"> </span>spliceQTL<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/spliceQTL/topics/drop.trivial">drop.trivial</a></span>(<span class="dt">map=</span>map)</a>
<a class="sourceLine" id="cb4-46" data-line-number="46"> </a>
<a class="sourceLine" id="cb4-47" data-line-number="47"> <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-48" data-line-number="48"> <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-49" data-line-number="49"> 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>) <span class="co"># slow!</span></a>
<a class="sourceLine" id="cb4-50" data-line-number="50"> <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-51" data-line-number="51"> </a>
<a class="sourceLine" id="cb4-52" data-line-number="52"> <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-53" data-line-number="53"> }</a>
<a class="sourceLine" id="cb4-54" data-line-number="54">}</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>
......@@ -176,7 +177,6 @@
<a class="sourceLine" id="cb5-12" data-line-number="12"> b &lt;-<span class="st"> </span>stats<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/stats/topics/p.adjust">p.adjust</a></span>(b[names,<span class="dv">1</span>])<span class="op">&lt;</span><span class="fl">0.05</span></a>
<a class="sourceLine" id="cb5-13" data-line-number="13"> chisq[chr] &lt;-<span class="st"> </span>stats<span class="op">::</span><span class="kw"><a href="http://www.rdocumentation.org/packages/stats/topics/chisq.test">chisq.test</a></span>(<span class="kw">table</span>(a,b))</a>
<a class="sourceLine" id="cb5-14" data-line-number="14">}</a></code></pre></div>
<p>Activate commented out lines (spliceQTL::adjust.samples, spliceQTL::adjust.covariates).</p>
<p>memory usage Linux: ps hax -o rss,user | awk ’{a[$2]+=$1;}END{for(i in a)print i" “int(a[i]/1024+0.5);}’ | sort -rnk2</p>
</div>
......
......@@ -131,7 +131,8 @@
</tr>
<tr>
<th>data</th>
<td><p>local directory for VCF (variant call format) and SDRF (sample and data relationship format) files</p></td>
<td><p>local directory for VCF (variant call format)
and SDRF (sample and data relationship format) files</p></td>
</tr>
<tr>
<th>path</th>
......
......@@ -164,7 +164,7 @@
<td>
<p><code><a href="test.single.html">test.single()</a></code> </p>
</td>
<td><p>Conduct single tests</p></td>
<td><p>Conduct single test</p></td>
</tr><tr>
<!-- -->
<td>
......
......@@ -30,7 +30,7 @@
<meta property="og:title" content="Conduct multiple tests — test.multiple" />
<meta property="og:description" content="This function ..." />
<meta property="og:description" content="This function tests for alternative splicing." />
<meta name="twitter:card" content="summary" />
......@@ -116,7 +116,7 @@
<div class="ref-description">
<p>This function ...</p>
<p>This function tests for alternative splicing.</p>
</div>
......
......@@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Conduct single tests — test.single • spliceQTL</title>
<title>Conduct single test — test.single • spliceQTL</title>
<!-- jquery -->
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script>
......@@ -28,9 +28,9 @@
<meta property="og:title" content="Conduct single tests — test.single" />
<meta property="og:title" content="Conduct single test — test.single" />
<meta property="og:description" content="This function" />
<meta property="og:description" content="This function tests for alternative splicing." />
<meta name="twitter:card" content="summary" />
......@@ -109,14 +109,14 @@
<div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Conduct single tests</h1>
<h1>Conduct single test</h1>
<small class="dont-index">Source: <a href='https://github.com/rauschenberger/spliceQTL/blob/master/R/functions.R'><code>R/functions.R</code></a></small>
<div class="hidden name"><code>test.single.Rd</code></div>
</div>
<div class="ref-description">
<p>This function</p>
<p>This function tests for alternative splicing.</p>
</div>
......
......@@ -9,7 +9,8 @@ get.snps.geuvadis(chr, data = NULL, path = getwd())
\arguments{
\item{chr}{chromosome: integer \eqn{1-22}}
\item{data}{local directory for VCF (variant call format) and SDRF (sample and data relationship format) files}
\item{data}{local directory for VCF (variant call format)
and SDRF (sample and data relationship format) files}
\item{path}{local directory for output}
}
......
......@@ -23,7 +23,7 @@ numeric vector with values between \eqn{0} and \eqn{1}}
positive integer}
}
\description{
This function ...
This function tests for alternative splicing.
}
\details{
Automatic adjustment of the number of permutations
......
......@@ -2,7 +2,7 @@
% Please edit documentation in R/functions.R
\name{test.single}
\alias{test.single}
\title{Conduct single tests}
\title{Conduct single test}
\usage{
test.single(Y, X, map, i, limit = NULL, steps = NULL, rho = c(0, 0.5, 1))
}
......@@ -29,7 +29,7 @@ integer vector}
numeric vector with values between \eqn{0} and \eqn{1}}
}
\description{
This function
This function tests for alternative splicing.
}
\details{
The maximum number of permutations equals \code{sum(steps)}. Permutations is
......
......@@ -44,7 +44,7 @@ for(chr in 1:22){
for(data in c("Geuvadis","LLS")){
set.seed(1)
cat("Analysing",data,"data:",as.character(Sys.time()),"\n")
cat("Analysing",data,chr,":",as.character(Sys.time()),"\n")
if(data=="Geuvadis"){
load(file.path(path,"Geuvadis.exons.RData"),verbose=TRUE)
} else {
......@@ -52,6 +52,8 @@ for(chr in 1:22){
cond <- sapply(strsplit(x=rownames(exons),split=":"),function(x) x[[1]]==data)
exons <- exons[cond,]
}
cond <- sapply(strsplit(x=colnames(exons),split="_"),function(x) x[[1]]==chr)
exons <- exons[,cond]
load(file.path(path,paste0(data,".chr",chr,".RData")),verbose=TRUE)
cat("Matching samples:","\n")
......@@ -86,8 +88,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)
pvalue <- spliceQTL::test.multiple(Y=exons,X=snps,map=map,rho=c(0,0.5),spec=1) # slow!
cat(as.character(Sys.time()),"\n")
save(object=pvalue,file=file.path(path,paste0("pval.",data,".chr",chr,".RData")))
......@@ -115,7 +116,4 @@ for(chr in 1:22){
```
Activate commented out lines (spliceQTL::adjust.samples, spliceQTL::adjust.covariates).
memory usage Linux: ps hax -o rss,user | awk '{a[$2]+=$1;}END{for(i in a)print i" "int(a[i]/1024+0.5);}' | sort -rnk2
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