comparison deseq2.R @ 18:3bf1b3ec1ddf draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 448dccb0c02aba00d8301247b0f0f406ab3d4fa2
author iuc
date Fri, 16 Nov 2018 14:47:19 -0500
parents d9e5cadc7f0b
children c56e0689e46e
comparison
equal deleted inserted replaced
17:d9e5cadc7f0b 18:3bf1b3ec1ddf
47 "quiet", "q", 0, "logical", 47 "quiet", "q", 0, "logical",
48 "help", "h", 0, "logical", 48 "help", "h", 0, "logical",
49 "batch_factors", "", 1, "character", 49 "batch_factors", "", 1, "character",
50 "outfile", "o", 1, "character", 50 "outfile", "o", 1, "character",
51 "countsfile", "n", 1, "character", 51 "countsfile", "n", 1, "character",
52 "rlogfile", "r", 1, "character",
53 "vstfile", "v", 1, "character",
52 "header", "H", 0, "logical", 54 "header", "H", 0, "logical",
53 "factors", "f", 1, "character", 55 "factors", "f", 1, "character",
54 "files_to_labels", "l", 1, "character", 56 "files_to_labels", "l", 1, "character",
55 "plots" , "p", 1, "character", 57 "plots" , "p", 1, "character",
56 "tximport", "i", 0, "logical", 58 "tximport", "i", 0, "logical",
57 "txtype", "y", 1, "character", 59 "txtype", "y", 1, "character",
58 "tx2gene", "x", 1, "character", # a space-sep tx-to-gene map or GTF file (auto detect .gtf/.GTF) 60 "tx2gene", "x", 1, "character", # a space-sep tx-to-gene map or GTF file (auto detect .gtf/.GTF)
61 "esf", "e", 1, "character",
59 "fit_type", "t", 1, "integer", 62 "fit_type", "t", 1, "integer",
60 "many_contrasts", "m", 0, "logical", 63 "many_contrasts", "m", 0, "logical",
61 "outlier_replace_off" , "a", 0, "logical", 64 "outlier_replace_off" , "a", 0, "logical",
62 "outlier_filter_off" , "b", 0, "logical", 65 "outlier_filter_off" , "b", 0, "logical",
63 "auto_mean_filter_off", "c", 0, "logical", 66 "auto_mean_filter_off", "c", 0, "logical",
186 } 189 }
187 cat("\n---------------------\n") 190 cat("\n---------------------\n")
188 } 191 }
189 192
190 dds <- get_deseq_dataset(sampleTable, header=opt$header, designFormula=designFormula, tximport=opt$tximport, txtype=opt$txtype, tx2gene=opt$tx2gene) 193 dds <- get_deseq_dataset(sampleTable, header=opt$header, designFormula=designFormula, tximport=opt$tximport, txtype=opt$txtype, tx2gene=opt$tx2gene)
191 194 # estimate size factors for the chosen method
195 if(!is.null(opt$esf)){
196 dds <- estimateSizeFactors(dds, type=opt$esf)
197 }
192 apply_batch_factors <- function (dds, batch_factors) { 198 apply_batch_factors <- function (dds, batch_factors) {
193 rownames(batch_factors) <- batch_factors$identifier 199 rownames(batch_factors) <- batch_factors$identifier
194 batch_factors <- subset(batch_factors, select = -c(identifier, condition)) 200 batch_factors <- subset(batch_factors, select = -c(identifier, condition))
195 dds_samples <- colnames(dds) 201 dds_samples <- colnames(dds)
196 batch_samples <- rownames(batch_factors) 202 batch_samples <- rownames(batch_factors)
281 287
282 if (!is.null(opt$countsfile)) { 288 if (!is.null(opt$countsfile)) {
283 normalizedCounts<-counts(dds,normalized=TRUE) 289 normalizedCounts<-counts(dds,normalized=TRUE)
284 write.table(normalizedCounts, file=opt$countsfile, sep="\t", col.names=NA, quote=FALSE) 290 write.table(normalizedCounts, file=opt$countsfile, sep="\t", col.names=NA, quote=FALSE)
285 } 291 }
292
293 if (!is.null(opt$rlogfile)) {
294 rLogNormalized <-rlogTransformation(dds)
295 rLogNormalizedMat <- assay(rLogNormalized)
296 write.table(rLogNormalizedMat, file=opt$rlogfile, sep="\t", col.names=NA, quote=FALSE)
297 }
298
299 if (!is.null(opt$vstfile)) {
300 vstNormalized<-varianceStabilizingTransformation(dds)
301 vstNormalizedMat <- assay(vstNormalized)
302 write.table(vstNormalizedMat, file=opt$vstfile, sep="\t", col.names=NA, quote=FALSE)
303 }
304
286 305
287 if (is.null(opt$many_contrasts)) { 306 if (is.null(opt$many_contrasts)) {
288 # only contrast the first and second level of the primary factor 307 # only contrast the first and second level of the primary factor
289 ref <- allLevels[1] 308 ref <- allLevels[1]
290 lvl <- allLevels[2] 309 lvl <- allLevels[2]