From 894806356d7f0ee77d4a09b4ab9a9689d3df372b Mon Sep 17 00:00:00 2001 From: James Krieger Date: Wed, 17 Apr 2024 15:49:44 +0200 Subject: [PATCH 1/9] fix setup.py to copy hpb --- setup.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ff26c5f96..c9080278c 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,8 @@ from setuptools import setup from setuptools import Extension +import shutil + if sys.version_info[:2] < (2, 7): sys.stderr.write('Python 2.6 and older is not supported\n') sys.exit() @@ -94,7 +96,15 @@ from glob import glob tntDir = join('prody', 'utilities', 'tnt') -hpbDir = join('prody', 'proteins', 'hpbmodule') +hpbSoDir = join('prody', 'proteins', 'hpbmodule', + 'hpb_Python{0}.{1}'.format(sys.version_info[0], + sys.version_info[1])) +proteinsDir = join('prody', 'proteins') + +try: + shutil.copy(hpbSoDir + "/hpb.so", proteinsDir) +except FileNotFoundError: + pass EXTENSIONS = [ Extension('prody.dynamics.rtbtools', @@ -164,8 +174,8 @@ setup( name='ProDy', version=__version__, - author='James Krieger, She Zhang, Hongchun Li, Cihan Kaya, Ahmet Bakan, and others', - author_email='kriegerj@pitt.edu', + author='James Krieger, Karolina Mikulska-Ruminska, She Zhang, Hongchun Li, Cihan Kaya, Ahmet Bakan, and others', + author_email='jamesmkrieger@gmail.com', description='A Python Package for Protein Dynamics Analysis', long_description=long_description, url='http://www.csb.pitt.edu/ProDy', From 2ef2316c31329aa047aad7cd78c859ef59ab7d0a Mon Sep 17 00:00:00 2001 From: James Krieger Date: Wed, 17 Apr 2024 16:01:20 +0200 Subject: [PATCH 2/9] add test imported hpb --- prody/tests/proteins/test_insty.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 0fd6a47ac..ae364bb0b 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -12,6 +12,8 @@ from prody.proteins.interactions import calcPiCationTrajectory, calcHydrophobicTrajectory from prody.proteins.interactions import calcDisulfideBondsTrajectory, calcProteinInteractions +import sys + class TestInteractions(unittest.TestCase): def setUp(self): @@ -132,4 +134,20 @@ def testDisulfideBonds(self): assert_equal(sorted([i[-1][-1] for i in data_test if i]), sorted([i[-1][-1] for i in self.DISU_INTERACTIONS if i]), 'failed to get correct disulfide bonds') - + def testImportHpb(self): + imported_hpb = False + + try: + import prody.proteins.hpb as hpb + imported_hpb = True + except ImportError: + try: + import hpb + imported_hpb = True + except ImportError: + raise ImportError('Please provide hpb.so file.') + + if sys.version_info[1] < 11: + self.assertTrue(imported_hpb) + else: + self.assertFalse(imported_hpb) From 2ccd6a2ce424a71869d76c3ae1d661af7e480a54 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Wed, 17 Apr 2024 17:12:41 +0200 Subject: [PATCH 3/9] fix 311 test --- prody/tests/proteins/test_insty.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index ae364bb0b..086fe3732 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -135,7 +135,6 @@ def testDisulfideBonds(self): 'failed to get correct disulfide bonds') def testImportHpb(self): - imported_hpb = False try: import prody.proteins.hpb as hpb @@ -145,7 +144,7 @@ def testImportHpb(self): import hpb imported_hpb = True except ImportError: - raise ImportError('Please provide hpb.so file.') + imported_hpb = False if sys.version_info[1] < 11: self.assertTrue(imported_hpb) From a93f2f65ac4aea44df33ef90c5a06c9332235ee2 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 13:50:23 +0200 Subject: [PATCH 4/9] change overlaping to overlapping in docs, comments and logging --- prody/proteins/interactions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index 40f3dd3d6..c8d04acca 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -163,7 +163,7 @@ def calcHydrophobicOverlapingAreas(atoms, **kwargs): :arg selection: selection string of hydrophobic residues :type selection: str - :arg hpb_cutoff: cutoff for hydrophobic overlaping area values + :arg hpb_cutoff: cutoff for hydrophobic overlapping area values default is 0.0 :type hpb_cutoff: float, int @@ -200,7 +200,7 @@ def calcHydrophobicOverlapingAreas(atoms, **kwargs): lA = [ [x[i] + str(y[i]), z[i] +'_'+ str(w[i]), ch[i]] for i in range(len(x))] output = hpb.hpb((lB,lA)) - LOGGER.info("Hydrophobic Overlaping Areas are computed.") + LOGGER.info("Hydrophobic Overlapping Areas are computed.") output_final = [i for i in output if i[-1] >= hpb_cutoff] if cumulative_values == None: @@ -1000,11 +1000,11 @@ def calcHydrophobic(atoms, **kwargs): non_standard works too :type non_standard_Hph: dict - :arg zerosHPh: zero values of hydrophobic overlaping areas included + :arg zerosHPh: zero values of hydrophobic overlapping areas included default is False :type zerosHPh: bool - Last value in the output corresponds to the total hydrophobic overlaping area for two residues + Last value in the output corresponds to the total hydrophobic overlapping area for two residues not only for the atoms that are included in the list. Atoms that which are listed are the closest between two residues and they will be inluded to draw the line in VMD_. @@ -1065,7 +1065,7 @@ def calcHydrophobic(atoms, **kwargs): aromatic_nr = list(set(zip(atoms.aromatic.getResnums(),atoms.aromatic.getChids()))) aromatic = list(set(atoms.aromatic.getResnames())) - # Computing hydrophobic overlaping areas for pairs of residues: + # Computing hydrophobic overlapping areas for pairs of residues: try: hpb_overlaping_results = calcHydrophobicOverlapingAreas(atoms_hydrophobic, cumulative_values='pairs') except: From 92abc7286418dc1348e957ffc9cea8eb4ddcbcda Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 14:33:47 +0200 Subject: [PATCH 5/9] remove files at end of test --- prody/tests/proteins/test_insty.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 086fe3732..a378407a4 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -150,3 +150,11 @@ def testImportHpb(self): self.assertTrue(imported_hpb) else: self.assertFalse(imported_hpb) + + @classmethod + def tearDownClass(cls): + import os + for filename in ['test_2k39_all.npy', 'test_2k39_hbs.npy', 'test_2k39_sbs.npy', + 'test_2k39_rib.npy', 'test_2k39_PiStack.npy', 'test_2k39_PiCat.npy', + 'test_2k39_hph.npy', 'test_2k39_disu.npy']: + os.remove(filename) From a48d4d0880b92d30608c2615606aab04a7d4dcd5 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 14:34:25 +0200 Subject: [PATCH 6/9] fix test name not used elsewhere --- prody/tests/proteins/test_insty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index a378407a4..7ea6a08f1 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -57,7 +57,7 @@ def setUp(self): self.data_disu = calcDisulfideBondsTrajectory(self.ATOMS) np.save('test_2k39_disu.npy', np.array(self.data_disu, dtype=object), allow_pickle=True) - def testAllInsteractions(self): + def testAllInteractions(self): """Test for all types of interactions.""" if prody.PY3K: From 83224a4104509206e7c807f8f55ee2e430184058 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 12:31:57 +0200 Subject: [PATCH 7/9] add so files to manifest.in --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index c58a255b9..a33dfffad 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,6 +9,7 @@ include prody/*/*.cpp include prody/*/*/*.cpp include prody/*/*.h include prody/*/*/*.h +include prody/*/*/*/*.so include prody/tests/*/*.py include prody/tests/datafiles/*.coo include prody/tests/datafiles/*.dcd From dbaff7ea7de3123ac71adce2dab85b0ff3097b79 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 15:30:07 +0200 Subject: [PATCH 8/9] remove files with PY3 --- prody/tests/proteins/test_insty.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 7ea6a08f1..5f6eeb22f 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -153,8 +153,9 @@ def testImportHpb(self): @classmethod def tearDownClass(cls): - import os - for filename in ['test_2k39_all.npy', 'test_2k39_hbs.npy', 'test_2k39_sbs.npy', - 'test_2k39_rib.npy', 'test_2k39_PiStack.npy', 'test_2k39_PiCat.npy', - 'test_2k39_hph.npy', 'test_2k39_disu.npy']: - os.remove(filename) + if PY3K: + import os + for filename in ['test_2k39_all.npy', 'test_2k39_hbs.npy', 'test_2k39_sbs.npy', + 'test_2k39_rib.npy', 'test_2k39_PiStack.npy', 'test_2k39_PiCat.npy', + 'test_2k39_hph.npy', 'test_2k39_disu.npy']: + os.remove(filename) From 9ae04c55f3d06c69deee34c62bf67a5a5540fab6 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 16:57:57 +0200 Subject: [PATCH 9/9] fix PY3K to prody.PY3K in tear down --- prody/tests/proteins/test_insty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 5f6eeb22f..fefe27258 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -153,7 +153,7 @@ def testImportHpb(self): @classmethod def tearDownClass(cls): - if PY3K: + if prody.PY3K: import os for filename in ['test_2k39_all.npy', 'test_2k39_hbs.npy', 'test_2k39_sbs.npy', 'test_2k39_rib.npy', 'test_2k39_PiStack.npy', 'test_2k39_PiCat.npy',