annotate binaverage.xml @ 13:292186c14b08

Uploaded
author xuebing
date Sat, 10 Mar 2012 08:17:36 -0500
parents b7f1d9f8f3bc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
1 <tool id="binaverage" name="bin and average">
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
2 <description>of numeric columns</description>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
3 <command>cat $script_file | R --vanilla --slave > $out_log </command>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
4 <inputs>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
5 <param name="input" type="data" format="tabular" label="Data file"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
6 <param name="data_avg" type="integer" value="1" label="Column number of the data to average"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
7 <param name="label_avg" type="text" value="label-avg" size="30" label="data label"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
8 <param name="log_avg" label="log2 transform the data" type="boolean" truevalue="logavg" falsevalue="none" checked="False"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
9 <param name="data_bin" type="integer" value="2" label="Column number of the data used to make bins"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
10 <param name="label_bin" type="text" value="label-bin" size="30" label="data label"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
11 <param name="log_bin" label="log2 transform the data" type="boolean" truevalue="logbin" falsevalue="none" checked="False"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
12 <param name="nbin" type="integer" value="3" label="number of bins"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
13 <param name="bintype" type="select" label="Bin by rank or by value" >
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
14 <option value="rank" selected="true">by rank: bins have the same number of data points</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
15 <option value="value">by value: bins may have different number of data points</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
16 </param>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
17 <param name="legendloc" type="select" label="legend location on CDF plot" >
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
18 <option value="bottomright" selected="true">bottomright</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
19 <option value="bottomleft">bottomleft</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
20 <option value="bottom">bottom</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
21 <option value="left">left</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
22 <option value="topleft">topleft</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
23 <option value="top">top</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
24 <option value="topright">topright</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
25 <option value="right">right</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
26 <option value="center">center</option>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
27 </param>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
28
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
29 <param name="title" type="text" value="bin-average" size="50" label="title of this analysis"/>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
30
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
31 </inputs>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
32
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
33 <configfiles>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
34 <configfile name="script_file">
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
35 ## Setup R error handling to go to stderr
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
36 options(warn=-1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
37 source("/Users/xuebing/galaxy-dist/tools/mytools/cdf.r")
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
38 x = read.table("${input}",sep='\t')
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
39 x = x[,c($data_bin,$data_avg)]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
40 label_avg = "${label_avg}"
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
41 label_bin = "${label_bin}"
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
42 if ("${log_bin}" == "logbin"){
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
43 x[,1] = log2(1+x[,1])
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
44 label_bin = paste('log2',label_bin)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
45 }
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
46 if ("${log_avg}" == "logavg"){
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
47 x[,2] = log2(1+x[,2])
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
48 label_avg = paste('log2',label_avg)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
49 }
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
50 res = binaverage(x,$nbin,"${bintype}")
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
51 attach(res)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
52 for (i in 1:${nbin}){
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
53 print(paste(label_bin,labels[i],sep=':'))
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
54 print(summary(binned[[i]]))
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
55 }
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
56 pdf("${out_file}")
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
57 mycdf(binned,"${title}",labels,"$legendloc",label_avg,label_bin)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
58 dev.off()
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
59 </configfile>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
60 </configfiles>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
61
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
62 <outputs>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
63 <data format="txt" name="out_log" label="${title}: (log)" />
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
64 <data format="pdf" name="out_file" label="${title}: (plot)" />
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
65 </outputs>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
66
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
67 <help>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
68
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
69 .. class:: infomark
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
70
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
71 This tool generates barplot and CDF plot comparing data/rows in a numeric column that are binned by a second numeric column. The input should have at least two numeric columns. One of the column is used to group rows into bins, and then values in the other column are compared using barplot, CDF plot, and KS test.
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
72
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
73 </help>
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
74 </tool>