Skip to content

Protein API#

docksuitex.protein.Protein #

Protein structure preparation for molecular docking.

This module provides automated protein preparation using PDBFixer for fixing structures and AutoDockTools (MGLTools) for PDBQT generation.

The preparation workflow
  1. Optionally fixing missing residues/atoms and nonstandard residues (using PDBFixer).
  2. Optionally removing heterogens (using PDBFixer) and removing water molecules (using AutoDockTools).
  3. Optionally adding pH-aware hydrogens (using PDBFixer) and Gasteiger charges (using AutoDockTools).
  4. Removing non-polar hydrogens and converting to PDBQT format (using AutoDockTools).
Supported Input Formats

PDB (Single Model only).

Note

If you have files in other formats (CIF, MOL2, etc.) or multi-model files (NMR ensembles), use the Format Converter utility to prepare a single-model PDB file before using this module.

Intermediate files (fixed PDB) are saved in an intermediate_proteins/ subfolder within the output directory.

__init__ #

__init__(
    input: Union[str, Path],
    fix_pdb: bool = True,
    remove_heterogens: bool = True,
    remove_water: bool = True,
    add_hydrogens: bool = True,
    ph: float = 7.4,
    add_charges: bool = True,
    preserve_charge_types: Optional[list[str]] = None,
)

Initialize a Protein object with a given file path and preparation parameters.

Parameters:

Name Type Description Default
input str | Path

Path to the single-model PDB file.

required
fix_pdb bool

Fix missing residues/atoms. Defaults to True.

True
remove_heterogens bool

Remove ligands/heterogens. Defaults to True.

True
remove_water bool

Remove water molecules. Defaults to True.

True
add_hydrogens bool

Add hydrogens using PDBFixer at the specified pH. Defaults to True.

True
ph float

Custom pH for adding missing hydrogens. Defaults to 7.4.

7.4
add_charges bool

Assign Gasteiger charges. Defaults to True.

True
preserve_charge_types list[str]

Atom types (e.g.,["Zn", "Fe"]) whose charges are preserved; others get Gasteiger charges; ignored if add_charges=False. Defaults to None.

None

Raises:

Type Description
FileNotFoundError

If the provided file does not exist.

ValueError

If the file extension is not a supported format.

prepare #

prepare(save_to: Union[str, Path] = '.') -> Path

Handle protein preparation for docking using PDBFixer, Open Babel, and AutoDockTools (ADT).

Saves the prepared PDBQT file to the specified location.

Parameters:

Name Type Description Default
save_to str | Path

Destination path for the PDBQT file. - If a directory: file will be saved with original name. - If a file path: saved with the given name. Defaults to current directory.

'.'

Returns:

Name Type Description
Path Path

Path to the saved PDBQT file.

Raises:

Type Description
RuntimeError

If Open Babel or AutoDockTools commands fail.

view_molecule #

view_molecule() -> nv.NGLWidget

Visualize the protein structure in a Jupyter notebook.

Uses NGLView to render either the prepared PDBQT file or the original input file in an interactive 3D viewer.

Returns:

Type Description
NGLWidget

nglview.NGLWidget: Interactive 3D molecular viewer widget.

Raises:

Type Description
FileNotFoundError

If neither prepared nor input file exists.

ImportError

If nglview is not installed.

Note

This method requires a Jupyter Notebook/Lab environment and the nglview package.