comparison uniq.py @ 0:4382d742830f draft

Uploaded
author bgruening
date Mon, 26 Aug 2013 04:38:43 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4382d742830f
1 import sys
2 import subprocess
3
4 """
5 We only need that file because galaxy do not understand the -t $'\t' term.
6 Otherwise that would be the right XML-only solution:
7 sort -u
8 $ignore_case
9 $is_numeric
10 -t \$'\t'
11 #if $adv_opts.adv_opts_selector=="advanced":
12 -k$adv_opts.column_start,$adv_opts.column_end
13 #end if
14 -o $outfile
15 $input
16 """
17
18 if sys.argv[1].strip() != 'false':
19 ignore_case = sys.argv[1]
20 else:
21 ignore_case = ''
22
23 if sys.argv[2].strip() != 'false':
24 is_numeric = sys.argv[2]
25 else:
26 is_numeric = ''
27
28 try:
29 col_start = sys.argv[3]
30 col_end = sys.argv[4]
31 com = "sort -u %s %s -t ' ' -k%s,%s -o %s %s" % (is_numeric, ignore_case, col_start, col_end, sys.argv[5], sys.argv[6])
32 except:
33 # no advanced options selected
34 com = "sort -u %s %s -t ' ' -o %s %s" % (is_numeric, ignore_case, sys.argv[3], sys.argv[4])
35
36 subprocess.call(com, shell=True)