Skip to content

Commit

Permalink
Merge branch 'development' into feature/chain
Browse files Browse the repository at this point in the history
  • Loading branch information
mestia authored Dec 16, 2024
2 parents 7569212 + 37f0097 commit b2ddc60
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 28 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Changelog
---------
# 2.3.1
* fixes in interaction detection with peptide ligands by @kalinni in #153
* fix in hydrogen bond acceptor identification by @kalinni in #151
* fixes in waterbridge detection and filtering by @kalinni in #152
* fix NumPy DeprecationWarning when using numpy.uint32 with negative numbers by @QY0831 in #150

# 2.3.0
* fixes an issue that caused encoding errors to be thrown
* salt bridge interaction improved
Expand Down
2 changes: 1 addition & 1 deletion plip/basic/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '2.3.0'
__version__ = '2.3.1'
__maintainer__ = 'PharmAI GmbH (2020-2021) - www.pharm.ai - hello@pharm.ai'
__citation_information__ = "Adasme,M. et al. PLIP 2021: expanding the scope of the protein-ligand interaction profiler to DNA and RNA. " \
"Nucl. Acids Res. (05 May 2021), gkab294. doi: 10.1093/nar/gkab294"
Expand Down
124 changes: 97 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,102 @@
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext
from setuptools.command.install import install
from distutils.command.build import build

from plip.basic import config

def install_pkg_via_pip(package):
import subprocess
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', package])

def build_ob_py_bindings():
""" Fix openbabel issue (https://github.com/openbabel/openbabel/issues/2408) manually
- Download openbabel bindings from pypi
- extract to a tmpdir
- fix version in $tmpdir/openbabel-3.1.1.1/openbabel/__init__.py to have 2 dot version only
- install the fixed version with setuptools/pip
- cleanup the tmpdir
"""
import requests
import tarfile
import tempfile
import shutil
import fileinput
import subprocess
import sys

openbabel_pypi_url='https://files.pythonhosted.org/packages/9d/3f/f08f5d1422d74ed0e1e612870b343bfcc26313bdf9efec9165c3ea4b3ae2/openbabel-3.1.1.1.tar.gz'

print (f"Downloading openbabel package from : {openbabel_pypi_url}")
obtar=requests.get(openbabel_pypi_url)
obtmpdir = tempfile.mkdtemp()
obtmp = obtmpdir+'/openbabel-3.1.1.1.tar'
open(obtmp,'wb').write(obtar.content)
print(f"Saving openbabel tar.gz to {obtmpdir}")
versfile = obtmpdir+'/openbabel-3.1.1.1/openbabel/__init__.py'

with tarfile.open(obtmp,mode='r') as tf:
tf.extractall(obtmpdir)

print ('Fix versions: s/3.1.1.1/3.1.1/ to make StrictVersion() in openbabel\'s setup.py happy')
print ('See https://github.com/openbabel/openbabel/issues/2408 for more details')
with fileinput.input(files=versfile,inplace=True) as f:
for line in f:
op = line.replace('__version__ = "3.1.1.1"', '__version__ = "3.1.1"')
print(op, end='')

install_pkg_via_pip(obtmpdir+'/openbabel-3.1.1.1/')
print (f"Cleanup tmpdir: {obtmpdir}")
shutil.rmtree(obtmpdir)

class CustomBuild(build):
"""Ensure build_ext runs first in build command."""
def run(self):
self.run_command('build_ext')
build.run(self)

class CustomInstall(install):
"""Ensure build_ext runs first in install command."""
def run(self):
self.run_command('build_ext')
install.run(self)

class CustomBuildExt(build_ext):
""" Check if openbabel bindings are installed || build them """
def run(self):
try: import openbabel
except ModuleNotFoundError:
try: import requests
except ModuleNotFoundError:
install_pkg_via_pip('requests')
build_ob_py_bindings()
return

setup(name='plip',
version=config.__version__,
description='PLIP - Fully automated protein-ligand interaction profiler',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'Natural Language :: English',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering :: Bio-Informatics'
],
url='https://github.com/pharmai/plip',
author='PharmAI GmbH',
author_email='hello@pharm.ai',
license='GPLv2',
packages=find_packages(),
scripts=['plip/plipcmd.py'],
install_requires=[
'openbabel',
'numpy',
'lxml'
],
entry_points={
"console_scripts": [
"plip = plip.plipcmd:main"
]
},
zip_safe=False)
version=config.__version__,
description='PLIP - Fully automated protein-ligand interaction profiler',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'Natural Language :: English',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering :: Bio-Informatics'
],
url='https://github.com/pharmai/plip',
author='PharmAI GmbH',
author_email='hello@pharm.ai',
license='GPLv2',
packages=find_packages(),
scripts=['plip/plipcmd.py'],
cmdclass={'build': CustomBuild, 'build_ext': CustomBuildExt, 'install': CustomInstall},
install_requires=[
'numpy',
'lxml'
],
entry_points={
"console_scripts": [
"plip = plip.plipcmd:main"
]
},
zip_safe=False)

0 comments on commit b2ddc60

Please sign in to comment.