comparison plot_pca.xml @ 0:610e86c430a9 draft default tip

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