Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactions (hpb improvements) #1765

Merged
merged 8 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions prody/proteins/hpbmodule/README
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,30 @@ hpb is a python module written for calculating the hydrophobic interactions and
accessible surface area using geometric method. The original program is in C++, so the
module is an interface to call functions in C++.

Follow the stpes to compile the C++ code into the *.so file of module (note that the directory to include python may need change):
Follow the stpes to compile the C++ code into the *.so file of module (note that the
directory to include python may need change):

cd libf2c
make -f makefile.l hadd
make -f makefile.l
Step 1:
gfortran -O3 -fPIC -c reg_tet.f

cd ..
Step 2:
g++ -O3 -g -fPIC -c hpbmodule.cpp -o hpbmodule.o -I/usr/include/python2.7/
or to compile the program for python 3.X use:
g++ -O3 -g -fPIC -c hpbmodule.cpp -o hpbmodule.o -I/usr/include/python3.X/
instead

to compile the program for python 3.8 use:
g++ -O3 -g -fPIC -c hpbmodule.cpp -o hpbmodule.o -I/usr/include/python3.8/
If we ae using Anaconda we might have such pathway to python:
g++ -O3 -g -fPIC -c hpbmodule.cpp -o hpbmodule.o -I/home/user_name/anaconda3/envs/name_of_environment/include/python3.9/

and further:
g++ -shared -Wl,-soname,hpb.so -o hpb.so hpbmodule.o reg_tet.o ./libf2c/libf2c.a -lm
user_name, name_of_environment - need to be replaced

Step 3:
g++ -shared -Wl,-soname,hpb.so -o hpb.so hpbmodule.o reg_tet.o -lgfortran

Note: You will need C++ compiler and Fortran compiler.

############################
After compiling the code, the module 'hpbmodule.so' file is created and user can import the module in python.
Try one example program 'testh.py' to use the functions in it.
Two functions hpb.hpb and hpb.sasa are writtein in the same module. The inputs to call them are the same.
The outputs are now in lists, with every element contains the information for one hydrophobic interaction or SASA value of one residue.
After compiling the code, the module 'hpb.so' file is created and user can import
the module to ProDy or copy the file in the local directory to use it with calcSASA(),
calcVolume(), calcHydrophobicOverlapingAreas(), or calcHydrophobic().

11 changes: 0 additions & 11 deletions prody/proteins/hpbmodule/compilation.txt

This file was deleted.

Binary file added prody/proteins/hpbmodule/hpb_Python2.7/hpb.so
Binary file not shown.
Binary file added prody/proteins/hpbmodule/hpb_Python3.10/hpb.so
Binary file not shown.
Binary file added prody/proteins/hpbmodule/hpb_Python3.8/hpb.so
Binary file not shown.
Binary file added prody/proteins/hpbmodule/hpb_Python3.9/hpb.so
Binary file not shown.
Binary file removed prody/proteins/hpbmodule/hpbmodule.o
Binary file not shown.
Binary file removed prody/proteins/hpbmodule/reg_tet.o
Binary file not shown.
15 changes: 7 additions & 8 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
(5) Pi-cation interactions
(6) Hydrophobic interactions
(7) Disulfide Bonds

For protein-ligand interactions (3) is replaced by water bridges.
"""

__author__ = 'Karolina Mikulska-Ruminska'
Expand Down Expand Up @@ -93,6 +91,7 @@ def calcAngleBetweenPlanes(a1, b1, c1, a2, b2, c2):


def removeDuplicates(list_of_interactions):
"""Remove duplicates from interactions."""
ls=[]
newList = []
for no, i in enumerate(list_of_interactions):
Expand Down Expand Up @@ -154,7 +153,7 @@ def filterInteractions(list_of_interactions, atoms, **kwargs):

def calcHydrophobicOverlapingAreas(atoms, **kwargs):
"""Provide information about hydrophobic contacts between pairs of residues based on
the regsurf program.
the regsurf program. To use this function compiled hpb.so is needed.

:arg atoms: an Atomic object from which residues are selected
:type atoms: :class:`.Atomic`
Expand Down Expand Up @@ -182,7 +181,7 @@ def calcHydrophobicOverlapingAreas(atoms, **kwargs):
import hpb
imported_hpb = True
except ImportError:
LOGGER.info('Please provide hpb.so file into the directory.')
raise ImportError('Please provide hpb.so file into the directory.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn’t need to be in directory, could be compiled inside prody

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I will change that, and I will add the description in the main ProDy README.


if imported_hpb:
selection = kwargs.pop('selection', 'protein and noh')
Expand Down Expand Up @@ -227,7 +226,7 @@ def calcHydrophobicOverlapingAreas(atoms, **kwargs):

def calcSASA(atoms, **kwargs):
"""Provide information about solvent accessible surface area (SASA) based on
the sasa program.
the sasa program. To use this function compiled hpb.so is needed.

:arg atoms: an Atomic object from which residues are selected
:type atoms: :class:`.Atomic`
Expand Down Expand Up @@ -255,7 +254,7 @@ def calcSASA(atoms, **kwargs):
import hpb
imported_hpb = True
except ImportError:
LOGGER.info('Please provide hpb.so file into the directory.')
raise ImportError('Please provide hpb.so file into the directory.')

if imported_hpb:
selection = kwargs.pop('selection', 'protein and noh')
Expand Down Expand Up @@ -284,7 +283,7 @@ def calcSASA(atoms, **kwargs):

def calcVolume(atoms, **kwargs):
"""Provide information about volume for each residue/molecule/chain
or other selection".
or other selection". To use this function compiled hpb.so is needed.

:arg atoms: an Atomic object from which residues are selected
:type atoms: :class:`.Atomic`
Expand Down Expand Up @@ -318,7 +317,7 @@ def calcVolume(atoms, **kwargs):
import hpb
imported_hpb = True
except ImportError:
LOGGER.info('Please provide hpb.so file into the directory.')
raise ImportError('Please provide hpb.so file into the directory.')

if imported_hpb:
selection = kwargs.pop('selection', 'protein and noh')
Expand Down
Loading