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

Uploaded
author tyty
date Thu, 19 Mar 2015 17:40:57 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/predict/ct_to_dot.py	Thu Mar 19 17:40:57 2015 -0400
@@ -0,0 +1,36 @@
+#!/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')
+comm = ''
+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)
+    comm = comm +' '+path+'/db_file_'+str(i+1)+'.dbnn' 
+
+
+
+os.system('cat'+comm+' > '+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()
+