comparison predict/ct_to_dot.py @ 102:43ea205aa49e draft

Uploaded
author tyty
date Thu, 19 Mar 2015 17:40:57 -0400
parents
children
comparison
equal deleted inserted replaced
101:a5c8b470bc9f 102:43ea205aa49e
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import sys
5 import shlex
6 import os
7 import subprocess
8 from read_file import *
9
10 ct_file = sys.argv[1]
11 path = sys.argv[2]
12 id_s = sys.argv[3]
13 result_file = sys.argv[4]
14
15 h = file(result_file, 'w')
16 os.system('grep "'+id_s+'" '+ct_file+' |wc -l > '+path+'/count.txt')
17 count = read_t_file(path+'/count.txt')
18 comm = ''
19 for i in range(int(count[0][0])):
20 command = shlex.split('ct2dot %s %s %s' % (ct_file, str(i+1), os.path.join(path, 'db_file_%s.dbnn' % str(i+1))))
21 subprocess.call(command)
22 comm = comm +' '+path+'/db_file_'+str(i+1)+'.dbnn'
23
24
25
26 os.system('cat'+comm+' > '+result_file)
27 for i in range(int(count[0][0])):
28 command = shlex.split('rm %s' % (os.path.join(path, 'db_file_%s.dbnn' % str(i+1))))
29 subprocess.call(command)
30 command = shlex.split('rm %s' % (os.path.join(path, 'count.txt')))
31 subprocess.call(command)
32
33
34
35 h.close()
36