annotate saint_wrapper.py @ 21:cb85ef8dc169 draft

Uploaded
author bornea
date Tue, 17 Nov 2015 13:32:05 -0500
parents
children 7cd627b3d184
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
1 import os
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
2 import sys
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
3
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
4 inter_file = sys.argv[1]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
5 prey_file = sys.argv[2]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
6 bait_file = sys.argv[3]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
7 num_of_rep = sys.argv[4]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
8 vc_bool = sys.argv[5]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
9 vc_num = sys.argv[6]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
10 go_bool = sys.argv[7]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
11 go_file = sys.argv[8]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
12 output_file = sys.argv[9]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
13 ins_path = sys.argv[10]
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
14
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
15 def first_run_check():
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
16 os.chdir(ins_path)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
17 dirs_list = []
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
18 for (dirpath, dirnames, filename) in os.walk("./"):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
19 dirs_list.extend(dirnames)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
20 break
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
21 if r"SAINTexpress_v3.6.1__2015-05-03" in dirs_list:
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
22 pass
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
23 else:
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
24 cmd = r"unzip SAINTexpress_v3.6.1__2015-05-03.zip"
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
25 os.system(cmd)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
26 os.chdir("./SAINTexpress_v3.6.1__2015-05-03")
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
27 cmd1 = r"make -j"
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
28 os.system(cmd1)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
29
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
30 def default_run(inter_file1,prey_file1,bait_file1,output_file1,num_of_rep1):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
31 cmd = str(ins_path) + r"/SAINTexpress_v3.6.1__2015-05-03/bin/SAINTexpress-spc " + r"-R" + str(num_of_rep1) + " " + str(inter_file1) + " " + str(prey_file1) + " " + str(bait_file1)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
32 os.system(cmd)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
33 open('list.txt')
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
34 os.rename('list.txt', str(output_file1))
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
35
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
36 def with_L(inter_file1,prey_file1,bait_file1,output_file1,vc_num1,num_of_rep1):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
37 cmd = str(ins_path) + r"/SAINTexpress_v3.6.1__2015-05-03/bin/SAINTexpress-spc "+ r"-R" + str(num_of_rep1) + " " + r"-L" + str(vc_num1) + " " + str(inter_file1) + " " + str(prey_file1) + " " + str(bait_file1)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
38 os.system(cmd)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
39 open('list.txt')
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
40 os.rename('list.txt', str(output_file1))
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
41
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
42 def external_data_no_L(inter_file1,prey_file1,bait_file1,output_file1,go_file1,num_of_rep1):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
43 cmd = str(ins_path) + r"/SAINTexpress_v3.6.1__2015-05-03/bin/SAINTexpress-spc "+ r"-R" + str(num_of_rep1) + " " + str(inter_file1) + " " + str(prey_file1) + " " + str(bait_file1) + " " + str(go_file1)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
44 os.system(cmd)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
45 open('list.txt')
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
46 os.rename('list.txt', str(output_file1))
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
47
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
48 def external_data_with_L(inter_file1,prey_file1,bait_file1,output_file1,go_file1,num_of_rep1,vc_num1):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
49 cmd = str(ins_path) + r"/SAINTexpress_v3.6.1__2015-05-03/bin/SAINTexpress-spc "+ r"-R" + str(num_of_rep1) + " " + r"-L" + str(vc_num1) + " " + str(inter_file1) + " " + str(prey_file1) + " " + str(bait_file1) + " " + str(go_file1)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
50 os.system(cmd)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
51 open('list.txt')
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
52 os.rename('list.txt', str(output_file1))
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
53
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
54 if (vc_bool == "true"):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
55 if (go_bool == "false"):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
56 with_L(inter_file, prey_file, bait_file, output_file, vc_num, num_of_rep)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
57 elif (go_bool == "true"):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
58 external_data_with_L(inter_file, prey_file, bait_file, output_file, go_file, num_of_rep, vc_num)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
59 elif (vc_bool == "false"):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
60 if (go_bool == "false"):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
61 default_run(inter_file, prey_file, bait_file, output_file, num_of_rep)
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
62 elif (go_bool == "true"):
cb85ef8dc169 Uploaded
bornea
parents:
diff changeset
63 external_data_no_L(inter_file, prey_file, bait_file, output_file, go_file, num_of_rep)