annotate tools/stats/column_maker.xml @ 2:c2a356708570

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:45:42 -0500
parents 9071e359b9a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
1 <tool id="Add_a_column1" name="Compute" version="1.1.0">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
2 <description>an expression on every row</description>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
3 <command interpreter="python">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
4 column_maker.py $input $out_file1 "$cond" $round ${input.metadata.columns} "${input.metadata.column_types}"
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
5 </command>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
6 <inputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
7 <param name="cond" size="40" type="text" value="c3-c2" label="Add expression"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
8 <param format="tabular" name="input" type="data" label="as a new column to" help="Dataset missing? See TIP below"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
9 <param name="round" type="select" label="Round result?">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
10 <option value="no">NO</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
11 <option value="yes">YES</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
12 </param>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
13 </inputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
14 <outputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
15 <data format="input" name="out_file1" metadata_source="input"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
16 </outputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
17 <tests>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
18 <test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
19 <param name="cond" value="c3-c2"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
20 <param name="input" value="1.bed"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
21 <param name="round" value="no"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
22 <output name="out_file1" file="column_maker_out1.interval"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
23 </test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
24 <test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
25 <param name="cond" value="c4*1"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
26 <param name="input" value="1.interval"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
27 <param name="round" value="no"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
28 <output name="out_file1" file="column_maker_out2.interval"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
29 </test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
30 <test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
31 <param name="cond" value="c4*1"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
32 <param name="input" value="1.interval"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
33 <param name="round" value="yes"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
34 <output name="out_file1" file="column_maker_out3.interval"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
35 </test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
36 </tests>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
37 <help>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
38
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
39 .. class:: infomark
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
40
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
41 **TIP:** If your data is not TAB delimited, use *Text Manipulation-&gt;Convert*
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
42
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
43 -----
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
44
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
45 **What it does**
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
46
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
47 This tool computes an expression for every row of a dataset and appends the result as a new column (field).
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
48
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
49 - Columns are referenced with **c** and a **number**. For example, **c1** refers to the first column of a tab-delimited file
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
50
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
51 - **c3-c2** will add a length column to the dataset if **c2** and **c3** are start and end position
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
52
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
53 -----
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
54
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
55 **Example**
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
56
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
57 If this is your input::
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
58
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
59 chr1 151077881 151077918 2 200 -
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
60 chr1 151081985 151082078 3 500 +
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
61
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
62 computing "c4*c5" will produce::
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
63
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
64 chr1 151077881 151077918 2 200 - 400.0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
65 chr1 151081985 151082078 3 500 + 1500.0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
66
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
67 if, at the same time, "Round result?" is set to **YES** results will look like this::
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
68
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
69 chr1 151077881 151077918 2 200 - 400
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
70 chr1 151081985 151082078 3 500 + 1500
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
71
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
72 You can also use this tool to evaluate expressions. For example, computing "c3>=c2" for Input will result in the following::
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
73
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
74 chr1 151077881 151077918 2 200 - True
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
75 chr1 151081985 151082078 3 500 + True
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
76
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
77 or computing "type(c2)==type('') for Input will return::
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
78
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
79 chr1 151077881 151077918 2 200 - False
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
80 chr1 151081985 151082078 3 500 + False
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
81
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
82 </help>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
83 </tool>