comparison dexseq.R @ 2:6e8b61c54ff3 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 0a56599c36b4968095ec5a3cb589f94fb139466c
author iuc
date Sun, 28 Jan 2018 04:04:39 -0500
parents 4ca0e679f21e
children 278b189248cd
comparison
equal deleted inserted replaced
1:f1c406f9554c 2:6e8b61c54ff3
1 ## Setup R error handling to go to stderr 1 ## Setup R error handling to go to stderr
2 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) 2 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
3 # we need that to not crash galaxy with an UTF8 error on German LC settings. 3 # we need that to not crash galaxy with an UTF8 error on German LC settings.
4 Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") 4 Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
5 5
6 library("DEXSeq") 6 suppressPackageStartupMessages({
7 library('getopt') 7 library("DEXSeq")
8 library('rjson') 8 library('getopt')
9 library('rjson')
10 })
9 11
10 12
11 options(stringAsfactors = FALSE, useFancyQuotes = FALSE) 13 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
12 args <- commandArgs(trailingOnly = TRUE) 14 args <- commandArgs(trailingOnly = TRUE)
13 15
88 print("Estimated size factors") 90 print("Estimated size factors")
89 sizeFactors(dxd) 91 sizeFactors(dxd)
90 BPPARAM=MulticoreParam(workers=opt$threads) 92 BPPARAM=MulticoreParam(workers=opt$threads)
91 dxd <- estimateDispersions(dxd, formula=formulaFullModel, BPPARAM=BPPARAM) 93 dxd <- estimateDispersions(dxd, formula=formulaFullModel, BPPARAM=BPPARAM)
92 print("Estimated dispersions") 94 print("Estimated dispersions")
93 dxd <- testForDEU(dxd, fullModel=formulaFullModel, BPPARAM=BPPARAM) 95 dxd <- testForDEU(dxd, reducedModel=formulaReducedModel, fullModel=formulaFullModel, BPPARAM=BPPARAM)
94 print("tested for DEU") 96 print("tested for DEU")
95 dxd <- estimateExonFoldChanges(dxd, fitExpToVar=primaryFactor, BPPARAM=BPPARAM) 97 dxd <- estimateExonFoldChanges(dxd, fitExpToVar=primaryFactor, BPPARAM=BPPARAM)
96 print("Estimated fold changes") 98 print("Estimated fold changes")
97 res <- DEXSeqResults(dxd) 99 res <- DEXSeqResults(dxd)
98 print("Results") 100 print("Results")
109 print("Written Results") 111 print("Written Results")
110 112
111 if ( !is.null(opt$reportdir) ) { 113 if ( !is.null(opt$reportdir) ) {
112 save(dxd, resSorted, file = file.path(opt$reportdir,"DEXSeq_analysis.RData")) 114 save(dxd, resSorted, file = file.path(opt$reportdir,"DEXSeq_analysis.RData"))
113 save.image() 115 save.image()
114 DEXSeqHTML(res, path=opt$reportdir, FDR=opt$fdr, color=c("#B7FEA0", "#FF8F43", "#637EE9", "#FF0000", "#F1E7A1", "#C3EEE7","#CEAEFF", "#EDC3C5", "#AAA8AA")) 116 DEXSeqHTML(res, fitExpToVar=primaryFactor, path=opt$reportdir, FDR=opt$fdr, color=c("#B7FEA0", "#FF8F43", "#637EE9", "#FF0000", "#F1E7A1", "#C3EEE7","#CEAEFF", "#EDC3C5", "#AAA8AA"))
115 unlink(file.path(opt$reportdir,"DEXSeq_analysis.RData")) 117 unlink(file.path(opt$reportdir,"DEXSeq_analysis.RData"))
116 } 118 }
117 sessionInfo() 119 sessionInfo()