annotate deseq2.R @ 9:6f91b8ce6e07 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 31371b7f8c564c4b4edc8914e83492ee7f04ea31
author iuc
date Tue, 11 Apr 2017 09:46:37 -0400
parents 4939397c4706
children 25204a860b79
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
1 #!/usr/bin/env Rscript
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
2
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
3 # A command-line interface to DESeq2 for use with Galaxy
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
4 # written by Bjoern Gruening and modified by Michael Love 2016.03.30
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
5 #
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
6 # one of these arguments is required:
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
7 #
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
8 # 'factors' a JSON list object from Galaxy
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
9 #
9
6f91b8ce6e07 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 31371b7f8c564c4b4edc8914e83492ee7f04ea31
iuc
parents: 6
diff changeset
10 # 'sample_table' is a sample table as described in ?DESeqDataSetFromHTSeqCount
6
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
11 # with columns: sample name, filename, then factors (variables)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
12 #
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
13 # the output file has columns:
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
14 #
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
15 # baseMean (mean normalized count)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
16 # log2FoldChange (by default a moderated LFC estimate)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
17 # lfcSE (the standard error)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
18 # stat (the Wald statistic)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
19 # pvalue (p-value from comparison of Wald statistic to a standard Normal)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
20 # padj (adjusted p-value, Benjamini Hochberg correction on genes which pass the mean count filter)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
21 #
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
22 # the first variable in 'factors' and first column in 'sample_table' will be the primary factor.
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
23 # the levels of the primary factor are used in the order of appearance in factors or in sample_table.
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
24 #
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
25 # by default, levels in the order A,B,C produces a single comparison of B vs A, to a single file 'outfile'
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
26 #
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
27 # for the 'many_contrasts' flag, levels in the order A,B,C produces comparisons C vs A, B vs A, C vs B,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
28 # to a number of files using the 'outfile' prefix: 'outfile.condition_C_vs_A' etc.
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
29 # all plots will still be sent to a single PDF, named by the arg 'plots', with extra pages.
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
30 #
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
31 # fit_type is an integer valued argument, with the options from ?estimateDisperions
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
32 # 1 "parametric"
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
33 # 2 "local"
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
34 # 3 "mean"
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
35
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
36 # setup R error handling to go to stderr
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
37 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
38
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
39 # we need that to not crash galaxy with an UTF8 error on German LC settings.
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
40 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
41
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
42 library("getopt")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
43 library("tools")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
44 options(stringAsFactors = FALSE, useFancyQuotes = FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
45 args <- commandArgs(trailingOnly = TRUE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
46
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
47 # get options, using the spec as defined by the enclosed list.
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
48 # we read the options from the default: commandArgs(TRUE).
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
49 spec <- matrix(c(
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
50 "quiet", "q", 0, "logical",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
51 "help", "h", 0, "logical",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
52 "outfile", "o", 1, "character",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
53 "countsfile", "n", 1, "character",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
54 "factors", "f", 1, "character",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
55 "plots" , "p", 1, "character",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
56 "sample_table", "s", 1, "character",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
57 "tximport", "i", 0, "logical",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
58 "tx2gene", "x", 1, "character", # a space-sep tx-to-gene map or GTF file (auto detect .gtf/.GTF)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
59 "fit_type", "t", 1, "integer",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
60 "many_contrasts", "m", 0, "logical",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
61 "outlier_replace_off" , "a", 0, "logical",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
62 "outlier_filter_off" , "b", 0, "logical",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
63 "auto_mean_filter_off", "c", 0, "logical",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
64 "beta_prior_off", "d", 0, "logical"),
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
65 byrow=TRUE, ncol=4)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
66 opt <- getopt(spec)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
67
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
68 # if help was asked for print a friendly message
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
69 # and exit with a non-zero error code
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
70 if (!is.null(opt$help)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
71 cat(getopt(spec, usage=TRUE))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
72 q(status=1)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
73 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
74
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
75 # enforce the following required arguments
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
76 if (is.null(opt$outfile)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
77 cat("'outfile' is required\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
78 q(status=1)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
79 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
80 if (is.null(opt$sample_table) & is.null(opt$factors)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
81 cat("'factors' or 'sample_table' is required\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
82 q(status=1)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
83 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
84
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
85 verbose <- if (is.null(opt$quiet)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
86 TRUE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
87 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
88 FALSE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
89 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
90
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
91 if (!is.null(opt$tximport)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
92 if (is.null(opt$tx2gene)) stop("A transcript-to-gene map or a GTF file is required for tximport")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
93 if (tolower(file_ext(opt$tx2gene)) == "gtf") {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
94 gtfFile <- opt$tx2gene
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
95 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
96 gtfFile <- NULL
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
97 tx2gene <- read.table(opt$tx2gene, header=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
98 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
99 useTXI <- TRUE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
100 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
101 useTXI <- FALSE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
102 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
103
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
104 suppressPackageStartupMessages({
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
105 library("DESeq2")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
106 library("RColorBrewer")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
107 library("gplots")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
108 })
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
109
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
110 # build or read sample table
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
111
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
112 trim <- function (x) gsub("^\\s+|\\s+$", "", x)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
113
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
114 # switch on if 'factors' was provided:
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
115 if (!is.null(opt$factors)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
116 library("rjson")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
117 parser <- newJSONParser()
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
118 parser$addData(opt$factors)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
119 factorList <- parser$getObject()
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
120 factors <- sapply(factorList, function(x) x[[1]])
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
121 primaryFactor <- factors[1]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
122 filenamesIn <- unname(unlist(factorList[[1]][[2]]))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
123 sampleTable <- data.frame(sample=basename(filenamesIn),
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
124 filename=filenamesIn,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
125 row.names=filenamesIn,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
126 stringsAsFactors=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
127 for (factor in factorList) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
128 factorName <- trim(factor[[1]])
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
129 sampleTable[[factorName]] <- character(nrow(sampleTable))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
130 lvls <- sapply(factor[[2]], function(x) names(x))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
131 for (i in seq_along(factor[[2]])) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
132 files <- factor[[2]][[i]][[1]]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
133 sampleTable[files,factorName] <- trim(lvls[i])
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
134 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
135 sampleTable[[factorName]] <- factor(sampleTable[[factorName]], levels=lvls)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
136 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
137 rownames(sampleTable) <- sampleTable$sample
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
138 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
139 # read the sample_table argument
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
140 # this table is described in ?DESeqDataSet
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
141 # one column for the sample name, one for the filename, and
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
142 # the remaining columns for factors in the analysis
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
143 sampleTable <- read.delim(opt$sample_table, stringsAsFactors=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
144 factors <- colnames(sampleTable)[-c(1:2)]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
145 for (factor in factors) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
146 lvls <- unique(as.character(sampleTable[[factor]]))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
147 sampleTable[[factor]] <- factor(sampleTable[[factor]], levels=lvls)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
148 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
149 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
150
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
151 primaryFactor <- factors[1]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
152 designFormula <- as.formula(paste("~", paste(rev(factors), collapse=" + ")))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
153
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
154 if (verbose) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
155 cat("DESeq2 run information\n\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
156 cat("sample table:\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
157 print(sampleTable[,-c(1:2),drop=FALSE])
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
158 cat("\ndesign formula:\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
159 print(designFormula)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
160 cat("\n\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
161 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
162
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
163 # these are plots which are made once for each analysis
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
164 generateGenericPlots <- function(dds, factors) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
165 rld <- rlog(dds)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
166 d=plotPCA(rld, intgroup=rev(factors), returnData=TRUE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
167 labs <- paste0(seq_len(ncol(dds)), ": ", do.call(paste, as.list(colData(dds)[factors])))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
168 library(ggplot2)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
169 print(ggplot(d, aes(x=PC1,y=PC2, col=group,label=factor(labs)), environment = environment()) + geom_point() + geom_text(size=3))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
170 dat <- assay(rld)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
171 colnames(dat) <- labs
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
172 distsRL <- dist(t(dat))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
173 mat <- as.matrix(distsRL)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
174 hc <- hclust(distsRL)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
175 hmcol <- colorRampPalette(brewer.pal(9, "GnBu"))(100)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
176 heatmap.2(mat, Rowv=as.dendrogram(hc), symm=TRUE, trace="none", col = rev(hmcol),
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
177 main="Sample-to-sample distances", margin=c(13,13))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
178 plotDispEsts(dds, main="Dispersion estimates")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
179 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
180
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
181 # these are plots which can be made for each comparison, e.g.
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
182 # once for C vs A and once for B vs A
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
183 generateSpecificPlots <- function(res, threshold, title_suffix) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
184 use <- res$baseMean > threshold
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
185 if (sum(!use) == 0) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
186 h <- hist(res$pvalue, breaks=0:50/50, plot=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
187 barplot(height = h$counts,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
188 col = "powderblue", space = 0, xlab="p-values", ylab="frequency",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
189 main=paste("Histogram of p-values for",title_suffix))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
190 text(x = c(0, length(h$counts)), y = 0, label=paste(c(0,1)), adj=c(0.5,1.7), xpd=NA)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
191 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
192 h1 <- hist(res$pvalue[!use], breaks=0:50/50, plot=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
193 h2 <- hist(res$pvalue[use], breaks=0:50/50, plot=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
194 colori <- c("filtered (low count)"="khaki", "not filtered"="powderblue")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
195 barplot(height = rbind(h1$counts, h2$counts), beside = FALSE,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
196 col = colori, space = 0, xlab="p-values", ylab="frequency",
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
197 main=paste("Histogram of p-values for",title_suffix))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
198 text(x = c(0, length(h1$counts)), y = 0, label=paste(c(0,1)), adj=c(0.5,1.7), xpd=NA)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
199 legend("topright", fill=rev(colori), legend=rev(names(colori)), bg="white")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
200 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
201 plotMA(res, main= paste("MA-plot for",title_suffix), ylim=range(res$log2FoldChange, na.rm=TRUE))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
202 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
203
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
204 if (verbose) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
205 cat(paste("primary factor:",primaryFactor,"\n"))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
206 if (length(factors) > 1) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
207 cat(paste("other factors in design:",paste(factors[-length(factors)],collapse=","),"\n"))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
208 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
209 cat("\n---------------------\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
210 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
211
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
212 # if JSON input from Galaxy, path is absolute
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
213 # otherwise, from sample_table, assume it is relative
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
214 dir <- if (is.null(opt$factors)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
215 "."
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
216 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
217 ""
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
218 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
219
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
220 if (!useTXI) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
221 # construct the object from HTSeq files
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
222 dds <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
223 directory = dir,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
224 design = designFormula)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
225 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
226 # construct the object using tximport
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
227 # first need to make the tx2gene table
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
228 # this takes ~2-3 minutes using Bioconductor functions
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
229 if (!is.null(gtfFile)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
230 suppressPackageStartupMessages({
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
231 library("GenomicFeatures")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
232 })
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
233 txdb <- makeTxDbFromGFF(gtfFile, format="gtf")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
234 k <- keys(txdb, keytype = "GENEID")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
235 df <- select(txdb, keys = k, keytype = "GENEID", columns = "TXNAME")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
236 tx2gene <- df[, 2:1] # tx ID, then gene ID
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
237 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
238 library("tximport")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
239 txiFiles <- as.character(sampleTable[,2])
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
240 names(txiFiles) <- as.character(sampleTable[,1])
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
241 txi <- tximport(txiFiles, type="sailfish", tx2gene=tx2gene)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
242 dds <- DESeqDataSetFromTximport(txi,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
243 sampleTable[,3:ncol(sampleTable),drop=FALSE],
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
244 designFormula)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
245 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
246
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
247 if (verbose) cat(paste(ncol(dds), "samples with counts over", nrow(dds), "genes\n"))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
248 # optional outlier behavior
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
249 if (is.null(opt$outlier_replace_off)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
250 minRep <- 7
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
251 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
252 minRep <- Inf
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
253 if (verbose) cat("outlier replacement off\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
254 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
255 if (is.null(opt$outlier_filter_off)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
256 cooksCutoff <- TRUE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
257 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
258 cooksCutoff <- FALSE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
259 if (verbose) cat("outlier filtering off\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
260 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
261
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
262 # optional automatic mean filtering
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
263 if (is.null(opt$auto_mean_filter_off)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
264 independentFiltering <- TRUE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
265 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
266 independentFiltering <- FALSE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
267 if (verbose) cat("automatic filtering on the mean off\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
268 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
269
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
270 # shrinkage of LFCs
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
271 if (is.null(opt$beta_prior_off)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
272 betaPrior <- TRUE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
273 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
274 betaPrior <- FALSE
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
275 if (verbose) cat("beta prior off\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
276 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
277
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
278 # dispersion fit type
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
279 if (is.null(opt$fit_type)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
280 fitType <- "parametric"
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
281 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
282 fitType <- c("parametric","local","mean")[opt$fit_type]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
283 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
284
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
285 if (verbose) cat(paste("using disperion fit type:",fitType,"\n"))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
286
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
287 # run the analysis
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
288 dds <- DESeq(dds, fitType=fitType, betaPrior=betaPrior, minReplicatesForReplace=minRep)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
289
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
290 # create the generic plots and leave the device open
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
291 if (!is.null(opt$plots)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
292 if (verbose) cat("creating plots\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
293 pdf(opt$plots)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
294 generateGenericPlots(dds, factors)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
295 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
296
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
297 n <- nlevels(colData(dds)[[primaryFactor]])
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
298 allLevels <- levels(colData(dds)[[primaryFactor]])
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
299
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
300 if (!is.null(opt$countsfile)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
301 labs <- paste0(seq_len(ncol(dds)), ": ", do.call(paste, as.list(colData(dds)[factors])))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
302 normalizedCounts<-counts(dds,normalized=TRUE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
303 colnames(normalizedCounts)<-labs
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
304 write.table(normalizedCounts, file=opt$countsfile, sep="\t", col.names=NA, quote=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
305 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
306
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
307 if (is.null(opt$many_contrasts)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
308 # only contrast the first and second level of the primary factor
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
309 ref <- allLevels[1]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
310 lvl <- allLevels[2]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
311 res <- results(dds, contrast=c(primaryFactor, lvl, ref),
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
312 cooksCutoff=cooksCutoff,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
313 independentFiltering=independentFiltering)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
314 if (verbose) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
315 cat("summary of results\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
316 cat(paste0(primaryFactor,": ",lvl," vs ",ref,"\n"))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
317 print(summary(res))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
318 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
319 resSorted <- res[order(res$padj),]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
320 outDF <- as.data.frame(resSorted)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
321 outDF$geneID <- rownames(outDF)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
322 outDF <- outDF[,c("geneID", "baseMean", "log2FoldChange", "lfcSE", "stat", "pvalue", "padj")]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
323 filename <- opt$outfile
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
324 write.table(outDF, file=filename, sep="\t", quote=FALSE, row.names=FALSE, col.names=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
325 if (independentFiltering) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
326 threshold <- unname(attr(res, "filterThreshold"))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
327 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
328 threshold <- 0
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
329 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
330 title_suffix <- paste0(primaryFactor,": ",lvl," vs ",ref)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
331 if (!is.null(opt$plots)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
332 generateSpecificPlots(res, threshold, title_suffix)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
333 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
334 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
335 # rotate through the possible contrasts of the primary factor
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
336 # write out a sorted table of results with the contrast as a suffix
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
337 # add contrast specific plots to the device
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
338 for (i in seq_len(n-1)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
339 ref <- allLevels[i]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
340 contrastLevels <- allLevels[(i+1):n]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
341 for (lvl in contrastLevels) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
342 res <- results(dds, contrast=c(primaryFactor, lvl, ref),
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
343 cooksCutoff=cooksCutoff,
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
344 independentFiltering=independentFiltering)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
345 resSorted <- res[order(res$padj),]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
346 outDF <- as.data.frame(resSorted)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
347 outDF$geneID <- rownames(outDF)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
348 outDF <- outDF[,c("geneID", "baseMean", "log2FoldChange", "lfcSE", "stat", "pvalue", "padj")]
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
349 filename <- paste0(opt$outfile,".",primaryFactor,"_",lvl,"_vs_",ref)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
350 write.table(outDF, file=filename, sep="\t", quote=FALSE, row.names=FALSE, col.names=FALSE)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
351 if (independentFiltering) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
352 threshold <- unname(attr(res, "filterThreshold"))
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
353 } else {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
354 threshold <- 0
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
355 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
356 title_suffix <- paste0(primaryFactor,": ",lvl," vs ",ref)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
357 if (!is.null(opt$plots)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
358 generateSpecificPlots(res, threshold, title_suffix)
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
359 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
360 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
361 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
362 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
363
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
364 # close the plot device
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
365 if (!is.null(opt$plots)) {
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
366 cat("closing plot device\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
367 dev.off()
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
368 }
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
369
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
370 cat("Session information:\n\n")
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
371
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
372 sessionInfo()
4939397c4706 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 3bc8d91ee546682ef8e9303bd1044bb14cf21b07
iuc
parents:
diff changeset
373