view predict/ct_to_dot.py @ 93:f1eb39775b93 draft

Uploaded
author tyty
date Mon, 16 Feb 2015 02:29:27 -0500
parents
children
line wrap: on
line source

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import shlex
import os
import subprocess
from read_file import *

ct_file = sys.argv[1]
path = sys.argv[2]
id_s = sys.argv[3]
result_file = sys.argv[4]

h = file(result_file, 'w')
os.system('grep "'+id_s+'" '+ct_file+' |wc -l > '+path+'/count.txt')
count = read_t_file(path+'/count.txt')
for i in range(int(count[0][0])):
    command = shlex.split('ct2dot %s %s %s' % (ct_file, str(i+1), os.path.join(path, 'db_file_%s.dbnn' % str(i+1))))
    subprocess.call(command)



os.system('cat '+path+'/*.dbnn > '+result_file)
for i in range(int(count[0][0])):
    command = shlex.split('rm %s' % (os.path.join(path, 'db_file_%s.dbnn' % str(i+1))))
    subprocess.call(command)
command = shlex.split('rm %s' % (os.path.join(path, 'count.txt')))
subprocess.call(command)
    


h.close()