moleculekit.tools.moleculechecks module#

moleculekit.tools.moleculechecks.areLigandsDocked(prot_file, sdf_file, threshold=10, max_check=None)#

Check whether all ligands in an SDF file are docked to a protein.

Each ligand in sdf_file is tested against the protein with isLigandDocked().

Parameters:
  • prot_file (str) – Path to the protein structure file.

  • sdf_file (str) – Path to the SDF file containing one or more ligands.

  • threshold (float) – Maximum allowed closest protein-ligand distance, in Angstrom, for a ligand to count as docked.

  • max_check (int | None) – If given, only the first max_check ligands are checked.

Returns:

  • all_docked (bool) – True if every checked ligand is docked, False otherwise.

  • not_docked (list of str) – The names of the ligands that were found not to be docked.

moleculekit.tools.moleculechecks.areLigandsOptimized(sdf_file, max_check=None)#

Check whether all ligands in an SDF file have optimized 3D geometries.

Each ligand in sdf_file is tested with isLigandOptimized().

Parameters:
  • sdf_file (str) – Path to the SDF file containing one or more ligands.

  • max_check (int | None) – If given, only the first max_check ligands are checked.

Returns:

  • all_optimized (bool) – True if every checked ligand is optimized, False otherwise.

  • not_optimized (list of str) – The names of the ligands that were found to be flat (not optimized).

moleculekit.tools.moleculechecks.closestDistance(mol1, mol2)#

Compute the minimum distance between the atoms of two molecules.

The two molecules are temporarily combined and the smallest pairwise distance between any atom of mol1 and any atom of mol2 is returned.

Parameters:
  • mol1 (Molecule) – The first molecule.

  • mol2 (Molecule) – The second molecule.

Returns:

dist – The shortest distance, in Angstrom, between any atom of mol1 and any atom of mol2.

Return type:

float

moleculekit.tools.moleculechecks.isLigandDocked(prot, lig, threshold=10)#

Check whether a ligand is docked close to a protein.

Parameters:
  • prot (Molecule) – The protein molecule.

  • lig (Molecule) – The ligand molecule.

  • threshold (float) – Maximum allowed distance, in Angstrom, between the closest protein and ligand atoms for the ligand to be considered docked.

Returns:

docked – True if the closest protein-ligand distance is below threshold, False otherwise.

Return type:

bool

moleculekit.tools.moleculechecks.isLigandOptimized(mol, atol=1e-06)#

Check whether a ligand has a 3D-optimized (non-flat) geometry.

All dihedral angles being either 0 or +/-pi means the ligand is planar, which indicates that it has not been optimized into a 3D conformation. Ligands with three or fewer atoms cannot be planar and are always considered optimized.

Parameters:
  • mol (Molecule) – The ligand molecule. If it has no bonds, they are guessed in place.

  • atol (float) – Absolute tolerance, in radians, for deciding whether a dihedral angle is effectively 0 or +/-pi (i.e. flat).

Returns:

optimized – True if at least one dihedral angle deviates from a planar value (or the ligand has three or fewer atoms), False if the ligand is flat.

Return type:

bool

moleculekit.tools.moleculechecks.isProteinProtonated(mol)#

Heuristically check whether a protein carries its hydrogen atoms.

Counts the protein hydrogens versus protein heavy atoms and decides that the protein is protonated only if there is a significant number of hydrogens relative to the heavy atoms.

Parameters:

mol (Molecule) – The molecule to inspect.

Returns:

protonated – True if the protein appears to be protonated, False otherwise.

Return type:

bool

moleculekit.tools.moleculechecks.proteinHasBonds(mol)#

Check whether the protein atoms of a molecule are bonded together.

Counts the bonds whose both atoms are protein atoms and compares against the number of protein atoms. A fully connected protein chain of n atoms has at least n - 1 bonds.

Parameters:

mol (Molecule) – The molecule to inspect.

Returns:

has_bonds – True if the protein atoms appear to be bonded together, False otherwise.

Return type:

bool