from xmlrpclib import ServerProxy
from IPython.display import Image
import os, sys
import scipy as sp
from scipy import constants
from scipy.constants import codata
import numpy as np
%%bash
echo "CC(=O)N[C@H]1C(O)O[C@H](CO)[C@@H](O)[C@@H]1O">nag.smi
obgen nag.smi > nag.mol
babel -imol nag.mol -opdb nag.pdb
%%bash
export PYTHONPATH=${PYTHONPATH}:/home/preps/golovin/.local_numpy/lib/python2.7/site-packages:/home/preps/golovin/.local_numpy/lib/python2.7/dist-packages
export PATH=${PATH}:/home/preps/golovin/progs/bin
%%bash
prepare_ligand4.py -h
%%bash
prepare_receptor4.py -r model_4.pdb
from xmlrpclib import ServerProxy
from IPython.display import Image
import os, sys, time
# pymol launching
import __main__
__main__.pymol_argv = [ 'pymol', '-cp' ]
# __main__.pymol_argv = [ 'pymol', '-x' ] # for GUI
import pymol
from pymol import cmd
pymol.finish_launching()
cmd.do('''
load model_4.pdb
pseudoatom mass_center, /model_4///*32/OE2 or /model_4///*102/O or /mosel_4///*60/OH
select mass_center
print cmd.get_atom_coords('mass_center')
''')
%%bash
echo "center_x=44.4
center_y=43
center_z=28.9
size_x = 25
size_y = 25
size_z = 25
num_modes = 20
" > vina.cfg
%%bash
date
vina --config vina.cfg --receptor model_4.pdbqt --ligand nag.pdbqt --out nag_prot.pdbqt --log nag_prot.log
date
#mode | affinity | dist from best mode
# | (kcal/mol) | rmsd l.b.| rmsd u.b.
#-----+------------+----------+----------
# 1 -5.2 0.000 0.000
# 2 -4.7 8.597 9.920
# 3 -4.1 10.411 11.919
defaultImage = 'pymolimg.png'
def prepareImage(width=300, height=300, sleep=5, filename=defaultImage):
## To save the rendered image
cmd.ray(width, height)
cmd.png('pymolimg.png')
time.sleep(sleep)
# Define some shortcuts
def focus(x):
cmd.center(x)
cmd.zoom(x)
cmd.do('''
reinit
bg white
load nag_prot.pdbqt
load model_4.pdb
show surface, model_4
set transparency, 0.5
show sticks, nag_prot
split_states nag_prot, 1, 20, prefix=conf
rotate x, 50, all, 0
rotate y, -90, all, 0
zoom all
ray
png pic1.png
''')
Image(filename='pic1.png')
%%bash
python /usr/share/pyshared/AutoDockTools/Utilities24/prepare_flexreceptor4.py -r model_4.pdbqt -s GLU32_TYR60_ALA102
date
vina --config vina.cfg --receptor model_4_rigid.pdbqt --flex model_4_flex.pdbqt --ligand nag.pdbqt --out nag_model_4_2.pdbqt --log nag_model_4_2.log
date