Skip to content
Open
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
217 changes: 215 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,216 @@
# FEGrow
ignore_git
.idea
fegrow.egg-info/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
#poetry.toml

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
#pdm.lock
#pdm.toml
.pdm-python
.pdm-build/

# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
#pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Cursor
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
# refer to https://docs.cursor.com/context/ignore-files
.cursorignore
.cursorindexingignore

# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/

# Streamlit
.streamlit/secrets.toml

# VSCode
.vscode
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

Authors: Mateusz K. Bieniek, Ben Cree, Rachael Pirie, Joshua T. Horton, Natalie J. Tatum, Daniel J. Cole

**version 3.0.0**
- Compatibility with MACE MLPs for optimising the ligand.

**version 2.0.1 **
- The scaffold's R atom breaks the constrained embedding. The R atom is now omitted. (#74)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ The remaining conformers are optimised using hybrid machine learning / molecular
energies = rmol.optimise_in_receptor(
receptor_file="rec_final.pdb",
ligand_force_field="openff",
use_ani=True,
ligand_intramolecular_force_field="ani2x",
sigma_scale_factor=0.8,
relative_permittivity=4,
water_model = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4448,7 +4448,7 @@ The remaining conformers are optimised using hybrid machine learning / molecular
energies = rmol.optimise_in_receptor(
receptor_file="rec_final.pdb",
ligand_force_field="openff",
use_ani=True,
ligand_intramolecular_force_field="ani2x",
sigma_scale_factor=0.8,
relative_permittivity=4,
water_model = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4447,7 +4447,7 @@ The remaining conformers are optimised using hybrid machine learning / molecular
energies = cs.optimise_in_receptor(
receptor_file="rec_final.pdb",
ligand_force_field="openff",
use_ani=True,
ligand_intramolecular_mlp="ani2x",
sigma_scale_factor=0.8,
relative_permittivity=4,
water_model = None,
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/0_basic/0_basic_tutorial_full.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ fegrow.fix_receptor("rec.pdb", "rec_final.pdb")
rec_final = prody.parsePDB("rec_final.pdb")
```

File ‘7L10.pdb’ already there; not retrieving.
File ‘7L10.pdb’ already there; not retrieving.



@> 2609 atoms and 1 coordinate set(s) were parsed in 0.05s.
Expand Down Expand Up @@ -544,7 +544,7 @@ The remaining conformers are optimised using hybrid machine learning / molecular
energies = rmol.optimise_in_receptor(
receptor_file="rec_final.pdb",
ligand_force_field="openff",
use_ani=True,
ligand_intramolecular_mlp="ani2x",
sigma_scale_factor=0.8,
relative_permittivity=4,
water_model=None,
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/1_chemspace/1_tutorial_introduce_chemspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The provided core structure is adapted from a recent study by [Jorgensen and co-
!obabel -ipdb sarscov2/lig.pdb -osdf -O sarscov2/coreh.sdf -p 7
```

1 molecule converted
1 molecule converted



Expand Down Expand Up @@ -4238,8 +4238,8 @@ fegrow.fix_receptor("rec.pdb", "rec_final.pdb")
rec_final = prody.parsePDB("rec_final.pdb")
```

File ‘7L10.pdb’ already there; not retrieving.
File ‘7L10.pdb’ already there; not retrieving.



@> 2609 atoms and 1 coordinate set(s) were parsed in 0.05s.
Expand Down Expand Up @@ -4411,7 +4411,7 @@ The remaining conformers are optimised using hybrid machine learning / molecular
energies = cs.optimise_in_receptor(
receptor_file="rec_final.pdb",
ligand_force_field="openff",
use_ani=True,
ligand_intramolecular_mlp="ani2x",
sigma_scale_factor=0.8,
relative_permittivity=4,
water_model=None,
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ dependencies:
- modal # modAL on pip
- cachey
- pyparsing<3.1.0 # temporary fix for prody
- nnpops
- pooch
1 change: 1 addition & 0 deletions fegrow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# activate nanomolar units in Pandas
import pint_pandas # noqa: F401

from . import mlp # noqa: F401
from .conformers import WrongCoreForMolecule, generate_conformers
from .package import (
ChemSpace,
Expand Down
29 changes: 25 additions & 4 deletions fegrow/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from fegrow import RMol
from fegrow.receptor import ForceField
from fegrow.mlp import MLForceFieldName


class Settings(BaseModel):
Expand All @@ -25,9 +26,14 @@ class Settings(BaseModel):
"openff",
description="The force field model to use for the small molecule during the restrained optimisation.",
)
use_ani: bool = Field(
True,
description="If we should attempt to use ANI2x to model the internal energies of the ligand in an ML/MM optimisation.",
use_ani: Optional[bool] = Field(
None,
description="**DEPRECATED**: Use 'ligand_intramolecular_mlp' instead. This field is kept for backwards compatibility only.",
)
ligand_intramolecular_mlp: Optional[MLForceFieldName] = Field(
None,
description="The machine learning force field that should be used for the ligand intramolecular interactions. "
"If set to None, the molecular mechanics ligand_force_field is used for all ligand interactions. ",
)
sigma_scale_factor: float = Field(
0.8,
Expand All @@ -54,6 +60,21 @@ class Settings(BaseModel):
description="The relative energy cutoff in kcal/mol used to select the top conformers for scoring.",
)

def model_post_init(self, __context) -> None:
"""Validate and handle deprecated use_ani parameter."""
if self.use_ani is not None:
raise ValueError(
"The 'use_ani' parameter has been deprecated and removed. "
"Please use 'ligand_intramolecular_mlp' instead.\n\n"
"Migration guide:\n"
" - Old: use_ani=true\n"
" - New: ligand_intramolecular_mlp='ani2x'\n\n"
" - Old: use_ani=false\n"
" - New: ligand_intramolecular_mlp=None\n\n"
"Available MLPs: 'ani2x', 'mace-off23-small', 'mace-off23-medium', "
"'mace-off23-large', 'egret-1'"
)


@dask.delayed
def score_ligand(
Expand Down Expand Up @@ -86,7 +107,7 @@ def score_ligand(
rmol.optimise_in_receptor(
receptor_file=receptor,
ligand_force_field=settings.ligand_force_field,
use_ani=settings.use_ani,
ligand_intramolecular_mlp=settings.ligand_intramolecular_mlp,
sigma_scale_factor=settings.sigma_scale_factor,
relative_permittivity=settings.relative_permittivity,
water_model=settings.water_model,
Expand Down
Loading