From 47ab592d9069ddf3cf1a2339d11f8138be48573c Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Thu, 20 Jun 2024 16:33:07 +0200 Subject: [PATCH 01/19] add ranges for pip dependenciesw --- pyproject.toml | 52 +++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6c95ec6c..336f82c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,38 +35,38 @@ classifiers = [ "Programming Language :: Python :: 3.10", ] dependencies = [ - "notebook >= 7.0.6", - "markov-clustering >= 0.0.6.dev0", - "tensorboard>=0.9.0", - "protobuf >= 3.20.1", - "dill >= 0.3.8", - "pyarrow >= 15.0.0", - "tables >= 3.8.0", + "notebook >= 7.0.6, < 8.0", + "markov-clustering >= 0.0.6.dev0, < 1.0", + "tensorboard>=0.9.0, < 1.0", + "protobuf >= 3.20.1, < 4.0", + "dill >= 0.3.8, < 1.0", + "pyarrow >= 15.0.0, < 16.0", + "tables >= 3.8.0, < 4.0", "numpy >= 1.25, < 2.0", - "scipy >= 1.13.1", - "h5py >= 3.6.0", - "networkx >= 2.6.3", - "matplotlib >= 3.5.1", - "scikit-learn >= 1.0.2", - "chart-studio >= 1.1.0", - "pdb2sql >= 0.5.1", - "python-louvain >= 0.16", - "tqdm >= 4.63.0", - "freesasa >= 2.1.0", - "biopython >= 1.81" + "scipy >= 1.13.1, < 2.0", + "h5py >= 3.6.0, < 4.0", + "networkx >= 2.6.3, < 3.0", + "matplotlib >= 3.5.1, < 4.0", + "scikit-learn >= 1.0.2, < 2.0", + "chart-studio >= 1.1.0, < 2.0", + "pdb2sql >= 0.5.1, < 1.0", + "python-louvain >= 0.16, < 1.0", + "tqdm >= 4.63.0, < 5.0", + "freesasa >= 2.1.0, < 3.0", + "biopython >= 1.81, < 2.0" ] [project.optional-dependencies] # development dependency groups test = [ - "pytest >= 7.4.0", - "bump2version", - "coverage", - "pycodestyle", - "pytest-cov", - "pytest-runner", - "coveralls", - "ruff>=0.3.0" + "pytest >= 7.4.0, < 8.0", + "bump2version >= 1.0.1, < 2.0", + "coverage >= 6.5.0, < 7.0", + "pycodestyle >= 2.8.0, < 3.0", + "pytest-cov >= 4.1.0, < 5.0", + "pytest-runner >= 6.0.0, < 7.0", + "coveralls >= 3.3.1, < 4.0", + "ruff >= 0.3.0, < 1.0" ] publishing = ["build", "twine", "wheel"] notebooks = ["nbmake"] From fc3782ab9363514efaa6fe704d1ac25a1bdd4d8c Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Thu, 20 Jun 2024 16:41:16 +0200 Subject: [PATCH 02/19] fix tensorboard version range --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 336f82c0..5c156d4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ classifiers = [ dependencies = [ "notebook >= 7.0.6, < 8.0", "markov-clustering >= 0.0.6.dev0, < 1.0", - "tensorboard>=0.9.0, < 1.0", + "tensorboard >= 1.0.0, < 2.0", "protobuf >= 3.20.1, < 4.0", "dill >= 0.3.8, < 1.0", "pyarrow >= 15.0.0, < 16.0", From 3104a31c2bccef93242d145f6b0a5fd174f36cf5 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Thu, 20 Jun 2024 17:24:11 +0200 Subject: [PATCH 03/19] degrade numpy range --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5c156d4a..dbd22d32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dependencies = [ "dill >= 0.3.8, < 1.0", "pyarrow >= 15.0.0, < 16.0", "tables >= 3.8.0, < 4.0", - "numpy >= 1.25, < 2.0", + "numpy >= 1.20, < 1.24", "scipy >= 1.13.1, < 2.0", "h5py >= 3.6.0, < 4.0", "networkx >= 2.6.3, < 3.0", From f458d171048c773551fde50a8a226c9110654874 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Thu, 20 Jun 2024 17:29:32 +0200 Subject: [PATCH 04/19] update min versions pip --- pyproject.toml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index dbd22d32..9e8be130 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,25 +35,25 @@ classifiers = [ "Programming Language :: Python :: 3.10", ] dependencies = [ - "notebook >= 7.0.6, < 8.0", + "notebook >= 7.2.1, < 8.0", "markov-clustering >= 0.0.6.dev0, < 1.0", - "tensorboard >= 1.0.0, < 2.0", - "protobuf >= 3.20.1, < 4.0", + "tensorboard >= 2.17.0, < 3.0", + "protobuf >= 5.27.1, < 6.0", "dill >= 0.3.8, < 1.0", - "pyarrow >= 15.0.0, < 16.0", - "tables >= 3.8.0, < 4.0", - "numpy >= 1.20, < 1.24", + "pyarrow >= 16.1.0, < 17.0", + "tables >= 3.9.2, < 4.0", + "numpy >= 1.25, < 2.0", "scipy >= 1.13.1, < 2.0", - "h5py >= 3.6.0, < 4.0", - "networkx >= 2.6.3, < 3.0", - "matplotlib >= 3.5.1, < 4.0", - "scikit-learn >= 1.0.2, < 2.0", + "h5py >= 3.11.0, < 4.0", + "networkx >= 3.3.3, < 4.0", + "matplotlib >= 3.9.0, < 4.0", + "scikit-learn >= 1.5.0, < 2.0", "chart-studio >= 1.1.0, < 2.0", - "pdb2sql >= 0.5.1, < 1.0", + "pdb2sql >= 0.5.3, < 1.0", "python-louvain >= 0.16, < 1.0", - "tqdm >= 4.63.0, < 5.0", - "freesasa >= 2.1.0, < 3.0", - "biopython >= 1.81, < 2.0" + "tqdm >= 4.66.4, < 5.0", + "freesasa >= 2.1.1, < 3.0", + "biopython >= 1.83, < 2.0" ] [project.optional-dependencies] From 49bf53c1f552debb4268411f44d5c31f75a1c203 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Fri, 21 Jun 2024 10:33:11 +0200 Subject: [PATCH 05/19] fix networkx lower bound version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9e8be130..14a0c4d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ dependencies = [ "numpy >= 1.25, < 2.0", "scipy >= 1.13.1, < 2.0", "h5py >= 3.11.0, < 4.0", - "networkx >= 3.3.3, < 4.0", + "networkx >= 3.1, < 4.0", "matplotlib >= 3.9.0, < 4.0", "scikit-learn >= 1.5.0, < 2.0", "chart-studio >= 1.1.0, < 2.0", From f6260bcaa1b002f36bc6b2ab2188240ab8b8365c Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Fri, 21 Jun 2024 10:39:04 +0200 Subject: [PATCH 06/19] change lower bound protobuf to solve conflict --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 14a0c4d1..8d234757 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "notebook >= 7.2.1, < 8.0", "markov-clustering >= 0.0.6.dev0, < 1.0", "tensorboard >= 2.17.0, < 3.0", - "protobuf >= 5.27.1, < 6.0", + "protobuf >= 5.24.3, < 6.0", "dill >= 0.3.8, < 1.0", "pyarrow >= 16.1.0, < 17.0", "tables >= 3.9.2, < 4.0", From 5befe6250d88b00024345aecc7c5068592bd3a9a Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Fri, 21 Jun 2024 10:50:22 +0200 Subject: [PATCH 07/19] edit lower bounds versions --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8d234757..b735f143 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,8 +37,8 @@ classifiers = [ dependencies = [ "notebook >= 7.2.1, < 8.0", "markov-clustering >= 0.0.6.dev0, < 1.0", - "tensorboard >= 2.17.0, < 3.0", - "protobuf >= 5.24.3, < 6.0", + "tensorboard >= 0.9.0, < 3.0", + "protobuf >= 3.20.1, < 6.0", "dill >= 0.3.8, < 1.0", "pyarrow >= 16.1.0, < 17.0", "tables >= 3.9.2, < 4.0", From f5a9e772d3846beb92f414bf38e8bf740d032e3b Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Fri, 21 Jun 2024 12:02:04 +0200 Subject: [PATCH 08/19] fix conda critical deps --- env/deeprank2.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/env/deeprank2.yml b/env/deeprank2.yml index 423fab5c..f80243ef 100644 --- a/env/deeprank2.yml +++ b/env/deeprank2.yml @@ -7,14 +7,14 @@ channels: - conda-forge - sbl dependencies: - - sbl::libcifpp>=5.1.0 - - sbl::dssp>=4.2.2.1 - - msms>=2.6.1 + - sbl::libcifpp=5.1.0 + - sbl::dssp=4.2.2.1 + - msms=2.6.1 - pytorch=2.1.1 - torchvision>=0.16.1 - torchaudio>=2.1.1 - cpuonly>=2.0 - - pyg>=2.4.0 + - pyg=2.4.0 - pytorch-scatter>=2.1.2 - pytorch-sparse>=0.6.18 - pytorch-cluster>=1.6.3 From 99fc5e0a53493a4243d496897fa432d0928e18a2 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Fri, 21 Jun 2024 15:43:28 +0200 Subject: [PATCH 09/19] add python version spec --- env/deeprank2.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/env/deeprank2.yml b/env/deeprank2.yml index f80243ef..4e5d7b64 100644 --- a/env/deeprank2.yml +++ b/env/deeprank2.yml @@ -7,6 +7,8 @@ channels: - conda-forge - sbl dependencies: + - python=3.10 + - pip>=23.3 - sbl::libcifpp=5.1.0 - sbl::dssp=4.2.2.1 - msms=2.6.1 From 21516185d26c7abed0ce557eeb94eb4966109196 Mon Sep 17 00:00:00 2001 From: Dani Bodor Date: Tue, 9 Jul 2024 10:20:06 +0200 Subject: [PATCH 10/19] ci: update ruff settings --- pyproject.toml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6c95ec6c..1ca3ded9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,10 +91,12 @@ include = ["deeprank2*"] addopts = "-ra" [tool.ruff] +output-format = "concise" line-length = 159 [tool.ruff.lint] select = ["ALL"] +pydocstyle.convention = "google" # docstring settings ignore = [ # Unrealistic for this code base "PTH", # flake8-use-pathlib @@ -117,20 +119,6 @@ ignore = [ "D104", # Missing public package docstring "D105", # Missing docstring in magic method "D107", # Missing docstring in `__init__` - # Docstring rules irrelevant to the Google style - "D203", # 1 blank line required before class docstring - "D204", # 1 blank line required after class docstring - "D212", # Multi-line docstring summary should start at the first line - "D213", # Multi-line docstring summary should start at the second line - "D215", # Section underline is over-indented - "D400", # First line should end with a period (clashes with D415:First line should end with a period, question mark, or exclamation point) - "D401", # First line of docstring should be in imperative mood - "D404", # First word of the docstring should not be This - "D406", # Section name should end with a newline - "D407", # Missing dashed underline after section - "D408", # Section underline should be in the line following the section's name - "D409", # Section underline should match the length of its name - "D413", # Missing blank line after last section ] # Autofix settings From 78422506d6d991c1156934c8e2cd8f6e2503c4bc Mon Sep 17 00:00:00 2001 From: Dani Bodor Date: Tue, 9 Jul 2024 10:20:33 +0200 Subject: [PATCH 11/19] docs: auto fix docstrings --- deeprank2/trainer.py | 27 +++++++++------------------ tests/test_integration.py | 3 +-- tests/test_querycollection.py | 3 +-- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/deeprank2/trainer.py b/deeprank2/trainer.py index ab54a436..799ec135 100644 --- a/deeprank2/trainer.py +++ b/deeprank2/trainer.py @@ -348,8 +348,7 @@ def _precluster(self, dataset: GraphDataset) -> None: f5.close() def _put_model_to_device(self, dataset: GraphDataset | GridDataset) -> None: - """ - Puts the model on the available device. + """Puts the model on the available device. Args: dataset (:class:`GraphDataset` | :class:`GridDataset`): GraphDataset object. @@ -405,8 +404,7 @@ def configure_optimizers( lr: float = 0.001, weight_decay: float = 1e-05, ) -> None: - """ - Configure optimizer and its main parameters. + """Configure optimizer and its main parameters. Args: optimizer (:class:`torch.optim`, optional): PyTorch optimizer object. If none, defaults to :class:`torch.optim.Adam`. @@ -435,8 +433,7 @@ def set_lossfunction( # noqa: C901 lossfunction: nn.modules.loss._Loss | None = None, override_invalid: bool = False, ) -> None: - """ - Set the loss function. + """Set the loss function. Args: lossfunction (optional): Make sure to use a loss function that is appropriate for @@ -524,8 +521,7 @@ def train( # noqa: PLR0915, C901 best_model: bool = True, filename: str | None = "model.pth.tar", ) -> None: - """ - Performs the training of the model. + """Performs the training of the model. Args: nepoch (int, optional): Maximum number of epochs to run. @@ -685,8 +681,7 @@ def train( # noqa: PLR0915, C901 self.model.load_state_dict(self.model_load_state_dict) def _epoch(self, epoch_number: int, pass_name: str) -> float | None: - """ - Runs a single epoch. + """Runs a single epoch. Args: epoch_number (int): the current epoch number @@ -751,8 +746,7 @@ def _eval( epoch_number: int, pass_name: str, ) -> float | None: - """ - Evaluates the model. + """Evaluates the model. Args: loader (Dataloader): Data to evaluate on. @@ -818,8 +812,7 @@ def _eval( @staticmethod def _log_epoch_data(stage: str, loss: float, time: float) -> None: - """ - Prints the data of each epoch. + """Prints the data of each epoch. Args: stage (str): Train or valid. @@ -863,8 +856,7 @@ def test( batch_size: int = 32, num_workers: int = 0, ) -> None: - """ - Performs the testing of the model. + """Performs the testing of the model. Args: batch_size (int, optional): Sets the size of the batch. @@ -935,8 +927,7 @@ def _load_params(self) -> None: self.ngpu = state["ngpu"] def _save_model(self) -> dict[str, Any]: - """ - Saves the model to a file. + """Saves the model to a file. Args: filename (str, optional): Name of the file. Defaults to None. diff --git a/tests/test_integration.py b/tests/test_integration.py index c6ac34ac..b0fce68b 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -32,8 +32,7 @@ def test_cnn() -> None: - """ - Tests processing several PDB files into their features representation HDF5 file. + """Tests processing several PDB files into their features representation HDF5 file. Then uses HDF5 generated files to train and test a CnnRegression network. """ diff --git a/tests/test_querycollection.py b/tests/test_querycollection.py index 7b469465..28cdfea7 100644 --- a/tests/test_querycollection.py +++ b/tests/test_querycollection.py @@ -22,8 +22,7 @@ def _querycollection_tester( cpu_count: int = 1, combine_output: bool = True, ) -> tuple[QueryCollection, str, list[str]]: - """ - Generic function to test QueryCollection class. + """Generic function to test QueryCollection class. Args: query_type (str): query type to be generated. It accepts only 'ppi' (ProteinProteinInterface) or 'srv' (SingleResidueVariant). From fc4662cc3d83eda9547f30e79963db89d4a3e447 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Tue, 9 Jul 2024 10:26:40 +0200 Subject: [PATCH 12/19] fix ruff version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b735f143..f697d526 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ test = [ "pytest-cov >= 4.1.0, < 5.0", "pytest-runner >= 6.0.0, < 7.0", "coveralls >= 3.3.1, < 4.0", - "ruff >= 0.3.0, < 1.0" + "ruff == 0.5.1" ] publishing = ["build", "twine", "wheel"] notebooks = ["nbmake"] From d971eb501a0fa1c006862a685a39d7783b28b354 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Tue, 9 Jul 2024 10:27:57 +0200 Subject: [PATCH 13/19] add freezed env and test it on the ci --- .../install-python-and-package/action.yml | 15 +- .github/workflows/build-repo-freezed-env.yml | 60 +++++ env/deeprank2_freezed.yml | 234 ++++++++++++++++++ 3 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-repo-freezed-env.yml create mode 100644 env/deeprank2_freezed.yml diff --git a/.github/actions/install-python-and-package/action.yml b/.github/actions/install-python-and-package/action.yml index 9f725336..a5884bcb 100644 --- a/.github/actions/install-python-and-package/action.yml +++ b/.github/actions/install-python-and-package/action.yml @@ -39,6 +39,19 @@ runs: activate-environment: deeprank2 environment-file: env/deeprank2.yml use-mamba: true + if: ${{ inputs.pkg-installation-type != 'freezed' }} + + - name: Setup miniconda with freezed dependencies + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniforge-variant: Mambaforge + channels: conda-forge + python-version: ${{ inputs.python-version }} + activate-environment: deeprank2 + environment-file: env/deeprank2_freezed.yml + use-mamba: true + if: ${{ inputs.pkg-installation-type == 'freezed' }} - run: | conda --version @@ -53,7 +66,7 @@ runs: - name: Install the GitHub repository version of the package shell: bash -l {0} - if: ${{ inputs.pkg-installation-type == 'repository' }} + if: ${{ inputs.pkg-installation-type == 'repository' || inputs.pkg-installation-type == 'freezed' }} run: | conda activate deeprank2 pip install .'[${{ inputs.extras-require }}]' diff --git a/.github/workflows/build-repo-freezed-env.yml b/.github/workflows/build-repo-freezed-env.yml new file mode 100644 index 00000000..9a009d15 --- /dev/null +++ b/.github/workflows/build-repo-freezed-env.yml @@ -0,0 +1,60 @@ +name: build (repository package) using the freezed environment + +on: + push: + paths-ignore: + # specific folder locations + - ".vscode/**" + - "docs/**" + # filetypes + - "**.md" + - "**.rst" + - "**.ipynb" + - "**.cff" + - "**.png" + branches: + - main + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths-ignore: + # specific folder locations + - ".vscode/**" + - "docs/**" + # filetypes + - "**.md" + - "**.rst" + - "**.ipynb" + - "**.cff" + - "**.png" + +jobs: + build: + if: github.event.pull_request.draft == false + name: Build for (${{ matrix.python-version }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + python-version: ["3.10"] # ["3.10", "3.11"] + + # https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell + defaults: + run: + shell: bash -l {0} + + steps: + - uses: actions/checkout@v3 + + - uses: ./.github/actions/install-python-and-package + with: + python-version: ${{ matrix.python-version }} + extras-require: test, publishing + pkg-installation-type: "freezed" + + - name: Run unit tests + run: pytest -v + + - name: Verify that we can build the package + run: python3 -m build diff --git a/env/deeprank2_freezed.yml b/env/deeprank2_freezed.yml new file mode 100644 index 00000000..bab6c797 --- /dev/null +++ b/env/deeprank2_freezed.yml @@ -0,0 +1,234 @@ +name: deeprank2 +channels: + - pyg + - bioconda + - sbl + - pytorch + - defaults + - conda-forge +dependencies: + - _libgcc_mutex=0.1=conda_forge + - _openmp_mutex=4.5=2_gnu + - blas=1.0=mkl + - brotli-python=1.0.9=py310h6a678d5_8 + - bzip2=1.0.8=h5eee18b_6 + - ca-certificates=2024.3.11=h06a4308_0 + - certifi=2024.6.2=py310h06a4308_0 + - charset-normalizer=2.0.4=pyhd3eb1b0_0 + - cpuonly=2.0=0 + - dssp=4.2.2.1=h3fd9d12_0 + - ffmpeg=4.3=hf484d3e_0 + - filelock=3.13.1=py310h06a4308_0 + - freetype=2.12.1=h4a9f257_0 + - gmp=6.2.1=h295c915_3 + - gmpy2=2.1.2=py310heeb90bb_0 + - gnutls=3.6.15=he1e5248_0 + - idna=3.7=py310h06a4308_0 + - intel-openmp=2023.1.0=hdb19cb5_46306 + - jinja2=3.1.4=py310h06a4308_0 + - joblib=1.4.2=py310h06a4308_0 + - jpeg=9e=h5eee18b_1 + - lame=3.100=h7b6447c_0 + - lcms2=2.12=h3be6417_0 + - ld_impl_linux-64=2.38=h1181459_1 + - lerc=3.0=h295c915_0 + - libcifpp=5.1.0=hf65b397_0 + - libdeflate=1.17=h5eee18b_1 + - libffi=3.4.4=h6a678d5_1 + - libgcc-ng=13.2.0=h77fa898_11 + - libgfortran-ng=11.2.0=h00389a5_1 + - libgfortran5=11.2.0=h1234567_1 + - libgomp=13.2.0=h77fa898_11 + - libiconv=1.16=h5eee18b_3 + - libidn2=2.3.4=h5eee18b_0 + - libjpeg-turbo=2.0.0=h9bf148f_0 + - libmcfp=1.2.3=h3fd9d12_0 + - libpng=1.6.39=h5eee18b_0 + - libstdcxx-ng=13.2.0=hc0a3c3a_11 + - libtasn1=4.19.0=h5eee18b_0 + - libtiff=4.5.1=h6a678d5_0 + - libunistring=0.9.10=h27cfd23_0 + - libuuid=1.41.5=h5eee18b_0 + - libwebp-base=1.3.2=h5eee18b_0 + - libzlib=1.2.13=h4ab18f5_6 + - llvm-openmp=14.0.6=h9e868ea_0 + - lz4-c=1.9.4=h6a678d5_1 + - markupsafe=2.1.3=py310h5eee18b_0 + - mkl=2023.1.0=h213fc3f_46344 + - mkl-service=2.4.0=py310h5eee18b_1 + - mkl_fft=1.3.8=py310h5eee18b_0 + - mkl_random=1.2.4=py310hdb19cb5_0 + - mpc=1.1.0=h10f8cd9_1 + - mpfr=4.0.2=hb69a4c5_1 + - mpmath=1.3.0=py310h06a4308_0 + - msms=2.6.1=h9ee0642_3 + - ncurses=6.4=h6a678d5_0 + - nettle=3.7.3=hbbd107a_1 + - networkx=3.2.1=py310h06a4308_0 + - numpy=1.26.4=py310h5f9d8c6_0 + - numpy-base=1.26.4=py310hb5e798b_0 + - openh264=2.1.1=h4ff587b_0 + - openjpeg=2.4.0=h3ad879b_0 + - openssl=3.0.14=h5eee18b_0 + - pillow=10.3.0=py310h5eee18b_0 + - pip=24.0=py310h06a4308_0 + - psutil=5.9.0=py310h5eee18b_0 + - pybind11-abi=4=hd3eb1b0_1 + - pyg=2.4.0=py310_torch_2.1.0_cpu + - pyparsing=3.0.9=py310h06a4308_0 + - pysocks=1.7.1=py310h06a4308_0 + - python=3.10.14=h955ad1f_1 + - pytorch=2.1.1=py3.10_cpu_0 + - pytorch-cluster=1.6.3=py310_torch_2.1.0_cpu + - pytorch-mutex=1.0=cpu + - pytorch-scatter=2.1.2=py310_torch_2.1.0_cpu + - pytorch-sparse=0.6.18=py310_torch_2.1.0_cpu + - pytorch-spline-conv=1.2.2=py310_torch_2.1.0_cpu + - pyyaml=6.0.1=py310h5eee18b_0 + - readline=8.2=h5eee18b_0 + - requests=2.32.2=py310h06a4308_0 + - scipy=1.13.1=py310h5f9d8c6_0 + - setuptools=69.5.1=py310h06a4308_0 + - sqlite=3.45.3=h5eee18b_0 + - sympy=1.12=py310h06a4308_0 + - tbb=2021.8.0=hdb19cb5_0 + - tk=8.6.14=h39e8969_0 + - torchaudio=2.1.1=py310_cpu + - torchvision=0.16.1=py310_cpu + - tqdm=4.66.4=py310h2f386ee_0 + - typing_extensions=4.11.0=py310h06a4308_0 + - urllib3=2.2.2=py310h06a4308_0 + - wheel=0.43.0=py310h06a4308_0 + - xz=5.4.6=h5eee18b_1 + - yaml=0.2.5=h7b6447c_0 + - zlib=1.2.13=h4ab18f5_6 + - zstd=1.5.5=hc292b87_2 + - pip: + - absl-py==2.1.0 + - anyio==4.4.0 + - argon2-cffi==23.1.0 + - argon2-cffi-bindings==21.2.0 + - arrow==1.3.0 + - asttokens==2.4.1 + - async-lru==2.0.4 + - attrs==23.2.0 + - babel==2.15.0 + - beautifulsoup4==4.12.3 + - biopython==1.83 + - bleach==6.1.0 + - blosc2==2.7.0 + - bump2version==1.0.1 + - cffi==1.16.0 + - chart-studio==1.1.0 + - comm==0.2.2 + - contourpy==1.2.1 + - coverage==6.5.0 + - coveralls==3.3.1 + - cycler==0.12.1 + - debugpy==1.8.1 + - decorator==5.1.1 + - defusedxml==0.7.1 + - dill==0.3.8 + - docopt==0.6.2 + - exceptiongroup==1.2.1 + - executing==2.0.1 + - fastjsonschema==2.20.0 + - fonttools==4.53.0 + - fqdn==1.5.1 + - freesasa==2.2.1 + - grpcio==1.64.1 + - h11==0.14.0 + - h5py==3.11.0 + - httpcore==1.0.5 + - httpx==0.27.0 + - iniconfig==2.0.0 + - ipykernel==6.29.4 + - ipython==8.25.0 + - isoduration==20.11.0 + - jedi==0.19.1 + - json5==0.9.25 + - jsonpointer==3.0.0 + - jsonschema==4.22.0 + - jsonschema-specifications==2023.12.1 + - jupyter-client==8.6.2 + - jupyter-core==5.7.2 + - jupyter-events==0.10.0 + - jupyter-lsp==2.2.5 + - jupyter-server==2.14.1 + - jupyter-server-terminals==0.5.3 + - jupyterlab==4.2.2 + - jupyterlab-pygments==0.3.0 + - jupyterlab-server==2.27.2 + - kiwisolver==1.4.5 + - markdown==3.6 + - markov-clustering==0.0.6.dev0 + - matplotlib==3.9.0 + - matplotlib-inline==0.1.7 + - mistune==3.0.2 + - msgpack==1.0.8 + - nbclient==0.10.0 + - nbconvert==7.16.4 + - nbformat==5.10.4 + - ndindex==1.8 + - nest-asyncio==1.6.0 + - notebook==7.2.1 + - notebook-shim==0.2.4 + - numexpr==2.10.1 + - overrides==7.7.0 + - packaging==24.1 + - pandas==2.2.2 + - pandocfilters==1.5.1 + - parso==0.8.4 + - pdb2sql==0.5.3 + - pexpect==4.9.0 + - platformdirs==4.2.2 + - plotly==5.22.0 + - pluggy==1.5.0 + - prometheus-client==0.20.0 + - prompt-toolkit==3.0.47 + - protobuf==4.25.3 + - ptyprocess==0.7.0 + - pure-eval==0.2.2 + - py-cpuinfo==9.0.0 + - pyarrow==16.1.0 + - pycodestyle==2.12.0 + - pycparser==2.22 + - pygments==2.18.0 + - pytest==7.4.4 + - pytest-cov==4.1.0 + - pytest-runner==6.0.1 + - python-dateutil==2.9.0.post0 + - python-json-logger==2.0.7 + - python-louvain==0.16 + - pytz==2024.1 + - pyzmq==26.0.3 + - referencing==0.35.1 + - retrying==1.3.4 + - rfc3339-validator==0.1.4 + - rfc3986-validator==0.1.1 + - rpds-py==0.18.1 + - ruff==0.4.10 + - scikit-learn==1.5.0 + - send2trash==1.8.3 + - six==1.16.0 + - sniffio==1.3.1 + - soupsieve==2.5 + - stack-data==0.6.3 + - tables==3.9.2 + - tenacity==8.4.1 + - tensorboard==2.17.0 + - tensorboard-data-server==0.7.2 + - terminado==0.18.1 + - threadpoolctl==3.5.0 + - tinycss2==1.3.0 + - tomli==2.0.1 + - tornado==6.4.1 + - traitlets==5.14.3 + - types-python-dateutil==2.9.0.20240316 + - tzdata==2024.1 + - uri-template==1.3.0 + - wcwidth==0.2.13 + - webcolors==24.6.0 + - webencodings==0.5.1 + - websocket-client==1.8.0 + - werkzeug==3.0.3 From 5c3a1929585e1914b659d9b64e6c653ac3ecf3c1 Mon Sep 17 00:00:00 2001 From: Dani Bodor Date: Tue, 9 Jul 2024 10:32:08 +0200 Subject: [PATCH 14/19] style: fix linting errors I double checked that the dicts are identical to what they were before this change --- deeprank2/tools/target.py | 5 +---- deeprank2/utils/parsing/residue.py | 8 +------- tests/test_querycollection.py | 8 ++------ 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/deeprank2/tools/target.py b/deeprank2/tools/target.py index 4721633a..81f43ff2 100644 --- a/deeprank2/tools/target.py +++ b/deeprank2/tools/target.py @@ -35,12 +35,9 @@ def add_target( # noqa: C901 1ATN_xxx-3 0 1ATN_xxx-4 0 """ - target_dict = {} - labels = np.loadtxt(target_list, delimiter=sep, usecols=[0], dtype=str) values = np.loadtxt(target_list, delimiter=sep, usecols=[1]) - for label, value in zip(labels, values, strict=True): - target_dict[label] = value + target_dict = dict(zip(labels, values, strict=False)) if os.path.isdir(graph_path): graphs = glob.glob(f"{graph_path}/*.hdf5") diff --git a/deeprank2/utils/parsing/residue.py b/deeprank2/utils/parsing/residue.py index 49d7ddf7..d2116354 100644 --- a/deeprank2/utils/parsing/residue.py +++ b/deeprank2/utils/parsing/residue.py @@ -10,9 +10,7 @@ def __init__( absent_atom_names: list[str], ): self.class_name = class_name - self.amino_acid_names = amino_acid_names - self.present_atom_names = present_atom_names self.absent_atom_names = absent_atom_names @@ -26,11 +24,7 @@ def matches(self, amino_acid_name: str, atom_names: list[str]) -> bool: return False # check the atom names that should be present - if not all(atom_name in atom_names for atom_name in self.present_atom_names): - return False - - # all checks passed - return True + return all(atom_name in atom_names for atom_name in self.present_atom_names) class ResidueClassParser: # noqa: D101 diff --git a/tests/test_querycollection.py b/tests/test_querycollection.py index 28cdfea7..39a64fbe 100644 --- a/tests/test_querycollection.py +++ b/tests/test_querycollection.py @@ -202,15 +202,11 @@ def test_querycollection_process_combine_output_true() -> None: _, output_directory_f, output_paths_f = _querycollection_tester(query_type, feature_modules=modules, combine_output=False, cpu_count=2) assert len(output_paths_t) == 1 - keys_t = {} with h5py.File(output_paths_t[0], "r") as file_t: - for key, value in file_t.items(): - keys_t[key] = value - keys_f = {} + keys_t = dict(file_t.items()) for output_path in output_paths_f: with h5py.File(output_path, "r") as file_f: - for key, value in file_f.items(): - keys_f[key] = value + keys_f = dict(file_f.items()) assert keys_t == keys_f rmtree(output_directory_t) From 655e839acde8b76da359fc33dfc32f793f207ad0 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Tue, 9 Jul 2024 10:46:02 +0200 Subject: [PATCH 15/19] add ref to freezed env --- README.md | 2 ++ docs/installation.md | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4482c0d7..375815c7 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ conda activate deeprank2 pip install deeprank2 ``` +We also provide a frozen environment YML file located at `env/deeprank2_freezed.yml` with all dependencies set to fixed versions. If necessary, this file can be used instead of `env/deeprank2.yml`. + See instructions below to [test](#testing-deeprank2-installation) that the installation was succesful. #### Manual installation (customizable) diff --git a/docs/installation.md b/docs/installation.md index 394a28d0..831a3976 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -4,9 +4,9 @@ - [Installation](#installation) - [Containerized Installation](#containerized-installation) - [Local/remote installation](#localremote-installation) - - [YML file installation (recommended)](#yml-file-installation-recommended) - - [Manual installation (customizable)](#manual-installation-customizable) - - [Testing DeepRank2 installation](#testing-deeprank2-installation) + - [YML file installation (recommended)](#yml-file-installation-recommended) + - [Manual installation (customizable)](#manual-installation-customizable) + - [Testing DeepRank2 installation](#testing-deeprank2-installation) - [Contributing](#contributing) # Installation @@ -67,6 +67,8 @@ conda activate deeprank2 pip install deeprank2 ``` +We also provide a frozen environment YML file located at `env/deeprank2_freezed.yml` with all dependencies set to fixed versions. If necessary, this file can be used instead of `env/deeprank2.yml`. + See instructions below to [test](#testing-deeprank2-installation) that the installation was succesful. #### Manual installation (customizable) From 252ebe48184d948322572d947b86ab719c1ea18a Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Tue, 9 Jul 2024 11:19:34 +0200 Subject: [PATCH 16/19] change freezed to frozen --- .github/actions/install-python-and-package/action.yml | 10 +++++----- .github/workflows/build-repo-freezed-env.yml | 4 ++-- README.md | 2 +- docs/installation.md | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/install-python-and-package/action.yml b/.github/actions/install-python-and-package/action.yml index a5884bcb..539cfe42 100644 --- a/.github/actions/install-python-and-package/action.yml +++ b/.github/actions/install-python-and-package/action.yml @@ -39,9 +39,9 @@ runs: activate-environment: deeprank2 environment-file: env/deeprank2.yml use-mamba: true - if: ${{ inputs.pkg-installation-type != 'freezed' }} + if: ${{ inputs.pkg-installation-type != 'frozen' }} - - name: Setup miniconda with freezed dependencies + - name: Setup miniconda with frozen dependencies uses: conda-incubator/setup-miniconda@v2 with: auto-update-conda: true @@ -49,9 +49,9 @@ runs: channels: conda-forge python-version: ${{ inputs.python-version }} activate-environment: deeprank2 - environment-file: env/deeprank2_freezed.yml + environment-file: env/deeprank2_frozen.yml use-mamba: true - if: ${{ inputs.pkg-installation-type == 'freezed' }} + if: ${{ inputs.pkg-installation-type == 'frozen' }} - run: | conda --version @@ -66,7 +66,7 @@ runs: - name: Install the GitHub repository version of the package shell: bash -l {0} - if: ${{ inputs.pkg-installation-type == 'repository' || inputs.pkg-installation-type == 'freezed' }} + if: ${{ inputs.pkg-installation-type == 'repository' || inputs.pkg-installation-type == 'frozen' }} run: | conda activate deeprank2 pip install .'[${{ inputs.extras-require }}]' diff --git a/.github/workflows/build-repo-freezed-env.yml b/.github/workflows/build-repo-freezed-env.yml index 9a009d15..47f29dce 100644 --- a/.github/workflows/build-repo-freezed-env.yml +++ b/.github/workflows/build-repo-freezed-env.yml @@ -1,4 +1,4 @@ -name: build (repository package) using the freezed environment +name: build (repository package) using the frozen environment on: push: @@ -51,7 +51,7 @@ jobs: with: python-version: ${{ matrix.python-version }} extras-require: test, publishing - pkg-installation-type: "freezed" + pkg-installation-type: "frozen" - name: Run unit tests run: pytest -v diff --git a/README.md b/README.md index 375815c7..09f6fd08 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ conda activate deeprank2 pip install deeprank2 ``` -We also provide a frozen environment YML file located at `env/deeprank2_freezed.yml` with all dependencies set to fixed versions. If necessary, this file can be used instead of `env/deeprank2.yml`. +We also provide a frozen environment YML file located at `env/deeprank2_frozen.yml` with all dependencies set to fixed versions. If necessary, this file can be used instead of `env/deeprank2.yml`. See instructions below to [test](#testing-deeprank2-installation) that the installation was succesful. diff --git a/docs/installation.md b/docs/installation.md index 831a3976..ced3f9b3 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -67,7 +67,7 @@ conda activate deeprank2 pip install deeprank2 ``` -We also provide a frozen environment YML file located at `env/deeprank2_freezed.yml` with all dependencies set to fixed versions. If necessary, this file can be used instead of `env/deeprank2.yml`. +We also provide a frozen environment YML file located at `env/deeprank2_frozen.yml` with all dependencies set to fixed versions. If necessary, this file can be used instead of `env/deeprank2.yml`. See instructions below to [test](#testing-deeprank2-installation) that the installation was succesful. From 107e52cb4cac5cc126cfa96ea34af3f5a8c0069b Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Tue, 9 Jul 2024 11:23:59 +0200 Subject: [PATCH 17/19] add comment about when to use the frozen env --- README.md | 2 +- docs/installation.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ce08569..f7fa6c36 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ conda activate deeprank2 pip install deeprank2 ``` -We also provide a frozen environment YML file located at `env/deeprank2_frozen.yml` with all dependencies set to fixed versions. If necessary, this file can be used instead of `env/deeprank2.yml`. +We also provide a frozen environment YML file located at `env/deeprank2_frozen.yml` with all dependencies set to fixed versions. The `env/deeprank2_frozen.yml` file provides a frozen environment with all dependencies set to fixed versions. This ensures reproducibility of experiments and results by preventing changes in package versions that could occur due to updates or modifications in the default `env/deeprank2.yml`. Use this frozen environment file for a stable and consistent setup, particularly if you encounter issues with the default environment file. #### Manual installation (customizable) diff --git a/docs/installation.md b/docs/installation.md index 091894b2..05cfb6a4 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -61,7 +61,7 @@ conda activate deeprank2 pip install deeprank2 ``` -We also provide a frozen environment YML file located at `env/deeprank2_frozen.yml` with all dependencies set to fixed versions. If necessary, this file can be used instead of `env/deeprank2.yml`. +We also provide a frozen environment YML file located at `env/deeprank2_frozen.yml` with all dependencies set to fixed versions. The `env/deeprank2_frozen.yml` file provides a frozen environment with all dependencies set to fixed versions. This ensures reproducibility of experiments and results by preventing changes in package versions that could occur due to updates or modifications in the default `env/deeprank2.yml`. Use this frozen environment file for a stable and consistent setup, particularly if you encounter issues with the default environment file. #### Manual installation (customizable) From 79b5331716e763e25348c7954738a3c74248bd84 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Tue, 9 Jul 2024 11:26:21 +0200 Subject: [PATCH 18/19] rename frozen env file --- env/{deeprank2_freezed.yml => deeprank2_frozen.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename env/{deeprank2_freezed.yml => deeprank2_frozen.yml} (100%) diff --git a/env/deeprank2_freezed.yml b/env/deeprank2_frozen.yml similarity index 100% rename from env/deeprank2_freezed.yml rename to env/deeprank2_frozen.yml From 602354f0b1f4dc6100af20784cfe4b983b748d67 Mon Sep 17 00:00:00 2001 From: gcroci2 Date: Tue, 9 Jul 2024 11:31:47 +0200 Subject: [PATCH 19/19] rename to frozen --- .../{build-repo-freezed-env.yml => build-repo-frozen-env.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{build-repo-freezed-env.yml => build-repo-frozen-env.yml} (100%) diff --git a/.github/workflows/build-repo-freezed-env.yml b/.github/workflows/build-repo-frozen-env.yml similarity index 100% rename from .github/workflows/build-repo-freezed-env.yml rename to .github/workflows/build-repo-frozen-env.yml