MakeVinaCommand
Jump to navigation
Jump to search
Overview
Vina is a new, very fast, molecular docking program, written by Oleg Trott. In order to run Vina, you should have MGLTools1.5.4 installed (you need prepare_receptor4.py and prepare_ligand4.py). But, you don't need MGLTools for this script to run.
To run Vina it needs to know the center of the protein and also its extents (size in XYZ directions). We can easily do this with PyMOL.
Requirements:
- COM -- simple script to get the center of mass of a selection
Todo:
- Commandline options
- Robustness to vagaries of input
- Usage & Help
Usage
pymol -cq ./makeVinaCommandFromProtein.py proteinFile ligandFile
For high-throughput screening, where we compare each ligand to each protein, I typically wrap the script in a for-loop like:
# foreach protein in my proteins directory
for protein in proteinsDir/*; do
# foreach ligand in my ligands directory
for ligand in ligandsDir/*; do;
# make a Vina command to run the protein vs the ligand.
# note the backticks to run the output
`pymol -cq ./makeVinaCommandFromProtein.py $protein $ligand | grep vina`;
done;
done;
The Code
# -*- coding: utf-8 -*-
#
# makeVinaCommandFromProtein.py -- automatically make a valid Vina command from a PDB file and a ligand (name)
#
# Author: Jason Vertrees
# Date : 2/2009
#
from pymol import cmd
from sys import argv
from os import path
# try to keep PyMOL quiet
cmd.feedback("disable","all","actions")
cmd.feedback("disable","all","results")
# prepare some output names
protName= path.basename(argv[-2])
ligName = path.basename(argv[-1])
outName = protName.split(".")[0] + "." + ligName.split(".")[0] + ".docked.pdbqt"
logName = protName.split(".")[0] + "." + ligName.split(".")[0] + ".log"
# very unsafe commandline checking; needs updating
cmd.load(argv[-2], protName)
cmd.load(argv[-1], ligName)
# remove the ligand before calculating the center of mass
cmd.delete(ligName)
# load center of mass script
cmd.do("run /home/path/to/COM.py")
# calculate the center of mass and extents
(comX, comY, comZ) = COM(protName)
((maxX, maxY, maxZ), (minX, minY, minZ)) = cmd.get_extent(protName)
# print the command line
print "vina --receptor ", protName, " --ligand ", ligName, "--center_x ", str(comX), " --center_y ", str(comY),\
" --center_z ", str(comZ), " --size_x ", str(abs(maxX-minX)), " --size_y ", str(abs(maxY-minY)), " --size_z ", \
str(abs(maxZ-minZ)), " --all ", outName , " --exhaustiveness 200 --log ", logName, " \n"
Example
# execute the script
> pymol -cq ./makeVinaCommandFromProtein.py 1ia6_gh09.pdb glucose.pdb | grep vina
# the output
vina --receptor 1ia6_gh09.pdbqt --ligand glucose_dimer.pdbqt --center_x 1.86797851457 --center_y 17.7951449088 --center_z 65.2250072289 --size_x 55.9499988556 --size_y 49.7459993362 --size_z 58.1769981384 --all 1ia6_gh09.glucose_dimer.docked.pdbqt --exhaustiveness 100 --log 1ia6_gh09.glucose_dimer.log