新建
Drug-target binding affinity predict with transformerCPI
nickkk
赞
1
目录
数据集
AI4SCUP-CNS-BBB(v1)
点击:开始链接
选择gpu镜像 tcpi:notebook
代码
文本
Download source code from github
代码
文本
[1]
! git clone https://github.com/lifanchen-simm/transformerCPI2.0.git
Cloning into 'transformerCPI2.0'... remote: Enumerating objects: 77, done. remote: Counting objects: 100% (77/77), done. remote: Compressing objects: 100% (76/76), done. remote: Total 77 (delta 36), reused 2 (delta 0), pack-reused 0 Unpacking objects: 100% (77/77), 1.35 MiB | 680.00 KiB/s, done.
代码
文本
rename
代码
文本
[3]
! mv transformerCPI2.0/ tcpi
代码
文本
copy prepared checkpoint
代码
文本
[4]
! cp /root/transformerCPI2.0/tcpi.pt .
代码
文本
select kernel tcpi from upper right
代码
文本
[1]
import sys
sys.path.append('./tcpi/')
代码
文本
[5]
import torch
from predict import pack
from featurizer import featurizer
model = torch.load('tcpi.pt').to(0)
代码
文本
[8]
sequence = "MPHSSLHPSIPCPRGHGAQKAALVLLSACLVTLWGLGEPPEHTLRYLVLHLA" # Example protein sequence
smiles = "CS(=O)(C1=NN=C(S1)CN2C3CCC2C=C(C4=CC=CC=C4)C3)=O" # Example compound
代码
文本
Featurizer the data
代码
文本
[9]
compounds, adjacencies, proteins = featurizer(smiles, sequence)
代码
文本
predict
代码
文本
[10]
dataset = list(zip(compounds, adjacencies, proteins))
model.eval()
with torch.no_grad():
for data in dataset:
adjs, atoms, proteins = [], [], []
atom, adj, protein= data
adjs.append(adj)
atoms.append(atom)
proteins.append(protein)
data = pack(atoms,adjs,proteins, 0) ### do some data transfer
predicted_scores = model(data)
print(predicted_scores)
[0.6602165]
代码
文本
点个赞吧
推荐阅读
公开
Drug-target binding affinity predict with transformerCPInickkk
发布于 2023-08-03
公开
batched target fishing with TransformerCPInickkk
发布于 2023-09-25