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