annotate mytools/binaverage.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="binaverage" name="bin and average">
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
2 <description>of 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="input" type="data" format="tabular" label="Data file"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
6 <param name="data_avg" type="integer" value="1" label="Column number of the data to average"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
7 <param name="label_avg" type="text" value="label-avg" size="30" label="data label"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
8 <param name="log_avg" label="log2 transform the data" type="boolean" truevalue="logavg" falsevalue="none" checked="False"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
9 <param name="data_bin" type="integer" value="2" label="Column number of the data used to make bins"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
10 <param name="label_bin" type="text" value="label-bin" size="30" label="data label"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
11 <param name="log_bin" label="log2 transform the data" type="boolean" truevalue="logbin" falsevalue="none" checked="False"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
12 <param name="nbin" type="integer" value="3" label="number of bins"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
13 <param name="bintype" type="select" label="Bin by rank or by value" >
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
14 <option value="rank" selected="true">by rank: bins have the same number of data points</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
15 <option value="value">by value: bins may have different number of data points</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
16 </param>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
17 <param name="legendloc" type="select" label="legend location on CDF plot" >
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
18 <option value="bottomright" selected="true">bottomright</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
19 <option value="bottomleft">bottomleft</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
20 <option value="bottom">bottom</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
21 <option value="left">left</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
22 <option value="topleft">topleft</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
23 <option value="top">top</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
24 <option value="topright">topright</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
25 <option value="right">right</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
26 <option value="center">center</option>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
27 </param>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
28
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
29 <param name="title" type="text" value="bin-average" size="50" label="title of this analysis"/>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
30
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
31 </inputs>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
32
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
33 <configfiles>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
34 <configfile name="script_file">
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
35 ## Setup R error handling to go to stderr
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
36 options(warn=-1)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
37 source("/Users/xuebing/galaxy-dist/tools/mytools/cdf.r")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
38 x = read.table("${input}",sep='\t')
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
39 x = x[,c($data_bin,$data_avg)]
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
40 label_avg = "${label_avg}"
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
41 label_bin = "${label_bin}"
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
42 if ("${log_bin}" == "logbin"){
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
43 x[,1] = log2(1+x[,1])
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
44 label_bin = paste('log2',label_bin)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
45 }
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
46 if ("${log_avg}" == "logavg"){
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
47 x[,2] = log2(1+x[,2])
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
48 label_avg = paste('log2',label_avg)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
49 }
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
50 res = binaverage(x,$nbin,"${bintype}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
51 attach(res)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
52 for (i in 1:${nbin}){
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
53 print(paste(label_bin,labels[i],sep=':'))
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
54 print(summary(binned[[i]]))
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
55 }
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
56 pdf("${out_file}")
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
57 mycdf(binned,"${title}",labels,"$legendloc",label_avg,label_bin)
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
58 dev.off()
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
59 </configfile>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
60 </configfiles>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
61
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
62 <outputs>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
63 <data format="txt" name="out_log" label="${title}: (log)" />
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
64 <data format="pdf" name="out_file" label="${title}: (plot)" />
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
65 </outputs>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
66
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
67 <help>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
68
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
69 .. class:: infomark
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
70
39217fa39ff2 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.
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
72
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
73 </help>
39217fa39ff2 Uploaded
xuebing
parents:
diff changeset
74 </tool>