Vina_dock: Rigid Docking Automation with AutoDock Vina

This script automates rigid protein-ligand docking using the Vina scoring function and AutoDockTools file preparation scripts. It handles grid setup, format conversion, execution, and optional multi-pose output.

?? Requirements

Environment 1: Python 2 (for MGLTools)

Python 2.7

MGLTools (AutoDockTools/Utilities24)

Used only for prepare_ligand4.py and prepare_receptor4.py

Environment 2: Python 3 (for docking)

Python 3.10+

rdkit

openbabel (with Python bindings)

vina

numpy

pyinstaller for standalone executable

?? Step-by-step setup

Step 1: Create Python 2 environment for MGLTools

conda create -n mgltools_env python=2.7
conda activate mgltools_env

Install MGLTools manually (if using .tar.gz):

tar -xvzf mgltools_x.x.tar.gz
cd mgltools_x.x
./install.sh

Note down:

Python 2 interpreter path: /path/to/mgltools_env/bin/python

Utility script folder: /path/to/MGLToolsPckgs/AutoDockTools/Utilities24

Step 2: Create Python 3 environment for docking

conda create -n vina_env python=3.10
conda activate vina_env

Install dependencies:

conda install -c conda-forge openbabel rdkit numpy
pip install vina

Step 3: Prepare input files and environment variables

You will need:

A protein.xyz file

A ligand.xyz file

A valid SMILES string for the ligand

You may set the following environment variables (optional):

export AUTODOCKTOOLS_PY2_PATH=/path/to/mgltools_env/bin/python
export AUTODOCKTOOLS_UTILS_PATH=/path/to/AutoDockTools/Utilities24

Step 4: Run the docking script

python Vina_dock.py \
  --protein path/to/protein.xyz \
  --ligand path/to/ligand.xyz \
  --smiles "SMILES_STRING_HERE" \
  --grid_center X Y Z \
  --grid_size SIZE [SIZE SIZE] \
  --grid_spacing SPACING \
  --n_poses N \
  --energy_range RANGE \
  --exhaustiveness LEVEL \
  --output_all_poses True \
  --py2 /path/to/python2 \
  --utils_path /path/to/Utilities24

grid_center is optional; the ligands center of mass is used if not provided.

grid_size can be a single value or three values.

Step 5: Expected output files

File

Description

docking_results.txt

Summary (best energy, grid, settings)

output.pdbqt

Raw output with all poses

pose_1.xyz, pose_2.xyz, ...

Converted poses (if --output_all_poses True)

ligand.pdb, ligand.pdbqt

Intermediate ligand files

protein.pdb, protein.pdbqt

Intermediate protein files

Step 6: Cleanup and tips

To delete intermediate files:

rm *.pdb *.pdbqt

Visualization tools:

PyMOL, Chimera (for .pdb)

Jmol (for .xyz)

To ensure reproducibility, record or set the --seed value.

Step 7: Build a standalone executable

Install PyInstaller in the Python 3 environment:

pip install pyinstaller

Create the executable:

pyinstaller --onefile \
  --hidden-import=vina \
  --collect-all vina \
  --collect-all openbabel \
  Vina_dock.py

The final binary will be in the dist/ folder:

./dist/Vina_dock --protein ... --ligand ... [other options]

Note: You still need MGLTools and Python 2 installed separately for external scripts.

?? License

MIT License

?? Citation

If you use this tool in your research, please cite appropriately and credit the respective authors of AutoDock Vina, RDKit, Open Babel, and MGLTools.

