MobleyLab / blues

Applications of nonequilibrium candidate Monte Carlo (NCMC) to ligand binding mode sampling
https://mobleylab-blues.readthedocs.io/en/latest
MIT License
33 stars 16 forks source link

BLUES: Binding modes of Ligands Using Enhanced Sampling

This package takes advantage of non-equilibrium candidate Monte Carlo moves (NCMC) to help sample between different ligand binding modes.

Latest release: Build Status Documentation Status codecov Anaconda-Server Badge DOI

Citations

Publication

Preprints

Manifest

Prerequisites

BLUES is compatible with MacOSX/Linux with Python=3.6.

Install miniconda according to your system.

Installation

ReadTheDocs: Installation

Recommended: Install releases from conda

# Create a clean environment (python 3.6 is required)
conda create -n blues python=3.6
conda activate blues

# Install OpenEye toolkits and related tools first
conda install -c openeye/label/Orion -c omnia oeommtools
conda install -c openeye openeye-toolkits

# Install necessary dependencies
conda install -c omnia -c conda-forge openmmtools=0.15.0 openmm=7.4.2 numpy cython

conda install -c mobleylab blues

Install from source (if conda installation fails)

# Clone the BLUES repository
git clone https://github.com/MobleyLab/blues.git ./blues

# Install some dependencies
conda install -c omnia -c conda-forge openmmtools=0.15.0 openmm=7.4.2 numpy cython

# To use SideChainMove class, OpenEye toolkits and related tools are requried (requires OpenEye License)
conda install -c openeye/label/Orion -c omnia oeommtools
conda install -c openeye openeye-toolkits

# Install BLUES package from the top directory
pip install -e .

# To validate your BLUES installation run the tests (need pytest)
cd blues/tests
pytest -v -s

Documentation

For documentation on the BLUES modules see ReadTheDocs: Modules For a tutorial on how to use BLUES see ReadTheDocs: Tutorial

BLUES using NCMC

This package takes advantage of non-equilibrium candidate Monte Carlo moves (NCMC) to help sample between different ligand binding modes using the OpenMM simulation package. One goal for this package is to allow for easy additions of other moves of interest, which will be covered below.

Example Use

An example of how to set up a simulation sampling the binding modes of toluene bound to T4 lysozyme using NCMC and a rotational move can be found in examples/example_rotmove.py

Actually using BLUES

The integrator of BLUES contains the framework necessary for NCMC. Specifically, the integrator class calculates the work done during a NCMC move. It also controls the lambda scaling of parameters. The integrator that BLUES uses inherits from openmmtools.integrators.AlchemicalNonequilibriumLangevinIntegrator to keep track of the work done outside integration steps, allowing Monte Carlo (MC) moves to be incorporated together with the NCMC thermodynamic perturbation protocol. Currently the openmmtools.alchemy package is used to generate the lambda parameters for the ligand, allowing alchemical modification of the sterics and electrostatics of the system. The Simulation class in blues/simulation.py serves as a wrapper for running NCMC simulations.

Implementing Custom Moves

Users can implement their own MC moves into NCMC by inheriting from an appropriate blues.moves.Move class and constructing a custom move() method that only takes in an Openmm context object as a parameter. The move() method will then access the positions of that context, change those positions, then update the positions of that context. For example if you would like to add a move that randomly translates a set of coordinates the code would look similar to this pseudocode:

from blues.moves import Move
class TranslationMove(Move):
    def __init__(self, atom_indices):
        self.atom_indices = atom_indices
    def move(context):
    """pseudocode for move"""
        positions = context.context.getState(getPositions=True).getPositions(asNumpy=True)
        #get positions from context
        #use some function that translates atom_indices
        newPositions = RandomTranslation(positions[self.atom_indices])
        context.setPositions(newPositions)
        return context

Combining Moves

Note: This feature has not been tested, use at your own risk. If you're interested in combining moves together sequentially–say you'd like to perform a rotation and translation move together–instead of coding up a new Move class that performs that, you can instead leverage the functionality of existing Moves using the CombinationMove class. CombinationMove takes in a list of instantiated Move objects. The CombinationMove's move() method perfroms the moves in either listed or reverse order. Replicating a rotation and translation move on t, then, can effectively be done by passing in an instantiated TranslationMove (from the pseudocode example above) and RandomLigandRotation. One important non-obvious thing to note about the CombinationMove class is that to ensure detailed balance is maintained, moves are done half the time in listed order and half the time in the reverse order.

Versions:

Acknowledgements

We would like to thank Patrick Grinaway and John Chodera for their basic code framework for NCMC in OpenMM (see https://github.com/choderalab/perses/tree/master/perses/annihilation), and John Chodera and Christopher Bayly for their helpful discussions.