upstream-extended/community/tools/rpy_statistics_collection/pca.xml
1<tool id="pca1" name="Principal Component Analysis" version="1.1.0">
2 <description> </description>
3
4 <macros>
5 <import>statistic_tools_macros.xml</import>
6 </macros>
7 <expand macro="requirements" />
8 <command interpreter="python">
9<![CDATA[
10 pca.py
11 $input1
12 $var_cols
13 $methodChoice.method
14 $out_file1
15 $out_file2
16 #if $methodChoice.method == "svd":
17 $methodChoice.scale
18 #end if
19]]>
20 </command>
21 <inputs>
22 <param format="tabular" name="input1" type="data" label="Select data" help="Dataset missing? See TIP below."/>
23 <param name="var_cols" label="Select columns containing input variables " type="data_column" data_ref="input1" numerical="True" multiple="true" >
24 <validator type="no_options" message="Please select at least one column."/>
25 </param>
26 <conditional name="methodChoice">
27 <param name="method" type="select" label="Method" help="The correlation matrix can only be used if there are no constant variables">
28 <option value="cor" selected="true">Eigenvectors of Correlation (princomp)</option>
29 <option value="cov">Eigenvectors of Covariance (princomp)</option>
30 <option value="svd">Singular Value Decomposition (prcomp)</option>
31 </param>
32 <when value="cor" />
33 <when value="cov" />
34 <when value="svd">
35 <param name="scale" type="select" label="Centering and Scaling" help="Can be used to center and/or scale variables">
36 <option value="none" selected="true">None</option>
37 <option value="center">Center only</option>
38 <option value="scale">Scale only</option>
39 <option value="both">Center and Scale</option>
40 </param>
41 </when>
42 </conditional>
43 </inputs>
44 <outputs>
45 <data format_source="input" name="out_file1" metadata_source="input1" />
46 <data format="pdf" name="out_file2" />
47 </outputs>
48 <tests>
49 <test>
50 <param name="input1" value="iris.tabular"/>
51 <param name="var_cols" value="1,2,3,4"/>
52 <param name="method" value="cor"/>
53 <output name="out_file1" file="pca_out1.tabular"/>
54 <output name="out_file2" file="pca_out2.pdf"/>
55 </test>
56 <test>
57 <param name="input1" value="iris.tabular"/>
58 <param name="var_cols" value="1,2,3,4"/>
59 <param name="method" value="cov"/>
60 <output name="out_file1" file="pca_out3.tabular"/>
61 <output name="out_file2" file="pca_out4.pdf"/>
62 </test>
63 <test>
64 <param name="input1" value="iris.tabular"/>
65 <param name="var_cols" value="1,2,3,4"/>
66 <param name="method" value="svd"/>
67 <param name="scale" value="both"/>
68 <output name="out_file1" file="pca_out5.tabular"/>
69 <output name="out_file2" file="pca_out6.pdf"/>
70 </test>
71 </tests>
72 <help>
73<![CDATA[
74
75
76.. class:: infomark
77
78**TIP:** If your data is not TAB delimited, use *Edit Datasets->Convert characters*
79
80-----
81
82.. class:: infomark
83
84**What it does**
85
86This tool performs Principal Component Analysis on the given numeric input data using functions from R statistical package - 'princomp' function (for Eigenvector based solution) and 'prcomp' function (for Singular value decomposition based solution). It outputs two files, one containing the summary statistics of PCA, and the other containing biplots of the observations and principal components.
87
88*R Development Core Team (2009). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R-project.org.*
89
90-----
91
92.. class:: warningmark
93
94**Note**
95
96- This tool currently treats all variables as continuous numeric variables. Running the tool on categorical variables might result in incorrect results. Rows containing non-numeric (or missing) data in any of the chosen columns will be skipped from the analysis.
97
98- The summary statistics in the output are described below:
99
100 - Std. deviation: Standard deviations of the principal components
101 - Loadings: a list of eigen-vectors/variable loadings
102 - Scores: Scores of the input data on the principal components
103
104]]>
105 </help>
106 <expand macro="citations" />
107</tool>