wwpdb.apps.ccmodule 0.26__tar.gz → 0.27__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.
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/PKG-INFO +1 -1
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/__init__.py +1 -1
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/chem/ChemCompAssign.py +3 -3
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/chem/ChemCompAssignDepict.py +15 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/chem/ChemCompAssignDepictLite.py +2 -4
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/reports/ChemCompReports.py +2 -2
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/sketch/ChemCompSketch.py +5 -3
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/utils/ChemCompConfig.py +2 -4
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/utils/ChemCompDpUtility.py +5 -4
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/utils/LigandAnalysisState.py +2 -2
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/view/ChemCompViewDepict.py +2 -2
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/webapp/ChemCompWebApp.py +7 -1
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/webapp/ChemCompWebAppLite.py +2 -4
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb.apps.ccmodule.egg-info/PKG-INFO +1 -1
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb.apps.ccmodule.egg-info/SOURCES.txt +0 -3
- wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/edit/ChemCompTableEditor.py +0 -384
- wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/edit/ChemCompTableEditorDepict.py +0 -564
- wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/webapp/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/README.md +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/setup.cfg +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/setup.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/chem/ChemCompAnnotate.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/chem/PdbxChemCompAssign.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/chem/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/depict/ChemCompDepict.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/depict/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/edit → wwpdb.apps.ccmodule-0.27/wwpdb/apps/ccmodule/extract}/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/extract/ccOps.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/io/ChemCompAssignDataStore.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/io/ChemCompDataExport.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/io/ChemCompDataImport.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/io/ChemCompEditStore.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/io/ChemCompIo.py +0 -0
- {wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/extract → wwpdb.apps.ccmodule-0.27/wwpdb/apps/ccmodule/io}/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/reports/ChemCompAlignImageGenerator.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/reports/ChemCompAlignImages.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/reports/ChemCompBigAlignImages.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/reports/ChemCompGenImage.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/reports/InstanceDataGenerator.py +0 -0
- {wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/io → wwpdb.apps.ccmodule-0.27/wwpdb/apps/ccmodule/reports}/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/search/ChemCompSearch.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/search/ChemCompSearchDb.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/search/ChemCompSearchDbDepict.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/search/ChemCompSearchDepict.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/search/DbSession.py +0 -0
- {wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/reports → wwpdb.apps.ccmodule-0.27/wwpdb/apps/ccmodule/search}/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/sketch/ChemCompSketchDepict.py +0 -0
- {wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/search → wwpdb.apps.ccmodule-0.27/wwpdb/apps/ccmodule/sketch}/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/utils/ChemCompWFInterface.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/utils/Exceptions.py +0 -0
- {wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/sketch → wwpdb.apps.ccmodule-0.27/wwpdb/apps/ccmodule/utils}/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/view/ChemCompView.py +0 -0
- {wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/utils → wwpdb.apps.ccmodule-0.27/wwpdb/apps/ccmodule/view}/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26/wwpdb/apps/ccmodule/view → wwpdb.apps.ccmodule-0.27/wwpdb/apps/ccmodule/webapp}/__init__.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/webapp/wsgi.py +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb.apps.ccmodule.egg-info/dependency_links.txt +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb.apps.ccmodule.egg-info/not-zip-safe +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb.apps.ccmodule.egg-info/requires.txt +0 -0
- {wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb.apps.ccmodule.egg-info/top_level.txt +0 -0
{wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/chem/ChemCompAssign.py
RENAMED
|
@@ -166,9 +166,9 @@ class ChemCompAssign(object):
|
|
|
166
166
|
self.__ccReportPath = os.path.join(self.__sessionPath, 'assign')
|
|
167
167
|
elif context == 'deposition':
|
|
168
168
|
self.__depId = self.__reqObj.getValue('identifier')
|
|
169
|
-
|
|
170
|
-
self.__modelDirPath = os.path.join(
|
|
171
|
-
self.__ccReportPath = os.path.join(
|
|
169
|
+
depositPath = Path(PathInfo().getDepositPath(self.__depId))
|
|
170
|
+
self.__modelDirPath = os.path.join(depositPath)
|
|
171
|
+
self.__ccReportPath = os.path.join(depositPath, self._CC_REPORT_DIR)
|
|
172
172
|
|
|
173
173
|
self.normal = ['ALA', 'CYS', 'ASP', 'GLU', 'PHE', 'GLY', 'HIS', 'ILE',
|
|
174
174
|
'LYS', 'LEU', 'MET', 'ASN', 'PRO', 'GLN', 'ARG', 'SER',
|
|
@@ -101,6 +101,7 @@ from wwpdb.apps.ccmodule.depict.ChemCompDepict import ChemCompDepict
|
|
|
101
101
|
# from wwpdb.apps.ccmodule.chem.PdbxChemCompAssign import PdbxCategoryDefinition
|
|
102
102
|
from wwpdb.apps.ccmodule.io.ChemCompAssignDataStore import ChemCompAssignDataStore
|
|
103
103
|
from wwpdb.utils.config.ConfigInfo import ConfigInfo
|
|
104
|
+
from wwpdb.utils.config.ConfigInfoApp import ConfigInfoAppCc
|
|
104
105
|
from wwpdb.utils.oe_util.oedepict.OeDepict import OeDepict
|
|
105
106
|
from wwpdb.utils.oe_util.build.OeBuildMol import OeBuildMol
|
|
106
107
|
|
|
@@ -123,6 +124,7 @@ class ChemCompAssignDepict(ChemCompDepict):
|
|
|
123
124
|
self.__debug = True
|
|
124
125
|
#
|
|
125
126
|
self.__cI = ConfigInfo()
|
|
127
|
+
self.__cIAppCc = ConfigInfoAppCc(verbose=self.__verbose, log=self.__lfh)
|
|
126
128
|
#
|
|
127
129
|
# self.__cDict = PdbxCategoryDefinition._cDict
|
|
128
130
|
#
|
|
@@ -382,6 +384,8 @@ class ChemCompAssignDepict(ChemCompDepict):
|
|
|
382
384
|
#
|
|
383
385
|
oL = []
|
|
384
386
|
#
|
|
387
|
+
if self.__cIAppCc.get_extended_ccd_supp():
|
|
388
|
+
oL.append('<script>max_ccd_width = 5;</script>\n')
|
|
385
389
|
oL.append('<div id="cc_entity_browser">\n<h4>Browse Chem Components by Entity Group</h4>\n<div id="pagi" class="noprint fltlft"></div>\n<br class="clearfloat" />\n')
|
|
386
390
|
oL.append('<div id="cc_entity_browse_content">\n')
|
|
387
391
|
i = 0
|
|
@@ -531,6 +535,12 @@ class ChemCompAssignDepict(ChemCompDepict):
|
|
|
531
535
|
##
|
|
532
536
|
############################################################
|
|
533
537
|
#
|
|
538
|
+
# CCD ID width expansion
|
|
539
|
+
if self.__cIAppCc.get_extended_ccd_supp():
|
|
540
|
+
lclDict['max_ccd_width'] = '5'
|
|
541
|
+
else:
|
|
542
|
+
lclDict['max_ccd_width'] = '3'
|
|
543
|
+
|
|
534
544
|
# ######## Rerun Search handling ############################
|
|
535
545
|
##
|
|
536
546
|
lclDict['link_radius_dlta'] = p_ccAssgnDataStr.getGlblRerunSrchParam_lnkRadii(p_authAssignedGrp)
|
|
@@ -628,6 +638,11 @@ class ChemCompAssignDepict(ChemCompDepict):
|
|
|
628
638
|
#
|
|
629
639
|
#######################################################################################################################################################
|
|
630
640
|
#######################################################################################################################################################
|
|
641
|
+
if self.__cIAppCc.get_extended_ccd_supp():
|
|
642
|
+
p_hlprDict['max_ccd_width'] = '5'
|
|
643
|
+
else:
|
|
644
|
+
p_hlprDict['max_ccd_width'] = '3'
|
|
645
|
+
|
|
631
646
|
p_hlprDict['top_hit_ccid'] = topHitCcId
|
|
632
647
|
p_hlprDict['2dpath_labld_w_hy_ref'] = os.path.join(self.rltvSessionPath, 'assign', instId, 'image', topHitCcId + '_Big.svg')
|
|
633
648
|
# p_hlprDict['2dpath_labld_w_hy_ref'] = os.path.join(self.rltvSessionPath, 'assign', 'rfrnc_reports', topHitCcId, topHitCcId + '_D3L3.gif')
|
|
@@ -124,10 +124,8 @@ class ChemCompAssignDepictLite(ChemCompDepict):
|
|
|
124
124
|
|
|
125
125
|
self.__alternateTopHitMarkup = '''<input id="use_exact_mtch_id_%(auth_assgnd_grp)s_%(tophit_id)s" class="c_%(auth_assgnd_grp)s addrss_msmtch use_exact_mtch_id" type="radio" name="addrss_msmtch_chc" value="use_exact_mtch_id" %(use_exact_mtch_id_checked)s %(disabled)s /><label for="use_exact_mtch_id_%(auth_assgnd_grp)s_%(tophit_id)s">Use exact match ID of <span name="%(tophit_id)s" style="color: #F00;" class="strong tophit">%(tophit_id)s</span> (<a href="http://ligand-expo.rcsb.org/pyapps/ldHandler.py?formid=cc-index-search&target=%(tophit_id)s&operation=ccid" target="_blank">See Definition</a>) instead of originally proposed ID</label><br />''' # noqa: E501
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
self.
|
|
129
|
-
self.__ccReportPath = os.path.join(self.__depositPath, self.__depId, self._CC_REPORT_DIR)
|
|
130
|
-
# self.__depositAssignPath = os.path.join(self.__depositPath, self.__depId, self._CC_ASSIGN_DIR)
|
|
127
|
+
depositPath = Path(PathInfo().getDepositPath(self.__depId))
|
|
128
|
+
self.__ccReportPath = os.path.join(depositPath, self._CC_REPORT_DIR)
|
|
131
129
|
self.__logger = self._setupLog(log)
|
|
132
130
|
|
|
133
131
|
################################################################################################################
|
{wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/reports/ChemCompReports.py
RENAMED
|
@@ -72,8 +72,8 @@ class ChemCompReport(object):
|
|
|
72
72
|
self.__ccReportPath = os.path.join(self.__sessionPath, 'assign')
|
|
73
73
|
elif context == 'deposition':
|
|
74
74
|
self.__depId = self.__reqObj.getValue('identifier').upper()
|
|
75
|
-
|
|
76
|
-
self.__ccReportPath = os.path.join(
|
|
75
|
+
depositPath = Path(PathInfo().getDepositPath(self.__depId))
|
|
76
|
+
self.__ccReportPath = os.path.join(depositPath, 'cc_analysis')
|
|
77
77
|
|
|
78
78
|
def __getContext(self):
|
|
79
79
|
filesource = self.__reqObj.getValue('filesource')
|
{wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/sketch/ChemCompSketch.py
RENAMED
|
@@ -21,6 +21,7 @@ import shutil
|
|
|
21
21
|
from wwpdb.apps.ccmodule.utils.ChemCompConfig import ChemCompConfig
|
|
22
22
|
from wwpdb.apps.ccmodule.io.ChemCompIo import ChemCompReader
|
|
23
23
|
from wwpdb.apps.ccmodule.extract.ccOps import ccOps
|
|
24
|
+
from wwpdb.io.locator.ChemRefPathInfo import ChemRefPathInfo
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class ChemCompSketch(object):
|
|
@@ -76,9 +77,10 @@ class ChemCompSketch(object):
|
|
|
76
77
|
def __getFilePathFromId(self, ccId):
|
|
77
78
|
"""
|
|
78
79
|
"""
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
siteid = self.__reqObj.getValue("WWPDB_SITE_ID")
|
|
81
|
+
crpi = ChemRefPathInfo(siteid, verbose=self.__verbose, log=self.__lfh)
|
|
82
|
+
|
|
83
|
+
self.__ccFilePath = crpi.getFilePath(ccId, "CC")
|
|
82
84
|
#
|
|
83
85
|
if (not os.access(self.__ccFilePath, os.R_OK)):
|
|
84
86
|
return False
|
{wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/utils/ChemCompConfig.py
RENAMED
|
@@ -59,7 +59,6 @@ class ChemCompConfig(object):
|
|
|
59
59
|
# RPS 2011-11-29 --- use of above symbolic links for archBinPath and archDataPath being superseded by paths determined via calls to ConfigInfo
|
|
60
60
|
self.__ccAppsBinPath = os.path.join(self.__cICommon.get_site_cc_apps_path(), "bin")
|
|
61
61
|
self.__ccDictPath = self.__cIAppCc.get_site_cc_dict_path()
|
|
62
|
-
self.__ccCvsPath = self.__cIAppCc.get_site_cc_cvs_path()
|
|
63
62
|
self.__oeLicenseFilePath = self.__cICommon.get_site_cc_oe_licence()
|
|
64
63
|
self.__oeDirPath = self.__cICommon.get_site_cc_oe_dir()
|
|
65
64
|
|
|
@@ -68,7 +67,6 @@ class ChemCompConfig(object):
|
|
|
68
67
|
self.__lfh.write("+ChemCompConfig.__init() --------------------------------------------------------------------------\n")
|
|
69
68
|
self.__lfh.write("+ChemCompConfig.__init() ------ self.__ccAppsBinPath is: %s \n" % self.__ccAppsBinPath)
|
|
70
69
|
self.__lfh.write("+ChemCompConfig.__init() ------ self.__ccDictPath is: %s \n" % self.__ccDictPath)
|
|
71
|
-
self.__lfh.write("+ChemCompConfig.__init() ------ self.__ccCvsPath is: %s \n" % self.__ccCvsPath)
|
|
72
70
|
self.__lfh.write("+ChemCompConfig.__init() --------------------------------------------------------------------------\n")
|
|
73
71
|
#
|
|
74
72
|
# Place holders for working path info -
|
|
@@ -147,8 +145,8 @@ class ChemCompConfig(object):
|
|
|
147
145
|
# elif (type == "sandboxPathV2"):
|
|
148
146
|
# return os.path.join("/data/components/ligand-dict-v1")
|
|
149
147
|
#
|
|
150
|
-
elif (type == "sandboxPathV3" or type == "chemCompCachePath"):
|
|
151
|
-
|
|
148
|
+
# elif (type == "sandboxPathV3" or type == "chemCompCachePath"):
|
|
149
|
+
# return self.__ccCvsPath
|
|
152
150
|
elif (type == "fpPatternPath"):
|
|
153
151
|
return self.__cICommon.get_cc_fp_patterns()
|
|
154
152
|
elif (type == "serializedCcDictPath"):
|
{wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/utils/ChemCompDpUtility.py
RENAMED
|
@@ -57,9 +57,9 @@ class ChemCompDpUtility(object):
|
|
|
57
57
|
siteId = str(self._reqObj.getValue("WWPDB_SITE_ID"))
|
|
58
58
|
|
|
59
59
|
self._ccRefPathInfo = ChemRefPathInfo(siteId, verbose=self._verbose, log=self._lfh)
|
|
60
|
-
|
|
61
|
-
self._ccReportPath = os.path.join(
|
|
62
|
-
self._depositAssignPath = os.path.join(
|
|
60
|
+
depositPath = Path(PathInfo().getDepositPath(self._depId))
|
|
61
|
+
self._ccReportPath = os.path.join(depositPath, self._CC_REPORT_DIR)
|
|
62
|
+
self._depositAssignPath = os.path.join(depositPath, self._CC_ASSIGN_DIR)
|
|
63
63
|
self._ligState = LigandAnalysisState(self._depId, self._verbose, self._lfh)
|
|
64
64
|
|
|
65
65
|
def doAnalysis(self):
|
|
@@ -552,7 +552,8 @@ class ChemCompDpUtility(object):
|
|
|
552
552
|
self._logger.warning('---- WARNING ---- No path obtained for CC assign details export file, id %s', depId)
|
|
553
553
|
|
|
554
554
|
# chem comp depositor progress file
|
|
555
|
-
|
|
555
|
+
depositPath = Path(PathInfo().getDepositPath(depId))
|
|
556
|
+
pathDict['dpstrPrgrssFileFlPth'] = os.path.join(depositPath, 'cc-dpstr-progress')
|
|
556
557
|
pathDict['dpstrPrgrssFileDirPth'] = os.path.split(pathDict['dpstrPrgrssFileFlPth'])[0]
|
|
557
558
|
|
|
558
559
|
if (self._verbose):
|
|
@@ -28,8 +28,8 @@ class LigandAnalysisState:
|
|
|
28
28
|
|
|
29
29
|
self._cI = ConfigInfo()
|
|
30
30
|
self._depId = depId
|
|
31
|
-
|
|
32
|
-
self._ccReportPath = os.path.join(
|
|
31
|
+
depositPath = Path(PathInfo().getDepositPath(self._depId))
|
|
32
|
+
self._ccReportPath = os.path.join(depositPath, 'cc_analysis')
|
|
33
33
|
self._ccStateFilePath = os.path.join(self._ccReportPath, self._CC_STATE_FILE)
|
|
34
34
|
|
|
35
35
|
self._progress = 0
|
{wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/view/ChemCompViewDepict.py
RENAMED
|
@@ -56,8 +56,8 @@ class ChemCompViewDepict(ChemCompDepict):
|
|
|
56
56
|
#
|
|
57
57
|
checked = ''
|
|
58
58
|
#
|
|
59
|
-
sPathRel = os.path.join(self.
|
|
60
|
-
sPathAbslt = os.path.join(self.
|
|
59
|
+
sPathRel = os.path.join(self.rltvAssgnSessionPath, ccId)
|
|
60
|
+
sPathAbslt = os.path.join(self.absltAssgnSessionPath, ccId)
|
|
61
61
|
#
|
|
62
62
|
p_ccDict['sess_path_rel'] = sPathRel
|
|
63
63
|
p_ccDict['jmol_code_base'] = self.jmolCodeBase
|
{wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb/apps/ccmodule/webapp/ChemCompWebApp.py
RENAMED
|
@@ -166,7 +166,7 @@ from wwpdb.apps.ccmodule.io.ChemCompDataExport import ChemCompDataExport
|
|
|
166
166
|
from wwpdb.apps.ccmodule.io.ChemCompIo import ChemCompReader
|
|
167
167
|
#
|
|
168
168
|
from wwpdb.utils.config.ConfigInfo import ConfigInfo
|
|
169
|
-
from wwpdb.utils.config.ConfigInfoApp import ConfigInfoAppCommon
|
|
169
|
+
from wwpdb.utils.config.ConfigInfoApp import ConfigInfoAppCommon, ConfigInfoAppCc
|
|
170
170
|
#
|
|
171
171
|
from wwpdb.io.file.mmCIFUtil import mmCIFUtil
|
|
172
172
|
#
|
|
@@ -298,6 +298,7 @@ class ChemCompWebAppWorker(object):
|
|
|
298
298
|
self.__rltvSessionPath = None
|
|
299
299
|
self.__siteId = str(self.__reqObj.getValue("WWPDB_SITE_ID"))
|
|
300
300
|
self.__cI = ConfigInfo(self.__siteId)
|
|
301
|
+
self.__cIAppCc = ConfigInfoAppCc(self.__siteId, verbose=self.__verbose, log=self.__lfh)
|
|
301
302
|
self.__modelFilePath = None
|
|
302
303
|
#
|
|
303
304
|
self.__pathInstncsVwTmplts = "templates/workflow_ui/instances_view"
|
|
@@ -623,6 +624,11 @@ class ChemCompWebAppWorker(object):
|
|
|
623
624
|
myD['instance'] = wfInstId
|
|
624
625
|
myD['pdbid'] = str(self.__reqObj.getValue("pdbid"))
|
|
625
626
|
myD['annotator'] = str(self.__reqObj.getValue("annotator"))
|
|
627
|
+
# CCD ID width expansion
|
|
628
|
+
if self.__cIAppCc.get_extended_ccd_supp():
|
|
629
|
+
myD['max_ccd_width'] = '5'
|
|
630
|
+
else:
|
|
631
|
+
myD['max_ccd_width'] = '3'
|
|
626
632
|
#
|
|
627
633
|
myD['session_url_prefix'] = os.path.join(self.__rltvSessionPath, "assign", instanceId)
|
|
628
634
|
myD['processing_site'] = self.__cI.get('SITE_NAME').upper()
|
|
@@ -248,9 +248,6 @@ class ChemCompWebAppLiteWorker(object):
|
|
|
248
248
|
# self.__siteConfigDir = self.__cI.get('TOP_WWPDB_SITE_CONFIG_DIR')
|
|
249
249
|
# self.__siteLoc = self.__cI.get('WWPDB_SITE_LOC')
|
|
250
250
|
self.__pathInfo = PathInfo()
|
|
251
|
-
self.__depositPath = Path(self.__pathInfo.getDepositPath(self.__depId)).parent
|
|
252
|
-
# self.__depositAssignPath = os.path.join(self.__depositPath, self.__depId, 'assign')
|
|
253
|
-
# self.__ccReportPath = os.path.join(self.__depositPath, self.__depId, 'cc_analysis') # should we add 'cc_analysis' in a variable in site-config?
|
|
254
251
|
self.__logger = self._setupLog(log)
|
|
255
252
|
|
|
256
253
|
#
|
|
@@ -380,7 +377,8 @@ class ChemCompWebAppLiteWorker(object):
|
|
|
380
377
|
ligandId = self.__reqObj.getValue("ligid")
|
|
381
378
|
filename = self.__reqObj.getValue("file")
|
|
382
379
|
|
|
383
|
-
|
|
380
|
+
depositPath = Path(self.__pathInfo.getDepositPath(depId))
|
|
381
|
+
ccReportPath = os.path.join(depositPath, "cc_analysis")
|
|
384
382
|
fileType = filename.split(".")[-1]
|
|
385
383
|
filePath = None
|
|
386
384
|
|
{wwpdb.apps.ccmodule-0.26 → wwpdb.apps.ccmodule-0.27}/wwpdb.apps.ccmodule.egg-info/SOURCES.txt
RENAMED
|
@@ -18,9 +18,6 @@ wwpdb/apps/ccmodule/chem/PdbxChemCompAssign.py
|
|
|
18
18
|
wwpdb/apps/ccmodule/chem/__init__.py
|
|
19
19
|
wwpdb/apps/ccmodule/depict/ChemCompDepict.py
|
|
20
20
|
wwpdb/apps/ccmodule/depict/__init__.py
|
|
21
|
-
wwpdb/apps/ccmodule/edit/ChemCompTableEditor.py
|
|
22
|
-
wwpdb/apps/ccmodule/edit/ChemCompTableEditorDepict.py
|
|
23
|
-
wwpdb/apps/ccmodule/edit/__init__.py
|
|
24
21
|
wwpdb/apps/ccmodule/extract/__init__.py
|
|
25
22
|
wwpdb/apps/ccmodule/extract/ccOps.py
|
|
26
23
|
wwpdb/apps/ccmodule/io/ChemCompAssignDataStore.py
|
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# File: ChemCompTableEditor.py
|
|
3
|
-
# Date: 21-Aug-2010
|
|
4
|
-
#
|
|
5
|
-
# Updates:
|
|
6
|
-
# 1-Sep-2010 jdw New incremental storage of edits using ChemCompEditStore()
|
|
7
|
-
# 2012-10-24 RPS Updated to reflect reorganization of modules in pdbx packages#
|
|
8
|
-
##
|
|
9
|
-
"""
|
|
10
|
-
Chemical component text edit functions.
|
|
11
|
-
|
|
12
|
-
"""
|
|
13
|
-
__docformat__ = "restructuredtext en"
|
|
14
|
-
__author__ = "John Westbrook"
|
|
15
|
-
__email__ = "jwest@rcsb.rutgers.edu"
|
|
16
|
-
__license__ = "Creative Commons Attribution 3.0 Unported"
|
|
17
|
-
__version__ = "V0.01"
|
|
18
|
-
|
|
19
|
-
import os
|
|
20
|
-
import sys
|
|
21
|
-
import shutil
|
|
22
|
-
import traceback
|
|
23
|
-
from wwpdb.apps.ccmodule.utils.ChemCompConfig import ChemCompConfig
|
|
24
|
-
from mmcif_utils.chemcomp.PdbxChemCompUtils import PdbxChemCompReader, PdbxChemCompUpdater
|
|
25
|
-
#
|
|
26
|
-
from wwpdb.apps.ccmodule.io.ChemCompEditStore import ChemCompEditStore, ChemCompEdit
|
|
27
|
-
#
|
|
28
|
-
# temporary -
|
|
29
|
-
# from wwpdb.apps.ccmodule.io.ccIo import ccIo
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class ChemCompTableEditor(object):
|
|
33
|
-
"""Chemical component table/text edit functions.
|
|
34
|
-
|
|
35
|
-
"""
|
|
36
|
-
def __init__(self, reqObj, verbose=False, log=sys.stderr):
|
|
37
|
-
"""Chemical component text edit functions -
|
|
38
|
-
|
|
39
|
-
:param `verbose`: boolean flag to activate verbose logging.
|
|
40
|
-
:param `log`: stream for logging.
|
|
41
|
-
|
|
42
|
-
"""
|
|
43
|
-
self.__verbose = verbose
|
|
44
|
-
self.__lfh = log
|
|
45
|
-
# self.__debug = True
|
|
46
|
-
#
|
|
47
|
-
self.__reqObj = reqObj
|
|
48
|
-
#
|
|
49
|
-
self.__sObj = self.__reqObj.newSessionObj()
|
|
50
|
-
self.__sessionPath = self.__sObj.getPath()
|
|
51
|
-
self.__sessionRelativePath = self.__sObj.getRelativePath()
|
|
52
|
-
self.__sessionId = self.__sObj.getId()
|
|
53
|
-
#
|
|
54
|
-
self.__ccConfig = ChemCompConfig(self.__reqObj, verbose=self.__verbose, log=self.__lfh)
|
|
55
|
-
#
|
|
56
|
-
self.__ccId = None
|
|
57
|
-
self.__ccFilePath = None
|
|
58
|
-
self.__ccFileFormat = 'cif'
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
def setCcId(self, ccId):
|
|
63
|
-
"""Set an existing chemical component identifier in archive collection as
|
|
64
|
-
the edit target
|
|
65
|
-
"""
|
|
66
|
-
self.__ccId = str(ccId.upper())
|
|
67
|
-
return self.__getFilePathFromId(self.__ccId)
|
|
68
|
-
|
|
69
|
-
def setFilePath(self, ccFilePath, ccFileFormat='cif', ccId=None):
|
|
70
|
-
self.__ccFilePath = ccFilePath
|
|
71
|
-
self.__ccFileFormat = ccFileFormat
|
|
72
|
-
if not os.access(self.__ccFilePath, os.R_OK):
|
|
73
|
-
return False
|
|
74
|
-
if ccId is not None:
|
|
75
|
-
self.__ccId = str(ccId).upper()
|
|
76
|
-
#
|
|
77
|
-
return True
|
|
78
|
-
|
|
79
|
-
def getFilePath(self):
|
|
80
|
-
return self.__ccFilePath
|
|
81
|
-
|
|
82
|
-
def __getFilePathFromId(self, ccId):
|
|
83
|
-
"""
|
|
84
|
-
"""
|
|
85
|
-
idUc = str(ccId).upper()
|
|
86
|
-
fileName = idUc + ".cif"
|
|
87
|
-
self.__ccFilePath = os.path.join(self.__ccConfig.getPath('chemCompCachePath'), idUc[0:1], idUc[0:3], fileName)
|
|
88
|
-
#
|
|
89
|
-
if not os.access(self.__ccFilePath, os.R_OK):
|
|
90
|
-
return False
|
|
91
|
-
self.__ccFileFormat = 'cif'
|
|
92
|
-
return True
|
|
93
|
-
|
|
94
|
-
def doUndo(self):
|
|
95
|
-
""" Process an undo edit request.
|
|
96
|
-
"""
|
|
97
|
-
rD = {}
|
|
98
|
-
#
|
|
99
|
-
# id = self.__reqObj.getValue('id')
|
|
100
|
-
blockId = self.__reqObj.getValue('blockId')
|
|
101
|
-
#
|
|
102
|
-
# edit number controlled from edit store -
|
|
103
|
-
editToUndo = self.__reqObj.getValue('editOpNumber')
|
|
104
|
-
#
|
|
105
|
-
if self.__verbose:
|
|
106
|
-
self.__lfh.write("+ChemCompEdit.doUndo() - Starting doUndo() \n")
|
|
107
|
-
self.__lfh.write("+ChemCompEdit.doUndo() - session id %s\n" % self.__sessionId)
|
|
108
|
-
self.__lfh.write("+ChemCompEdit.doUndo() - block id %s\n" % blockId)
|
|
109
|
-
self.__lfh.write("+ChemCompEdit.doUndo() - edit to undo %r\n" % editToUndo)
|
|
110
|
-
self.__lfh.flush()
|
|
111
|
-
|
|
112
|
-
#
|
|
113
|
-
es = ChemCompEditStore(self.__reqObj, verbose=self.__verbose, log=self.__lfh)
|
|
114
|
-
editOpLast = es.getLastOpNumber()
|
|
115
|
-
#
|
|
116
|
-
if self.__verbose:
|
|
117
|
-
self.__lfh.write("+ChemCompEdit.doUndo() - last stored edit operation %d\n" % editOpLast)
|
|
118
|
-
#
|
|
119
|
-
edNo = int(editToUndo)
|
|
120
|
-
edList = es.get(edNo)
|
|
121
|
-
undoList = []
|
|
122
|
-
for ed in edList:
|
|
123
|
-
if (ed.getEditType() == "replace-value"):
|
|
124
|
-
targetId = "#" + ed.getTargetId()
|
|
125
|
-
priorValue = ed.getValuePrevious()
|
|
126
|
-
undoList.append({'id' : targetId, 'value' : priorValue})
|
|
127
|
-
else:
|
|
128
|
-
ed.printIt(self.__lfh)
|
|
129
|
-
|
|
130
|
-
es.remove(edNo)
|
|
131
|
-
#
|
|
132
|
-
ok = True
|
|
133
|
-
if not ok:
|
|
134
|
-
rD['errortext'] = 'edit failed during update'
|
|
135
|
-
rD['errorflag'] = True
|
|
136
|
-
rD['value'] = None
|
|
137
|
-
rD['editOpNumber'] = edNo - 1
|
|
138
|
-
else:
|
|
139
|
-
rD['editOpNumber'] = edNo - 1
|
|
140
|
-
rD['id'] = None
|
|
141
|
-
rD['value'] = None
|
|
142
|
-
rD['valuelist'] = undoList
|
|
143
|
-
|
|
144
|
-
#
|
|
145
|
-
return rD
|
|
146
|
-
|
|
147
|
-
def doItemValueUpdate(self):
|
|
148
|
-
""" Process an item value edit.update request.
|
|
149
|
-
"""
|
|
150
|
-
rD = {}
|
|
151
|
-
#
|
|
152
|
-
id = self.__reqObj.getValue('id') # pylint: disable=redefined-builtin
|
|
153
|
-
blockId = self.__reqObj.getValue('blockId')
|
|
154
|
-
value = self.__reqObj.getValue('value')
|
|
155
|
-
priorValue = self.__reqObj.getValue('priorValue')
|
|
156
|
-
localPath = self.__reqObj.getValue('localPath')
|
|
157
|
-
targetRowId = self.__reqObj.getValue('targetRowId')
|
|
158
|
-
#
|
|
159
|
-
# edit number controlled from edit store -
|
|
160
|
-
editNumberReported = self.__reqObj.getValue('editOpNumber')
|
|
161
|
-
#
|
|
162
|
-
if self.__verbose:
|
|
163
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - Starting doItemValueUpdate() \n")
|
|
164
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - session id %s\n" % self.__sessionId)
|
|
165
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - local path %s\n" % localPath)
|
|
166
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - id %s\n" % id)
|
|
167
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - block id %s\n" % blockId)
|
|
168
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - value %s\n" % value)
|
|
169
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - prior value %s\n" % priorValue)
|
|
170
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - target row id %s\n" % targetRowId)
|
|
171
|
-
self.__lfh.write("+ChemCompEdit.doItemValueUpdate() - editNumber %r\n" % editNumberReported)
|
|
172
|
-
self.__lfh.flush()
|
|
173
|
-
|
|
174
|
-
(catName, attributeName, _sRow, _insertCode, _opNum) = id.split(':')
|
|
175
|
-
# iRow = int(sRow)
|
|
176
|
-
itemName = '_' + catName + '.' + attributeName
|
|
177
|
-
#
|
|
178
|
-
#
|
|
179
|
-
es = ChemCompEditStore(self.__reqObj, verbose=self.__verbose, log=self.__lfh)
|
|
180
|
-
#
|
|
181
|
-
editOpLast = es.getLastOpNumber()
|
|
182
|
-
editOpNext = int(editOpLast) + 1
|
|
183
|
-
|
|
184
|
-
ccEd = ChemCompEdit(self.__verbose, self.__lfh)
|
|
185
|
-
#
|
|
186
|
-
ccEd.setTargetId(id)
|
|
187
|
-
ccEd.setBlockId(blockId)
|
|
188
|
-
ccEd.setTargetRowId(targetRowId)
|
|
189
|
-
ccEd.setEditType("replace-value")
|
|
190
|
-
ccEd.setEditOpNumber(editOpNext)
|
|
191
|
-
#
|
|
192
|
-
ccEd.setTargetItemName(itemName)
|
|
193
|
-
ccEd.setValueNew(value)
|
|
194
|
-
ccEd.setValuePrevious(priorValue)
|
|
195
|
-
|
|
196
|
-
ok = es.storeEdit(ccEd)
|
|
197
|
-
if not ok:
|
|
198
|
-
rD['errortext'] = 'edit failed during update'
|
|
199
|
-
rD['errorflag'] = True
|
|
200
|
-
rD['value'] = priorValue
|
|
201
|
-
rD['editOpNumber'] = editNumberReported
|
|
202
|
-
else:
|
|
203
|
-
rD['editOpNumber'] = editOpNext
|
|
204
|
-
rD['value'] = value
|
|
205
|
-
rD['valuelist'] = [{'id': id, 'value': value}, {'id': id, 'value': value}]
|
|
206
|
-
|
|
207
|
-
#
|
|
208
|
-
return rD
|
|
209
|
-
|
|
210
|
-
# def __getRowDefault(self, catName):
|
|
211
|
-
# """ Provide a
|
|
212
|
-
# """
|
|
213
|
-
# # rD = {}
|
|
214
|
-
# pass
|
|
215
|
-
|
|
216
|
-
def doRowUpdate(self):
|
|
217
|
-
""" Process a row edit update request -
|
|
218
|
-
"""
|
|
219
|
-
rD = {}
|
|
220
|
-
id = self.__reqObj.getValue('id') # pylint: disable=redefined-builtin
|
|
221
|
-
value = self.__reqObj.getValue('value')
|
|
222
|
-
blockId = self.__reqObj.getValue('blockId')
|
|
223
|
-
priorValue = self.__reqObj.getValue('priorValue')
|
|
224
|
-
localPath = self.__reqObj.getValue('localPath')
|
|
225
|
-
targetRowId = self.__reqObj.getValue('targetRowId')
|
|
226
|
-
editNumberReported = self.__reqObj.getValue('editOpNumber')
|
|
227
|
-
#
|
|
228
|
-
if self.__verbose:
|
|
229
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - Starting doUpdate() \n")
|
|
230
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - session id %s\n" % self.__sessionId)
|
|
231
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - local path %s\n" % localPath)
|
|
232
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - id %s\n" % id)
|
|
233
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - block id %s\n" % blockId)
|
|
234
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - value %s\n" % value)
|
|
235
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - prior value %s\n" % priorValue)
|
|
236
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - target row id %s\n" % targetRowId)
|
|
237
|
-
self.__lfh.write("+ChemCompEdit.doRowUpdate() - editNumber %r\n" % editNumberReported)
|
|
238
|
-
self.__lfh.flush()
|
|
239
|
-
|
|
240
|
-
try:
|
|
241
|
-
rD['editOpNumber'] = int(editOpNumber) + 1 # noqa: F821 XXXX This might be editOpeNumberReported - what are implications? pylint: disable=undefined-variable
|
|
242
|
-
except: # noqa: E722 pylint: disable=bare-except
|
|
243
|
-
rD['editOpNumber'] = 1
|
|
244
|
-
|
|
245
|
-
rD['value'] = '+/-'
|
|
246
|
-
rD['op'] = value
|
|
247
|
-
|
|
248
|
-
(catName, opName, sRow, insertCode, sOpNum) = id.split(':')
|
|
249
|
-
iRow = int(sRow)
|
|
250
|
-
opNum = int(sOpNum)
|
|
251
|
-
|
|
252
|
-
rD['id'] = '#%s:%s:%d:%s:%d' % (catName, opName, iRow, insertCode, opNum)
|
|
253
|
-
|
|
254
|
-
if True: # pylint: disable=using-constant-test
|
|
255
|
-
return rD
|
|
256
|
-
|
|
257
|
-
ccU = PdbxChemCompUpdater(verbose=self.__verbose, log=self.__lfh)
|
|
258
|
-
ok = ccU.readComp(localPath, compId=None)
|
|
259
|
-
if not ok:
|
|
260
|
-
rD['errortext'] = 'update file not found'
|
|
261
|
-
rD['errorflag'] = True
|
|
262
|
-
|
|
263
|
-
ok = ccU.updateItem(itemName, value, iRow) # noqa: F821 XXXX This code clearly not used as cannot work pylint: disable=undefined-variable
|
|
264
|
-
if not ok:
|
|
265
|
-
rD['errortext'] = 'item update failed'
|
|
266
|
-
rD['errorflag'] = True
|
|
267
|
-
|
|
268
|
-
ok = ccU.write()
|
|
269
|
-
if not ok:
|
|
270
|
-
rD['errortext'] = 'write failed during update'
|
|
271
|
-
rD['errorflag'] = True
|
|
272
|
-
|
|
273
|
-
#
|
|
274
|
-
return rD
|
|
275
|
-
|
|
276
|
-
def doEdit(self):
|
|
277
|
-
""" Return content to launch the chemical component editor -
|
|
278
|
-
"""
|
|
279
|
-
#
|
|
280
|
-
oD = {}
|
|
281
|
-
oD['dataDict'] = {}
|
|
282
|
-
filePath = self.__ccFilePath
|
|
283
|
-
fileFormat = self.__ccFileFormat
|
|
284
|
-
blockId = self.__ccId
|
|
285
|
-
#
|
|
286
|
-
editOpNumber = 0
|
|
287
|
-
if self.__verbose:
|
|
288
|
-
self.__lfh.write("+ChemCompEdit.doEdit() - Starting doEdit() \n")
|
|
289
|
-
self.__lfh.write("+ChemCompEdit.doEdit() - file path %s\n" % filePath)
|
|
290
|
-
self.__lfh.write("+ChemCompEdit.doEdit() - file format %s\n" % fileFormat)
|
|
291
|
-
self.__lfh.write("+ChemCompEdit.doEdit() - block Id %s\n" % blockId)
|
|
292
|
-
self.__lfh.flush()
|
|
293
|
-
#
|
|
294
|
-
#
|
|
295
|
-
# make a local copy of the file (if required)
|
|
296
|
-
#
|
|
297
|
-
(_pth, fileName) = os.path.split(filePath)
|
|
298
|
-
dirPath = os.path.join(self.__sessionPath, 'edit')
|
|
299
|
-
localPath = os.path.join(dirPath, fileName)
|
|
300
|
-
localRelativePath = os.path.join(self.__sessionRelativePath, 'edit', fileName)
|
|
301
|
-
if filePath != localPath:
|
|
302
|
-
if not os.access(dirPath, os.F_OK):
|
|
303
|
-
os.makedirs(dirPath)
|
|
304
|
-
shutil.copyfile(filePath, localPath)
|
|
305
|
-
#
|
|
306
|
-
if self.__verbose:
|
|
307
|
-
self.__lfh.write("+ChemCompEdit.doEdit() - Copied input file %s to edit session path %s \n"
|
|
308
|
-
% (filePath, localPath))
|
|
309
|
-
self.__lfh.flush()
|
|
310
|
-
#
|
|
311
|
-
# Path context --
|
|
312
|
-
|
|
313
|
-
oD['filePath'] = filePath
|
|
314
|
-
oD['localPath'] = localPath
|
|
315
|
-
oD['localRelativePath'] = localRelativePath
|
|
316
|
-
oD['sessionId'] = self.__sessionId
|
|
317
|
-
oD['editOpNumber'] = editOpNumber
|
|
318
|
-
#
|
|
319
|
-
try:
|
|
320
|
-
ccf = PdbxChemCompReader(verbose=self.__verbose, log=self.__lfh)
|
|
321
|
-
ccf.setFilePath(localPath, compId=blockId)
|
|
322
|
-
ccf.getComp()
|
|
323
|
-
oD['blockId'] = ccf.getBlockId()
|
|
324
|
-
for catName in ['chem_comp', 'chem_comp_atom', 'chem_comp_bond']:
|
|
325
|
-
oD['dataDict'][catName] = ccf.getChemCompCategory(catName=catName)
|
|
326
|
-
except: # noqa: E722 pylint: disable=bare-except
|
|
327
|
-
if (self.__verbose):
|
|
328
|
-
self.__lfh.write("+ChemCompEdit.doEdit() - edit preparation failed for: %s\n" % fileName)
|
|
329
|
-
traceback.print_exc(file=self.__lfh)
|
|
330
|
-
self.__lfh.flush()
|
|
331
|
-
return oD
|
|
332
|
-
|
|
333
|
-
return oD
|
|
334
|
-
|
|
335
|
-
def doLiveUpdate(self):
|
|
336
|
-
""" Process an edit update request.
|
|
337
|
-
"""
|
|
338
|
-
rD = {}
|
|
339
|
-
id = self.__reqObj.getValue('id') # pylint: disable=redefined-builtin
|
|
340
|
-
value = self.__reqObj.getValue('value')
|
|
341
|
-
priorValue = self.__reqObj.getValue('priorValue')
|
|
342
|
-
localPath = self.__reqObj.getValue('localPath')
|
|
343
|
-
editOpNumber = self.__reqObj.getValue('editOpNumber')
|
|
344
|
-
if self.__verbose:
|
|
345
|
-
self.__lfh.write("+ChemCompEdit.doUpdate() - Starting doUpdate() \n")
|
|
346
|
-
self.__lfh.write("+ChemCompEdit.doUpdate() - local path %s\n" % localPath)
|
|
347
|
-
self.__lfh.write("+ChemCompEdit.doUpdate() - id %s\n" % id)
|
|
348
|
-
self.__lfh.write("+ChemCompEdit.doUpdate() - value %s\n" % value)
|
|
349
|
-
self.__lfh.write("+ChemCompEdit.doUpdate() - prior value %s\n" % priorValue)
|
|
350
|
-
self.__lfh.write("+ChemCompEdit.doUpdate() - editOpNumber %r\n" % editOpNumber)
|
|
351
|
-
self.__lfh.flush()
|
|
352
|
-
try:
|
|
353
|
-
rD['editOpNumber'] = int(editOpNumber) + 1
|
|
354
|
-
except: # noqa: E722 pylint: disable=bare-except
|
|
355
|
-
rD['editOpNumber'] = 1
|
|
356
|
-
|
|
357
|
-
rD['value'] = value
|
|
358
|
-
rD['valuelist'] = [{'id': id, 'value': value}, {'id': id, 'value': value}]
|
|
359
|
-
(catName, attributeName, sRow, _insertCode, _opNum) = id.split(':')
|
|
360
|
-
iRow = int(sRow)
|
|
361
|
-
itemName = '_' + catName + '.' + attributeName
|
|
362
|
-
|
|
363
|
-
ccU = PdbxChemCompUpdater(verbose=self.__verbose, log=self.__lfh)
|
|
364
|
-
ok = ccU.readComp(localPath, compId=None)
|
|
365
|
-
if not ok:
|
|
366
|
-
rD['errortext'] = 'update file not found'
|
|
367
|
-
rD['errorflag'] = True
|
|
368
|
-
|
|
369
|
-
ok = ccU.updateItem(itemName, value, iRow)
|
|
370
|
-
if not ok:
|
|
371
|
-
rD['errortext'] = 'item update failed'
|
|
372
|
-
rD['errorflag'] = True
|
|
373
|
-
|
|
374
|
-
ok = ccU.write()
|
|
375
|
-
if not ok:
|
|
376
|
-
rD['errortext'] = 'write failed during update'
|
|
377
|
-
rD['errorflag'] = True
|
|
378
|
-
|
|
379
|
-
#
|
|
380
|
-
return rD
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
if __name__ == '__main__':
|
|
384
|
-
pass
|