REINVENT is a molecular design tool for de novo design, scaffold hopping, R-group replacement, linker design, molecule optimization, and other small molecule design tasks. At its heart, REINVENT uses a Reinforcement Learning (RL) algorithm to generate optimized molecules compliant with a user defined property profile defined as a multi-component score.
A preprint is available on ChemRxiv: REINVENT4: Modern AI-Driven Generative Molecule Design. See AUTHORS.md for references to previous papers.
REINVENT is being developed on and for Linux but is also known to work on MacOSX. The code is written in Python 3 (>= 3.10). The list of dependencies can be found in the repository (see also Installation below). A GPU is not strictly necessary but it is stronlgy recommended to run on GPU for performance reasons. Note that if no GPU is installed in your computer the code attempts to run on the CPU only.
- Clone this Git repository.
- Install compatible version of Python, for example with Conda (Docker, pyenv, or system package manager would work too).
conda create --name reinvent4 python=3.10 conda activate reinvent4
- Go to the repository. Install the dependencies from the lockfile:
pip install -r requirements-linux-64.lock
- Install the tool. Dependencies were already installed in the previous step, no need to install them again (flag `--no-deps). If you want to install in editable (development i.e changes to code are automatically picked up) mode add -e.
pip install --no-deps .
- Use the tool. Installer added script
reinvent
to the path.reinvent --help
Update lockfiles with pip-tools (do not edit lockfiles manually):
pip-compile --extra-index-url=https://download.pytorch.org/whl/cu113 --extra-index-url=https://pypi.anaconda.org/OpenEye/simple --resolver=backtracking pyproject.toml
To update single package, use pip-compile --upgrade-package somepackage
(see pip-tools docs).
For the time being go through the files in config/toml where you will find various examples on how to run REINVENT. The files in config/json are conversions from the JSON files and are functionally equivalent.
NOTE: these will be updated at a later time!
The REINVENT project uses the pytest
framework for its tests; before you run them you first have to create a
configuration, which the tests will use.
In the project directory, create a config.json
file in the configs/
directory; you can use the example
config (example.config.json
) as a base. Make sure that you set MAIN\_TEST\_PATH
to a non-existent directory; it
is where temporary files will be written during the tests; if it is set to an existing directory, that directory
will be removed once the tests have finished.
Some tests require a proprietary OpenEye license; you have to set up a few things to make the tests read your
license. The simple way is to just set the OE\_LICENSE
environment variable to the path of the file containing the
license.
Once you have a configuration and your license can be read, you can run the tests.
$ pytest tests
The scoring component of the code uses a simple plugin mechanism. If you wish to write your own, follow these instructions
- Create /top/dir/somewhere/reinvent_plugins/components where /top/dir/somewhere is a convenient location for you.
- Do not place a __init__.py in either reinvent_plugins or components as this would break the mechanism. It is fine to create normal packages within components as long as you import those correctly.
- Place a file whose name starts with comp_ into reinvent_plugins/components. The directory will be searched recursively so structure your code as needed. Files with different names will be ignored.
- Tag the scoring component class(es) in that file with the @add_tag decorator. More than one component class can be added to the same comp_ file. See existing code.
- Tag at most one dataclass as parameter in the same file, see exisiting code. This is optional.
- There is no need to touch any of the REINVENT code.
- Set or add /top/dir/somewhere to PYTHONPATH or use any other mechanism to extend sys.path.
- The scoring component should now be automatically picked up by REINVENT.