我正在学习rdkit。目前我想从蛋白质中对接的配体中提取信息。我面临的问题是,无论实际类型如何,配体的键总是返回为“单一”,而蛋白质的键类型则返回得很好。
有人知道我错过了什么吗?
对于下面的代码示例,我正在查看 P38 激酶,2GHL PDB 文件,配体的名称为“LIB”。但我在尝试过的所有 PDB 文件中都发现了同样的问题。
我的策略分为三步:
from rdkit import Chem
# Specify the path to your PDB file
pdb_file = "path\\2ghl.pdb"
# Load the PDB file using the Chem module
mol = Chem.MolFromPDBFile(pdb_file)
# Create empty lists to store ligand and protein atoms
ligand_atoms = []
for i in range(len(mol.GetAtoms())):
residue_name = mol.GetAtomWithIdx(i).GetPDBResidueInfo().GetResidueName()
if residue_name == "LIB":
ligand_atoms.append(mol.GetAtomWithIdx(i))
# Find index of first and last atom of the ligand
first_atom_idx = ligand_atoms[0].GetIdx()
last_atom_idx = ligand_atoms[len(ligand_atoms)-1].GetIdx()
# Return bond type between each atom of the ligand if there is a bond
for i in range(first_atom_idx, last_atom_idx+1):
for j in range(i+1, last_atom_idx+1):
if mol.GetBondBetweenAtoms(i, j):
print(mol.GetAtomWithIdx(i).GetSymbol(), " ", i, ", ",
mol.GetAtomWithIdx(j).GetSymbol(), " ", j, ": ",
mol.GetBondBetweenAtoms(i, j).GetBondType())
这是输出:
分子中含有双键和芳香键:
不知道你错过了什么,PDB格式可能是这样工作的,
在这里看到一个很好的网页,描述了各种文件格式,其中指出:
这可能是课程中最无聊的部分。 然而,了解化学结构如何以不同格式编码非常有用,因为不同的软件通常具有不同的“默认”文件格式,并且了解这些格式能够(或不能)做什么可能很有用。
关于 PDB 文件格式:
注意 一般来说,在计算化学中最好避免使用 pdb 文件,而 mol2 等格式对于存储结构更可靠。对于小分子尤其如此,例如您将在蛋白质-配体对接计算中使用的配体。 此 mol2 文件的一个重要原因是同时包含分子连接性和键类型/顺序(上例中的 @BOND 部分),因此原子键合的方式是明确定义的,不需要由软件。对于存在的不同版本的 pdb 文件而言,情况并非总是如此,并且可能会导致您可能使用的不同软件包对分子结构的误解。
关于仅使用依赖于化学成分词典的RCSB蛋白质数据库(RCSB PDB)提供的数据的问题/问题:
wwPDB 化学成分字典 (CCD) 使用独特的标识符 CCD ID 和详细的化学描述定义了 PDB 中发现的每个独特的小分子配体(Westbrook 等人,2015)。每个独特定义的 CCD 配体可能存在于多个 PDB 结构中,并且可能在一个 PDB 结构内具有多个副本。
我最终得到了两个解决方案:
第一个使用化学成分词典:mmCIF(纯文本),我不知道更新频率和GemmiCIF解析器
import rdkit
print('RDKit Version : ', rdkit.__version__)
from rdkit import Chem
from gemmi import cif
path ='components.cif'
try:
doc = cif.read_file(path) # copy all the data from mmCIF file
print(doc)
for block in doc :
if block.name == 'LIB':
print('\n\n')
print(block.name)
print('\n\n')
print(block)
descriptor = block.find('_pdbx_chem_comp_descriptor.',
['comp_id', 'type', 'program', 'program_version', 'descriptor'])
print(descriptor)
descriptor2 = block.get_mmcif_category('_pdbx_chem_comp_descriptor.')
print('\n\n',descriptor2)
for row in descriptor :
if row[1] == 'SMILES':
print(row)
smiles = row[4].strip('\"')
# mol = None
mol = Chem.MolFromSmiles(smiles)
break
except :
print('something went wrong')
if mol != None :
# Create empty lists to store ligand and protein atoms
ligand_atoms = []
for i in range(len(mol.GetAtoms())):
ligand_atoms.append(mol.GetAtomWithIdx(i))
# Find index of first and last atom of the ligand
first_atom_idx = ligand_atoms[0].GetIdx()
last_atom_idx = ligand_atoms[len(ligand_atoms)-1].GetIdx()
# Return bond type between each atom of the ligand if there is a bond
for i in range(first_atom_idx, last_atom_idx+1):
for j in range(i+1, last_atom_idx+1):
if mol.GetBondBetweenAtoms(i, j):
print(mol.GetAtomWithIdx(i).GetSymbol(), " ", i, ", ",
mol.GetAtomWithIdx(j).GetSymbol(), " ", j, ": ",
mol.GetBondBetweenAtoms(i, j).GetBondType())
不知道这是否是使用该工具的最佳方式,但给出了所需的结果。在我的机器上速度有点慢,因为“components.cif”大约为 405MB。
一些输出:
....
.......
<gemmi.cif.Table.Row: LIB SMILES ACDLabs 10.04 "Clc1ccccc1NC(=O)N(c2nc(ncc2)NC(C(O)(C)C)C)c3ccc(OC)cc3">
Cl 0 , C 1 : SINGLE
C 1 , C 2 : AROMATIC
C 1 , C 6 : AROMATIC
C 2 , C 3 : AROMATIC
C 3 , C 4 : AROMATIC
C 4 , C 5 : AROMATIC
C 5 , C 6 : AROMATIC
C 6 , N 7 : SINGLE
N 7 , C 8 : SINGLE
C 8 , O 9 : DOUBLE
C 8 , N 10 : SINGLE
N 10 , C 11 : SINGLE
N 10 , C 24 : SINGLE
C 11 , N 12 : AROMATIC
C 11 , C 16 : AROMATIC
N 12 , C 13 : AROMATIC
C 13 , N 14 : AROMATIC
C 13 , N 17 : SINGLE
N 14 , C 15 : AROMATIC
C 15 , C 16 : AROMATIC
N 17 , C 18 : SINGLE
C 18 , C 19 : SINGLE
C 18 , C 23 : SINGLE
C 19 , O 20 : SINGLE
C 19 , C 21 : SINGLE
C 19 , C 22 : SINGLE
C 24 , C 25 : AROMATIC
C 24 , C 31 : AROMATIC
C 25 , C 26 : AROMATIC
C 26 , C 27 : AROMATIC
C 27 , O 28 : SINGLE
C 27 , C 30 : AROMATIC
O 28 , C 29 : SINGLE
C 30 , C 31 : AROMATIC
第二个使用 RCSB PDB Data API ,因此您需要互联网连接才能使用 Python Requests 库:
import rdkit
print('RDKit Version : ', rdkit.__version__)
from rdkit import Chem
import requests
try :
risposta = requests.get('https://data.rcsb.org/rest/v1/core/chemcomp/LIB')
print(risposta.status_code)
print(type(risposta.json()))
smiles = risposta.json()['rcsb_chem_comp_descriptor']['smiles']
print('\nsmiles : ', smiles)
# print(risposta.json())
except:
print('something went wrong')
if smiles != None :
mol = Chem.MolFromSmiles(smiles)
# Create empty lists to store ligand and protein atoms
ligand_atoms = []
for i in range(len(mol.GetAtoms())):
ligand_atoms.append(mol.GetAtomWithIdx(i))
# Find index of first and last atom of the ligand
first_atom_idx = ligand_atoms[0].GetIdx()
last_atom_idx = ligand_atoms[len(ligand_atoms)-1].GetIdx()
# Return bond type between each atom of the ligand if there is a bond
for i in range(first_atom_idx, last_atom_idx+1):
for j in range(i+1, last_atom_idx+1):
if mol.GetBondBetweenAtoms(i, j):
print(mol.GetAtomWithIdx(i).GetSymbol(), " ", i, ", ",
mol.GetAtomWithIdx(j).GetSymbol(), " ", j, ": ",
mol.GetBondBetweenAtoms(i, j).GetBondType())
带输出:
......
..........
smiles : CC(C(C)(C)O)Nc1nccc(n1)N(c2ccc(cc2)OC)C(=O)Nc3ccccc3Cl
C 0 , C 1 : SINGLE
C 1 , C 2 : SINGLE
C 1 , N 6 : SINGLE
C 2 , C 3 : SINGLE
C 2 , C 4 : SINGLE
C 2 , O 5 : SINGLE
N 6 , C 7 : SINGLE
C 7 , N 8 : AROMATIC
C 7 , N 12 : AROMATIC
N 8 , C 9 : AROMATIC
C 9 , C 10 : AROMATIC
C 10 , C 11 : AROMATIC
C 11 , N 12 : AROMATIC
C 11 , N 13 : SINGLE
N 13 , C 14 : SINGLE
N 13 , C 22 : SINGLE
C 14 , C 15 : AROMATIC
C 14 , C 19 : AROMATIC
C 15 , C 16 : AROMATIC
C 16 , C 17 : AROMATIC
C 17 , C 18 : AROMATIC
C 17 , O 20 : SINGLE
C 18 , C 19 : AROMATIC
O 20 , C 21 : SINGLE
C 22 , O 23 : DOUBLE
C 22 , N 24 : SINGLE
N 24 , C 25 : SINGLE
C 25 , C 26 : AROMATIC
C 25 , C 30 : AROMATIC
C 26 , C 27 : AROMATIC
C 27 , C 28 : AROMATIC
C 28 , C 29 : AROMATIC
C 29 , C 30 : AROMATIC
C 30 , Cl 31 : SINGLE
注意两个LIB分子SMILES解析并获取的事实
在原子排序方面有所不同,“components.cif”和RCSB PDB Data API都携带/公开了不止一种(由不同软件SMILES生成),请随意探索API和LIB配体的字典。
您可以使用 Ligand Expo 下载不同格式的所有配体 请参阅 Ligand Expo 下载。
请注意,我不是这方面的专家,即我不知道是否有任何 API 可以下载
mol
RCSB 蛋白质数据库 (RCSB PDB) 中的配体格式,即使配体 SMILES是词典索引 mmcif_pdbx.dic 的一部分或将来会是。
关于为什么不同软件提供的同一分子有不同的微笑,这也是另一个问题,可能更适合Chemistry Stack Exchange