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)
......
This diff is collapsed.
......@@ -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