In [1]:
from xmlrpclib import ServerProxy
from IPython.display import Image
import os, sys
In [2]:
import __main__
__main__.pymol_argv = [ 'pymol', '-x' ]
import pymol
pymol.finish_launching()
from pymol import cmd
In [3]:
from IPython.display import Image
In [17]:
# Визуализируем зону контакта 1lmp с лигандом
cmd.do('''
cd E:\public_html\term8\pr_1
set ray_trace_mode, 0; red
set ray_opaque_background, off
set antialias, .5
set light_count, 8
set ambient, 0.5
set ray_trace_color, red
set cartoon_side_chain_helper, on
fetch 1lmp
''')
In [5]:
cmd.do('''
remove solvent
extract ligands,het
as surface, 1lmp
set transparency,0.5
as sticks, ligands
show stick, byres(1lmp w. 4 of ligands)
center ligands
origin ligands
zoom ligands
dist hbo,1lmp,ligands,3.2,mode=2
select near_lig, 1lmp within 3.2 of ligands
label near_lig, resn,resi
set label_color, firebrick, near_lig
set label_color, black, hbo
color orange, ligands
color tv_red, 1lmp
ray
png pic1.png
''')
In [6]:
# Изображение зоны контакта
Image(filename='pic1.png')
Out[6]:
In [7]:
# Задание 2. Введем мутацию: заменим ASN 103 на GLY.
cmd.wizard("mutagenesis")
cmd.do("refresh_wizard")
cmd.get_wizard().set_mode("GLY")
cmd.get_wizard().do_select("103/")
cmd.frame(11)
cmd.get_wizard().apply()
cmd.wizard(None)
In [8]:
cmd.do('''
center ligands
origin ligands
zoom ligands
ray
png pic2.png
''')
In [9]:
Image(filename='pic2.png')
# Вверху слева ASN 103 заменен на GLY.
Out[9]:
In [10]:
# Задание 3. Создание анимационного ролика: совмещение белков + место мутации.
cmd.do('''
reinitialize
fetch 1lmp
''')
In [11]:
cmd.wizard("mutagenesis")
cmd.do("refresh_wizard")
cmd.get_wizard().set_mode("GLY")
cmd.get_wizard().do_select("103/")
cmd.frame(11)
cmd.get_wizard().apply()
cmd.wizard(None)
cmd.do('''
fetch 1lmp, new
''')
In [12]:
cmd.do('''
color marine, new
color firebrick, 1lmp
remove solvent
extract ligands,het
as cartoon, new
as cartoon, 1lmp
as sticks, ligands
color orange, ligands
show stick, resi 103
zoom all
center all
''')
In [13]:
# Прописываю раскадровку...
cmd.do('''
set matrix_mode, 1
set movie_panel, 1
set scene_buttons, 1
set cache_frames, 1
config_mouse three_button_motions, 1
mset 1-230
frame 1
translate [30,0,0], object=new
mview store
mview store, object=new
mview store, object=1lmp
frame 10
translate [-30,0,0], object=new
mview store
mview store, object=new
mview store, object=1lmp
mview interpolate, object=new
frame 50
orient ligands
mview store
mview store, object=new
mview store, object=1lmp
mview reinterpolate, object=new
mview reinterpolate, object=1lmp
frame 100
orient resi 103
label resi 103, resn,resi
set label_color, white
mview store
mview store, object=new
mview store, object=1lmp
frame 120
orient resi 103
hide (new)
mview store
mview store, object=new
mview store, object=1lmp
frame 140
orient resi 103
show (new)
as cartoon, new
label resi 103, resn,resi
show sticks, i. 103
mview store
mview store, object=new
mview store, object=1lmp
frame 200
mview reinterpolate, object=new
mview reinterpolate, object=1lmp
mplay
''')
In [27]:
# Задание 4. Присоединение метки к ASP 119 (находится на поверхности).
cmd.do('''
reinitialize
fetch 1lmp
fetch CID_2762604, compound
''')
In [28]:
# Присоединяем метку...
cmd.do('''
set ray_trace_mode, 0; red
set ray_opaque_background, off
set antialias, .5
set light_count, 8
set ambient, 0.5
set ray_trace_color, red
set cartoon_side_chain_helper, on
set stick_radius, 0.5
remove solvent
color firebrick, 1lmp
as cartoon, 1lmp
show sticks, i. 119
as sticks, compound
set_view (\
0.481463730, -0.215451851, 0.849567294,\
-0.653435826, -0.734250367, 0.184107974,\
0.584124088, -0.643774390, -0.494301081,\
-0.000183590, 0.000376124, -143.562362671,\
7.198918819, 56.109981537, 17.282592773,\
115.911651611, 171.311889648, -20.000000000 )
fuse /compound///UNK`0/O, /1lmp/A/A/ASP`119/OD2, mode=1
''')
In [29]:
## Крутим-вертим связь...
cmd.torsion(103)
cmd.do('''
ray
png pic3.png
''')
In [30]:
Image(filename='pic3.png')
Out[30]:
In [33]:
cmd.do('''
remove compound
zoom resi 119
orient resi 119
ray
png pic4.png
''')
In [34]:
Image(filename='pic4.png')
Out[34]:
In [47]:
# Задание 5. Поли-Leu спираль.
cmd.do('''
reinitialize
set ray_trace_mode, 0; red
set ray_opaque_background, off
set antialias, .5
set light_count, 8
set ambient, 0.5
set ray_trace_color, red
set cartoon_side_chain_helper, on
''')
cmd.fragment ("leu")
for x in range(2,101):
cmd.edit("resi "+ str(x)+" and name C")
cmd.editor.attach_amino_acid("pk1","leu")
cmd.edit("resi "+str(x)+" and name N", "resi "+str(x)+" and name CA")
cmd.torsion (-75)
cmd.edit("resi "+str(x)+" and name C", "resi "+str(x)+" and name CA")
cmd.torsion (150)
cmd.do ('''
zoom all
ray
png pic5.png
''')
In [48]:
Image(filename='pic5.png')
Out[48]:
In [63]:
# Задание 6. babel
# На kodomo воспользовался babel:
# echo 'C12C3C4C1C5C4C3C25 cubane' > my.smi
# obgen my.smi > my.mol
cmd.reinitialize()
cmd.load(my.mol)
#Никак не могу нормально загрузить файл my.mol(