Skip to content

Commit

Permalink
Merge pull request prody#1869 from jamesmkrieger/hpb
Browse files Browse the repository at this point in the history
fix setup.py to copy hpb
  • Loading branch information
karolamik13 authored Aug 23, 2024
2 parents 9513595 + 176c122 commit eddc7df
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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_.
Expand Down Expand Up @@ -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:
Expand Down
30 changes: 28 additions & 2 deletions prody/tests/proteins/test_insty.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -55,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:
Expand Down Expand Up @@ -132,4 +134,28 @@ 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):

try:
import prody.proteins.hpb as hpb
imported_hpb = True
except ImportError:
try:
import hpb
imported_hpb = True
except ImportError:
imported_hpb = False

if sys.version_info[1] < 11:
self.assertTrue(imported_hpb)
else:
self.assertFalse(imported_hpb)

@classmethod
def tearDownClass(cls):
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',
'test_2k39_hph.npy', 'test_2k39_disu.npy']:
os.remove(filename)
16 changes: 13 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -164,8 +174,8 @@
setup(
name='ProDy',
version=__version__,
author='James Krieger, She Zhang, Hongchun Li, Cihan Kaya, Ahmet Bakan, and others',
author_email='[email protected]',
author='James Krieger, Karolina Mikulska-Ruminska, She Zhang, Hongchun Li, Cihan Kaya, Ahmet Bakan, and others',
author_email='[email protected]',
description='A Python Package for Protein Dynamics Analysis',
long_description=long_description,
url='http://www.csb.pitt.edu/ProDy',
Expand Down

0 comments on commit eddc7df

Please sign in to comment.