In [1]:
import __main__
__main__.pymol_argv = [ 'pymol', '-x' ]
In [12]:
import pymol
import numpy as np
from IPython.display import Image
In [33]:
%%capture
pymol.finish_launching()
from pymol import cmd,stored
In [15]:
cmd.do('''
fetch 1cll, ascync=0
as lines, n. C+O+N+CA
zoom i. 4+5
mset 1 x1000
mview store
set ray_trace_mode, 3
bg_color white
ray
png 1_1.png''')
stored.r = [] 
cmd.iterate('1cll and n. CA','stored.r.append(resi)')
Image(filename='./1_1.png')
Out[15]:
In [16]:
length = len(stored.r)
colors = np.linspace(1,0.5, length)
for k,i in enumerate(stored.r):
    cmd.set_color('col%d' %k, [colors[k],0.5,0.75])
    print [1,1,colors[k]]
    cmd.set('cartoon_color','col%d' % k ,'resi %d' % i)
cmd.show_as('cartoon','all')
cmd.ray()
cmd.png('1_2.png')
Image(filename='./1_2.png')
Out[16]:

Работа с Pymol¶

Изменим структуру белка 1LMP с помощью механизма Sculpting. До:

In [17]:
cmd.reinitialize()
cmd.do('''
fetch 1LMP
remove resname hoh
set ray_trace_mode, 3
bg_color white
ray
png 2_1.png
''')
In [18]:
Image(filename='./2_1.png') 
Out[18]:

После:

In [21]:
Image(filename='./2_2.png')
Out[21]:

Проведем одиночную мутацию в белке, которая должна привести к потере связывания с лигандом. Для данного лизоцима наиболее важными являются каталитические остатки Glu35 и Asp52, согласно литературным данным.

In [22]:
cmd.reinitialize()
cmd.do('''
fetch 1LMP
remove resname hoh
select lig, (r. NAG + r. NDG)
select si, all within 5 of lig
show sticks, si
rotate x, 180
color grey70, elem C* and lig
select site, (i. 52 or i. 35) and chain A
show sticks, site
color hotpink, elem C* and site
orient si
rotate x, -50
rotate y, -20
set cartoon_transparensy, 0.5, all
set cartoon_side_chain_helper, 1
set ray_trace_mode, 1
bg_color white
ray
png 3_1.png
''')
Image(filename='./3_1.png')
Out[22]:

Исходя из структуры сайта связывания и литературных данных, я решила заменить остаток Asp52 на триптофан (чтобы наверняка).

In [23]:
Image(filename='./3_2.png')
Out[23]:

Мутация полностью нарушает геометрию сайта, что должно привести к неспособности связывать лиганд.

In [37]:
display(Image("./gga3970db71c.gif"))
<IPython.core.display.Image object>

In [40]:
display(Image(data=open('gga3970db71c.gif','rb').read(), format='png'))

Присоединим флуоресцентную метку TAMRA к белку через сложноэфирную связь к SER81.

In [28]:
cmd.load('./6tamra.sdf')
cmd.do('''
color grey70, elem C*
bg_color white
ray
png 4_1.png
''')
Image(filename='./4_1.png')
Out[28]:
In [30]:
cmd.reinitialize()
cmd.do('''
fetch 1LMP
remove resname hoh
set ray_trace_mode, 1
bg_color white
''')
cmd.load('./6tamra.sdf')
cmd.do('''
extract tamra_mod, (6tamra and id 2) or (6tamra and id 54)
select tamra29, 6tamra and id 29
select ser1, 1LMP and resi 81 and name OG
fuse tamra29, ser1
pick pkbond
torsion 0
orient 1LMP 
center ser1
show stick, 1LMP and resi 81
set cartoon_transparensy 0.5
set cartoon_side_chain_helper, 1
set ray_trace_mode, 1
bg_color white
rotate z, 120
rotate y, -180
hide label
''')
Image(filename='./4_2.png')
Out[30]:

Поли-аланиновая альфа-спираль.

In [31]:
cmd.reinitialize()
cmd.fragment('ala')

for i in range(2,101):
    cmd.do('''
    edit i. {} and n. C
    editor.attach_amino_acid("pk1","ala")
    set_dihedral i. {} and n. N, i. {} and n. CA, i. {} and n. C, i. {} and n. N, -48
    set_dihedral i. {} and n. C, i. {} and n. N, i. {} and n. CA, i. {} and n. C, -59'''.format(i, i,i,i,i+1,i,i+1,i+1,i+1))

cmd.do('''
alter (all),resi=str(int(resi)-1)
spectrum count, rainbow_rev, byres=1
bg_color white
zoom
ray
png 5.png
''')
Image(filename='./5.png')
Out[31]:

B-форма ДНК

In [32]:
cmd.reinitialize()
cmd.bg_color('white')
dna_length = 101
cmd.fetch('1bna', 'start')
cmd.show('spheres')
cmd.remove('resn HOH')
cmd.create('AT', 'c. B and i. 20 + c. A and i. 5') 
cmd.create('GC', 'c. B and i. 21 + c. A and i. 4') 
cmd.create('1', 'AT')
cmd.pair_fit('AT', 'GC')
trans = cmd.get_object_matrix('AT')
for i in range(2, dna_length):
    cmd.create('{0}'.format(i), '{0}'.format(i-1))
    cmd.transform_selection('{0}'.format(i), trans)
cmd.do('''
bg_color white
select all
hide spheres, sele
show sticks, sele
orient sele
ray
png 6.png
''')    
Image(filename='./6.png')
Out[32]:
In [ ]: