diff --git a/wwpdb/apps/ann_tasks_v2/__init__.py b/wwpdb/apps/ann_tasks_v2/__init__.py index 3638c83..7be2b04 100644 --- a/wwpdb/apps/ann_tasks_v2/__init__.py +++ b/wwpdb/apps/ann_tasks_v2/__init__.py @@ -2,4 +2,4 @@ __author__ = "Ezra Peisach" __email__ = "ezra.peisach@rcsb.org" __license__ = "Apache 2.0" -__version__ = "0.41.1" +__version__ = "0.41.2" diff --git a/wwpdb/apps/ann_tasks_v2/assembly/AssemblyInput.py b/wwpdb/apps/ann_tasks_v2/assembly/AssemblyInput.py index 5f210e2..1b74c57 100644 --- a/wwpdb/apps/ann_tasks_v2/assembly/AssemblyInput.py +++ b/wwpdb/apps/ann_tasks_v2/assembly/AssemblyInput.py @@ -347,6 +347,8 @@ def makeSymopInfoTable(self, entryId="1ABC", entryFileName=None): # # symopFile = os.path.join(self.__sessionPath, entryId + "-symop-info.txt") + if os.access(symopFile, os.R_OK): + os.remove(symopFile) # try: dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) diff --git a/wwpdb/apps/ann_tasks_v2/assembly/AssemblySelect.py b/wwpdb/apps/ann_tasks_v2/assembly/AssemblySelect.py index 1609f57..d482953 100644 --- a/wwpdb/apps/ann_tasks_v2/assembly/AssemblySelect.py +++ b/wwpdb/apps/ann_tasks_v2/assembly/AssemblySelect.py @@ -96,11 +96,16 @@ def run(self, entryId, inpFile, sessionName, maxAssems=50): inpPath = os.path.join(self.__sessionPath, inpFile) reportPath = os.path.join(self.__sessionPath, entryId + "_assembly-report_P1.xml") logPath = os.path.join(self.__sessionPath, entryId + "-assembly-report.log") + for filePath in ( reportPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) if self.__assemblyArgs is not None and len(self.__assemblyArgs) > 0: dp.addInput(name="pisa_assembly_arguments", value=self.__assemblyArgs) + # dp.addInput(name="pisa_session_name", value=sessionName) dp.op("pisa-analysis") dp.expLog(logPath) @@ -127,7 +132,10 @@ def run(self, entryId, inpFile, sessionName, maxAssems=50): dp.exp(assemModelFileName) if self.__verbose: self.__lfh.write("+AssemblySelect.run - creating assembly model %r file %s\n" % (assemblyUid, assemModelFileName)) - # dp.cleanup() + # + # + # + # dp.cleanup() return True except: # noqa: E722 pylint: disable=bare-except if self.__verbose: @@ -273,6 +281,11 @@ def updateModelFile(self, entryId, inpFile, assignPath, updateInput=True): retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") logPath = os.path.join(self.__sessionPath, entryId + "_assembly-merge.log") reportPath = os.path.join(self.__sessionPath, entryId + "_assembly-report_P1.xml") + for filePath in ( retPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # + # if self.__verbose: self.__lfh.write("+AssemblySelect.updateModelFile() input path %s\n" % inpPath) self.__lfh.write("+AssemblySelect.updateModelFile() return path %s\n" % retPath) @@ -288,14 +301,14 @@ def updateModelFile(self, entryId, inpFile, assignPath, updateInput=True): # dp.op("pisa-assembly-merge-cif") dp.exp(retPath) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) + # dp.expLog(logPath) # # Added generation of assembly files to the model update. if os.access(retPath, os.R_OK): self.generateAssemblies(entryId, modelFilePath=retPath) - # # dp.cleanup() return True @@ -314,6 +327,10 @@ def autoAssignDefaultAssembly(self, entryId, inpFile): logPath = os.path.join(self.__sessionPath, entryId + "_assembly-merge.log") assignPath = os.path.join(self.__sessionPath, entryId + "_assembly-assign_P1.cif") reportPath = os.path.join(self.__sessionPath, entryId + "_assembly-report_P1.xml") + for filePath in ( retPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -339,7 +356,6 @@ def autoAssignDefaultAssembly(self, entryId, inpFile): # Added generation of assembly files to the model update. if os.access(retPath, os.R_OK): self.generateAssemblies(entryId, modelFilePath=retPath) - # # dp.cleanup() return True @@ -539,6 +555,10 @@ def runPdb(self, entryId, inpFile, sessionName): inpPath = os.path.join(self.__sessionPath, inpFile) reportPath = os.path.join(self.__sessionPath, entryId + "_assembly-report_P1.xml") logPath = os.path.join(self.__sessionPath, entryId + "_assembly-report.log") + for filePath in ( reportPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) diff --git a/wwpdb/apps/ann_tasks_v2/check/ExtraCheck.py b/wwpdb/apps/ann_tasks_v2/check/ExtraCheck.py index 1921a28..e85d67d 100644 --- a/wwpdb/apps/ann_tasks_v2/check/ExtraCheck.py +++ b/wwpdb/apps/ann_tasks_v2/check/ExtraCheck.py @@ -42,7 +42,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): # self.__exportPath = None self.__checkArgs = None - self.__cleanup = False + self.__cleanup = True self.__reportFileSize = 0 self.__reportPath = None # diff --git a/wwpdb/apps/ann_tasks_v2/check/FormatCheck.py b/wwpdb/apps/ann_tasks_v2/check/FormatCheck.py index fb64c88..878b4a0 100644 --- a/wwpdb/apps/ann_tasks_v2/check/FormatCheck.py +++ b/wwpdb/apps/ann_tasks_v2/check/FormatCheck.py @@ -42,7 +42,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__exportPath = None self.__checkArgs = None - self.__cleanup = False + self.__cleanup = True self.__reportFileSize = 0 self.__reportPath = None diff --git a/wwpdb/apps/ann_tasks_v2/check/GeometryCalc.py b/wwpdb/apps/ann_tasks_v2/check/GeometryCalc.py index d8eac7b..90aec43 100644 --- a/wwpdb/apps/ann_tasks_v2/check/GeometryCalc.py +++ b/wwpdb/apps/ann_tasks_v2/check/GeometryCalc.py @@ -49,7 +49,7 @@ def __setup(self): self.__siteId = self.__reqObj.getValue("WWPDB_SITE_ID") self.__sObj = self.__reqObj.getSessionObj() self.__sessionPath = self.__sObj.getPath() - self.__cleanup = False + self.__cleanup = True def setArguments(self, checkArgs): self.__checkArgs = checkArgs @@ -76,7 +76,7 @@ def run(self, entryId, inpFile, updateInput=True): dp.exp(retPath) self.addDownloadPath(retPath) self.addDownloadPath(logPath) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) # if self.__verbose: @@ -84,7 +84,12 @@ def run(self, entryId, inpFile, updateInput=True): if self.__cleanup: dp.cleanup() - return True + # + if os.access(retPath, os.R_OK): + return True + else: + return False + # except: # noqa: E722 pylint: disable=bare-except if self.__verbose: self.__lfh.write("+%s.%s geometry calc failed for entryId %s file %s\n" % (self.__class__.__name__, inspect.currentframe().f_code.co_name, entryId, inpFile)) diff --git a/wwpdb/apps/ann_tasks_v2/check/GeometryCheck.py b/wwpdb/apps/ann_tasks_v2/check/GeometryCheck.py index 40177cb..630fe67 100644 --- a/wwpdb/apps/ann_tasks_v2/check/GeometryCheck.py +++ b/wwpdb/apps/ann_tasks_v2/check/GeometryCheck.py @@ -44,7 +44,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__checkArgs = None self.__reportFileSize = 0 self.__reportPath = None - self.__cleanup = False + self.__cleanup = True self.__setup() diff --git a/wwpdb/apps/ann_tasks_v2/correspnd/CorresPNDTemplate.py b/wwpdb/apps/ann_tasks_v2/correspnd/CorresPNDTemplate.py index ed5ef10..ba21513 100644 --- a/wwpdb/apps/ann_tasks_v2/correspnd/CorresPNDTemplate.py +++ b/wwpdb/apps/ann_tasks_v2/correspnd/CorresPNDTemplate.py @@ -86,6 +86,10 @@ def __runGetCorresInfo(self): try: resultfile = os.path.join(self.__sessionPath, "corres_1.cif") logfilename = os.path.join(self.__sessionPath, "corres_1.log") + for filePath in ( resultfile, logfilename ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(os.path.join(self.__sessionPath, self.__entryFile)) diff --git a/wwpdb/apps/ann_tasks_v2/editCoord/CSEditorForm.py b/wwpdb/apps/ann_tasks_v2/editCoord/CSEditorForm.py index 3ed4fb5..870da95 100644 --- a/wwpdb/apps/ann_tasks_v2/editCoord/CSEditorForm.py +++ b/wwpdb/apps/ann_tasks_v2/editCoord/CSEditorForm.py @@ -63,11 +63,18 @@ def get(self): def __runScript(self): """ """ try: + retPath = os.path.join(self.__sessionPath, self.__entryId + "_cs_html.txt") + logPath = os.path.join(self.__sessionPath, self.__entryId + "_cs_summary.log") + for filePath in ( retPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # + # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(os.path.join(self.__sessionPath, self.__entryFile)) dp.op("annot-depict-chemical-shift") - dp.exp(os.path.join(self.__sessionPath, self.__entryId + "_cs_html.txt")) - dp.expLog(os.path.join(self.__sessionPath, self.__entryId + "_cs_summary.log")) + dp.exp(retPath) + dp.expLog(logPath) dp.cleanup() except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) diff --git a/wwpdb/apps/ann_tasks_v2/editCoord/CSEditorUpdate.py b/wwpdb/apps/ann_tasks_v2/editCoord/CSEditorUpdate.py index cf0ffd3..40b8108 100644 --- a/wwpdb/apps/ann_tasks_v2/editCoord/CSEditorUpdate.py +++ b/wwpdb/apps/ann_tasks_v2/editCoord/CSEditorUpdate.py @@ -103,12 +103,16 @@ def __writeSelectInfo(self, cmap): def __runUpdateScript(self): """ """ try: + logPath = os.path.join(self.__sessionPath, self.__entryId + "_cs_update.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) + # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(os.path.join(self.__sessionPath, self.__entryFile)) dp.addInput(name="assign", value=os.path.join(self.__sessionPath, self.__entryId + "_cs_select.cif")) dp.op("annot-edit-chemical-shift") dp.exp(os.path.join(self.__sessionPath, self.__entryFile)) - dp.expLog(os.path.join(self.__sessionPath, self.__entryId + "_cs_update.log")) + dp.expLog(logPath) dp.cleanup() # return self.__readLogFile("_cs_update.log", "Update failed!") diff --git a/wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorForm_v2.py b/wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorForm_v2.py index 116a43a..6c10c77 100644 --- a/wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorForm_v2.py +++ b/wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorForm_v2.py @@ -157,8 +157,14 @@ def __runScript(self): jsonPath = os.path.join(self.__jsonPath, self.__entryId + ".json") textPath = os.path.join(self.__sessionPath, self.__entryId + "_chainids.txt") indxPath = os.path.join(self.__sessionPath, self.__entryId + "_index.cif") + logPath = os.path.join(self.__sessionPath, self.__entryId + "_summary.log") + for filePath in ( jsonPath, textPath, indxPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # + # dp.expList(dstPathList=[jsonPath, textPath, indxPath]) - dp.expLog(os.path.join(self.__sessionPath, self.__entryId + "_summary.log")) + dp.expLog(logPath) dp.cleanup() except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) diff --git a/wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorUpdate.py b/wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorUpdate.py index d937cb4..1f3051d 100644 --- a/wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorUpdate.py +++ b/wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorUpdate.py @@ -114,11 +114,15 @@ def __writeSelectInfo(self, smap): def __runCheckScript(self): """ """ try: + logPath = os.path.join(self.__sessionPath, self.__entryId + "_check.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) + # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(os.path.join(self.__sessionPath, self.__entryId + "_index.cif")) dp.addInput(name="select", value=os.path.join(self.__sessionPath, self.__entryId + "_select.cif")) dp.op("annot-check-select-number") - dp.expLog(dstPath=os.path.join(self.__sessionPath, self.__entryId + "_check.log"), appendMode=False) + dp.expLog(dstPath=logPath, appendMode=False) dp.cleanup() # return self.__readLogFile("_check.log", "Run numbering checking failed") @@ -131,12 +135,16 @@ def __runCheckScript(self): def __runUpdateScript(self): """ """ try: + logPath = os.path.join(self.__sessionPath, self.__entryId + "_update.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) + # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(os.path.join(self.__sessionPath, self.__entryFile)) dp.addInput(name="assign", value=os.path.join(self.__sessionPath, self.__entryId + "_select.cif")) dp.op("annot-update-molecule") dp.exp(os.path.join(self.__sessionPath, self.__entryFile)) - dp.expLog(dstPath=os.path.join(self.__sessionPath, self.__entryId + "_update.log"), appendMode=False) + dp.expLog(dstPath=logPath, appendMode=False) dp.cleanup() # return self.__readLogFile("_update.log", "Update failed!") diff --git a/wwpdb/apps/ann_tasks_v2/em3d/EmAutoFix.py b/wwpdb/apps/ann_tasks_v2/em3d/EmAutoFix.py index a6a4ccd..c7c44d1 100644 --- a/wwpdb/apps/ann_tasks_v2/em3d/EmAutoFix.py +++ b/wwpdb/apps/ann_tasks_v2/em3d/EmAutoFix.py @@ -31,7 +31,7 @@ def __init__(self, sessionPath, siteId=None, verbose=True, log=sys.stderr): self.__lfh = log self.__siteId = siteId self.__sessionPath = sessionPath - self.__cleanup = False + self.__cleanup = True self.__pI = PathInfo(sessionPath=sessionPath, verbose=self.__verbose, log=self.__lfh) self.__mD = {"primary map": "em-volume", "mask": "em-mask-volume", "additional map": "em-additional-volume", "half map": "em-half-volume", "map header": "em-volume-header"} @@ -53,6 +53,11 @@ def __getEmdDbCode(blockobj): def __mapfix(self, depsetid, emdbid, volin, volout, voxel): resultPath = os.path.join(self.__sessionPath, depsetid + "_mapfix-header-report_P1.json") logPath = os.path.join(self.__sessionPath, depsetid + "_mapfix-report_P1.txt") + for filePath in ( resultPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # + # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.setDebugMode(flag=True) dp.addInput(name="input_map_file_path", value=volin, type="file") @@ -65,7 +70,7 @@ def __mapfix(self, depsetid, emdbid, volin, volout, voxel): if self.__cleanup: dp.cleanup() - + # return resultPath def autoFixMapLabels(self, datasetid, modelin, modelout, vollocation="archive"): diff --git a/wwpdb/apps/ann_tasks_v2/em3d/EmEditUtils.py b/wwpdb/apps/ann_tasks_v2/em3d/EmEditUtils.py index d1966b7..df40fef 100644 --- a/wwpdb/apps/ann_tasks_v2/em3d/EmEditUtils.py +++ b/wwpdb/apps/ann_tasks_v2/em3d/EmEditUtils.py @@ -47,7 +47,7 @@ def __setup(self): self.__sessionId = self.__sObj.getId() self.__sessionPath = self.__sObj.getPath() self.__pI = PathInfo(siteId=self.__siteId, sessionPath=self.__sessionPath, verbose=self.__verbose, log=self.__lfh) - self.__cleanup = False + self.__cleanup = True self.__headerKeyList = [ ("Map title", "label", True), @@ -107,6 +107,10 @@ def getMapHeader(self, entryId, mapFilePath): try: resultPath = os.path.join(self.__sessionPath, entryId + "_mapfix-header-report_P1.json") logPath = os.path.join(self.__sessionPath, entryId + "_mapfix-report_P1.txt") + for filePath in ( resultPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.setDebugMode(flag=True) @@ -289,6 +293,10 @@ def updateMapHeader(self, entryId, inputMapFileName, outputMapFilePath=None): resultPath = os.path.join(self.__sessionPath, entryId + "_mapfix-header-report_P1.json") logPath = os.path.join(self.__sessionPath, entryId + "_mapfix-report_P1.txt") + for filePath in ( resultPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.setDebugMode(flag=True) diff --git a/wwpdb/apps/ann_tasks_v2/link/Link.py b/wwpdb/apps/ann_tasks_v2/link/Link.py index d781ca2..5bda399 100644 --- a/wwpdb/apps/ann_tasks_v2/link/Link.py +++ b/wwpdb/apps/ann_tasks_v2/link/Link.py @@ -60,14 +60,16 @@ def run(self, entryId, inpFile, updateInput=True): pI = PathInfo(siteId=self.__siteId, sessionPath=self.__sessionPath, verbose=self.__verbose, log=self.__lfh) csvFile = pI.getFileName(entryId, contentType="pcm-missing-data", formatType="csv", versionId="none", partNumber="1") csvPath = os.path.join(self.__sessionPath, csvFile) - if os.access(csvPath, os.F_OK): - os.remove(csvPath) # inpPath = os.path.join(self.__sessionPath, inpFile) logPath1 = os.path.join(self.__sessionPath, entryId + "-link-anal.log") logPath2 = os.path.join(self.__sessionPath, entryId + "-cispeptide-anal.log") retPath1 = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") retPath2 = os.path.join(self.__sessionPath, entryId + "_model-updated_P2.cif") + for filePath in ( csvPath, retPath1, retPath2, logPath1, logPath2 ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) diff --git a/wwpdb/apps/ann_tasks_v2/mapcalc/BisoFullCalc.py b/wwpdb/apps/ann_tasks_v2/mapcalc/BisoFullCalc.py index 9c2393c..d1a39d0 100644 --- a/wwpdb/apps/ann_tasks_v2/mapcalc/BisoFullCalc.py +++ b/wwpdb/apps/ann_tasks_v2/mapcalc/BisoFullCalc.py @@ -37,7 +37,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__lfh = log self.__reqObj = reqObj self.__dccArgs = None - self.__cleanup = False + self.__cleanup = True # self.__setup() @@ -67,6 +67,10 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True) # logPath = os.path.join(self.__sessionPath, entryId + "_biso-full-calc.log") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( retPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -79,7 +83,7 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True) dp.expLog(logPath) dp.exp(retPath) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) # if self.__verbose: @@ -87,7 +91,12 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True) if self.__cleanup: dp.cleanup() - return True + # + if os.access(retPath, os.R_OK): + return True + else: + return False + # except: # noqa: E722 pylint: disable=bare-except if self.__verbose: self.__lfh.write("+BisoFullCalc.run- failed with exception for entryId %s file %s\n" % (entryId, inpPath)) diff --git a/wwpdb/apps/ann_tasks_v2/mapcalc/DccCalc.py b/wwpdb/apps/ann_tasks_v2/mapcalc/DccCalc.py index e843918..6dcba28 100644 --- a/wwpdb/apps/ann_tasks_v2/mapcalc/DccCalc.py +++ b/wwpdb/apps/ann_tasks_v2/mapcalc/DccCalc.py @@ -37,7 +37,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__lfh = log self.__reqObj = reqObj self.__dccArgs = None - self.__cleanup = False + self.__cleanup = True self.__exportPath = None self.__reportPath = None # diff --git a/wwpdb/apps/ann_tasks_v2/mapcalc/DccRefineCalc.py b/wwpdb/apps/ann_tasks_v2/mapcalc/DccRefineCalc.py index cbc11fa..3469517 100644 --- a/wwpdb/apps/ann_tasks_v2/mapcalc/DccRefineCalc.py +++ b/wwpdb/apps/ann_tasks_v2/mapcalc/DccRefineCalc.py @@ -37,7 +37,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__lfh = log self.__reqObj = reqObj self.__dccArgs = None - self.__cleanup = False + self.__cleanup = True # self.__setup() @@ -67,6 +67,10 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True) # logPath = os.path.join(self.__sessionPath, entryId + "_dcc-refine-calc.log") reportPath = os.path.join(self.__sessionPath, entryId + "_dcc-refine-report.cif") + for filePath in ( reportPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) diff --git a/wwpdb/apps/ann_tasks_v2/mapcalc/MapCalc.py b/wwpdb/apps/ann_tasks_v2/mapcalc/MapCalc.py index dfbbcdb..3edee18 100644 --- a/wwpdb/apps/ann_tasks_v2/mapcalc/MapCalc.py +++ b/wwpdb/apps/ann_tasks_v2/mapcalc/MapCalc.py @@ -37,7 +37,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__lfh = log self.__reqObj = reqObj self.__mapArgs = None - self.__cleanup = False + self.__cleanup = True # self.__setup() @@ -66,6 +66,9 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True, # # logPath = os.path.join(self.__sessionPath, entryId + "_map-calc.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) + # result2fofcPath = os.path.join(self.__sessionPath, entryId + "_map-2fofc_P1.map") resultfofcPath = os.path.join(self.__sessionPath, entryId + "_map-fofc_P1.map") # @@ -90,6 +93,9 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True, # if doOmit: logPath = os.path.join(self.__sessionPath, entryId + "_map-omit-calc.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) + # result2fofcPath = os.path.join(self.__sessionPath, entryId + "_map-omit-2fofc_P1.map") resultfofcPath = os.path.join(self.__sessionPath, entryId + "_map-omit-fofc_P1.map") # diff --git a/wwpdb/apps/ann_tasks_v2/mapcalc/NpCcMapCalc.py b/wwpdb/apps/ann_tasks_v2/mapcalc/NpCcMapCalc.py index 8f1433d..89d812e 100644 --- a/wwpdb/apps/ann_tasks_v2/mapcalc/NpCcMapCalc.py +++ b/wwpdb/apps/ann_tasks_v2/mapcalc/NpCcMapCalc.py @@ -37,7 +37,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__reqObj = reqObj # self.__mapArgs = None - self.__cleanup = False + self.__cleanup = True # self.__setup() @@ -65,6 +65,9 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True, sfPath = os.path.join(self.__sessionPath, expInputFile) # logPath = os.path.join(self.__sessionPath, entryId + "_map-npcc-calc.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) + # outDataPath = os.path.join(self.__sessionPath, "np-cc-maps") outIndexPath = os.path.join(self.__sessionPath, "np-cc-maps", "np-cc-maps-index.cif") # @@ -93,6 +96,9 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True, dp.setDebugMode(flag=True) # logPath = os.path.join(self.__sessionPath, entryId + "_map-omit-npcc-calc.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) + # outDataPath = os.path.join(self.__sessionPath, "np-cc-omit-maps") outIndexPath = os.path.join(self.__sessionPath, "np-cc-omit-maps", "np-cc-omit-maps-index.cif") dp.imp(inpPath) diff --git a/wwpdb/apps/ann_tasks_v2/mapcalc/ReassignAltIdsCalc.py b/wwpdb/apps/ann_tasks_v2/mapcalc/ReassignAltIdsCalc.py index a4b2ba1..4765cbc 100644 --- a/wwpdb/apps/ann_tasks_v2/mapcalc/ReassignAltIdsCalc.py +++ b/wwpdb/apps/ann_tasks_v2/mapcalc/ReassignAltIdsCalc.py @@ -37,7 +37,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__lfh = log self.__reqObj = reqObj self.__dccArgs = None - self.__cleanup = False + self.__cleanup = True # self.__setup() @@ -57,16 +57,19 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True) inpPath = os.path.join(self.__sessionPath, modelFileName) else: inpPath = os.path.join(self.__sessionPath, modelInputFile) - + # if expInputFile is None: expFileName = entryId + "_sf_P1.cif" sfPath = os.path.join(self.__sessionPath, expFileName) else: sfPath = os.path.join(self.__sessionPath, expInputFile) # - # logPath = os.path.join(self.__sessionPath, entryId + "_reassign-alt-ids-calc.log") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( retPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -78,15 +81,20 @@ def run(self, entryId, modelInputFile=None, expInputFile=None, updateInput=True) dp.exp(retPath) self.addDownloadPath(retPath) self.addDownloadPath(logPath) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) # if self.__verbose: self.__lfh.write("+ReassignAltIdsCalc.run- completed for entryId %s file %s\n" % (entryId, inpPath)) - + # if self.__cleanup: dp.cleanup() - return True + # + if os.access(retPath, os.R_OK): + return True + else: + return False + # except: # noqa: E722 pylint: disable=bare-except if self.__verbose: self.__lfh.write("+ReassignAltIdsCalc.run- failed with exception for entryId %s file %s\n" % (entryId, inpPath)) diff --git a/wwpdb/apps/ann_tasks_v2/mapcalc/SpecialPositionCalc.py b/wwpdb/apps/ann_tasks_v2/mapcalc/SpecialPositionCalc.py index 40dafe8..c7c01bc 100644 --- a/wwpdb/apps/ann_tasks_v2/mapcalc/SpecialPositionCalc.py +++ b/wwpdb/apps/ann_tasks_v2/mapcalc/SpecialPositionCalc.py @@ -47,7 +47,7 @@ def __setup(self): self.__siteId = self.__reqObj.getValue("WWPDB_SITE_ID") self.__sObj = self.__reqObj.getSessionObj() self.__sessionPath = self.__sObj.getPath() - self.__cleanup = False + self.__cleanup = True def setArguments(self, dccArgs): # pylint: disable=unused-argument # self.__dccArgs = dccArgs @@ -97,6 +97,7 @@ def run(self, entryId, modelInputFile=None): if self.__cleanup: dp.cleanup() + # return True except: # noqa: E722 pylint: disable=bare-except if self.__verbose: diff --git a/wwpdb/apps/ann_tasks_v2/mapcalc/SpecialPositionUpdate.py b/wwpdb/apps/ann_tasks_v2/mapcalc/SpecialPositionUpdate.py index 325ff40..05fb7fe 100644 --- a/wwpdb/apps/ann_tasks_v2/mapcalc/SpecialPositionUpdate.py +++ b/wwpdb/apps/ann_tasks_v2/mapcalc/SpecialPositionUpdate.py @@ -40,7 +40,7 @@ def __init__(self, reqObj=None, verbose=False, log=sys.stderr): self.__lfh = log self.__reqObj = reqObj # self.__checkArgs = None - self.__cleanup = False + self.__cleanup = True self.__modelUpdated = False # self.__setup() @@ -69,6 +69,10 @@ def run(self, entryId, inpFile, updateInput=True): inpPath = os.path.join(self.__sessionPath, inpFile) logPath = os.path.join(self.__sessionPath, entryId + "_special-position-update.log") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( retPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -81,17 +85,22 @@ def run(self, entryId, inpFile, updateInput=True): self.__modelUpdated = True self.addDownloadPath(logPath) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.expList(dstPathList=[inpPath]) # if self.__verbose: self.__lfh.write( "+%s.%s special position update calc completed for entryId %s file %s\n" % (self.__class__.__name__, inspect.currentframe().f_code.co_name, entryId, inpFile) ) - + # if self.__cleanup: dp.cleanup() - return True + # + if os.access(retPath, os.R_OK): + return True + else: + return False + # except: # noqa: E722 pylint: disable=bare-except if self.__verbose: self.__lfh.write( diff --git a/wwpdb/apps/ann_tasks_v2/nafeatures/NAFeatures.py b/wwpdb/apps/ann_tasks_v2/nafeatures/NAFeatures.py index bcc7176..64fd182 100644 --- a/wwpdb/apps/ann_tasks_v2/nafeatures/NAFeatures.py +++ b/wwpdb/apps/ann_tasks_v2/nafeatures/NAFeatures.py @@ -55,6 +55,10 @@ def run(self, entryId, inpFile, updateInput=True): inpPath = os.path.join(self.__sessionPath, inpFile) logPath1 = os.path.join(self.__sessionPath, entryId + "-na-anal.log") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( retPath, logPath1 ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -66,13 +70,18 @@ def run(self, entryId, inpFile, updateInput=True): # self.addDownloadPath(retPath) self.addDownloadPath(logPath1) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) + # if self.__verbose: self.__lfh.write("+NAFeatures.run- completed for entryId %s file %s\n" % (entryId, inpPath)) - + # dp.cleanup() - return True + if os.access(retPath, os.R_OK): + return True + else: + return False + # except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) return False diff --git a/wwpdb/apps/ann_tasks_v2/nmr/NmrChemShiftsMiscChecks.py b/wwpdb/apps/ann_tasks_v2/nmr/NmrChemShiftsMiscChecks.py index 22c6b3c..e48cc99 100644 --- a/wwpdb/apps/ann_tasks_v2/nmr/NmrChemShiftsMiscChecks.py +++ b/wwpdb/apps/ann_tasks_v2/nmr/NmrChemShiftsMiscChecks.py @@ -61,6 +61,10 @@ def run(self, entryId, csInpFilePath, xyzFilePath): ofpng = os.path.join(self.__sessionPath, entryId + "-nmr-val-slider.png") ofsvg = os.path.join(self.__sessionPath, entryId + "-nmr-val-slider.svg") logPath = os.path.join(self.__sessionPath, entryId + "-nmr-cs-check-rpt.log") + for filePath in ( ofpdf, ofxml, offullpdf, ofpng, ofsvg, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # ------------ dp.addInput(name="request_annotation_context", value="yes") # adding explicit selection of steps -- @@ -87,6 +91,7 @@ def run(self, entryId, csInpFilePath, xyzFilePath): # if self.__cleanUp: dp.cleanup() + # return True except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) diff --git a/wwpdb/apps/ann_tasks_v2/nmr/NmrChemShiftsUtils.py b/wwpdb/apps/ann_tasks_v2/nmr/NmrChemShiftsUtils.py index 1c8714c..7028d32 100644 --- a/wwpdb/apps/ann_tasks_v2/nmr/NmrChemShiftsUtils.py +++ b/wwpdb/apps/ann_tasks_v2/nmr/NmrChemShiftsUtils.py @@ -82,6 +82,8 @@ def runPrep(self, entryId): csFilePath = pI.getChemcialShiftsFilePath(entryId, formatType="pdbx", fileSource="session", versionId="none", mileStone=None) # outPath=os.path.join(self.__sessionPath, entryId + "_cs_P1.cif") logPath = os.path.join(self.__sessionPath, entryId + "-annot-chem-shifts-upload-check.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) # chkPath = os.path.join(self.__sessionPath, entryId + "_nmr-chemical-shifts-upload-report_P1.cif") dp.addInput(name="chemical_shifts_upload_check_file_path", value=chkPath) @@ -90,7 +92,6 @@ def runPrep(self, entryId): dp.expLog(logPath) dp.exp(csFilePath) # - # wPath = os.path.join(self.__sessionPath, "Warnings-combine.txt") ePath = os.path.join(self.__sessionPath, "Errors-combine.txt") self.__processReport(chkPath, wPath, ePath) @@ -101,6 +102,7 @@ def runPrep(self, entryId): if self.__cleanUp: dp.cleanup() + # return True except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) @@ -122,6 +124,9 @@ def runAtomNameCheck(self, entryId, csInpFilePath, xyzFilePath, csOutFilePath): dp.addInput(name="coordinate_file_path", value=xyzFilePath) # logPath = os.path.join(self.__sessionPath, entryId + "-chem-shifts-atom-name-check.log") + if os.access(logPath, os.R_OK): + os.remove(logPath) + # chkPath = os.path.join(self.__sessionPath, entryId + "_nmr-chemical-shifts-atom-name-report_P1.cif") dp.addInput(name="chemical_shifts_coord_check_file_path", value=chkPath) @@ -130,7 +135,6 @@ def runAtomNameCheck(self, entryId, csInpFilePath, xyzFilePath, csOutFilePath): dp.expLog(logPath) dp.exp(csOutFilePath) # - # wPath = os.path.join(self.__sessionPath, "Warnings-atom-name.txt") ePath = os.path.join(self.__sessionPath, "Errors-atom-name.txt") self.__processReport(chkPath, wPath, ePath) @@ -138,10 +142,10 @@ def runAtomNameCheck(self, entryId, csInpFilePath, xyzFilePath, csOutFilePath): self.addDownloadPath(chkPath) self.addDownloadPath(logPath) self.addDownloadPath(csOutFilePath) - # if self.__cleanUp: dp.cleanup() + # return True except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) @@ -163,7 +167,9 @@ def runUpdate(self, entryId, csInpFilePath, xyzFilePath, csOutFilePath): dp.addInput(name="coordinate_file_path", value=xyzFilePath) # logPath = os.path.join(self.__sessionPath, entryId + "-chem-shifts-update.log") - + if os.access(logPath, os.R_OK): + os.remove(logPath) + # dp.op("annot-chem-shifts-update") dp.expLog(logPath) dp.exp(csOutFilePath) @@ -173,6 +179,7 @@ def runUpdate(self, entryId, csInpFilePath, xyzFilePath, csOutFilePath): # if self.__cleanUp: dp.cleanup() + # return True except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) @@ -200,7 +207,7 @@ def __processReport(self, chkPath, warningPath=None, errorPath=None): ofh.write("%s" % ("\n").join(self.__errors)) ofh.close() self.addDownloadPath(errorPath) - + # return True except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) diff --git a/wwpdb/apps/ann_tasks_v2/nmr/NmrModelUtils.py b/wwpdb/apps/ann_tasks_v2/nmr/NmrModelUtils.py index 53b0b64..b22bc68 100644 --- a/wwpdb/apps/ann_tasks_v2/nmr/NmrModelUtils.py +++ b/wwpdb/apps/ann_tasks_v2/nmr/NmrModelUtils.py @@ -95,7 +95,7 @@ def run(self, entryId, inpFile, updateInput=True): if updateInput and (self.__status == "ok"): dp.exp(inpPath) # - # dp.cleanup() + dp.cleanup() if self.__status == "ok": return True else: diff --git a/wwpdb/apps/ann_tasks_v2/secstruct/SecondaryStructure.py b/wwpdb/apps/ann_tasks_v2/secstruct/SecondaryStructure.py index d810a5b..ddabc92 100644 --- a/wwpdb/apps/ann_tasks_v2/secstruct/SecondaryStructure.py +++ b/wwpdb/apps/ann_tasks_v2/secstruct/SecondaryStructure.py @@ -76,26 +76,34 @@ def run(self, entryId, inpFile, updateInput=True): inpPath = os.path.join(self.__sessionPath, inpFile) logPath1 = os.path.join(self.__sessionPath, entryId + "-sec-struct-anal.log") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( retPath, logPath1 ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) if self.__topFilePath is not None: dp.addInput(name="ss_topology_file_path", value=self.__topFilePath) + # dp.op("annot-secondary-structure") dp.expLog(logPath1) dp.exp(retPath) self.addDownloadPath(retPath) self.addDownloadPath(logPath1) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) - # self.__status = self.__checkStatus(logPath1) if self.__verbose: self.__lfh.write("+SecondaryStructure.run- completed with status %s for entryId %s file %s\n" % (self.__status, entryId, inpPath)) - + # dp.cleanup() - return True + if os.access(retPath, os.R_OK): + return True + else: + return False + # except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) return False diff --git a/wwpdb/apps/ann_tasks_v2/site/Site.py b/wwpdb/apps/ann_tasks_v2/site/Site.py index a9004a7..098ddc7 100644 --- a/wwpdb/apps/ann_tasks_v2/site/Site.py +++ b/wwpdb/apps/ann_tasks_v2/site/Site.py @@ -57,6 +57,10 @@ def run(self, entryId, inpFile, updateInput=True): logPath2 = os.path.join(self.__sessionPath, entryId + "_site-merge.log") resultPath = os.path.join(self.__sessionPath, entryId + "_site-anal_P1.cif") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( resultPath, retPath, logPath1, logPath2 ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -78,12 +82,12 @@ def run(self, entryId, inpFile, updateInput=True): dp.exp(retPath) self.addDownloadPath(retPath) self.addDownloadPath(logPath2) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) # if self.__verbose: self.__lfh.write("+Site.run- completed for entryId %s file %s\n" % (entryId, inpPath)) - + # dp.cleanup() return True except: # noqa: E722 pylint: disable=bare-except diff --git a/wwpdb/apps/ann_tasks_v2/solvent/Solvent.py b/wwpdb/apps/ann_tasks_v2/solvent/Solvent.py index 3bbbf9f..05a5030 100644 --- a/wwpdb/apps/ann_tasks_v2/solvent/Solvent.py +++ b/wwpdb/apps/ann_tasks_v2/solvent/Solvent.py @@ -58,6 +58,10 @@ def run(self, entryId, inpFile, updateInput=True): inpPath = os.path.join(self.__sessionPath, inpFile) logPath1 = os.path.join(self.__sessionPath, entryId + "-solvent-anal.log") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( retPath, logPath1 ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -72,13 +76,18 @@ def run(self, entryId, inpFile, updateInput=True): dp.exp(retPath) self.addDownloadPath(retPath) self.addDownloadPath(logPath1) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) + # if self.__verbose: self.__lfh.write("+Solvent.run- completed for entryId %s file %s\n" % (entryId, inpPath)) - + # dp.cleanup() - return True + if os.access(retPath, os.R_OK): + return True + else: + return False + # except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) return False diff --git a/wwpdb/apps/ann_tasks_v2/transformCoord/TransformCoord.py b/wwpdb/apps/ann_tasks_v2/transformCoord/TransformCoord.py index 508a9d2..8341bff 100644 --- a/wwpdb/apps/ann_tasks_v2/transformCoord/TransformCoord.py +++ b/wwpdb/apps/ann_tasks_v2/transformCoord/TransformCoord.py @@ -63,6 +63,10 @@ def run(self, entryId, inpFile, fileType="symop", updateInput=True): inpPath = os.path.join(self.__sessionPath, inpFile) logPath1 = os.path.join(self.__sessionPath, entryId + "-trans-coord.log") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( retPath, logPath1 ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -74,6 +78,7 @@ def run(self, entryId, inpFile, fileType="symop", updateInput=True): dp.op("annot-move-xyz-by-matrix") else: dp.op("annot-move-xyz-by-symop") + # dp.expLog(logPath1) dp.exp(retPath) self.addDownloadPath(retPath) @@ -91,7 +96,7 @@ def run(self, entryId, inpFile, fileType="symop", updateInput=True): status = False else: status = False - + # dp.cleanup() return status except: # noqa: E722 pylint: disable=bare-except diff --git a/wwpdb/apps/ann_tasks_v2/utils/PublicPdbxFile.py b/wwpdb/apps/ann_tasks_v2/utils/PublicPdbxFile.py index eb3c913..aa1f261 100644 --- a/wwpdb/apps/ann_tasks_v2/utils/PublicPdbxFile.py +++ b/wwpdb/apps/ann_tasks_v2/utils/PublicPdbxFile.py @@ -51,7 +51,7 @@ def __setup(self): self.__sObj = self.__reqObj.getSessionObj() self._sessionPath = self.__sObj.getPath() self._exportPath = self._sessionPath # pylint: disable=attribute-defined-outside-init - self._cleanup = False + self._cleanup = True def setExportPath(self, exportPath): """Set the path where output files are copyied.""" diff --git a/wwpdb/apps/ann_tasks_v2/utils/TerminalAtoms.py b/wwpdb/apps/ann_tasks_v2/utils/TerminalAtoms.py index 4657955..9d0b54e 100644 --- a/wwpdb/apps/ann_tasks_v2/utils/TerminalAtoms.py +++ b/wwpdb/apps/ann_tasks_v2/utils/TerminalAtoms.py @@ -68,6 +68,10 @@ def run(self, entryId, inpFile, updateInput=True, updateOption="delete"): inpPath = os.path.join(self.__sessionPath, inpFile) logPath1 = os.path.join(self.__sessionPath, entryId + "-terminal-atoms.log") retPath = os.path.join(self.__sessionPath, entryId + "_model-updated_P1.cif") + for filePath in ( retPath, logPath1 ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) dp.imp(inpPath) @@ -78,16 +82,19 @@ def run(self, entryId, inpFile, updateInput=True, updateOption="delete"): dp.exp(retPath) self.addDownloadPath(retPath) self.addDownloadPath(logPath1) - if updateInput: + if updateInput and os.access(retPath, os.R_OK): dp.exp(inpPath) - # self.__status = self.__checkStatus(logPath1) if self.__verbose: self.__lfh.write("+TerminalAtoms.run- completed with status %s for entryId %s file %s\n" % (self.__status, entryId, inpPath)) - + # dp.cleanup() - return True + if os.access(retPath, os.R_OK): + return True + else: + return False + # except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) return False diff --git a/wwpdb/apps/ann_tasks_v2/utils/TlsRange.py b/wwpdb/apps/ann_tasks_v2/utils/TlsRange.py index c0b935b..94119ba 100644 --- a/wwpdb/apps/ann_tasks_v2/utils/TlsRange.py +++ b/wwpdb/apps/ann_tasks_v2/utils/TlsRange.py @@ -65,8 +65,10 @@ def run(self, entryId, depFileName, inpFile): inpPath = os.path.join(self.__sessionPath, inpFile) logPath = os.path.join(self.__sessionPath, entryId + "-tls-range.log") retPath = os.path.join(self.__sessionPath, entryId + "-tls-correction.cif") - if os.access(retPath, os.R_OK): - os.remove(retPath) + for filePath in ( retPath, logPath ): + if os.access(filePath, os.R_OK): + os.remove(filePath) + # # dp = RcsbDpUtility(tmpPath=self.__sessionPath, siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh) # @@ -95,7 +97,7 @@ def run(self, entryId, depFileName, inpFile): if self.__verbose: self.__lfh.write("+TlsRange.run- completed with status %s for entryId %s file %s\n" % (self.__status, entryId, inpPath)) # - # dp.cleanup() + dp.cleanup() return True except: # noqa: E722 pylint: disable=bare-except traceback.print_exc(file=self.__lfh) diff --git a/wwpdb/apps/ann_tasks_v2/webapp/AnnTasksWebAppWorker.py b/wwpdb/apps/ann_tasks_v2/webapp/AnnTasksWebAppWorker.py index bf47e44..941d6b6 100644 --- a/wwpdb/apps/ann_tasks_v2/webapp/AnnTasksWebAppWorker.py +++ b/wwpdb/apps/ann_tasks_v2/webapp/AnnTasksWebAppWorker.py @@ -315,8 +315,9 @@ def _launchOp(self): # # auto_assembly_status = "" + assembly_inferred = "" if bIsWorkflow: - hasAssemblyInfo = self.__checkAssemblyInfo(os.path.join(self._sessionPath, entryFileName)) + hasAssemblyInfo,assembly_inferred = self.__checkAssemblyInfo(os.path.join(self._sessionPath, entryFileName)) if hasAssemblyInfo: auto_assembly_status = "existed" method = str(self._reqObj.getValue("method")).strip().upper() @@ -332,7 +333,7 @@ def _launchOp(self): assem.autoAssignDefaultAssembly(entryId, entryFileName) # updatedModelPath = os.path.join(self._sessionPath, entryId + "_model-assembly-updated_P1.cif") - hasAssemblyInfo = self.__checkAssemblyInfo(updatedModelPath) + hasAssemblyInfo,assembly_inferred = self.__checkAssemblyInfo(updatedModelPath) if hasAssemblyInfo: auto_assembly_status = "updated" os.rename(updatedModelPath, os.path.join(self._sessionPath, entryFileName)) @@ -353,6 +354,9 @@ def _launchOp(self): if missingpcmstatus == "yes": auto_assembly_status_url += "&missingpcmstatus=" + missingpcmstatus # + if assembly_inferred != "": + auto_assembly_status_url += "&provenance=" + assembly_inferred.strip().upper() + # htmlList = [] htmlList.append("") htmlList.append('') @@ -869,10 +873,11 @@ def __checkAssemblyInfo(self, modelFile): assemblyList = cifObj.GetValue("pdbx_struct_assembly") genList = cifObj.GetValue("pdbx_struct_assembly_gen") operList = cifObj.GetValue("pdbx_struct_oper_list") + assembly_inferred = cifObj.GetSingleValue("pdbx_depui_status_flags", "assembly_inferred") if (len(assemblyList) > 0) and (len(genList) > 0) and (len(operList) > 0): - return True + return True,assembly_inferred # - return False + return False,assembly_inferred def __getNmrDiagnosticsHtmlText(self, entryId): """Get diagnostics from validation xml and nmr-shift-error-report json files"""