From 13afe11edfc814cdac2c07aaa786cc4cdfb9f86d Mon Sep 17 00:00:00 2001 From: Dennis Piehl Date: Thu, 25 Jul 2024 03:10:43 -0400 Subject: [PATCH] Fix pylinting; fix assignment logic of Pharos data for rcsb_chem_comp_related.related_mapping_method in DictMethodChemRefHelper --- pylintrc | 4 ++-- rcsb/utils/dictionary/DictMethodAssemblyHelper.py | 3 ++- rcsb/utils/dictionary/DictMethodChemRefHelper.py | 7 ++++++- rcsb/utils/dictionary/DictMethodCompModelHelper.py | 2 ++ rcsb/utils/dictionary/DictMethodResourceProvider.py | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pylintrc b/pylintrc index 3c44ebb..9704ada 100644 --- a/pylintrc +++ b/pylintrc @@ -573,5 +573,5 @@ min-public-methods=2 # Exceptions that will emit a warning when being caught. Defaults to # "BaseException, Exception". -overgeneral-exceptions=BaseException, - Exception +# overgeneral-exceptions=builtins.BaseException, +# builtins.Exception diff --git a/rcsb/utils/dictionary/DictMethodAssemblyHelper.py b/rcsb/utils/dictionary/DictMethodAssemblyHelper.py index 2565d64..008eb18 100644 --- a/rcsb/utils/dictionary/DictMethodAssemblyHelper.py +++ b/rcsb/utils/dictionary/DictMethodAssemblyHelper.py @@ -608,7 +608,8 @@ def __getAssemblyComposition(self, dataContainer): epTypeD = self.__commonU.getEntityPolymerTypes(dataContainer) eTypeD = self.__commonU.getEntityTypes(dataContainer) epTypeFilteredD = self.__commonU.getPolymerEntityFilteredTypes(dataContainer) - + # + methodL = [] if dataContainer.exists("exptl"): xObj = dataContainer.getObj("exptl") methodL = xObj.getAttributeValueList("method") diff --git a/rcsb/utils/dictionary/DictMethodChemRefHelper.py b/rcsb/utils/dictionary/DictMethodChemRefHelper.py index 230f25e..b0a22b8 100644 --- a/rcsb/utils/dictionary/DictMethodChemRefHelper.py +++ b/rcsb/utils/dictionary/DictMethodChemRefHelper.py @@ -9,6 +9,7 @@ # 5-Apr-2023 dwp Stop loading rcsb_chem_comp_synonyms for rcsb_chem_comp_synonyms.type 'Brand Name' (to be loaded to new separate data item later) # 18-Sep-2023 dwp Load COD references separately from CCDC/CSD references # 3-May-2024 dwp Change BIRD citation method to copy categories instead of just renaming, and only apply to BIRD entries +# 25-Jul-2024 dwp Fix assignment logic of Pharos data for rcsb_chem_comp_related.related_mapping_method in addChemCompRelated() ## """ Helper class implements external method references supporting chemical @@ -200,12 +201,16 @@ def addChemCompRelated(self, dataContainer, catName, **kwargs): # for rName, rIdS in xD.items(): - if rName in ["PubChem", "Pharos"]: + aMethod = None + if rName in ["PubChem"]: aMethod = "matching InChIKey in PubChem" elif rName in ["CAS", "ChEMBL", "ChEBI"]: aMethod = "assigned by PubChem resource" elif rName in ["Pharos"]: aMethod = "matching ChEMBL ID in Pharos" + if not aMethod: + logger.error("No matching condition for rName %r", rName) + continue for rId in rIdS: iRow = wObj.getRowCount() wObj.setValue(ccId, "comp_id", iRow) diff --git a/rcsb/utils/dictionary/DictMethodCompModelHelper.py b/rcsb/utils/dictionary/DictMethodCompModelHelper.py index 6b0d9b6..fd8127b 100644 --- a/rcsb/utils/dictionary/DictMethodCompModelHelper.py +++ b/rcsb/utils/dictionary/DictMethodCompModelHelper.py @@ -312,6 +312,8 @@ def consolidateGlobalQAScores(self, dataContainer, catName, **kwargs): if dataContainer.exists("ma_qa_metric_global"): bObj = dataContainer.getObj("ma_qa_metric_global") + else: + return False maQaMetricTypeD = self.__commonU.getMaQaMetricType(dataContainer) maQaMetricGlobalTypeD = maQaMetricTypeD["maQaMetricGlobalTypeD"] diff --git a/rcsb/utils/dictionary/DictMethodResourceProvider.py b/rcsb/utils/dictionary/DictMethodResourceProvider.py index 2ae85e0..ff63819 100644 --- a/rcsb/utils/dictionary/DictMethodResourceProvider.py +++ b/rcsb/utils/dictionary/DictMethodResourceProvider.py @@ -720,6 +720,7 @@ def syncCache(self, providerName, cfgOb, configName, cachePath, remotePrefix=Non logger.debug("%r classArgs %r", providerName, classArgs) # useCache = True + ok = okB = True try: if sourceCache == "stash": prI = self.__providerD[providerName]["class"](cachePath=cachePath, useCache=useCache, **classArgs)