gpt4 book ai didi

python - 使用 rdkit 或其他 python 模块将 SMILES 转换为化学名称或 IUPAC 名称

转载 作者:行者123 更新时间:2023-12-03 23:43:30 29 4
gpt4 key购买 nike

有没有办法使用 RDKit 或其他 python 模块将 SMILES 转换为化学名称或 IUPAC 名称?
我在其他帖子中找不到非常有用的东西。
非常感谢你!

最佳答案

据我所知,使用 rdkit 是不可能的,而且我不知道任何具有这种能力的 python 模块。如果您可以使用 Web 服务,您可以使用 NCI resolver .
这是一个从 SMILES 字符串中检索 IUPAC 标识符的函数的简单实现:

import requests


CACTUS = "https://cactus.nci.nih.gov/chemical/structure/{0}/{1}"


def smiles_to_iupac(smiles):
rep = "iupac_name"
url = CACTUS.format(smiles, rep)
response = requests.get(url)
response.raise_for_status()
return response.text


print(smiles_to_iupac('c1ccccc1'))
print(smiles_to_iupac('CC(=O)OC1=CC=CC=C1C(=O)O'))

[Out]:
BENZENE
2-acetyloxybenzoic acid
您可以轻松扩展它以转换多种不同的格式,尽管该功能并不完全快速......
另一种解决方案是使用 PubChem。您可以将 API 与 python 包 pubchempy 一起使用.请记住,这可能会返回多种化合物。
import pubchempy


# Use the SMILES you provided
smiles = 'O=C(NCc1ccc(C(F)(F)F)cc1)[C@@H]1Cc2[nH]cnc2CN1Cc1ccc([N+](=O)[O-])cc1'
compounds = pubchempy.get_compounds(smiles, namespace='smiles')
match = compounds[0]
print(match.iupac_name)

[Out]:
(6S)-5-[(4-nitrophenyl)methyl]-N-[[4-(trifluoromethyl)phenyl]methyl]-3,4,6,7-tetrahydroimidazo[4,5-c]pyridine-6-carboxamide

关于python - 使用 rdkit 或其他 python 模块将 SMILES 转换为化学名称或 IUPAC 名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64329049/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com