|
0
|
1 # BEGIN_COPYRIGHT
|
|
|
2 # END_COPYRIGHT
|
|
|
3
|
|
|
4 import sys
|
|
|
5 from bl.vl.app.kb_query.main import main as kb_query
|
|
|
6
|
|
|
7 def main(argv):
|
|
|
8 selected_column, new_column_name, input_file = argv[:3]
|
|
|
9 selected_column = int(selected_column) - 1
|
|
|
10 new_column_name = new_column_name.strip()
|
|
|
11
|
|
|
12 # with open(input_file) as f:
|
|
|
13 # l = f.readline().strip()
|
|
|
14 # Backport to 2.6
|
|
|
15 fi = open(input_file)
|
|
|
16 l = fi.readline().strip()
|
|
|
17 fi.close()
|
|
|
18
|
|
|
19 column_names = l.split('\t')
|
|
|
20 column_name = column_names[selected_column]
|
|
|
21
|
|
|
22 argv = argv[3:] + ['--column=%s,%s' % (column_name, new_column_name)]
|
|
|
23 kb_query(argv)
|
|
|
24
|
|
|
25 main(sys.argv[1:])
|