def testChemicalShiftCoordinateCheck2Alt(self): """ Test upload check of one CS file --- Using the wrong model to generate errors """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) dp.setDebugMode(flag=True) inpPath = os.path.join(self.__testFilePath, self.__testConcatCS) xyzPath = os.path.abspath(os.path.join(self.__testFilePath, self.__testFileNmrModelAlt)) outPath = "output-cs-file-concat-alt.cif" chkPath = "cs-diag-atom-name-check-concat-alt.cif" dp.imp(inpPath) dp.addInput(name="coordinate_file_path", value=xyzPath) dp.addInput(name="chemical_shifts_coord_check_file_path", value=chkPath) dp.op("annot-chem-shifts-atom-name-check") dp.expLog("annot-chem-shifts-atom-name-check-concat-alt.log") dp.exp(outPath) # if os.access(chkPath, os.R_OK): csr = PdbxChemShiftReport(inputPath=chkPath, verbose=self.__verbose, log=self.__lfh) status = csr.getStatus() logger.info("Status code: %s\n" % status) warnings = csr.getWarnings() logger.info("\n\nWarning count : %d\n %s\n" % (len(warnings), ('\n').join(warnings))) # errors = csr.getErrors() logger.info("\n\nError count : %d\n %s\n" % (len(errors), ('\n').join(errors))) # # 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 testAnnotDccReport(self): """ Test create DCC report - """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: ofn = "dcc-report.cif" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) dp.setDebugMode() xyzPath = os.path.join(self.__testFilePath, self.__testFileValidateXyz) sfPath = os.path.join(self.__testFilePath, self.__testFileValidateSf) dp.imp(xyzPath) dp.addInput(name="sf_file_path", value=sfPath) dp.op("annot-dcc-report") dp.expLog("dcc-report.log") dp.exp(ofn) # dp.expList(dstPathList=[ofpdf,ofxml]) dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testPisaAssemblyDownloadModelPdb(self): """ """ logger.info("\nStarting") try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) fPath = os.path.join(self.__testFilePath, self.__testFileCifPisa) dp.imp(fPath) dp.addInput(name="pisa_session_name", value="session_3re3_cif") dp.op("pisa-analysis") dp.expLog("pisa-anal-assembly-cif.log.gz") dp.op("pisa-assembly-report-xml") dp.exp("pisa-assembly-report-cif.xml") dp.expLog("pisa-report-xml-cif.log.gz") # for assemId in ["1", "2", "3", "4", "5"]: dp.addInput(name="pisa_assembly_id", value=assemId) oFileName = "3rer-assembly-" + assemId + ".pdb.gz" oLogName = "3rer-assembly-" + assemId + "-pdb.log.gz" dp.op("pisa-assembly-coordinates-pdb") dp.exp(oFileName) dp.expLog(oLogName) dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()
def testChemicalShiftCoordinateCheck2(self): """Test upload check of one CS file --- Using a processed chemical shift file""" logger.info("\nStarting") try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) dp.setDebugMode(flag=True) inpPath = os.path.join(self.__testFilePath, self.__testConcatCS) xyzPath = os.path.abspath( os.path.join(self.__testFilePath, self.__testFileNmrModel)) outPath = "output-cs-file-concat.cif" chkPath = "cs-diag-atom-name-check-concat.cif" dp.imp(inpPath) dp.addInput(name="coordinate_file_path", value=xyzPath) dp.addInput(name="chemical_shifts_coord_check_file_path", value=chkPath) dp.op("annot-chem-shifts-atom-name-check") dp.expLog("annot-chem-shifts-atom-name-check-concat.log") dp.exp(outPath) # dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()
def testAnnotSiteAndMerge(self): """Calculate site environment""" logger.info("\nStarting") try: of = "annot-site-" + self.__testFileAnnotSite # +".gz" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) inpPath = os.path.join(self.__testFilePath, self.__testFileAnnotSite) dp.imp(inpPath) dp.addInput(name="block_id", value=self.__testIdAnnotSite) dp.op("annot-site") dp.expLog("annot-site.log") dp.exp(of) inpPath = os.path.join(self.__testFilePath, self.__testFileAnnotSite) dp.imp(inpPath) dp.addInput(name="site_info_file_path", value=of, type="file") dp.op("annot-merge-struct-site") dp.exp("annot-site-updated.cif.gz") dp.expLog("annot-site-updated-cif.log.gz") # dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()
def pdbx2Assemblies(self, idCode, inpFilePath, outPath=".", indexFilePath=None): """Create model assemby files from input PDBx model file.""" try: pdbxPath = inpFilePath logPath = os.path.join(self.__sessionPath, "pdbx-assembly.log") # indexFilePath=os.path.join(self.__sessionPath,"pdbx-assembly-index.txt") # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(pdbxPath) if idCode is not None: dp.addInput(name="deposition_data_set_id", value=idCode, type="param") if indexFilePath is not None: dp.addInput(name="index_file_path", value=indexFilePath, type="param") dp.op("annot-gen-assem-pdbx") dp.expLog(logPath) pthList = dp.getResultPathList() # wrkPath = dp.getWorkingDir() for pth in pthList: if os.access(pth, os.R_OK): (_t, fn) = os.path.split(pth) shutil.copyfile(pth, os.path.join(outPath, fn)) # if (not self.__debug): # dp.cleanup() # if self.__verbose: self.__lfh.write("+DataFileAdapter.pdbx2Assemblies() - input model file path: %s\n" % inpFilePath) self.__lfh.write("+DataFileAdapter.pdbx2Assemblies() - assembly output paths: %r\n" % pthList) return True except: # noqa: E722 pylint: disable=bare-except self.__lfh.write("+DataFileAdapter.pdbx2Assemblies() - failing for input file path %s output path %s\n" % (inpFilePath, outPath)) traceback.print_exc(file=self.__lfh) return False
def testAnnotLigandMapCalc(self): """Test create density maps --""" logger.info("\nStarting") try: for pdbId in ["3of4"]: # of2fofc=pdbId+"_2fofc.map" # offofc=pdbId+"_fofc.map" testFileXyz = pdbId + ".cif" testFileSf = pdbId + "-sf.cif" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) xyzPath = os.path.join(self.__testFilePath, testFileXyz) sfPath = os.path.join(self.__testFilePath, testFileSf) outMapPath = "." outMapPathFull = os.path.abspath(outMapPath) # dp.imp(xyzPath) dp.addInput(name="sf_file_path", value=sfPath) dp.addInput(name="output_map_file_path", value=outMapPathFull) dp.op("annot-make-ligand-maps") dp.expLog(pdbId + "-annot-make-ligand-maps.log") # dp.expList(dstPathList=[of2fofc,offofc]) # dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()
def testAnnotValidateListXrayTest(self): """Test create validation report for the test list of example PDB ids (NMR examples)""" logger.info("\nStarting") try: for pdbId in self.__testValidateXrayIdList: ofpdf = pdbId + "-valrpt.pdf" ofxml = pdbId + "-valdata.xml" offullpdf = pdbId + "-valrpt_full.pdf" ofpng = pdbId + "-val-slider.png" ofsvg = pdbId + "-val-slider.svg" # testFileValidateXyz = pdbId + ".cif" testFileValidateSf = pdbId + "-sf.cif" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) # dp.setDebugMode(True) xyzPath = os.path.abspath( os.path.join(self.__testFilePath, testFileValidateXyz)) sfPath = os.path.abspath( os.path.join(self.__testFilePath, testFileValidateSf)) # dp.addInput(name="request_annotation_context", value="yes") dp.addInput(name="request_validation_mode", value="annotate") # dp.addInput(name="request_validation_mode", value="server") dp.imp(xyzPath) dp.addInput(name="sf_file_path", value=sfPath) dp.op("annot-wwpdb-validate-all") dp.expLog(pdbId + "-annot-validate-test.log") dp.expList(dstPathList=[ofpdf, ofxml, offullpdf, ofpng, ofsvg]) # dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()
def test_AnnotMergeRemote(self): """ Test of updating geometrical validation diagnostics - """ self.__lfh.write( "\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) for pdbId in self.__testValidateXrayIdList: self.__tmpPath = tempfile.mkdtemp( dir=self.__siteWebAppsSessionsPath) testFileValidateXyz = pdbId + ".cif" xyzPath = os.path.abspath( os.path.join(self.__testFilePath, testFileValidateXyz)) dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) of = os.path.join(self.__tmpPath, "annot-merge-xyz-remote.cif") dp.imp(xyzPath) dp.addInput(name="new_coordinate_file_path", value=xyzPath) dp.addInput(name="new_coordinate_format", value='cif') # dp.setRunRemote() ret = dp.op("annot-merge-xyz") dp.expLog( os.path.join(self.__tmpPath, "annot-merge-xyz-remote.log")) dp.exp(of) # dp.cleanup() self.assertTrue(ret == 0) self.assertTrue(os.path.exists(of))
def testPisaAssemblyDownloadModelPdb(self): """ """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) fPath = os.path.join(self.__testFilePath, self.__testFileCifPisa) dp.imp(fPath) dp.addInput(name="pisa_session_name", value="session_3re3_cif") dp.op("pisa-analysis") dp.expLog("pisa-anal-assembly-cif.log.gz") dp.op("pisa-assembly-report-xml") dp.exp("pisa-assembly-report-cif.xml") dp.expLog("pisa-report-xml-cif.log.gz") # for assemId in ['1', '2', '3', '4', '5']: dp.addInput(name="pisa_assembly_id", value=assemId) oFileName = '3rer-assembly-' + assemId + '.pdb.gz' oLogName = '3rer-assembly-' + assemId + '-pdb.log.gz' dp.op("pisa-assembly-coordinates-pdb") dp.exp(oFileName) dp.expLog(oLogName) dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testAnnotOmitMapCalc(self): """ Test create density maps -- """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: for pdbId in self.__testValidateIdList: of2fofc = pdbId + "_map-omit-2fofc_P1.map" offofc = pdbId + "_map-omit-fofc_P1.map" testFileXyz = pdbId + ".cif" testFileSf = pdbId + "-sf.cif" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) dp.setDebugMode() xyzPath = os.path.join(self.__testFilePath, testFileXyz) sfPath = os.path.join(self.__testFilePath, testFileSf) dp.imp(xyzPath) dp.addInput(name="sf_file_path", value=sfPath) dp.op("annot-make-maps") dp.expLog(pdbId + "-annot-make-maps.log") dp.expList(dstPathList=[of2fofc, offofc]) # dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testEm2EmSpider(self): """ Test mapfix utility """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) # inpPath = os.path.join(self.__testFilePath, self.__testMapSpider) of = self.__testMapSpider + "-spider-cnv.map" dp.imp(inpPath) pixelSize = 2.54 dp.addInput(name="pixel-spacing-x", value=pixelSize) dp.addInput(name="pixel-spacing-y", value=pixelSize) dp.addInput(name="pixel-spacing-z", value=pixelSize) dp.op("em2em-spider") dp.expLog("em2em-spider.log") dp.exp(of) # dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testMapFixRemote(self): """ Test mapfix utility """ self.__lfh.write( "\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) # inpPath = os.path.join(self.__testFilePath, self.__testMapNormal) of = os.path.join(self.__tmpPath, self.__testMapNormal + "-fix.map") dp.imp(inpPath) pixelSize = 2.54 #dp.addInput(name="pixel-spacing-x", value=pixelSize) #dp.addInput(name="pixel-spacing-y", value=pixelSize) #dp.addInput(name="pixel-spacing-z", value=pixelSize) dp.addInput(name="input_map_file_path", value=inpPath) dp.addInput(name="output_map_file_path", value=of) dp.addInput(name="label", value='test') dp.addInput(name="voxel", value='{0} {0} {0}'.format(pixelSize)) # dp.setRunRemote() ret = dp.op("deposit-update-map-header-in-place") dp.expLog(os.path.join(self.__tmpPath, "mapfix-big.log")) dp.exp(of) # dp.cleanup() self.assertTrue(ret == 0) self.assertTrue(os.path.exists(of))
def testPisaAnalysisCif(self): """ """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) cifPath = os.path.join(self.__testFilePath, self.__testFileCifPisa) dp.imp(cifPath) dp.addInput(name="pisa_session_name", value="session_test_cif") dp.op("pisa-analysis") dp.expLog("pisa-anal-cif.log.gz") dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testCifCheckExt(self): """ """ logger.info("\nStarting") try: for name in ["deposit", "archive_current", "archive_next"]: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) cifPath = os.path.join(self.__testFilePath, self.__testFileCif) dp.imp(cifPath) dp.addInput(name="dictionary", value=name) dp.op("check-cif-ext") dp.exp("check-cif-diags-%s.txt" % name) dp.expLog("check-cif-%s.log" % name) # dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()
def testPisaAnalysisPdb(self): """ """ logger.info("\nStarting") try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) pdbPath = os.path.join(self.__testFilePath, self.__testFilePdbPisa) dp.imp(pdbPath) dp.addInput(name="pisa_session_name", value="session_3re3_pdb") dp.op("pisa-analysis") dp.expLog("pisa-anal-pdb.log.gz") dp.cleanup() except Exception as e: logger.exception("Failing with %s", str(e)) self.fail()
def pdbx2nmrstar(self, inpPath, outPath, pdbId=None): """PDBx to NMRSTAR""" try: dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) if pdbId is not None: dp.addInput(name="pdb_id", value=pdbId, type="param") dp.op("annot-pdbx2nmrstar") logPath = os.path.join(self.__sessionPath, "annot-pdbx2nmrstar.log") dp.expLog(logPath) dp.exp(outPath) if not self.__debug: dp.cleanup() except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) return False # return True
def testPisaAssemblyReportXmlPdb(self): """ """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) fPath = os.path.join(self.__testFilePath, self.__testFilePdbPisa) dp.imp(fPath) dp.addInput(name="pisa_session_name", value="session_3re3_cif") dp.op("pisa-analysis") dp.expLog("pisa-anal-assembly-pdb.log.gz") dp.op("pisa-assembly-report-xml") dp.exp("pisa-assembly-report-pdb.xml") dp.expLog("pisa-report-xml-pdb.log.gz") dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testAnnotSiteAlt(self): """ Calculate site environment """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: of = "annot-site-" + self.__testIdAnnotSiteAlt + '.cif' dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) inpPath = os.path.join(self.__testFilePath, self.__testFileAnnotSiteAlt) dp.imp(inpPath) dp.addInput(name="block_id", value=self.__testIdAnnotSiteAlt) dp.op("annot-site") dp.expLog("annot-site.log") dp.exp(of) # dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testAnnotSecondaryStructureWithTopology(self): """ Calculate secondary structure with a supporting topology file. """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: of = "annot-ss-with-top-" + self.__testFileAnnotSS + ".gz" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) inpPath = os.path.join(self.__testFilePath, self.__testFileAnnotSS) dp.imp(inpPath) topPath = os.path.abspath(os.path.join(self.__testFilePath, self.__testFileAnnotSSTop)) dp.addInput(name="ss_topology_file_path", value=topPath) dp.op("annot-secondary-structure") dp.expLog("annot-secondary-structure-w-top.log") dp.exp(of) dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testAnnotConsolidatedTasksWithTopology(self): """ Calculate annotation tasks in a single step including supporting topology data. """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: of = "annot-consolidated-top-" + self.__testFileAnnotSS + ".gz" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) inpPath = os.path.join(self.__testFilePath, self.__testFileAnnotSS) dp.imp(inpPath) topPath = os.path.abspath(os.path.join(self.__testFilePath, self.__testFileAnnotSSTop)) dp.addInput(name="ss_topology_file_path", value=topPath) dp.op("annot-consolidated-tasks") dp.expLog("annot-consolidated-w-top.log") dp.exp(of) dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testAnnotSiteRemote(self): """Calculate site environment""" logger.debug("\nStarting") of = os.path.join(self.__tmpPath, "annot-site-" + self.__testFileAnnotSite) dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) inpPath = os.path.join(self.__testFilePath, self.__testFileAnnotSite) dp.imp(inpPath) dp.addInput(name="block_id", value=self.__testIdAnnotSite) # dp.setRunRemote() ret = dp.op("annot-site") dp.expLog(os.path.join(self.__tmpPath, "annot-site.log")) dp.exp(of) # dp.cleanup() self.assertTrue(ret == 0) self.assertTrue(os.path.exists(of))
def testAnnotValidateListNmrTestRemote(self): """ Test create validation report for the test list of example PDB ids (NMR examples) """ self.__lfh.write( "\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) for pdbId in self.__testValidateNmrIdList: self.__tmpPath = tempfile.mkdtemp( dir=self.__siteWebAppsSessionsPath) self.__lfh.write("\nStarting {} in {}\n".format( pdbId, self.__tmpPath)) ofpdf = os.path.join(self.__tmpPath, pdbId + "-valrpt.pdf") ofxml = os.path.join(self.__tmpPath, pdbId + "-valdata.xml") offullpdf = os.path.join(self.__tmpPath, pdbId + "-valrpt_full.pdf") ofpng = os.path.join(self.__tmpPath, pdbId + "-val-slider.png") ofsvg = os.path.join(self.__tmpPath, pdbId + "-val-slider.svg") # testFileValidateXyz = pdbId + ".cif" testFileValidateCs = pdbId + "-cs.cif" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) xyzPath = os.path.abspath( os.path.join(self.__testFilePath, testFileValidateXyz)) csPath = os.path.abspath( os.path.join(self.__testFilePath, testFileValidateCs)) dp.addInput(name="request_annotation_context", value="yes") dp.addInput(name='run_dir', value=os.path.join( self.__siteWebAppsSessionsPath, "validation_%s" % random.randrange(9999999))) # adding explicit selection of steps -- # Alternate #dp.addInput(name="step_list", value=" coreclust,chemicalshifts,writexml,writepdf ") dp.addInput(name='kind', value='nmr') dp.imp(xyzPath) dp.addInput(name="cs_file_path", value=csPath) # dp.setRunRemote() ret = dp.op("annot-wwpdb-validate-all") dp.expLog( os.path.join(self.__tmpPath, pdbId + "-annot-validate-test.log")) dp.expList(dstPathList=[ofpdf, ofxml, offullpdf, ofpng, ofsvg]) # dp.cleanup() self.assertTrue(ret == 0) self.assertTrue(os.path.exists(ofpdf)) self.assertTrue(os.path.exists(ofxml)) self.assertTrue(os.path.exists(offullpdf)) self.assertTrue(os.path.exists(ofpng)) self.assertTrue(os.path.exists(ofsvg))
def convert_xray_density_map(self, coord_file, in_2fofc_cif, in_fofc_cif, out_binary_volume, working_dir): logging.info("Converting X-ray maps to binary cif") logging.debug(working_dir) rdb = RcsbDpUtility(tmpPath=working_dir, siteId=self.__site_id, verbose=True) rdb.imp(coord_file) rdb.addInput(name="two_fofc_cif", value=in_2fofc_cif, type="file") rdb.addInput(name="one_fofc_cif", value=in_fofc_cif, type="file") rdb.op("xray-density-bcif") rdb.exp(out_binary_volume) rdb.cleanup() if out_binary_volume: if os.path.exists(out_binary_volume): return True return False
def __generateLoadDb(self, tmpPath, filePath, sql_file, logFile): try: dp = RcsbDpUtility(tmpPath=tmpPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(filePath) dp.addInput(name="mapping_file", value=self.__mapping, type="file") # This code handles model files - first block dp.addInput(name="first_block", value=True) dp.op("db-loader") dp.expLog(logFile) dp.exp(sql_file) dp.cleanup() return except: # noqa: E722 pylint: disable=bare-except self.__lfh.write( "DbLoadingApi::__generateLoadDb(): failing, with exception.\n") traceback.print_exc(file=self.__lfh)
def testAnnotDccRsrReport(self): """ Test create DCC report - """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: ofn = "dcc-rsr-report.cif" dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) xyzPath = os.path.join(self.__testFilePath, self.__testDccModelId + '.cif') sfPath = os.path.join(self.__testFilePath, self.__testDccModelId + '-sf.cif') dp.imp(xyzPath) dp.addInput(name="sf_file_path", value=sfPath) dp.addInput(name="dcc_arguments", value=" -rsr -refmac ") dp.op("annot-dcc-report") dp.expLog("dcc-rsr-report.log") dp.exp(ofn) # dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testAnnotPrdSearch(self): """ Test case for PRD Search -- """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: ofn = "prd-search-result.cif" firstModelPath = os.path.abspath('firstmodel.cif') logFilePath = os.path.abspath("prd-search-log.log") dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) inpPath = os.path.join(self.__testFilePath, self.__testFilePrdSearch) dp.imp(inpPath) dp.addInput(name='firstmodel', value=firstModelPath) dp.addInput(name='logfile', value=logFilePath) dp.op("prd-search") dp.expLog("prd-search-execution.log") dp.exp(ofn) # dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testCif2PdbxExt(self): """ """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: for name in ['archive_next', 'archive_current']: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) cifPath = os.path.join(self.__testFilePath, self.__testFileCif) dp.imp(cifPath) dp.addInput(name='destination', value=name) dp.op("cif2pdbx-ext") dp.exp("cif2pdbx-ext-%s.cif" % name) dp.expLog("cif2pdbx-%s.log" % name) # dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()
def testPisaAssemblyMergeModelCif(self): """ """ logger.info("\nStarting %s %s\n" % (self.__class__.__name__, sys._getframe().f_code.co_name)) try: dp = RcsbDpUtility(tmpPath=self.__tmpPath, siteId=self.__siteId, verbose=True) fPath = os.path.join(self.__testFilePath, self.__testFileCifPisa) assignPath = os.path.join(self.__testFilePath, "3rer_assembly_assign_P1.cif") dp.imp(fPath) dp.addInput(name="pisa_session_name", value="session_3re3-cif") dp.op("pisa-analysis") dp.op("pisa-assembly-report-xml") dp.exp("pisa-assembly-report-cif.xml") # cifPath = os.path.join(self.__testFilePath, self.__testFileCifPisa) dp.imp(cifPath) # # assignmentFile = self.__inputParamDict['pisa_assembly_assignment_file_path'] # dp.addInput(name="pisa_assembly_file_path", value="pisa-assembly-report-cif.xml", type="file") dp.addInput(name="pisa_assembly_assignment_file_path", value=assignPath, type="file") dp.op("pisa-assembly-merge-cif") dp.exp("3rer-updated.cif.gz") dp.expLog("3rer-updated-cif.log.gz") # dp.cleanup() except Exception as e: logger.exception("Failing with %s" % str(e)) self.fail()