root/galaxy-central/tools/filters/sorter.xml @ 2

リビジョン 2, 4.5 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1<tool id="sort1" name="Sort" version="1.0.1">
2  <description>data in ascending or descending order</description>
3  <command interpreter="python">
4    sorter.py
5      --input=$input
6      --out_file1=$out_file1
7      --column=$column
8      --style=$style
9      --order=$order
10      #for $col in $column_set:
11        ${col.other_column}
12        ${col.other_style}
13        ${col.other_order}
14      #end for
15  </command>
16  <inputs>
17    <param format="tabular" name="input" type="data" label="Sort Query" />
18    <param name="column" label="on column" type="data_column" data_ref="input" accept_default="true" />
19    <param name="style" type="select" label="with flavor">
20      <option value="num">Numerical sort</option>
21      <option value="alpha">Alphabetical sort</option>
22    </param>
23    <param name="order" type="select" label="everything in">
24      <option value="DESC">Descending order</option>
25      <option value="ASC">Ascending order</option>
26    </param>
27    <repeat name="column_set" title="Column selection">
28      <param name="other_column" label="on column" type="data_column" data_ref="input" accept_default="true" />
29      <param name="other_style" type="select" label="with flavor">
30        <option value="num">Numerical sort</option>
31        <option value="alpha">Alphabetical sort</option>
32      </param>
33      <param name="other_order" type="select" label="everything in">
34        <option value="DESC">Descending order</option>
35        <option value="ASC">Ascending order</option>
36      </param>
37    </repeat>
38  </inputs>
39  <outputs>
40    <data format="input" name="out_file1" metadata_source="input"/>
41  </outputs>
42  <tests>
43    <test>
44      <param name="input" value="sort_in1.bed"/>
45      <param name="column" value="1"/>
46      <param name="style" value="num"/>
47      <param name="order" value="ASC"/>
48      <param name="other_column" value="3"/>
49      <param name="other_style" value="num"/>
50      <param name="other_order" value="ASC"/>
51      <output name="out_file1" file="sort_out1.bed"/>
52    </test>
53    <test>
54      <param name="input" value="sort_in1.bed"/>
55      <param name="column" value="3"/>
56      <param name="style" value="alpha"/>
57      <param name="order" value="ASC"/>
58      <param name="other_column" value="1"/>
59      <param name="other_style" value="alpha"/>
60      <param name="other_order" value="ASC"/>
61      <output name="out_file1" file="sort_out2.bed"/>
62    </test>
63  </tests>
64  <help>
65
66.. class:: infomark
67
68**TIP:** If your data is not TAB delimited, use *Text Manipulation-&gt;Convert*
69
70-----
71
72**Syntax**
73
74This tool sorts the dataset on any number of columns in either ascending or descending order.
75
76* Numerical sort orders numbers by their magnitude, ignores all characters besides numbers, and evaluates a string of numbers to the value they signify. 
77* Alphabetical sort is a phonebook type sort based on the conventional order of letters in an alphabet. Each nth letter is compared with the nth letter of other words in the list, starting at the first letter of each word and advancing to the second, third, fourth, and so on, until the order is established. Therefore, in an alphabetical sort, 2 comes after 100 (1 &lt; 2).
78
79-----
80
81**Examples**
82
83The list of numbers 4,17,3,5 collates to 3,4,5,17 by numerical sorting, while it collates to 17,3,4,5 by alphabetical sorting.
84
85Sorting the following::
86
87  Q     d    7   II    jhu  45
88  A     kk   4   I     h    111
89  Pd    p    1   ktY   WS   113
90  A     g    10  H     ZZ   856
91  A     edf  4   tw    b    234
92  BBB   rt   10  H     ZZ   100
93  A     rew  10  d     b    1111
94  C     sd   19  YH    aa   10
95  Hah   c    23  ver   bb   467
96  MN    gtr  1   a     X    32
97  N     j    9   a     T    205
98  BBB   rrf  10  b     Z    134
99  odfr  ws   6   Weg   dew  201
100  C     f    3   WW    SW   34
101  A     jhg  4   I     b    345
102  Pd    gf   7   Gthe  de   567
103  rS    hty  90  YY    LOp  89
104  A     g    10  H     h    43
105  A     g    4   I     h    500
106
107on columns 1 (alpha), 3 (num), and 6 (num) in ascending order will yield::
108
109  A     kk   4   I     h    111
110  A     edf  4   tw    b    234
111  A     jhg  4   I     b    345
112  A     g    4   I     h    500
113  A     g    10  H     h    43
114  A     g    10  H     ZZ   856
115  A     rew  10  d     b    1111
116  BBB   rt   10  H     ZZ   100
117  BBB   rrf  10  b     Z    134
118  C     f    3   WW    SW   34
119  C     sd   19  YH    aa   10
120  Hah   c    23  ver   bb   467
121  MN    gtr  1   a     X    32
122  N     j    9   a     T    205
123  odfr  ws   6   Weg   dew  201
124  Pd    p    1   ktY   WS   113
125  Pd    gf   7   Gthe  de   567
126  Q     d    7   II    jhu  45
127  rS    hty  90  YY    LOp  89
128
129  </help>
130</tool>
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。