-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_pca.xml
More file actions
281 lines (222 loc) · 8.78 KB
/
plot_pca.xml
File metadata and controls
281 lines (222 loc) · 8.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!--# Copyright (C) 2017 INRA
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#-->
<tool id="plot_pca" name="Plot PCA" version="1.0.0">
<description>PCA analysis</description>
<requirements>
<requirement type="package">R</requirement>
<requirement type="package">r-optparse</requirement>
<requirement type="package">r-reshape</requirement>
<requirement type="package">r-ggplot2</requirement>
<requirement type="package">r-gridextra</requirement>
<requirement type="package">r-scatterplot3d</requirement>
</requirements>
<stdio>
<!-- Anything other than zero is an error -->
<exit_code range="1:" level="fatal"/>
<exit_code range=":-1" level="fatal"/>
</stdio>
<command><![CDATA[
Rscript $__tool_directory__/plot_pca.R
--input_matrix $input_matrix
#if $log_cond.log10:
-l $log_cond.pseudocount
#end if
#if $height
--height $height
#end if
#if $width
--width $width
#end if
#if $output
--output $output
#end if
#if $metadata_cond.metadata:
--metadata
$metadata_cond.input_metadata
#for $i, $s in enumerate( $metadata_cond.series )
,${s.input_metadata2}
#end for
#if $metadata_cond.color_by
--color_by $metadata_cond.color_by
#end if
#if $metadata_cond.shape_by
--shape_by $metadata_cond.shape_by
#end if
#end if
--border
--palette=$__tool_directory__/rainbow.3.txt
&&
cp *.pdf $outputfile
]]></command>
<inputs>
<param argument="--input_matrix" type="data" format="csv,tabular" label="Input Matrix"/>
<conditional name="log_cond">
<param name="log10" type="boolean" checked="false" truevalue="True" falsevalue="" label="Apply the log10" help="Default=No"/>
<when value="True">
<param name="pseudocount" type="float" value="1e-04" help="Default=1e-04" />
</when>
</conditional>
<conditional name="metadata_cond">
<param name="metadata" type="boolean" checked="false" truevalue="Yes" falsevalue="" label="Add file with metadata on matrix experiment?" help="must countain a key column named 'labExpId"/>
<when value="Yes">
<param name="input_metadata" type="data" format="tsv" label="Input Metadata file"/>
<repeat name="series" title="Others Input Metadata files">
<param name="input_metadata2" type="data" format="tsv" label="Other Input Metadata file"/>
</repeat>
<param argument="--color_by" type="text" label="Choose the fields in the metadata you want to color by" />
<param argument="--shape_by" type="text" label="Choose the fields in the metadata you want to shape by" />
</when>
</conditional>
<param argument="--height" size="20" type="integer" value="7" label="Height of the plot in inches" />
<param argument="--width" size="20" type="integer" value="7" label="Width of the plot in inches" />
<param argument="--output" type="text" label="Output name" help="[Optional] Specify the project label for your outputs. By default it will be the name of your input file."/>
</inputs>
<outputs>
<data format="pdf" name="outputfile" label ="#if str($output)=='' then os.path.splitext(str($input_matrix.name))[0] else $output #_PCA.pdf"/>
</outputs>
<tests>
<test>
<param name="input_matrix" value="decathlon.tsv" />
<conditional name="log_cond">
<param name="log10" value="True" />
<param name="pseudocount" value="1e-04" />
</conditional>
<conditional name="metadata_cond">
<param name="metadata" value="" />
</conditional>
<param name="height" value="7" />
<param name="width" value="7" />
<param name="output" value="" />
<output name="outputfile" file="output" compare="sim_size" />
</test>
</tests>
<help><![CDATA[
========
Plot PCA
========
-----------
Description
-----------
Plot a Principal Component Analysis (PCA) from a data matrix
-----------
Input files
-----------
+---------------------------+----------------+
| Parameter : num + label | Format |
+===========================+================+
| 1 : Input matrix | csv,tabular |
+---------------------------+----------------+
----------
Parameters
----------
Apply the log 10
| To normalize your data
|
(?)Add file with metadata on matrix experiment?
| To ad metadata to the analysis
|
Input Metadata file
| Must countain a key column named labExpId
|
Others Metadata files
|
Choose the fields in the metadata you want to color by
|
Choose the fields in the metadata you want to shape by
|
Height of the plot in inches
| default 7 inches
|
Width of the plot in inches
| default 7 inches
|
Output name
| Specify the project label for your outputs. By default it will be the name of your input file
|
------------
Output files
------------
<Input Name>_PCA.pdf
| Pdf file containing your PCA plot
------
**Authors**
Alessandra Breschi (alessandra.breschi@crg.eu);
Sarah Djebali (sarah.djebali-quelen@inra.fr);
Valentin Marcon (valentin.marcon@inra.fr)
Contact : sigenae-support@listes.inra.fr
-------------
Please cite :
-------------
- (Depending on the help provided you can cite us in acknowledgements)
Acknowledgements
| We wish to thank : Alessandra Breschi, Sarah Djebali (Centre for Genomic Regulation - http://www.crg.eu/), and Valentin Marcon (Migale platform - http://migale.jouy.inra.fr/)
------
.. class:: infomark
Usage: ./plot_pca.R [options] file
Options:
-i INPUT_MATRIX, --input_matrix=INPUT_MATRIX
the matrix you want to analyze. Can be stdin
-l, --log10
apply the log [default=FALSE]
-p PSEUDOCOUNT, --pseudocount=PSEUDOCOUNT
specify a pseudocount for the log [default=1e-04]
-m METADATA, --metadata=METADATA
A list of tsv files with metadata on matrix experiment.
They must be in the format 'file1.tsv,file2.tsv' and contain a key column named 'labExpId'. Can be omitted
--merge_mdata_on=MERGE_MDATA_ON
[default=labExpId]
-c COLOR_BY, --color_by=COLOR_BY
choose the fields in the metadata you want to color by
--sort_color=SORT_COLOR
A field for sorting colors. Can be omitted [default=NULL]
-s SHAPE_BY, --shape_by=SHAPE_BY
choose the fields in the metadata you want to shape by
--no_legend
Do not show the legend [default=FALSE]
-r, --row_as_variables
select this if you want rows as variables [default=FALSE]
-C PRINCOMP, --princomp=PRINCOMP
choose the principal components you want to plot. With 3 PC it gives a 3d plot [default='PC1,PC2']
--print_scores
Output the resuling PCs as a separate file with the extension PCs.tsv [default=FALSE]
--print_loadings
Output the resulting loadings as a separate file with the extension loadings.tsv [default=FALSE]
--print_lambdas
Output the resulting lambdas (stdev) as a separate file with the extension lambdas.tsv [default=FALSE]
--biplot
If active, the factor of the color is used as grouping factor.
Centroids are computed and the first <top> loadings are plotted wrt to the two specified components [default=FALSE]
--palette=PALETTE
File with the color palette [default=/users/rg/abreschi/R/palettes/cbbPalette1.15.txt]
--border
Black border to dots [default=FALSE]
--shapes=SHAPES
File with the shapes [default=NULL]
-L LABELS, --labels=LABELS
The metadata field with the labels [default=NULL]
-B BASE_SIZE, --base_size=BASE_SIZE
Base font size [default=16]
-H HEIGHT, --height=HEIGHT
Height of the plot in inches [default=7]
-W WIDTH, --width=WIDTH
Width of the plot in inches [default=7]
-o OUTPUT, --output=OUTPUT
output file name [default=pca.out]
-v, --verbose
verbose output [default=FALSE]
-h, --help
Show this help message and exit
]]></help>
</tool>