annotate micropita_prepare.py @ 12:6e94c5a60c80

Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
author george-weingart
date Tue, 06 May 2014 20:20:26 -0400
parents 1dcb00d567f7
children 627e25eb606d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
1 #!/usr/bin/env python
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
2
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
3 """
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
4 Author: George Weingart
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
5 Description: Prepare parameters to call micropita
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
6 """
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
7
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
8 #####################################################################################
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
9 #Copyright (C) <2012>
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
10 #
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
11 #Permission is hereby granted, free of charge, to any person obtaining a copy of
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
12 #this software and associated documentation files (the "Software"), to deal in the
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
13 #Software without restriction, including without limitation the rights to use, copy,
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
14 #modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
15 #and to permit persons to whom the Software is furnished to do so, subject to
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
16 #the following conditions:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
17 #
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
18 #The above copyright notice and this permission notice shall be included in all copies
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
19 #or substantial portions of the Software.
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
20 #
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
21 #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
22 #INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
23 #PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
24 #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
25 #OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
26 #SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
27 #####################################################################################
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
28
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
29 __author__ = "George Weingart"
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
30 __copyright__ = "Copyright 2012"
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
31 __credits__ = ["George Weingart"]
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
32 __license__ = "MIT"
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
33 __maintainer__ = "George Weingart"
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
34 __email__ = "george.weingart@gmail.com"
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
35 __status__ = "Development"
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
36
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
37 import argparse
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
38 from cStringIO import StringIO
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
39 import sys,string,time
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
40 import os
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
41 from time import gmtime, strftime
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
42 from pprint import pprint
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
43 import subprocess
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
44 import blist
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
45 import shlex
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
46 import tempfile
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
47
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
48 ##################################################################################
12
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
49 # Modification by George Weingart 5/6/2014 #
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
50 # Using subprocess to invoke the calls to Micropita #
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
51 # and allocating the temporary file using trmpfile #
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
52 ##################################################################################
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
53
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
54
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
55
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
56
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
57 ##################################################################################
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
58 # Decode Parms #
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
59 ##################################################################################
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
60 def read_params(x):
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
61 parser = argparse.ArgumentParser(description='Micropita Annotate Argparser')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
62 parser.add_argument('--input', action="store",dest='inputname')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
63 parser.add_argument('--output', action="store",dest='outputname')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
64 parser.add_argument('-m', action="store",dest='MParameter')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
65 parser.add_argument('-n', action="store",dest='NSamples')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
66 parser.add_argument('--lastmeta', action="store",dest='lastmeta')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
67 parser.add_argument('--stratify_value', action="store",dest='stratify_value')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
68
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
69
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
70 try:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
71 parser.add_argument('--feature_method', action="store",dest='feature_method')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
72 except:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
73 pass
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
74 try:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
75 parser.add_argument('--targets', action="store",dest='targets')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
76 except:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
77 pass
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
78 try:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
79 parser.add_argument('--label_value', action="store",dest='label_value')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
80 except:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
81 pass
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
82 return parser
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
83
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
84
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
85 ##################################################################################
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
86 # Main Program #
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
87 ##################################################################################
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
88 parser = read_params( sys.argv )
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
89 results = parser.parse_args()
3
800220830386 Updated the root_dir parameter
george-weingart
parents: 2
diff changeset
90 root_dir = os.environ.get('micropita_SCRIPT_PATH')
800220830386 Updated the root_dir parameter
george-weingart
parents: 2
diff changeset
91
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
92
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
93 fname = results.inputname
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
94 input_file = open(fname,'rU')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
95 input_lines = input_file.readlines()
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
96 input_file.close()
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
97 table_lines = []
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
98 for x in input_lines:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
99 first_column = x.split('\t')[0]
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
100 table_lines.append(first_column)
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
101
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
102
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
103
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
104 FileTimeStamp = strftime("%Y%m%d%H%M%S", gmtime())
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
105 LastMetaInt = 0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
106 if results.lastmeta and not results.lastmeta == "None":
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
107 LastMetaInt = int(results.lastmeta) - 1
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
108
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
109 StratifyValueInt = 0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
110 if results.stratify_value and not results.stratify_value == "None":
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
111 StratifyValueInt = int(results.stratify_value) - 2
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
112
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
113 LabelValueInt = 0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
114 if results.label_value and not results.label_value == "None":
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
115 LabelValueInt = int(results.label_value) - 1
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
116
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
117 stratify_string = ""
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
118 q = '"'
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
119 if not results.stratify_value == '1':
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
120 stratify_string = " --stratify " + q + table_lines[StratifyValueInt] + q + " "
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
121
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
122 if results.MParameter == "features":
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
123 TBTargets = list()
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
124 TableTargets = results.targets.split(',')
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
125 for t in TableTargets:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
126 tb_entry = int(t) + LastMetaInt
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
127 TBTargets.append(int(tb_entry))
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
128
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
129
11
1dcb00d567f7 Set delete=False when allocating temp file
george-weingart
parents: 10
diff changeset
130 OutTargetsFile = tempfile.NamedTemporaryFile('w', delete=False )
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
131 TempTargetsFileName = OutTargetsFile.name
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
132 indx = -1
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
133 for c in table_lines:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
134 indx+=1
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
135 if indx in TBTargets:
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
136 OutputString = table_lines[indx] + "\n"
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
137 OutTargetsFile.write(OutputString)
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
138 OutTargetsFile.close()
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
139 os_command = "python " + \
4
73ab9bfbeaf1 Updated root-dir parameter
george-weingart
parents: 3
diff changeset
140 root_dir + \
8
da693b03b582 Modified the call to os.system
george-weingart
parents: 7
diff changeset
141 "/MicroPITA.py "+\
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
142 "--lastmeta " + table_lines[LastMetaInt]+ " " +\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
143 "--feature_method " + results.feature_method + " " + \
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
144 "--target " + TempTargetsFileName + " " +\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
145 "-m " + results.MParameter + " " + \
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
146 "-n " + results.NSamples + " " +\
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
147 stratify_string + " " +\
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
148 results.inputname + " " +\
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
149 results.outputname
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
150 #print os_command
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
151 os.system(os_command)
12
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
152 argsx = shlex.split(os_command) #Split the command
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
153 try:
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
154 subprocess.check_call(argsx , shell=False)
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
155 except:
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
156 print "The call to micropita failed============="
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
157 sys.exit(0)
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
158
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
159
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
160
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
161 if results.MParameter == "representative"\
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
162 or results.MParameter == "diverse"\
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
163 or results.MParameter == "extreme":
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
164 os_command = "python " + \
4
73ab9bfbeaf1 Updated root-dir parameter
george-weingart
parents: 3
diff changeset
165 root_dir + \
8
da693b03b582 Modified the call to os.system
george-weingart
parents: 7
diff changeset
166 "/MicroPITA.py "+\
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
167 "--lastmeta " + table_lines[LastMetaInt]+ " " +\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
168 "-m " + results.MParameter + " " + \
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
169 "-n " + results.NSamples + " " +\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
170 stratify_string + " " + \
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
171 results.inputname + " " +\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
172 results.outputname
12
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
173 argsx = shlex.split(os_command) #Split the command
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
174 try:
10
2f588c566849 Modified the invication of the commad using subprocess and modified tempfile
george-weingart
parents: 9
diff changeset
175 ###os.system(os_command)
2f588c566849 Modified the invication of the commad using subprocess and modified tempfile
george-weingart
parents: 9
diff changeset
176 subprocess.check_call(argsx , shell=False)
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
177 except:
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
178 print "The call to micropita failed============="
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
179 sys.exit(0)
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
180
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
181
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
182
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
183
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
184 if results.MParameter == "distinct"\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
185 or results.MParameter == "discriminant":
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
186 os_command = "python " + \
4
73ab9bfbeaf1 Updated root-dir parameter
george-weingart
parents: 3
diff changeset
187 root_dir + \
8
da693b03b582 Modified the call to os.system
george-weingart
parents: 7
diff changeset
188 "/MicroPITA.py "+\
2
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
189 "--lastmeta " + table_lines[LastMetaInt]+ " " +\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
190 "--label " + table_lines[LastMetaInt]+ " " +\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
191 "-m " + results.MParameter + " " + \
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
192 "-n " + results.NSamples + " " +\
31f689324222 Uploaded Updated version of the prepare program with subprocess and tempfile enhancements + debug displays
george-weingart
parents: 0
diff changeset
193 stratify_string + " " + \
0
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
194 results.inputname + " " +\
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
195 results.outputname
d589875b8125 First version of micropita in this repository
george-weingart
parents:
diff changeset
196 #print os_command
12
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
197 argsx = shlex.split(os_command) #Split the command
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
198 try:
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
199 subprocess.check_call(argsx , shell=False)
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
200 except:
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
201 print "The call to micropita failed============="
6e94c5a60c80 Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
george-weingart
parents: 11
diff changeset
202 sys.exit(0)