rcsb.exdb 1.31__py3-none-any.whl → 1.33__py3-none-any.whl
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.
- rcsb/exdb/tree/TreeNodeListWorker.py +72 -49
- {rcsb_exdb-1.31.dist-info → rcsb_exdb-1.33.dist-info}/METADATA +2 -2
- {rcsb_exdb-1.31.dist-info → rcsb_exdb-1.33.dist-info}/RECORD +5 -42
- rcsb/exdb/tests/TEST-EXDB-CLI-EXEC.sh +0 -19
- rcsb/exdb/tests/TEST-EXDB-CLI-REFSEQ-EXEC.sh +0 -12
- rcsb/exdb/tests/__init__.py +0 -0
- rcsb/exdb/tests/fixtureDictMethodResourceProvider.py +0 -104
- rcsb/exdb/tests/fixturePdbxLoader.py +0 -298
- rcsb/exdb/tests/test-data/components-abbrev.cif +0 -2739
- rcsb/exdb/tests/test-data/prdcc-abbrev.cif +0 -9171
- rcsb/exdb/tests/testAnnotationExtractor.py +0 -79
- rcsb/exdb/tests/testBranchedEntityExtractor.py +0 -81
- rcsb/exdb/tests/testChemRefLoader.py +0 -106
- rcsb/exdb/tests/testChemRefMappingProvider.py +0 -95
- rcsb/exdb/tests/testCitationAdapter.py +0 -97
- rcsb/exdb/tests/testCitationExtractor.py +0 -93
- rcsb/exdb/tests/testCitationUtils.py +0 -92
- rcsb/exdb/tests/testEntryInfoEtlWorkflow.py +0 -70
- rcsb/exdb/tests/testEntryInfoProvider.py +0 -97
- rcsb/exdb/tests/testGlycanEtlWorkflow.py +0 -70
- rcsb/exdb/tests/testGlycanProvider.py +0 -98
- rcsb/exdb/tests/testGlycanUtils.py +0 -64
- rcsb/exdb/tests/testLigandNeighborMappingProvider.py +0 -90
- rcsb/exdb/tests/testObjectExtractor.py +0 -342
- rcsb/exdb/tests/testObjectTransformer.py +0 -83
- rcsb/exdb/tests/testObjectUpdater.py +0 -120
- rcsb/exdb/tests/testPolymerEntityExtractor.py +0 -93
- rcsb/exdb/tests/testPubChemDataCacheProvider.py +0 -124
- rcsb/exdb/tests/testPubChemEtlWorkflow.py +0 -134
- rcsb/exdb/tests/testPubChemEtlWrapper.py +0 -155
- rcsb/exdb/tests/testPubChemIndexCacheProvider.py +0 -123
- rcsb/exdb/tests/testReferenceSequenceAnnotationAdapter.py +0 -106
- rcsb/exdb/tests/testReferenceSequenceAssignmentAdapter.py +0 -121
- rcsb/exdb/tests/testReferenceSequenceAssignmentAdapterValidate.py +0 -122
- rcsb/exdb/tests/testReferenceSequenceAssignmentProvider.py +0 -117
- rcsb/exdb/tests/testReferenceSequenceCacheProvider.py +0 -94
- rcsb/exdb/tests/testTaxonomyExtractor.py +0 -75
- rcsb/exdb/tests/testTreeNodeListWorker.py +0 -111
- rcsb/exdb/tests/testUniProtCoreEtlWorker.py +0 -99
- rcsb/exdb/tests/testUniProtExtractor.py +0 -77
- {rcsb_exdb-1.31.dist-info → rcsb_exdb-1.33.dist-info}/WHEEL +0 -0
- {rcsb_exdb-1.31.dist-info → rcsb_exdb-1.33.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# File: EntryInfoEtlWorkflowTests.py
|
|
3
|
-
# Author: J. Westbrook
|
|
4
|
-
# Date: 22-Sep-2021
|
|
5
|
-
#
|
|
6
|
-
# Updates:
|
|
7
|
-
#
|
|
8
|
-
##
|
|
9
|
-
"""
|
|
10
|
-
Tests for entry information extraction ETL workflow methods
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
__docformat__ = "google en"
|
|
14
|
-
__author__ = "John Westbrook"
|
|
15
|
-
__email__ = "jwest@rcsb.rutgers.edu"
|
|
16
|
-
__license__ = "Apache 2.0"
|
|
17
|
-
|
|
18
|
-
import logging
|
|
19
|
-
import os
|
|
20
|
-
import platform
|
|
21
|
-
import resource
|
|
22
|
-
import time
|
|
23
|
-
import unittest
|
|
24
|
-
|
|
25
|
-
from rcsb.exdb.wf.EntryInfoEtlWorkflow import EntryInfoEtlWorkflow
|
|
26
|
-
|
|
27
|
-
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s]-%(module)s.%(funcName)s: %(message)s")
|
|
28
|
-
logger = logging.getLogger()
|
|
29
|
-
|
|
30
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
31
|
-
TOPDIR = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class EntryInfoEtlWorkflowTests(unittest.TestCase):
|
|
35
|
-
def setUp(self):
|
|
36
|
-
#
|
|
37
|
-
self.__cachePath = os.path.join(HERE, "test-output", "CACHE")
|
|
38
|
-
self.__configPath = os.path.join(TOPDIR, "rcsb", "mock-data", "config", "dbload-setup-example.yml")
|
|
39
|
-
self.__configName = "site_info_configuration"
|
|
40
|
-
#
|
|
41
|
-
self.__startTime = time.time()
|
|
42
|
-
logger.debug("Starting %s at %s", self.id(), time.strftime("%Y %m %d %H:%M:%S", time.localtime()))
|
|
43
|
-
|
|
44
|
-
def tearDown(self):
|
|
45
|
-
unitS = "MB" if platform.system() == "Darwin" else "GB"
|
|
46
|
-
rusageMax = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
|
|
47
|
-
logger.info("Maximum resident memory size %.4f %s", rusageMax / 10 ** 6, unitS)
|
|
48
|
-
endTime = time.time()
|
|
49
|
-
logger.info("Completed %s at %s (%.4f seconds)", self.id(), time.strftime("%Y %m %d %H:%M:%S", time.localtime()), endTime - self.__startTime)
|
|
50
|
-
|
|
51
|
-
def testUpdateEntryInfo(self):
|
|
52
|
-
"""Test case - update extracted entry-level annotations."""
|
|
53
|
-
try:
|
|
54
|
-
eiP = EntryInfoEtlWorkflow(configPath=self.__configPath, configName=self.__configName, cachePath=self.__cachePath)
|
|
55
|
-
ok = eiP.update(backup=False)
|
|
56
|
-
self.assertTrue(ok)
|
|
57
|
-
except Exception as e:
|
|
58
|
-
logger.exception("Failing with %s", str(e))
|
|
59
|
-
self.fail()
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def entryInfoEtlWorkflowSuite():
|
|
63
|
-
suiteSelect = unittest.TestSuite()
|
|
64
|
-
suiteSelect.addTest(EntryInfoEtlWorkflowTests("testUpdateEntryInfo"))
|
|
65
|
-
return suiteSelect
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if __name__ == "__main__":
|
|
69
|
-
mySuite = entryInfoEtlWorkflowSuite()
|
|
70
|
-
unittest.TextTestRunner(verbosity=2).run(mySuite)
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# File: EntryInfoProviderTests.py
|
|
3
|
-
# Author: J. Westbrook
|
|
4
|
-
# Date: 22-Sep-2021
|
|
5
|
-
#
|
|
6
|
-
# Update:
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
##
|
|
10
|
-
"""
|
|
11
|
-
Tests for accessors entry-level annotations.
|
|
12
|
-
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
__docformat__ = "google en"
|
|
16
|
-
__author__ = "John Westbrook"
|
|
17
|
-
__email__ = "jwest@rcsb.rutgers.edu"
|
|
18
|
-
__license__ = "Apache 2.0"
|
|
19
|
-
|
|
20
|
-
import logging
|
|
21
|
-
import os
|
|
22
|
-
import unittest
|
|
23
|
-
|
|
24
|
-
from rcsb.exdb.entry.EntryInfoProvider import EntryInfoProvider
|
|
25
|
-
from rcsb.utils.config.ConfigUtil import ConfigUtil
|
|
26
|
-
|
|
27
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
28
|
-
TOPDIR = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
|
|
29
|
-
|
|
30
|
-
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s]-%(module)s.%(funcName)s: %(message)s")
|
|
31
|
-
logger = logging.getLogger()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class EntryInfoProviderTests(unittest.TestCase):
|
|
35
|
-
doInternal = False
|
|
36
|
-
|
|
37
|
-
def setUp(self):
|
|
38
|
-
self.__cachePath = os.path.join(HERE, "test-output", "CACHE")
|
|
39
|
-
#
|
|
40
|
-
self.__mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data")
|
|
41
|
-
self.__configPath = os.path.join(TOPDIR, "rcsb", "mock-data", "config", "dbload-setup-example.yml")
|
|
42
|
-
configName = "site_info_configuration"
|
|
43
|
-
self.__cfgOb = ConfigUtil(configPath=self.__configPath, defaultSectionName=configName, mockTopPath=self.__mockTopPath)
|
|
44
|
-
#
|
|
45
|
-
|
|
46
|
-
def tearDown(self):
|
|
47
|
-
pass
|
|
48
|
-
|
|
49
|
-
def testGetEntryInfo(self):
|
|
50
|
-
minCount = 12
|
|
51
|
-
eiP = EntryInfoProvider(cachePath=self.__cachePath, useCache=False)
|
|
52
|
-
ok = eiP.testCache(minCount=0)
|
|
53
|
-
self.assertTrue(ok)
|
|
54
|
-
ok = eiP.update(self.__cfgOb, fmt="json", indent=3)
|
|
55
|
-
self.assertTrue(ok)
|
|
56
|
-
riD = eiP.getEntryInfo("4en8")
|
|
57
|
-
logger.info("riD (%d) %r", len(riD), riD)
|
|
58
|
-
rL = eiP.getEntriesByPolymerEntityCount(count=2)
|
|
59
|
-
self.assertGreaterEqual(len(rL), 5)
|
|
60
|
-
ok = eiP.testCache(minCount=minCount)
|
|
61
|
-
self.assertTrue(ok)
|
|
62
|
-
eiP = EntryInfoProvider(cachePath=self.__cachePath, useCache=True)
|
|
63
|
-
ok = eiP.testCache(minCount=minCount)
|
|
64
|
-
self.assertTrue(ok)
|
|
65
|
-
|
|
66
|
-
@unittest.skipUnless(doInternal, "Internal full test")
|
|
67
|
-
def testEntryInfoRemote(self):
|
|
68
|
-
minCount = 182000
|
|
69
|
-
configName = "site_info_remote_configuration"
|
|
70
|
-
cfgOb = ConfigUtil(configPath=self.__configPath, defaultSectionName=configName, mockTopPath=self.__mockTopPath)
|
|
71
|
-
eiP = EntryInfoProvider(cachePath=self.__cachePath, useCache=True)
|
|
72
|
-
ok = eiP.testCache(minCount=minCount)
|
|
73
|
-
ok = eiP.update(cfgOb, fmt="json", indent=3)
|
|
74
|
-
self.assertTrue(ok)
|
|
75
|
-
riD = eiP.getEntryInfo("1kip")
|
|
76
|
-
logger.info("riD (%d)", len(riD))
|
|
77
|
-
self.assertGreaterEqual(len(riD), 1)
|
|
78
|
-
configName = "site_info_configuration"
|
|
79
|
-
cfgOb = ConfigUtil(configPath=self.__configPath, defaultSectionName=configName, mockTopPath=self.__mockTopPath)
|
|
80
|
-
ok = eiP.backup(cfgOb, configName, useStash=False, useGit=True)
|
|
81
|
-
self.assertTrue(ok)
|
|
82
|
-
ok = eiP.restore(cfgOb, configName, useStash=False, useGit=True)
|
|
83
|
-
self.assertTrue(ok)
|
|
84
|
-
eiP = EntryInfoProvider(cachePath=self.__cachePath, useCache=True)
|
|
85
|
-
ok = eiP.testCache(minCount=minCount)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def entryInfoSuite():
|
|
89
|
-
suiteSelect = unittest.TestSuite()
|
|
90
|
-
suiteSelect.addTest(EntryInfoProviderTests("testGetEntryInfo"))
|
|
91
|
-
return suiteSelect
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if __name__ == "__main__":
|
|
95
|
-
|
|
96
|
-
mySuite = entryInfoSuite()
|
|
97
|
-
unittest.TextTestRunner(verbosity=2).run(mySuite)
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# File: GlycanEtlWorkflowTests.py
|
|
3
|
-
# Author: J. Westbrook
|
|
4
|
-
# Date: 30-Jun-2021
|
|
5
|
-
#
|
|
6
|
-
# Updates:
|
|
7
|
-
#
|
|
8
|
-
##
|
|
9
|
-
"""
|
|
10
|
-
Tests for Glycan ETL workflow methods
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
__docformat__ = "google en"
|
|
14
|
-
__author__ = "John Westbrook"
|
|
15
|
-
__email__ = "jwest@rcsb.rutgers.edu"
|
|
16
|
-
__license__ = "Apache 2.0"
|
|
17
|
-
|
|
18
|
-
import logging
|
|
19
|
-
import os
|
|
20
|
-
import platform
|
|
21
|
-
import resource
|
|
22
|
-
import time
|
|
23
|
-
import unittest
|
|
24
|
-
|
|
25
|
-
from rcsb.exdb.wf.GlycanEtlWorkflow import GlycanEtlWorkflow
|
|
26
|
-
|
|
27
|
-
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s]-%(module)s.%(funcName)s: %(message)s")
|
|
28
|
-
logger = logging.getLogger()
|
|
29
|
-
|
|
30
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
31
|
-
TOPDIR = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class GlycanEtlWorkflowTests(unittest.TestCase):
|
|
35
|
-
def setUp(self):
|
|
36
|
-
#
|
|
37
|
-
self.__cachePath = os.path.join(HERE, "test-output", "CACHE")
|
|
38
|
-
self.__configPath = os.path.join(TOPDIR, "rcsb", "mock-data", "config", "dbload-setup-example.yml")
|
|
39
|
-
self.__configName = "site_info_configuration"
|
|
40
|
-
#
|
|
41
|
-
self.__startTime = time.time()
|
|
42
|
-
logger.debug("Starting %s at %s", self.id(), time.strftime("%Y %m %d %H:%M:%S", time.localtime()))
|
|
43
|
-
|
|
44
|
-
def tearDown(self):
|
|
45
|
-
unitS = "MB" if platform.system() == "Darwin" else "GB"
|
|
46
|
-
rusageMax = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
|
|
47
|
-
logger.info("Maximum resident memory size %.4f %s", rusageMax / 10 ** 6, unitS)
|
|
48
|
-
endTime = time.time()
|
|
49
|
-
logger.info("Completed %s at %s (%.4f seconds)", self.id(), time.strftime("%Y %m %d %H:%M:%S", time.localtime()), endTime - self.__startTime)
|
|
50
|
-
|
|
51
|
-
def testUpdateIndex(self):
|
|
52
|
-
"""Test case - update the glycan corrrespondence index."""
|
|
53
|
-
try:
|
|
54
|
-
gP = GlycanEtlWorkflow(configPath=self.__configPath, configName=self.__configName, cachePath=self.__cachePath)
|
|
55
|
-
ok = gP.updateMatchedIndex(backup=False)
|
|
56
|
-
self.assertTrue(ok)
|
|
57
|
-
except Exception as e:
|
|
58
|
-
logger.exception("Failing with %s", str(e))
|
|
59
|
-
self.fail()
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def glycanEtlWorkflowSuite():
|
|
63
|
-
suiteSelect = unittest.TestSuite()
|
|
64
|
-
suiteSelect.addTest(GlycanEtlWorkflowTests("testUpdateIndex"))
|
|
65
|
-
return suiteSelect
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if __name__ == "__main__":
|
|
69
|
-
mySuite = glycanEtlWorkflowSuite()
|
|
70
|
-
unittest.TextTestRunner(verbosity=2).run(mySuite)
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# File: GlycanProviderTests.py
|
|
3
|
-
# Author: J. Westbrook
|
|
4
|
-
# Date: 24-May-2021
|
|
5
|
-
#
|
|
6
|
-
# Update:
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
##
|
|
10
|
-
"""
|
|
11
|
-
Tests for accessors for managing Glycan extracted annotations.
|
|
12
|
-
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
__docformat__ = "google en"
|
|
16
|
-
__author__ = "John Westbrook"
|
|
17
|
-
__email__ = "jwest@rcsb.rutgers.edu"
|
|
18
|
-
__license__ = "Apache 2.0"
|
|
19
|
-
|
|
20
|
-
import logging
|
|
21
|
-
import os
|
|
22
|
-
import unittest
|
|
23
|
-
|
|
24
|
-
from rcsb.exdb.branch.GlycanProvider import GlycanProvider
|
|
25
|
-
from rcsb.utils.config.ConfigUtil import ConfigUtil
|
|
26
|
-
from rcsb.utils.io.MarshalUtil import MarshalUtil
|
|
27
|
-
|
|
28
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
29
|
-
TOPDIR = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
|
|
30
|
-
|
|
31
|
-
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s]-%(module)s.%(funcName)s: %(message)s")
|
|
32
|
-
logger = logging.getLogger()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class GlycanProviderTests(unittest.TestCase):
|
|
36
|
-
def setUp(self):
|
|
37
|
-
self.__cachePath = os.path.join(HERE, "test-output", "CACHE")
|
|
38
|
-
self.__dataPath = os.path.join(HERE, "test-data")
|
|
39
|
-
self.__mU = MarshalUtil(workPath=self.__cachePath)
|
|
40
|
-
#
|
|
41
|
-
self.__mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data")
|
|
42
|
-
self.__configPath = os.path.join(TOPDIR, "rcsb", "mock-data", "config", "dbload-setup-example.yml")
|
|
43
|
-
configName = "site_info_configuration"
|
|
44
|
-
self.__cfgOb = ConfigUtil(configPath=self.__configPath, defaultSectionName=configName, mockTopPath=self.__mockTopPath)
|
|
45
|
-
#
|
|
46
|
-
self.__stashUrl = None
|
|
47
|
-
self.__stashRemotePath = os.path.join(self.__cachePath, "stash-remote")
|
|
48
|
-
|
|
49
|
-
def tearDown(self):
|
|
50
|
-
pass
|
|
51
|
-
|
|
52
|
-
def testGlycanMapping(self):
|
|
53
|
-
minCount = 12
|
|
54
|
-
gP = GlycanProvider(cachePath=self.__cachePath, useCache=False)
|
|
55
|
-
ok = gP.testCache(minCount=0)
|
|
56
|
-
self.assertTrue(ok)
|
|
57
|
-
ok = gP.update(self.__cfgOb, fmt="json", indent=3)
|
|
58
|
-
self.assertTrue(ok)
|
|
59
|
-
riD = gP.getIdentifiers()
|
|
60
|
-
logger.info("riD (%d)", len(riD))
|
|
61
|
-
ok = gP.testCache(minCount=minCount)
|
|
62
|
-
self.assertTrue(ok)
|
|
63
|
-
gP = GlycanProvider(cachePath=self.__cachePath, useCache=True)
|
|
64
|
-
ok = gP.testCache(minCount=minCount)
|
|
65
|
-
self.assertTrue(ok)
|
|
66
|
-
|
|
67
|
-
@unittest.skip("Internal test")
|
|
68
|
-
def testGlycanStashRemote(self):
|
|
69
|
-
minCount = 12
|
|
70
|
-
configName = "site_info_remote_configuration"
|
|
71
|
-
cfgOb = ConfigUtil(configPath=self.__configPath, defaultSectionName=configName, mockTopPath=self.__mockTopPath)
|
|
72
|
-
gP = GlycanProvider(cachePath=self.__cachePath, useCache=True)
|
|
73
|
-
ok = gP.testCache(minCount=minCount)
|
|
74
|
-
ok = gP.update(cfgOb, fmt="json", indent=3)
|
|
75
|
-
self.assertTrue(ok)
|
|
76
|
-
riD = gP.getIdentifiers()
|
|
77
|
-
logger.info("riD (%d)", len(riD))
|
|
78
|
-
self.assertTrue(ok)
|
|
79
|
-
ok = gP.backup(cfgOb, configName)
|
|
80
|
-
self.assertTrue(ok)
|
|
81
|
-
ok = gP.restore(cfgOb, configName)
|
|
82
|
-
self.assertTrue(ok)
|
|
83
|
-
#
|
|
84
|
-
ok = gP.update(cfgOb, fmt="json", indent=3)
|
|
85
|
-
self.assertTrue(ok)
|
|
86
|
-
#
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
def glycanMappingSuite():
|
|
90
|
-
suiteSelect = unittest.TestSuite()
|
|
91
|
-
suiteSelect.addTest(GlycanProviderTests("testGlycanMapping"))
|
|
92
|
-
return suiteSelect
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if __name__ == "__main__":
|
|
96
|
-
|
|
97
|
-
mySuite = glycanMappingSuite()
|
|
98
|
-
unittest.TextTestRunner(verbosity=2).run(mySuite)
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# File: GlycanUtilsTests.py
|
|
3
|
-
# Author: J. Westbrook
|
|
4
|
-
# Date: 25-May-2021
|
|
5
|
-
#
|
|
6
|
-
# Update:
|
|
7
|
-
# 9-Feb-2023 aae Fix TOPDIR path
|
|
8
|
-
##
|
|
9
|
-
"""
|
|
10
|
-
Tests for creating glycan accession mapping details.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
__docformat__ = "google en"
|
|
14
|
-
__author__ = "John Westbrook"
|
|
15
|
-
__email__ = "jwest@rcsb.rutgers.edu"
|
|
16
|
-
__license__ = "Apache 2.0"
|
|
17
|
-
|
|
18
|
-
import logging
|
|
19
|
-
import os
|
|
20
|
-
import unittest
|
|
21
|
-
|
|
22
|
-
from rcsb.exdb.branch.GlycanUtils import GlycanUtils
|
|
23
|
-
from rcsb.utils.config.ConfigUtil import ConfigUtil
|
|
24
|
-
|
|
25
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
26
|
-
TOPDIR = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
|
|
27
|
-
|
|
28
|
-
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s]-%(module)s.%(funcName)s: %(message)s")
|
|
29
|
-
logger = logging.getLogger()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class GlycanUtilsTests(unittest.TestCase):
|
|
33
|
-
def setUp(self):
|
|
34
|
-
self.__dirPath = os.path.join(HERE, "test-output", "CACHE", "glycan")
|
|
35
|
-
#
|
|
36
|
-
self.__mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data")
|
|
37
|
-
configPath = os.path.join(TOPDIR, "rcsb", "mock-data", "config", "dbload-setup-example.yml")
|
|
38
|
-
configName = "site_info_configuration"
|
|
39
|
-
self.__cfgOb = ConfigUtil(configPath=configPath, defaultSectionName=configName, mockTopPath=self.__mockTopPath)
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
def tearDown(self):
|
|
43
|
-
pass
|
|
44
|
-
|
|
45
|
-
def testGlycanMapping(self):
|
|
46
|
-
gU = GlycanUtils(self.__cfgOb, self.__dirPath)
|
|
47
|
-
beD = gU.getBranchedEntityDetails()
|
|
48
|
-
self.assertGreaterEqual(len(beD), 1)
|
|
49
|
-
logger.info("branched entity descriptor details (%d)", len(beD))
|
|
50
|
-
eaD = gU.updateEntityAccessionMap()
|
|
51
|
-
logger.info("updated entity accession map length (%d)", len(eaD))
|
|
52
|
-
self.assertGreaterEqual(len(eaD), 12)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def glycanMappingSuite():
|
|
56
|
-
suiteSelect = unittest.TestSuite()
|
|
57
|
-
suiteSelect.addTest(GlycanUtilsTests("testGlycanMapping"))
|
|
58
|
-
return suiteSelect
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if __name__ == "__main__":
|
|
62
|
-
|
|
63
|
-
mySuite = glycanMappingSuite()
|
|
64
|
-
unittest.TextTestRunner(verbosity=2).run(mySuite)
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# File: LigandNeighborMappingProviderTests.py
|
|
3
|
-
# Author: J. Westbrook
|
|
4
|
-
# Date: 28-Jun-2021
|
|
5
|
-
#
|
|
6
|
-
# Updates:
|
|
7
|
-
#
|
|
8
|
-
##
|
|
9
|
-
"""
|
|
10
|
-
Tests for
|
|
11
|
-
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
__docformat__ = "google en"
|
|
15
|
-
__author__ = "John Westbrook"
|
|
16
|
-
__email__ = "jwest@rcsb.rutgers.edu"
|
|
17
|
-
__license__ = "Apache 2.0"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import logging
|
|
21
|
-
import os
|
|
22
|
-
import platform
|
|
23
|
-
import resource
|
|
24
|
-
import time
|
|
25
|
-
import unittest
|
|
26
|
-
|
|
27
|
-
from rcsb.exdb.seq.LigandNeighborMappingProvider import LigandNeighborMappingProvider
|
|
28
|
-
|
|
29
|
-
from rcsb.utils.config.ConfigUtil import ConfigUtil
|
|
30
|
-
|
|
31
|
-
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s]-%(module)s.%(funcName)s: %(message)s")
|
|
32
|
-
logger = logging.getLogger()
|
|
33
|
-
|
|
34
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
35
|
-
TOPDIR = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class LigandNeighborMappingProviderTests(unittest.TestCase):
|
|
39
|
-
def __init__(self, methodName="runTest"):
|
|
40
|
-
super(LigandNeighborMappingProviderTests, self).__init__(methodName)
|
|
41
|
-
self.__verbose = True
|
|
42
|
-
|
|
43
|
-
def setUp(self):
|
|
44
|
-
self.__mockTopPath = os.path.join(TOPDIR, "rcsb", "mock-data")
|
|
45
|
-
configPath = os.path.join(TOPDIR, "rcsb", "mock-data", "config", "dbload-setup-example.yml")
|
|
46
|
-
configName = "site_info_configuration"
|
|
47
|
-
self.__cfgOb = ConfigUtil(configPath=configPath, defaultSectionName=configName, mockTopPath=self.__mockTopPath)
|
|
48
|
-
self.__cachePath = os.path.join(TOPDIR, "CACHE")
|
|
49
|
-
self.__startTime = time.time()
|
|
50
|
-
logger.debug("Starting %s at %s", self.id(), time.strftime("%Y %m %d %H:%M:%S", time.localtime()))
|
|
51
|
-
|
|
52
|
-
def tearDown(self):
|
|
53
|
-
unitS = "MB" if platform.system() == "Darwin" else "GB"
|
|
54
|
-
rusageMax = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
|
|
55
|
-
logger.info("Maximum resident memory size %.4f %s", rusageMax / 10 ** 6, unitS)
|
|
56
|
-
endTime = time.time()
|
|
57
|
-
logger.info("Completed %s at %s (%.4f seconds)", self.id(), time.strftime("%Y %m %d %H:%M:%S", time.localtime()), endTime - self.__startTime)
|
|
58
|
-
|
|
59
|
-
def testLigandNeighborMapping(self):
|
|
60
|
-
"""Test case - load and access ligand neighbor mapping cache"""
|
|
61
|
-
try:
|
|
62
|
-
crmP = LigandNeighborMappingProvider(self.__cachePath, useCache=True)
|
|
63
|
-
ok = crmP.testCache()
|
|
64
|
-
self.assertTrue(ok)
|
|
65
|
-
#
|
|
66
|
-
ok = crmP.fetchLigandNeighborMapping(self.__cfgOb)
|
|
67
|
-
self.assertTrue(ok)
|
|
68
|
-
crmP = LigandNeighborMappingProvider(self.__cachePath, useCache=True)
|
|
69
|
-
ok = crmP.testCache(minCount=2)
|
|
70
|
-
self.assertTrue(ok)
|
|
71
|
-
nL = crmP.getLigandNeighbors("3VFJ_2")
|
|
72
|
-
logger.info("ligand neighbor list nL %r", nL)
|
|
73
|
-
self.assertGreaterEqual(len(nL), 4)
|
|
74
|
-
self.assertGreater(len(nL[0]), 1)
|
|
75
|
-
#
|
|
76
|
-
except Exception as e:
|
|
77
|
-
logger.exception("Failing with %s", str(e))
|
|
78
|
-
self.fail()
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def ligandNeighborMappingSuite():
|
|
82
|
-
suiteSelect = unittest.TestSuite()
|
|
83
|
-
suiteSelect.addTest(LigandNeighborMappingProviderTests("testLigandNeighborMapping"))
|
|
84
|
-
return suiteSelect
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if __name__ == "__main__":
|
|
88
|
-
#
|
|
89
|
-
mySuite = ligandNeighborMappingSuite()
|
|
90
|
-
unittest.TextTestRunner(verbosity=2).run(mySuite)
|