annotate dexseq.R @ 5:28a2181df3b9 draft

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