Skip to content

Commit

Permalink
Merge branch 'main' into 480_new
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniBodor committed Sep 20, 2023
2 parents 0ac01c5 + 7fdf6ab commit b6b6203
Show file tree
Hide file tree
Showing 41 changed files with 397 additions and 976 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ comment = The contents of this file cannot be merged with that of setup.cfg unti
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

[bumpversion:file:setup.cfg]
[bumpversion:file:pyproject.toml]
search = version = {current_version}
replace = version = {new_version}

Expand Down
85 changes: 60 additions & 25 deletions .github/actions/install-python-and-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ inputs:

python-version:
required: false
description: "The Python version to use. Specify major and minor version, e.g. '3.9'."
default: "3.9"
description: "The Python version to use. Specify major and minor version, e.g. '3.10'."
default: "3.10"

extras-require:
required: false
Expand All @@ -24,12 +24,6 @@ runs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
cache-dependency-path: setup.cfg

- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
Expand All @@ -38,29 +32,70 @@ runs:
conda-channels: anaconda
- run: conda --version
shell: bash {0}
- run: which python
shell: bash {0}

- name: Upgrade pip and install dependencies
- name: Python info
shell: bash -e {0}
run: |
which python3
python3 --version
- name: Install dependencies on Linux
shell: bash {0}
env:
CMAKE_INSTALL_PREFIX: .local
if: runner.os == 'Linux'
run: |
python3 -m pip install --upgrade pip setuptools wheel
# Install dssp
# Install dependencies not handled by setuptools
## DSSP
sudo apt-get install -y dssp
# Only way to install msms is through conda
## MSMS
conda install -c bioconda msms
# Safest way to install PyTorch and PyTorch Geometric is through conda
conda install pytorch==2.0.0 torchvision=0.15.0 torchaudio=2.0.0 cpuonly -c pytorch
## PyTorch, PyG, PyG adds
### Installing for CPU only on the CI
conda install pytorch torchvision torchaudio cpuonly -c pytorch
conda install pyg -c pyg
# Install optional pyg dependencies
python3 -m pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-$(python3 -c "import torch; print(torch.__version__)")+cpu.html
# In the future, release h5xplorer on PyPI
pip install git+https://github.com/DeepRank/h5xplorer.git@master
- name: Install the package
pip install torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-$(python3 -c "import torch; print(torch.__version__)")+cpu.html
- name: Install dependencies on MacOS
shell: bash {0}
run: python3 -m pip install .[${{ inputs.extras-require }}]
env:
CONDA_PREFIX: /usr/share/miniconda
CMAKE_INSTALL_PREFIX: .local
if: runner.os == 'macOS'
run: |
# Install dependencies not handled by setuptools
## DSSP
git clone https://github.com/PDB-REDO/libcifpp.git --recurse-submodules
cd libcifpp
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
#######
git clone https://github.com/mhekkel/libmcfp.git
cd libmcfp
mkdir build
cd build
cmake ..
cmake --build .
cmake --install .
#######
git clone https://github.com/PDB-REDO/dssp.git
cd dssp
mkdir build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
## MSMS
cd /tmp/
wget http://mgltools.scripps.edu/downloads/tars/releases/MSMSRELEASE/REL2.6.1/msms_i86Linux2_2.6.1.tar.gz
sudo mkdir /usr/local/lib/msms
cd /usr/local/lib/msms
sudo tar zxvf /tmp/msms_i86Linux2_2.6.1.tar.gz
sudo ln -s /usr/local/lib/msms/msms.i86Linux2.2.6.1 /usr/local/bin/msms
sudo ln -s /usr/local/lib/msms/pdb_to_xyzr* /usr/local/bin
## PyTorch, PyG, PyG adds
### Installing for CPU only on the CI
conda install pytorch torchvision torchaudio cpuonly -c pytorch
pip install torch_geometric
pip install torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-$(python3 -c "import torch; print(torch.__version__)")+cpu.html
# PyTables via conda only for MacOS
conda install pytables
- name: Install the package
shell: bash {0}
run: pip install .'[${{ inputs.extras-require }}]'
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3.9', '3.10']
python-version: ['3.10', '3.11']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-python-and-package
with:
python-version: ${{ matrix.python-version }}
extras-require: test, publishing
- name: Run unit tests
env:
CONDA_PREFIX: /usr/share/miniconda
run: |
pytest -v
run: pytest -v
- name: Verify that we can build the package
run: python3 setup.py sdist bdist_wheel
run: python3 -m build
7 changes: 5 additions & 2 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: [3.9]
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-python-and-package
with:
python-version: ${{ matrix.python-version }}
extras-require: test
- name: Run unit tests with coverage
run: pytest --cov --cov-append --cov-report xml --cov-report term --cov-report html
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COVERALLS_FLAG_NAME: python-${{ matrix.os }}
run: |
coveralls --service=github
coveralls --service=github
7 changes: 5 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: [3.9]
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-python-and-package
with:
python-version: ${{ matrix.python-version }}
extras-require: test
- name: Check style against standards using prospector
run: prospector --die-on-tool-error
run: prospector --die-on-tool-error
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: [3.9]
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-python-and-package
with:
python-version: ${{ matrix.python-version }}
extras-require: publishing
- name: Build wheel and source distribution
run: python -m build
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ docs/apidocs

#other
*_.ipynb
Untitled*
Untitled*
data_raw/
data_processed/
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

58 changes: 25 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
| **fairness** | [![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green)](https://fair-software.eu) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/6403/badge)](https://bestpractices.coreinfrastructure.org/projects/6403) |
| **package** | [![PyPI version](https://badge.fury.io/py/deeprank2.svg)](https://badge.fury.io/py/deeprank2) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/f3f98b2d1883493ead50e3acaa23f2cc)](https://app.codacy.com/gh/DeepRank/deeprank2?utm_source=github.com&utm_medium=referral&utm_content=DeepRank/deeprank2&utm_campaign=Badge_Grade) |
| **docs** | [![Documentation Status](https://readthedocs.org/projects/deeprank2/badge/?version=latest)](https://deeprank2.readthedocs.io/en/latest/?badge=latest) [![DOI](https://zenodo.org/badge/450496579.svg)](https://zenodo.org/badge/latestdoi/450496579) |
| **tests** | [![Build Status](https://github.com/DeepRank/deeprank2/actions/workflows/build.yml/badge.svg)](https://github.com/DeepRank/deeprank2/actions) ![Linting status](https://github.com/DeepRank/deeprank2/actions/workflows/linting.yml/badge.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/DeepRank/deeprank2/badge.svg?branch=main)](https://coveralls.io/github/DeepRank/deeprank2?branch=main) |
| **tests** | [![Build Status](https://github.com/DeepRank/deeprank2/actions/workflows/build.yml/badge.svg)](https://github.com/DeepRank/deeprank2/actions) ![Linting status](https://github.com/DeepRank/deeprank2/actions/workflows/linting.yml/badge.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/DeepRank/deeprank2/badge.svg?branch=main)](https://coveralls.io/github/DeepRank/deeprank2?branch=main) ![Python](https://img.shields.io/badge/python-3.10-blue.svg) ![Python](https://img.shields.io/badge/python-3.11-blue.svg) |
| **running on** | ![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white) |
| **license** | [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/license/apache-2-0/) |


## Overview

![alt-text](./deeprank2.png)
Expand Down Expand Up @@ -46,35 +46,28 @@ DeepRank2 extensive documentation can be found [here](https://deeprank2.rtfd.io/
- [GraphDataset](#graphdataset)
- [GridDataset](#griddataset)
- [Training](#training)
- [h5x support](#h5x-support)
- [Package development](#package-development)

## Installation

The package officially supports ubuntu-latest OS only, whose functioning is widely tested through the continuous integration workflows.

### Dependencies

Before installing deeprank2 you need to install some dependencies. We advise to use a [conda environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) with Python >= 3.9 installed.

* [msms](https://ssbio.readthedocs.io/en/latest/instructions/msms.html): `conda install -c bioconda msms`. *For MacOS with M1 chip users*: you can follow [these instructions](https://ssbio.readthedocs.io/en/latest/instructions/msms.html).
* [PyTorch](https://pytorch.org/):
* CPU only: `conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 cpuonly -c pytorch`
* if using GPU: `conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.7 -c pytorch -c nvidia`
* [pytorch-geometric](https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html): `conda install pyg -c pyg`
* [Dependencies for pytorch geometric from wheels](https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html#installation-from-wheels): `pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html`.
- Here, `${TORCH}` and `${CUDA}` should be replaced by the pytorch and CUDA versions installed. You can find these using:
- `python -c "import torch; print(torch.__version__)"` and
- `python -c "import torch; print(torch.version.cuda)"`
- if this returns `None`, use `cpu` instead
- For example: `pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.0.0+cpu.html`
* Check if [DSSP 4](https://swift.cmbi.umcn.nl/gv/dssp/) is installed: `dssp --version`
* if this gives an error or shows a version lower than 4:
* on ubuntu 22.04 or newer: `sudo apt-get install dssp`.
* If the package cannot be located, first run `sudo apt-get update`.
* on older versions of ubuntu or on mac or lacking sudo priviliges: install from [here](https://github.com/pdb-redo/dssp), following the instructions listed.
* Check if gcc is installed: `gcc --version`.
* if this gives an error, run `sudo apt-get install gcc`.

* For MacOS with M1 chip (otherwise ignore this): `conda install pytables`
Before installing deeprank2 you need to install some dependencies. We advise to use a [conda environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) with Python >= 3.10 installed. The following dependency installation instructions are updated as of 14/09/2023, but in case of issues during installation always refer to the official documentation which is linked below:

* [MSMS](https://anaconda.org/bioconda/msms): `conda install -c bioconda msms`.
* [Here](https://ssbio.readthedocs.io/en/latest/instructions/msms.html) for MacOS with M1 chip users.
* [PyTorch](https://pytorch.org/get-started/locally/)
* We support torch's CPU library as well as CUDA.
* [PyG](https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html) and its optional dependencies: `torch_scatter`, `torch_sparse`, `torch_cluster`, `torch_spline_conv`.
* [DSSP 4](https://swift.cmbi.umcn.nl/gv/dssp/)
* Check if `dssp` is installed: `dssp --version`. If this gives an error or shows a version lower than 4:
* on ubuntu 22.04 or newer: `sudo apt-get install dssp`. If the package cannot be located, first run `sudo apt-get update`.
* on older versions of ubuntu or on mac or lacking sudo priviliges: install from [here](https://github.com/pdb-redo/dssp), following the instructions listed. Alternatively, follow [this](https://github.com/PDB-REDO/libcifpp/issues/49) thread.
* [GCC](https://gcc.gnu.org/install/)
* Check if gcc is installed: `gcc --version`. If this gives an error, run `sudo apt-get install gcc`.
* For MacOS with M1 chip users only install [the conda version of PyTables](https://www.pytables.org/usersguide/installation.html).

### Deeprank2 Package

Expand All @@ -84,26 +77,29 @@ Once the dependencies are installed, you can install the latest stable release o
pip install deeprank2
```

Alternatively, get all the new developments by cloning the repo and installing the code with
Alternatively, get all the new developments by cloning the repo and installing the editable version of the package with:

```bash
git clone https://github.com/DeepRank/deeprank2
cd deeprank2
pip install -e ./
pip install -e .'[test]'
```

The `test` extra is optional, and can be used to install test-related dependencies useful during the development.

### Test installation

If you have installed the package from a cloned repository (second option above), you can check that all components were installed correctly, using pytest.
The quick test should be sufficient to ensure that the software works, while the full test (a few minutes) will cover a much broader range of settings to ensure everything is correct.

First, install [pytest](https://docs.pytest.org/): `pip install pytest`.
Then run `pytest tests/test_integration.py` for the quick test or just `pytest` for the full test (expect a few minutes to run).
Run `pytest tests/test_integration.py` for the quick test or just `pytest` for the full test (expect a few minutes to run).

### Contributing

If you would like to contribute to the package in any way, please see [our guidelines](CONTRIBUTING.rst).

## Quick start

The following section serves as a first guide to start using the package, using Protein-Protein Interface (PPI) queries as example.
For an enhanced learning experience, we provide in-depth [tutorial notebooks](https://github.com/DeepRank/deeprank2/tree/main/tutorials) for generating PPI data, generating variants data, and for the training pipeline.
For more details, see the [extended documentation](https://deeprank2.rtfd.io/).
Expand Down Expand Up @@ -318,10 +314,6 @@ trainer.test()

```

## h5x support

After installing `h5xplorer` (https://github.com/DeepRank/h5xplorer), you can execute the python file `deeprank2/h5x/h5x.py` to explorer the connection graph used by deeprank2. The context menu (right click on the name of the structure) allows to automatically plot the graphs using `plotly`.

## Package development

- Branching
Expand Down
7 changes: 3 additions & 4 deletions deeprank2/features/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
from typing import Optional

import numpy as np
from deeprank2.molstruct.atom import Atom
from deeprank2.molstruct.residue import Residue
from deeprank2.molstruct.variant import SingleResidueVariant
from deeprank2.utils.graph import Graph

from deeprank2.domain import nodestorage as Nfeat
from deeprank2.molstruct.atom import Atom
from deeprank2.molstruct.residue import Residue, SingleResidueVariant
from deeprank2.utils.graph import Graph
from deeprank2.utils.parsing import atomic_forcefield

_log = logging.getLogger(__name__)
Expand Down
7 changes: 3 additions & 4 deletions deeprank2/features/conservation.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from typing import Optional

import numpy as np

from deeprank2.domain import nodestorage as Nfeat
from deeprank2.domain.aminoacidlist import amino_acids
from deeprank2.molstruct.atom import Atom
from deeprank2.molstruct.residue import Residue
from deeprank2.molstruct.variant import SingleResidueVariant
from deeprank2.molstruct.residue import Residue, SingleResidueVariant
from deeprank2.utils.graph import Graph

from deeprank2.domain import nodestorage as Nfeat


def add_features( # pylint: disable=unused-argument
pdb_path: str, graph: Graph,
Expand Down
2 changes: 1 addition & 1 deletion deeprank2/features/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from deeprank2.domain import edgestorage as Efeat
from deeprank2.molstruct.atom import Atom
from deeprank2.molstruct.pair import AtomicContact, ResidueContact
from deeprank2.molstruct.variant import SingleResidueVariant
from deeprank2.molstruct.residue import SingleResidueVariant
from deeprank2.utils.graph import Graph
from deeprank2.utils.parsing import atomic_forcefield

Expand Down
7 changes: 3 additions & 4 deletions deeprank2/features/exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
from Bio.PDB.HSExposure import HSExposureCA
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.ResidueDepth import get_surface, residue_depth
from deeprank2.molstruct.atom import Atom
from deeprank2.molstruct.residue import Residue
from deeprank2.molstruct.variant import SingleResidueVariant
from deeprank2.utils.graph import Graph

from deeprank2.domain import nodestorage as Nfeat
from deeprank2.molstruct.atom import Atom
from deeprank2.molstruct.residue import Residue, SingleResidueVariant
from deeprank2.utils.graph import Graph

_log = logging.getLogger(__name__)

Expand Down
Loading

0 comments on commit b6b6203

Please sign in to comment.