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

[1.1] add CI tests + new strain energy calculations and data for plots #2

Merged
merged 14 commits into from
Jan 30, 2024
66 changes: 66 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: build

on:
push:
paths-ignore:
- "README.md"
- "docs/**"

pull_request:
paths-ignore:
- "README.md"
- "docs/*"

jobs:
build_cpu:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
#torch: [1.12.0, 1.13.0, 2.0.0]
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repository
uses: actions/checkout@v3

# Setup environment (conda, dependencies, etc.)
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-variant: Mambaforge
channels: "conda-forge, pytorch"
python-version: ${{ matrix['python-version'] }}
use-mamba: true

#- name: Install PyTorch
# run: mamba install -c pytorch pytorch==${{matrix.torch}} cpuonly

- name: Install Extras
run: pip install -r requirements.txt

- name: Install OpenBabel
run: mamba install -c conda-forge openbabel

- name: Install reduce
run: mamba install -c speleo3 reduce

# Install coverage tool
- name: Install Coverage
run: pip install coverage

# # Run tests with coverage
# - name: Run unit tests and generate coverage report
# run: |
# coverage run --source=posecheck -m unittest discover -s tests -p "test_*.py"
# coverage xml

# # Upload coverage to Codecov
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v2
# with:
# files: ./coverage.xml
# fail_ci_if_error: true
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# PoseCheck: Benchmarking Generated Poses


[![arXiv](https://img.shields.io/badge/arXiv-2308.07413-b31b1b.svg)](https://arxiv.org/abs/2308.07413)
![version](https://img.shields.io/badge/version-1.1-blue)
[![python](https://img.shields.io/badge/-Python_3.8_%7C_3.9_%7C_3.10_%7C_3.11-blue?logo=python&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![build](https://github.com/cch1999/posecheck/actions/workflows/tests.yaml/badge.svg?branch=main)](https://github.com/cch1999/posecheck/actions/workflows/tests.yaml)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

<p align="center">
<a href="">
<img src="data/posecheck_logo.png" width="800"/>
Expand Down Expand Up @@ -78,7 +86,10 @@ print(f"Interactions of example molecule: {interactions}")

## Data from the paper

WIP!

The data for the paper can be found at the following Zenodo link and place in the `data` directory.

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10208912.svg)](https://doi.org/10.5281/zenodo.10208912)


## Cite
Expand Down
19 changes: 19 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

## [1.1] - 18-01-2024

### Changed
- [IMPORTANT - PLEASE READ IF YOU INTEND TO PUBLISH] Changed the way strain energy is calculated. Previously, the strain energy was calculated as the difference between the energy of the raw output and a fully relaxed structure. This meant that the energy term of the raw output exploded due to slight imperfections in local bond lengths and angles and did not reflect global strain well. Now we perform a small bit of local relaxation (max displacement in the atom positions of 0.1 Å) and use the energy of this structure as the reference energy. This means that the strain energy is now a more accurate reflection of the global strain of the molecule.

### Added
- Data and notebooks needed to reproduce plots from the paper.
- Validator that warms the user if `reduce` cannot be found.
- CI tests
- Full environment specs

### Fixed
- Improved doc string coverage

## [1.0] - 24-09-2023

Initial release of the software with basic features for chemical analysis.
44 changes: 44 additions & 0 deletions dev.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"ename": "",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31mRunning cells with '/Users/charlie/micromamba/envs/posecheck/bin/python' requires the ipykernel package.\n",
"\u001b[1;31mRun the following command to install 'ipykernel' into the Python environment. \n",
"\u001b[1;31mCommand: 'conda install -p /Users/charlie/micromamba/envs/posecheck ipykernel --update-deps --force-reinstall'"
]
}
],
"source": [
"import torch"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
115 changes: 102 additions & 13 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,105 @@
name: posecheck
name: poses
channels:
- conda-forge
- defaults
- conda-forge
- speleo3
dependencies:
- openbabel
- pip:
- pandas
- seaborn
- matplotlib
- rdkit
- datamol
- prolif
- tqdm

- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- asttokens=2.2.1=pyhd8ed1ab_0
- backcall=0.2.0=pyh9f0ad1d_0
- backports=1.0=pyhd8ed1ab_3
- backports.functools_lru_cache=1.6.5=pyhd8ed1ab_0
- bzip2=1.0.8=h7f98852_4
- ca-certificates=2023.7.22=hbcca054_0
- cairo=1.16.0=hbbf8b49_1016
- comm=0.1.4=pyhd8ed1ab_0
- debugpy=1.6.8=py311hb755f60_0
- decorator=5.1.1=pyhd8ed1ab_0
- executing=1.2.0=pyhd8ed1ab_0
- expat=2.5.0=hcb278e6_1
- font-ttf-dejavu-sans-mono=2.37=hab24e00_0
- font-ttf-inconsolata=3.000=h77eed37_0
- font-ttf-source-code-pro=2.038=h77eed37_0
- font-ttf-ubuntu=0.83=hab24e00_0
- fontconfig=2.14.2=h14ed4e7_0
- fonts-conda-ecosystem=1=0
- fonts-conda-forge=1=0
- freetype=2.12.1=hca18f0e_1
- gettext=0.21.1=h27087fc_0
- icu=72.1=hcb278e6_0
- importlib-metadata=6.8.0=pyha770c72_0
- importlib_metadata=6.8.0=hd8ed1ab_0
- ipykernel=6.25.1=pyh71e2992_0
- ipython=8.14.0=pyh41d4057_0
- jedi=0.19.0=pyhd8ed1ab_0
- jupyter_client=8.3.0=pyhd8ed1ab_0
- jupyter_core=5.3.1=py311h38be061_0
- ld_impl_linux-64=2.40=h41732ed_0
- libexpat=2.5.0=hcb278e6_1
- libffi=3.4.2=h7f98852_5
- libgcc-ng=13.1.0=he5830b7_0
- libglib=2.76.4=hebfc3b9_0
- libgomp=13.1.0=he5830b7_0
- libiconv=1.17=h166bdaf_0
- libnsl=2.0.0=h7f98852_0
- libpng=1.6.39=h753d276_0
- libsodium=1.0.18=h36c2ea0_1
- libsqlite=3.42.0=h2797004_0
- libstdcxx-ng=13.1.0=hfd8a6a1_0
- libuuid=2.38.1=h0b41bf4_0
- libxcb=1.15=h0b41bf4_0
- libxml2=2.11.5=h0d562d8_0
- libzlib=1.2.13=hd590300_5
- matplotlib-inline=0.1.6=pyhd8ed1ab_0
- ncurses=6.4=hcb278e6_0
- nest-asyncio=1.5.6=pyhd8ed1ab_0
- openbabel=3.1.1=py311ha3c2874_7
- openssl=3.1.2=hd590300_0
- packaging=23.1=pyhd8ed1ab_0
- parso=0.8.3=pyhd8ed1ab_0
- pcre2=10.40=hc3806b6_0
- pexpect=4.8.0=pyh1a96a4e_2
- pickleshare=0.7.5=py_1003
- pip=23.2.1=pyhd8ed1ab_0
- pixman=0.40.0=h36c2ea0_0
- platformdirs=3.10.0=pyhd8ed1ab_0
- prompt-toolkit=3.0.39=pyha770c72_0
- prompt_toolkit=3.0.39=hd8ed1ab_0
- psutil=5.9.5=py311h2582759_0
- pthread-stubs=0.4=h36c2ea0_1001
- ptyprocess=0.7.0=pyhd3deb0d_0
- pure_eval=0.2.2=pyhd8ed1ab_0
- pygments=2.16.1=pyhd8ed1ab_0
- python=3.11.4=hab00c5b_0_cpython
- python-dateutil=2.8.2=pyhd8ed1ab_0
- python_abi=3.11=3_cp311
- pyzmq=25.1.1=py311h75c88c4_0
- readline=8.2=h8228510_1
- reduce=3.16.111118=h6bb024c_0
- setuptools=68.0.0=pyhd8ed1ab_0
- six=1.16.0=pyh6c4a22f_0
- stack_data=0.6.2=pyhd8ed1ab_0
- tk=8.6.12=h27826a3_0
- tornado=6.3.2=py311h459d7ec_0
- traitlets=5.9.0=pyhd8ed1ab_0
- typing-extensions=4.7.1=hd8ed1ab_0
- typing_extensions=4.7.1=pyha770c72_0
- tzdata=2023c=h71feb2d_0
- wcwidth=0.2.6=pyhd8ed1ab_0
- wheel=0.41.1=pyhd8ed1ab_0
- xorg-kbproto=1.0.7=h7f98852_1002
- xorg-libice=1.1.1=hd590300_0
- xorg-libsm=1.2.4=h7391055_0
- xorg-libx11=1.8.6=h8ee46fc_0
- xorg-libxau=1.0.11=hd590300_0
- xorg-libxdmcp=1.1.3=h7f98852_0
- xorg-libxext=1.3.4=h0b41bf4_2
- xorg-libxrender=0.9.11=hd590300_0
- xorg-renderproto=0.11.1=h7f98852_1002
- xorg-xextproto=7.3.0=h0b41bf4_1003
- xorg-xproto=7.0.31=h7f98852_1007
- xz=5.2.6=h166bdaf_0
- zeromq=4.3.4=h9c3ff4c_1
- zipp=3.16.2=pyhd8ed1ab_0
- zlib=1.2.13=hd590300_5

Binary file modified posecheck/__pycache__/posecheck.cpython-311.pyc
Binary file not shown.
9 changes: 7 additions & 2 deletions posecheck/posecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from posecheck.utils.interactions import generate_interaction_df
from posecheck.utils.loading import (load_mols_from_rdkit, load_mols_from_sdf,
load_protein_from_pdb, read_pdbqt)
from posecheck.utils.strain import get_strain_energy
from posecheck.utils.strain import calculate_strain_energy
from posecheck.utils.validators import is_reduce_installed, print_reduce_warning


class PoseCheck(object):
Expand Down Expand Up @@ -41,6 +42,10 @@ def __init__(
"""
self.reduce_path = reduce_path
self.clash_tolerance = clash_tolerance

# Check if reduce is installed
if not is_reduce_installed(reduce_path):
print_reduce_warning()

def load_protein_from_pdb(self, pdb_path: str) -> None:
"""Load a protein from a PDB file.
Expand Down Expand Up @@ -113,7 +118,7 @@ def calculate_clashes(self) -> int:

def calculate_strain_energy(self) -> float:
"""Calculate the strain energy of the ligand."""
return [get_strain_energy(mol) for mol in self.ligands]
return [calculate_strain_energy(mol) for mol in self.ligands]

def calculate_interactions(self) -> pd.DataFrame:
"""Calculate the interactions between the protein and the ligand."""
Expand Down
Loading
Loading