-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_all.py
executable file
·31 lines (29 loc) · 1.17 KB
/
run_all.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
30
31
import glob, os, subprocess, sys
cdk_dir = "../../chemistry/cdk"
classpath = "bin:lib/*:" + ":".join([path for path in glob.glob(cdk_dir + "/*/*/target/classes")])
classpath += ":/Users/maclean/.m2/repository/java3d/vecmath/1.5.2/vecmath-1.5.2.jar"
classpath += ":/Users/maclean/.m2/repository/uk/ac/ebi/beam/beam-core/0.8/beam-core-0.8.jar"
classpath += ":/Users/maclean/.m2/repository/uk/ac/ebi/beam/beam-func/0.8/beam-func-0.8.jar"
classpath += ":/Users/maclean/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar"
# the file of formula-count pairs
input_file = sys.argv[1]
limit = int(sys.argv[2])
f_dict = {}
line_number = 0
for line in open(input_file):
line_number += 1
if line_number < 2: continue
if line_number > limit: break
formula, count = line.split()
f_dict[formula] = int(count.replace(",", ""))
print f_dict
for formula in f_dict:
expected = f_dict[formula]
obs = subprocess.check_output(["java", "-cp", classpath, "app.AMG", "-e", formula, "-t"])
try:
observed = int(obs.split()[0])
time = int(obs.split()[3])
#print expected == observed, formula, expected, observed, time
print formula, observed, time
except Exception:
pass