Mercurial > repos > bgruening > text_processing
annotate sort.xml @ 30:5907d248dee3 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
| author | bgruening |
|---|---|
| date | Sat, 17 Jan 2026 00:56:56 +0000 |
| parents | 4f7cade041cb |
| children |
| rev | line source |
|---|---|
|
26
f22a309187a3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit c2b1677d1c94433f777c2dc28ac8eec0a99cc6a7
bgruening
parents:
18
diff
changeset
|
1 <tool id="tp_sort_header_tool" name="Sort" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> |
| 1 | 2 <description>data in ascending or descending order</description> |
| 4 | 3 <macros> |
| 4 <import>macros.xml</import> | |
| 5 </macros> | |
|
26
f22a309187a3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit c2b1677d1c94433f777c2dc28ac8eec0a99cc6a7
bgruening
parents:
18
diff
changeset
|
6 <expand macro="creator"/> |
| 4 | 7 <expand macro="requirements"> |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
8 <requirement type="package" version="4.9">sed</requirement> |
| 4 | 9 </expand> |
| 10 <version_command>sort --version | head -n 1</version_command> | |
| 11 <command> | |
| 12 <![CDATA[ | |
| 13 ( | |
|
29
4f7cade041cb
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 4dd118c84ed4d6157303e71438c24446ec4b4f31
bgruening
parents:
27
diff
changeset
|
14 export LC_ALL=C; |
| 4 | 15 #if int($header) > 0: |
| 7 | 16 sed -u '${header}'q && |
| 4 | 17 #end if |
| 0 | 18 |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
19 sort $unique --stable -t ' ' |
| 0 | 20 |
| 4 | 21 #for $key in $sortkeys: |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
22 #if $key.start_charpos and $key.end_charpos: |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
23 -k ${key.column}.${key.start_charpos}${key.ignore_leading_blanks},${key.column}.${key.end_charpos}${key.ignore_leading_blanks}${key.order}${key.style}${key.ignore_case} |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
24 #elif $key.start_charpos: |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
25 -k ${key.column}.${key.start_charpos}${key.ignore_leading_blanks},${key.column}${key.order}${key.style}${key.ignore_case} |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
26 #elif $key.end_charpos: |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
27 -k ${key.column}${key.ignore_leading_blanks},${key.column}.${key.end_charpos}${key.ignore_leading_blanks}${key.order}${key.style}${key.ignore_case} |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
28 #else: |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
29 -k ${key.column}${key.ignore_leading_blanks},${key.column}${key.order}${key.style}${key.ignore_case} |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
30 #end if |
| 4 | 31 #end for |
| 0 | 32 |
| 4 | 33 ) < '${infile}' > '${outfile}' |
| 34 ]]> | |
| 0 | 35 </command> |
| 36 <inputs> | |
| 4 | 37 <param format="tabular" name="infile" type="data" label="Sort Query" /> |
|
10
c78b1767db2b
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 10052765d6b712cf7d38356af4251fcc38a339b6-dirty
bgruening
parents:
8
diff
changeset
|
38 <param name="header" type="integer" value="0" |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
39 label="Number of header lines" help="Header lines will be copied to the output unchanged without operating on them."> |
| 0 | 40 <validator type="in_range" message="Negative values are not allowed." min="0"/> |
| 41 </param> | |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
42 |
| 1 | 43 <repeat name="sortkeys" title="Column selections" min="1"> |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
44 <param name="column" label="Sort on column" type="data_column" data_ref="infile" accept_default="true" /> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
45 <param name="start_charpos" label="considering its characters from" type="integer" min="1" optional="true" help="Leave empty (or set to 1) to use the column value starting from its first character." /> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
46 <param name="end_charpos" label="to and including" type="integer" min="1" optional="true" help="Leave empty to use the column value up to and including its last character." /> |
| 0 | 47 <param name="order" type="select" display="radio" label="in"> |
| 48 <option value="">Ascending order</option> | |
| 49 <option value="r">Descending order</option> | |
| 50 </param> | |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
51 <param name="style" type="select" display="radio" label="using sort flavor"> |
| 4 | 52 <option value="n">Fast numeric sort (-n)</option> |
| 53 <option value="g">General numeric sort ( scientific notation -g)</option> | |
| 54 <option value="V">Natural/Version sort (-V) </option> | |
| 0 | 55 <option value="">Alphabetical sort</option> |
| 56 <option value="h">Human-readable numbers (-h)</option> | |
| 4 | 57 <option value="R">Random order (-R)</option> |
| 0 | 58 </param> |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
59 <param name="ignore_case" type="boolean" checked="false" truevalue="f" falsevalue="" |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
60 label="ignoring case" help="Turn lowercase symbols to upper case before comparing values in this column. (-f)" /> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
61 <param name="ignore_leading_blanks" type="boolean" checked="false" truevalue="b" falsevalue="" |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
62 label="ignoring leading blanks" help="This option can be useful with Alphabetical and Natural sort (which treat spaces as actual characters) or to prevent unwanted offsets if you specified a range of character positions to consider." /> |
| 0 | 63 </repeat> |
| 1 | 64 |
| 65 <param name="unique" type="boolean" checked="false" truevalue="--unique" falsevalue="" | |
| 4 | 66 label="Output unique values" help="Print only unique values, based on sorted key columns. See help section for details. (--unique)" /> |
| 0 | 67 </inputs> |
| 68 <outputs> | |
| 6 | 69 <data name="outfile" format_source="infile" metadata_source="infile"/> |
| 0 | 70 </outputs> |
| 1 | 71 <tests> |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
72 <test expect_num_outputs="1"> |
| 6 | 73 <param name="infile" value="sort1.bed"/> |
| 4 | 74 <param name="header" value="3"/> |
| 75 <repeat name="sortkeys"> | |
| 76 <param name="column" value="1"/> | |
| 77 <param name="style" value=""/> | |
| 78 <param name="order" value=""/> | |
| 79 </repeat> | |
| 80 <repeat name="sortkeys"> | |
| 81 <param name="column" value="3"/> | |
| 82 <param name="style" value="n"/> | |
| 83 <param name="order" value="r"/> | |
| 84 </repeat> | |
| 85 <output name="outfile" file="sort_result1.bed"/> | |
| 1 | 86 </test> |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
87 <test expect_num_outputs="1"> |
| 6 | 88 <param name="infile" value="sort1.bed"/> |
| 4 | 89 <param name="header" value="3"/> |
| 90 <repeat name="sortkeys"> | |
| 91 <param name="column" value="1"/> | |
| 92 <param name="style" value=""/> | |
|
8
fa7f88da29d7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 369e40078146d00608d52205bb8cee66ae735b76-dirty
bgruening
parents:
7
diff
changeset
|
93 <param name="order" value=""/> |
| 4 | 94 </repeat> |
| 95 <repeat name="sortkeys"> | |
| 96 <param name="column" value="3"/> | |
| 97 <param name="style" value="n"/> | |
| 98 <param name="order" value=""/> | |
| 99 </repeat> | |
| 100 <output name="outfile" file="sort_result2.bed"/> | |
| 1 | 101 </test> |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
102 <test expect_num_outputs="1"> |
| 6 | 103 <param name="infile" value="sort2.bed"/> |
| 4 | 104 <repeat name="sortkeys"> |
| 105 <param name="column" value="5"/> | |
| 106 <param name="style" value="g"/> | |
| 107 <param name="order" value=""/> | |
| 108 </repeat> | |
| 109 <output name="outfile" file="sort_result3.bed"/> | |
| 1 | 110 </test> |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
111 <test expect_num_outputs="1"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
112 <param name="infile" value="sort3.tabular"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
113 <param name="header" value="0"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
114 <param name="unique" value="false"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
115 <repeat name="sortkeys"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
116 <param name="column" value="2"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
117 <param name="start_charpos" value="7"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
118 <param name="order" value=""/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
119 <param name="style" value="n"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
120 </repeat> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
121 <repeat name="sortkeys"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
122 <param name="column" value="2"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
123 <param name="start_charpos" value="4"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
124 <param name="end_charpos" value="5"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
125 <param name="order" value=""/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
126 <param name="style" value="n"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
127 </repeat> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
128 <repeat name="sortkeys"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
129 <param name="column" value="2"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
130 <param name="start_charpos" value="1"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
131 <param name="end_charpos" value="2"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
132 <param name="order" value="r"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
133 <param name="style" value="n"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
134 </repeat> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
135 <output name="outfile" file="sorted3.tabular" ftype="tabular" /> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
136 </test> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
137 <!-- Test ignore_case param --> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
138 <test expect_num_outputs="1"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
139 <param name="infile" value="sort4.tabular"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
140 <param name="header" value="1"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
141 <param name="unique" value="false"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
142 <repeat name="sortkeys"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
143 <param name="column" value="1"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
144 <param name="order" value=""/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
145 <param name="style" value=""/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
146 <param name="ignore_case" value="true"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
147 </repeat> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
148 <repeat name="sortkeys"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
149 <param name="column" value="3"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
150 <param name="order" value="r"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
151 <param name="style" value="n"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
152 </repeat> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
153 <output name="outfile" file="sorted4_partial.tabular" ftype="tabular" /> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
154 </test> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
155 <!-- Test ignore_leading_blanks param --> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
156 <test expect_num_outputs="1"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
157 <param name="infile" value="sort4.tabular"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
158 <param name="header" value="1"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
159 <param name="unique" value="false"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
160 <repeat name="sortkeys"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
161 <param name="column" value="1"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
162 <param name="start_charpos" value="1"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
163 <param name="end_charpos" value="4"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
164 <param name="order" value=""/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
165 <param name="style" value=""/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
166 <param name="ignore_case" value="true"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
167 <param name="ignore_leading_blanks" value="true"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
168 </repeat> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
169 <repeat name="sortkeys"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
170 <param name="column" value="1"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
171 <param name="start_charpos" value="5"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
172 <param name="order" value=""/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
173 <param name="style" value=""/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
174 <param name="ignore_case" value="true"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
175 <param name="ignore_leading_blanks" value="true"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
176 </repeat> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
177 <repeat name="sortkeys"> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
178 <param name="column" value="3"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
179 <param name="order" value="r"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
180 <param name="style" value="n"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
181 <param name="ignore_leading_blanks" value="true"/> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
182 </repeat> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
183 <output name="outfile" file="sorted4.tabular" ftype="tabular" /> |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
184 </test> |
| 1 | 185 </tests> |
| 0 | 186 <help> |
| 4 | 187 <![CDATA[ |
| 0 | 188 **What it does** |
| 189 | |
| 190 This tool sorts an input file. | |
| 191 | |
| 192 ----- | |
| 193 | |
| 194 **Sorting Styles** | |
| 195 | |
| 196 * **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). | |
| 197 * **General Numeric**: sort by numeric values. Handles all numeric notations (including scientific notation). Slower than *fast numeric*, so use only when necessary. | |
| 198 * **Natural Sort**: Sort in 'natural' order (natural to humans, not to computers). See example below. | |
| 199 * **Alphabetical sort**: Sort in strict alphabetical order. See example below. | |
| 200 * **Human-readable numbers**: Sort human readble numbers (e.g. 1G > 2M > 3K > 400) | |
| 201 * **Random order**: return lines in random order. | |
| 202 | |
| 203 ------ | |
| 204 | |
| 205 **Example - Header line** | |
| 206 | |
| 207 **Input file** (note first line is a header line, should not be sorted):: | |
| 208 | |
| 209 Fruit Color Price | |
| 210 Banana Yellow 4.1 | |
| 211 Avocado Green 8.0 | |
| 212 Apple Red 3.0 | |
| 213 Melon Green 6.1 | |
| 214 | |
| 215 **Sorting** by **numeric order** on column **3**, with **header**, will return:: | |
| 216 | |
| 217 Fruit Color Price | |
| 218 Apple Red 3.0 | |
| 219 Banana Yellow 4.1 | |
| 220 Melon Green 6.1 | |
| 221 Avocado Green 8.0 | |
| 222 | |
| 223 | |
| 224 ----- | |
| 225 | |
| 226 **Example - Natural vs. Alphabetical sorting** | |
| 227 | |
| 228 Given the following list:: | |
| 229 | |
| 230 chr4 | |
| 231 chr13 | |
| 232 chr1 | |
| 233 chr10 | |
| 234 chr20 | |
| 235 chr2 | |
| 236 | |
| 237 **Alphabetical sort** would produce the following sorted list:: | |
| 238 | |
| 239 chr1 | |
| 240 chr10 | |
| 241 chr13 | |
| 242 chr2 | |
| 243 chr20 | |
| 244 chr4 | |
| 245 | |
| 246 **Natural Sort** would produce the following sorted list:: | |
| 247 | |
| 248 chr1 | |
| 249 chr2 | |
| 250 chr4 | |
| 251 chr10 | |
| 252 chr13 | |
| 253 chr20 | |
| 254 | |
| 255 | |
| 256 .. class:: infomark | |
| 257 | |
| 258 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. | |
| 259 | |
|
30
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
260 ----- |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
261 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
262 **Example - Sorting based on parts of column values** |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
263 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
264 The above column of chromosomes, with their constant prefix, could have been sorted in natural order also with the **Fast numeric sort** and **considering its characters from** character 4 only. |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
265 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
266 In general, sorting based on just a range of characters in a column can be useful for sorting values with internal structure, in a single tool run. |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
267 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
268 Consider, for example, the following column of dates, which is unfortunately not ISO-8601 formatted:: |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
269 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
270 10/24/2025 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
271 09/18/1974 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
272 12/16/1998 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
273 03/04/2007 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
274 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
275 You could modify these values with other tools first, but you can achieve correct chronological sort order with a single run of the sort tool like this: |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
276 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
277 - Do a **Fast numeric sort** on the column **considering its characters from** character 7 (the start of the year). |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
278 - Resolve ties (using another column selection section) with another **Fast numeric sort** on the same column **considering its characters from** character 1 **to and including** character 2 (the month representation). |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
279 - Resolve remaining ties with a third **Fast numeric sort** on again the same column **considering its characters from** character 4 **to and including** character 5 (the day representation). |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
280 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
281 This will result in the ascending chronological order:: |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
282 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
283 09/18/1974 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
284 11/17/1998 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
285 11/18/1998 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
286 12/16/1998 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
287 03/04/2007 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
288 10/24/2025 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
289 |
|
5907d248dee3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
bgruening
parents:
29
diff
changeset
|
290 Before relying on in-column character ranges, make extra sure that all values are formatted consistently (in the above example, that all dates use two digits for days and months and the same overall date format). |
| 4 | 291 ]]> |
| 0 | 292 </help> |
|
14
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
13
diff
changeset
|
293 <expand macro="citations" /> |
| 0 | 294 </tool> |
