annotate mytools/cdf.xml @ 0:39217fa39ff2

Uploaded
author xuebing
date Tue, 13 Mar 2012 23:34:52 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
1 <tool id="cdf" name="CDF">
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
2 <description>plot of multiple numeric columns</description>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
3 <command>cat $script_file | R --vanilla --slave > $out_log </command>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
4 <inputs>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
5 <param name="title" type="text" value="CDF plot" size="30" label="Plot title"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
6 <param name="xlabel" type="text" value="value" size="30" label="xlabel"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
7 <param name="log" label="log2 transform the data" type="boolean" truevalue="log" falsevalue="none" checked="False"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
8 <param name="zero" label="remove zero" type="boolean" truevalue="zero" falsevalue="none" checked="False"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
9 <param name="legendloc" type="select" label="legend location on CDF plot" >
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
10 <option value="bottomright" selected="true">bottomright</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
11 <option value="bottomleft">bottomleft</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
12 <option value="bottom">bottom</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
13 <option value="left">left</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
14 <option value="topleft">topleft</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
15 <option value="top">top</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
16 <option value="topright">topright</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
17 <option value="right">right</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
18 <option value="center">center</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
19 </param>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
20 <repeat name="series" title="sample">
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
21 <param name="label" type="text" value="" size="30" label="data label"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
22 <param name="input" type="data" format="tabular" label="dataset"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
23 <param name="column" type="integer" value="2" label="column number (-1 for last column)"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
24 </repeat>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
25
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
26 </inputs>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
27
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
28 <configfiles>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
29 <configfile name="script_file">
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
30 ## Setup R error handling to go to stderr
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
31 options(warn=-1)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
32 source("/Users/xuebing/galaxy-dist/tools/mytools/cdf.r")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
33 uselog = as.character("${log}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
34 zero = as.character("${zero}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
35 title = as.character("${title}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
36 xlabel = as.character("${xlabel}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
37 if (uselog=='log'){
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
38 xlabel = paste('log2',xlabel)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
39 }
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
40
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
41 labels = character(0)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
42 x = list()
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
43 #for $i, $s in enumerate( $series )
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
44 labels = c(labels,"${s.label.value}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
45 x0 = read.table( "${s.input.file_name}" ,sep='\t')
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
46 col = ${s.column.value}
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
47 if (col == -1) {col = ncol(x0)}
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
48 x0 = x0[,col]
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
49 if (zero == 'zero'){
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
50 x0 = x0[x0 != 0]
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
51 }
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
52 if (uselog=='log'){
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
53 x0=log2(1+x0)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
54 }
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
55 print("${s.label.value}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
56 summary(x0)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
57 x[[$i+1]] = x0
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
58 #end for
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
59 pdf("${out_file}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
60 mycdf(x,title,labels,"${legendloc}",xlabel,'')
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
61 dev.off()
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
62 </configfile>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
63 </configfiles>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
64
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
65 <outputs>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
66 <data format="txt" name="out_log" label="${tool.name} on ${on_string}: (log)" />
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
67 <data format="pdf" name="out_file" label="${tool.name} on ${on_string}: (plot)" />
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
68 </outputs>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
69
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
70 <help>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
71
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
72 .. class:: infomark
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
73
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
74 This tool generate barplot and CDF plot comparing multiple numeric columns in different files.
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
75
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
76
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
77 </help>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
78 </tool>