Mercurial > repos > bgruening > text_processing
annotate sort.xml @ 20:fbf99087e067 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit c4f50d1ee81c1618344ede1f04a46a28d8068bcc
author | bgruening |
---|---|
date | Thu, 28 Mar 2024 13:20:16 +0000 |
parents | 12615d397df7 |
children |
rev | line source |
---|---|
19
12615d397df7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 70980e329cd9fa78e74bf14a76fd4ded9bd2b91f
bgruening
parents:
11
diff
changeset
|
1 <tool id="tp_sort_header_tool" name="Sort" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> |
0 | 2 <description>data in ascending or descending order</description> |
3 <macros> | |
4 <import>macros.xml</import> | |
5 </macros> | |
19
12615d397df7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 70980e329cd9fa78e74bf14a76fd4ded9bd2b91f
bgruening
parents:
11
diff
changeset
|
6 <expand macro="creator"/> |
0 | 7 <expand macro="requirements"> |
19
12615d397df7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 70980e329cd9fa78e74bf14a76fd4ded9bd2b91f
bgruening
parents:
11
diff
changeset
|
8 <requirement type="package" version="4.8">sed</requirement> |
0 | 9 </expand> |
10 <version_command>sort --version | head -n 1</version_command> | |
11 <command> | |
12 <![CDATA[ | |
13 ( | |
14 LC_ALL=C | |
15 #if int($header) > 0: | |
16 sed -u '${header}'q && | |
17 #end if | |
18 | |
19 sort $unique $ignore_case --stable -t ' ' | |
20 | |
21 #for $key in $sortkeys: | |
22 -k '${key.column}${key.order}${key.style},${key.column}' | |
23 #end for | |
24 | |
25 ) < '${infile}' > '${outfile}' | |
26 ]]> | |
27 </command> | |
28 <inputs> | |
29 <param format="tabular" name="infile" type="data" label="Sort Query" /> | |
3
37e1eb05b1b4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 10052765d6b712cf7d38356af4251fcc38a339b6-dirty
bgruening
parents:
1
diff
changeset
|
30 <param name="header" type="integer" value="0" |
0 | 31 label="Number of header lines" help="These will be ignored during sort."> |
32 <validator type="in_range" message="Negative values are not allowed." min="0"/> | |
33 </param> | |
34 | |
35 <repeat name="sortkeys" title="Column selections" min="1"> | |
36 <param name="column" label="on column" type="data_column" data_ref="infile" accept_default="true" /> | |
37 <param name="order" type="select" display="radio" label="in"> | |
38 <option value="">Ascending order</option> | |
39 <option value="r">Descending order</option> | |
40 </param> | |
41 <param name="style" type="select" display="radio" label="Flavor"> | |
42 <option value="n">Fast numeric sort (-n)</option> | |
43 <option value="g">General numeric sort ( scientific notation -g)</option> | |
44 <option value="V">Natural/Version sort (-V) </option> | |
45 <option value="">Alphabetical sort</option> | |
46 <option value="h">Human-readable numbers (-h)</option> | |
47 <option value="R">Random order (-R)</option> | |
48 </param> | |
49 </repeat> | |
50 | |
51 <param name="unique" type="boolean" checked="false" truevalue="--unique" falsevalue="" | |
52 label="Output unique values" help="Print only unique values, based on sorted key columns. See help section for details. (--unique)" /> | |
53 <param name="ignore_case" type="boolean" checked="false" truevalue="-i" falsevalue="" | |
54 label="Ignore case" help="Sort and Join key column values regardless of upper/lower case letters. (-i)" /> | |
55 </inputs> | |
56 <outputs> | |
57 <data name="outfile" format_source="infile" metadata_source="infile"/> | |
58 </outputs> | |
59 <tests> | |
60 <test> | |
61 <param name="infile" value="sort1.bed"/> | |
62 <param name="header" value="3"/> | |
63 <repeat name="sortkeys"> | |
64 <param name="column" value="1"/> | |
65 <param name="style" value=""/> | |
66 <param name="order" value=""/> | |
67 </repeat> | |
68 <repeat name="sortkeys"> | |
69 <param name="column" value="3"/> | |
70 <param name="style" value="n"/> | |
71 <param name="order" value="r"/> | |
72 </repeat> | |
73 <output name="outfile" file="sort_result1.bed"/> | |
74 </test> | |
75 <test> | |
76 <param name="infile" value="sort1.bed"/> | |
77 <param name="header" value="3"/> | |
78 <repeat name="sortkeys"> | |
79 <param name="column" value="1"/> | |
80 <param name="style" value=""/> | |
1
43b1f073b693
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 369e40078146d00608d52205bb8cee66ae735b76-dirty
bgruening
parents:
0
diff
changeset
|
81 <param name="order" value=""/> |
0 | 82 </repeat> |
83 <repeat name="sortkeys"> | |
84 <param name="column" value="3"/> | |
85 <param name="style" value="n"/> | |
86 <param name="order" value=""/> | |
87 </repeat> | |
88 <output name="outfile" file="sort_result2.bed"/> | |
89 </test> | |
90 <test> | |
91 <param name="infile" value="sort2.bed"/> | |
92 <repeat name="sortkeys"> | |
93 <param name="column" value="5"/> | |
94 <param name="style" value="g"/> | |
95 <param name="order" value=""/> | |
96 </repeat> | |
97 <output name="outfile" file="sort_result3.bed"/> | |
98 </test> | |
99 </tests> | |
100 <help> | |
101 <![CDATA[ | |
102 **What it does** | |
103 | |
104 This tool sorts an input file. | |
105 | |
106 ----- | |
107 | |
108 **Sorting Styles** | |
109 | |
110 * **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). | |
111 * **General Numeric**: sort by numeric values. Handles all numeric notations (including scientific notation). Slower than *fast numeric*, so use only when necessary. | |
112 * **Natural Sort**: Sort in 'natural' order (natural to humans, not to computers). See example below. | |
113 * **Alphabetical sort**: Sort in strict alphabetical order. See example below. | |
114 * **Human-readable numbers**: Sort human readble numbers (e.g. 1G > 2M > 3K > 400) | |
115 * **Random order**: return lines in random order. | |
116 | |
117 ------ | |
118 | |
119 **Example - Header line** | |
120 | |
121 **Input file** (note first line is a header line, should not be sorted):: | |
122 | |
123 Fruit Color Price | |
124 Banana Yellow 4.1 | |
125 Avocado Green 8.0 | |
126 Apple Red 3.0 | |
127 Melon Green 6.1 | |
128 | |
129 **Sorting** by **numeric order** on column **3**, with **header**, will return:: | |
130 | |
131 Fruit Color Price | |
132 Apple Red 3.0 | |
133 Banana Yellow 4.1 | |
134 Melon Green 6.1 | |
135 Avocado Green 8.0 | |
136 | |
137 | |
138 ----- | |
139 | |
140 **Example - Natural vs. Alphabetical sorting** | |
141 | |
142 Given the following list:: | |
143 | |
144 chr4 | |
145 chr13 | |
146 chr1 | |
147 chr10 | |
148 chr20 | |
149 chr2 | |
150 | |
151 **Alphabetical sort** would produce the following sorted list:: | |
152 | |
153 chr1 | |
154 chr10 | |
155 chr13 | |
156 chr2 | |
157 chr20 | |
158 chr4 | |
159 | |
160 **Natural Sort** would produce the following sorted list:: | |
161 | |
162 chr1 | |
163 chr2 | |
164 chr4 | |
165 chr10 | |
166 chr13 | |
167 chr20 | |
168 | |
169 | |
170 .. class:: infomark | |
171 | |
172 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. | |
173 | |
174 ]]> | |
175 </help> | |
6
60edf2f8c28f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
5
diff
changeset
|
176 <expand macro="citations" /> |
0 | 177 </tool> |