def testAnnotMtz2PdbxGood(self): """ Test mtz to pdbx conversion (good mtz) """ self.__lfh.write( "\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) diagfn = os.path.join(self.__tmpPath, "sf-convert-diags.cif") ciffn = os.path.join(self.__tmpPath, "sf-convert-datafile.cif") dmpfn = os.path.join(self.__tmpPath, "sf-convert-mtzdmp.log") # dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) mtzPath = os.path.join(self.__testFilePath, self.__testFileMtzGood) dp.imp(mtzPath) dp.setTimeout(15) ret = dp.op("annot-sf-convert") dp.expLog(os.path.join(self.__tmpPath, "sf-convert.log")) dp.expList(dstPathList=[ciffn, diagfn, dmpfn]) # dp.cleanup() self.assertTrue(ret == 0) self.assertTrue(ciffn) self.assertTrue(diagfn) self.assertTrue(dmpfn)
def testAnnotMtz2PdbxBad(self): """Test mtz to pdbx conversion""" logger.info("\nStarting") try: diagfn = "sf-convert-diags-bad.cif" ciffn = "sf-convert-datafile-bad.cif" dmpfn = "sf-convert-mtzdmp-bad.log" # # self.__testFileMtzRunaway = "bad-runaway.mtz" # self.__testFileXyzRunaway = "bad-runaway.cif" # dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) mtzPath = os.path.join(self.__testFilePath, self.__testFileMtzBad) dp.imp(mtzPath) # xyzPath=os.path.join(self.__testFilePath,self.__testFileXyzBad) dp.setTimeout(15) # dp.addInput(name="xyz_file_path",value=xyzPath) dp.op("annot-sf-convert") dp.expLog("sf-convert-bad.log") dp.expList(dstPathList=[ciffn, diagfn, dmpfn]) # dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()
def testAnnotMtz2PdbxBadTimeout(self): """ Test mtz to pdbx conversion """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: diagfn = "sf-convert-diags-bad-runaway.cif" ciffn = "sf-convert-datafile-bad-runaway.cif" dmpfn = "sf-convert-mtzdmp-bad-runaway.log" # dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) dp.setDebugMode() mtzPath = os.path.join(self.__testFilePath, self.__testFileMtzRunaway) dp.imp(mtzPath) dp.setTimeout(15) dp.op("annot-sf-convert") dp.expLog("sf-convert-runaway.log") dp.expList(dstPathList=[ciffn, diagfn, dmpfn]) # dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def mtz2Pdbx(self, mtzFilePath, outSfFilePath, pdbxFilePath=None, logFilePath=None, diagsFilePath=None, dumpFilePath=None, timeout=120): """ Convert input MTZ format to PDBx sf file. """ try: diagfn = logFilePath if logFilePath is not None else "sf-convert-diags.cif" dmpfn = dumpFilePath if dumpFilePath is not None else "sf-convert-mtzdmp.log" # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(mtzFilePath) dp.setTimeout(timeout) if pdbxFilePath is not None: dp.addInput(name="xyz_file_path", value=pdbxFilePath) dp.op("annot-sf-convert") dp.expLog(logFilePath) dp.expList(dstPathList=[outSfFilePath, diagfn, dmpfn]) if (not self.__debug): dp.cleanup() return True except: self.__lfh.write( "+DataFileAdapter.mtz2Pdbx() - failing for mtz file path %s output path %s\n" % (mtzFilePath, outSfFilePath)) traceback.print_exc(file=self.__lfh) return False
def testAnnotMtz2PdbxGood(self): """Test mtz to pdbx conversion (good mtz)""" logger.info("\nStarting") try: diagfn = "sf-convert-diags.cif" ciffn = "sf-convert-datafile.cif" dmpfn = "sf-convert-mtzdmp.log" # dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) dp.setDebugMode() mtzPath = os.path.join(self.__testFilePath, self.__testFileMtzGood) dp.imp(mtzPath) dp.setTimeout(15) dp.op("annot-sf-convert") dp.expLog("sf-convert.log") dp.expList(dstPathList=[ciffn, diagfn, dmpfn]) # dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()