annotate dexseq.R @ 3:f89c9b25feb4 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit e785d126b23609208b055fb8902f3b9368e9b839
author iuc
date Sat, 28 Jul 2018 03:44:02 -0400
parents 6e8b61c54ff3
children 278b189248cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
1 ## Setup R error handling to go to stderr
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
2 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
3 # we need that to not crash galaxy with an UTF8 error on German LC settings.
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
4 Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
5
2
6e8b61c54ff3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents: 0
diff changeset
6 suppressPackageStartupMessages({
6e8b61c54ff3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents: 0
diff changeset
7 library("DEXSeq")
6e8b61c54ff3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents: 0
diff changeset
8 library('getopt')
6e8b61c54ff3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents: 0
diff changeset
9 library('rjson')
6e8b61c54ff3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents: 0
diff changeset
10 })
0
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
11
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
12
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
13 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
14 args <- commandArgs(trailingOnly = TRUE)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
15
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
16 #get options, using the spec as defined by the enclosed list.
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
17 #we read the options from the default: commandArgs(TRUE).
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
18 spec = matrix(c(
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
19 'verbose', 'v', 2, "integer",
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
20 'help', 'h', 0, "logical",
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
21 'gtf', 'a', 1, "character",
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
22 'outfile', 'o', 1, "character",
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
23 'reportdir', 'r', 1, "character",
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
24 'factors', 'f', 1, "character",
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
25 'threads', 'p', 1, "integer",
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
26 'fdr', 'c', 1, "double"
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
27 ), byrow=TRUE, ncol=4);
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
28 opt = getopt(spec);
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
29
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
30 # if help was asked for print a friendly message
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
31 # and exit with a non-zero error code
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
32 if ( !is.null(opt$help) ) {
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
33 cat(getopt(spec, usage=TRUE));
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
34 q(status=1);
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
35 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
36
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
37 trim <- function (x) gsub("^\\s+|\\s+$", "", x)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
38 opt$samples <- trim(opt$samples)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
39 opt$factors <- trim(opt$factors)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
40
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
41 parser <- newJSONParser()
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
42 parser$addData( opt$factors )
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
43 factorsList <- parser$getObject()
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
44
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
45 sampleTable<-data.frame()
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
46 countFiles<-c()
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
47 factorNames<-c()
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
48 primaryFactor<-""
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
49 for(factor in factorsList){
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
50 factorName<-factor[[1]]
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
51 factorNames<-append(factorNames, paste(factorName,"exon",sep=":"))
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
52 factorValuesMapList<-factor[[2]]
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
53 c = length(factorValuesMapList)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
54 for (factorValuesMap in factorValuesMapList){
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
55 for(files in factorValuesMap){
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
56 for(file in files){
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
57 if(primaryFactor == "") {
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
58 countFiles<-append(countFiles,file)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
59 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
60 sampleTable[basename(file),factorName]<-paste(c,names(factorValuesMap),sep="_")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
61 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
62 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
63 c = c-1
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
64 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
65 if(primaryFactor == ""){
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
66 primaryFactor <- factorName
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
67 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
68 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
69
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
70 factorNames<-append(factorNames,"exon")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
71 factorNames<-append(factorNames,"sample")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
72 factorNames<-rev(factorNames)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
73 formulaFullModel <- as.formula(paste("", paste(factorNames, collapse=" + "), sep=" ~ "))
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
74 factorNames <- head(factorNames,-1)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
75 formulaReducedModel <- as.formula(paste("", paste(factorNames, collapse=" + "), sep=" ~ "))
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
76
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
77 sampleTable
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
78 formulaFullModel
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
79 formulaReducedModel
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
80 primaryFactor
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
81 countFiles
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
82 opt$reportdir
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
83 opt$threads
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
84 getwd()
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
85
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
86 dxd = DEXSeqDataSetFromHTSeq(countFiles, sampleData=sampleTable, design= formulaFullModel, flattenedfile=opt$gtf)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
87
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
88 colData(dxd)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
89 dxd <- estimateSizeFactors(dxd)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
90 print("Estimated size factors")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
91 sizeFactors(dxd)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
92 BPPARAM=MulticoreParam(workers=opt$threads)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
93 dxd <- estimateDispersions(dxd, formula=formulaFullModel, BPPARAM=BPPARAM)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
94 print("Estimated dispersions")
2
6e8b61c54ff3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents: 0
diff changeset
95 dxd <- testForDEU(dxd, reducedModel=formulaReducedModel, fullModel=formulaFullModel, BPPARAM=BPPARAM)
0
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
96 print("tested for DEU")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
97 dxd <- estimateExonFoldChanges(dxd, fitExpToVar=primaryFactor, BPPARAM=BPPARAM)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
98 print("Estimated fold changes")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
99 res <- DEXSeqResults(dxd)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
100 print("Results")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
101 table(res$padj <= opt$fdr)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
102 resSorted <- res[order(res$padj),]
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
103 head(resSorted)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
104
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
105 export_table <- as.data.frame(resSorted)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
106 last_column <- ncol(export_table)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
107 for(i in 1:nrow(export_table)) {
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
108 export_table[i,last_column] <- paste(export_table[i,last_column][[1]],collapse=", ")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
109 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
110 write.table(export_table, file = opt$outfile, sep="\t", quote = FALSE, col.names = FALSE)
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
111 print("Written Results")
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
112
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
113 if ( !is.null(opt$reportdir) ) {
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
114 save(dxd, resSorted, file = file.path(opt$reportdir,"DEXSeq_analysis.RData"))
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
115 save.image()
2
6e8b61c54ff3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
iuc
parents: 0
diff changeset
116 DEXSeqHTML(res, fitExpToVar=primaryFactor, path=opt$reportdir, FDR=opt$fdr, color=c("#B7FEA0", "#FF8F43", "#637EE9", "#FF0000", "#F1E7A1", "#C3EEE7","#CEAEFF", "#EDC3C5", "#AAA8AA"))
0
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
117 unlink(file.path(opt$reportdir,"DEXSeq_analysis.RData"))
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
118 }
4ca0e679f21e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
iuc
parents:
diff changeset
119 sessionInfo()