Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的论文库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
基于Uni-Mol的分子对接
Deep Learning
中文
notebook
Deep Learning中文notebook
zhougm@dp.tech
发布于 2023-08-31
推荐镜像 :Uni-Mol:unimol-qsar:v0.5
推荐机型 :c3_m4_1 * NVIDIA T4
2
2
基于Uni-Mol的分子对接

基于Uni-Mol的分子对接

代码
文本
[16]
%%bash
# 选择镜像:unimol-qsar:unimolxxlatest, 机型选择GPU
# 拉取数据、代码和模型权重
rm -rf CASF-2016.tar.gz
rm -rf CASF-2016
rm -rf binding_pose_220908.pt
rm -rf docking.tar.gz
rm -rf docking
wget -nv https://bohrium-example.oss-cn-zhangjiakou.aliyuncs.com/unimol-docking/CASF-2016.tar.gz
wget -nv https://bohrium-example.oss-cn-zhangjiakou.aliyuncs.com/unimol-docking/binding_pose_220908.pt
wget -nv https://bohrium-example.oss-cn-zhangjiakou.aliyuncs.com/unimol-docking/docking.tar.gz
tar --no-same-owner -xzf "CASF-2016.tar.gz"
tar --no-same-owner -xzf "docking.tar.gz"
cd docking
python setup.py install
pip install -q biopandas -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn
pip install -q py3Dmol -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn
pip install -q ipywidgets -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn
2024-04-28 13:31:04 URL:https://bohrium-example.oss-cn-zhangjiakou.aliyuncs.com/unimol-docking/CASF-2016.tar.gz [39434267/39434267] -> "CASF-2016.tar.gz" [1]
2024-04-28 13:31:38 URL:https://bohrium-example.oss-cn-zhangjiakou.aliyuncs.com/unimol-docking/binding_pose_220908.pt [435265981/435265981] -> "binding_pose_220908.pt" [1]
2024-04-28 13:31:38 URL:https://bohrium-example.oss-cn-zhangjiakou.aliyuncs.com/unimol-docking/docking.tar.gz [72258/72258] -> "docking.tar.gz" [1]
running install
running bdist_egg
running egg_info
creating unimol_docking.egg-info
writing unimol_docking.egg-info/PKG-INFO
writing dependency_links to unimol_docking.egg-info/dependency_links.txt
writing requirements to unimol_docking.egg-info/requires.txt
writing top-level names to unimol_docking.egg-info/top_level.txt
writing manifest file 'unimol_docking.egg-info/SOURCES.txt'
reading manifest file 'unimol_docking.egg-info/SOURCES.txt'
writing manifest file 'unimol_docking.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/unimol_docking
copying unimol_docking/infer.py -> build/lib/unimol_docking
copying unimol_docking/__init__.py -> build/lib/unimol_docking
creating build/lib/unimol_docking/models
copying unimol_docking/models/docking_pose.py -> build/lib/unimol_docking/models
copying unimol_docking/models/unimol.py -> build/lib/unimol_docking/models
copying unimol_docking/models/__init__.py -> build/lib/unimol_docking/models
copying unimol_docking/models/transformer_encoder_with_pair.py -> build/lib/unimol_docking/models
creating build/lib/unimol_docking/tasks
copying unimol_docking/tasks/docking_pose.py -> build/lib/unimol_docking/tasks
copying unimol_docking/tasks/unimol.py -> build/lib/unimol_docking/tasks
copying unimol_docking/tasks/__init__.py -> build/lib/unimol_docking/tasks
creating build/lib/unimol_docking/losses
copying unimol_docking/losses/docking_pose.py -> build/lib/unimol_docking/losses
copying unimol_docking/losses/unimol.py -> build/lib/unimol_docking/losses
copying unimol_docking/losses/__init__.py -> build/lib/unimol_docking/losses
copying unimol_docking/losses/cross_entropy.py -> build/lib/unimol_docking/losses
copying unimol_docking/losses/reg_loss.py -> build/lib/unimol_docking/losses
creating build/lib/unimol_docking/utils
copying unimol_docking/utils/docking_utils.py -> build/lib/unimol_docking/utils
copying unimol_docking/utils/__init__.py -> build/lib/unimol_docking/utils
copying unimol_docking/utils/docking.py -> build/lib/unimol_docking/utils
copying unimol_docking/utils/coordinate_model.py -> build/lib/unimol_docking/utils
creating build/lib/unimol_docking/data
copying unimol_docking/data/data_utils.py -> build/lib/unimol_docking/data
copying unimol_docking/data/atom_type_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/distance_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/prepend_and_append_2d_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/mask_points_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/cropping_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/conformer_sample_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/tta_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/normalize_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/__init__.py -> build/lib/unimol_docking/data
copying unimol_docking/data/from_str_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/remove_hydrogen_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/key_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/lmdb_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/coord_pad_dataset.py -> build/lib/unimol_docking/data
copying unimol_docking/data/add_2d_conformer_dataset.py -> build/lib/unimol_docking/data
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/unimol_docking
creating build/bdist.linux-x86_64/egg/unimol_docking/models
copying build/lib/unimol_docking/models/docking_pose.py -> build/bdist.linux-x86_64/egg/unimol_docking/models
copying build/lib/unimol_docking/models/unimol.py -> build/bdist.linux-x86_64/egg/unimol_docking/models
copying build/lib/unimol_docking/models/__init__.py -> build/bdist.linux-x86_64/egg/unimol_docking/models
copying build/lib/unimol_docking/models/transformer_encoder_with_pair.py -> build/bdist.linux-x86_64/egg/unimol_docking/models
copying build/lib/unimol_docking/infer.py -> build/bdist.linux-x86_64/egg/unimol_docking
creating build/bdist.linux-x86_64/egg/unimol_docking/tasks
copying build/lib/unimol_docking/tasks/docking_pose.py -> build/bdist.linux-x86_64/egg/unimol_docking/tasks
copying build/lib/unimol_docking/tasks/unimol.py -> build/bdist.linux-x86_64/egg/unimol_docking/tasks
copying build/lib/unimol_docking/tasks/__init__.py -> build/bdist.linux-x86_64/egg/unimol_docking/tasks
creating build/bdist.linux-x86_64/egg/unimol_docking/losses
copying build/lib/unimol_docking/losses/docking_pose.py -> build/bdist.linux-x86_64/egg/unimol_docking/losses
copying build/lib/unimol_docking/losses/unimol.py -> build/bdist.linux-x86_64/egg/unimol_docking/losses
copying build/lib/unimol_docking/losses/__init__.py -> build/bdist.linux-x86_64/egg/unimol_docking/losses
copying build/lib/unimol_docking/losses/cross_entropy.py -> build/bdist.linux-x86_64/egg/unimol_docking/losses
copying build/lib/unimol_docking/losses/reg_loss.py -> build/bdist.linux-x86_64/egg/unimol_docking/losses
copying build/lib/unimol_docking/__init__.py -> build/bdist.linux-x86_64/egg/unimol_docking
creating build/bdist.linux-x86_64/egg/unimol_docking/utils
copying build/lib/unimol_docking/utils/docking_utils.py -> build/bdist.linux-x86_64/egg/unimol_docking/utils
copying build/lib/unimol_docking/utils/__init__.py -> build/bdist.linux-x86_64/egg/unimol_docking/utils
copying build/lib/unimol_docking/utils/docking.py -> build/bdist.linux-x86_64/egg/unimol_docking/utils
copying build/lib/unimol_docking/utils/coordinate_model.py -> build/bdist.linux-x86_64/egg/unimol_docking/utils
creating build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/data_utils.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/atom_type_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/distance_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/prepend_and_append_2d_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/mask_points_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/cropping_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/conformer_sample_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/tta_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/normalize_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/__init__.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/from_str_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/remove_hydrogen_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/key_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/lmdb_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/coord_pad_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
copying build/lib/unimol_docking/data/add_2d_conformer_dataset.py -> build/bdist.linux-x86_64/egg/unimol_docking/data
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/models/docking_pose.py to docking_pose.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/models/unimol.py to unimol.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/models/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/models/transformer_encoder_with_pair.py to transformer_encoder_with_pair.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/infer.py to infer.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/tasks/docking_pose.py to docking_pose.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/tasks/unimol.py to unimol.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/tasks/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/losses/docking_pose.py to docking_pose.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/losses/unimol.py to unimol.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/losses/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/losses/cross_entropy.py to cross_entropy.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/losses/reg_loss.py to reg_loss.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/utils/docking_utils.py to docking_utils.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/utils/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/utils/docking.py to docking.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/utils/coordinate_model.py to coordinate_model.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/data_utils.py to data_utils.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/atom_type_dataset.py to atom_type_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/distance_dataset.py to distance_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/prepend_and_append_2d_dataset.py to prepend_and_append_2d_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/mask_points_dataset.py to mask_points_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/cropping_dataset.py to cropping_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/conformer_sample_dataset.py to conformer_sample_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/tta_dataset.py to tta_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/normalize_dataset.py to normalize_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/from_str_dataset.py to from_str_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/remove_hydrogen_dataset.py to remove_hydrogen_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/key_dataset.py to key_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/lmdb_dataset.py to lmdb_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/coord_pad_dataset.py to coord_pad_dataset.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/unimol_docking/data/add_2d_conformer_dataset.py to add_2d_conformer_dataset.cpython-38.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying unimol_docking.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying unimol_docking.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying unimol_docking.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying unimol_docking.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying unimol_docking.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
/opt/conda/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/opt/conda/lib/python3.8/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
zip_safe flag not set; analyzing archive contents...
unimol_docking.losses.__pycache__.__init__.cpython-38: module references __file__
unimol_docking.tasks.__pycache__.__init__.cpython-38: module references __file__
creating dist
creating 'dist/unimol_docking-1.0.0-py3.8.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing unimol_docking-1.0.0-py3.8.egg
removing '/opt/conda/lib/python3.8/site-packages/unimol_docking-1.0.0-py3.8.egg' (and everything under it)
creating /opt/conda/lib/python3.8/site-packages/unimol_docking-1.0.0-py3.8.egg
Extracting unimol_docking-1.0.0-py3.8.egg to /opt/conda/lib/python3.8/site-packages
unimol-docking 1.0.0 is already the active version in easy-install.pth

Installed /opt/conda/lib/python3.8/site-packages/unimol_docking-1.0.0-py3.8.egg
Processing dependencies for unimol-docking==1.0.0
Searching for pandas==1.3.5
Best match: pandas 1.3.5
Adding pandas 1.3.5 to easy-install.pth file

Using /opt/conda/lib/python3.8/site-packages
Searching for numpy==1.20.3
Best match: numpy 1.20.3
Adding numpy 1.20.3 to easy-install.pth file
Installing f2py script to /opt/conda/bin
Installing f2py3 script to /opt/conda/bin
Installing f2py3.8 script to /opt/conda/bin

Using /opt/conda/lib/python3.8/site-packages
Searching for pytz==2022.1
Best match: pytz 2022.1
Adding pytz 2022.1 to easy-install.pth file

Using /opt/conda/lib/python3.8/site-packages
Searching for python-dateutil==2.8.2
Best match: python-dateutil 2.8.2
Adding python-dateutil 2.8.2 to easy-install.pth file

Using /opt/conda/lib/python3.8/site-packages
Searching for six==1.16.0
Best match: six 1.16.0
Adding six 1.16.0 to easy-install.pth file

Using /opt/conda/lib/python3.8/site-packages
Finished processing dependencies for unimol-docking==1.0.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
代码
文本
[17]
# 载入相关的库
import sys
sys.path.append('/opt/conda/lib/python3.8/site-packages/unimol_docking-1.0.0-py3.8.egg')
from unimol_docking.utils.docking_utils import (
docking_data_pre,
ensemble_iterations,
write_lmdb,
generate_docking_input
)
from tqdm import tqdm
from rdkit import Chem
import subprocess
import py3Dmol
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import pickle
import json
import copy
import os
from ipywidgets import widgets,Layout,HBox,VBox
代码
文本
[4]
# docking函数,传入pdb_id 以及对应的smiles即可
def call_unimol_docking(pdb_id, smiles):
data_path = "./CASF-2016"
seed = 42
results_path = "./results"
os.makedirs(results_path, exist_ok=True)
smiles_list = smiles.split(",")
print("generate predict data...")
write_lmdb(data_path, pdb_id, smiles_list, seed=seed)
print("model inference...")
cmd = ' '.join(['export MKL_SERVICE_FORCE_INTEL=1',
'&&',
'python ./docking/unimol_docking/infer.py',
'--user-dir ./docking/unimol_docking {}'.format(data_path),
'--valid-subset {} --results-path {}'.format(pdb_id, results_path),
'--num-workers 8 --ddp-backend=c10d --batch-size 8 --task docking_pose',
'--loss docking_pose --arch docking_pose --path ./binding_pose_220908.pt',
'--fp16 --fp16-init-scale 4 --fp16-scale-window 256',
'--dist-threshold 8.0 --recycling 3 --log-interval 50 --log-format simple',
])
os.system(cmd)
print("docking ...")
predict_file = os.path.join(results_path, pdb_id + ".out.pkl")
reference_file = os.path.join(data_path, pdb_id + ".lmdb")
generate_docking_input(
predict_file, reference_file, tta_times=10, output_dir=results_path
)
print("visualization ...")
for i, smiles in enumerate(smiles_list[:1]):
print("Docking {}".format(smiles))
input_path = os.path.join(results_path, "{}.{}.pkl".format(pdb_id, i))
ligand_path = os.path.join(results_path, "docking.{}.{}.sdf".format(pdb_id, i))
cmd = "export MKL_THREADING_LAYER=GNU"
cmd += "&& python ./docking/unimol_docking/utils/coordinate_model.py --input {} --output-ligand {}".format(
input_path, ligand_path
)
subprocess.call(cmd, shell=True)

pdb_path = os.path.join(data_path, 'casf2016', pdb_id+'_protein.pdb')
ligand_path = os.path.join(results_path, "docking.{}.{}.sdf".format(pdb_id,0))
gt_ligand_path = os.path.join(data_path,'casf2016',pdb_id+'_ligand.sdf')
view = py3Dmol.view()
view.removeAllModels()
pdb_path = os.path.join(data_path, 'casf2016', pdb_id+'_protein.pdb')
view.addModel(open(pdb_path,'r').read(),format='pdb')
view.setStyle({'cartoon': {'arrows':True, 'tubes':False, 'style':'oval', 'color':'white'}})
view.addSurface(py3Dmol.VDW,{'opacity':0.5,'color':'white'})

view.addModel(open(ligand_path,'r').read(),format='sdf')
ref_m = view.getModel()
ref_m.setStyle({},{'stick':{'colorscheme':'greenCarbon','radius':0.2}})

view.zoomTo(viewer=(100,0))
view.show()

view.removeAllModels()
view.addModel(open(ligand_path,'r').read(),format='sdf')
ref_m = view.getModel()
ref_m.setStyle({},{'stick':{'colorscheme':'greenCarbon','radius':0.2}})

view.addModel(open(gt_ligand_path,'r').read(),format='sdf')
ref_m = view.getModel()
ref_m.setStyle({},{'stick':{'colorscheme':'redCarbon','radius':0.2}})

view.zoomTo(viewer=(100,0))
view.show()
代码
文本
  • 目前支持CSAF-2016里面的靶点,默认会选择其对应的分子进行对接;
  • 如果想对接其他分子,可以直接修改smiles的输入;
  • 如果想对接多个分子,输入smiles,并且用逗号间隔即可;
  • 后续会支持更多的场景,包括上传蛋白、辅助筛选口袋、自定义docking;
代码
文本
[5]
data_path = "./CASF-2016"
casf_collect = os.listdir(os.path.join(data_path, "casf2016"))
casf_collect = list(set([item[:4] for item in casf_collect]))

pdb_selector = widgets.SelectMultiple(
options=casf_collect,
value=[np.random.choice(casf_collect)],
row=8,
description='请选择靶点:',
disable=False
)
pdb_label = widgets.Label(value='已选择靶点:')
smiles_label = widgets.Label(value='默认Dock分子: ')
smiles_text = widgets.Text(
description='选择其他分子: ',
layout=Layout(width='36%', height='30px'),
)
submiter = widgets.Button(
description='选择',
button_style='success',
layout=Layout(width='36%', height='30px'),
)
def btn_click(sender):
pdb_id = pdb_selector.value[0]
pdb_label.value='已选择靶点: '+ pdb_selector.value[0]
supp = Chem.SDMolSupplier(os.path.join(data_path, "casf2016", pdb_id + "_ligand.sdf"))
mol = [mol for mol in supp if mol][0]
ori_smiles = Chem.MolToSmiles(mol)
smiles_label.value = '默认Dock分子: '+ori_smiles
submiter.on_click(btn_click)
display(HBox([pdb_selector,
VBox([pdb_label,
smiles_label])]
)
)
display(submiter)
代码
文本
  • 可视化展示的是unimol预测的分子对接效果,上图是unimol预测的分子位置,下图是与真实晶体中的位置进行的比较;
代码
文本
[6]
### docking ####
### 你可以指定自定义的smiles,传入smiles即可
pdb_id = pdb_selector.value[0]
smiles = smiles_label.value.split(': ')[-1]
call_unimol_docking(pdb_id, smiles)
generate predict data...
model inference...
Error: mkl-service + Intel(R) MKL: MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library.
	Try to import numpy first or set the threading layer accordingly. Set MKL_SERVICE_FORCE_INTEL to force it.
2023-04-11 19:55:12 | INFO | numexpr.utils | Note: NumExpr detected 16 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
2023-04-11 19:55:12 | INFO | numexpr.utils | NumExpr defaulting to 8 threads.
2023-04-11 19:55:12 | INFO | unimol_docking.inference | loading model(s) from ./binding_pose_220908.pt
2023-04-11 19:55:15 | INFO | unimol_docking.tasks.docking_pose | ligand dictionary: 30 types
2023-04-11 19:55:15 | INFO | unimol_docking.tasks.docking_pose | pocket dictionary: 9 types
2023-04-11 19:55:18 | INFO | unicore.tasks.unicore_task | get EpochBatchIterator for epoch 1
2023-04-11 19:55:20 | INFO | unimol_docking.inference | Done inference! 
docking ...
visualization ...
Docking NS(=O)(=O)c1ccccc1F
2weg-NS(=O)(=O)c1ccccc1F-RMSD:22.9571-0.074-0.2547
代码
文本
[ ]

代码
文本
Deep Learning
中文
notebook
Deep Learning中文notebook
点个赞吧
推荐阅读
公开
基于Uni-Mol的分子对接
Uni-MolDeep Learning
Uni-MolDeep Learning
Zhifeng Gao
发布于 2023-09-14
1 赞
公开
基于Uni-Mol的分子性质预测
Uni-MolDeep Learning
Uni-MolDeep Learning
Zhifeng Gao
更新于 2024-07-17
7 赞8 转存文件