annotate edgeR_Differential_Gene_Expression.xml @ 94:46745f5666ac draft

Added test
author yhoogstrate
date Sat, 28 Mar 2015 08:09:03 -0400
parents 31335aa52b2e
children 9dac2146b98c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
2 <tool id="edger_dge" name="edgeR: Differential Gene(Expression) Analysis" version="3.0.3-latest.d">
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
3 <description>RNA-Seq gene expression analysis using edgeR (R package)</description>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
4
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
5 <requirements>
67
6eb298a5561f Uploaded
yhoogstrate
parents: 65
diff changeset
6 <requirement type="package" version="3.0.3">R</requirement>
77
2ee2336d71cc Uploaded
yhoogstrate
parents: 75
diff changeset
7 <requirement type="package" version="latest">biocLite_edgeR_limma</requirement>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
8 </requirements>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
9
79
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
10 <version_command>R --vanilla --slave -e "library(edgeR) ; cat(sessionInfo()\$otherPkgs\$edgeR\$Version)" 2&gt; /dev/null</version_command>
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
11
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
12 <command>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
13 <!--
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
14 The following script is written in the "Cheetah" language:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
15 http://www.cheetahtemplate.org/docs/users_guide_html_multipage/contents.html
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
16 -->
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
17
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
18 R --vanilla --slave -f $R_script '--args
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
19 $expression_matrix
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
20 $design_matrix
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
21 $contrast
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
22
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
23 $fdr
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
24
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
25 $output_count_edgeR
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
26 $output_cpm
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
27
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
28 /dev/null <!-- Calculation of FPKM/RPKM should come here -->
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
29
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
30 #if $output_raw_counts:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
31 $output_raw_counts
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
32 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
33 /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
34 #end if
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
35
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
36 #if $output_MDSplot_logFC:
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
37 $output_MDSplot_logFC
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
38 #else:
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
39 /dev/null
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
40 #end if
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
41
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
42 #if $output_MDSplot_bcv:
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
43 $output_MDSplot_bcv
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
44 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
45 /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
46 #end if
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
47
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
48 #if $output_BCVplot:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
49 $output_BCVplot
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
50 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
51 /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
52 #end if
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
53
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
54 #if $output_MAplot:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
55 $output_MAplot
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
56 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
57 /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
58 #end if
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
59
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
60 #if $output_PValue_distribution_plot:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
61 $output_PValue_distribution_plot
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
62 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
63 /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
64 #end if
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
65
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
66 #if $output_hierarchical_clustering_plot:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
67 $output_hierarchical_clustering_plot
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
68 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
69 /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
70 #end if
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
71
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
72 #if $output_heatmap_plot:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
73 $output_heatmap_plot
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
74 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
75 /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
76 #end if
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
77
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
78 #if $output_RData_obj:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
79 $output_RData_obj
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
80 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
81 /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
82 #end if
55
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
83
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
84 $output_format_images
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
85 '
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
86 #if $output_R:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
87 > $output_R
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
88 #else:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
89 > /dev/null
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
90 #end if
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
91
94
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
92 <!--
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
93 2> stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
94
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
95 grep -v 'Calculating library sizes from column' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
96
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
97 ## Locale error messages:
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
98 grep -v 'During startup - Warning messages' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
99 grep -v 'Setting LC_TIME failed' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
100 grep -v 'Setting LC_MONETARY failed' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
101 grep -v 'Setting LC_PAPER failed' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
102 grep -v 'Setting LC_MEASUREMENT failed' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
103 grep -v 'Setting LC_CTYPE failed' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
104 grep -v 'Setting LC_COLLATE failed' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ;
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
105
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
106 cat stderr.txt >&amp;2
94
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
107 -->
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
108 </command>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
109
94
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
110 <stdio>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
111 <regex match="Calculating library sizes from column"
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
112 source="stderr"
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
113 level="log" />
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
114 <regex match="During startup - Warning messages"
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
115 source="stderr"
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
116 level="log" />
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
117 <regex match="Setting LC_[^ ]+ failed"
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
118 source="stderr"
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
119 level="warning"
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
120 description="LOCALE has not been set correctly" />
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
121 </stdio>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
122
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
123 <inputs>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
124 <param name="expression_matrix" type="data" format="tabular" label="Expression (read count) matrix" />
94
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
125 <param name="design_matrix" type="data" format="tabular" label="Design matrix" help="Ensure your samplenames are identical to those in the expression matrix. Preferentially, create the contrast matrix using 'edgeR: Design- from Expression matrix'." />
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
126
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
127 <param name="contrast" type="text" label="Contrast (biological question)" help="e.g. 'tumor-normal' or '(G1+G2)/2-G3' using the factors chosen in the design matrix. Read the 'makeContrasts' manual from Limma package for more info: http://www.bioconductor.org/packages/release/bioc/html/limma.html and http://www.bioconductor.org/packages/release/bioc/vignettes/limma/inst/doc/usersguide.pdf." />
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
128
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
129 <param name="fdr" type="float" min="0" max="1" value="0.05" label="False Discovery Rate (FDR)" />
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
130
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
131 <param name="outputs" type="select" label="Optional desired outputs" multiple="true" display="checkboxes">
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
132 <option value="make_output_raw_counts">Raw counts table</option>
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
133 <option value="make_output_MDSplot_logFC">MDS-plot (logFC-method)</option>
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
134 <option value="make_output_MDSplot_bcv">MDS-plot (BCV-method; much slower)</option>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
135 <option value="make_output_BCVplot">BCV-plot</option>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
136 <option value="make_output_MAplot">MA-plot</option>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
137 <option value="make_output_PValue_distribution_plot">P-Value distribution plot</option>
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
138 <option value="make_output_hierarchical_clustering_plot">Hierarchical custering (under contstruction)</option>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
139 <option value="make_output_heatmap_plot">Heatmap</option>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
140
43
c6e787bb605c Uploaded
yhoogstrate
parents: 42
diff changeset
141 <option value="make_output_R_stdout">R stdout</option>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
142 <option value="make_output_RData_obj">R Data object</option>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
143 </param>
55
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
144
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
145 <param name="output_format_images" type="select" label="Output format of images" display="radio">
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
146 <option value="png">Portable network graphics (.png)</option>
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
147 <option value="pdf">Portable document format (.pdf)</option>
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
148 <option value="svg">Scalable vector graphics (.svg)</option>
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
149 </param>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
150 </inputs>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
151
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
152 <configfiles>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
153 <configfile name="R_script">
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
154 library(limma,quietly=TRUE) ## enable quietly to avoid unnecessaity stderr dumping
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
155 library(edgeR,quietly=TRUE) ## enable quietly to avoid unnecessaity stderr dumping
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
156 library(splines,quietly=TRUE) ## enable quietly to avoid unnecessaity stderr dumping
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
157
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
158 ## Fetch commandline arguments
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
159 args &lt;- commandArgs(trailingOnly = TRUE)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
160
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
161 expression_matrix_file = args[1]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
162 design_matrix_file = args[2]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
163 contrast = args[3]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
164
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
165 fdr = args[4]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
166
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
167 output_count_edgeR = args[5]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
168 output_cpm = args[6]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
169
43
c6e787bb605c Uploaded
yhoogstrate
parents: 42
diff changeset
170 output_xpkm = args[7] ##FPKM file - yet to be implemented
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
171
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
172 output_raw_counts = args[8]
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
173 output_MDSplot_logFC = args[9]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
174 output_MDSplot_bcv = args[10]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
175 output_BCVplot = args[11]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
176 output_MAplot = args[12]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
177 output_PValue_distribution_plot = args[13]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
178 output_hierarchical_clustering_plot = args[14]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
179 output_heatmap_plot = args[15]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
180 output_RData_obj = args[16]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
181 output_format_images = args[17]
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
182
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
183
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
184 library(edgeR)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
185 ##raw_data &lt;- read.delim(designmatrix,header=T,stringsAsFactors=T)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
186 ## Obtain read-counts
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
187
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
188 expression_matrix &lt;- read.delim(expression_matrix_file,header=T,stringsAsFactors=F,row.names=1,check.names=FALSE,na.strings=c(""))
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
189 design_matrix &lt;- read.delim(design_matrix_file,header=T,stringsAsFactors=F,row.names=1,check.names=FALSE,na.strings=c(""))
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
190
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
191 colnames(design_matrix) &lt;- make.names(colnames(design_matrix))
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
192
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
193 for(i in 1:ncol(design_matrix)) {
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
194 old &lt;- design_matrix[,i]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
195 design_matrix[,i] &lt;- make.names(design_matrix[,i])
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
196 if(paste(design_matrix[,i],collapse="\t") != paste(old,collapse="\t")) {
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
197 print("Renaming of factors:")
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
198 print(old)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
199 print("To:")
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
200 print(design_matrix[,i])
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
201 }
45
f710e5ed7cea Uploaded
yhoogstrate
parents: 44
diff changeset
202 ## The following line seems to malfunction the script:
f710e5ed7cea Uploaded
yhoogstrate
parents: 44
diff changeset
203 ##design_matrix[,i] &lt;- as.factor(design_matrix[,i])
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
204 }
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
205
44
261b997b241f Uploaded
yhoogstrate
parents: 43
diff changeset
206 ## 1) In the expression matrix, you only want to have the samples described in the design matrix
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
207 columns &lt;- match(rownames(design_matrix),colnames(expression_matrix))
43
c6e787bb605c Uploaded
yhoogstrate
parents: 42
diff changeset
208 columns &lt;- columns[!is.na(columns)]
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
209 read_counts &lt;- expression_matrix[,columns]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
210
44
261b997b241f Uploaded
yhoogstrate
parents: 43
diff changeset
211 ## 2) In the design matrix, you only want to have samples of which you really have the counts
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
212 columns &lt;- match(colnames(read_counts),rownames(design_matrix))
44
261b997b241f Uploaded
yhoogstrate
parents: 43
diff changeset
213 columns &lt;- columns[!is.na(columns)]
261b997b241f Uploaded
yhoogstrate
parents: 43
diff changeset
214 design_matrix &lt;- design_matrix[columns,,drop=FALSE]
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
215
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
216 ## Filter for HTSeq predifined counts:
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
217 exclude_HTSeq &lt;- c("no_feature","ambiguous","too_low_aQual","not_aligned","alignment_not_unique")
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
218 exclude_DEXSeq &lt;- c("_ambiguous","_empty","_lowaqual","_notaligned")
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
219
44
261b997b241f Uploaded
yhoogstrate
parents: 43
diff changeset
220 exclude &lt;- match(c(exclude_HTSeq, exclude_DEXSeq),rownames(read_counts))
261b997b241f Uploaded
yhoogstrate
parents: 43
diff changeset
221 exclude &lt;- exclude[is.na(exclude)==0]
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
222 if(length(exclude) != 0) {
44
261b997b241f Uploaded
yhoogstrate
parents: 43
diff changeset
223 read_counts &lt;- read_counts[-exclude,]
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
224 }
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
225
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
226
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
227 ## sorting expression matrix with the order of the read_counts
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
228 ##order &lt;- match(colnames(read_counts) , rownames(design_matrix))
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
229 ##read_counts_ordered &lt;- read_counts[,order2]
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
230
44
261b997b241f Uploaded
yhoogstrate
parents: 43
diff changeset
231 empty_samples &lt;- apply(read_counts,2,function(x) sum(x) == 0)
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
232 if(sum(empty_samples) > 0) {
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
233 write(paste("There are ",sum(empty_samples)," empty samples found:",sep=""),stderr())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
234 write(colnames(read_counts)[empty_samples],stderr())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
235 } else {
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
236
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
237 dge &lt;- DGEList(counts=read_counts,genes=rownames(read_counts))
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
238
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
239 formula &lt;- paste(c("~0",make.names(colnames(design_matrix))),collapse = " + ")
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
240 design_matrix_tmp &lt;- design_matrix
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
241 colnames(design_matrix_tmp) &lt;- make.names(colnames(design_matrix_tmp))
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
242 design &lt;- model.matrix(as.formula(formula),design_matrix_tmp)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
243 rm(design_matrix_tmp)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
244
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
245 # Filter prefixes
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
246 prefixes = colnames(design_matrix)[attr(design,"assign")]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
247 avoid = nchar(prefixes) == nchar(colnames(design))
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
248 replacements = substr(colnames(design),nchar(prefixes)+1,nchar(colnames(design)))
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
249 replacements[avoid] = colnames(design)[avoid]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
250 colnames(design) = replacements
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
251
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
252 # Do normalization
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
253 write("Calculating normalization factors...",stdout())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
254 dge &lt;- calcNormFactors(dge)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
255 write("Estimating common dispersion...",stdout())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
256 dge &lt;- estimateGLMCommonDisp(dge,design)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
257 write("Estimating trended dispersion...",stdout())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
258 dge &lt;- estimateGLMTrendedDisp(dge,design)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
259 write("Estimating tagwise dispersion...",stdout())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
260 dge &lt;- estimateGLMTagwiseDisp(dge,design)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
261
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
262
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
263 if(output_MDSplot_logFC != "/dev/null") {
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
264 write("Creating MDS plot (logFC method)",stdout())
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
265 points &lt;- plotMDS.DGEList(dge,top=500,labels=rep("",nrow(dge\$samples)))# Get coordinates of unflexible plot
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
266 dev.off()# Kill it
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
267
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
268 if(output_format_images == "pdf") {
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
269 pdf(output_MDSplot_logFC,height=14,width=14)
55
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
270 } else if(output_format_images == "svg") {
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
271 svg(output_MDSplot_logFC,height=14,width=14)
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
272 } else {
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
273 ## png(output_MDSplot_logFC)
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
274 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
275
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
276 bitmap(output_MDSplot_logFC,type="png16m",height=14,width=14)
70
fb64bf85361d Uploaded
yhoogstrate
parents: 69
diff changeset
277 }
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
278
55
8c63794c3d3e Uploaded
yhoogstrate
parents: 53
diff changeset
279
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
280 diff_x &lt;- abs(max(points\$x)-min(points\$x))
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
281 diff_y &lt;-(max(points\$y)-min(points\$y))
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
282 plot(c(min(points\$x),max(points\$x) + 0.45 * diff_x), c(min(points\$y) - 0.05 * diff_y,max(points\$y) + 0.05 * diff_y), main="edgeR logFC-MDS Plot on top 500 genes",type="n", xlab="Leading logFC dim 1", ylab="Leading logFC dim 2")
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
283 points(points\$x,points\$y,pch=20)
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
284 text(points\$x, points\$y,rownames(dge\$samples),cex=1.25,col="gray",pos=4)
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
285 rm(diff_x,diff_y)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
286
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
287 dev.off()
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
288 }
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
289
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
290 if(output_MDSplot_bcv != "/dev/null") {
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
291 write("Creating MDS plot (bcv method)",stdout())
93
31335aa52b2e Uploaded
yhoogstrate
parents: 91
diff changeset
292
31335aa52b2e Uploaded
yhoogstrate
parents: 91
diff changeset
293 ## 1. First create a virtual plot to obtain the desired coordinates
31335aa52b2e Uploaded
yhoogstrate
parents: 91
diff changeset
294 pdf("bcvmds.pdf")
31335aa52b2e Uploaded
yhoogstrate
parents: 91
diff changeset
295 points &lt;- plotMDS.DGEList(dge,method="bcv",top=500,labels=rep("",nrow(dge\$samples)))
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
296 dev.off()# Kill it
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
297
93
31335aa52b2e Uploaded
yhoogstrate
parents: 91
diff changeset
298 ## 2. Re-plot the coordinates in a new figure with the size and settings.
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
299 if(output_format_images == "pdf") {
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
300 pdf(output_MDSplot_bcv,height=14,width=14)
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
301 } else if(output_format_images == "svg") {
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
302 svg(output_MDSplot_bcv,height=14,width=14)
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
303 } else {
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
304 ## png(output_MDSplot_bcv)
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
305 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
306
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
307 bitmap(output_MDSplot_bcv,type="png16m",height=14,width=14)
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
308 }
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
309
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
310 diff_x &lt;- abs(max(points\$x)-min(points\$x))
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
311 diff_y &lt;-(max(points\$y)-min(points\$y))
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
312 plot(c(min(points\$x),max(points\$x) + 0.45 * diff_x), c(min(points\$y) - 0.05 * diff_y,max(points\$y) + 0.05 * diff_y), main="edgeR BCV-MDS Plot",type="n", xlab="Leading BCV dim 1", ylab="Leading BCV dim 2")
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
313 points(points\$x,points\$y,pch=20)
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
314 text(points\$x, points\$y,rownames(dge\$samples),cex=1.25,col="gray",pos=4)
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
315 rm(diff_x,diff_y)
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
316
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
317 dev.off()
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
318 }
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
319
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
320
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
321 if(output_BCVplot != "/dev/null") {
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
322 write("Creating Biological coefficient of variation plot",stdout())
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
323
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
324 if(output_format_images == "pdf") {
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
325 pdf(output_BCVplot)
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
326 } else if(output_format_images == "svg") {
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
327 svg(output_BCVplot)
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
328 } else {
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
329 ## png(output_BCVplot)
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
330 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
331
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
332 bitmap(output_BCVplot,type="png16m")
70
fb64bf85361d Uploaded
yhoogstrate
parents: 69
diff changeset
333 }
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
334
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
335 plotBCV(dge, cex=0.4, main="edgeR: Biological coefficient of variation (BCV) vs abundance")
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
336 dev.off()
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
337 }
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
338
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
339
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
340 write("Fitting GLM...",stdout())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
341 fit &lt;- glmFit(dge,design)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
342
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
343 write(paste("Performing likelihood ratio test: ",contrast,sep=""),stdout())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
344 cont &lt;- c(contrast)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
345 cont &lt;- makeContrasts(contrasts=cont, levels=design)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
346
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
347 lrt &lt;- glmLRT(fit, contrast=cont[,1])
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
348 write(paste("Exporting to file: ",output_count_edgeR,sep=""),stdout())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
349 write.table(file=output_count_edgeR,topTags(lrt,n=nrow(read_counts))\$table,sep="\t",row.names=TRUE,col.names=NA)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
350 write.table(file=output_cpm,cpm(dge,normalized.lib.sizes=TRUE),sep="\t",row.names=TRUE,col.names=NA)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
351
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
352 ## todo EXPORT FPKM
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
353 write.table(file=output_raw_counts,dge\$counts,sep="\t",row.names=TRUE,col.names=NA)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
354
34
a36a9af266e5 Uploaded
yhoogstrate
parents: 33
diff changeset
355 if(output_MAplot != "/dev/null" || output_PValue_distribution_plot != "/dev/null") {
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
356 etable &lt;- topTags(lrt, n=nrow(dge))\$table
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
357 etable &lt;- etable[order(etable\$FDR), ]
32
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
358
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
359 if(output_MAplot != "/dev/null") {
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
360 write("Creating MA plot...",stdout())
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
361
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
362 if(output_format_images == "pdf") {
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
363 pdf(output_MAplot)
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
364 } else if(output_format_images == "svg") {
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
365 svg(output_MAplot)
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
366 } else {
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
367 ## png(output_MAplot)
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
368 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
369
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
370 bitmap(output_MAplot,type="png16m")
70
fb64bf85361d Uploaded
yhoogstrate
parents: 69
diff changeset
371 }
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
372
32
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
373 with(etable, plot(logCPM, logFC, pch=20, main="edgeR: Fold change vs abundance"))
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
374 with(subset(etable, FDR &lt; fdr), points(logCPM, logFC, pch=20, col="red"))
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
375 abline(h=c(-1,1), col="blue")
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
376 dev.off()
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
377 }
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
378
32
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
379 if(output_PValue_distribution_plot != "/dev/null") {
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
380 write("Creating P-value distribution plot...",stdout())
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
381
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
382 if(output_format_images == "pdf") {
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
383 pdf(output_PValue_distribution_plot,width=14,height=14)
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
384 } else if(output_format_images == "svg") {
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
385 svg(output_PValue_distribution_plot,width=14,height=14)
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
386 } else {
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
387 ## png(output_PValue_distribution_plot)
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
388 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
389
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
390 bitmap(output_PValue_distribution_plot,type="png16m",width=14,height=14)
70
fb64bf85361d Uploaded
yhoogstrate
parents: 69
diff changeset
391 }
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
392
32
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
393 expressed_genes &lt;- subset(etable, PValue &lt; 0.99)
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
394 h &lt;- hist(expressed_genes\$PValue,breaks=nrow(expressed_genes)/15,main="Binned P-Values (&lt; 0.99)")
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
395 center &lt;- sum(h\$counts) / length(h\$counts)
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
396 lines(c(0,1),c(center,center),lty=2,col="red",lwd=2)
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
397 k &lt;- ksmooth(h\$mid, h\$counts)
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
398 lines(k\$x,k\$y,col="red",lwd=2)
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
399 rmsd &lt;- (h\$counts) - center
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
400 rmsd &lt;- rmsd^2
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
401 rmsd &lt;- sum(rmsd)
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
402 rmsd &lt;- sqrt(rmsd)
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
403 text(0,max(h\$counts),paste("e=",round(rmsd,2),sep=""),pos=4,col="blue")
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
404 ## change e into epsilon somehow
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
405 dev.off()
87bf067cfc53 Uploaded
yhoogstrate
parents: 29
diff changeset
406 }
40
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
407 }
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
408
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
409 if(output_heatmap_plot != "/dev/null") {
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
410
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
411 if(output_format_images == "pdf") {
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
412 pdf(output_heatmap_plot,width=10.5)
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
413 } else if(output_format_images == "svg") {
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
414 svg(output_heatmap_plot,width=10.5)
91
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
415 } else {
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
416 ## png(output_heatmap_plot)
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
417 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
418
c81da57fff20 Uploaded
yhoogstrate
parents: 90
diff changeset
419 bitmap(output_heatmap_plot,type="png16m",width=10.5)
70
fb64bf85361d Uploaded
yhoogstrate
parents: 69
diff changeset
420 }
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
421
40
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
422 etable2 &lt;- topTags(lrt, n=100)\$table
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
423 order &lt;- rownames(etable2)
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
424 cpm_sub &lt;- cpm(dge,normalized.lib.sizes=TRUE,log=TRUE)[as.numeric(order),]
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
425 heatmap(t(cpm_sub))
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
426 dev.off()
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
427 }
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
428
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
429 ##output_hierarchical_clustering_plot = args[13]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
430
35
fab87cecb3e5 Uploaded
yhoogstrate
parents: 34
diff changeset
431 if(output_RData_obj != "/dev/null") {
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
432 save.image(output_RData_obj)
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
433 }
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
434
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
435 write("Done!",stdout())
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
436 }
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
437 </configfile>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
438 </configfiles>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
439
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
440 <outputs>
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
441 <data format="tabular" name="output_count_edgeR" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - differentially expressed genes" />
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
442 <data format="tabular" name="output_cpm" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - CPM" />
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
443
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
444 <data format="tabular" name="output_raw_counts" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - raw counts">
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
445 <filter>outputs and ("make_output_raw_counts" in outputs)</filter>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
446 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
447
89
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
448 <data format="png" name="output_MDSplot_logFC" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - MDS-plot (logFC method)">
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
449 <filter>outputs and ("make_output_MDSplot_logFC" in outputs)</filter>
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
450
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
451 <change_format>
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
452 <when input="output_format_images" value="png" format="png" />
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
453 <when input="output_format_images" value="pdf" format="pdf" />
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
454 <when input="output_format_images" value="svg" format="svg" />
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
455 </change_format>
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
456 </data>
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
457
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
458 <data format="png" name="output_MDSplot_bcv" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - MDS-plot (bcv method)">
875f080136b6 Solved a very serious bug: if contrast and design matrix described samples not in the same order, statistical analysis goes wrong
yhoogstrate
parents: 83
diff changeset
459 <filter>outputs and ("make_output_MDSplot_bcv" in outputs)</filter>
59
f20dc31afd5e Uploaded
yhoogstrate
parents: 57
diff changeset
460
f20dc31afd5e Uploaded
yhoogstrate
parents: 57
diff changeset
461 <change_format>
f20dc31afd5e Uploaded
yhoogstrate
parents: 57
diff changeset
462 <when input="output_format_images" value="png" format="png" />
f20dc31afd5e Uploaded
yhoogstrate
parents: 57
diff changeset
463 <when input="output_format_images" value="pdf" format="pdf" />
f20dc31afd5e Uploaded
yhoogstrate
parents: 57
diff changeset
464 <when input="output_format_images" value="svg" format="svg" />
f20dc31afd5e Uploaded
yhoogstrate
parents: 57
diff changeset
465 </change_format>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
466 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
467
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
468 <data format="png" name="output_BCVplot" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - BCV-plot">
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
469 <filter>outputs and ("make_output_BCVplot" in outputs)</filter>
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
470
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
471 <change_format>
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
472 <when input="output_format_images" value="png" format="png" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
473 <when input="output_format_images" value="pdf" format="pdf" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
474 <when input="output_format_images" value="svg" format="svg" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
475 </change_format>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
476 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
477
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
478 <data format="png" name="output_MAplot" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - MA-plot">
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
479 <filter>outputs and ("make_output_MAplot" in outputs)</filter>
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
480
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
481 <change_format>
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
482 <when input="output_format_images" value="png" format="png" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
483 <when input="output_format_images" value="pdf" format="pdf" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
484 <when input="output_format_images" value="svg" format="svg" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
485 </change_format>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
486 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
487
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
488 <data format="png" name="output_PValue_distribution_plot" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - P-Value distribution">
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
489 <filter>outputs and ("make_output_PValue_distribution_plot" in outputs)</filter>
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
490
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
491 <change_format>
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
492 <when input="output_format_images" value="png" format="png" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
493 <when input="output_format_images" value="pdf" format="pdf" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
494 <when input="output_format_images" value="svg" format="svg" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
495 </change_format>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
496 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
497
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
498 <data format="png" name="output_hierarchical_clustering_plot" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - Hierarchical custering">
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
499 <filter>outputs and ("make_output_hierarchical_clustering_plot" in outputs)</filter>
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
500
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
501 <change_format>
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
502 <when input="output_format_images" value="png" format="png" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
503 <when input="output_format_images" value="pdf" format="pdf" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
504 <when input="output_format_images" value="svg" format="svg" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
505 </change_format>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
506 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
507
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
508 <data format="png" name="output_heatmap_plot" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - Heatmap">
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
509 <filter>outputs and ("make_output_heatmap_plot" in outputs)</filter>
60
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
510
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
511 <change_format>
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
512 <when input="output_format_images" value="png" format="png" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
513 <when input="output_format_images" value="pdf" format="pdf" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
514 <when input="output_format_images" value="svg" format="svg" />
c5cc1b24f7d8 Uploaded
yhoogstrate
parents: 59
diff changeset
515 </change_format>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
516 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
517
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
518 <data format="RData" name="output_RData_obj" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - R data object">
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
519 <filter>outputs and ("make_output_RData_obj" in outputs)</filter>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
520 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
521
40
d9c9caf4e182 Uploaded
yhoogstrate
parents: 39
diff changeset
522 <data format="txt" name="output_R" label="edgeR DGE on ${design_matrix.hid}: ${design_matrix.name} - R output (debug)" >
53
b89788eead3c Uploaded
yhoogstrate
parents: 45
diff changeset
523 <filter>outputs and ("make_output_R_stdout" in outputs)</filter>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
524 </data>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
525 </outputs>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
526
94
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
527 <tests>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
528 <test>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
529 <param name="expression_matrix" value="Differential_Gene_Expression/expression_matrix.tabular.txt" />
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
530 <param name="design_matrix" value="Differential_Gene_Expression/design_matrix.tabular.txt" />
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
531
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
532 <param name="contrast" value="E-C"/>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
533
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
534 <param name="fdr" value="0.05" />
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
535
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
536 <param name="output_format_images" value="png" />
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
537
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
538 <output name="output_count_edgeR" file="Differential_Gene_Expression/differentially_expressed_genes.tabular.txt" />
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
539 </test>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
540 </tests>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
541
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
542 <help>
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
543 edgeR: Differential Gene(Expression) Analysis
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
544 #############################################
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
545
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
546 Overview
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
547 --------
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
548 Differential expression analysis of RNA-seq and digital gene expression profiles with biological replication. Uses empirical Bayes estimation and exact tests based on the negative binomial distribution. Also useful for differential signal analysis with other types of genome-scale count data [1].
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
549
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
550 For every experiment, the algorithm requires a design matrix. This matrix describes which samples belong to which groups.
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
551 More details on this are given in the edgeR manual: http://www.bioconductor.org/packages/2.12/bioc/vignettes/edgeR/inst/doc/edgeRUsersGuide.pdf
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
552 and the limma manual.
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
553
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
554 Because the creation of a design matrix can be complex and time consuming, especially if no GUI is used, this package comes with an alternative tool which can help you with it.
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
555 This tool is called *edgeR Design Matrix Creator*.
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
556 If the appropriate design matrix (with corresponding links to the files) is given,
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
557 the correct contrast ( http://en.wikipedia.org/wiki/Contrast_(statistics) ) has to be given.
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
558
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
559 If you have for example two groups, with an equal weight, you would like to compare either
79
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
560 "g1-g2" or "normal-cancer".
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
561
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
562 The test function makes use of a MCF7 dataset used in a study that indicates that a higher sequencing depth is not neccesairily more important than a higher amount of replaciates[2].
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
563
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
564 Input
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
565 -----
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
566 Expression matrix
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
567 ^^^^^^^^^^^^^^^^^
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
568 ::
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
569
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
570 Geneid "\t" Sample-1 "\t" Sample-2 "\t" Sample-3 "\t" Sample-4 [...] "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
571 SMURF "\t" 123 "\t" 21 "\t" 34545 "\t" 98 ... "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
572 BRCA1 "\t" 435 "\t" 6655 "\t" 45 "\t" 55 ... "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
573 LINK33 "\t" 4 "\t" 645 "\t" 345 "\t" 1 ... "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
574 SNORD78 "\t" 498 "\t" 65 "\t" 98 "\t" 27 ... "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
575 [...]
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
576
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
577 *Note: Make sure the number of columns in the header is identical to the number of columns in the body.*
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
578
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
579 Design matrix
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
580 ^^^^^^^^^^^^^
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
581 ::
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
582
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
583 Sample "\t" Condition "\t" Ethnicity "\t" Patient "\t" Batch "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
584 Sample-1 "\t" Tumor "\t" European "\t" 1 "\t" 1 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
585 Sample-2 "\t" Normal "\t" European "\t" 1 "\t" 1 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
586 Sample-3 "\t" Tumor "\t" European "\t" 2 "\t" 1 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
587 Sample-4 "\t" Normal "\t" European "\t" 2 "\t" 1 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
588 Sample-5 "\t" Tumor "\t" African "\t" 3 "\t" 1 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
589 Sample-6 "\t" Normal "\t" African "\t" 3 "\t" 1 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
590 Sample-7 "\t" Tumor "\t" African "\t" 4 "\t" 2 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
591 Sample-8 "\t" Normal "\t" African "\t" 4 "\t" 2 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
592 Sample-9 "\t" Tumor "\t" Asian "\t" 5 "\t" 2 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
593 Sample-10 "\t" Normal "\t" Asian "\t" 5 "\t" 2 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
594 Sample-11 "\t" Tumor "\t" Asian "\t" 6 "\t" 2 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
595 Sample-12 "\t" Normal "\t" Asian "\t" 6 "\t" 2 "\n"
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
596
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
597 *Note: Avoid factor names that are (1) numerical, (2) contain mathematical symbols and preferebly only use letters.*
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
598
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
599 Contrast
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
600 ^^^^^^^^
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
601 The contrast represents the biological question. There can be many questions asked, e.g.:
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
602
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
603 - Tumor-Normal
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
604 - African-European
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
605 - 0.5*(Control+Placebo) / Treated
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
606
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
607 Installation
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
608 ------------
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
609
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
610 This tool requires no specific configurations. The following dependencies are installed automatically:
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
611
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
612 - R
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
613 - Bioconductor
79
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
614 - limma
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
615 - edgeR
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
616
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
617 License
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
618 -------
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
619 - R
79
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
620 - GPL 2 &amp; GPL 3
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
621 - limma
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
622 - GPL (&gt;=2)
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
623 - edgeR
79
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
624 - GPL (&gt;=2)
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
625
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
626 References
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
627 ----------
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
628
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
629 EdgeR
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
630 ^^^^^
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
631 **[1] edgeR: a Bioconductor package for differential expression analysis of digital gene expression data.**
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
632
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
633 *Mark D. Robinson, Davis J. McCarthy and Gordon K. Smyth* - Bioinformatics (2010) 26 (1): 139-140.
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
634
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
635 - http://www.bioconductor.org/packages/2.12/bioc/html/edgeR.html
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
636 - http://dx.doi.org/10.1093/bioinformatics/btp616
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
637 - http://www.bioconductor.org/packages/release/bioc/html/edgeR.html
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
638
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
639 Test-data (MCF7)
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
640 ^^^^^^^^^^^^^^^^
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
641 **[2] RNA-seq differential expression studies: more sequence or more replication?**
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
642
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
643 *Yuwen Liu, Jie Zhou and Kevin P. White* - Bioinformatics (2014) 30 (3): 301-304.
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
644
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
645 - http://www.ncbi.nlm.nih.gov/pubmed/24319002
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
646 - http://dx.doi.org/10.1093/bioinformatics/btt688
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
647
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
648 Contact
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
649 -------
79
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
650
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
651 The tool wrapper has been written by Youri Hoogstrate from the Erasmus
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
652 Medical Center (Rotterdam, Netherlands) on behalf of the Translational
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
653 Research IT (TraIT) project:
83
b2738b4d7c8c Uploaded
yhoogstrate
parents: 79
diff changeset
654
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
655 http://www.ctmm.nl/en/programmas/infrastructuren/traitprojecttranslationeleresearch
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
656
79
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
657 More tools by the Translational Research IT (TraIT) project can be found
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
658 in the following toolsheds:
83
b2738b4d7c8c Uploaded
yhoogstrate
parents: 79
diff changeset
659
b2738b4d7c8c Uploaded
yhoogstrate
parents: 79
diff changeset
660 http://toolshed.dtls.nl/
b2738b4d7c8c Uploaded
yhoogstrate
parents: 79
diff changeset
661
b2738b4d7c8c Uploaded
yhoogstrate
parents: 79
diff changeset
662 http://toolshed.g2.bx.psu.edu
b2738b4d7c8c Uploaded
yhoogstrate
parents: 79
diff changeset
663
b2738b4d7c8c Uploaded
yhoogstrate
parents: 79
diff changeset
664 http://testtoolshed.g2.bx.psu.edu/
79
c86f1f86b3c1 Uploaded
yhoogstrate
parents: 77
diff changeset
665
36
185effd01633 Uploaded
yhoogstrate
parents: 35
diff changeset
666 I would like to thank Hina Riaz - Naz Khan for her helpful contribution.
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
667 </help>
94
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
668
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
669 <citations>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
670 <citation type="doi">10.1093/bioinformatics/btp616</citation>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
671 <citation type="doi">10.1093/bioinformatics/btt688</citation>
46745f5666ac Added test
yhoogstrate
parents: 93
diff changeset
672 </citations>
25
7cb518091b18 Uploaded
yhoogstrate
parents:
diff changeset
673 </tool>