diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 2102670c5..0a21020ca 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -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}
diff --git a/.github/actions/install-python-and-package/action.yml b/.github/actions/install-python-and-package/action.yml
index 4887709d1..510da80a7 100644
--- a/.github/actions/install-python-and-package/action.yml
+++ b/.github/actions/install-python-and-package/action.yml
@@ -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
@@ -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:
@@ -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 }}]'
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b62565144..6b1ad6ee3 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -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
\ No newline at end of file
+ run: python3 -m build
diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml
index cdec5534e..a59459c20 100644
--- a/.github/workflows/coveralls.yml
+++ b/.github/workflows/coveralls.yml
@@ -37,11 +37,14 @@ 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
@@ -49,4 +52,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.github_token }}
COVERALLS_FLAG_NAME: python-${{ matrix.os }}
run: |
- coveralls --service=github
\ No newline at end of file
+ coveralls --service=github
diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml
index c750b6dc4..4c0e1c9f4 100644
--- a/.github/workflows/linting.yml
+++ b/.github/workflows/linting.yml
@@ -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
\ No newline at end of file
+ run: prospector --die-on-tool-error
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 1baa5437b..e5c3d6350 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -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
diff --git a/.gitignore b/.gitignore
index 6a2314b46..827d85d1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,4 +41,6 @@ docs/apidocs
#other
*_.ipynb
-Untitled*
\ No newline at end of file
+Untitled*
+data_raw/
+data_processed/
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 9734d1a84..000000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,3 +0,0 @@
-include LICENSE
-include README.md
-recursive-include deeprank2 *
\ No newline at end of file
diff --git a/README.md b/README.md
index c7eb9ddb7..4ca81b767 100644
--- a/README.md
+++ b/README.md
@@ -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)
@@ -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.
+* [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
@@ -84,28 +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 SRV data, and for the training pipeline.
+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 SVR data, and for the training pipeline.
For more details, see the [extended documentation](https://deeprank2.rtfd.io/).
### Data generation
@@ -319,10 +313,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
diff --git a/deeprank2/tools/plotgraph.py b/deeprank2/tools/plotgraph.py
deleted file mode 100644
index be78e727b..000000000
--- a/deeprank2/tools/plotgraph.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-
-import os
-
-from deeprank2.tools.visualization.h5x_menu import context_menu
-from h5xplorer.h5xplorer import h5xplorer
-
-baseimport = os.path.dirname(
- os.path.abspath(__file__)) + "/baseimport.py"
-app = h5xplorer(context_menu,
- baseimport=baseimport, extended_selection=False)
diff --git a/deeprank2/tools/visualization/__init__.py b/deeprank2/tools/visualization/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/deeprank2/tools/visualization/baseimport.py b/deeprank2/tools/visualization/baseimport.py
deleted file mode 100644
index 9c825cf4d..000000000
--- a/deeprank2/tools/visualization/baseimport.py
+++ /dev/null
@@ -1,21 +0,0 @@
-import plotly.offline as py
-from deeprank2.tools.visualization.plotting import (hdf5_to_networkx,
- plotly_2d, plotly_3d)
-
-
-def tsne_graph(grp, method):
-
- py.init_notebook_mode(connected=True)
-
- g = hdf5_to_networkx(grp)
-
- plotly_2d(g, offline=True, iplot=False, method=method)
-
-
-def graph3d(grp):
-
- py.init_notebook_mode(connected=True)
-
- g = hdf5_to_networkx(grp)
-
- plotly_3d(g, offline=True, iplot=False)
diff --git a/deeprank2/tools/visualization/embedding.py b/deeprank2/tools/visualization/embedding.py
deleted file mode 100644
index e42dcfe19..000000000
--- a/deeprank2/tools/visualization/embedding.py
+++ /dev/null
@@ -1,17 +0,0 @@
-from sklearn.manifold import MDS, TSNE, SpectralEmbedding
-
-
-def manifold_embedding(pos,method='tsne'):
- n_components = 2
- n_neighbors = 100
-
- if method == 'tsne':
- tsne = TSNE(n_components=n_components, init='pca', random_state=0, perplexity=5.0)
- Y = tsne.fit_transform(pos)
- elif method == 'spectral':
- se = SpectralEmbedding(n_components=n_components,n_neighbors=n_neighbors)
- Y = se.fit_transform(pos)
- elif method == 'mds':
- mds = MDS(n_components, max_iter=100, n_init=1)
- Y = mds.fit_transform(pos)
- return Y
diff --git a/deeprank2/tools/visualization/h5x_menu.py b/deeprank2/tools/visualization/h5x_menu.py
deleted file mode 100644
index 5dc72e539..000000000
--- a/deeprank2/tools/visualization/h5x_menu.py
+++ /dev/null
@@ -1,82 +0,0 @@
-from h5xplorer.menu_plot import plot2d, plot_histogram, plot_line
-from h5xplorer.menu_tools import (get_current_hdf5_group, get_current_item,
- get_group_data, get_multilevel_actions,
- send_dict_to_console)
-
-
-def context_menu(self, treeview, position): # noqa: MC0001
- """Generate a right-click menu for the items."""
-
- all_item = get_current_item(self, treeview, single=False)
-
- if len(all_item) == 1:
-
- item = all_item[0]
- data = get_group_data(get_current_hdf5_group(self, item))
-
- if data is None:
- list_operations = ['Print attrs', 'tSNE Graph', '3D Plot']
- list_sub = [[], ['Louvain', 'MCL'], []]
-
- elif data.ndim == 1:
- list_operations = ['Print attrs',
- '-', 'Plot Hist', 'Plot Line']
-
- elif data.ndim == 2:
- list_operations = ['Print attrs',
- '-', 'Plot Hist', 'Plot Map']
-
- else:
- list_operations = ['Print attrs']
-
- #action,actions = get_actions(treeview,position,list_operations)
- action, actions = get_multilevel_actions(
- treeview, position, list_operations, list_sub)
-
- if action == actions['Print attrs']:
- send_dict_to_console(self, item, treeview)
-
- if 'Plot Hist' in actions:
- if action == actions['Plot Hist']:
- plot_histogram(self, item, treeview)
-
- if 'Plot Line' in actions:
- if action == actions['Plot Line']:
- plot_line(self, item, treeview)
-
- if 'Plot Map' in actions:
- if action == actions['Plot Map']:
- plot2d(self, item, treeview)
-
- if ('tSNE Graph', 'Louvain') in actions:
- if action == actions[('tSNE Graph', 'Louvain')]:
-
- grp = get_current_hdf5_group(self, item)
- data_dict = {'_grp': grp}
- treeview.emitDict.emit(data_dict)
-
- cmd = "tsne_graph(_grp,'louvain')"
- data_dict = {'exec_cmd': cmd}
- treeview.emitDict.emit(data_dict)
-
- if ('tSNE Graph', 'MCL') in actions:
- if action == actions[('tSNE Graph', 'MCL')]:
-
- grp = get_current_hdf5_group(self, item)
- data_dict = {'_grp': grp}
- treeview.emitDict.emit(data_dict)
-
- cmd = "tsne_graph(_grp,'mcl')"
- data_dict = {'exec_cmd': cmd}
- treeview.emitDict.emit(data_dict)
-
- if '3D Plot' in actions:
- if action == actions['3D Plot']:
-
- grp = get_current_hdf5_group(self, item)
- data_dict = {'_grp': grp}
- treeview.emitDict.emit(data_dict)
-
- cmd = 'graph3d(_grp)'
- data_dict = {'exec_cmd': cmd}
- treeview.emitDict.emit(data_dict)
diff --git a/deeprank2/tools/visualization/plotting.py b/deeprank2/tools/visualization/plotting.py
deleted file mode 100644
index d60395631..000000000
--- a/deeprank2/tools/visualization/plotting.py
+++ /dev/null
@@ -1,419 +0,0 @@
-import logging
-from copy import deepcopy
-from typing import Optional
-
-import community
-import h5py
-import markov_clustering
-import matplotlib.pyplot as plt
-import networkx
-import numpy as np
-import plotly.graph_objs as go
-
-from deeprank2.domain import edgestorage as Efeat
-from deeprank2.domain import nodestorage as Nfeat
-from deeprank2.tools.visualization.embedding import manifold_embedding
-
-_log = logging.getLogger(__name__)
-
-
-def _get_node_key(value):
- if isinstance(value, str):
- return value
-
- key = ""
- for item in value:
- if isinstance(item, (bytes, np.bytes_)):
- key = item.decode()
-
- elif isinstance(item, str):
- key += item
-
- else:
- key += str(item)
-
- return key
-
-
-def hdf5_to_networkx(graph_group: h5py.Group) -> networkx.Graph: # pylint: disable=too-many-locals
- """Read a hdf5 group into a networkx graph."""
-
- graph = networkx.Graph()
-
- # read nodes
- node_features_group = graph_group[Nfeat.NODE]
- node_names = [_get_node_key(key) for key in node_features_group[Nfeat.NAME][()]]
- node_features = {}
- node_feature_names = list(node_features_group.keys())
- for node_feature_name in node_feature_names:
- node_features[node_feature_name] = node_features_group[node_feature_name][()]
-
- for node_index, node_name in enumerate(node_names):
- graph.add_node(node_name)
- for node_feature_name in node_feature_names:
- graph.nodes[node_name][node_feature_name] = node_features[
- node_feature_name
- ][node_index]
-
- # read edges
- edge_features_group = graph_group[Efeat.EDGE]
- edge_names = edge_features_group[Efeat.NAME][()]
- edge_node_indices = edge_features_group[Efeat.INDEX][()]
- edge_features = {}
- edge_feature_names = list(edge_features_group.keys())
- for edge_feature_name in edge_feature_names:
- edge_features[edge_feature_name] = edge_features_group[edge_feature_name][()]
-
- for edge_index, _ in enumerate(edge_names):
- node1_index, node2_index = edge_node_indices[edge_index]
- node1_name = node_names[node1_index]
- node2_name = node_names[node2_index]
- edge_key = (node1_name, node2_name)
-
- graph.add_edge(node1_name, node2_name)
- for edge_feature_name in edge_feature_names:
- graph.edges[edge_key][edge_feature_name] = edge_features[edge_feature_name][
- edge_index
- ]
-
- return graph
-
-
-def _get_edge_type_name(value):
- if isinstance(value, (bytes, np.bytes_)):
-
- return value.decode()
-
- return value
-
-
-def plotly_2d( # noqa
- graph: networkx.Graph,
- out: Optional[str] = None,
- offline: bool = False,
- iplot: bool = True,
- disable_plot: bool = False,
- method: str = "louvain",
-):
- """Plots the interface graph in 2D."""
-
- if offline:
- import plotly.offline as py # pylint: disable=import-outside-toplevel
- else:
- import chart_studio.plotly as py # pylint: disable=import-outside-toplevel
-
- pos = np.array(
- [v.tolist() for _, v in networkx.get_node_attributes(graph, Nfeat.POSITION).items()]
- )
- pos2d = manifold_embedding(pos)
- dict_pos = dict(zip(graph.nodes, pos2d))
- networkx.set_node_attributes(graph, dict_pos, "pos2d")
-
- # remove interface edges for clustering
- gtmp = deepcopy(graph)
- ebunch = []
- for e in graph.edges:
- if graph.edges[e][Efeat.SAMECHAIN] == 0.0:
- ebunch.append(e)
- gtmp.remove_edges_from(ebunch)
-
- if method == "louvain":
- cluster = community.best_partition(gtmp)
-
- elif method == "mcl":
- matrix = networkx.to_scipy_sparse_matrix(gtmp)
- # run MCL with default parameters
- result = markov_clustering.run_mcl(matrix.toarray())
- mcl_clust = markov_clustering.get_clusters(result) # get clusters
- cluster = {}
- node_key = list(graph.nodes.keys())
- for ic, c in enumerate(mcl_clust):
- for node in c:
- cluster[node_key[node]] = ic
-
- # get the colormap for the clsuter line
- ncluster = np.max([v for _, v in cluster.items()]) + 1
- cmap = plt.cm.nipy_spectral
- N = cmap.N
- cmap = [cmap(i) for i in range(N)]
- cmap = cmap[:: int(N / ncluster)]
- cmap = "plasma"
-
- edge_trace_list, internal_edge_trace_list = [], []
-
- node_connect = {}
- for edge in graph.edges:
-
- same_chain = graph.edges[edge[0], edge[1]][Efeat.SAMECHAIN]
- if same_chain == 1.0: # internal
- trace = go.Scatter(
- x=[],
- y=[],
- text=[],
- mode="lines",
- hoverinfo=None,
- showlegend=False,
- line=go.scatter.Line(color="rgb(110,110,110)", width=3),
- )
-
- if same_chain == 0.0: # interface
- trace = go.Scatter(
- x=[],
- y=[],
- text=[],
- mode="lines",
- hoverinfo=None,
- showlegend=False,
- line=go.scatter.Line(color="rgb(210,210,210)", width=1),
- )
- else:
- continue
-
- x0, y0 = graph.nodes[edge[0]]["pos2d"]
- x1, y1 = graph.nodes[edge[1]]["pos2d"]
-
- trace["x"] += (x0, x1, None)
- trace["y"] += (y0, y1, None)
-
- if same_chain == 1.0: # internal
- internal_edge_trace_list.append(trace)
-
- if same_chain == 0.0: # interface
- edge_trace_list.append(trace)
-
- for i in [0, 1]:
- if edge[i] not in node_connect:
- node_connect[edge[i]] = 1
- else:
- node_connect[edge[i]] += 1
- node_trace_a = go.Scatter(
- x=[],
- y=[],
- text=[],
- mode="markers",
- hoverinfo="text",
- marker=dict(
- color="rgb(227,28,28)",
- size=[],
- line=dict(color=[], width=4, colorscale=cmap),
- ),
- )
- # 'rgb(227,28,28)'
- node_trace_b = go.Scatter(
- x=[],
- y=[],
- text=[],
- mode="markers",
- hoverinfo="text",
- marker=dict(
- color="rgb(0,102,255)",
- size=[],
- line=dict(color=[], width=4, colorscale=cmap),
- ),
- )
- # 'rgb(0,102,255)'
- node_trace = [node_trace_a, node_trace_b]
-
- for x, node in enumerate(graph.nodes):
-
- index = 0
- if Nfeat.CHAINID in graph.nodes[node]:
- if x == 0:
- first_chain = graph.nodes[node][Nfeat.CHAINID]
- if graph.nodes[node][Nfeat.CHAINID] != first_chain: # This is not very pythonic, but somehow I'm stuck on how to do this without enumerating
- index = 1
-
- pos = graph.nodes[node]["pos2d"]
-
- node_trace[index]["x"] += (pos[0],)
- node_trace[index]["y"] += (pos[1],)
- node_trace[index]["text"] += (
- "[Clst:" + str(cluster[node]) + "] " + " ".join(node),
- )
-
- nc = node_connect[node]
- node_trace[index]["marker"]["size"] += (5 + 15 * np.tanh(nc / 5),)
- node_trace[index]["marker"]["line"]["color"] += (cluster[node],)
-
- fig = go.Figure(
- data=[*internal_edge_trace_list, *edge_trace_list, *node_trace],
- layout=go.Layout(
- title="
tSNE connection graph",
- titlefont=dict(size=16),
- showlegend=False,
- hovermode="closest",
- margin=dict(b=20, l=5, r=5, t=40),
- annotations=[
- dict(
- text="",
- showarrow=False,
- xref="paper",
- yref="paper",
- x=0.005,
- y=-0.002,
- )
- ],
- xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
- yaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
- ),
- )
-
- if not disable_plot:
- if iplot:
- py.iplot(fig, filename=out)
- else:
- py.plot(fig)
-
-
-def plotly_3d( # pylint: disable=too-many-locals, too-many-branches # noqa: MC0001
- graph: networkx.Graph,
- out: Optional[str] = None,
- offline: bool = False,
- iplot: bool = True,
- disable_plot: bool = False,
-):
- """Plots interface graph in 3D.
-
- Args:
- graph (:class:`networkx.Graph`): The graph to be plotted.
- out (str, optional): Defaults to None.
- offline (bool, optional): Defaults to False.
- iplot (bool, optional): Defaults to True.
- disable_plot (bool, optional): Defaults to False.
- """
-
- if offline:
- import plotly.offline as py # pylint: disable=import-outside-toplevel
- else:
- import chart_studio.plotly as py # pylint: disable=import-outside-toplevel
-
- edge_trace_list, internal_edge_trace_list = [], []
- node_connect = {}
-
- for edge in graph.edges:
-
- same_chain = graph.edges[edge[0], edge[1]][Efeat.SAMECHAIN]
- if same_chain == 1.0: # internal
- trace = go.Scatter3d(
- x=[],
- y=[],
- z=[],
- text=[],
- mode="lines",
- hoverinfo=None,
- showlegend=False,
- line=go.scatter3d.Line(color="rgb(110,110,110)", width=5),
- )
-
- elif same_chain == 0.0: # interface
- trace = go.Scatter3d(
- x=[],
- y=[],
- z=[],
- text=[],
- mode="lines",
- hoverinfo=None,
- showlegend=False,
- line=go.scatter3d.Line(color="rgb(210,210,210)", width=2),
- )
- else:
- continue
-
- x0, y0, z0 = graph.nodes[edge[0]][Nfeat.POSITION]
- x1, y1, z1 = graph.nodes[edge[1]][Nfeat.POSITION]
-
- trace["x"] += (x0, x1, None)
- trace["y"] += (y0, y1, None)
- trace["z"] += (z0, z1, None)
-
- if same_chain == 1.0: # internal
- internal_edge_trace_list.append(trace)
-
- elif same_chain == 0.0: # interface
- edge_trace_list.append(trace)
-
- for i in [0, 1]:
- if edge[i] not in node_connect:
- node_connect[edge[i]] = 1
- else:
- node_connect[edge[i]] += 1
-
- node_trace_a = go.Scatter3d(
- x=[],
- y=[],
- z=[],
- text=[],
- mode="markers",
- hoverinfo="text",
- marker=dict(
- color="rgb(227,28,28)",
- size=[],
- symbol="circle",
- line=dict(color="rgb(50,50,50)", width=2),
- ),
- )
-
- node_trace_b = go.Scatter3d(
- x=[],
- y=[],
- z=[],
- text=[],
- mode="markers",
- hoverinfo="text",
- marker=dict(
- color="rgb(0,102,255)",
- size=[],
- symbol="circle",
- line=dict(color="rgb(50,50,50)", width=2),
- ),
- )
-
- node_trace = [node_trace_a, node_trace_b]
-
- for x, node in enumerate(graph.nodes):
-
- index = 0
- if Nfeat.CHAINID in graph.nodes[node]:
- if x == 0:
- first_chain = graph.nodes[node][Nfeat.CHAINID]
- if graph.nodes[node][Nfeat.CHAINID] != first_chain: # This is not very puythonic, but somehow I'm stuck on how to do this without enumerating
- index = 1
-
- pos = graph.nodes[node][Nfeat.POSITION]
-
- node_trace[index]["x"] += (pos[0],)
- node_trace[index]["y"] += (pos[1],)
- node_trace[index]["z"] += (pos[2],)
- node_trace[index]["text"] += (" ".join(node),)
-
- nc = node_connect[node]
- node_trace[index]["marker"]["size"] += (5 + 15 * np.tanh(nc / 5),)
-
- fig = go.Figure(
- data=[*node_trace, *internal_edge_trace_list, *edge_trace_list],
- layout=go.Layout(
- title="
Connection graph",
- titlefont=dict(size=16),
- showlegend=False,
- hovermode="closest",
- margin=dict(b=20, l=5, r=5, t=40),
- annotations=[
- dict(
- text="",
- showarrow=False,
- xref="paper",
- yref="paper",
- x=0.005,
- y=-0.002,
- )
- ],
- xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
- yaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
- ),
- )
-
- if not disable_plot:
- if iplot:
- py.iplot(fig, filename=out)
- else:
- py.plot(fig)
diff --git a/docs/getstarted.md b/docs/getstarted.md
index 827aa0ac4..12fe532b4 100644
--- a/docs/getstarted.md
+++ b/docs/getstarted.md
@@ -412,7 +412,3 @@ fig.update_layout(
title='Loss vs epochs'
)
```
-
-## 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`.
diff --git a/docs/installation.md b/docs/installation.md
index 086e41d30..7d1b0af9b 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -1,53 +1,50 @@
# 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`
-
-## DeepRank2 Package
-
-Once the dependencies installed, you can install the latest release of deeprank2 using the PyPi package manager:
+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.
+* [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
+
+Once the dependencies are installed, you can install the latest stable release of deeprank2 using the PyPi package manager:
```bash
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).
diff --git a/pyproject.toml b/pyproject.toml
index b56b80cf8..f6dd8d8f1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,84 @@
[build-system]
-requires = ["setuptools", "wheel"]
+requires = ["setuptools"]
build-backend = "setuptools.build_meta"
-[tool.pytest.ini_options]
-testpaths = ["tests"]
\ No newline at end of file
+[project]
+name = "deeprank2"
+version = "2.0.0"
+description = "DeepRank2 is an open-source deep learning framework for data mining of protein-protein interfaces or single-residue missense variants."
+readme = "README.md"
+requires-python = ">=3.10"
+keywords = [
+ "graph neural network",
+ "convolutional neural network",
+ "protein-protein interfaces",
+ "missense variants",
+ "deep learning",
+ "pytorch"]
+authors = [
+ {name = "Giulia Crocioni", email = "g.crocioni@esciencecenter.nl"},
+ {name = "Coos Baakman", email = "coos.baakman@radboudumc.nl"},
+ {name = "Dani Bodor", email = "d.bodor@esciencecenter.nl"},
+ {name = "Daniel Rademaker"},
+ {name = "Gayatri Ramakrishnan"},
+ {name = "Sven van der Burg"},
+ {name = "Li Xue"},
+ {name = "Daniil Lepikhov"},
+ ]
+license = {text = "Apache-2.0 license"}
+classifiers = [
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: Apache Software License",
+ "Natural Language :: English",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.10"
+]
+dependencies = [
+ "tables >= 3.8.0",
+ "numpy >= 1.21.5",
+ "scipy >= 1.11.2",
+ "h5py >= 3.6.0",
+ "networkx >= 2.6.3",
+ "matplotlib >= 3.5.1",
+ "pdb2sql >= 0.5.1",
+ "scikit-learn >= 1.0.2",
+ "chart-studio >= 1.1.0",
+ "biopython >= 1.81",
+ "python-louvain >= 0.16",
+ "markov-clustering >= 0.0.6.dev0",
+ "tqdm >= 4.63.0",
+ "freesasa >= 2.1.0",
+ "tensorboard >= 0.9.0",
+ "protobuf >= 3.20.1"
+]
+
+[project.optional-dependencies]
+# development dependency groups
+test = [
+ "pytest >= 7.4.0",
+ "pylint <= 2.15.3",
+ "prospector[with_pyroma] <= 1.7.7",
+ "bump2version",
+ "coverage",
+ "pycodestyle",
+ "pytest-cov",
+ "pytest-runner",
+ "coveralls",
+]
+publishing = [
+ "build",
+ "twine",
+ "wheel",
+]
+
+[project.urls]
+Documentation = "https://deeprank2.readthedocs.io/en/latest/?badge=latest"
+Repository = "https://github.com/DeepRank/deeprank2"
+Changelog = "https://github.com/DeepRank/deeprank2/blob/main/CHANGELOG.md"
+
+[tool.coverage.run]
+branch = true
+source = ["deeprank2"]
+
+[tool.setuptools]
+packages = ["deeprank2"]
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 2fb747254..000000000
--- a/setup.cfg
+++ /dev/null
@@ -1,89 +0,0 @@
-[metadata]
-name = deeprank2
-authors = [
- { name = "Giulia Crocioni", email = "g.crocioni@esciencecenter.nl"},
- { name = "Coos Baakman", email = "coos.baakman@radboudumc.nl"},
- { name = "Dani Bodor", email = "d.bodor@esciencecenter.nl"},
- { name = "Daniel Rademaker"},
- { name = "Gayatri Ramakrishnan"},
- { name = "Sven van der Burg"},
- { name = "Li Xue"},
- { name = "Daniil Lepikhov"},
- ]
-
-classifiers =
- Intended Audience :: Developers
- License :: OSI Approved :: Apache Software License
- Natural Language :: English
- Programming Language :: Python :: 3
- Programming Language :: Python :: 3.9
- Programming Language :: Python :: 3.10
-description = deeprank2 allows to train graph neural networks to classify protein-protein interfaces with a greater flexibility for the user.
-keywords =
- graph neural network
- protein-protein interface
- pytorch
-long_description = file: README.md
-long_description_content_type = text/markdown
-project_urls =
- Bug Tracker = https://github.com/DeepRank/deeprank2/issues
-url = https://github.com/DeepRank/deeprank2
-version = 2.0.0
-
-[options]
-zip_safe = False
-include_package_data = True
-packages = find_namespace:
-python_requires = >= 3.9
-install_requires =
- tables >= 3.7
- numpy >= 1.21.5
- scipy >= 1.11.2
- h5py >= 3.6.0
- networkx >= 2.6.3
- matplotlib >= 3.5.1
- pdb2sql >= 0.5.1
- scikit-learn >= 1.0.2
- chart-studio >= 1.1.0
- biopython >= 1.81
- python-louvain >= 0.16
- markov-clustering >= 0.0.6.dev0
- tqdm >= 4.63.0
- freesasa == 2.1.0
- tensorboard >= 2.9.0
- protobuf <= 3.20.1
-
-[options.extras_require]
-dev =
- yapf
-doc =
- myst-parser
- sphinx
- sphinx_rtd_theme
-test =
- pytest
- pylint <= 2.15.3
- prospector[with_pyroma] <= 1.7.7
- bump2version
- coverage
- pycodestyle
- pytest-cov
- pytest-runner
- coveralls
-publishing =
- build
- twine
- wheel
-tutorials =
- notebook
- pytest
- plotly
- jupyterlab
-
-[options.packages.find]
-include = deeprank2, deeprank2.*
-exclude = tests, tests.*
-
-[coverage:run]
-branch = True
-source = deeprank2
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 5b5b22c42..000000000
--- a/setup.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env python
-from setuptools import setup
-
-# see setup.cfg
-setup()
\ No newline at end of file
diff --git a/tests/tools/test_visualization.py b/tests/tools/test_visualization.py
deleted file mode 100644
index 00d720a3c..000000000
--- a/tests/tools/test_visualization.py
+++ /dev/null
@@ -1,34 +0,0 @@
-import unittest
-import warnings
-
-import h5py
-import numpy as np
-from deeprank2.tools.visualization.embedding import manifold_embedding
-from deeprank2.tools.visualization.plotting import (hdf5_to_networkx,
- plotly_2d, plotly_3d)
-
-
-class TestGraph(unittest.TestCase):
- def setUp(self):
- with h5py.File("tests/data/hdf5/1ATN_ppi.hdf5", "r") as f5:
- self.networkx_graph = hdf5_to_networkx(f5["residue-ppi-1ATN_1w:A-B"])
-
- self.pdb_path = "tests/data/pdb/1ATN/1ATN_1w.pdb"
- self.reference_path = "tests/data/pdb/1ATN/1ATN_2w.pdb"
-
- def test_plot_2d(self):
- with warnings.catch_warnings(record=FutureWarning):
- plotly_2d(self.networkx_graph, "1ATN", disable_plot=True)
-
- def test_plot_3d(self):
- plotly_3d(self.networkx_graph, "1ATN", disable_plot=True)
-
- def test_embedding(self):
- pos = np.random.rand(110, 3)
- for method in ["tsne", "spectral", "mds"]:
- with warnings.catch_warnings(record=FutureWarning):
- _ = manifold_embedding(pos, method=method)
-
-
-if __name__ == "__main__":
- unittest.main()