wwpdb.apps.ccmodule 0.32__tar.gz → 0.32.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/PKG-INFO +2 -2
  2. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/__init__.py +1 -1
  3. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/chem/ChemCompAssignDepict.py +33 -6
  4. wwpdb_apps_ccmodule-0.32.2/wwpdb/apps/ccmodule/reports/ChemCompAlignImageGenerator.py +154 -0
  5. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb.apps.ccmodule.egg-info/PKG-INFO +2 -2
  6. wwpdb_apps_ccmodule-0.32/wwpdb/apps/ccmodule/reports/ChemCompAlignImageGenerator.py +0 -130
  7. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/README.md +0 -0
  8. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/setup.cfg +0 -0
  9. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/setup.py +0 -0
  10. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/__init__.py +0 -0
  11. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/__init__.py +0 -0
  12. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/chem/ChemCompAnnotate.py +0 -0
  13. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/chem/ChemCompAssign.py +0 -0
  14. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/chem/ChemCompAssignDepictLite.py +0 -0
  15. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/chem/PdbxChemCompAssign.py +0 -0
  16. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/chem/__init__.py +0 -0
  17. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/depict/ChemCompDepict.py +0 -0
  18. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/depict/__init__.py +0 -0
  19. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/extract/__init__.py +0 -0
  20. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/extract/ccOps.py +0 -0
  21. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/io/ChemCompAssignDataStore.py +0 -0
  22. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/io/ChemCompDataExport.py +0 -0
  23. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/io/ChemCompDataImport.py +0 -0
  24. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/io/ChemCompEditStore.py +0 -0
  25. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/io/ChemCompIo.py +0 -0
  26. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/io/__init__.py +0 -0
  27. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/reports/ChemCompAlignImages.py +0 -0
  28. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/reports/ChemCompBigAlignImages.py +0 -0
  29. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/reports/ChemCompGenImage.py +0 -0
  30. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/reports/ChemCompReports.py +0 -0
  31. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/reports/InstanceDataGenerator.py +0 -0
  32. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/reports/__init__.py +0 -0
  33. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/search/ChemCompSearch.py +0 -0
  34. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/search/ChemCompSearchDb.py +0 -0
  35. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/search/ChemCompSearchDbDepict.py +0 -0
  36. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/search/ChemCompSearchDepict.py +0 -0
  37. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/search/DbSession.py +0 -0
  38. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/search/__init__.py +0 -0
  39. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/sketch/ChemCompSketch.py +0 -0
  40. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/sketch/ChemCompSketchDepict.py +0 -0
  41. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/sketch/__init__.py +0 -0
  42. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/utils/ChemCompConfig.py +0 -0
  43. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/utils/ChemCompDpUtility.py +0 -0
  44. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/utils/ChemCompWFInterface.py +0 -0
  45. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/utils/Exceptions.py +0 -0
  46. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/utils/LigandAnalysisState.py +0 -0
  47. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/utils/__init__.py +0 -0
  48. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/view/ChemCompView.py +0 -0
  49. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/view/ChemCompViewDepict.py +0 -0
  50. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/view/__init__.py +0 -0
  51. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/webapp/ChemCompWebApp.py +0 -0
  52. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/webapp/ChemCompWebAppLite.py +0 -0
  53. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/webapp/__init__.py +0 -0
  54. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb/apps/ccmodule/webapp/wsgi.py +0 -0
  55. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb.apps.ccmodule.egg-info/SOURCES.txt +0 -0
  56. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb.apps.ccmodule.egg-info/dependency_links.txt +0 -0
  57. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb.apps.ccmodule.egg-info/not-zip-safe +0 -0
  58. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb.apps.ccmodule.egg-info/requires.txt +0 -0
  59. {wwpdb_apps_ccmodule-0.32 → wwpdb_apps_ccmodule-0.32.2}/wwpdb.apps.ccmodule.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: wwpdb.apps.ccmodule
3
- Version: 0.32
3
+ Version: 0.32.2
4
4
  Summary: wwPDB workflow engine utils
5
5
  Home-page: https://github.com/rcsb/py-wwpdb_apps_wf_engine_utils
6
6
  Author: Ezra Peisach
@@ -3,4 +3,4 @@ __docformat__ = "restructuredtext en"
3
3
  __author__ = "Ezra Peisach"
4
4
  __email__ = "ezra.peisach@rcsb.org"
5
5
  __license__ = "Apache 2.0"
6
- __version__ = "0.32"
6
+ __version__ = "0.32.2"
@@ -82,6 +82,7 @@
82
82
  # 2017-05-03 RPS Updates so that LOI tracking can succeed even in cases where annotator reruns ligand search and consequently changes value for "author" assigned CCID
83
83
  # 2023-06-21 ZF Added chemical descriptions provided by refinement packages
84
84
  # 2024-12-07 ZF Added extpdbid
85
+ # 2025-05-31 ZF Added self.__splitCcdList[] and displaying OBS status information for split CCDs
85
86
  ##
86
87
  """
87
88
  Create HTML depiction chemical component assignment files.
@@ -141,7 +142,7 @@ class ChemCompAssignDepict(ChemCompDepict):
141
142
  self.__pathAllInstcs = "templates/workflow_ui/instances_view/all_instances"
142
143
  self.__pathAllInstncsCmprTmplts = self.__pathAllInstcs + "/comparison_view"
143
144
  self.__pathAllInstncsJmolTmplts = self.__pathAllInstncsCmprTmplts + "/jmol"
144
-
145
+ #
145
146
  self.__dpstrInfoKeyList = ['dpstr_info_name',
146
147
  'dpstr_info_alt_comp_id',
147
148
  'dpstr_info_frmla',
@@ -159,6 +160,13 @@ class ChemCompAssignDepict(ChemCompDepict):
159
160
  'dpstr_restraint_img_pth',
160
161
  'dpstr_info_type',
161
162
  'dpstr_info_details']
163
+ #
164
+ self.__splitCcdList = [ "1CU", "2OF", "3OF", "543", "CD1", "CD3", "CD5", "CO5", "KO4", "MH3",
165
+ "MN5", "MN6", "MO1", "MO2", "MO3", "MO4", "MO5", "MO6", "MW1", "MW2",
166
+ "MW3", "NA2", "NA5", "NA6", "NAO", "NAW", "NI1", "NI2", "NI3", "NIK",
167
+ "O4M", "OC1", "OC2", "OC3", "OC4", "OC5", "OC6", "OC7", "OC8", "OCL",
168
+ "OCM", "OCN", "OCO", "OF1", "OF3", "YH", "ZH3", "ZN3", "ZNO", "ZO3" ]
169
+ #
162
170
 
163
171
  ################################################################################################################
164
172
  # ------------------------------------------------------------------------------------------------------------
@@ -314,8 +322,13 @@ class ChemCompAssignDepict(ChemCompDepict):
314
322
  scoreWarnClass = retD['warn_class']
315
323
  scorePrefix = retD['prefix']
316
324
  scoreSuffix = retD['suffix']
325
+ #
326
+ status = ''
327
+ if topHitCcId.upper() in self.__splitCcdList:
328
+ status = ' <br/><span style="color: red;">Status: OBS</span>'
329
+ #
317
330
  # we also apply required html markup to CCID display field when not "None"
318
- topHitCcId = '<a href="/ccmodule/cc-view.html?ccid=' + topHitCcId + '" target="_blank" title="Profile in Viewer">' + topHitCcId + '</a>'
331
+ topHitCcId = '<a href="/ccmodule/cc-view.html?ccid=' + topHitCcId + '" target="_blank" title="Profile in Viewer">' + topHitCcId + '</a>' + status
319
332
  #
320
333
  cmpstScore = scorePrefix + str(p_ccAssgnDataStr.getBatchBestHitScore(instId)) + scoreSuffix
321
334
  #
@@ -861,7 +874,11 @@ class ChemCompAssignDepict(ChemCompDepict):
861
874
  if topHit == 'None':
862
875
  myD['top_hit_ccid'] = topHit
863
876
  else:
864
- myD['top_hit_ccid'] = '<a href="/ccmodule/cc-view.html?ccid=' + topHit + '" target="_blank" title="Profile in Viewer">' + topHit + '</a>'
877
+ status = ''
878
+ if topHit.upper() in self.__splitCcdList:
879
+ status = ' <br/><span style="color: red;">Status: OBS</span>'
880
+ #
881
+ myD['top_hit_ccid'] = '<a href="/ccmodule/cc-view.html?ccid=' + topHit + '" target="_blank" title="Profile in Viewer">' + topHit + '</a>' + status
865
882
  #
866
883
  hlprD = self.__processWarningMsg(p_ccAssgnDataStr.getCcAssgnWarning(instId))
867
884
  #
@@ -1144,19 +1161,24 @@ class ChemCompAssignDepict(ChemCompDepict):
1144
1161
  #
1145
1162
  countr = 0
1146
1163
  for tupL in p_ccAssgnDataStr.getTopHitsList(instId):
1147
-
1164
+ candidate_ccid_with_status = tupL[0]
1165
+ if tupL[0].upper() in self.__splitCcdList:
1166
+ candidate_ccid_with_status = tupL[0] + ' <br/><span style="color: red;">Status: OBS</span>'
1167
+ #
1168
+ myD['candidate_ccid_with_status'] = candidate_ccid_with_status
1148
1169
  myD['candidate_ccid'] = tupL[0]
1149
1170
  # template requires "candidate_ccid", "instanceid", and "showstyle" substitution parameters
1150
1171
  oL.append(self.processTemplate(tmpltPth=p_tmpltPth, fn="cc_all_instncs_assgn_row_tmplt.html", parameterDict=myD))
1151
1172
  countr += 1
1152
-
1173
+ #
1153
1174
  if countr == 0:
1154
1175
  myD['candidate_ccid'] = "None"
1155
1176
  if self.__verbose:
1156
1177
  self.__lfh.write("+ChemCompAssignDepict.doRender_InstanceAssgnRows() candidate_ccid for %s set to 'None'\n" % instId)
1157
1178
  # template requires "candidate_ccid", "instanceid", and "showstyle" substitution parameters
1158
1179
  oL.append(self.processTemplate(tmpltPth=p_tmpltPth, fn="cc_all_instncs_assgn_row_tmplt.html", parameterDict=myD))
1159
-
1180
+ #
1181
+ #
1160
1182
  # end of iterating through all instanc IDs
1161
1183
 
1162
1184
  return oL
@@ -1639,6 +1661,10 @@ class ChemCompAssignDepict(ChemCompDepict):
1639
1661
  else:
1640
1662
  assgnChecked = ''
1641
1663
  #
1664
+ status = ''
1665
+ if ccid.upper() in self.__splitCcdList:
1666
+ status = ' <br/><span style="color: red;">Status: OBS</span>'
1667
+ #
1642
1668
  # using lclDict to supply text substitution content for both cc_instnc_match_rslts_tbl_tmplt.html and cc_viz_cmp_li_tmplt.html in this loop
1643
1669
  lclDict['assgn_checked'] = assgnChecked
1644
1670
  #
@@ -1649,6 +1675,7 @@ class ChemCompAssignDepict(ChemCompDepict):
1649
1675
  #
1650
1676
  lclDict['score'] = scorePrefix + cmpstscore + scoreSuffix
1651
1677
  lclDict['ccid'] = ccid
1678
+ lclDict['ccid_status'] = status
1652
1679
  lclDict['cc_name'] = name
1653
1680
  lclDict['cc_name_displ'] = self.truncateForDisplay(name)
1654
1681
  lclDict['cc_formula'] = formula
@@ -0,0 +1,154 @@
1
+ ##
2
+ # File: ChemCompAlignImageGenerator.py
3
+ # Date: 31-Oct-2014
4
+ ##
5
+ """
6
+ Utility Class for generating aligned ligand images
7
+
8
+ This software was developed as part of the World Wide Protein Data Bank
9
+ Common Deposition and Annotation System Project
10
+
11
+ Copyright (c) 2012 wwPDB
12
+
13
+ This software is provided under a Creative Commons Attribution 3.0 Unported
14
+ License described at http://creativecommons.org/licenses/by/3.0/.
15
+
16
+ """
17
+ __docformat__ = "restructuredtext en"
18
+ __author__ = "Zukang Feng"
19
+ __email__ = "zfeng@rcsb.rutgers.edu"
20
+ __license__ = "Creative Commons Attribution 3.0 Unported"
21
+ __version__ = "V0.01"
22
+
23
+ import os
24
+ import sys
25
+ import traceback
26
+
27
+ from wwpdb.utils.config.ConfigInfo import ConfigInfo
28
+ from wwpdb.utils.dp.RcsbDpUtility import RcsbDpUtility
29
+ from wwpdb.io.file.mmCIFUtil import mmCIFUtil
30
+ from wwpdb.io.locator.ChemRefPathInfo import ChemRefPathInfo
31
+
32
+
33
+ class ChemCompAlignImageGenerator(object):
34
+ """Utility Class for generating aligned ligand images
35
+ """
36
+ def __init__(self, reqObj=None, verbose=False, log=sys.stderr):
37
+ self.__reqObj = reqObj
38
+ self.__verbose = verbose
39
+ self.__lfh = log
40
+ #
41
+ self.__sObj = self.__reqObj.getSessionObj()
42
+ self.__sessionPath = self.__sObj.getPath()
43
+ #
44
+ self.__imagePath = None
45
+
46
+ self.__siteId = str(self.__reqObj.getValue("WWPDB_SITE_ID"))
47
+ self.__cI = ConfigInfo(self.__siteId)
48
+ #
49
+ self.__ccRefPathInfo = ChemRefPathInfo(self.__siteId, verbose=self.__verbose, log=self.__lfh)
50
+
51
+ def generateImages(self, instId=None, instFile=None, hitList=None):
52
+ if (not instId) or (not instFile) or (not os.access(instFile, os.F_OK)):
53
+ return
54
+ if hitList is None:
55
+ hitList = []
56
+ #
57
+ self.__imagePath = os.path.join(self.__sessionPath, "assign", instId, "image")
58
+ if not os.access(self.__imagePath, os.F_OK):
59
+ try:
60
+ os.makedirs(self.__imagePath)
61
+ except: # noqa: E722 pylint: disable=bare-except
62
+ return
63
+ #
64
+ #
65
+ foundList = []
66
+ imageFile = os.path.join(self.__imagePath, "image.txt")
67
+ ofh = open(imageFile, "w")
68
+ ofh.write(instId + " " + instFile + "\n")
69
+ for hitId in hitList: # pylint: disable=redefined-builtin
70
+ refFile = self.__ccRefPathInfo.getFilePath(str(hitId).upper())
71
+ if not os.access(refFile, os.F_OK):
72
+ continue
73
+ #
74
+ ofh.write(hitId + " " + refFile + "\n")
75
+ #
76
+ alist = []
77
+ alist.append(hitId)
78
+ alist.append(refFile)
79
+ foundList.append(alist)
80
+ #
81
+ ofh.close()
82
+ #
83
+ if foundList:
84
+ try:
85
+ heavyAtomCount = 0
86
+ cifObj = mmCIFUtil(filePath=instFile)
87
+ dlist = cifObj.GetValue("chem_comp_atom")
88
+ for ccDic in dlist:
89
+ if ("type_symbol" not in ccDic) or (not ccDic["type_symbol"]):
90
+ continue
91
+ #
92
+ type_symbol = ccDic["type_symbol"].upper().strip()
93
+ if (type_symbol == "H") or (type_symbol == "D"):
94
+ continue
95
+ #
96
+ heavyAtomCount += 1
97
+ #
98
+ # Only generate aligned images for small ligands - DAOTHER-9883 for D_1292143423: TP3 -> A1IZO
99
+ #
100
+ if heavyAtomCount < 100:
101
+ self.__lfh.write("+ChemCompAlignImageGenerator.generateImages() - Generating images \n")
102
+
103
+ dp = RcsbDpUtility(tmpPath=self.__imagePath, siteId=self.__cI.get("SITE_PREFIX"), verbose=self.__verbose, log=self.__lfh)
104
+ dp.addInput(name="image_file", value=imageFile)
105
+ dp.setWorkingDir(self.__imagePath)
106
+ returnCode = dp.op("chem-comp-align-img-gen")
107
+
108
+ self.__lfh.write("+ChemCompAlignImageGenerator.generateImages() - remote process returned %d \n" % returnCode)
109
+
110
+ if returnCode == 0:
111
+ FounImage = True
112
+ imageFile = os.path.join(self.__imagePath, instId + ".svg")
113
+ if not os.access(imageFile, os.F_OK):
114
+ FounImage = False
115
+ #
116
+ for hitId in hitList:
117
+ imageFile = os.path.join(self.__imagePath, hitId + ".svg")
118
+ if not os.access(imageFile, os.F_OK):
119
+ FounImage = False
120
+ #
121
+ #
122
+ if FounImage:
123
+ return
124
+ #
125
+ #
126
+ #
127
+ except: # noqa: E722 pylint: disable=bare-except
128
+ if self.__verbose:
129
+ traceback.print_exc(file=self.__lfh)
130
+ #
131
+ #
132
+ #
133
+
134
+ self.__generateSingleImage(Id=instId, FileName=instFile)
135
+ self.__generateSingleImage(Id=instId, FileName=instFile, size=1000, labelAtomName=True, suffix="_Big")
136
+ if foundList:
137
+ for flist in foundList:
138
+ self.__generateSingleImage(Id=flist[0], FileName=flist[1])
139
+ self.__generateSingleImage(Id=flist[0], FileName=flist[1], size=1000, labelAtomName=True, suffix="_Big")
140
+ #
141
+ #
142
+
143
+ def __generateSingleImage(self, Id=None, FileName=None, size=300, labelAtomName=False, suffix=""):
144
+ imgPth = os.path.join(self.__imagePath, Id + suffix + ".svg")
145
+
146
+ dp = RcsbDpUtility(tmpPath=self.__imagePath, siteId=self.__cI.get("SITE_PREFIX"), verbose=self.__verbose, log=self.__lfh)
147
+ dp.addInput(name="title", value=Id)
148
+ dp.addInput(name="path", value=FileName)
149
+ dp.addInput(name="image_path", value=imgPth)
150
+ dp.addInput(name="size", value=size)
151
+ dp.addInput(name="label", value=labelAtomName)
152
+
153
+ return dp.op("chem-comp-gen-images")
154
+ #
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: wwpdb.apps.ccmodule
3
- Version: 0.32
3
+ Version: 0.32.2
4
4
  Summary: wwPDB workflow engine utils
5
5
  Home-page: https://github.com/rcsb/py-wwpdb_apps_wf_engine_utils
6
6
  Author: Ezra Peisach
@@ -1,130 +0,0 @@
1
- ##
2
- # File: ChemCompAlignImageGenerator.py
3
- # Date: 31-Oct-2014
4
- ##
5
- """
6
- Utility Class for generating aligned ligand images
7
-
8
- This software was developed as part of the World Wide Protein Data Bank
9
- Common Deposition and Annotation System Project
10
-
11
- Copyright (c) 2012 wwPDB
12
-
13
- This software is provided under a Creative Commons Attribution 3.0 Unported
14
- License described at http://creativecommons.org/licenses/by/3.0/.
15
-
16
- """
17
- __docformat__ = "restructuredtext en"
18
- __author__ = "Zukang Feng"
19
- __email__ = "zfeng@rcsb.rutgers.edu"
20
- __license__ = "Creative Commons Attribution 3.0 Unported"
21
- __version__ = "V0.01"
22
-
23
- import os
24
- import sys
25
-
26
- from wwpdb.utils.config.ConfigInfo import ConfigInfo
27
- from wwpdb.utils.dp.RcsbDpUtility import RcsbDpUtility
28
- from wwpdb.io.locator.ChemRefPathInfo import ChemRefPathInfo
29
-
30
-
31
- class ChemCompAlignImageGenerator(object):
32
- """Utility Class for generating aligned ligand images
33
- """
34
- def __init__(self, reqObj=None, verbose=False, log=sys.stderr):
35
- self.__reqObj = reqObj
36
- self.__verbose = verbose
37
- self.__lfh = log
38
- #
39
- self.__sObj = self.__reqObj.getSessionObj()
40
- self.__sessionPath = self.__sObj.getPath()
41
- #
42
- self.__imagePath = None
43
-
44
- self.__siteId = str(self.__reqObj.getValue("WWPDB_SITE_ID"))
45
- self.__cI = ConfigInfo(self.__siteId)
46
- #
47
- self.__ccRefPathInfo = ChemRefPathInfo(self.__siteId, verbose=self.__verbose, log=self.__lfh)
48
-
49
- def generateImages(self, instId=None, instFile=None, hitList=None):
50
- if (not instId) or (not instFile):
51
- return
52
- if hitList is None:
53
- hitList = []
54
- #
55
- self.__imagePath = os.path.join(self.__sessionPath, 'assign', instId, 'image')
56
- if not os.access(self.__imagePath, os.F_OK):
57
- try:
58
- os.makedirs(self.__imagePath)
59
- except: # noqa: E722 pylint: disable=bare-except
60
- return
61
- #
62
- #
63
- foundList = []
64
- imageFile = os.path.join(self.__imagePath, 'image.txt')
65
- ofh = open(imageFile, 'w')
66
- ofh.write(instId + ' ' + instFile + '\n')
67
- for id in hitList: # pylint: disable=redefined-builtin
68
- refFile = self.__ccRefPathInfo.getFilePath(str(id).upper())
69
- if not os.access(refFile, os.F_OK):
70
- continue
71
- #
72
- ofh.write(id + ' ' + refFile + '\n')
73
- #
74
- alist = []
75
- alist.append(id)
76
- alist.append(refFile)
77
- foundList.append(alist)
78
- #
79
- ofh.close()
80
- #
81
- if foundList:
82
- self.__lfh.write('+ChemCompAlignImageGenerator.generateImages() - Generating images \n')
83
-
84
- dp = RcsbDpUtility(tmpPath=self.__imagePath, siteId=self.__cI.get('SITE_PREFIX'), verbose=self.__verbose, log=self.__lfh)
85
- dp.addInput(name='image_file', value=imageFile)
86
- dp.setWorkingDir(self.__imagePath)
87
- returnCode = dp.op('chem-comp-align-img-gen')
88
-
89
- self.__lfh.write('+ChemCompAlignImageGenerator.generateImages() - remote process returned %d \n' % returnCode)
90
-
91
- if returnCode == 0:
92
- FounImage = True
93
- imageFile = os.path.join(self.__imagePath, instId + '.svg')
94
- if not os.access(imageFile, os.F_OK):
95
- FounImage = False
96
- #
97
- for id in hitList:
98
- imageFile = os.path.join(self.__imagePath, id + '.svg')
99
- if not os.access(imageFile, os.F_OK):
100
- FounImage = False
101
- #
102
- #
103
- if FounImage:
104
- return
105
- #
106
- #
107
- #
108
-
109
- self.__generateSingleImage(Id=instId, FileName=instFile)
110
- self.__generateSingleImage(Id=instId, FileName=instFile, size=1000, labelAtomName=True, suffix='_Big')
111
- if foundList:
112
- for flist in foundList:
113
- self.__generateSingleImage(Id=flist[0], FileName=flist[1])
114
- self.__generateSingleImage(Id=flist[0], FileName=flist[1], size=1000, labelAtomName=True, suffix='_Big')
115
- #
116
- #
117
- #
118
-
119
- def __generateSingleImage(self, Id=None, FileName=None, size=300, labelAtomName=False, suffix=''):
120
- imgPth = os.path.join(self.__imagePath, Id + suffix + '.svg')
121
-
122
- dp = RcsbDpUtility(tmpPath=self.__imagePath, siteId=self.__cI.get('SITE_PREFIX'), verbose=self.__verbose, log=self.__lfh)
123
- dp.addInput(name="title", value=Id)
124
- dp.addInput(name="path", value=FileName)
125
- dp.addInput(name="image_path", value=imgPth)
126
- dp.addInput(name="size", value=size)
127
- dp.addInput(name="label", value=labelAtomName)
128
-
129
- return dp.op("chem-comp-gen-images")
130
- #