diff --git a/HISTORY.txt b/HISTORY.txt index 1bfe7a5..3b84d74 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -1,7 +1,7 @@ # File: HISTORY.txt # 14-Feb-2021 - V0.11 Created module with content migrated from rcsb.db -15-Feb-2021 - V0.12 Extend namedtuple "NonpolymerValidationInstance" +15-Feb-2021 - V0.12 Extend named tuple "NonpolymerValidationInstance" 18-Feb-2021 - V0.13 Added TargetInteractionProvider() related tests, getNonpolymerInstanceNeighbors() in DictMethodCommonUtils() 18-Feb-2021 - V0.14 Add further accessors to TargetInteractionProvider() 21-Feb-2021 - V0.15 Update handling of completeness/disorder in calculating validation scores, add TargetInteractionWorkflow() @@ -32,4 +32,5 @@ 2-Jun-2021 - V0.40 Add support to filter redundant records in category subsets 5-Jun-2021 - V0.41 Prune test cases 10-Jun-2021 - V0.42 Adding calculation of average occupancy __getAtomSiteInfo() in DictMethodCommonUtils() -10-Jun-2021 - V0.43 Add provenance to the aggregated "is_subject_of_investigation" ligand validation flag. \ No newline at end of file +10-Jun-2021 - V0.43 Add provenance to the aggregated "is_subject_of_investigation" ligand validation flag. +30-Jun-2021 - V0.44 Adjust error handling/reporting for atom counts in DictMethodEntityInstanceHelper(), update GlycanProvider() api in DictMethodResourceProvider() \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index d36a05f..dbdbdeb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,7 @@ # -# File: py-rcsb_utils_chemref/MANIFEST.in +# File: py-rcsb_utils_dictionary/MANIFEST.in # include HISTORY.txt -# +include requirements.txt +include README.md +# \ No newline at end of file diff --git a/pylintrc b/pylintrc index 6058ff4..2d5368a 100644 --- a/pylintrc +++ b/pylintrc @@ -142,7 +142,8 @@ disable=missing-docstring, xreadlines-attribute, deprecated-sys-function, exception-escape, - comprehension-escape + comprehension-escape, + W0238 # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/rcsb/utils/dictionary/DictMethodEntityInstanceHelper.py b/rcsb/utils/dictionary/DictMethodEntityInstanceHelper.py index 05ca349..d287964 100644 --- a/rcsb/utils/dictionary/DictMethodEntityInstanceHelper.py +++ b/rcsb/utils/dictionary/DictMethodEntityInstanceHelper.py @@ -1743,7 +1743,7 @@ def buildInstanceValidationScores(self, dataContainer, catName, **kwargs): else: numReportedAtoms = ligandAtomCountD[asymId]["FL"] except Exception as e: - logger.exception("Failing for entry %s asymId %s altId %r with %s", entryId, asymId, altId, str(e)) + logger.warning("Missing ligand atom count for entry %s asymId %s altId %r with %s", entryId, asymId, altId, str(e)) try: if altId: @@ -1759,7 +1759,7 @@ def buildInstanceValidationScores(self, dataContainer, catName, **kwargs): else: occupancySum = occupancySumD[asymId]["FL"] except Exception as e: - logger.warning("Failing occupancy for entry %s asymId %s altId %r with %s", entryId, asymId, altId, str(e)) + logger.warning("Missing occupancy for entry %s asymId %s altId %r with %s", entryId, asymId, altId, str(e)) # avgHeavyOccupancy = round(occupancySum / float(numHeavyAtoms), 4) completeness = self.__calculateModeledCompleteness( diff --git a/rcsb/utils/dictionary/DictMethodResourceProvider.py b/rcsb/utils/dictionary/DictMethodResourceProvider.py index 812c77b..f8216fa 100644 --- a/rcsb/utils/dictionary/DictMethodResourceProvider.py +++ b/rcsb/utils/dictionary/DictMethodResourceProvider.py @@ -429,27 +429,15 @@ def __fetchNeighborInteractionProvider(self, cfgOb, configName, cachePath, useCa def __fetchGlycanProvider(self, cfgOb, configName, cachePath, useCache=True, **kwargs): logger.debug("configName %s cachePath %s kwargs %r", configName, cachePath, kwargs) if not self.__glyP: - # try: - minCount = 0 - userName = cfgOb.get("_STASH_AUTH_USERNAME", sectionName=configName) - password = cfgOb.get("_STASH_AUTH_PASSWORD", sectionName=configName) - basePath = cfgOb.get("_STASH_SERVER_BASE_PATH", sectionName=configName) - url = cfgOb.get("STASH_SERVER_URL", sectionName=configName) - urlFallBack = cfgOb.get("STASH_SERVER_FALLBACK_URL", sectionName=configName) - # gP = GlycanProvider(cachePath=cachePath, useCache=useCache) - ok = gP.fromStash(url, basePath, userName=userName, password=password) + gP.restore(cfgOb, configName) ok = gP.reload() ok = gP.testCache(minCount=10) - if not ok: - ok = gP.fromStash(urlFallBack, basePath, userName=userName, password=password) - ok = gP.testCache(minCount=minCount) - # if gP: self.__glyP = gP riD = gP.getIdentifiers() - logger.info("Fetched glycan mapping dictionary (%d)", len(riD)) + logger.info("Fetched glycan mapping dictionary (%r) (%d)", ok, len(riD)) except Exception as e: logger.exception("Failing with %s", str(e)) # diff --git a/rcsb/utils/dictionary/__init__.py b/rcsb/utils/dictionary/__init__.py index d86ab19..847a04f 100644 --- a/rcsb/utils/dictionary/__init__.py +++ b/rcsb/utils/dictionary/__init__.py @@ -2,4 +2,4 @@ __author__ = "John Westbrook" __email__ = "john.westbrook@rcsb.org" __license__ = "Apache 2.0" -__version__ = "0.43" +__version__ = "0.44" diff --git a/rcsb/utils/tests-dictionary/testDictMethodRunner.py b/rcsb/utils/tests-dictionary/testDictMethodRunner.py index 149ffa9..807dc9e 100644 --- a/rcsb/utils/tests-dictionary/testDictMethodRunner.py +++ b/rcsb/utils/tests-dictionary/testDictMethodRunner.py @@ -44,7 +44,7 @@ def setUp(self): self.__numProc = 2 self.__fileLimit = 200 mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data") - self.__cachePath = os.path.join(TOPDIR, "CACHE") + self.__cachePath = os.path.join(HERE, "test-output", "CACHE") configPath = os.path.join(mockTopPath, "config", "dbload-setup-example.yml") configName = "site_info_configuration" self.__configName = configName diff --git a/rcsb/utils/tests-dictionary/testDictionaryApiProvider.py b/rcsb/utils/tests-dictionary/testDictionaryApiProvider.py index c66dd2a..d515c38 100644 --- a/rcsb/utils/tests-dictionary/testDictionaryApiProvider.py +++ b/rcsb/utils/tests-dictionary/testDictionaryApiProvider.py @@ -36,7 +36,7 @@ class DictionaryProviderTests(unittest.TestCase): def setUp(self): mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data") - self.__cachePath = os.path.join(TOPDIR, "CACHE") + self.__cachePath = os.path.join(HERE, "test-output", "CACHE") self.__dirPath = os.path.join(self.__cachePath, "dictionaries") configPath = os.path.join(mockTopPath, "config", "dbload-setup-example.yml") configName = "site_info_configuration" diff --git a/rcsb/utils/tests-dictionary/testDictionaryApiProviderWrapper.py b/rcsb/utils/tests-dictionary/testDictionaryApiProviderWrapper.py index f3265e4..b32ea7c 100644 --- a/rcsb/utils/tests-dictionary/testDictionaryApiProviderWrapper.py +++ b/rcsb/utils/tests-dictionary/testDictionaryApiProviderWrapper.py @@ -36,8 +36,8 @@ class DictionaryProviderTests(unittest.TestCase): def setUp(self): mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data") - self.__cachePath = os.path.join(TOPDIR, "CACHE") - configPath = os.path.join(mockTopPath, "config", "dbload-setup-example.yml") + self.__cachePath = os.path.join(HERE, "test-output", "CACHE") + configPath = os.path.join(mockTopPath, "config", "dbload-setup-example.yml") configName = "site_info_configuration" self.__configName = configName self.__cfgOb = ConfigUtil(configPath=configPath, defaultSectionName=configName, mockTopPath=mockTopPath) diff --git a/rcsb/utils/tests-dictionary/testNeighborInteractionProvider.py b/rcsb/utils/tests-dictionary/testNeighborInteractionProvider.py index 22e6919..f4412ac 100644 --- a/rcsb/utils/tests-dictionary/testNeighborInteractionProvider.py +++ b/rcsb/utils/tests-dictionary/testNeighborInteractionProvider.py @@ -38,7 +38,7 @@ class NeighborInteractionProviderTests(unittest.TestCase): def setUp(self): mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data") - self.__cachePath = os.path.join(TOPDIR, "CACHE") + self.__cachePath = os.path.join(HERE, "test-output", "CACHE") configPath = os.path.join(HERE, "test-data", "stash-config-example.yml") self.__configName = "site_info_configuration" self.__startTime = time.time() diff --git a/rcsb/utils/tests-dictionary/testNeighborInteractionWorkflow.py b/rcsb/utils/tests-dictionary/testNeighborInteractionWorkflow.py index dc2ad38..933f311 100644 --- a/rcsb/utils/tests-dictionary/testNeighborInteractionWorkflow.py +++ b/rcsb/utils/tests-dictionary/testNeighborInteractionWorkflow.py @@ -35,7 +35,7 @@ class NeighborInteractionWorkflowTests(unittest.TestCase): def setUp(self): self.__mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data") - self.__cachePath = os.path.join(TOPDIR, "CACHE") + self.__cachePath = os.path.join(HERE, "test-output", "CACHE") self.__configPath = os.path.join(HERE, "test-data", "stash-config-example.yml") self.__configName = "site_info_configuration" self.__useCache = False diff --git a/setup.py b/setup.py index 1cd94b9..b8a49cd 100755 --- a/setup.py +++ b/setup.py @@ -14,6 +14,13 @@ with open("rcsb/utils/dictionary/__init__.py", "r") as fd: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) +# Load packages from requirements*.txt +with open("requirements.txt", "r") as ifh: + packagesRequired = [ln.strip() for ln in ifh.readlines()] + +with open("README.md", "r") as ifh: + longDescription = ifh.read() + if not version: raise RuntimeError("Cannot find version information") @@ -21,7 +28,8 @@ name=thisPackage, version=version, description="RCSB Python Dictionary Utility Classes", - long_description="See: README.md", + long_description_content_type="text/markdown", + long_description=longDescription, author="John Westbrook", author_email="john.westbrook@rcsb.org", url="https://github.com/rcsb/py-rcsb_utils_dictionary", @@ -39,22 +47,7 @@ ), entry_points={}, # - install_requires=[ - "scipy", - "numpy", - "mmcif >= 0.57", - "rcsb.utils.io >= 1.12", - "rcsb.utils.config >= 0.35", - "rcsb.utils.multiproc >= 0.17", - "rcsb.utils.validation >= 0.22", - "rcsb.utils.chemref >= 0.72", - "rcsb.utils.citation >= 0.15", - "rcsb.utils.ec >= 0.21", - "rcsb.utils.taxonomy >= 0.32", - "rcsb.utils.seq >= 0.60", - "rcsb.utils.struct >= 0.28", - "rcsb.utils.repository >= 0.12", - ], + install_requires=packagesRequired, packages=find_packages(exclude=["rcsb.utils.tests-dictionary", "rcsb.utils.tests-*", "tests.*"]), package_data={ # If any package contains *.md or *.rst ... files, include them: