Commit d1cc60e6 authored by Rauschenberger's avatar Rauschenberger
Browse files

automation

parent ba2936b9
......@@ -880,6 +880,10 @@ test.single <- function(Y,X,map,i,limit=NULL,steps=NULL,rho=c(0,0.5,1)){
#' number of cores\strong{:}
#' positive integer
#'
#' @param steps
#' number of iteration chunks\strong{:}
#' positive integer
#'
#' @details
#' Automatic adjustment of the number of permutations
#' such that Bonferroni-significant p-values are possible.
......@@ -887,7 +891,7 @@ test.single <- function(Y,X,map,i,limit=NULL,steps=NULL,rho=c(0,0.5,1)){
#' @examples
#' NA
#'
test.multiple <- function(Y,X,map,rho=c(0,0.5,1),spec=1){
test.multiple <- function(Y,X,map,rho=c(0,0.5,1),spec=1,steps=20){
p <- nrow(map$genes)
......@@ -905,7 +909,7 @@ test.multiple <- function(Y,X,map,rho=c(0,0.5,1),spec=1){
if(TRUE){
max <- p/0.05+1
limit <- ceiling(0.05*max/p)
steps <- diff(limit^seq(from=1,to=log(max)/log(limit),length.out=pmin(p,20))) # was (p,20)
steps <- diff(limit^seq(from=1,to=log(max)/log(limit),length.out=pmin(p,steps))) # was (p,20)
steps <- c(limit,round(steps)) # Or replace "limit" by "minimum # of permutations"!
steps[length(steps)] <- max-sum(steps[-length(steps)])
}
......
......@@ -195,7 +195,7 @@
<a class="sourceLine" id="cb5-10" data-line-number="10"> </a>
<a class="sourceLine" id="cb5-11" data-line-number="11"> <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">"data"</span>,<span class="st">"chr"</span>,<span class="st">"path"</span>))); <span class="kw">gc</span>(); <span class="kw">cat</span>(<span class="st">"."</span>)</a>
<a class="sourceLine" id="cb5-12" data-line-number="12"> <span class="kw">load</span>(<span class="kw">file.path</span>(path,<span class="kw">paste0</span>(<span class="st">"temp."</span>,data,<span class="st">".chr"</span>,chr,<span class="st">".RData"</span>))); <span class="kw">cat</span>(<span class="st">"."</span>)</a>
<a class="sourceLine" id="cb5-13" data-line-number="13"> 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="dv">1</span>,<span class="dt">spec=</span><span class="dv">1</span>); <span class="kw">cat</span>(<span class="st">"."</span>)</a>
<a class="sourceLine" id="cb5-13" data-line-number="13"> 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="dv">1</span>,<span class="dt">spec=</span><span class="dv">16</span>); <span class="kw">cat</span>(<span class="st">"."</span>)</a>
<a class="sourceLine" id="cb5-14" data-line-number="14"> <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>))); <span class="kw">cat</span>(<span class="st">"</span><span class="ch">\n</span><span class="st">"</span>)</a>
<a class="sourceLine" id="cb5-15" data-line-number="15"> }</a>
<a class="sourceLine" id="cb5-16" data-line-number="16"><span class="co">#q()</span></a>
......
......@@ -120,7 +120,7 @@
</div>
<pre class="usage"><span class='fu'>test.multiple</span>(<span class='no'>Y</span>, <span class='no'>X</span>, <span class='no'>map</span>, <span class='kw'>rho</span> <span class='kw'>=</span> <span class='fu'>c</span>(<span class='fl'>0</span>, <span class='fl'>0.5</span>, <span class='fl'>1</span>), <span class='kw'>spec</span> <span class='kw'>=</span> <span class='fl'>1</span>)</pre>
<pre class="usage"><span class='fu'>test.multiple</span>(<span class='no'>Y</span>, <span class='no'>X</span>, <span class='no'>map</span>, <span class='kw'>rho</span> <span class='kw'>=</span> <span class='fu'>c</span>(<span class='fl'>0</span>, <span class='fl'>0.5</span>, <span class='fl'>1</span>), <span class='kw'>spec</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>steps</span> <span class='kw'>=</span> <span class='fl'>20</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
......@@ -148,6 +148,11 @@ numeric vector with values between \(0\) and \(1\)</p></td>
<tr>
<th>spec</th>
<td><p>number of cores<strong>:</strong>
positive integer</p></td>
</tr>
<tr>
<th>steps</th>
<td><p>number of iteration chunks<strong>:</strong>
positive integer</p></td>
</tr>
</table>
......
......@@ -4,7 +4,7 @@
\alias{test.multiple}
\title{Conduct multiple tests}
\usage{
test.multiple(Y, X, map, rho = c(0, 0.5, 1), spec = 1)
test.multiple(Y, X, map, rho = c(0, 0.5, 1), spec = 1, steps = 20)
}
\arguments{
\item{Y}{exon expression\strong{:}
......@@ -21,6 +21,9 @@ numeric vector with values between \eqn{0} and \eqn{1}}
\item{spec}{number of cores\strong{:}
positive integer}
\item{steps}{number of iteration chunks\strong{:}
positive integer}
}
\description{
This function tests for alternative splicing.
......
......@@ -131,7 +131,7 @@ for(chr in 22:1){
rm(list=setdiff(ls(),c("data","chr","path"))); gc(); cat(".")
load(file.path(path,paste0("temp.",data,".chr",chr,".RData"))); cat(".")
pvalue <- spliceQTL::test.multiple(Y=exons,X=snps,map=map,rho=1,spec=1); cat(".")
pvalue <- spliceQTL::test.multiple(Y=exons,X=snps,map=map,rho=1,spec=16); cat(".")
save(object=pvalue,file=file.path(path,paste0("pval.",data,".chr",chr,".RData"))); cat("\n")
}
#q()
......
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