from xmlrpclib import ServerProxy
from IPython.display import Image
import os, sys
Подключаем PyMol
import __main__
__main__.pymol_argv = [ 'pymol', '-cp' ]
import pymol
pymol.finish_launching()
from pymol import cmd
Сделаем возможность получать изображения:
from IPython.display import Image
cmd.delete('all')
cmd.fetch('1lmp')
Подгрузилась структура лизоцима с PDB-кодом 1lmp, далее хочется показать зону контакта с лигандом, нужно вписать параметры:
cmd.do('''
bg_color white
remove solvent
extract ligands,het
as surface, 1lmp
set transparency,0.5
as sticks, ligands
show stick, byres(1lmp w. 4 of ligands)
origin ligands
label (n. CA and byres(1lmp w. 4 of ligands)), (resn, resi)
set label_color, black
dist hbo,1lmp,ligands,3.2,mode=2
ray
png pic1.png
''')
Image(filename='pic1.png')
cmd.do('''
reinitialize
load 1lmp
load CID_2762604, compound
bg_color black
as sticks, all
orient, all
show sticks
set valence, on
set valence_mode, 5
set stick_ball, on
set stick_ball_ratio, 2
set stick_radius, 0.12
set valence_mode, 2
set ray_trace_mode, 2
as cartoon, 1lmp
ray
show sticks, i. 119
as sticks, compound
fuse /compound///UNK`0/O, /1lmp/A/A/ASP`119/OD2, mode=1
ray
zoom compound
png pic4.png
''')
%%bash
echo 'CN(C)C1=CC2=C(C=C1)C(=C3C=CC(=[N+](C)C)C=C3O2)C4=C(C=CC(=C4)C(=O)[O-])C(=O)O' > tamra.smi
%%bash
obgen tamra.smi > tamra.mol
cmd.delete('all')
cmd.load('tamra.mol')
cmd.refresh()
cmd.do('''
bg_color black
as sticks, all
orient, all
show sticks
set valence, on
set valence_mode, 3
set stick_ball, on
set stick_ball_ratio, 3
set stick_radius, 0.12
set valence_mode, 2
set ray_trace_mode, 3
rotate x, -10
ray
png tamra.png
''')
Image(filename='tamra.png')
cmd.save('tamra.pdb')
Image(filename='pic4.png')
%%bash
echo 'C12C3C4C1C5C2C3C45' > cubane.smi
%%bash
obgen cubane.smi > cubane.mol
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
import __main__
__main__.pymol_argv = [ 'pymol', '-cp' ]
import pymol
pymol.finish_launching()
from pymol import cmd
cmd.delete('all')
cmd.load('cubane.mol')
cmd.refresh()
cmd.do('''
bg_color black
as sticks, all
orient, all
show sticks
set valence, on
set valence_mode, 3
set stick_ball, on
set stick_ball_ratio, 3
set stick_radius, 0.12
set valence_mode, 2
set ray_trace_mode, 3
ray
png pic5.png
''')
Image(filename='pic5.png')