-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreformat_seed_stats.py
29 lines (24 loc) · 1.16 KB
/
reformat_seed_stats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import seed_fun
import sys
import re
def main(set, print_header = False):
fp = open("seeds%d.stats.txt" % set)
wp = open("seeds%s.stats2.txt" % set, "w")
header = fp.readline()
H = re.split("\s+", header.strip())
D = {x:i for i,x in enumerate(H)}
wp.write("{:<15}".format("seed_set") + "\t" + "\t".join(["{:<15}".format(x) for x in H]) + "\n")
if print_header:
wp2.write("{:<15}".format("seed_set") + "\t" + "\t".join(["{:<15}".format(x) for x in H]) + "\n")
for line in fp:
A = {H[i]:v for i,v in enumerate(re.split("\s+", line.rstrip()))}
if A['seed'] != 'NA':
A['seed'] = seed_fun.compact_seed(A['seed'])
A['ToolMem'] = 'NA' if A['ToolMem'] == 'NA' else str( int(A['ToolMem'])/1000000.0 )
A['ToolVMem'] = 'NA' if A['ToolVMem'] == 'NA' else str( int(A['ToolVMem'])/1000000.0 )
wp.write("{:<15}".format(set) + "\t" + "\t".join("{:<15}".format(A[h]) for h in H) + "\n")
if A['tool'] == 'phRAIDER':
wp2.write("{:<15}".format(set) + "\t" + "\t".join("{:<15}".format(A[h]) for h in H) + "\n")
wp2 = open("all.stats2.txt", "w")
for i in range(12,14):
main(i, i==1)