import numpy as np
import copy
# Отображение структур
import IPython.display
import ipywidgets
from IPython.display import display,display_svg,SVG,Image
# Open Drug Discovery Toolkit
import oddt
import oddt.docking
import oddt.interactions
# Органика
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
import pmx # Модуль для манипулирования pdb
pdb=pmx.Model('pluslig.B99990001.pdb')
for r in pdb.residues[135:]:
print r #посмотрим остатки
newpdb = pdb.copy()
for r in newpdb.residues[-3:]:
newpdb.remove_residue(r)
lig = pdb.copy()
del lig.residues[:-3]
#будем считать за центр среднее по всем координатам
coordinates = []
for a in lig.atoms:
coordinates.append(a.x)
center = np.mean(coordinates,axis=0)
print(center)
newpdb.writePDB('newpdb.pdb')
lig.writePDB('lig.pdb')
prot = oddt.toolkit.readfile('pdb','newpdb.pdb').next()
prot.OBMol.AddPolarHydrogens()
prot.OBMol.AutomaticPartialCharge()
print 'is it the first mol in 1lmp is protein?',prot.protein,':) and MW of this mol is:', prot.molwt
print(' ¯\_(ツ)_/¯ ')
smiles = ['OC(=O)NC1C(C(C(OC1O)CO)O)O', #OH
'[NH3+]C(=O)NC1C(C(C(OC1O)CO)O)O', #NH3+
'C(=O)NC1C(C(C(OC1O)CO)O)O', #H
'C1=CC=[C]C=C1C(=O)NC1C(C(C(OC1O)CO)O)O', #PH
'[O-]C(=O)C(=O)NC1C(C(C(OC1O)CO)O)O'] #COO
#smiles = ['c1cccc(O)c1', 'c1c(O)ccc(O)c1','c1(O)cc(c2ccccc2)cc(O)c1']
mols= []
images =[]
for s in smiles:
m = oddt.toolkit.readstring('smi', s)
if not m.OBMol.Has3D():
m.make3D(forcefield='mmff94', steps=150)
m.removeh()
m.OBMol.AddPolarHydrogens()
mols.append(m)
###with print m.OBMol.Has3D() was found that:
### deep copy needed to keep 3D , write svg make mols flat
images.append((SVG(copy.deepcopy(m).write('svg'))))
display_svg(*images)
#create docking object
dock_obj = oddt.docking.AutodockVina.autodock_vina(
protein=prot, size=(20,20,20), center=center, num_modes = 5,
executable='/usr/bin/vina',autocleanup=True)
print dock_obj.tmp_dir
print " ".join(dock_obj.params) # Опишите выдачу
# do it
res = dock_obj.dock(mols,prot)
import pandas as pd
subs=['OH']*5+['NH3+']*5+['H']*5+['Ph']*5+['COO-']*5
tablet = np.array([[i,r.formula, r.data['vina_affinity'], r.data['vina_rmsd_ub'], r.residues[0].name] for i,r in enumerate(res)])
tablet=np.column_stack((tablet, subs))
tablet=pd.DataFrame(tablet)
tablet.columns=['number', 'formula','affinity','rmsd','res', 'replaced by']
tablet_sorted = tablet.sort_values(by='affinity', ascending=False)
print (tablet_sorted)
for i,r in enumerate(res):
hbs = oddt.interactions.hbonds(prot,r)
stack= oddt.interactions.pi_stacking(prot,r)
phob = oddt.interactions.hydrophobic_contacts(prot,r)
for i,r in enumerate(res):
r.write(filename='r%s.pdb' % i, format='pdb', overwrite=True)
Нас интересует №15 (наименьший показатель аффинности)
import __main__
__main__.pymol_argv = ['pymol','-qc'] # Pymol: quiet and no GUI
from time import sleep
import pymol
pymol.finish_launching()
pymol.cmd.reinitialize()
pymol.cmd.do('''
load r15.pdb
load newpdb.pdb
show cartoon, newpdb
hide lines, newpdb
show sticks, r15
orient
zoom r15, 10
png picture.png
''')
Image(filename='picture.png')
Мы могли бы применить RFscore и NNscore для подсчета score докинга; предсказывать аффиность с помощью svm и др. моделей.