Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump versions and switch to uv #207

Merged
merged 19 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ jobs:
include:
- label: earliest
os: ubuntu-latest
python-version: 3.8
rdkit-version: "rdkit=2021.03.1"
python-version: 3.9
rdkit-version: "rdkit==2022.09.1"
coverage: false
- label: baseline
os: ubuntu-latest
python-version: "3.10"
rdkit-version: "rdkit~=2022.09"
rdkit-version: "rdkit~=2023.03.1"
coverage: true
- label: latest
os: ubuntu-latest
Expand All @@ -58,14 +58,10 @@ jobs:
uses: actions/checkout@v4

- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
auto-update-conda: true
channel-priority: flexible
channels: conda-forge, defaults
add-pip-as-python-dependency: true
architecture: x64
use-mamba: true
miniforge-variant: Mambaforge

Expand All @@ -79,13 +75,13 @@ jobs:

- name: Install conda dependencies
run: |
mamba install ${{ matrix.rdkit-version }}
mamba install uv ${{ matrix.rdkit-version }}
mamba list

- name: Install package through pip
run: |
pip install .[dev]
pip list
uv pip install .[dev]
uv pip list

- name: Run tests
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Black"
name: "Ruff/Black"

on:
push:
Expand All @@ -19,6 +19,12 @@ jobs:
uses: actions/checkout@v4

- name: Code formatting
uses: chartboost/ruff-action@v1
with:
args: "check --preview"

- name: Notebook formatting
uses: psf/black@stable
with:
src: "docs/notebooks/"
jupyter: true
10 changes: 6 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
version: 2
build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: mambaforge-4.10
python: mambaforge-22.9
sphinx:
configuration: docs/conf.py
python:
install:
- method: pip
path: .
- method: pip
path: .
extra_requirements:
- tutorials
conda:
environment: environment.yml
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- `Complex3D` and `fp.plot_3d` now have access to `only_interacting` and
`remove_hydrogens` parameters to control which residues and hydrogen atoms are
displayed. Non-polar hydrogen atoms that aren't involved in interactions are now
hidden by default.
- `LigNetwork.save_png` to save the displayed plot to a PNG file through JavaScript
(Issue #163).
- `Complex3D.save_png` to save the displayed plot to a PNG file through JavaScript.
- `fp.plot_3d` and `fp.plot_lignetwork` now return the underlying `LigNetwork` or
`Complex3D` object which has been enhanced with rich display functionality. From the
user's perspective, nothing changes apart from being able to do
`view = fp.plot_*(...); view.save_png()` to display a popup window for saving the
image.
- `cleanup_substructures` parameter now accessible in `mol2_supplier` to skip
sanitization based on atom types.
- `sanitize` parameter now available for the `mol2_supplier` and `sdf_supplier` classes.
- `ruff` linter and formatter.

### Fixed

- `display_residues` was sanitizing each residue while preparing them for display, which
could make debugging faulty molecules difficult. This is now disabled.
- Deprecation warnings

## [2.0.3] - 2024-03-10

### Fixed
Expand Down
7 changes: 4 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# ruff: noqa: PTH100
import os
import sys

Expand All @@ -24,7 +25,7 @@
# -- Project information -----------------------------------------------------

project = "ProLIF"
copyright = f"2017-{datetime.now().year}, Cédric Bouysset"
copyright = f"2017-{datetime.now().year}, Cédric Bouysset" # noqa: A001
author = "Cédric Bouysset"


Expand Down Expand Up @@ -99,7 +100,7 @@
"url": "https://github.com/chemosim-lab/ProLIF",
"icon": "fa-brands fa-square-github",
"type": "fontawesome",
}
},
],
}

Expand All @@ -123,7 +124,7 @@ def setup(app):
app.add_config_value(
"recommonmark_config",
{
#'url_resolver': lambda url: github_doc_root + url,
# 'url_resolver': lambda url: github_doc_root + url,
"auto_toc_tree_section": "Contents",
"enable_math": False,
"enable_inline_math": False,
Expand Down
35 changes: 16 additions & 19 deletions docs/notebooks/docking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@
"metadata": {},
"outputs": [],
"source": [
"fp.plot_lignetwork(pose_iterable[0])"
"view = fp.plot_lignetwork(pose_iterable[0])\n",
"view"
]
},
{
Expand All @@ -713,7 +714,11 @@
"- hover an interaction line to display the distance.\n",
"\n",
":::{note}\n",
"It is not possible to export it as an image, but you can always take a screenshot.\n",
"After arranging the residues to your liking, you can save the plot as a PNG image with:\n",
"```python\n",
"view.save_png()\n",
"```\n",
"Note that this only works in notebooks and cannot be used in regular Python scripts.\n",
":::\n",
"\n",
"You can generate 2 types of diagram with this function, controlled by the `kind` argument:\n",
Expand All @@ -735,7 +740,8 @@
"outputs": [],
"source": [
"pose_index = 0\n",
"fp.plot_lignetwork(pose_iterable[pose_index], kind=\"frame\", frame=pose_index)"
"view = fp.plot_lignetwork(pose_iterable[pose_index], kind=\"frame\", frame=pose_index)\n",
"view"
]
},
{
Expand All @@ -753,9 +759,10 @@
"source": [
"fp_count = plf.Fingerprint(count=True)\n",
"fp_count.run_from_iterable(pose_iterable, protein_mol)\n",
"fp_count.plot_lignetwork(\n",
"view = fp_count.plot_lignetwork(\n",
" pose_iterable[pose_index], kind=\"frame\", frame=pose_index, display_all=True\n",
")"
")\n",
"view"
]
},
{
Expand Down Expand Up @@ -785,22 +792,12 @@
"\n",
"The advantage of using a count fingerprint in that case is that it will automatically select the interaction occurence with the shortest distance for a more intuitive visualization.\n",
"\n",
"Once you're satisfied with the orientation, you can export the view as a PNG image with the following snippet:\n",
"Once you're satisfied with the orientation, you can export the view as a PNG image with:\n",
"\n",
"```python\n",
"from IPython.display import Javascript\n",
"\n",
"Javascript(\n",
" \"\"\"\n",
" var png = viewer_%s.pngURI()\n",
" var a = document.createElement('a')\n",
" a.href = png\n",
" a.download = \"prolif-3d.png\"\n",
" a.click()\n",
" a.remove()\n",
" \"\"\"\n",
" % view.uniqueid\n",
")\n",
"view.save_png()\n",
"```\n",
"Note that this only works in notebooks and cannot be used in regular Python scripts.\n",
"```"
]
},
Expand Down
36 changes: 16 additions & 20 deletions docs/notebooks/md-ligand-protein.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@
"metadata": {},
"outputs": [],
"source": [
"fp.plot_lignetwork(ligand_mol)"
"view = fp.plot_lignetwork(ligand_mol)\n",
"view"
]
},
{
Expand All @@ -564,7 +565,11 @@
"- hover an interaction line to display the distance.\n",
"\n",
":::{note}\n",
"It is not possible to export it as an image, but you can always take a screenshot.\n",
"After arranging the residues to your liking, you can save the plot as a PNG image with:\n",
"```python\n",
"view.save_png()\n",
"```\n",
"Note that this only works in notebooks and cannot be used in regular Python scripts.\n",
":::\n",
"\n",
"You can generate 2 types of diagram with this function, controlled by the `kind` argument:\n",
Expand All @@ -585,7 +590,8 @@
"metadata": {},
"outputs": [],
"source": [
"fp.plot_lignetwork(ligand_mol, threshold=0.0)"
"view = fp.plot_lignetwork(ligand_mol, threshold=0.0)\n",
"view"
]
},
{
Expand All @@ -603,7 +609,8 @@
"source": [
"fp_count = plf.Fingerprint(count=True)\n",
"fp_count.run(u.trajectory[0:1], ligand_selection, protein_selection)\n",
"fp_count.plot_lignetwork(ligand_mol, kind=\"frame\", frame=0, display_all=True)"
"view = fp_count.plot_lignetwork(ligand_mol, kind=\"frame\", frame=0, display_all=True)\n",
"view"
]
},
{
Expand Down Expand Up @@ -637,23 +644,12 @@
"\n",
"The advantage of using a count fingerprint in that case is that it will automatically select the interaction occurence with the shortest distance for a more intuitive visualization.\n",
"\n",
"Once you're satisfied with the orientation, you can export the view as a PNG image with the following snippet:\n",
"Once you're satisfied with the orientation, you can export the view as a PNG image with:\n",
"\n",
"```python\n",
"from IPython.display import Javascript\n",
"\n",
"Javascript(\n",
" \"\"\"\n",
" var png = viewer_%s.pngURI()\n",
" var a = document.createElement('a')\n",
" a.href = png\n",
" a.download = \"prolif-3d.png\"\n",
" a.click()\n",
" a.remove()\n",
" \"\"\"\n",
" % view.uniqueid\n",
")\n",
"```"
"view.save_png()\n",
"```\n",
"Note that this only works in notebooks and cannot be used in regular Python scripts."
]
},
{
Expand Down Expand Up @@ -708,7 +704,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
28 changes: 11 additions & 17 deletions docs/notebooks/md-protein-protein.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@
"metadata": {},
"outputs": [],
"source": [
"fp.plot_lignetwork(small_protein_mol)"
"view = fp.plot_lignetwork(small_protein_mol)\n",
"view"
]
},
{
Expand All @@ -592,7 +593,11 @@
"- hover an interaction line to display the distance.\n",
"\n",
":::{note}\n",
"It is not possible to export it as an image, but you can always take a screenshot.\n",
"After arranging the residues to your liking, you can save the plot as a PNG image with:\n",
"```python\n",
"view.save_png()\n",
"```\n",
"Note that this only works in notebooks and cannot be used in regular Python scripts.\n",
":::\n",
"\n",
"You can generate 2 types of diagram with this function, controlled by the `kind` argument:\n",
Expand Down Expand Up @@ -647,23 +652,12 @@
"source": [
"As in the lignetwork plot, you can hover atoms and interactions to display more information.\n",
"\n",
"Once you're satisfied with the orientation, you can export the view as a PNG image with the following snippet:\n",
"Once you're satisfied with the orientation, you can export the view as a PNG image with:\n",
"\n",
"```python\n",
"from IPython.display import Javascript\n",
"\n",
"Javascript(\n",
" \"\"\"\n",
" var png = viewer_%s.pngURI()\n",
" var a = document.createElement('a')\n",
" a.href = png\n",
" a.download = \"prolif-3d.png\"\n",
" a.click()\n",
" a.remove()\n",
" \"\"\"\n",
" % view.uniqueid\n",
")\n",
"```"
"view.save_png()\n",
"```\n",
"Note that this only works in notebooks and cannot be used in regular Python scripts."
]
},
{
Expand Down
Loading
Loading