From 19396f773acda3b097ec09da0f7022dc7c0a353b Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Wed, 28 Aug 2024 08:09:11 -0400 Subject: [PATCH] added PCM/PTM checking --- wwpdb/apps/entity_transform/__init__.py | 2 +- .../depict/PrdSummaryDepict.py | 14 ++++++++++++ .../depict/ProcessPrdSummary.py | 22 ++++++++++++++----- .../entity_transform/utils/SummaryCifUtil.py | 4 ++++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/wwpdb/apps/entity_transform/__init__.py b/wwpdb/apps/entity_transform/__init__.py index efcc70e..ae1375b 100644 --- a/wwpdb/apps/entity_transform/__init__.py +++ b/wwpdb/apps/entity_transform/__init__.py @@ -2,4 +2,4 @@ __author__ = "Ezra Peisach" __email__ = "ezra.peisach@rcsb.org" __license__ = "Apache 2.0" -__version__ = "0.20" +__version__ = "0.21" diff --git a/wwpdb/apps/entity_transform/depict/PrdSummaryDepict.py b/wwpdb/apps/entity_transform/depict/PrdSummaryDepict.py index aad726c..2e9ab1b 100644 --- a/wwpdb/apps/entity_transform/depict/PrdSummaryDepict.py +++ b/wwpdb/apps/entity_transform/depict/PrdSummaryDepict.py @@ -2,6 +2,10 @@ # File: PrdSummaryDepict.py # Date: 09-Oct-2012 # Updates: +# 25-Aug-2024 zf add following warning message: +# Unknown CCD ID covalently linked to a polymer residue, or in the polymer sequence +# Existing CCD ID without PCM data covalently linked to a polymer residue, or in the polymer sequence +# CCD ID that should be not used as PCM/PTM observed covalently linked to a polymer residue, or in the polymer sequence ## """ Create HTML depiction for PRD search summary. @@ -50,6 +54,7 @@ def DoRenderSummaryPage(self, imageFlag=True): self.__graphmatchResultFlag = prdUtil.getGraphmatchResultFlag() self.__combResidueFlag = prdUtil.getCombResidueFlag() self.__splitPolymerResidueFlag = prdUtil.getSplitPolymerResidueFlag() + self.__pcmLabelList = prdUtil.getPcmLabelList() # input_data = 'sessionid=' + self._sessionId + '&identifier=' + self._identifier + '&pdbid=' + self._pdbId # @@ -85,6 +90,15 @@ def DoRenderSummaryPage(self, imageFlag=True): # text += '
  • View PCM/PTM Documentation
  • \n' # noqa: E501 # + if "1" in self.__pcmLabelList: + text += '
  • Unknown CCD ID covalently linked to a polymer residue, or in the polymer sequence
  • \n' + # + if "2" in self.__pcmLabelList: + text += '
  • Existing CCD ID without PCM data covalently linked to a polymer residue, or in the polymer sequence
  • \n' + # + if "3" in self.__pcmLabelList: + text += '
  • CCD ID that should be not used as PCM/PTM observed covalently linked to a polymer residue, or in the polymer sequence
  • \n' + # text += '\n' # return text diff --git a/wwpdb/apps/entity_transform/depict/ProcessPrdSummary.py b/wwpdb/apps/entity_transform/depict/ProcessPrdSummary.py index d3c06b6..e7c0d3b 100644 --- a/wwpdb/apps/entity_transform/depict/ProcessPrdSummary.py +++ b/wwpdb/apps/entity_transform/depict/ProcessPrdSummary.py @@ -2,6 +2,8 @@ # File: ProcessPrdSummary.py # Date: 15-Feb-2019 # Updates: +# 25-Aug-2024 zf add getPcmLabelList() +# change the default 'red' color code to different color codes read from '_pdbx_non_polymer_info.highlight_with_color' item ## """ Process PRD search results and generate images. @@ -55,6 +57,7 @@ def __init__(self, reqObj=None, summaryCifObj=None, verbose=False, log=sys.stder self.__graphmatchResultFlag = False self.__combResidueFlag = False self.__splitPolymerResidueFlag = False + self.__pcmLabelList = [] def setTopDirPath(self, topPath): self.__topDirPath = topPath @@ -74,6 +77,10 @@ def run(self, imageFlag=True): if imageFlag: self.__generateImage() # + val = self.__cifObj.getPcmLabel() + if val: + self.__pcmLabelList = val.split(",") + # if self.__action_required_data: dic = {} dic["id"] = "action" @@ -112,6 +119,9 @@ def getCombResidueFlag(self): def getSplitPolymerResidueFlag(self): return self.__splitPolymerResidueFlag + def getPcmLabelList(self): + return self.__pcmLabelList + def __readEntityData(self): elist = self.__cifObj.getValueList("pdbx_entity_info") if not elist: @@ -273,14 +283,14 @@ def __readNonPolymerData(self): return # nonpolymermap = {} - colorList = [] + colorMap = {} for d in elist: if ('instance_id' not in d) or ('residue_id' not in d) or ('linkage_info' not in d): continue # - if ("highlight_with_color" in d) and (d["highlight_with_color"] == "Y"): - if d['residue_id'] not in colorList: - colorList.append(d['residue_id']) + if ("highlight_with_color" in d) and d["highlight_with_color"]: + if d['residue_id'] not in colorMap: + colorMap[d['residue_id']] = d["highlight_with_color"] # # if d['linkage_info'] == 'linked': @@ -308,8 +318,8 @@ def __readNonPolymerData(self): for k in keylist: v = nonpolymermap[k] count = len(v) - if k in colorList: - text = '' + k + " (" + str(count) + " " + if k in colorMap: + text = '' + k + " (" + str(count) + " " else: text = k + ' (' + str(count) + ' ' # diff --git a/wwpdb/apps/entity_transform/utils/SummaryCifUtil.py b/wwpdb/apps/entity_transform/utils/SummaryCifUtil.py index 4e667ec..3a2c055 100644 --- a/wwpdb/apps/entity_transform/utils/SummaryCifUtil.py +++ b/wwpdb/apps/entity_transform/utils/SummaryCifUtil.py @@ -2,6 +2,7 @@ # File: SummaryCifUtil.py # Date: 17-Oct-2012 # Updates: +# 25-Aug-2024 zf add getPcmLabel() method to read PCM information from '_entry.pcm_label' item ## """ Read and handle search summary cif file. @@ -70,6 +71,9 @@ def getEntryIds(self): def getFileId(self): return self.__cifObj.GetSingleValue('entry', 'file') + def getPcmLabel(self): + return self.__cifObj.GetSingleValue('entry', 'pcm_label') + def getTitle(self): return self.__cifObj.GetSingleValue('struct', 'title')