comparison xena_import.py @ 36:d64a002c3b0c

modify
author jingchunzhu
date Fri, 24 Jul 2015 11:39:31 -0700
parents d8dc482ef970
children 1ef1886dae04
comparison
equal deleted inserted replaced
35:d8dc482ef970 36:d64a002c3b0c
116 # with zero status. 116 # with zero status.
117 xenaLoadCmd = "java -jar %s -l --force %s/%s -p %s" % (xena.jarPath(), 117 xenaLoadCmd = "java -jar %s -l --force %s/%s -p %s" % (xena.jarPath(),
118 xenaFileDir, 118 xenaFileDir,
119 genomicDataFile, 119 genomicDataFile,
120 xena.port()) 120 xena.port())
121 loadInToXena (xenaLoadCmd, fp2) 121 loadInToXena (xenaLoadCmd, genomicDataFile, fp2)
122 if args.probeMap is not None: 122 if args.probeMap is not None:
123 xenaLoadCmd = "java -jar %s -l --force %s/%s -p %s" % (xena.jarPath(), 123 xenaLoadCmd = "java -jar %s -l --force %s/%s -p %s" % (xena.jarPath(),
124 xenaFileDir, 124 xenaFileDir,
125 probeMapDataFile, 125 probeMapDataFile,
126 xena.port()) 126 xena.port())
127 loadInToXena (xenaLoadCmd, fp2) 127 loadInToXena (xenaLoadCmd, probeMapDataFile, fp2)
128 fp2.close()
128 129
129 130 def loadInToXena (xenaLoadCmd, name, fp2):
130 def loadInToXena (xenaLoadCmd, fp2): 131 print xenaLoadCmd
131 try: 132 try:
132 subprocess.call(xenaLoadCmd, shell=True) 133 subprocess.call(xenaLoadCmd, shell=True)
133 except: 134 except:
134 exc_type, exc_value, exc_traceback = sys.exc_info() 135 exc_type, exc_value, exc_traceback = sys.exc_info()
135 lines = traceback.format_exception(exc_type, exc_value, exc_traceback) 136 lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
136 allLines = ''.join('!! ' + line for line in lines) 137 allLines = ''.join('!! ' + line for line in lines)
138 fp2.write("Unsuccessful: Import %s\n" % (name))
137 fp2.write("Unsuccessful: error %s\n" % allLines) 139 fp2.write("Unsuccessful: error %s\n" % allLines)
138 fp2.close()
139 sys.exit(-1)
140 else: 140 else:
141 fp2.write( "Import successful\n") 141 fp2.write( "Import %s is successful\n" % (name))
142 fp2.close()
143 sys.exit(0)
144 142
145 if __name__ == "__main__": 143 if __name__ == "__main__":
146 main() 144 main()