Skip to content

Commit

Permalink
Chore: V0.44 Adjust error handling/reporting for atom counts in DictM…
Browse files Browse the repository at this point in the history
…ethodEntityInstanceHelper(), update GlycanProvider() api in DictMethodResourceProvider()
  • Loading branch information
jdwestbrook committed Jun 30, 2021
1 parent 2449818 commit a9c0747
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 45 deletions.
5 changes: 3 additions & 2 deletions HISTORY.txt
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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.
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()
6 changes: 4 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
#
3 changes: 2 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rcsb/utils/dictionary/DictMethodEntityInstanceHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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(
Expand Down
16 changes: 2 additions & 14 deletions rcsb/utils/dictionary/DictMethodResourceProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
#
Expand Down
2 changes: 1 addition & 1 deletion rcsb/utils/dictionary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
__author__ = "John Westbrook"
__email__ = "[email protected]"
__license__ = "Apache 2.0"
__version__ = "0.43"
__version__ = "0.44"
2 changes: 1 addition & 1 deletion rcsb/utils/tests-dictionary/testDictMethodRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rcsb/utils/tests-dictionary/testDictionaryApiProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 10 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@
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")

setup(
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="[email protected]",
url="https://github.com/rcsb/py-rcsb_utils_dictionary",
Expand All @@ -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:
Expand Down

0 comments on commit a9c0747

Please sign in to comment.