Local docking tutorial

Run the complete docking pipeline on your own computer.

This is the copy-and-paste path for a new user: install the environment once, then prepare ligands, dock, rank results, and optionally create PyMOL and MD-ready outputs. Commands below are for macOS or Linux.

Page summary

Local docking in one sentence

Activate the docking Conda environment, create ligand PDBQT files, provide receptor PDBQT files and a matching vina_centers.csv, run the Vina batch script, then parse, visualize, and inspect the resulting ranked poses.

Before you start

Use a fresh working folder for every docking run.

These scripts write timestamped results beside the directory where you run them. Keep original inputs separate from results so reruns are easy to understand.

The browser app can prepare and download a ready-to-run job package. This page also covers running the repository scripts directly when you already have local receptor and ligand files.

Scientific note

Docking scores are hypotheses, not experimental measurements. Confirm receptor preparation, docking box placement, controls, and pose plausibility before using results in scientific decisions.

Inputs you need

A receptor folder containing .pdbqt files, ligand input in SDF/SMILES/CSV form, and a vina_centers.csv whose PDB_ID values match the receptor filenames.

Recommended first run

Start with one receptor, one small SDF, 9 poses, and 2–4 workers. Scale up only after that small run finishes successfully.

1. Install Conda and clone the project

Install Miniconda or Miniforge first. Then run this once in Terminal.

git clone https://github.com/Joey305/autodock-WEBSERVER.git
cd autodock-WEBSERVER
./create_vina_env.sh --name docking
conda activate docking

If your shell says conda: command not found immediately after installation, close and reopen Terminal, then repeat conda activate docking.

2. Verify the installation

Run all checks before starting a real job. Each command should print a version or success message.

python --version
python -c "from rdkit import Chem; print('RDKit OK')"
obabel -V
vina --version
pymol -cq -d "quit"

If only Vina fails, use the manual Vina install instructions and return here once vina --version works.

3. Make a run folder

This example assumes one receptor named target.pdbqt and one multi-record SDF named library.sdf. Copy your files into the indicated folders.

export REPO="$HOME/autodock-WEBSERVER"
mkdir -p "$HOME/docking-runs/first-run"/{Receptors,Ligand_Input}
cd "$HOME/docking-runs/first-run"

# Put target.pdbqt in Receptors/ and library.sdf in Ligand_Input/
ls Receptors Ligand_Input

Change REPO if you cloned the repository somewhere else. On the first run, avoid spaces in file and folder names.

4. Create ligand PDBQT files

The conformer generator uses RDKit and Open Babel. The command below creates a timestamped folder whose name starts with Ligands_PDBQT_.

python "$REPO/1_ConformerGeneration.py" \
  --mode 3 \
  --sdf Ligand_Input/library.sdf \
  --num-confs 9 \
  --workers 4

find . -maxdepth 1 -type d -name '*Ligands_PDBQT*'

For a CSV library, use --mode 1 --csv compounds.csv --smiles-col SMILES --id-col ID. Use python "$REPO/1_ConformerGeneration.py" --help to see the other input modes.

5. Add the docking center

Create vina_centers.csv in the run folder. PDB_ID must match the receptor file stem exactly: target for Receptors/target.pdbqt. Replace the example coordinates with your validated pocket center.

cat > vina_centers.csv <<'EOF'
PDB_ID,X,Y,Z
target,10.5,22.1,-3.4
EOF

cat vina_centers.csv

The web app can create this file from its saved docking-box center. Its downloaded portable package already includes receptors, ligands, and vina_centers.csv.

6. Run AutoDock Vina

Set LIGANDS to the generated folder printed in step 4. This example requests 9 poses, keeps four Vina processes active, and writes a timestamped Docking_Results_* folder.

export LIGANDS="$(find "$PWD" -maxdepth 1 -type d -name '*Ligands_PDBQT*' | head -n 1)"
test -n "$LIGANDS" || { echo "No ligand PDBQT folder found"; exit 1; }

python "$REPO/3_Complete_batch_docking.py" \
  --receptors Receptors \
  --ligands "$LIGANDS" \
  --centers_csv vina_centers.csv \
  --poses 9 \
  --workers 4 \
  --exhaustiveness 8

find . -maxdepth 1 -type d -name 'Docking_Results_*'

Use fewer workers than your available CPU cores. For broad pose-ensemble analysis, add --full-pose-ensemble; do not combine it with --energy-range.

7. Parse and rank the scores

Parsing creates a sorted CSV. Graphs creates a Plots/ folder beside that CSV.

export RESULTS="$(find "$PWD" -maxdepth 1 -type d -name 'Docking_Results_*' | head -n 1)"
python "$REPO/4_ParseScores.py" --dir "$RESULTS"

export SCORES="$(find "$PWD" -maxdepth 1 -name '*vina_docking_scores_sorted.csv' | head -n 1)"
python "$REPO/7_Graphs.py" \
  --csv "$SCORES" \
  --top-n 20 \
  --write-state-summaries \
  --write-ranking-plots

Lower (more negative) Vina affinity values rank ahead of higher values, but always inspect the poses rather than relying on score alone.

8. Optional: PyMOL, HTML, and MD outputs

First audit the top selection without reconstruction. Then make a PyMOL session or compact HTML project. The reference ligand SDF must still be available in the run directory tree.

python "$REPO/5C_BuildPymolSesh.py" \
  --csv "$SCORES" --mode per_receptor --top 20 \
  --receptor-roots Receptors --dry-run-selection --non-interactive

python "$REPO/5C_BuildPymolSesh.py" \
  --csv "$SCORES" --mode per_receptor --top 20 \
  --receptor-roots Receptors --non-interactive

python "$REPO/5_COMPACTED_SDF_HTML.py" \
  --csv "$SCORES" --receptor-roots Receptors \
  --top-ligands 20 --top-poses 1

6_MDpymacs.py is the next optional step after PyMOL export. It expects vina_centers.csv and an 11_AA_PDBOUTPUT/ folder created by the PyMOL workflow:

python "$REPO/6_MDpymacs.py"
# Add --skip-pymacs-install if the computer cannot reach GitHub.
Downloaded PrepServer package

Already built a portable ZIP in the web app?

Unzip it, activate the same environment, and run the included script. It is the shortest path because the package contains the validated receptors, ligand inputs, center CSV, and runner configuration.

unzip my-docking-package.zip -d my-docking-package
cd my-docking-package/job
conda activate docking
./run_all_local.sh

When something fails

Check commands in this order: conda activate docking, vina --version, obabel -V, receptor filename versus PDB_ID, and the paths given to the script. Run any script with --help to see every option.

Open troubleshooting