comparison saint_wrapper.py @ 21:cb85ef8dc169 draft

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