annotate tools/unix_tools/sort_tool.xml @ 1:cdcb0ce84a1b

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:45:15 -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="cshl_sort_tool" name="Sort">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
2 <!--
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
3 note 1:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
4 the 'version' sort (or natual order sort)
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
5 requires GNU Coreutils 7.1 or later
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
6
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
7 note 2:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
8 for greater efficiency, sort buffer size is very large.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
9 If your Galaxy server doesn't have so much memory (or the
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
10 sorts you use don't require it) - you can decrease the memory size.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
11 (argument is "-S 2G")
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
12 -->
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
13 <command>sort -S 2G $unique
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
14 #for $key in $sortkeys
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
15 '-k ${key.column},${key.column}${key.order}${key.style}'
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
16 #end for
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
17 $input > $out_file1
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
18 </command>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
19
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
20 <inputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
21 <param format="txt" name="input" type="data" label="Sort Query" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
22
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
23 <param name="unique" type="select" label="Output only unique values?">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
24 <option value="">No</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
25 <option value="-u">Yes</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
26 </param>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
27
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
28 <repeat name="sortkeys" title="sort key">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
29 <param name="column" label="on column" type="data_column" data_ref="input" accept_default="true" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
30 <param name="order" type="select" display="radio" label="in">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
31 <option value="r">Descending order</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
32 <option value="">Ascending order</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
33 </param>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
34 <param name="style" type="select" display="radio" label="Flavor">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
35 <option value="n">Fast numeric sort ([-n])</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
36 <option value="g">General numeric sort ( scientific notation [-g])</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
37 <option value="V">Natural/Version sort ([-V]) </option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
38 <option value="">Alphabetical sort</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
39 </param>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
40 </repeat>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
41 </inputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
42 <tests>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
43 <test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
44 <!-- Sort Descending numerical order,
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
45 with scientific notation -->
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
46 <param name="input" value="unix_sort_input1.txt" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
47 <output name="output" file="unix_sort_output1.txt" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
48 <param name="unique" value="No" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
49 <param name="column" value="2" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
50 <param name="order" value="r" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
51 <param name="style" value="g" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
52 </test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
53 <test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
54 <!-- Sort Ascending numerical order,
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
55 with scientific notation - outputing unique values only
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
56
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
57 The catch:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
58 chr15 appears twice, with the same value (0.0314 and 3.14e-2).
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
59 In the output, it should appear only once because of the unique flag
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
60 -->
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
61 <param name="input" value="unix_sort_input1.txt" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
62 <output name="output" file="unix_sort_output2.txt" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
63 <param name="unique" value="Yes" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
64 <param name="column" value="2" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
65 <param name="order" value="" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
66 <param name="style" value="g" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
67 </test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
68 <test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
69 <!-- Sort Ascending 'natural' order -->
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
70 <param name="input" value="unix_sort_input1.txt" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
71 <output name="output" file="unix_sort_output3.txt" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
72 <param name="unique" value="No" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
73 <param name="column" value="1" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
74 <param name="order" value="" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
75 <param name="style" value="V" />
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
76 </test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
77 </tests>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
78 <outputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
79 <data format="input" name="out_file1" metadata_source="input"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
80 </outputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
81 <help>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
82
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
83 **What it does**
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
84
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
85 This tool runs the unix **sort** command on the selected data file.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
86
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
87 -----
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
88
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
89 **Sorting Styles**
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
90
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
91 * **Fast Numeric**: sort by numeric values. Handles integer values (e.g. 43, 134) and decimal-point values (e.g. 3.14). *Does not* handle scientific notation (e.g. -2.32e2).
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
92 * **General Numeric**: sort by numeric values. Handles all numeric notations (including scientific notation). Slower than *fast numeric*, so use only when necessary.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
93 * **Natural Sort**: Sort in 'natural' order (natural to humans, not to computers). See example below.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
94 * **Alphabetical sort**: Sort in strict alphabetical order. See example below.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
95
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
96
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
97
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
98
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
99 **Sorting Examples**
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
100
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
101 Given the following list::
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
102
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
103 chr4
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
104 chr13
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
105 chr1
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
106 chr10
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
107 chr20
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
108 chr2
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
109
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
110 **Alphabetical sort** would produce the following sorted list::
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
111
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
112 chr1
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
113 chr10
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
114 chr13
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
115 chr2
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
116 chr20
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
117 chr4
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
118
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
119 **Natural Sort** would produce the following sorted list::
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
120
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
121 chr1
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
122 chr2
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
123 chr4
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
124 chr10
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
125 chr13
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
126 chr20
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
127
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
128
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
129 .. class:: infomark
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
130
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
131 If you're planning to use the file with another tool that expected sorted files (such as *join*), you should use the **Alphabetical sort**, not the **Natural Sort**. Natural sort order is easier for humans, but is unnatural for computer programs.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
132
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
133 </help>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
134 </tool>