moleculekit.tools.atomtyper module#
- moleculekit.tools.atomtyper.atomtypingValidityChecks(mol)#
Checks that a Molecule is suitable for atom typing and voxelization.
Verifies that the molecule only contains protein atoms and metals, that it has a reasonable number of unique bonds, that segments and chains are assigned and that hydrogens are present. Most of these requirements can be satisfied by first running
prepareProteinForAtomtyping.- Parameters:
mol (
Molecule) – The molecule to validate.- Raises:
RuntimeError – If no protein atoms are found, if non-protein/non-metal atoms are present, if duplicate bonds exist, if segments or chains are not assigned, if the number of segments does not match the predicted number, or if no hydrogens are present.
ValueError – If the molecule has fewer bonds than (number of atoms - 1).
- Return type:
- moleculekit.tools.atomtyper.getFeatures(mol)#
Computes the per-atom feature channels of a molecule from its atom types.
Requires the molecule to already have PDBQT atom types assigned (see
getPDBQTAtomTypesAndCharges).- Parameters:
mol (
Molecule) – The molecule for which to compute features. Must have its atomtype field populated with PDBQT atom types.- Returns:
features – A (natoms, 8) boolean array with one column per channel, in the order: hydrophobic, aromatic, hydrogen-bond acceptor, hydrogen-bond donor, positive ionizable, negative ionizable, metal and occupancy.
- Return type:
- moleculekit.tools.atomtyper.getPDBQTAtomType(atype, aidx, mol, aromaticNitrogen=False)#
Maps a single atom’s atom type to its corresponding PDBQT atom type.
- Parameters:
atype (
str) – The atom type of the atom (e.g. an Open Babel/Sybyl atom type such as “Car”, “Nam” or “OA”).aidx (
int) – The index of the atom in the molecule. Used to inspect the atom’s bonds.mol (
Molecule) – The molecule the atom belongs to. Used to look up bonding partners and elements.aromaticNitrogen (
bool) – If True, aromatic nitrogens are given dedicated PDBQT atom types (“Na”/”Nn”) instead of being collapsed into the generic types.
- Returns:
pdbqttype – The PDBQT atom type of the atom.
- Return type:
- Raises:
RuntimeError – If a hydrogen atom has no bonding partners and therefore cannot be typed.
- moleculekit.tools.atomtyper.getPDBQTAtomTypesAndCharges(mol, aromaticNitrogen=False, validitychecks=True)#
Computes the PDBQT atom types and partial charges of a molecule.
Uses Open Babel to assign atom types and Gasteiger partial charges and then maps each atom to its PDBQT atom type.
- Parameters:
mol (
Molecule) – The molecule for which to compute atom types and charges.aromaticNitrogen (
bool) – If True, aromatic nitrogens are given dedicated PDBQT atom types instead of being collapsed into the generic types.validitychecks (
bool) – If True, runsatomtypingValidityCheckson the molecule before atom typing.
- Returns:
atomtypes (
numpy.ndarray) – An object array of length natoms with the PDBQT atom type of each atom.charges (
numpy.ndarray) – A float32 array of length natoms with the partial charge of each atom.
- moleculekit.tools.atomtyper.parallel(func, listobj, n_cpus=-1, *args)#
- moleculekit.tools.atomtyper.prepareProteinForAtomtyping(mol, guessBonds=True, protonate=True, pH=7.4, segment=True, verbose=True)#
Prepares a Molecule object for atom typing.
- Parameters:
mol (
Molecule) – The protein to prepareguessBonds (
bool) – Drops the bonds in the molecule and guesses them from scratchprotonate (
bool) – Protonates the protein for the given pH and optimizes hydrogen networkspH (
float) – The pH for protonationsegment (
bool) – Automatically guesses the segments of a protein by using the guessed bondsverbose (
bool) – Set to False to turn of the printing
- Returns:
mol – The prepared Molecule
- Return type: