meeko.molecule_pdbqt module#
- class meeko.molecule_pdbqt.PDBQTMolecule(pdbqt_string, name=None, poses_to_read=None, energy_range=None, is_dlg=False, skip_typing=False)[source]#
Bases:
objectPDBQTMolecule class for reading PDBQT (or dlg) files from AutoDock4, AutoDock-GPU or AutoDock-Vina.
- _current_pose#
Index of the current pose.
- Type:
int
- _pdbqt_filename#
Filename of the PDBQT file.
- Type:
str
- _atoms#
Array of atoms.
- Type:
ndarray.
- _positions#
Array of positions.
- Type:
ndarray
- _bonds#
Dictionary of bonds.
- Type:
dict
- _atom_annotations#
Dictionary of atom annotations.
- Type:
dict
- _pose_data#
Dictionary of pose data.
- Type:
dict
- _name#
Name of the molecule.
- Type:
str
- _KDTrees#
List of KDTree objects for each pose.
- Type:
list
- classmethod from_file(pdbqt_filename, name=None, poses_to_read=None, energy_range=None, is_dlg=False, skip_typing=False)[source]#
Read PDBQT file and return PDBQTMolecule object.
- Parameters:
pdbqt_filename (str) – Filename of the PDBQT file.
name (str, optional) – Name of the molecule. De is None (use filename without pdbqt suffix).
poses_to_read (int, optional) – Total number of poses to read. Default is None (read all).
energy_range (float, optional) – Read docked poses until the maximum energy difference from best pose is reach, for example 2.5 kcal/mol. Default is None (read all).
is_dlg (bool, optional) – Input file is in dlg (AutoDock docking log) format. Default is False (input file is not in dlg format).
skip_typing (bool, optional) – Flag indicating that atomtyping should be skipped. Default is False (do not skip typing).
- property name#
Return the name of the molecule.
- property pose_id#
Return the index of the current pose.
- property score#
Return the score (kcal/mol) of the current pose.
- available_atom_properties(ignore_properties=None)[source]#
Return all the available atom properties for that molecule. The following properties are awlays ignored:
ligand
flexible_residue
water
- Parameters:
ignore_properties (list, optional) – List of properties to ignore. Default is None (no properties are ignored).
- Returns:
list – List of available atom properties.
- Return type:
list
- has_flexible_residues()[source]#
Tell if the molecule contains a flexible residue or not.
- Returns:
True if contains flexible residues, otherwise False.
- Return type:
bool
- has_water_molecules()[source]#
Tell if the molecules contains water molecules or not in the current pose.
- Returns:
True if contains water molecules in the current pose, otherwise False.
- Return type:
bool
- atoms(atom_idx=None, only_active=True)[source]#
Return the ith atom.
- Parameters:
atom_idx (int, list, optional) – Index of one or multiple atoms (0-based). Default is None (return all atoms).
only_active (bool, optional) – Return only active atoms. Default is True (return only active atoms).
- Returns:
atoms – ndarray (atom_id, atom_name, resname, resid, chainid, xyz, q, t).
- Return type:
ndarray
- positions(atom_idx=None, only_active=True)[source]#
Return coordinates (xyz) of all atoms or a certain atom.
- Parameters:
atom_idx (int, list, optional) – Index of one or multiple atoms (0-based). Default is None (return all atoms).
only_active (bool, optional) – Return only active atoms. Default is True (return only active atoms).
- Returns:
ndarray of coordinates (xyz).
- Return type:
ndarray
- atoms_by_properties(atom_properties, only_active=True)[source]#
Return atom based on their properties.
- Parameters:
atom_properties (str or list) – Property of the atoms to retrieve (properties: ligand, flexible_residue, vdw, hb_don, hb_acc, metal, water, reactive, glue).
only_active (bool, optional) – Return only active atoms. Default is True (return only active atoms).
- Returns:
ndarray of atoms (atom_id, atom_name, resname, resid, chainid, xyz, q, t).
- Return type:
ndarray
- Raises:
KeyError – If the atom property is not valid.
- closest_atoms_from_positions(xyz, radius, atom_properties=None, ignore=None)[source]#
Retrieve indices of the closest atoms around a positions/coordinates at a certain radius.
- Parameters:
xyz (np.ndarray) – array of 3D coordinates.
radius (float) – radius.
atom_properties (str or list, optional) – Property of the atoms to retrieve (properties: ligand, flexible_residue, vdw, hb_don, hb_acc, metal, water, reactive, glue).
ignore (int or list, optional) – Ignore atom for the search using atom id (0-based). Default is None (no atoms are ignored).
- Returns:
ndarray (atom_id, atom_name, resname, resid, chainid, xyz, q, t).
- Return type:
ndarray
- Raises:
KeyError – If the atom property is not valid.
- closest_atoms(atom_idx, radius, atom_properties=None)[source]#
Retrieve indices of the closest atoms around a positions/coordinates at a certain radius.
- Parameters:
atom_idx (int, list) – index of one or multiple atoms (0-based).
radius (float) – radius.
atom_properties (str or list, optional) – Property of the atoms to retrieve (properties: ligand, flexible_residue, vdw, hb_don, hb_acc, metal, water, reactive, glue).
- Returns:
ndarray (atom_id, atom_name, resname, resid, chainid, xyz, q, t).
- Return type:
ndarray
- neighbor_atoms(atom_idx)[source]#
Return neighbor (bonded) atoms of certain atom(s) by their index.
- Parameters:
atom_idx (int, list) – index of one or multiple atoms (0-based).
- Returns:
list of lists containing the neighbor (bonded) atoms (0-based).
- Return type:
list
- write_pdbqt_string(as_model=True)[source]#
Write PDBQT output string of the current pose.
- Parameters:
as_model (bool, optional) – Add MODEL/ENDMDL keywords to the output PDBQT string Default is True (add MODEL/ENDMDL keywords).
- Returns:
PDBQT string of the current pose.
- Return type:
str
- write_pdbqt_file(output_pdbqtfilename, overwrite=False, as_model=False)[source]#
Write PDBQT file of the current pose
- Parameters:
output_pdbqtfilename (str) – Filename of the output PDBQT file.
overwrite (bool, optional) – Overwrite on existing PDBQT file. Default is False (do not overwrite).
as_model (bool, optional) – Add MODEL/ENDMDL keywords to the output PDBQT string. Default is False (do not add MODEL/ENDMDL keywords).
- Raises:
RuntimeError – If the output PDBQT file already exists and overwrite is False.
- Return type:
None