comparison mytools/binaverage.xml @ 0:39217fa39ff2

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