Mercurial > repos > kellrott > cluster3
comparison cluster3.xml @ 0:cdcb3276c0e1 draft
Uploaded
author | kellrott |
---|---|
date | Thu, 25 Oct 2012 16:41:28 -0400 |
parents | |
children | e1bc1519822b |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cdcb3276c0e1 |
---|---|
1 <tool id="cluster3" name="Cluster 3" version="1.0.0"> | |
2 <description>Cluster 3.0</description> | |
3 <command interpreter="python">$scriptfile</command> | |
4 <inputs> | |
5 <param name="filename" type="data" format="tab" label="Matrix"/> | |
6 <param name="row_center" type="select" label="Row Center (gene)"> | |
7 <option value="x">No row Center</option> | |
8 <option value="a">Substact mean of row</option> | |
9 <option value="m">Substact median of row</option> | |
10 </param> | |
11 <param name="log_transform" type="boolean" label="Log transform data" default="false"/> | |
12 <param name="row_normalize" type="boolean" label="Normalize Rows (gene)"/> | |
13 | |
14 <param name="col_center" type="select" label="Column Center (sample)"> | |
15 <option value="x">No column Center</option> | |
16 <option value="a">Substact mean of column</option> | |
17 <option value="m">Substact median of column</option> | |
18 </param> | |
19 <param name="col_normalize" type="boolean" label="Normalize Columns (sample)"/> | |
20 | |
21 <conditional name="cparam"> | |
22 <param name="run_mode" type="select" label="Run Mode"> | |
23 <option value="clustering">Clustering</option> | |
24 <option value="pca">Principal Component Analysis</option> | |
25 </param> | |
26 <when value="clustering"> | |
27 <param name="col_distance" type="select" label="Column (sample) clustering"> | |
28 <option value="0">No clustering</option> | |
29 <option value="1">Uncentered correlation</option> | |
30 <option value="2">Pearson correlation</option> | |
31 <option value="3">Uncentered correlation, absolute value</option> | |
32 <option value="4">Pearson correlation, absolute value</option> | |
33 <option value="5">Spearman's rank correlation</option> | |
34 <option value="6">Kendall's tau</option> | |
35 <option value="7">Euclidean distance</option> | |
36 <option value="8">City-block distance</option> | |
37 </param> | |
38 | |
39 <param name="row_distance" type="select" label="Row (gene) clustering"> | |
40 <option value="0">No clustering</option> | |
41 <option value="1">Uncentered correlation</option> | |
42 <option value="2">Pearson correlation</option> | |
43 <option value="3">Uncentered correlation, absolute value</option> | |
44 <option value="4">Pearson correlation, absolute value</option> | |
45 <option value="5">Spearman's rank correlation</option> | |
46 <option value="6">Kendall's tau</option> | |
47 <option value="7">Euclidean distance</option> | |
48 <option value="8">City-block distance</option> | |
49 </param> | |
50 <conditional name="cluster_mode"> | |
51 <param name="mode_name" type="select" label="Clustering Type"> | |
52 <option value="hierarchical">Hierarchical Clustering</option> | |
53 <option value="kmeans">Kmeans Clustering</option> | |
54 </param> | |
55 <when value="hierarchical"> | |
56 <param name="hclustermethod" type="select" label="Hierarchical clustering method"> | |
57 <option value="m">Pairwise complete-linkage</option> | |
58 <option value="s">Pairwise single-linkage</option> | |
59 <option value="c">Pairwise centroid-linkage</option> | |
60 <option value="a">Pairwise average-linkage</option> | |
61 </param> | |
62 </when> | |
63 <when value="kmeans"> | |
64 <param name="knum" type="integer" optional="true" label="K-Means count"/> | |
65 <param name="kruns" type="integer" optional="true" label="K-Means run count"/> | |
66 </when> | |
67 </conditional> | |
68 </when> | |
69 | |
70 <when value="pca"> | |
71 <param name="pca_mode" type="select" label="Principal Component Analysis Mode"> | |
72 <option value="row">Rows (genes)</option> | |
73 <option value="col">Cols (samples)</option> | |
74 </param> | |
75 </when> | |
76 </conditional> | |
77 | |
78 </inputs> | |
79 <outputs> | |
80 <data name="cdtfile" format="cdt" label="CDT File"> | |
81 <filter>cparam['run_mode'] == "clustering"</filter> | |
82 </data> | |
83 <data format="atr" name="atrfile" label="ATR File"> | |
84 <filter>cparam['run_mode'] == "clustering" and cparam['cluster_mode']['mode_name'] == "hierarchical" and cparam['col_distance'] != "0"</filter> | |
85 </data> | |
86 <data format="gtr" name="gtrfile" label="GTR File"> | |
87 <filter>cparam['run_mode'] == "clustering" and cparam['cluster_mode']['mode_name'] == "hierarchical" and cparam['row_distance'] != "0"</filter> | |
88 </data> | |
89 <data format="txt" name="kagfile" label="KAG File"> | |
90 <filter>cparam['run_mode'] == "clustering" and cparam['cluster_mode']['mode_name'] == "kmeans" and cparam['col_distance'] != "0"</filter> | |
91 </data> | |
92 <data format="txt" name="kggfile" label="KGG File"> | |
93 <filter>cparam['run_mode'] == "clustering" and cparam['cluster_mode']['mode_name'] == "kmeans" and cparam['row_distance'] != "0"</filter> | |
94 </data> | |
95 <data format="txt" name="pcagenefile" label="PCA Gene File"> | |
96 <filter>cparam['run_mode']=="pca" and cparam['pca_mode'] == "row"</filter> | |
97 </data> | |
98 <data format="txt" name="pcagenecoordfile" label="PCA Gene Coord File"> | |
99 <filter>cparam['run_mode']=="pca" and cparam['pca_mode'] == "row"</filter> | |
100 </data> | |
101 <data format="txt" name="pcasamplefile" label="PCA Sample File"> | |
102 <filter>cparam['run_mode']=="pca" and cparam['pca_mode'] == "col"</filter> | |
103 </data> | |
104 <data format="txt" name="pcasamplecoordfile" label="PCA Sample Coord File"> | |
105 <filter>cparam['run_mode']=="pca" and cparam['pca_mode'] == "col"</filter> | |
106 </data> | |
107 </outputs> | |
108 <configfiles> | |
109 | |
110 <configfile name="scriptfile"><![CDATA[#!/usr/bin/env python | |
111 import subprocess | |
112 import shutil | |
113 from glob import glob | |
114 | |
115 cmd = ["cluster", "-f", "$filename", "-u", "galaxy_cluster"] | |
116 | |
117 #if $cparam.run_mode == "clustering": | |
118 if "$cparam.col_distance" != "0": | |
119 cmd.extend( ['-e', '$cparam.col_distance'] ) | |
120 | |
121 if "$cparam.row_distance" != "0": | |
122 cmd.extend( ['-g', '$cparam.row_distance'] ) | |
123 | |
124 runK = False | |
125 #if $cparam.cluster_mode.mode_name == "kmeans": | |
126 if len("${cparam.cluster_mode.knum}"): | |
127 cmd.extend(['-k', '${cparam.cluster_mode.knum}']) | |
128 runK = True | |
129 | |
130 if len("${cparam.cluster_mode.kruns}"): | |
131 cmd.extend(['-r', '${cparam.cluster_mode.kruns}']) | |
132 #end if | |
133 | |
134 if "$col_normalize" == "true": | |
135 cmd.append("-na") | |
136 | |
137 if "$row_normalize" == "true": | |
138 cmd.append("-ng") | |
139 | |
140 if "$log_transform" == "true": | |
141 cmd.append("-l") | |
142 #end if | |
143 | |
144 #if $cparam.run_mode == "pca": | |
145 if "$cparam.pca_mode" == "row": | |
146 cmd.append("-pg") | |
147 if "$cparam.pca_mode" == "col": | |
148 cmd.append("-pa") | |
149 #end if | |
150 | |
151 print "Running", " ".join(cmd) | |
152 | |
153 proc = subprocess.Popen(cmd) | |
154 proc.communicate() | |
155 | |
156 #if $cparam.run_mode == "clustering": | |
157 if "$cparam.row_distance" != "0" or "$cparam.col_distance" != "0": | |
158 if runK: | |
159 for f in glob("galaxy_cluster*.cdt"): | |
160 shutil.move(f, "$cdtfile") | |
161 else: | |
162 shutil.move("galaxy_cluster.cdt", "$cdtfile") | |
163 | |
164 if "$cparam.col_distance" != "0": | |
165 if runK: | |
166 for f in glob("galaxy_cluster*.kag"): | |
167 shutil.move(f, "$kagfile") | |
168 else: | |
169 shutil.move("galaxy_cluster" + ".atr", "$atrfile") | |
170 | |
171 if "$cparam.row_distance" != "0": | |
172 if runK: | |
173 for f in glob("galaxy_cluster*.kgg"): | |
174 shutil.move(f, "$kggfile") | |
175 else: | |
176 shutil.move("galaxy_cluster" + ".gtr", "$gtrfile") | |
177 #end if | |
178 | |
179 #if $cparam.run_mode == "pca": | |
180 if "$cparam.pca_mode" == "row": | |
181 shutil.move("galaxy_cluster_pca_gene.pc.txt", "$pcagenefile") | |
182 shutil.move("galaxy_cluster_pca_gene.coords.txt", "$pcagenecoordfile") | |
183 if "$cparam.pca_mode" == "col": | |
184 shutil.move("galaxy_cluster_pca_array.pc.txt", "$pcasamplefile") | |
185 shutil.move("galaxy_cluster_pca_array.coords.txt", "$pcasamplecoordfile") | |
186 #end if | |
187 ]]></configfile> | |
188 </configfiles> | |
189 <help> | |
190 | |
191 A Wrapper for the Cluster3.0 program http://bonsai.hgc.jp/~mdehoon/software/cluster/software.htm | |
192 | |
193 Principle modes: | |
194 | |
195 - K-means Clustering | |
196 - Hierarchical Clustering | |
197 - Principal Component Analysis | |
198 | |
199 Source code at http://bonsai.hgc.jp/~mdehoon/software/cluster/cluster-1.50.tar.gz | |
200 | |
201 For command line version, | |
202 ./configure --without-x | |
203 make | |
204 make install | |
205 | |
206 </help> | |
207 </tool> |