wepy.resampling.distances.receptor module¶
Distance metrics related to common features of receptor-ligand processes in molecular systems.
The ReceptorDistance class is an abstract class that provides some common functionality for normalizing reference states, providing correct indices of receptor and ligand atoms, and a common image function.
Subclasses of ReceptorDistance need only implement the ‘image_distance’ function according to their needs.
The UnbindingDistance is a useful metric for enhancing ligand movement away from the reference bound state conformation.
The RebindingDistance is a useful metric for enhancing the movement of a ligand towards a reference state.
- class wepy.resampling.distances.receptor.ReceptorDistance(ligand_idxs, binding_site_idxs, ref_state)[source]¶
Bases:
Distance
Common abstract class for receptor-ligand molecular systems.
Any input walker state should have the attributes ‘positions’ and ‘box_vectors’ and will first preprocess these states, by recentering the complex. Two component systems like receptor-ligands in periodic boxes can sometimes drift to different periodic images of the box making them unsuitable for RMSD calculations.
The ‘image’ method will align the receptor structures of the state to the reference state after the recentering.
Construct a distance metric.
- Parameters:
ligand_idxs (arraylike of int) – The indices of the atoms from the ‘positions’ attribute of states that correspond to the ligand molecule.
binding_site_idxs (arraylike of int) – The indices of the atoms from the ‘positions’ attribute of states that correspond to the atoms of the binding site of the receptor. These are the atoms you want to perform alignment on and so can be a subset of a complete molecule.
ref_state (object implementing WalkerState) – The reference state all walker states will be aligned to with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- _unaligned_image(state)[source]¶
The preprocessing method of states.
First it groups the binding site and ligand into the same periodic box image and then centers the box around their mutual center of mass and returns only the positions of the binding site and ligand.
- Parameters:
state (object implementing WalkerState) – State with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- image(state)[source]¶
Transform a state to a receptor image.
A receptor image is one in which the binding site and ligand are first normalized to be within the same periodic box image and at the center of the box, and then only the binding site and ligand are retained.
- Parameters:
state (object implementing WalkerState) – State with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- Returns:
receptor_image – The positions of binding site and ligand after preprocessing.
- Return type:
array of float
- distance(state_a, state_b)¶
Compute the distance between two states.
- Parameters:
state_a (object implementing WalkerState)
state_b (object implementing WalkerState)
- Returns:
distance – The distance between the two walker states
- Return type:
- image_distance(image_a, image_b)¶
Compute the distance between two images of walker states.
- Parameters:
image_a (object produced by Distance.image)
image_b (object produced by Distance.image)
- Returns:
distance – The distance between the two images
- Return type:
:raises NotImplementedError : always because this is abstract:
- class wepy.resampling.distances.receptor.UnbindingDistance(ligand_idxs, binding_site_idxs, ref_state)[source]¶
Bases:
ReceptorDistance
Distance metric for measuring differences between walker states in regards to the RMSDs between ligands.
Images are produced using the ReceptorDistance.image method. The distance between images then is solely the RMSD of the ligand atoms.
Thus walkers were ligands are divergent in position will have higher distances.
Construct a distance metric.
- Parameters:
ligand_idxs (arraylike of int) – The indices of the atoms from the ‘positions’ attribute of states that correspond to the ligand molecule.
binding_site_idxs (arraylike of int) – The indices of the atoms from the ‘positions’ attribute of states that correspond to the atoms of the binding site of the receptor. These are the atoms you want to perform alignment on and so can be a subset of a complete molecule.
ref_state (object implementing WalkerState) – The reference state all walker states will be aligned to with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- image_distance(image_a, image_b)[source]¶
Compute the distance between two images of walker states.
- Parameters:
image_a (object produced by Distance.image)
image_b (object produced by Distance.image)
- Returns:
distance – The distance between the two images
- Return type:
:raises NotImplementedError : always because this is abstract:
- _unaligned_image(state)¶
The preprocessing method of states.
First it groups the binding site and ligand into the same periodic box image and then centers the box around their mutual center of mass and returns only the positions of the binding site and ligand.
- Parameters:
state (object implementing WalkerState) – State with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- distance(state_a, state_b)¶
Compute the distance between two states.
- Parameters:
state_a (object implementing WalkerState)
state_b (object implementing WalkerState)
- Returns:
distance – The distance between the two walker states
- Return type:
- image(state)¶
Transform a state to a receptor image.
A receptor image is one in which the binding site and ligand are first normalized to be within the same periodic box image and at the center of the box, and then only the binding site and ligand are retained.
- Parameters:
state (object implementing WalkerState) – State with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- Returns:
receptor_image – The positions of binding site and ligand after preprocessing.
- Return type:
array of float
- class wepy.resampling.distances.receptor.RebindingDistance(ligand_idxs, binding_site_idxs, ref_state)[source]¶
Bases:
ReceptorDistance
Distance metric for measuring differences between walker states in regards to the RMSDs between ligands.
Images are produced using the ReceptorDistance.image method. The distance between images then is the relative difference between the ligand RMSDs to the reference state.
Construct a distance metric.
- Parameters:
ligand_idxs (arraylike of int) – The indices of the atoms from the ‘positions’ attribute of states that correspond to the ligand molecule.
binding_site_idxs (arraylike of int) – The indices of the atoms from the ‘positions’ attribute of states that correspond to the atoms of the binding site of the receptor. These are the atoms you want to perform alignment on and so can be a subset of a complete molecule.
ref_state (object implementing WalkerState) – The reference state all walker states will be aligned to with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- image_distance(image_a, image_b)[source]¶
Compute the distance between two images of walker states.
- Parameters:
image_a (object produced by Distance.image)
image_b (object produced by Distance.image)
- Returns:
distance – The distance between the two images
- Return type:
:raises NotImplementedError : always because this is abstract:
- _unaligned_image(state)¶
The preprocessing method of states.
First it groups the binding site and ligand into the same periodic box image and then centers the box around their mutual center of mass and returns only the positions of the binding site and ligand.
- Parameters:
state (object implementing WalkerState) – State with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- distance(state_a, state_b)¶
Compute the distance between two states.
- Parameters:
state_a (object implementing WalkerState)
state_b (object implementing WalkerState)
- Returns:
distance – The distance between the two walker states
- Return type:
- image(state)¶
Transform a state to a receptor image.
A receptor image is one in which the binding site and ligand are first normalized to be within the same periodic box image and at the center of the box, and then only the binding site and ligand are retained.
- Parameters:
state (object implementing WalkerState) – State with ‘positions’ (Nx3 dims) and ‘box_vectors’ (3x3 array) attributes.
- Returns:
receptor_image – The positions of binding site and ligand after preprocessing.
- Return type:
array of float