Skip to content

Commit

Permalink
display the assembly provenance tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Ezra Peisach committed Dec 5, 2024
1 parent 14cc88c commit b699c46
Show file tree
Hide file tree
Showing 35 changed files with 246 additions and 71 deletions.
2 changes: 1 addition & 1 deletion wwpdb/apps/ann_tasks_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
__author__ = "Ezra Peisach"
__email__ = "[email protected]"
__license__ = "Apache 2.0"
__version__ = "0.41.1"
__version__ = "0.41.2"
2 changes: 2 additions & 0 deletions wwpdb/apps/ann_tasks_v2/assembly/AssemblyInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
28 changes: 24 additions & 4 deletions wwpdb/apps/ann_tasks_v2/assembly/AssemblySelect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wwpdb/apps/ann_tasks_v2/check/ExtraCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
2 changes: 1 addition & 1 deletion wwpdb/apps/ann_tasks_v2/check/FormatCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 8 additions & 3 deletions wwpdb/apps/ann_tasks_v2/check/GeometryCalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -76,15 +76,20 @@ 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:
self.__lfh.write("+%s.%s geometry 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("+%s.%s geometry calc failed for entryId %s file %s\n" % (self.__class__.__name__, inspect.currentframe().f_code.co_name, entryId, inpFile))
Expand Down
2 changes: 1 addition & 1 deletion wwpdb/apps/ann_tasks_v2/check/GeometryCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions wwpdb/apps/ann_tasks_v2/correspnd/CorresPNDTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 9 additions & 2 deletions wwpdb/apps/ann_tasks_v2/editCoord/CSEditorForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion wwpdb/apps/ann_tasks_v2/editCoord/CSEditorUpdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand Down
8 changes: 7 additions & 1 deletion wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorForm_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 10 additions & 2 deletions wwpdb/apps/ann_tasks_v2/editCoord/CoordEditorUpdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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!")
Expand Down
9 changes: 7 additions & 2 deletions wwpdb/apps/ann_tasks_v2/em3d/EmAutoFix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

Expand All @@ -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")
Expand All @@ -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"):
Expand Down
10 changes: 9 additions & 1 deletion wwpdb/apps/ann_tasks_v2/em3d/EmEditUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions wwpdb/apps/ann_tasks_v2/link/Link.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 12 additions & 3 deletions wwpdb/apps/ann_tasks_v2/mapcalc/BisoFullCalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand All @@ -79,15 +83,20 @@ 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:
self.__lfh.write("+BisoFullCalc.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("+BisoFullCalc.run- failed with exception for entryId %s file %s\n" % (entryId, inpPath))
Expand Down
2 changes: 1 addition & 1 deletion wwpdb/apps/ann_tasks_v2/mapcalc/DccCalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
Loading

0 comments on commit b699c46

Please sign in to comment.