comparison xena_import.py @ 38:1ef1886dae04

data import sucess/unsuccess message more informative
author jingchunzhu
date Fri, 24 Jul 2015 12:12:37 -0700
parents d64a002c3b0c
children 8da6920a39ac
comparison
equal deleted inserted replaced
37:97325a1202d2 38:1ef1886dae04
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, genomicDataFile, fp2) 121 if args.label is not None:
122 name = args.label
123 else:
124 name = genomicDataFile
125 loadInToXena (xenaLoadCmd, name, fp2)
126
122 if args.probeMap is not None: 127 if args.probeMap is not None:
123 xenaLoadCmd = "java -jar %s -l --force %s/%s -p %s" % (xena.jarPath(), 128 xenaLoadCmd = "java -jar %s -l --force %s/%s -p %s" % (xena.jarPath(),
124 xenaFileDir, 129 xenaFileDir,
125 probeMapDataFile, 130 probeMapDataFile,
126 xena.port()) 131 xena.port())
127 loadInToXena (xenaLoadCmd, probeMapDataFile, fp2) 132 loadInToXena (xenaLoadCmd, "id to gene mapping file for %s" % (name), fp2)
128 fp2.close() 133 fp2.close()
129 134
130 def loadInToXena (xenaLoadCmd, name, fp2): 135 def loadInToXena (xenaLoadCmd, name, fp2):
131 print xenaLoadCmd 136 print xenaLoadCmd
132 try: 137 try:
136 lines = traceback.format_exception(exc_type, exc_value, exc_traceback) 141 lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
137 allLines = ''.join('!! ' + line for line in lines) 142 allLines = ''.join('!! ' + line for line in lines)
138 fp2.write("Unsuccessful: Import %s\n" % (name)) 143 fp2.write("Unsuccessful: Import %s\n" % (name))
139 fp2.write("Unsuccessful: error %s\n" % allLines) 144 fp2.write("Unsuccessful: error %s\n" % allLines)
140 else: 145 else:
141 fp2.write( "Import %s is successful\n" % (name)) 146 fp2.write( "Importing %s is successful\n" % (name))
142 147
143 if __name__ == "__main__": 148 if __name__ == "__main__":
144 main() 149 main()