htmd.pathplanning module#
- htmd.pathplanning.parallelfunc(j, spherecoor, ligcoor, protcoor, step, colldist, outdist, distances)#
- htmd.pathplanning.raytracing(mol, ligandsel, othersel='protein', step=1, colldist=2, outdist=8, ligcom=False, numsamples=2000, ratioexposed=0, vmd=True)#
Find the escape vector of a ligand from a pocket.
Creates a sphere of points around the othersel atoms and traces a line from each atom of the ligand to each point on the sphere. If the line does not hit any othersel atoms within colldist it is checked if it exits the pocket by checking if any point on the line is outside the pocket. Thus we can calculate all the unimpeded vectors with which the ligand can reach the solvent. We then select the point of the surrounding sphere to which most ligand atoms can reach without hitting any othersel atoms within colldist and we consider this as the escape vector.
- Parameters:
mol (
Molecule) – The molecule to analyze.ligandsel (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array (seeMolecule.atomselect) identifying the ligand.othersel (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array (seeMolecule.atomselect) identifying the other molecules which impede the escape of the ligand.step (
float) – The step size to use for the line tracing.colldist (
float) – The collision distance threshold to use for the line tracing.outdist (
float) – The distance threshold to use to check if the line exits the pocket.ligcom (
bool) – Whether to use the center of mass of the ligand or its individual atoms to trace the line.numsamples (
int) – The number of points to sample on the surrounding sphere.ratioexposed (
float) – The ratio of exposed ligand atoms that should be present on the escape vector. If set to a value greater than 0, the function will check if the number of exposed ligand atoms on the escape vector is greater than the specified ratio and raise an error if it is not.vmd (
bool) – Whether to visualize the results using VMD.
- Return type:
- Returns:
translation (
numpy.ndarray) – The translation vector to apply if we want to align the molecule to the escape vector.escape_vector (
numpy.ndarray) – The escape vector, i.e. the vector which the ligand can use to reach the solvent without hitting any othersel atoms within colldist.
- Raises:
RuntimeError – If no ligand atoms can exit the pocket without clashes, or if the fraction of exposed ligand atoms is below ratioexposed.
Examples
>>> from moleculekit.util import rotation_matrix_from_vectors >>> translation, escape_vector = raytracing(mol, "resname LIG", "protein") >>> rotmat = rotation_matrix_from_vectors(np.array([0, 0, 1]), escape_vector) >>> mol.moveBy(translation) >>> mol.rotateBy(rotmat)
- htmd.pathplanning.rrt(mol, ligandsel, step=1, maxiter=1000000, ligcom=False, colldist=2, outdist=8)#
Run a basic RRT path planning algorithm to find a ligand exit path.
Uses a Rapidly-exploring Random Tree (RRT) to find a collision-free path for the ligand to exit the binding pocket by sampling points on a surrounding sphere.
- Parameters:
mol (
Molecule) – The molecule containing the protein and ligand.ligandsel (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array (seeMolecule.atomselect) identifying the ligand atoms.step (
float) – Step size in Angstroms for path extension.maxiter (
int) – Maximum number of iterations for the RRT algorithm.ligcom (
bool) – If True, use the center of mass of the ligand instead of individual ligand atoms as the starting point.colldist (
float) – Collision distance threshold in Angstroms. Points closer than this to protein atoms are considered in collision.outdist (
float) – Distance threshold in Angstroms to determine if the ligand has exited the pocket.
- Return type:
- htmd.pathplanning.rrtstarsmart(mol, ligandsel, step=1, maxiter=1000000, ligcom=False, colldist=2, outdist=8, radius=2.5)#
Run an RRT* SMART path planning algorithm to find a ligand exit path.
Uses a Rapidly-exploring Random Tree Star (RRT*) variant with smart sampling to find a collision-free path for the ligand to exit the binding pocket.
- Parameters:
mol (
Molecule) – The molecule containing the protein and ligand.ligandsel (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array (seeMolecule.atomselect) identifying the ligand atoms.step (
float) – Step size in Angstroms for path extension.maxiter (
int) – Maximum number of iterations for the RRT* algorithm.ligcom (
bool) – If True, use the center of mass of the ligand instead of individual ligand atoms as the starting point.colldist (
float) – Collision distance threshold in Angstroms. Points closer than this to protein atoms are considered in collision.outdist (
float) – Distance threshold in Angstroms to determine if the ligand has exited the pocket.radius (
float) – Radius in Angstroms for the neighbourhood search used in the RRT* rewiring step.
- Return type: