Commit c31632d1 authored by Rauschenberger's avatar Rauschenberger
Browse files

automation

parent a294a69f
...@@ -54,7 +54,8 @@ NULL ...@@ -54,7 +54,8 @@ NULL
#' chromosome: integer \eqn{1-22} #' chromosome: integer \eqn{1-22}
#' #'
#' @param data #' @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 #' @param path
#' local directory for output #' local directory for output
...@@ -731,10 +732,10 @@ drop.trivial <- function(map){ ...@@ -731,10 +732,10 @@ drop.trivial <- function(map){
#' @export #' @export
#' @title #' @title
#' Conduct single tests #' Conduct single test
#' #'
#' @description #' @description
#' This function #' This function tests for alternative splicing.
#' #'
#' @param Y #' @param Y
#' exon expression\strong{:} #' exon expression\strong{:}
...@@ -853,7 +854,7 @@ test.single <- function(Y,X,map,i,limit=NULL,steps=NULL,rho=c(0,0.5,1)){ ...@@ -853,7 +854,7 @@ test.single <- function(Y,X,map,i,limit=NULL,steps=NULL,rho=c(0,0.5,1)){
#' Conduct multiple tests #' Conduct multiple tests
#' #'
#' @description #' @description
#' This function ... #' This function tests for alternative splicing.
#' #'
#' @param Y #' @param Y
#' exon expression\strong{:} #' exon expression\strong{:}
...@@ -908,13 +909,13 @@ test.multiple <- function(Y,X,map,rho=c(0,0.5,1),spec=1){ ...@@ -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)} if(max != sum(steps)){stop("Invalid combination?",call.=FALSE)}
## parallel computation ## parallel computation
#type <- ifelse(test=.Platform$OS.type=="windows",yes="PSOCK",no="FORK") type <- ifelse(test=.Platform$OS.type=="windows",yes="PSOCK",no="FORK")
#cluster <- parallel::makeCluster(spec=spec,type=type) cluster <- parallel::makeCluster(spec=spec,type=type)
#parallel::clusterSetRNGStream(cl=cluster,iseed=1) parallel::clusterSetRNGStream(cl=cluster,iseed=1)
##parallel::clusterExport(cl=cluster,varlist=c("Y","X","map","limit","steps","rho"),envir=environment()) ##parallel::clusterExport(cl=cluster,varlist=c("Y","X","map","limit","steps","rho"),envir=environment())
#start <- Sys.time() #start <- Sys.time()
#parallel::clusterEvalQ(cl=cluster,library(spliceQTL)) #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)) #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() #end <- Sys.time()
#parallel::stopCluster(cluster) #parallel::stopCluster(cluster)
...@@ -924,7 +925,7 @@ test.multiple <- function(Y,X,map,rho=c(0,0.5,1),spec=1){ ...@@ -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)) #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 ## 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 # tyding up
pvalue <- do.call(what=rbind,args=pvalue) pvalue <- do.call(what=rbind,args=pvalue)
......
This diff is collapsed.
...@@ -131,7 +131,8 @@ ...@@ -131,7 +131,8 @@
</tr> </tr>
<tr> <tr>
<th>data</th> <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>
<tr> <tr>
<th>path</th> <th>path</th>
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
<td> <td>
<p><code><a href="test.single.html">test.single()</a></code> </p> <p><code><a href="test.single.html">test.single()</a></code> </p>
</td> </td>
<td><p>Conduct single tests</p></td> <td><p>Conduct single test</p></td>
</tr><tr> </tr><tr>
<!-- --> <!-- -->
<td> <td>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<meta property="og:title" content="Conduct multiple tests — test.multiple" /> <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" /> <meta name="twitter:card" content="summary" />
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<div class="ref-description"> <div class="ref-description">
<p>This function ...</p> <p>This function tests for alternative splicing.</p>
</div> </div>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <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 --> <!-- jquery -->
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script>
...@@ -28,9 +28,9 @@ ...@@ -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" /> <meta name="twitter:card" content="summary" />
...@@ -109,14 +109,14 @@ ...@@ -109,14 +109,14 @@
<div class="row"> <div class="row">
<div class="col-md-9 contents"> <div class="col-md-9 contents">
<div class="page-header"> <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> <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 class="hidden name"><code>test.single.Rd</code></div>
</div> </div>
<div class="ref-description"> <div class="ref-description">
<p>This function</p> <p>This function tests for alternative splicing.</p>
</div> </div>
......
...@@ -9,7 +9,8 @@ get.snps.geuvadis(chr, data = NULL, path = getwd()) ...@@ -9,7 +9,8 @@ get.snps.geuvadis(chr, data = NULL, path = getwd())
\arguments{ \arguments{
\item{chr}{chromosome: integer \eqn{1-22}} \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} \item{path}{local directory for output}
} }
......
...@@ -23,7 +23,7 @@ numeric vector with values between \eqn{0} and \eqn{1}} ...@@ -23,7 +23,7 @@ numeric vector with values between \eqn{0} and \eqn{1}}
positive integer} positive integer}
} }
\description{ \description{
This function ... This function tests for alternative splicing.
} }
\details{ \details{
Automatic adjustment of the number of permutations Automatic adjustment of the number of permutations
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
% Please edit documentation in R/functions.R % Please edit documentation in R/functions.R
\name{test.single} \name{test.single}
\alias{test.single} \alias{test.single}
\title{Conduct single tests} \title{Conduct single test}
\usage{ \usage{
test.single(Y, X, map, i, limit = NULL, steps = NULL, rho = c(0, 0.5, 1)) test.single(Y, X, map, i, limit = NULL, steps = NULL, rho = c(0, 0.5, 1))
} }
...@@ -29,7 +29,7 @@ integer vector} ...@@ -29,7 +29,7 @@ integer vector}
numeric vector with values between \eqn{0} and \eqn{1}} numeric vector with values between \eqn{0} and \eqn{1}}
} }
\description{ \description{
This function This function tests for alternative splicing.
} }
\details{ \details{
The maximum number of permutations equals \code{sum(steps)}. Permutations is The maximum number of permutations equals \code{sum(steps)}. Permutations is
......
...@@ -44,7 +44,7 @@ for(chr in 1:22){ ...@@ -44,7 +44,7 @@ for(chr in 1:22){
for(data in c("Geuvadis","LLS")){ for(data in c("Geuvadis","LLS")){
set.seed(1) set.seed(1)
cat("Analysing",data,"data:",as.character(Sys.time()),"\n") cat("Analysing",data,chr,":",as.character(Sys.time()),"\n")
if(data=="Geuvadis"){ if(data=="Geuvadis"){
load(file.path(path,"Geuvadis.exons.RData"),verbose=TRUE) load(file.path(path,"Geuvadis.exons.RData"),verbose=TRUE)
} else { } else {
...@@ -52,6 +52,8 @@ for(chr in 1:22){ ...@@ -52,6 +52,8 @@ for(chr in 1:22){
cond <- sapply(strsplit(x=rownames(exons),split=":"),function(x) x[[1]]==data) cond <- sapply(strsplit(x=rownames(exons),split=":"),function(x) x[[1]]==data)
exons <- exons[cond,] 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) load(file.path(path,paste0(data,".chr",chr,".RData")),verbose=TRUE)
cat("Matching samples:","\n") cat("Matching samples:","\n")
...@@ -86,8 +88,7 @@ for(chr in 1:22){ ...@@ -86,8 +88,7 @@ for(chr in 1:22){
cat("Testing:",as.character(Sys.time())," -> ") cat("Testing:",as.character(Sys.time())," -> ")
rm(list=setdiff(ls(),c("exons","snps","map","data","chr"))); gc() 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) # slow!
pvalue <- spliceQTL::test.multiple(Y=exons,X=snps,map=map,rho=c(0,0.5),spec=1)
cat(as.character(Sys.time()),"\n") cat(as.character(Sys.time()),"\n")
save(object=pvalue,file=file.path(path,paste0("pval.",data,".chr",chr,".RData"))) save(object=pvalue,file=file.path(path,paste0("pval.",data,".chr",chr,".RData")))
...@@ -115,7 +116,4 @@ for(chr in 1:22){ ...@@ -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 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