11<tool id =" sort1" name =" Sort" version =" 1.2.0" >
22 <description >data in ascending or descending order</description >
33 <requirements >
4- <requirement type =" package" version =" 3.8" >python</requirement >
54 <requirement type =" package" version =" 2.14" >grep</requirement >
65 <requirement type =" package" version =" 4.4" >sed</requirement >
76 <requirement type =" package" version =" 8.31" >coreutils</requirement >
87 </requirements >
9- <command detect_errors =" exit_code" >
10- python '$__tool_directory__/sorter.py'
11-
12- --input='$input'
13- --output='$out_file1'
8+ <command detect_errors =" exit_code" ><![CDATA[
9+ ## Sorts tabular data on one or more columns. All comments of the file are
10+ ## collected and placed at the beginning of the sorted output file.
11+ #if $header_lines > 0:
12+ sed -n 1,${header_lines}p '$input' > '$out_file1' &&
13+ #end if
14+ grep '^#' '$input' >> '$out_file1';
15+ #if $header_lines > 0:
16+ sed 1,${header_lines}d '$input' |
17+ #else:
18+ < '$input'
19+ #end if
20+ grep '^[^#]' | sort -f -t \$'\t'
1421
1522#if (str($style) == 'num'):
1623 #set $style = 'n'
@@ -22,8 +29,7 @@ python '$__tool_directory__/sorter.py'
2229
2330#set $order = '' if (str($order) == 'ASC') else 'r'
2431
25- --key=${column},${column}${style}${order}
26-
32+ -k ${column},${column}${style}${order}
2733
2834#for $col in $column_set:
2935 #set $other_column = str($col.other_column)
@@ -37,10 +43,10 @@ python '$__tool_directory__/sorter.py'
3743 #end if
3844
3945 #set $other_order = '' if (str($col.other_order) == "ASC") else 'r'
40- --key= ${other_column},${other_column}${other_style}${other_order}
46+ -k ${other_column},${other_column}${other_style}${other_order}
4147#end for
42- --header $header_lines
43- </command >
48+ >> '$out_file1'
49+ ]]> </command >
4450 <inputs >
4551 <param format =" tabular" name =" input" type =" data" label =" Sort Dataset" />
4652 <param name =" column" label =" on column" type =" data_column" data_ref =" input" accept_default =" true" />
0 commit comments